summaryrefslogtreecommitdiff
path: root/arch/arm/soc/ti_lm3s6965/scp.c
blob: 291b3acf18e02f535f433e86c83da0684017ed16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * Copyright (c) 2013-2014 Wind River Systems, Inc.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @file
 * @brief TI LM3S6965 System Control Peripherals interface
 *
 *
 * Library for controlling target-specific devices present in the 0x400fe000
 * peripherals memory region.
 *
 * Currently, only enabling the main OSC with default value is implemented.
 */

#include <stdint.h>
#include <toolchain.h>
#include <sections.h>

#include "scp.h"

/* System Control Peripheral (SCP) Registers */

volatile struct __scp __scp_section __scp;

/**
 *
 * @brief Enable main oscillator with default frequency of 6MHz
 *
 * @return N/A
 */
void _ScpMainOscEnable(void)
{
	union __rcc reg;

	reg.value = __scp.clock.rcc.value;
	reg.bit.moscdis = 0;
	reg.bit.oscsrc = _SCP_OSC_SOURCE_MAIN;
	reg.bit.xtal = _SCP_CRYSTAL_6MHZ;

	__scp.clock.rcc.value = reg.value;
}