EE445M RTOS
Taken at the University of Texas Spring 2015
Sysctl_api

Macros

#define FLASH_PP_MAINSS_S   16
 
#define SysCtlXtalCfgToIndex(a)   ((a & 0x7c0) >> 6)
 
#define MAX_VCO_ENTRIES   2
 
#define MAX_XTAL_ENTRIES   18
 
#define PLL_M_TO_REG(mi, mf)   ((uint32_t)mi | (uint32_t)(mf << SYSCTL_PLLFREQ0_MFRAC_S))
 
#define PLL_N_TO_REG(n)   ((uint32_t)(n - 1) << SYSCTL_PLLFREQ1_N_S)
 
#define SYSCTL_PPBASE   0x400fe300
 
#define SYSCTL_SRBASE   0x400fe500
 
#define SYSCTL_RCGCBASE   0x400fe600
 
#define SYSCTL_SCGCBASE   0x400fe700
 
#define SYSCTL_DCGCBASE   0x400fe800
 
#define SYSCTL_PCBASE   0x400fe900
 
#define SYSCTL_PRBASE   0x400fea00
 

Functions

static uint32_t _SysCtlMemTimingGet (uint32_t ui32SysClock)
 
static uint32_t _SysCtlFrequencyGet (uint32_t ui32Xtal)
 
uint32_t SysCtlSRAMSizeGet (void)
 
uint32_t SysCtlFlashSizeGet (void)
 
uint32_t SysCtlFlashSectorSizeGet (void)
 
bool SysCtlPeripheralPresent (uint32_t ui32Peripheral)
 
bool SysCtlPeripheralReady (uint32_t ui32Peripheral)
 
void SysCtlPeripheralPowerOn (uint32_t ui32Peripheral)
 
void SysCtlPeripheralPowerOff (uint32_t ui32Peripheral)
 
void SysCtlPeripheralReset (uint32_t ui32Peripheral)
 
void SysCtlPeripheralEnable (uint32_t ui32Peripheral)
 
void SysCtlPeripheralDisable (uint32_t ui32Peripheral)
 
void SysCtlPeripheralSleepEnable (uint32_t ui32Peripheral)
 
void SysCtlPeripheralSleepDisable (uint32_t ui32Peripheral)
 
void SysCtlPeripheralDeepSleepEnable (uint32_t ui32Peripheral)
 
void SysCtlPeripheralDeepSleepDisable (uint32_t ui32Peripheral)
 
void SysCtlPeripheralClockGating (bool bEnable)
 
void SysCtlIntRegister (void(*pfnHandler)(void))
 
void SysCtlIntUnregister (void)
 
void SysCtlIntEnable (uint32_t ui32Ints)
 
void SysCtlIntDisable (uint32_t ui32Ints)
 
void SysCtlIntClear (uint32_t ui32Ints)
 
uint32_t SysCtlIntStatus (bool bMasked)
 
void SysCtlLDOSleepSet (uint32_t ui32Voltage)
 
uint32_t SysCtlLDOSleepGet (void)
 
void SysCtlLDODeepSleepSet (uint32_t ui32Voltage)
 
uint32_t SysCtlLDODeepSleepGet (void)
 
void SysCtlSleepPowerSet (uint32_t ui32Config)
 
void SysCtlDeepSleepPowerSet (uint32_t ui32Config)
 
void SysCtlReset (void)
 
void SysCtlSleep (void)
 
void SysCtlDeepSleep (void)
 
uint32_t SysCtlResetCauseGet (void)
 
void SysCtlResetCauseClear (uint32_t ui32Causes)
 
void SysCtlMOSCConfigSet (uint32_t ui32Config)
 
uint32_t SysCtlPIOSCCalibrate (uint32_t ui32Type)
 
void SysCtlResetBehaviorSet (uint32_t ui32Behavior)
 
uint32_t SysCtlResetBehaviorGet (void)
 
uint32_t SysCtlClockFreqSet (uint32_t ui32Config, uint32_t ui32SysClock)
 
void SysCtlClockSet (uint32_t ui32Config)
 
uint32_t SysCtlClockGet (void)
 
void SysCtlDeepSleepClockSet (uint32_t ui32Config)
 
void SysCtlDeepSleepClockConfigSet (uint32_t ui32Div, uint32_t ui32Config)
 
void SysCtlPWMClockSet (uint32_t ui32Config)
 
uint32_t SysCtlPWMClockGet (void)
 
void SysCtlGPIOAHBEnable (uint32_t ui32GPIOPeripheral)
 
void SysCtlGPIOAHBDisable (uint32_t ui32GPIOPeripheral)
 
void SysCtlUSBPLLEnable (void)
 
void SysCtlUSBPLLDisable (void)
 
void SysCtlVoltageEventConfig (uint32_t ui32Config)
 
uint32_t SysCtlVoltageEventStatus (void)
 
void SysCtlVoltageEventClear (uint32_t ui32Status)
 
uint32_t SysCtlNMIStatus (void)
 
void SysCtlNMIClear (uint32_t ui32Ints)
 
void SysCtlClockOutConfig (uint32_t ui32Config, uint32_t ui32Div)
 
void SysCtlAltClkConfig (uint32_t ui32Config)
 

Variables

static const uint32_t g_pui32Xtals []
 
static const uint32_t g_pppui32XTALtoVCO [2][18][2]
 
struct {
   uint32_t   ui32Frequency
 
   uint32_t   ui32MemTiming
 
g_sXTALtoMEMTIM []
 
static const uint32_t g_pui32VCOFrequencies [2]
 

Detailed Description

Macro Definition Documentation

#define FLASH_PP_MAINSS_S   16

Definition at line 65 of file sysctl.c.

Referenced by SysCtlFlashSectorSizeGet().

#define MAX_VCO_ENTRIES   2

Definition at line 118 of file sysctl.c.

Referenced by SysCtlClockFreqSet().

#define MAX_XTAL_ENTRIES   18

Definition at line 119 of file sysctl.c.

#define PLL_M_TO_REG (   mi,
  mf 
)    ((uint32_t)mi | (uint32_t)(mf << SYSCTL_PLLFREQ0_MFRAC_S))

Definition at line 127 of file sysctl.c.

#define PLL_N_TO_REG (   n)    ((uint32_t)(n - 1) << SYSCTL_PLLFREQ1_N_S)

Definition at line 129 of file sysctl.c.

#define SYSCTL_DCGCBASE   0x400fe800

Definition at line 345 of file sysctl.c.

Referenced by SysCtlPeripheralDeepSleepDisable(), and SysCtlPeripheralDeepSleepEnable().

#define SYSCTL_PCBASE   0x400fe900

Definition at line 346 of file sysctl.c.

Referenced by SysCtlPeripheralPowerOff(), and SysCtlPeripheralPowerOn().

#define SYSCTL_PPBASE   0x400fe300

Definition at line 341 of file sysctl.c.

Referenced by SysCtlPeripheralPresent().

#define SYSCTL_PRBASE   0x400fea00

Definition at line 347 of file sysctl.c.

Referenced by SysCtlPeripheralReady().

#define SYSCTL_RCGCBASE   0x400fe600

Definition at line 343 of file sysctl.c.

Referenced by SysCtlPeripheralDisable(), and SysCtlPeripheralEnable().

#define SYSCTL_SCGCBASE   0x400fe700

Definition at line 344 of file sysctl.c.

Referenced by SysCtlPeripheralSleepDisable(), and SysCtlPeripheralSleepEnable().

#define SYSCTL_SRBASE   0x400fe500

Definition at line 342 of file sysctl.c.

Referenced by SysCtlPeripheralReset().

#define SysCtlXtalCfgToIndex (   a)    ((a & 0x7c0) >> 6)

Definition at line 74 of file sysctl.c.

Referenced by SysCtlClockFreqSet().

Function Documentation

static uint32_t _SysCtlFrequencyGet ( uint32_t  ui32Xtal)
static

Definition at line 266 of file sysctl.c.

References HWREG, SYSCTL_PLLFREQ0, SYSCTL_PLLFREQ0_MFRAC_M, SYSCTL_PLLFREQ0_MFRAC_S, SYSCTL_PLLFREQ0_MINT_M, SYSCTL_PLLFREQ1, SYSCTL_PLLFREQ1_N_M, SYSCTL_PLLFREQ1_N_S, SYSCTL_PLLFREQ1_Q_M, and SYSCTL_PLLFREQ1_Q_S.

Referenced by SysCtlClockFreqSet().

267 {
268  uint32_t ui32Result;
269  uint_fast16_t ui16F1, ui16F2;
270  uint_fast16_t ui16PInt, ui16PFract;
271  uint_fast8_t ui8Q, ui8N;
272 
273  //
274  // Extract all of the values from the hardware registers.
275  //
276  ui16PFract = ((HWREG(SYSCTL_PLLFREQ0) & SYSCTL_PLLFREQ0_MFRAC_M) >>
279  ui8Q = (((HWREG(SYSCTL_PLLFREQ1) & SYSCTL_PLLFREQ1_Q_M) >>
280  SYSCTL_PLLFREQ1_Q_S) + 1);
281  ui8N = (((HWREG(SYSCTL_PLLFREQ1) & SYSCTL_PLLFREQ1_N_M) >>
282  SYSCTL_PLLFREQ1_N_S) + 1);
283 
284  //
285  // Divide the crystal value by N.
286  //
287  ui32Xtal /= (uint32_t)ui8N;
288 
289  //
290  // Calculate the multiplier for bits 9:5.
291  //
292  ui16F1 = ui16PFract / 32;
293 
294  //
295  // Calculate the multiplier for bits 4:0.
296  //
297  ui16F2 = ui16PFract - (ui16F1 * 32);
298 
299  //
300  // Get the integer portion.
301  //
302  ui32Result = ui32Xtal * (uint32_t)ui16PInt;
303 
304  //
305  // Add first fractional bits portion(9:0).
306  //
307  ui32Result += (ui32Xtal * (uint32_t)ui16F1) / 32;
308 
309  //
310  // Add the second fractional bits portion(4:0).
311  //
312  ui32Result += (ui32Xtal * (uint32_t)ui16F2) / 1024;
313 
314  //
315  // Divide the result by Q.
316  //
317  ui32Result = ui32Result / (uint32_t)ui8Q;
318 
319  //
320  // Return the resulting PLL frequency.
321  //
322  return(ui32Result);
323 }
#define SYSCTL_PLLFREQ0_MFRAC_S
Definition: hw_sysctl.h:1550
#define SYSCTL_PLLFREQ0_MFRAC_M
Definition: hw_sysctl.h:1548
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_PLLFREQ1_N_M
Definition: hw_sysctl.h:1560
#define SYSCTL_PLLFREQ1_Q_S
Definition: hw_sysctl.h:1561
#define SYSCTL_PLLFREQ0
Definition: hw_sysctl.h:109
#define SYSCTL_PLLFREQ1
Definition: hw_sysctl.h:110
#define SYSCTL_PLLFREQ0_MINT_M
Definition: hw_sysctl.h:1549
#define SYSCTL_PLLFREQ1_Q_M
Definition: hw_sysctl.h:1559
#define SYSCTL_PLLFREQ1_N_S
Definition: hw_sysctl.h:1562

Here is the caller graph for this function:

static uint32_t _SysCtlMemTimingGet ( uint32_t  ui32SysClock)
static

Definition at line 227 of file sysctl.c.

References g_sXTALtoMEMTIM, ui32Frequency, and ui32MemTiming.

Referenced by SysCtlClockFreqSet().

228 {
229  uint_fast8_t ui8Idx;
230 
231  //
232  // Loop through the flash memory timings.
233  //
234  for(ui8Idx = 0;
235  ui8Idx < (sizeof(g_sXTALtoMEMTIM) / sizeof(g_sXTALtoMEMTIM[0]));
236  ui8Idx++)
237  {
238  //
239  // See if the system clock frequency is less than the maximum frequency
240  // for this flash memory timing.
241  //
242  if(ui32SysClock <= g_sXTALtoMEMTIM[ui8Idx].ui32Frequency)
243  {
244  //
245  // This flash memory timing is the best choice for the system clock
246  // frequency, so return it now.
247  //
248  return(g_sXTALtoMEMTIM[ui8Idx].ui32MemTiming);
249  }
250  }
251 
252  //
253  // An appropriate flash memory timing could not be found, so the device is
254  // being clocked too fast. Return the default flash memory timing.
255  //
256  return(0);
257 }
uint32_t ui32Frequency
Definition: sysctl.c:194
uint32_t ui32MemTiming
Definition: sysctl.c:195
static const struct @1 g_sXTALtoMEMTIM[]

Here is the caller graph for this function:

void SysCtlAltClkConfig ( uint32_t  ui32Config)

Configures the alternate peripheral clock source.

Parameters
ui32Configholds the configuration options for the alternate peripheral clock.

This function configures the alternate peripheral clock. The alternate peripheral clock is used to provide a known clock in all operating modes to peripherals that support using the alternate peripheral clock as an input clock. The ui32Config parameter value provides the clock input source using one of the following values:

  • SYSCTL_ALTCLK_PIOSC - use the PIOSC as the alternate clock source (default).
  • SYSCTL_ALTCLK_RTCOSC - use the Hibernate module RTC clock as the alternate clock source.
  • SYSCTL_ALTCLK_LFIOSC - use the low-frequency internal oscillator as the alternate clock source.

Example: Select the Hibernate module RTC clock as the alternate clock source.

//!
//! //
//! // Select the Hibernate module RTC clock as the alternate clock source.
//! //
//! SysCtlAltClkConfig(SYSCTL_ALTCLK_RTCOSC);
//! 
\note The availability of the alternate peripheral clock varies with the
Tiva part in use.  Please consult the data sheet for the part you are
using to determine which interrupt sources are available.

\return None.  

Definition at line 3686 of file sysctl.c.

References HWREG, and SYSCTL_ALTCLKCFG.

3687 {
3688  //
3689  // Set the requested configuration and divisor.
3690  //
3691  HWREG(SYSCTL_ALTCLKCFG) = ui32Config;
3692 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_ALTCLKCFG
Definition: hw_sysctl.h:98
uint32_t SysCtlClockFreqSet ( uint32_t  ui32Config,
uint32_t  ui32SysClock 
)

Configures the system clock.

Parameters
ui32Configis the required configuration of the device clocking.
ui32SysClockis the requested processor frequency.

This function configures the main system clocking for the device. The input frequency, oscillator source, whether or not to enable the PLL, and the system clock divider are all configured with this function. This function configures the system frequency to the closest available divisor of one of the fixed PLL VCO settings provided in the ui32Config parameter. The caller sets the ui32SysClock parameter to request the system clock frequency, and this function then attempts to match this using the values provided in the ui32Config parameter. If this function cannot exactly match the requested frequency, it picks the closest frequency that is lower than the requested frequency. The ui32Config parameter provides the remaining configuration options using a set of defines that are a logical OR of several different values, many of which are grouped into sets where only one of the set can be chosen. This function returns the current system frequency which may not match the requested frequency.

The oscillator source is chosen with one of the following values:

  • SYSCTL_OSC_MAIN to use an external crystal or oscillator.
  • SYSCTL_OSC_INT to use the 16-MHz precision internal oscillator.
  • SYSCTL_OSC_INT30 to use the internal low frequency oscillator.
  • SYSCTL_OSC_EXT32 to use the hibernate modules 32.786-kHz oscillator. This option is only available on devices that include the hibernation module.

The system clock source is chosen with one of the following values:

  • SYSCTL_USE_PLL is used to select the PLL output as the system clock.
  • SYSCTL_USE_OSC is used to choose one of the oscillators as the system clock.

The PLL VCO frequency is chosen with one of the the following values:

  • SYSCTL_CFG_VCO_480 to set the PLL VCO output to 480-MHz
  • SYSCTL_CFG_VCO_320 to set the PLL VCO output to 320-MHz

Example: Configure the system clocking to be 40 MHz with a 320-MHz PLL setting using the 16-MHz internal oscillator.

//! SysCtlClockFreqSet(SYSCTL_OSC_INT | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_320,
//!                    40000000);
//! 
\note This function cannot be used with TM4C123 devices.  For TM4C123
devices use the SysCtlClockSet() function.

\return The actual configured system clock frequency in Hz or zero if the
value could not be changed due to a parameter error or PLL lock failure.  

Definition at line 2115 of file sysctl.c.

References _SysCtlFrequencyGet(), _SysCtlMemTimingGet(), ASSERT, CLASS_IS_TM4C123, g_pppui32XTALtoVCO, g_pui32Xtals, HWREG, MAX_VCO_ENTRIES, SYSCTL_MEMTIM0, SYSCTL_MOSCCTL, SYSCTL_MOSCCTL_NOXTAL, SYSCTL_MOSCCTL_OSCRNG, SYSCTL_MOSCCTL_PWRDN, SYSCTL_OSC_EXT32, SYSCTL_OSC_INT, SYSCTL_OSC_INT30, SYSCTL_OSC_MAIN, SYSCTL_PLLFREQ0, SYSCTL_PLLFREQ0_PLLPWR, SYSCTL_PLLFREQ1, SYSCTL_PLLSTAT, SYSCTL_PLLSTAT_LOCK, SYSCTL_RSCLKCFG, SYSCTL_RSCLKCFG_MEMTIMU, SYSCTL_RSCLKCFG_NEWFREQ, SYSCTL_RSCLKCFG_OSCSRC_LFIOSC, SYSCTL_RSCLKCFG_OSCSRC_M, SYSCTL_RSCLKCFG_OSCSRC_MOSC, SYSCTL_RSCLKCFG_OSCSRC_PIOSC, SYSCTL_RSCLKCFG_OSCSRC_RTC, SYSCTL_RSCLKCFG_OSYSDIV_M, SYSCTL_RSCLKCFG_OSYSDIV_S, SYSCTL_RSCLKCFG_PLLSRC_M, SYSCTL_RSCLKCFG_PLLSRC_MOSC, SYSCTL_RSCLKCFG_PLLSRC_PIOSC, SYSCTL_RSCLKCFG_PSYSDIV_M, SYSCTL_RSCLKCFG_PSYSDIV_S, SYSCTL_RSCLKCFG_USEPLL, SYSCTL_USE_OSC, SYSCTL_USE_PLL, SYSCTL_XTAL_10MHZ, SYSCTL_XTAL_16MHZ, SYSCTL_XTAL_25MHZ, SYSCTL_XTAL_5MHZ, and SysCtlXtalCfgToIndex.

2116 {
2117  int32_t i32Timeout, i32VCOIdx, i32XtalIdx;
2118  uint32_t ui32MOSCCTL;
2119  uint32_t ui32SysDiv, ui32Osc, ui32OscSelect, ui32RSClkConfig;
2120  bool bNewPLL;
2121 
2122  //
2123  // TM4C123 devices should not use this function.
2124  //
2125  if(CLASS_IS_TM4C123)
2126  {
2127  return(0);
2128  }
2129 
2130  //
2131  // Get the index of the crystal from the ui32Config parameter.
2132  //
2133  i32XtalIdx = SysCtlXtalCfgToIndex(ui32Config);
2134 
2135  //
2136  // Determine which non-PLL source was selected.
2137  //
2138  if((ui32Config & 0x38) == SYSCTL_OSC_INT)
2139  {
2140  //
2141  // Use the nominal frequency for the PIOSC oscillator and set the
2142  // crystal select.
2143  //
2144  ui32Osc = 16000000;
2145  ui32OscSelect = SYSCTL_RSCLKCFG_OSCSRC_PIOSC;
2146  ui32OscSelect |= SYSCTL_RSCLKCFG_PLLSRC_PIOSC;
2147 
2148  //
2149  // Force the crystal index to the value for 16-MHz.
2150  //
2152  }
2153  else if((ui32Config & 0x38) == SYSCTL_OSC_INT30)
2154  {
2155  //
2156  // Use the nominal frequency for the low frequency oscillator.
2157  //
2158  ui32Osc = 30000;
2159  ui32OscSelect = SYSCTL_RSCLKCFG_OSCSRC_LFIOSC;
2160  }
2161  else if((ui32Config & 0x38) == (SYSCTL_OSC_EXT32 & 0x38))
2162  {
2163  //
2164  // Use the RTC frequency.
2165  //
2166  ui32Osc = 32768;
2167  ui32OscSelect = SYSCTL_RSCLKCFG_OSCSRC_RTC;
2168  }
2169  else if((ui32Config & 0x38) == SYSCTL_OSC_MAIN)
2170  {
2171  //
2172  // Bounds check the source frequency for the main oscillator. The is
2173  // because the PLL tables in the g_pppui32XTALtoVCO structure range
2174  // from 5MHz to 25MHz.
2175  //
2176  if((i32XtalIdx > (SysCtlXtalCfgToIndex(SYSCTL_XTAL_25MHZ))) ||
2177  (i32XtalIdx < (SysCtlXtalCfgToIndex(SYSCTL_XTAL_5MHZ))))
2178  {
2179  return(0);
2180  }
2181 
2182  ui32Osc = g_pui32Xtals[i32XtalIdx];
2183 
2184  //
2185  // Set the PLL source select to MOSC.
2186  //
2187  ui32OscSelect = SYSCTL_RSCLKCFG_OSCSRC_MOSC;
2188  ui32OscSelect |= SYSCTL_RSCLKCFG_PLLSRC_MOSC;
2189 
2190  //
2191  // Clear MOSC power down, high oscillator range setting, and no crystal
2192  // present setting.
2193  //
2194  ui32MOSCCTL = HWREG(SYSCTL_MOSCCTL) &
2197 
2198  //
2199  // Increase the drive strength for MOSC of 10 MHz and above.
2200  //
2201  if(i32XtalIdx >= (SysCtlXtalCfgToIndex(SYSCTL_XTAL_10MHZ) -
2203  {
2204  ui32MOSCCTL |= SYSCTL_MOSCCTL_OSCRNG;
2205  }
2206 
2207  HWREG(SYSCTL_MOSCCTL) = ui32MOSCCTL;
2208  }
2209  else
2210  {
2211  //
2212  // This was an invalid request because no oscillator source was
2213  // indicated.
2214  //
2215  ui32Osc = 0;
2216  ui32OscSelect = SYSCTL_RSCLKCFG_OSCSRC_PIOSC;
2217  }
2218 
2219  //
2220  // Check if the running with the PLL enabled was requested.
2221  //
2222  if((ui32Config & SYSCTL_USE_OSC) == SYSCTL_USE_PLL)
2223  {
2224  //
2225  // ui32Config must be SYSCTL_OSC_MAIN or SYSCTL_OSC_INT.
2226  //
2227  if(((ui32Config & 0x38) != SYSCTL_OSC_MAIN) &&
2228  ((ui32Config & 0x38) != SYSCTL_OSC_INT))
2229  {
2230  return(0);
2231  }
2232 
2233  //
2234  // Get the VCO index out of the ui32Config parameter.
2235  //
2236  i32VCOIdx = (ui32Config >> 24) & 7;
2237 
2238  //
2239  // Check that the VCO index is not out of bounds.
2240  //
2241  ASSERT(i32VCOIdx < MAX_VCO_ENTRIES);
2242 
2243  //
2244  // Set the memory timings for the maximum external frequency since
2245  // this could be a switch to PIOSC or possibly to MOSC which can be
2246  // up to 25MHz.
2247  //
2249 
2250  //
2251  // Clear the old PLL divider and source in case it was set.
2252  //
2253  ui32RSClkConfig = HWREG(SYSCTL_RSCLKCFG) &
2257 
2258  //
2259  // Update the memory timings to match running from PIOSC.
2260  //
2261  ui32RSClkConfig |= SYSCTL_RSCLKCFG_MEMTIMU;
2262 
2263  //
2264  // Update clock configuration to switch back to PIOSC.
2265  //
2266  HWREG(SYSCTL_RSCLKCFG) = ui32RSClkConfig;
2267 
2268  //
2269  // The table starts at 5 MHz so modify the index to match this.
2270  //
2271  i32XtalIdx -= SysCtlXtalCfgToIndex(SYSCTL_XTAL_5MHZ);
2272 
2273  //
2274  // If there were no changes to the PLL do not force the PLL to lock by
2275  // writing the PLL settings.
2276  //
2277  if((HWREG(SYSCTL_PLLFREQ1) !=
2278  g_pppui32XTALtoVCO[i32VCOIdx][i32XtalIdx][1]) ||
2279  (HWREG(SYSCTL_PLLFREQ0) !=
2280  (g_pppui32XTALtoVCO[i32VCOIdx][i32XtalIdx][0] |
2282  {
2283  bNewPLL = true;
2284  }
2285  else
2286  {
2287  bNewPLL = false;
2288  }
2289 
2290  //
2291  // If there are new PLL settings write them.
2292  //
2293  if(bNewPLL)
2294  {
2295  //
2296  // Set the oscillator source.
2297  //
2298  HWREG(SYSCTL_RSCLKCFG) |= ui32OscSelect;
2299 
2300  //
2301  // Set the M, N and Q values provided from the table and preserve
2302  // the power state of the main PLL.
2303  //
2305  g_pppui32XTALtoVCO[i32VCOIdx][i32XtalIdx][1];
2307  (g_pppui32XTALtoVCO[i32VCOIdx][i32XtalIdx][0] |
2309  }
2310 
2311  //
2312  // Calculate the System divider such that we get a frequency that is
2313  // the closest to the requested frequency without going over.
2314  //
2315  ui32SysDiv = (g_pui32VCOFrequencies[i32VCOIdx] + ui32SysClock - 1) /
2316  ui32SysClock;
2317 
2318  //
2319  // Calculate the actual system clock.
2320  //
2321  ui32SysClock = _SysCtlFrequencyGet(ui32Osc) / ui32SysDiv;
2322 
2323  //
2324  // Set the Flash and EEPROM timing values.
2325  //
2326  HWREG(SYSCTL_MEMTIM0) = _SysCtlMemTimingGet(ui32SysClock);
2327 
2328  //
2329  // Check if the PLL is already powered up.
2330  //
2332  {
2333  if(bNewPLL == true)
2334  {
2335  //
2336  // Trigger the PLL to lock to the new frequency.
2337  //
2339  }
2340  }
2341  else
2342  {
2343  //
2344  // Power up the PLL.
2345  //
2347  }
2348 
2349  //
2350  // Wait until the PLL has locked.
2351  //
2352  for(i32Timeout = 32768; i32Timeout > 0; i32Timeout--)
2353  {
2355  {
2356  break;
2357  }
2358  }
2359 
2360  //
2361  // If the loop above did not timeout then switch over to the PLL
2362  //
2363  if(i32Timeout)
2364  {
2365  ui32RSClkConfig = HWREG(SYSCTL_RSCLKCFG);
2366  ui32RSClkConfig |= ((ui32SysDiv - 1) <<
2367  SYSCTL_RSCLKCFG_PSYSDIV_S) | ui32OscSelect |
2369  ui32RSClkConfig |= SYSCTL_RSCLKCFG_MEMTIMU;
2370 
2371  //
2372  // Set the new clock configuration.
2373  //
2374  HWREG(SYSCTL_RSCLKCFG) = ui32RSClkConfig;
2375  }
2376  else
2377  {
2378  ui32SysClock = 0;
2379  }
2380  }
2381  else
2382  {
2383  //
2384  // Set the Flash and EEPROM timing values for PIOSC.
2385  //
2387 
2388  //
2389  // Make sure that the PLL is powered down since it is not being used.
2390  //
2391  HWREG(SYSCTL_PLLFREQ0) &= ~SYSCTL_PLLFREQ0_PLLPWR;
2392 
2393  //
2394  // Clear the old PLL divider and source in case it was set.
2395  //
2396  ui32RSClkConfig = HWREG(SYSCTL_RSCLKCFG);
2397  ui32RSClkConfig &= ~(SYSCTL_RSCLKCFG_OSYSDIV_M |
2400 
2401  //
2402  // Update the memory timings.
2403  //
2404  ui32RSClkConfig |= SYSCTL_RSCLKCFG_MEMTIMU;
2405 
2406  //
2407  // Set the new clock configuration.
2408  //
2409  HWREG(SYSCTL_RSCLKCFG) = ui32RSClkConfig;
2410 
2411  //
2412  // If zero given as the system clock then default to divide by 1.
2413  //
2414  if(ui32SysClock == 0)
2415  {
2416  ui32SysDiv = 0;
2417  }
2418  else
2419  {
2420  //
2421  // Calculate the System divider based on the requested
2422  // frequency.
2423  //
2424  ui32SysDiv = ui32Osc / ui32SysClock;
2425 
2426  //
2427  // If the system divisor is not already zero, subtract one to
2428  // set the value in the register which requires the value to
2429  // be n-1.
2430  //
2431  if(ui32SysDiv != 0)
2432  {
2433  ui32SysDiv -= 1;
2434  }
2435 
2436  //
2437  // Calculate the system clock.
2438  //
2439  ui32SysClock = ui32Osc / (ui32SysDiv + 1);
2440  }
2441 
2442  //
2443  // Set the memory timing values for the new system clock.
2444  //
2445  HWREG(SYSCTL_MEMTIM0) = _SysCtlMemTimingGet(ui32SysClock);
2446 
2447  //
2448  // Set the new system clock values.
2449  //
2450  ui32RSClkConfig = HWREG(SYSCTL_RSCLKCFG);
2451  ui32RSClkConfig |= (ui32SysDiv << SYSCTL_RSCLKCFG_OSYSDIV_S) |
2452  ui32OscSelect;
2453 
2454  //
2455  // Update the memory timings.
2456  //
2457  ui32RSClkConfig |= SYSCTL_RSCLKCFG_MEMTIMU;
2458 
2459  //
2460  // Set the new clock configuration.
2461  //
2462  HWREG(SYSCTL_RSCLKCFG) = ui32RSClkConfig;
2463  }
2464 
2465  return(ui32SysClock);
2466 }
static const uint32_t g_pppui32XTALtoVCO[2][18][2]
Definition: sysctl.c:137
#define SysCtlXtalCfgToIndex(a)
Definition: sysctl.c:74
#define SYSCTL_OSC_INT30
Definition: sysctl.h:381
#define SYSCTL_RSCLKCFG_NEWFREQ
Definition: hw_sysctl.h:1184
#define SYSCTL_PLLSTAT
Definition: hw_sysctl.h:111
#define SYSCTL_RSCLKCFG
Definition: hw_sysctl.h:76
#define SYSCTL_XTAL_5MHZ
Definition: sysctl.h:360
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_RSCLKCFG_OSYSDIV_S
Definition: hw_sysctl.h:1209
#define MAX_VCO_ENTRIES
Definition: sysctl.c:118
static uint32_t _SysCtlMemTimingGet(uint32_t ui32SysClock)
Definition: sysctl.c:227
#define SYSCTL_OSC_MAIN
Definition: sysctl.h:378
#define SYSCTL_MOSCCTL_OSCRNG
Definition: hw_sysctl.h:1171
#define SYSCTL_MOSCCTL_NOXTAL
Definition: hw_sysctl.h:1173
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_USE_OSC
Definition: sysctl.h:350
static const uint32_t g_pui32Xtals[]
Definition: sysctl.c:81
#define SYSCTL_RSCLKCFG_PLLSRC_M
Definition: hw_sysctl.h:1187
#define SYSCTL_XTAL_16MHZ
Definition: sysctl.h:372
#define SYSCTL_RSCLKCFG_PLLSRC_MOSC
Definition: hw_sysctl.h:1191
#define SYSCTL_RSCLKCFG_MEMTIMU
Definition: hw_sysctl.h:1183
#define SYSCTL_RSCLKCFG_OSCSRC_M
Definition: hw_sysctl.h:1194
#define SYSCTL_RSCLKCFG_OSCSRC_RTC
Definition: hw_sysctl.h:1202
#define SYSCTL_MOSCCTL_PWRDN
Definition: hw_sysctl.h:1172
#define SYSCTL_XTAL_10MHZ
Definition: sysctl.h:367
#define SYSCTL_RSCLKCFG_USEPLL
Definition: hw_sysctl.h:1186
#define SYSCTL_XTAL_25MHZ
Definition: sysctl.h:377
#define SYSCTL_PLLFREQ0
Definition: hw_sysctl.h:109
#define SYSCTL_OSC_EXT32
Definition: sysctl.h:382
#define SYSCTL_RSCLKCFG_PSYSDIV_M
Definition: hw_sysctl.h:1207
static const uint32_t g_pui32VCOFrequencies[2]
Definition: sysctl.c:330
#define SYSCTL_RSCLKCFG_PSYSDIV_S
Definition: hw_sysctl.h:1211
#define SYSCTL_PLLFREQ1
Definition: hw_sysctl.h:110
#define CLASS_IS_TM4C123
Definition: hw_types.h:93
#define SYSCTL_OSC_INT
Definition: sysctl.h:379
#define SYSCTL_USE_PLL
Definition: sysctl.h:349
#define SYSCTL_RSCLKCFG_OSYSDIV_M
Definition: hw_sysctl.h:1205
#define SYSCTL_MOSCCTL
Definition: hw_sysctl.h:75
#define SYSCTL_RSCLKCFG_PLLSRC_PIOSC
Definition: hw_sysctl.h:1189
#define SYSCTL_RSCLKCFG_OSCSRC_LFIOSC
Definition: hw_sysctl.h:1198
#define SYSCTL_MEMTIM0
Definition: hw_sysctl.h:78
#define SYSCTL_RSCLKCFG_OSCSRC_MOSC
Definition: hw_sysctl.h:1200
#define SYSCTL_PLLFREQ0_PLLPWR
Definition: hw_sysctl.h:1547
#define SYSCTL_RSCLKCFG_OSCSRC_PIOSC
Definition: hw_sysctl.h:1196
#define SYSCTL_PLLSTAT_LOCK
Definition: hw_sysctl.h:1569
static uint32_t _SysCtlFrequencyGet(uint32_t ui32Xtal)
Definition: sysctl.c:266

Here is the call graph for this function:

uint32_t SysCtlClockGet ( void  )

Gets the processor clock rate.

This function determines the clock rate of the processor clock, which is also the clock rate of the peripheral modules (with the exception of PWM, which has its own clock divider; other peripherals may have different clocking, see the device data sheet for details).

Note
This cannot return accurate results if SysCtlClockSet() has not been called to configure the clocking of the device, or if the device is directly clocked from a crystal (or a clock source) that is not one of the supported crystal frequencies. In the latter case, this function should be modified to directly return the correct system clock rate.
This function can only be called on TM4C123 devices. For TM4C129 devices, the return value from SysCtlClockFreqSet() indicates the system clock frequency.
Returns
The processor clock rate for TM4C123 devices only.

Definition at line 2727 of file sysctl.c.

References ASSERT, CLASS_IS_TM4C123, g_pui32Xtals, HWREG, SYSCTL_DC1, SYSCTL_DC1_MINSYSDIV_20, SYSCTL_DC1_MINSYSDIV_25, SYSCTL_DC1_MINSYSDIV_40, SYSCTL_DC1_MINSYSDIV_50, SYSCTL_DC1_MINSYSDIV_66, SYSCTL_DC1_MINSYSDIV_80, SYSCTL_DC1_MINSYSDIV_M, SYSCTL_PLLFREQ0, SYSCTL_PLLFREQ0_MFRAC_M, SYSCTL_PLLFREQ0_MFRAC_S, SYSCTL_PLLFREQ0_MINT_M, SYSCTL_PLLFREQ0_MINT_S, SYSCTL_PLLFREQ1, SYSCTL_PLLFREQ1_N_M, SYSCTL_PLLFREQ1_N_S, SYSCTL_PLLFREQ1_Q_M, SYSCTL_PLLFREQ1_Q_S, SYSCTL_RCC, SYSCTL_RCC2, SYSCTL_RCC2_BYPASS2, SYSCTL_RCC2_DIV400, SYSCTL_RCC2_OSCSRC2_32, SYSCTL_RCC2_OSCSRC2_M, SYSCTL_RCC2_SYSDIV2_M, SYSCTL_RCC2_SYSDIV2_S, SYSCTL_RCC2_SYSDIV2LSB, SYSCTL_RCC2_USERCC2, SYSCTL_RCC_BYPASS, SYSCTL_RCC_OSCSRC_30, SYSCTL_RCC_OSCSRC_INT, SYSCTL_RCC_OSCSRC_INT4, SYSCTL_RCC_OSCSRC_M, SYSCTL_RCC_OSCSRC_MAIN, SYSCTL_RCC_SYSDIV_M, SYSCTL_RCC_SYSDIV_S, SYSCTL_RCC_USESYSDIV, SYSCTL_RCC_XTAL_M, and SYSCTL_RCC_XTAL_S.

Referenced by main(), scheduler_reschedule(), systick_init(), timer_add_interrupt(), and uart_init().

2728 {
2729  uint32_t ui32RCC, ui32RCC2, ui32PLL, ui32Clk, ui32Max;
2730  uint32_t ui32PLL1;
2731 
2732  //
2733  // This function is only valid on TM4C123 devices.
2734  //
2736 
2737  //
2738  // Read RCC and RCC2.
2739  //
2740  ui32RCC = HWREG(SYSCTL_RCC);
2741  ui32RCC2 = HWREG(SYSCTL_RCC2);
2742 
2743  //
2744  // Get the base clock rate.
2745  //
2746  switch((ui32RCC2 & SYSCTL_RCC2_USERCC2) ?
2747  (ui32RCC2 & SYSCTL_RCC2_OSCSRC2_M) :
2748  (ui32RCC & SYSCTL_RCC_OSCSRC_M))
2749  {
2750  //
2751  // The main oscillator is the clock source. Determine its rate from
2752  // the crystal setting field.
2753  //
2755  {
2756  ui32Clk = g_pui32Xtals[(ui32RCC & SYSCTL_RCC_XTAL_M) >>
2758  break;
2759  }
2760 
2761  //
2762  // The internal oscillator is the source clock.
2763  //
2764  case SYSCTL_RCC_OSCSRC_INT:
2765  {
2766  //
2767  // The internal oscillator on all devices is 16 MHz.
2768  //
2769  ui32Clk = 16000000;
2770  break;
2771  }
2772 
2773  //
2774  // The internal oscillator divided by four is the source clock.
2775  //
2777  {
2778  //
2779  // The internal oscillator on all devices is 16 MHz.
2780  //
2781  ui32Clk = 16000000 / 4;
2782  break;
2783  }
2784 
2785  //
2786  // The internal 30-KHz oscillator is the source clock.
2787  //
2788  case SYSCTL_RCC_OSCSRC_30:
2789  {
2790  //
2791  // The internal 30-KHz oscillator has an accuracy of +/- 30%.
2792  //
2793  ui32Clk = 30000;
2794  break;
2795  }
2796 
2797  //
2798  // The 32.768-KHz clock from the hibernate module is the source clock.
2799  //
2801  {
2802  ui32Clk = 32768;
2803  break;
2804  }
2805 
2806  //
2807  // An unknown setting, so return a zero clock (that is, an unknown
2808  // clock rate).
2809  //
2810  default:
2811  {
2812  return(0);
2813  }
2814  }
2815 
2816  //
2817  // Default the maximum frequency to the maximum 32-bit unsigned value.
2818  //
2819  ui32Max = 0xffffffff;
2820 
2821  //
2822  // See if the PLL is being used.
2823  //
2824  if(((ui32RCC2 & SYSCTL_RCC2_USERCC2) &&
2825  !(ui32RCC2 & SYSCTL_RCC2_BYPASS2)) ||
2826  (!(ui32RCC2 & SYSCTL_RCC2_USERCC2) && !(ui32RCC & SYSCTL_RCC_BYPASS)))
2827  {
2828  //
2829  // Read the two PLL frequency registers. The formula for a
2830  // TM4C123 device is "(xtal * m) / ((q + 1) * (n + 1))".
2831  //
2832  ui32PLL = HWREG(SYSCTL_PLLFREQ0);
2833  ui32PLL1 = HWREG(SYSCTL_PLLFREQ1);
2834 
2835  //
2836  // Divide the input clock by the dividers.
2837  //
2838  ui32Clk /= ((((ui32PLL1 & SYSCTL_PLLFREQ1_Q_M) >>
2839  SYSCTL_PLLFREQ1_Q_S) + 1) *
2840  (((ui32PLL1 & SYSCTL_PLLFREQ1_N_M) >>
2841  SYSCTL_PLLFREQ1_N_S) + 1) * 2);
2842 
2843  //
2844  // Multiply the clock by the multiplier, which is split into an
2845  // integer part and a fractional part.
2846  //
2847  ui32Clk = ((ui32Clk * ((ui32PLL & SYSCTL_PLLFREQ0_MINT_M) >>
2849  ((ui32Clk * ((ui32PLL & SYSCTL_PLLFREQ0_MFRAC_M) >>
2850  SYSCTL_PLLFREQ0_MFRAC_S)) >> 10));
2851 
2852  //
2853  // Force the system divider to be enabled. It is always used when
2854  // using the PLL, but in some cases it does not read as being enabled.
2855  //
2856  ui32RCC |= SYSCTL_RCC_USESYSDIV;
2857 
2858  //
2859  // Calculate the maximum system frequency.
2860  //
2862  {
2864  {
2865  ui32Max = 80000000;
2866  break;
2867  }
2869  {
2870  ui32Max = 66666666;
2871  break;
2872  }
2874  {
2875  ui32Max = 50000000;
2876  break;
2877  }
2879  {
2880  ui32Max = 40000000;
2881  break;
2882  }
2884  {
2885  ui32Max = 25000000;
2886  break;
2887  }
2889  {
2890  ui32Max = 20000000;
2891  break;
2892  }
2893  default:
2894  {
2895  break;
2896  }
2897  }
2898  }
2899 
2900  //
2901  // See if the system divider is being used.
2902  //
2903  if(ui32RCC & SYSCTL_RCC_USESYSDIV)
2904  {
2905  //
2906  // Adjust the clock rate by the system clock divider.
2907  //
2908  if(ui32RCC2 & SYSCTL_RCC2_USERCC2)
2909  {
2910  if((ui32RCC2 & SYSCTL_RCC2_DIV400) &&
2911  (((ui32RCC2 & SYSCTL_RCC2_USERCC2) &&
2912  !(ui32RCC2 & SYSCTL_RCC2_BYPASS2)) ||
2913  (!(ui32RCC2 & SYSCTL_RCC2_USERCC2) &&
2914  !(ui32RCC & SYSCTL_RCC_BYPASS))))
2915 
2916  {
2917  ui32Clk = ((ui32Clk * 2) / (((ui32RCC2 &
2920  (SYSCTL_RCC2_SYSDIV2_S - 1)) +
2921  1));
2922  }
2923  else
2924  {
2925  ui32Clk /= (((ui32RCC2 & SYSCTL_RCC2_SYSDIV2_M) >>
2926  SYSCTL_RCC2_SYSDIV2_S) + 1);
2927  }
2928  }
2929  else
2930  {
2931  ui32Clk /= (((ui32RCC & SYSCTL_RCC_SYSDIV_M) >>
2932  SYSCTL_RCC_SYSDIV_S) + 1);
2933  }
2934  }
2935 
2936  //
2937  // Limit the maximum clock to the maximum clock frequency.
2938  //
2939  if(ui32Max < ui32Clk)
2940  {
2941  ui32Clk = ui32Max;
2942  }
2943 
2944  //
2945  // Return the computed clock rate.
2946  //
2947  return(ui32Clk);
2948 }
#define SYSCTL_DC1
Definition: hw_sysctl.h:51
#define SYSCTL_PLLFREQ0_MFRAC_S
Definition: hw_sysctl.h:1550
#define SYSCTL_PLLFREQ0_MFRAC_M
Definition: hw_sysctl.h:1548
#define SYSCTL_RCC_XTAL_M
Definition: hw_sysctl.h:1077
#define SYSCTL_RCC_XTAL_S
Definition: hw_sysctl.h:1106
#define SYSCTL_RCC2_DIV400
Definition: hw_sysctl.h:1151
#define SYSCTL_RCC2_SYSDIV2_S
Definition: hw_sysctl.h:1164
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_PLLFREQ0_MINT_S
Definition: hw_sysctl.h:1551
#define SYSCTL_RCC_OSCSRC_INT4
Definition: hw_sysctl.h:1102
#define SYSCTL_RCC2_OSCSRC2_32
Definition: hw_sysctl.h:1163
#define SYSCTL_RCC2
Definition: hw_sysctl.h:74
#define SYSCTL_DC1_MINSYSDIV_50
Definition: hw_sysctl.h:673
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_RCC_SYSDIV_M
Definition: hw_sysctl.h:1065
#define SYSCTL_RCC2_SYSDIV2LSB
Definition: hw_sysctl.h:1154
static const uint32_t g_pui32Xtals[]
Definition: sysctl.c:81
#define SYSCTL_RCC_OSCSRC_30
Definition: hw_sysctl.h:1103
#define SYSCTL_RCC
Definition: hw_sysctl.h:70
#define SYSCTL_DC1_MINSYSDIV_25
Definition: hw_sysctl.h:677
#define SYSCTL_PLLFREQ1_N_M
Definition: hw_sysctl.h:1560
#define SYSCTL_RCC_BYPASS
Definition: hw_sysctl.h:1076
#define SYSCTL_PLLFREQ1_Q_S
Definition: hw_sysctl.h:1561
#define SYSCTL_RCC_OSCSRC_M
Definition: hw_sysctl.h:1099
#define SYSCTL_RCC2_OSCSRC2_M
Definition: hw_sysctl.h:1158
#define SYSCTL_PLLFREQ0
Definition: hw_sysctl.h:109
#define SYSCTL_RCC_OSCSRC_MAIN
Definition: hw_sysctl.h:1100
#define SYSCTL_RCC2_BYPASS2
Definition: hw_sysctl.h:1157
#define SYSCTL_PLLFREQ1
Definition: hw_sysctl.h:110
#define CLASS_IS_TM4C123
Definition: hw_types.h:93
#define SYSCTL_RCC2_USERCC2
Definition: hw_sysctl.h:1150
#define SYSCTL_DC1_MINSYSDIV_M
Definition: hw_sysctl.h:668
#define SYSCTL_DC1_MINSYSDIV_66
Definition: hw_sysctl.h:671
#define SYSCTL_DC1_MINSYSDIV_40
Definition: hw_sysctl.h:675
#define SYSCTL_PLLFREQ0_MINT_M
Definition: hw_sysctl.h:1549
#define SYSCTL_RCC_SYSDIV_S
Definition: hw_sysctl.h:1105
#define SYSCTL_DC1_MINSYSDIV_20
Definition: hw_sysctl.h:679
#define SYSCTL_DC1_MINSYSDIV_80
Definition: hw_sysctl.h:669
#define SYSCTL_PLLFREQ1_Q_M
Definition: hw_sysctl.h:1559
#define SYSCTL_PLLFREQ1_N_S
Definition: hw_sysctl.h:1562
#define SYSCTL_RCC2_SYSDIV2_M
Definition: hw_sysctl.h:1153
#define SYSCTL_RCC_USESYSDIV
Definition: hw_sysctl.h:1066
#define SYSCTL_RCC_OSCSRC_INT
Definition: hw_sysctl.h:1101

Here is the caller graph for this function:

void SysCtlClockOutConfig ( uint32_t  ui32Config,
uint32_t  ui32Div 
)

Configures and enables or disables the clock output on the DIVSCLK pin.

Parameters
ui32Configholds the configuration options including enabling or disabling the clock output on the DIVSCLK pin.
ui32Divis the divisor for the clock selected in the ui32Config parameter.

This function selects the source for the DIVSCLK, enables or disables the clock output and provides an output divider value. The ui32Div parameter specifies the divider for the selected clock source and has a valid range of 1-256. The ui32Config parameter configures the DIVSCLK output based on the following settings:

The first setting allows the output to be enabled or disabled.

  • SYSCTL_CLKOUT_EN - enable the DIVSCLK output.
  • SYSCTL_CLKOUT_DIS - disable the DIVSCLK output (default).

The next group of settings selects the source for the DIVSCLK.

  • SYSCTL_CLKOUT_SYSCLK - use the current system clock as the source (default).
  • SYSCTL_CLKOUT_PIOSC - use the PIOSC as the source.
  • SYSCTL_CLKOUT_MOSC - use the MOSC as the source.

Example: Enable the PIOSC divided by 4 as the DIVSCLK output.

//!
//! //
//! // Enable the PIOSC divided by 4 as the DIVSCLK output.
//! //
//! SysCtlClockOutConfig(SYSCTL_DIVSCLK_EN | SYSCTL_DIVSCLK_SRC_PIOSC, 4);
//! 
\note The availability of the DIVSCLK output varies with the Tiva part
in use.  Please consult the data sheet for the part you are using to
determine which interrupt sources are available.

\return None.  

Definition at line 3634 of file sysctl.c.

References ASSERT, HWREG, SYSCTL_CLKOUT_DIS, SYSCTL_CLKOUT_EN, SYSCTL_CLKOUT_MOSC, SYSCTL_CLKOUT_PIOSC, SYSCTL_CLKOUT_SYSCLK, SYSCTL_DIVSCLK, and SYSCTL_DIVSCLK_DIV_M.

3635 {
3636  ASSERT(ui32Div != 0);
3637  ASSERT((ui32Config & ~(SYSCTL_CLKOUT_EN | SYSCTL_CLKOUT_DIS |
3639  SYSCTL_CLKOUT_MOSC)) == 0);
3640 
3641  //
3642  // Set the requested configuration and divisor.
3643  //
3644  HWREG(SYSCTL_DIVSCLK) = ui32Config | ((ui32Div - 1) &
3646 }
#define SYSCTL_CLKOUT_MOSC
Definition: sysctl.h:566
#define SYSCTL_CLKOUT_DIS
Definition: sysctl.h:563
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_CLKOUT_SYSCLK
Definition: sysctl.h:564
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_CLKOUT_EN
Definition: sysctl.h:562
#define SYSCTL_CLKOUT_PIOSC
Definition: sysctl.h:565
#define SYSCTL_DIVSCLK_DIV_M
Definition: hw_sysctl.h:1501
#define SYSCTL_DIVSCLK
Definition: hw_sysctl.h:102
void SysCtlClockSet ( uint32_t  ui32Config)

Sets the clocking of the device.

Parameters
ui32Configis the required configuration of the device clocking.

This function configures the clocking of the device. The input crystal frequency, oscillator to be used, use of the PLL, and the system clock divider are all configured with this function.

The ui32Config parameter is the logical OR of several different values, many of which are grouped into sets where only one can be chosen.

The system clock divider is chosen with one of the following values: SYSCTL_SYSDIV_1, SYSCTL_SYSDIV_2, SYSCTL_SYSDIV_3, ... SYSCTL_SYSDIV_64.

The use of the PLL is chosen with either SYSCTL_USE_PLL or SYSCTL_USE_OSC.

The external crystal frequency is chosen with one of the following values: SYSCTL_XTAL_4MHZ, SYSCTL_XTAL_4_09MHZ, SYSCTL_XTAL_4_91MHZ, SYSCTL_XTAL_5MHZ, SYSCTL_XTAL_5_12MHZ, SYSCTL_XTAL_6MHZ, SYSCTL_XTAL_6_14MHZ, SYSCTL_XTAL_7_37MHZ, SYSCTL_XTAL_8MHZ, SYSCTL_XTAL_8_19MHZ, SYSCTL_XTAL_10MHZ, SYSCTL_XTAL_12MHZ, SYSCTL_XTAL_12_2MHZ, SYSCTL_XTAL_13_5MHZ, SYSCTL_XTAL_14_3MHZ, SYSCTL_XTAL_16MHZ, SYSCTL_XTAL_16_3MHZ, SYSCTL_XTAL_18MHZ, SYSCTL_XTAL_20MHZ, SYSCTL_XTAL_24MHZ, or SYSCTL_XTAL_25MHz. Values below SYSCTL_XTAL_5MHZ are not valid when the PLL is in operation.

The oscillator source is chosen with one of the following values: SYSCTL_OSC_MAIN, SYSCTL_OSC_INT, SYSCTL_OSC_INT4, SYSCTL_OSC_INT30, or SYSCTL_OSC_EXT32. SYSCTL_OSC_EXT32 is only available on devices with the hibernate module, and then only when the hibernate module has been enabled.

The internal and main oscillators are disabled with the SYSCTL_INT_OSC_DIS and SYSCTL_MAIN_OSC_DIS flags, respectively. The external oscillator must be enabled in order to use an external clock source. Note that attempts to disable the oscillator used to clock the device is prevented by the hardware.

To clock the system from an external source (such as an external crystal oscillator), use SYSCTL_USE_OSC | SYSCTL_OSC_MAIN. To clock the system from the main oscillator, use SYSCTL_USE_OSC | SYSCTL_OSC_MAIN. To clock the system from the PLL, use SYSCTL_USE_PLL | SYSCTL_OSC_MAIN, and select the appropriate crystal with one of the SYSCTL_XTAL_xxx values.

Note
This function should only be called on TM4C123 devices. For all other devices use the SysCtlClockFreqSet() function.
If selecting the PLL as the system clock source (that is, via SYSCTL_USE_PLL), this function polls the PLL lock interrupt to determine when the PLL has locked. If an interrupt handler for the system control interrupt is in place, and it responds to and clears the PLL lock interrupt, this function delays until its timeout has occurred instead of completing as soon as PLL lock is achieved.
Returns
None.

Definition at line 2532 of file sysctl.c.

References HWREG, SYSCTL_MAIN_OSC_DIS, SYSCTL_MISC, SYSCTL_MISC_MOSCPUPMIS, SYSCTL_MISC_PLLLMIS, SYSCTL_PLLSTAT, SYSCTL_PLLSTAT_LOCK, SYSCTL_RCC, SYSCTL_RCC2, SYSCTL_RCC2_BYPASS2, SYSCTL_RCC2_DIV400, SYSCTL_RCC2_OSCSRC2_M, SYSCTL_RCC2_PWRDN2, SYSCTL_RCC2_SYSDIV2_M, SYSCTL_RCC2_SYSDIV2LSB, SYSCTL_RCC2_USERCC2, SYSCTL_RCC_BYPASS, SYSCTL_RCC_MOSCDIS, SYSCTL_RCC_OSCSRC_M, SYSCTL_RCC_PWRDN, SYSCTL_RCC_SYSDIV_M, SYSCTL_RCC_USESYSDIV, SYSCTL_RCC_XTAL_M, SYSCTL_RIS, SYSCTL_RIS_MOSCPUPRIS, and SysCtlDelay().

Referenced by main().

2533 {
2534  uint32_t ui32Delay, ui32RCC, ui32RCC2;
2535 
2536  //
2537  // Get the current value of the RCC and RCC2 registers.
2538  //
2539  ui32RCC = HWREG(SYSCTL_RCC);
2540  ui32RCC2 = HWREG(SYSCTL_RCC2);
2541 
2542  //
2543  // Bypass the PLL and system clock dividers for now.
2544  //
2545  ui32RCC |= SYSCTL_RCC_BYPASS;
2546  ui32RCC &= ~(SYSCTL_RCC_USESYSDIV);
2547  ui32RCC2 |= SYSCTL_RCC2_BYPASS2;
2548 
2549  //
2550  // Write the new RCC value.
2551  //
2552  HWREG(SYSCTL_RCC) = ui32RCC;
2553  HWREG(SYSCTL_RCC2) = ui32RCC2;
2554 
2555  //
2556  // See if the oscillator needs to be enabled.
2557  //
2558  if((ui32RCC & SYSCTL_RCC_MOSCDIS) && !(ui32Config & SYSCTL_MAIN_OSC_DIS))
2559  {
2560  //
2561  // Make sure that the required oscillators are enabled. For now, the
2562  // previously enabled oscillators must be enabled along with the newly
2563  // requested oscillators.
2564  //
2565  ui32RCC &= (~SYSCTL_RCC_MOSCDIS | (ui32Config & SYSCTL_MAIN_OSC_DIS));
2566 
2567  //
2568  // Clear the MOSC power up raw interrupt status to be sure it is not
2569  // set when waiting below.
2570  //
2572 
2573  //
2574  // Write the new RCC value.
2575  //
2576  HWREG(SYSCTL_RCC) = ui32RCC;
2577 
2578  //
2579  // Timeout using the legacy delay value.
2580  //
2581  ui32Delay = 524288;
2582 
2583  while((HWREG(SYSCTL_RIS) & SYSCTL_RIS_MOSCPUPRIS) == 0)
2584  {
2585  ui32Delay--;
2586 
2587  if(ui32Delay == 0)
2588  {
2589  break;
2590  }
2591  }
2592 
2593  //
2594  // If the main oscillator failed to start up then do not switch to
2595  // it and return.
2596  //
2597  if(ui32Delay == 0)
2598  {
2599  return;
2600  }
2601 
2602  }
2603 
2604  //
2605  // Set the new crystal value and oscillator source. Because the OSCSRC2
2606  // field in RCC2 overlaps the XTAL field in RCC, the OSCSRC field has a
2607  // special encoding within ui32Config to avoid the overlap.
2608  //
2609  ui32RCC &= ~(SYSCTL_RCC_XTAL_M | SYSCTL_RCC_OSCSRC_M);
2610  ui32RCC |= ui32Config & (SYSCTL_RCC_XTAL_M | SYSCTL_RCC_OSCSRC_M);
2611  ui32RCC2 &= ~(SYSCTL_RCC2_USERCC2 | SYSCTL_RCC2_OSCSRC2_M);
2612  ui32RCC2 |= ui32Config & (SYSCTL_RCC2_USERCC2 | SYSCTL_RCC_OSCSRC_M);
2613  ui32RCC2 |= (ui32Config & 0x00000008) << 3;
2614 
2615  //
2616  // Write the new RCC value.
2617  //
2618  HWREG(SYSCTL_RCC) = ui32RCC;
2619  HWREG(SYSCTL_RCC2) = ui32RCC2;
2620 
2621  //
2622  // Set the PLL configuration.
2623  //
2624  ui32RCC &= ~SYSCTL_RCC_PWRDN;
2625  ui32RCC |= ui32Config & SYSCTL_RCC_PWRDN;
2626  ui32RCC2 &= ~SYSCTL_RCC2_PWRDN2;
2627  ui32RCC2 |= ui32Config & SYSCTL_RCC2_PWRDN2;
2628 
2629  //
2630  // Clear the PLL lock interrupt.
2631  //
2633 
2634  //
2635  // Write the new RCC value.
2636  //
2637  if(ui32RCC2 & SYSCTL_RCC2_USERCC2)
2638  {
2639  HWREG(SYSCTL_RCC2) = ui32RCC2;
2640  HWREG(SYSCTL_RCC) = ui32RCC;
2641  }
2642  else
2643  {
2644  HWREG(SYSCTL_RCC) = ui32RCC;
2645  HWREG(SYSCTL_RCC2) = ui32RCC2;
2646  }
2647 
2648  //
2649  // Set the requested system divider and disable the appropriate
2650  // oscillators. This value is not written immediately.
2651  //
2652  ui32RCC &= ~(SYSCTL_RCC_SYSDIV_M | SYSCTL_RCC_USESYSDIV |
2654  ui32RCC |= ui32Config & (SYSCTL_RCC_SYSDIV_M | SYSCTL_RCC_USESYSDIV |
2656  ui32RCC2 &= ~(SYSCTL_RCC2_SYSDIV2_M);
2657  ui32RCC2 |= ui32Config & SYSCTL_RCC2_SYSDIV2_M;
2658  if(ui32Config & SYSCTL_RCC2_DIV400)
2659  {
2660  ui32RCC |= SYSCTL_RCC_USESYSDIV;
2661  ui32RCC2 &= ~(SYSCTL_RCC_USESYSDIV);
2662  ui32RCC2 |= ui32Config & (SYSCTL_RCC2_DIV400 | SYSCTL_RCC2_SYSDIV2LSB);
2663  }
2664  else
2665  {
2666  ui32RCC2 &= ~(SYSCTL_RCC2_DIV400);
2667  }
2668 
2669  //
2670  // See if the PLL output is being used to clock the system.
2671  //
2672  if(!(ui32Config & SYSCTL_RCC_BYPASS))
2673  {
2674  //
2675  // Wait until the PLL has locked.
2676  //
2677  for(ui32Delay = 32768; ui32Delay > 0; ui32Delay--)
2678  {
2680  {
2681  break;
2682  }
2683  }
2684 
2685  //
2686  // Enable use of the PLL.
2687  //
2688  ui32RCC &= ~(SYSCTL_RCC_BYPASS);
2689  ui32RCC2 &= ~(SYSCTL_RCC2_BYPASS2);
2690  }
2691 
2692  //
2693  // Write the final RCC value.
2694  //
2695  HWREG(SYSCTL_RCC) = ui32RCC;
2696  HWREG(SYSCTL_RCC2) = ui32RCC2;
2697 
2698  //
2699  // Delay for a little bit so that the system divider takes effect.
2700  //
2701  SysCtlDelay(16);
2702 }
#define SYSCTL_RCC_XTAL_M
Definition: hw_sysctl.h:1077
#define SYSCTL_RCC2_DIV400
Definition: hw_sysctl.h:1151
#define SYSCTL_PLLSTAT
Definition: hw_sysctl.h:111
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_RCC2
Definition: hw_sysctl.h:74
#define SYSCTL_RCC_SYSDIV_M
Definition: hw_sysctl.h:1065
#define SYSCTL_RCC2_SYSDIV2LSB
Definition: hw_sysctl.h:1154
void SysCtlDelay(uint32_t ui32Count)
#define SYSCTL_RCC
Definition: hw_sysctl.h:70
#define SYSCTL_RCC_BYPASS
Definition: hw_sysctl.h:1076
#define SYSCTL_RCC_OSCSRC_M
Definition: hw_sysctl.h:1099
#define SYSCTL_RCC2_OSCSRC2_M
Definition: hw_sysctl.h:1158
#define SYSCTL_MAIN_OSC_DIS
Definition: sysctl.h:384
#define SYSCTL_RCC2_BYPASS2
Definition: hw_sysctl.h:1157
#define SYSCTL_RIS_MOSCPUPRIS
Definition: hw_sysctl.h:989
#define SYSCTL_RCC2_USERCC2
Definition: hw_sysctl.h:1150
#define SYSCTL_RCC2_PWRDN2
Definition: hw_sysctl.h:1156
#define SYSCTL_RCC_MOSCDIS
Definition: hw_sysctl.h:1104
#define SYSCTL_RCC2_SYSDIV2_M
Definition: hw_sysctl.h:1153
#define SYSCTL_RIS
Definition: hw_sysctl.h:64
#define SYSCTL_RCC_USESYSDIV
Definition: hw_sysctl.h:1066
#define SYSCTL_RCC_PWRDN
Definition: hw_sysctl.h:1075
#define SYSCTL_MISC_MOSCPUPMIS
Definition: hw_sysctl.h:1025
#define SYSCTL_MISC_PLLLMIS
Definition: hw_sysctl.h:1029
#define SYSCTL_PLLSTAT_LOCK
Definition: hw_sysctl.h:1569
#define SYSCTL_MISC
Definition: hw_sysctl.h:66

Here is the call graph for this function:

Here is the caller graph for this function:

void SysCtlDeepSleep ( void  )

Puts the processor into deep-sleep mode.

This function places the processor into deep-sleep mode; it does not return until the processor returns to run mode. The peripherals that are enabled via SysCtlPeripheralDeepSleepEnable() continue to operate and can wake up the processor (if automatic clock gating is enabled with SysCtlPeripheralClockGating(), otherwise all peripherals continue to operate).

Returns
None.

Definition at line 1726 of file sysctl.c.

References CPUwfi(), HWREG, NVIC_SYS_CTRL, and NVIC_SYS_CTRL_SLEEPDEEP.

1727 {
1728  //
1729  // Enable deep-sleep.
1730  //
1732 
1733  //
1734  // Wait for an interrupt.
1735  //
1736  CPUwfi();
1737 
1738  //
1739  // Disable deep-sleep so that a future sleep works correctly.
1740  //
1742 }
#define HWREG(x)
Definition: hw_types.h:48
void CPUwfi(void)
#define NVIC_SYS_CTRL_SLEEPDEEP
Definition: hw_nvic.h:948
#define NVIC_SYS_CTRL
Definition: hw_nvic.h:118

Here is the call graph for this function:

void SysCtlDeepSleepClockConfigSet ( uint32_t  ui32Div,
uint32_t  ui32Config 
)

Sets the clock configuration of the device while in deep-sleep mode.

Parameters
ui32Divis the clock divider when in deep-sleep mode.
ui32Configis the configuration of the device clocking while in deep-sleep mode.

This function configures the clocking of the device while in deep-sleep mode. The ui32Config parameter selects the oscillator and the ui32Div parameter sets the clock divider used in deep-sleep mode. The valid values for the ui32Div parameter range from 1 to 1024, however not all Tiva microcontrollers support this full range. This function replaces the SysCtlDeepSleepClockSet() function and can be used on Tiva devices that support deep-sleep mode.

The oscillator source is chosen from one of the following values: SYSCTL_DSLP_OSC_MAIN, SYSCTL_DSLP_OSC_INT, SYSCTL_DSLP_OSC_INT30, or SYSCTL_DSLP_OSC_EXT32. The SYSCTL_DSLP_OSC_EXT32 option is only available on devices with the hibernation module, and then only when the hibernation module is enabled.

The precision internal oscillator can be powered down in deep-sleep mode by specifying SYSCTL_DSLP_PIOSC_PD. The precision internal oscillator is not powered down if it is required for operation while in deep-sleep (based on other configuration settings).

The main oscillator can be powered down in deep-sleep mode by specifying SYSCTL_DSLP_MOSC_PD. The main oscillator is not powered down if it is required for operation while in deep-sleep (based on other configuration settings).

Note
The availability of deep-sleep clocking configuration and the configuration values vary with the Tiva device in use. Please consult the data sheet for the device you are using to determine whether the desired configuration options are available and to determine the valid range for the clock divider.
Returns
None.

Definition at line 3039 of file sysctl.c.

References ASSERT, CLASS_IS_TM4C123, HWREG, SYSCTL_DSCLKCFG, SYSCTL_DSCLKCFG_DSOSCSRC_LFIOSC, SYSCTL_DSCLKCFG_DSOSCSRC_MOSC, SYSCTL_DSCLKCFG_DSOSCSRC_RTC, SYSCTL_DSCLKCFG_MOSCDPD, SYSCTL_DSCLKCFG_PIOSCPD, SYSCTL_DSLP_MOSC_PD, SYSCTL_DSLP_OSC_EXT32, SYSCTL_DSLP_OSC_INT, SYSCTL_DSLP_OSC_INT30, SYSCTL_DSLP_OSC_MAIN, SYSCTL_DSLP_PIOSC_PD, SYSCTL_DSLPCLKCFG, SYSCTL_DSLPCLKCFG_D_M, SYSCTL_DSLPCLKCFG_D_S, and SYSCTL_DSLPCLKCFG_O_M.

3040 {
3041  uint32_t ui32Value;
3042 
3043  ASSERT(ui32Div != 0);
3044 
3045  if(CLASS_IS_TM4C123)
3046  {
3047  //
3048  // Set the deep-sleep clock configuration.
3049  //
3050  HWREG(SYSCTL_DSLPCLKCFG) = (ui32Config & ~SYSCTL_DSLPCLKCFG_D_M) |
3051  ((ui32Div - 1) << SYSCTL_DSLPCLKCFG_D_S);
3052  }
3053  else
3054  {
3055  //
3056  // Initialize the value with the divider.
3057  //
3058  ui32Value = ui32Div - 1;
3059 
3060  //
3061  // Set the clock source selection based on the defines used for
3062  // SysCtlDeepSleepClockSet() function so that there is some backwards
3063  // compatibility.
3064  //
3065  switch(ui32Config & SYSCTL_DSLPCLKCFG_O_M)
3066  {
3067  //
3068  // Choose the main external oscillator.
3069  //
3070  case SYSCTL_DSLP_OSC_MAIN:
3071  {
3072  ui32Value |= SYSCTL_DSCLKCFG_DSOSCSRC_MOSC;
3073 
3074  break;
3075  }
3076 
3077  //
3078  // Choose the low frequency oscillator.
3079  //
3080  case SYSCTL_DSLP_OSC_INT30:
3081  {
3082  ui32Value |= SYSCTL_DSCLKCFG_DSOSCSRC_LFIOSC;
3083 
3084  break;
3085  }
3086 
3087  //
3088  // Choose the low frequency oscillator.
3089  //
3090  case SYSCTL_DSLP_OSC_EXT32:
3091  {
3092  ui32Value |= SYSCTL_DSCLKCFG_DSOSCSRC_RTC;
3093 
3094  break;
3095  }
3096  //
3097  // The zero value uses the PIOSC as the clock source.
3098  //
3099  case SYSCTL_DSLP_OSC_INT:
3100  default:
3101  {
3102  break;
3103  }
3104  }
3105 
3106  //
3107  // Set the PIOSC power down bit.
3108  //
3109  if(ui32Config & SYSCTL_DSLP_PIOSC_PD)
3110  {
3111  ui32Value |= SYSCTL_DSCLKCFG_PIOSCPD;
3112  }
3113 
3114  //
3115  // Set the PIOSC power down bit.
3116  //
3117  if(ui32Config & SYSCTL_DSLP_MOSC_PD)
3118  {
3119  ui32Value |= SYSCTL_DSCLKCFG_MOSCDPD;
3120  }
3121 
3122  //
3123  // Update the deep-sleep clock configuration.
3124  //
3125  HWREG(SYSCTL_DSCLKCFG) = ui32Value;
3126  }
3127 }
#define SYSCTL_DSCLKCFG_DSOSCSRC_RTC
Definition: hw_sysctl.h:1482
#define SYSCTL_DSLPCLKCFG_O_M
Definition: hw_sysctl.h:1457
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_DSLPCLKCFG_D_M
Definition: hw_sysctl.h:1456
#define SYSCTL_DSLP_MOSC_PD
Definition: sysctl.h:461
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_DSLP_OSC_INT
Definition: sysctl.h:457
#define SYSCTL_DSCLKCFG
Definition: hw_sysctl.h:100
#define SYSCTL_DSLPCLKCFG_D_S
Definition: hw_sysctl.h:1464
#define SYSCTL_DSLP_PIOSC_PD
Definition: sysctl.h:460
#define SYSCTL_DSLP_OSC_MAIN
Definition: sysctl.h:456
#define SYSCTL_DSCLKCFG_PIOSCPD
Definition: hw_sysctl.h:1472
#define CLASS_IS_TM4C123
Definition: hw_types.h:93
#define SYSCTL_DSLPCLKCFG
Definition: hw_sysctl.h:99
#define SYSCTL_DSLP_OSC_INT30
Definition: sysctl.h:458
#define SYSCTL_DSCLKCFG_MOSCDPD
Definition: hw_sysctl.h:1473
#define SYSCTL_DSCLKCFG_DSOSCSRC_LFIOSC
Definition: hw_sysctl.h:1478
#define SYSCTL_DSLP_OSC_EXT32
Definition: sysctl.h:459
#define SYSCTL_DSCLKCFG_DSOSCSRC_MOSC
Definition: hw_sysctl.h:1480
void SysCtlDeepSleepClockSet ( uint32_t  ui32Config)

Sets the clocking of the device while in deep-sleep mode.

Parameters
ui32Configis the required configuration of the device clocking while in deep-sleep mode.

This function configures the clocking of the device while in deep-sleep mode. The oscillator to be used and the system clock divider are configured with this function.

The ui32Config parameter is the logical OR of the following values:

The system clock divider is chosen from one of the following values: SYSCTL_DSLP_DIV_1, SYSCTL_DSLP_DIV_2, SYSCTL_DSLP_DIV_3, ... SYSCTL_DSLP_DIV_64.

The oscillator source is chosen from one of the following values: SYSCTL_DSLP_OSC_MAIN, SYSCTL_DSLP_OSC_INT, SYSCTL_DSLP_OSC_INT30, or SYSCTL_DSLP_OSC_EXT32. SYSCTL_OSC_EXT32 is only available on devices with the hibernation module, and then only when the hibernation module has been enabled.

The precision internal oscillator can be powered down in deep-sleep mode by specifying SYSCTL_DSLP_PIOSC_PD. The precision internal oscillator is not powered down if it is required for operation while in deep-sleep (based on other configuration settings.)

Note
This function should only be called on TM4C123 devices. For other devices use the SysCtlDeepSleepClockConfigSet() function.
The availability of deep-sleep clocking configuration varies with the Tiva part in use. Please consult the data sheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 2989 of file sysctl.c.

References HWREG, and SYSCTL_DSLPCLKCFG.

2990 {
2991  //
2992  // Set the deep-sleep clock configuration.
2993  //
2994  HWREG(SYSCTL_DSLPCLKCFG) = ui32Config;
2995 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_DSLPCLKCFG
Definition: hw_sysctl.h:99
void SysCtlDeepSleepPowerSet ( uint32_t  ui32Config)

Configures the power to the flash and SRAM while in deep-sleep mode.

Parameters
ui32Configis the required flash and SRAM power configuration.

This function allows the power configuration of the flash and SRAM while in deep-sleep mode to be set. The ui32Config parameter is the logical OR of the flash power configuration and the SRAM power configuration.

The flash power configuration is specified as either:

  • SYSCTL_FLASH_NORMAL - The flash is left in fully powered mode, providing fast wake-up time but higher power consumption.
  • SYSCTL_FLASH_LOW_POWER - The flash is in low power mode, providing reduced power consumption but longer wake-up time.

The SRAM power configuration is specified as one of:

  • SYSCTL_LDO_SLEEP - The LDO is in sleep mode.
  • SYSCTL_TEMP_LOW_POWER - The temperature sensor in low power mode.
  • SYSCTL_SRAM_NORMAL - The SRAM is left in fully powered mode, providing fast wake-up time but higher power consumption.
  • SYSCTL_SRAM_STANDBY - The SRAM is placed into a lower power mode, providing reduced power consumption but longer wake-up time.
  • SYSCTL_SRAM_LOW_POWER - The SRAM is placed into lowest power mode, providing further reduced power consumption but longer wake-up time.
Note
The availability of this feature varies with the Tiva part in use. Please consult the data sheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1649 of file sysctl.c.

References HWREG, and SYSCTL_DSLPPWRCFG.

1650 {
1651  //
1652  // Set the deep-sleep-mode flash and SRAM power configuration.
1653  //
1654  HWREG(SYSCTL_DSLPPWRCFG) = ui32Config;
1655 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_DSLPPWRCFG
Definition: hw_sysctl.h:113
uint32_t SysCtlFlashSectorSizeGet ( void  )

Gets the size of a single eraseable sector of flash.

This function determines the flash sector size on the Tiva device. This size determines the erase granularity of the device flash.

Returns
The number of bytes in a single flash sector.

Definition at line 500 of file sysctl.c.

References CLASS_IS_TM4C129, FLASH_PP, FLASH_PP_MAINSS_M, FLASH_PP_MAINSS_S, and HWREG.

501 {
502  //
503  // TM4C129 devices store the value in a different register.
504  //
505  if(CLASS_IS_TM4C129)
506  {
507  //
508  // Get the flash sector size from the FLASH_PP register.
509  //
510  return(1 << (10 +
511  ((HWREG(FLASH_PP) &
513  }
514  else
515  {
516  //
517  // The sector size is fixed at 1KB.
518  //
519  return(1024);
520  }
521 }
#define HWREG(x)
Definition: hw_types.h:48
#define FLASH_PP_MAINSS_M
Definition: hw_flash.h:260
#define FLASH_PP
Definition: hw_flash.h:60
#define CLASS_IS_TM4C129
Definition: hw_types.h:99
#define FLASH_PP_MAINSS_S
Definition: sysctl.c:65
uint32_t SysCtlFlashSizeGet ( void  )

Gets the size of the flash.

This function determines the size of the flash on the Tiva device.

Returns
The total number of bytes of flash.

Definition at line 467 of file sysctl.c.

References CLASS_IS_TM4C123, FLASH_PP, FLASH_PP_SIZE_M, HWREG, SYSCTL_DC0, and SYSCTL_DC0_FLASHSZ_M.

468 {
469 
470  //
471  // TM4C123 devices report the flash size in DC0.
472  //
473  if(CLASS_IS_TM4C123)
474  {
475  //
476  // Compute the size of the flash.
477  //
478  return(((HWREG(SYSCTL_DC0) & SYSCTL_DC0_FLASHSZ_M) << 11) + 0x800);
479  }
480  else
481  {
482  //
483  // Get the flash size from the FLASH_PP register.
484  //
485  return(2048 * ((HWREG(FLASH_PP) & FLASH_PP_SIZE_M) + 1));
486  }
487 }
#define HWREG(x)
Definition: hw_types.h:48
#define FLASH_PP_SIZE_M
Definition: hw_flash.h:267
#define SYSCTL_DC0
Definition: hw_sysctl.h:50
#define SYSCTL_DC0_FLASHSZ_M
Definition: hw_sysctl.h:646
#define FLASH_PP
Definition: hw_flash.h:60
#define CLASS_IS_TM4C123
Definition: hw_types.h:93
void SysCtlGPIOAHBDisable ( uint32_t  ui32GPIOPeripheral)

Disables access to a GPIO peripheral via the AHB.

Parameters
ui32GPIOPeripheralis the GPIO peripheral to disable.

This function disables the specified GPIO peripheral for access from the Advanced Host Bus (AHB). Once disabled, the GPIO peripheral is accessed from the legacy Advanced Peripheral Bus (APB).

The ui32GPIOPeripheral argument must be only one of the following values: SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, or SYSCTL_PERIPH_GPIOJ.

Note
Some devices allow disabling AHB access to GPIO ports that are only present on the AHB. Disabling AHB access to these ports will disable access to these GPIO ports. On some devices, all GPIO ports are only available on AHB.
Returns
None.

Definition at line 3294 of file sysctl.c.

References ASSERT, HWREG, SYSCTL_GPIOHBCTL, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, and SYSCTL_PERIPH_GPIOJ.

3295 {
3296  //
3297  // Check the arguments.
3298  //
3299  ASSERT((ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOA) ||
3300  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOB) ||
3301  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOC) ||
3302  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOD) ||
3303  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOE) ||
3304  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOF) ||
3305  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOG) ||
3306  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOH) ||
3307  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOJ));
3308 
3309  //
3310  // Disable this GPIO for AHB access.
3311  //
3312  HWREG(SYSCTL_GPIOHBCTL) &= ~(1 << (ui32GPIOPeripheral & 0xF));
3313 }
#define SYSCTL_PERIPH_GPIOJ
Definition: sysctl.h:79
#define SYSCTL_PERIPH_GPIOG
Definition: sysctl.h:77
#define SYSCTL_PERIPH_GPIOH
Definition: sysctl.h:78
#define SYSCTL_PERIPH_GPIOB
Definition: sysctl.h:72
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_PERIPH_GPIOF
Definition: sysctl.h:76
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_PERIPH_GPIOA
Definition: sysctl.h:71
#define SYSCTL_PERIPH_GPIOC
Definition: sysctl.h:73
#define SYSCTL_GPIOHBCTL
Definition: hw_sysctl.h:72
#define SYSCTL_PERIPH_GPIOE
Definition: sysctl.h:75
#define SYSCTL_PERIPH_GPIOD
Definition: sysctl.h:74
void SysCtlGPIOAHBEnable ( uint32_t  ui32GPIOPeripheral)

Enables access to a GPIO peripheral via the AHB.

Parameters
ui32GPIOPeripheralis the GPIO peripheral to enable.

This function is used to enable the specified GPIO peripheral to be accessed from the Advanced Host Bus (AHB) instead of the legacy Advanced Peripheral Bus (APB). When a GPIO peripheral is enabled for AHB access, the _AHB_BASE form of the base address should be used for GPIO functions. For example, instead of using GPIO_PORTA_BASE as the base address for GPIO functions, use GPIO_PORTA_AHB_BASE instead.

The ui32GPIOPeripheral argument must be only one of the following values: SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, or SYSCTL_PERIPH_GPIOJ.

Note
On some devices, all GPIO ports are only available on AHB.
Returns
None.

Definition at line 3248 of file sysctl.c.

References ASSERT, HWREG, SYSCTL_GPIOHBCTL, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, and SYSCTL_PERIPH_GPIOJ.

Referenced by adc_init().

3249 {
3250  //
3251  // Check the arguments.
3252  //
3253  ASSERT((ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOA) ||
3254  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOB) ||
3255  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOC) ||
3256  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOD) ||
3257  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOE) ||
3258  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOF) ||
3259  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOG) ||
3260  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOH) ||
3261  (ui32GPIOPeripheral == SYSCTL_PERIPH_GPIOJ));
3262 
3263  //
3264  // Enable this GPIO for AHB access.
3265  //
3266  HWREG(SYSCTL_GPIOHBCTL) |= (1 << (ui32GPIOPeripheral & 0xF));
3267 }
#define SYSCTL_PERIPH_GPIOJ
Definition: sysctl.h:79
#define SYSCTL_PERIPH_GPIOG
Definition: sysctl.h:77
#define SYSCTL_PERIPH_GPIOH
Definition: sysctl.h:78
#define SYSCTL_PERIPH_GPIOB
Definition: sysctl.h:72
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_PERIPH_GPIOF
Definition: sysctl.h:76
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_PERIPH_GPIOA
Definition: sysctl.h:71
#define SYSCTL_PERIPH_GPIOC
Definition: sysctl.h:73
#define SYSCTL_GPIOHBCTL
Definition: hw_sysctl.h:72
#define SYSCTL_PERIPH_GPIOE
Definition: sysctl.h:75
#define SYSCTL_PERIPH_GPIOD
Definition: sysctl.h:74

Here is the caller graph for this function:

void SysCtlIntClear ( uint32_t  ui32Ints)

Clears system control interrupt sources.

Parameters
ui32Intsis a bit mask of the interrupt sources to be cleared. Must be a logical OR of SYSCTL_INT_BOR0, SYSCTL_INT_VDDA_OK, SYSCTL_INT_MOSC_PUP, SYSCTL_INT_USBPLL_LOCK, SYSCTL_INT_PLL_LOCK, SYSCTL_INT_MOSC_FAIL, SYSCTL_INT_BOR, and/or SYSCTL_INT_BOR1.

The specified system control interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep it from being called again immediately on exit.

Note
Because there is a write buffer in the Cortex-M processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted).
The interrupt sources vary based on the Tiva part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available.
Returns
None.

Definition at line 1386 of file sysctl.c.

References HWREG, and SYSCTL_MISC.

1387 {
1388  //
1389  // Clear the requested interrupt sources.
1390  //
1391  HWREG(SYSCTL_MISC) = ui32Ints;
1392 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_MISC
Definition: hw_sysctl.h:66
void SysCtlIntDisable ( uint32_t  ui32Ints)

Disables individual system control interrupt sources.

Parameters
ui32Intsis a bit mask of the interrupt sources to be disabled. Must be a logical OR of SYSCTL_INT_BOR0, SYSCTL_INT_VDDA_OK, SYSCTL_INT_MOSC_PUP, SYSCTL_INT_USBPLL_LOCK, SYSCTL_INT_PLL_LOCK, SYSCTL_INT_MOSC_FAIL, SYSCTL_INT_BOR, and/or SYSCTL_INT_BOR1.

This function disables the indicated system control interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Note
The interrupt sources vary based on the Tiva part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available.
Returns
None.

Definition at line 1347 of file sysctl.c.

References HWREG, and SYSCTL_IMC.

1348 {
1349  //
1350  // Disable the specified interrupts.
1351  //
1352  HWREG(SYSCTL_IMC) &= ~(ui32Ints);
1353 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_IMC
Definition: hw_sysctl.h:65
void SysCtlIntEnable ( uint32_t  ui32Ints)

Enables individual system control interrupt sources.

Parameters
ui32Intsis a bit mask of the interrupt sources to be enabled. Must be a logical OR of SYSCTL_INT_BOR0, SYSCTL_INT_VDDA_OK, SYSCTL_INT_MOSC_PUP, SYSCTL_INT_USBPLL_LOCK, SYSCTL_INT_PLL_LOCK, SYSCTL_INT_MOSC_FAIL, SYSCTL_INT_BOR, and/or SYSCTL_INT_BOR1.

This function enables the indicated system control interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Note
The interrupt sources vary based on the Tiva part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available.
Returns
None.

Definition at line 1317 of file sysctl.c.

References HWREG, and SYSCTL_IMC.

1318 {
1319  //
1320  // Enable the specified interrupts.
1321  //
1322  HWREG(SYSCTL_IMC) |= ui32Ints;
1323 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_IMC
Definition: hw_sysctl.h:65
void SysCtlIntRegister ( void(*)(void)  pfnHandler)

Registers an interrupt handler for the system control interrupt.

Parameters
pfnHandleris a pointer to the function to be called when the system control interrupt occurs.

This function registers the handler to be called when a system control interrupt occurs. This function enables the global interrupt in the interrupt controller; specific system control interrupts must be enabled via SysCtlIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source via SysCtlIntClear().

System control can generate interrupts when the PLL achieves lock, if the internal LDO current limit is exceeded, if the internal oscillator fails, if the main oscillator fails, if the internal LDO output voltage droops too much, if the external voltage droops too much, or if the PLL fails.

See also
IntRegister() for important information about registering interrupt handlers.
Note
The events that cause system control interrupts vary based on the Tiva part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available.
Returns
None.

Definition at line 1254 of file sysctl.c.

References INT_SYSCTL_TM4C123, IntEnable(), and IntRegister().

1255 {
1256  //
1257  // Register the interrupt handler, returning an error if an error occurs.
1258  //
1259  IntRegister(INT_SYSCTL_TM4C123, pfnHandler);
1260 
1261  //
1262  // Enable the system control interrupt.
1263  //
1265 }
#define INT_SYSCTL_TM4C123
Definition: hw_ints.h:92
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Definition: interrupt.c:309
void IntEnable(uint32_t ui32Interrupt)
Definition: interrupt.c:610

Here is the call graph for this function:

uint32_t SysCtlIntStatus ( bool  bMasked)

Gets the current interrupt status.

Parameters
bMaskedis false if the raw interrupt status is required and true if the masked interrupt status is required.

This function returns the interrupt status for the system controller. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.

Note
The interrupt sources vary based on the Tiva part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available.
Returns
The current interrupt status, enumerated as a bit field of SYSCTL_INT_BOR0, SYSCTL_INT_VDDA_OK, SYSCTL_INT_MOSC_PUP, SYSCTL_INT_USBPLL_LOCK, SYSCTL_INT_PLL_LOCK, SYSCTL_INT_MOSC_FAIL, SYSCTL_INT_BOR, and/or SYSCTL_INT_BOR1.

Definition at line 1417 of file sysctl.c.

References HWREG, SYSCTL_MISC, and SYSCTL_RIS.

1418 {
1419  //
1420  // Return either the interrupt status or the raw interrupt status as
1421  // requested.
1422  //
1423  if(bMasked)
1424  {
1425  return(HWREG(SYSCTL_MISC));
1426  }
1427  else
1428  {
1429  return(HWREG(SYSCTL_RIS));
1430  }
1431 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_RIS
Definition: hw_sysctl.h:64
#define SYSCTL_MISC
Definition: hw_sysctl.h:66
void SysCtlIntUnregister ( void  )

Unregisters the interrupt handler for the system control interrupt.

This function unregisters the handler to be called when a system control interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

Definition at line 1282 of file sysctl.c.

References INT_SYSCTL_TM4C123, IntDisable(), and IntUnregister().

1283 {
1284  //
1285  // Disable the interrupt.
1286  //
1288 
1289  //
1290  // Unregister the interrupt handler.
1291  //
1293 }
#define INT_SYSCTL_TM4C123
Definition: hw_ints.h:92
void IntUnregister(uint32_t ui32Interrupt)
Definition: interrupt.c:381
void IntDisable(uint32_t ui32Interrupt)
Definition: interrupt.c:684

Here is the call graph for this function:

uint32_t SysCtlLDODeepSleepGet ( void  )

Returns the output voltage of the LDO when the device enters deep-sleep mode.

This function returns the output voltage of the LDO when the device is in deep-sleep mode, as specified by the control register.

Note
The availability of this feature, the default LDO voltage, and the adjustment range varies with the Tiva part in use. Please consult the data sheet for the part you are using to determine whether this support is available.
Returns
Returns the deep-sleep-mode voltage of the LDO; is one of SYSCTL_LDO_0_90V, SYSCTL_LDO_0_95V, SYSCTL_LDO_1_00V, SYSCTL_LDO_1_05V, SYSCTL_LDO_1_10V, SYSCTL_LDO_1_15V, or SYSCTL_LDO_1_20V.

Definition at line 1563 of file sysctl.c.

References HWREG, and SYSCTL_LDODPCTL.

1564 {
1565  //
1566  // Return the deep-sleep-mode LDO voltage setting.
1567  //
1568  return(HWREG(SYSCTL_LDODPCTL));
1569 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_LDODPCTL
Definition: hw_sysctl.h:117
void SysCtlLDODeepSleepSet ( uint32_t  ui32Voltage)

Sets the output voltage of the LDO when the device enters deep-sleep mode.

Parameters
ui32Voltageis the required output voltage from the LDO while in deep-sleep mode.

This function sets the output voltage of the LDO while in deep-sleep mode. The ui32Voltage parameter specifies the output voltage of the LDO and must be one of the following values: SYSCTL_LDO_0_90V, SYSCTL_LDO_0_95V, SYSCTL_LDO_1_00V, SYSCTL_LDO_1_05V, SYSCTL_LDO_1_10V, SYSCTL_LDO_1_15V, or SYSCTL_LDO_1_20V.

Note
The availability of this feature, the default LDO voltage, and the adjustment range varies with the Tiva part in use. Please consult the data sheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1524 of file sysctl.c.

References ASSERT, HWREG, SYSCTL_LDO_0_90V, SYSCTL_LDO_0_95V, SYSCTL_LDO_1_00V, SYSCTL_LDO_1_05V, SYSCTL_LDO_1_10V, SYSCTL_LDO_1_15V, SYSCTL_LDO_1_20V, and SYSCTL_LDODPCTL.

1525 {
1526  //
1527  // Check the arguments.
1528  //
1529  ASSERT((ui32Voltage == SYSCTL_LDO_0_90V) ||
1530  (ui32Voltage == SYSCTL_LDO_0_95V) ||
1531  (ui32Voltage == SYSCTL_LDO_1_00V) ||
1532  (ui32Voltage == SYSCTL_LDO_1_05V) ||
1533  (ui32Voltage == SYSCTL_LDO_1_10V) ||
1534  (ui32Voltage == SYSCTL_LDO_1_15V) ||
1535  (ui32Voltage == SYSCTL_LDO_1_20V));
1536 
1537  //
1538  // Set the deep-sleep LDO voltage to the requested value.
1539  //
1540  HWREG(SYSCTL_LDODPCTL) = ui32Voltage;
1541 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_LDO_1_15V
Definition: sysctl.h:153
#define SYSCTL_LDO_1_00V
Definition: sysctl.h:150
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_LDO_0_95V
Definition: sysctl.h:149
#define SYSCTL_LDODPCTL
Definition: hw_sysctl.h:117
#define SYSCTL_LDO_0_90V
Definition: sysctl.h:148
#define SYSCTL_LDO_1_20V
Definition: sysctl.h:154
#define SYSCTL_LDO_1_05V
Definition: sysctl.h:151
#define SYSCTL_LDO_1_10V
Definition: sysctl.h:152
uint32_t SysCtlLDOSleepGet ( void  )

Returns the output voltage of the LDO when the device enters sleep mode.

This function determines the output voltage of the LDO while in sleep mode, as specified by the control register.

Note
The availability of this feature, the default LDO voltage, and the adjustment range varies with the Tiva part in use. Please consult the data sheet for the part you are using to determine whether this support is available.
Returns
Returns the sleep-mode voltage of the LDO and is one of SYSCTL_LDO_0_90V, SYSCTL_LDO_0_95V, SYSCTL_LDO_1_00V, SYSCTL_LDO_1_05V, SYSCTL_LDO_1_10V, SYSCTL_LDO_1_15V, or SYSCTL_LDO_1_20V.

Definition at line 1493 of file sysctl.c.

References HWREG, and SYSCTL_LDOSPCTL.

1494 {
1495  //
1496  // Return the sleep-mode LDO voltage setting.
1497  //
1498  return(HWREG(SYSCTL_LDOSPCTL));
1499 }
#define SYSCTL_LDOSPCTL
Definition: hw_sysctl.h:116
#define HWREG(x)
Definition: hw_types.h:48
void SysCtlLDOSleepSet ( uint32_t  ui32Voltage)

Sets the output voltage of the LDO when the device enters sleep mode.

Parameters
ui32Voltageis the required output voltage from the LDO while in sleep mode.

This function sets the output voltage of the LDO while in sleep mode. The ui32Voltage parameter must be one of the following values: SYSCTL_LDO_0_90V, SYSCTL_LDO_0_95V, SYSCTL_LDO_1_00V, SYSCTL_LDO_1_05V, SYSCTL_LDO_1_10V, SYSCTL_LDO_1_15V, or SYSCTL_LDO_1_20V.

Note
The availability of this feature, the default LDO voltage, and the adjustment range varies with the Tiva part in use. Please consult the data sheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1455 of file sysctl.c.

References ASSERT, HWREG, SYSCTL_LDO_0_90V, SYSCTL_LDO_0_95V, SYSCTL_LDO_1_00V, SYSCTL_LDO_1_05V, SYSCTL_LDO_1_10V, SYSCTL_LDO_1_15V, SYSCTL_LDO_1_20V, and SYSCTL_LDOSPCTL.

1456 {
1457  //
1458  // Check the arguments.
1459  //
1460  ASSERT((ui32Voltage == SYSCTL_LDO_0_90V) ||
1461  (ui32Voltage == SYSCTL_LDO_0_95V) ||
1462  (ui32Voltage == SYSCTL_LDO_1_00V) ||
1463  (ui32Voltage == SYSCTL_LDO_1_05V) ||
1464  (ui32Voltage == SYSCTL_LDO_1_10V) ||
1465  (ui32Voltage == SYSCTL_LDO_1_15V) ||
1466  (ui32Voltage == SYSCTL_LDO_1_20V));
1467 
1468  //
1469  // Set the sleep-mode LDO voltage to the requested value.
1470  //
1471  HWREG(SYSCTL_LDOSPCTL) = ui32Voltage;
1472 }
#define SYSCTL_LDOSPCTL
Definition: hw_sysctl.h:116
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_LDO_1_15V
Definition: sysctl.h:153
#define SYSCTL_LDO_1_00V
Definition: sysctl.h:150
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_LDO_0_95V
Definition: sysctl.h:149
#define SYSCTL_LDO_0_90V
Definition: sysctl.h:148
#define SYSCTL_LDO_1_20V
Definition: sysctl.h:154
#define SYSCTL_LDO_1_05V
Definition: sysctl.h:151
#define SYSCTL_LDO_1_10V
Definition: sysctl.h:152
void SysCtlMOSCConfigSet ( uint32_t  ui32Config)

Provides a small delay.

Parameters
ui32Countis the number of delay loop iterations to perform.

This function provides a means of generating a delay by executing a simple 3 instruction cycle loop a given number of times. It is written in assembly to keep the loop instruction count consistent across tool chains.

It is important to note that this function does NOT provide an accurate timing mechanism. Although the delay loop is 3 instruction cycles long, the execution time of the loop will vary dramatically depending upon the application's interrupt environment (the loop will be interrupted unless run with interrupts disabled and this is generally an unwise thing to do) and also the current system clock rate and flash timings (wait states and the operation of the prefetch buffer affect the timing).

For better accuracy, the ROM version of this function may be used. This version will not suffer from flash- and prefect buffer-related timing variability but will still be delayed by interrupt service routines.

For best accuracy, a system timer should be used with code either polling for a particular timer value being exceeded or processing the timer interrupt to determine when a particular time period has elapsed.

Returns
None. Sets the configuration of the main oscillator (MOSC) control.
Parameters
ui32Configis the required configuration of the MOSC control.

This function configures the control of the main oscillator. The ui32Config is specified as the logical OR of the following values:

  • SYSCTL_MOSC_VALIDATE enables the MOSC verification circuit that detects a failure of the main oscillator (such as a loss of the clock).
  • SYSCTL_MOSC_INTERRUPT indicates that a MOSC failure should generate an interrupt instead of resetting the processor.
  • SYSCTL_MOSC_NO_XTAL indicates that there is no crystal or oscillator connected to the OSC0/OSC1 pins, allowing power consumption to be reduced.
  • SYSCTL_MOSC_PWR_DIS disable power to the main oscillator. If this parameter is not specified, the MOSC input remains powered.
  • SYSCTL_MOSC_LOWFREQ MOSC is less than 10 MHz.
  • SYSCTL_MOSC_HIGHFREQ MOSC is greater than 10 MHz.
  • SYSCTL_MOSC_SESRC specifies that the MOSC is a single-ended oscillator connected to OSC0. If this parameter is not specified, the input is assumed to be a crystal.
Note
The availability of MOSC control varies based on the Tiva part in use. Please consult the data sheet for the part you are using to determine whether this support is available. In addition, the capability of MOSC control varies based on the Tiva part in use.
Returns
None.

Definition at line 1900 of file sysctl.c.

References HWREG, and SYSCTL_MOSCCTL.

1901 {
1902  //
1903  // Configure the MOSC control.
1904  //
1905  HWREG(SYSCTL_MOSCCTL) = ui32Config;
1906 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_MOSCCTL
Definition: hw_sysctl.h:75
void SysCtlNMIClear ( uint32_t  ui32Ints)

Clears NMI sources.

Parameters
ui32Intsis a bit mask of the non-maskable interrupt sources.

This function clears the current NMI status specified in the ui32Ints parameter. The valid values for the ui32Ints parameter are a logical OR of the following values:

  • SYSCTL_NMI_MOSCFAIL the main oscillator is not present or did not start.
  • SYSCTL_NMI_TAMPER a tamper event has been detected.
  • SYSCTL_NMI_WDT0 watchdog 0 generated a timeout.
  • SYSCTL_NMI_WDT1 watchdog 1 generated a timeout.
  • SYSCTL_NMI_POWER a power event occurred.
  • SYSCTL_NMI_EXTERNAL an external NMI pin asserted.

Example: Clear all current NMI status flags.

//!
//! //
//! // Clear all the current NMI sources.
//! //
//! SysCtlNMIClear(SysCtlNMIStatus());
//! 
\note The availability of the NMI status varies with the Tiva part in
use.  Please consult the data sheet for the part you are using to determine
which interrupt sources are available.

\return None.  

Definition at line 3583 of file sysctl.c.

References HWREG, and SYSCTL_NMIC.

3584 {
3585  //
3586  // Clear the requested interrupt sources.
3587  //
3588  HWREG(SYSCTL_NMIC) &= ~ui32Ints;
3589 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_NMIC
Definition: hw_sysctl.h:71
uint32_t SysCtlNMIStatus ( void  )

Returns the current NMI status.

This function returns the NMI status for the system controller. The valid values for the ui32Ints parameter are a logical OR of the following values:

  • SYSCTL_NMI_MOSCFAIL the main oscillator is not present or did not start.
  • SYSCTL_NMI_TAMPER a tamper event has been detected.
  • SYSCTL_NMI_WDT0 watchdog 0 generated a timeout.
  • SYSCTL_NMI_WDT1 watchdog 1 generated a timeout.
  • SYSCTL_NMI_POWER a power event occurred.
  • SYSCTL_NMI_EXTERNAL an external NMI pin asserted.

Example: Clear all current NMI status flags.

//!
//! //
//! // Clear all the current NMI sources.
//! //
//! SysCtlNMIClear(SysCtlNMIStatus());
//! 
\note The availability of the NMI status varies with the Tiva part in
use.  Please consult the data sheet for the part you are using to determine
which interrupt sources are available.

\return The current NMI status.  

Definition at line 3543 of file sysctl.c.

References HWREG, and SYSCTL_NMIC.

3544 {
3545  return(HWREG(SYSCTL_NMIC));
3546 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_NMIC
Definition: hw_sysctl.h:71
void SysCtlPeripheralClockGating ( bool  bEnable)

Controls peripheral clock gating in sleep and deep-sleep mode.

Parameters
bEnableis a boolean that is true if the sleep and deep-sleep peripheral configuration should be used and false if not.

This function controls how peripherals are clocked when the processor goes into sleep or deep-sleep mode. By default, the peripherals are clocked the same as in run mode; if peripheral clock gating is enabled, they are clocked according to the configuration set by SysCtlPeripheralSleepEnable(), SysCtlPeripheralSleepDisable(), SysCtlPeripheralDeepSleepEnable(), and SysCtlPeripheralDeepSleepDisable().

Returns
None.

Definition at line 1193 of file sysctl.c.

References CLASS_IS_TM4C123, HWREG, SYSCTL_RCC, SYSCTL_RCC_ACG, SYSCTL_RSCLKCFG, and SYSCTL_RSCLKCFG_ACG.

1194 {
1195  if(CLASS_IS_TM4C123)
1196  {
1197  //
1198  // Enable peripheral clock gating as requested.
1199  //
1200  if(bEnable)
1201  {
1203  }
1204  else
1205  {
1207  }
1208  }
1209  else
1210  {
1211  //
1212  // Enable peripheral clock gating as requested.
1213  //
1214  if(bEnable)
1215  {
1217  }
1218  else
1219  {
1221  }
1222  }
1223 }
#define SYSCTL_RSCLKCFG
Definition: hw_sysctl.h:76
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_RCC_ACG
Definition: hw_sysctl.h:1064
#define SYSCTL_RCC
Definition: hw_sysctl.h:70
#define CLASS_IS_TM4C123
Definition: hw_types.h:93
#define SYSCTL_RSCLKCFG_ACG
Definition: hw_sysctl.h:1185
void SysCtlPeripheralDeepSleepDisable ( uint32_t  ui32Peripheral)

Disables a peripheral in deep-sleep mode.

Parameters
ui32Peripheralis the peripheral to disable in deep-sleep mode.

This function causes a peripheral to stop operating when the processor goes into deep-sleep mode. Disabling peripherals while in deep-sleep mode helps to lower the current draw of the device, and can keep peripherals that require a particular clock frequency from operating when the clock changes as a result of entering deep-sleep mode. If enabled (via SysCtlPeripheralEnable()), the peripheral automatically resumes operation when the processor leaves deep-sleep mode, maintaining its entire state from before deep-sleep mode was entered.

Deep-sleep mode clocking of peripherals must be enabled via SysCtlPeripheralClockGating(); if disabled, the peripheral deep-sleep mode configuration is maintained but has no effect when deep-sleep mode is entered.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_ADC0, SYSCTL_PERIPH_ADC1, SYSCTL_PERIPH_CAN0, SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_CCM0,SYSCTL_PERIPH_COMP0, SYSCTL_PERIPH_EEPROM0, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_EPI0, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, SYSCTL_PERIPH_GPIOJ, SYSCTL_PERIPH_GPIOK, SYSCTL_PERIPH_GPIOL, SYSCTL_PERIPH_GPIOM, SYSCTL_PERIPH_GPION, SYSCTL_PERIPH_GPIOP, SYSCTL_PERIPH_GPIOQ, SYSCTL_PERIPH_GPIOR, SYSCTL_PERIPH_GPIOS, SYSCTL_PERIPH_GPIOT, SYSCTL_PERIPH_HIBERNATE, SYSCTL_PERIPH_I2C0, SYSCTL_PERIPH_I2C1, SYSCTL_PERIPH_I2C2, SYSCTL_PERIPH_I2C3, SYSCTL_PERIPH_I2C4, SYSCTL_PERIPH_I2C5, SYSCTL_PERIPH_I2C6, SYSCTL_PERIPH_I2C7, SYSCTL_PERIPH_I2C8, SYSCTL_PERIPH_I2C9, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_ONEWIRE0, SYSCTL_PERIPH_PWM0, SYSCTL_PERIPH_PWM1, SYSCTL_PERIPH_QEI0, SYSCTL_PERIPH_QEI1, SYSCTL_PERIPH_SSI0, SYSCTL_PERIPH_SSI1, SYSCTL_PERIPH_SSI2, SYSCTL_PERIPH_SSI3, SYSCTL_PERIPH_TIMER0, SYSCTL_PERIPH_TIMER1, SYSCTL_PERIPH_TIMER2, SYSCTL_PERIPH_TIMER3, SYSCTL_PERIPH_TIMER4, SYSCTL_PERIPH_TIMER5, SYSCTL_PERIPH_TIMER6, SYSCTL_PERIPH_TIMER7, SYSCTL_PERIPH_UART0, SYSCTL_PERIPH_UART1, SYSCTL_PERIPH_UART2, SYSCTL_PERIPH_UART3, SYSCTL_PERIPH_UART4, SYSCTL_PERIPH_UART5, SYSCTL_PERIPH_UART6, SYSCTL_PERIPH_UART7, SYSCTL_PERIPH_UDMA, SYSCTL_PERIPH_USB0, SYSCTL_PERIPH_WDOG0, SYSCTL_PERIPH_WDOG1, SYSCTL_PERIPH_WTIMER0, SYSCTL_PERIPH_WTIMER1, SYSCTL_PERIPH_WTIMER2, SYSCTL_PERIPH_WTIMER3, SYSCTL_PERIPH_WTIMER4, or SYSCTL_PERIPH_WTIMER5

Returns
None.

Definition at line 1161 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_DCGCBASE.

1162 {
1163  //
1164  // Check the arguments.
1165  //
1166  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
1167 
1168  //
1169  // Disable this peripheral in deep-sleep mode.
1170  //
1171  HWREGBITW(SYSCTL_DCGCBASE + ((ui32Peripheral & 0xff00) >> 8),
1172  ui32Peripheral & 0xff) = 0;
1173 }
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_DCGCBASE
Definition: sysctl.c:345
#define HWREGBITW(x, b)
Definition: hw_types.h:54
void SysCtlPeripheralDeepSleepEnable ( uint32_t  ui32Peripheral)

Enables a peripheral in deep-sleep mode.

Parameters
ui32Peripheralis the peripheral to enable in deep-sleep mode.

This function allows a peripheral to continue operating when the processor goes into deep-sleep mode. Because the clocking configuration of the device may change, not all peripherals can safely continue operating while the processor is in deep-sleep mode. Those that must run at a particular frequency (such as a UART) do not work as expected if the clock changes. It is the responsibility of the caller to make sensible choices.

Deep-sleep mode clocking of peripherals must be enabled via SysCtlPeripheralClockGating(); if disabled, the peripheral deep-sleep mode configuration is maintained but has no effect when deep-sleep mode is entered.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_ADC0, SYSCTL_PERIPH_ADC1, SYSCTL_PERIPH_CAN0, SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_CCM0,SYSCTL_PERIPH_COMP0, SYSCTL_PERIPH_EEPROM0, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_EPI0, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, SYSCTL_PERIPH_GPIOJ, SYSCTL_PERIPH_GPIOK, SYSCTL_PERIPH_GPIOL, SYSCTL_PERIPH_GPIOM, SYSCTL_PERIPH_GPION, SYSCTL_PERIPH_GPIOP, SYSCTL_PERIPH_GPIOQ, SYSCTL_PERIPH_GPIOR, SYSCTL_PERIPH_GPIOS, SYSCTL_PERIPH_GPIOT, SYSCTL_PERIPH_HIBERNATE, SYSCTL_PERIPH_I2C0, SYSCTL_PERIPH_I2C1, SYSCTL_PERIPH_I2C2, SYSCTL_PERIPH_I2C3, SYSCTL_PERIPH_I2C4, SYSCTL_PERIPH_I2C5, SYSCTL_PERIPH_I2C6, SYSCTL_PERIPH_I2C7, SYSCTL_PERIPH_I2C8, SYSCTL_PERIPH_I2C9, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_ONEWIRE0, SYSCTL_PERIPH_PWM0, SYSCTL_PERIPH_PWM1, SYSCTL_PERIPH_QEI0, SYSCTL_PERIPH_QEI1, SYSCTL_PERIPH_SSI0, SYSCTL_PERIPH_SSI1, SYSCTL_PERIPH_SSI2, SYSCTL_PERIPH_SSI3, SYSCTL_PERIPH_TIMER0, SYSCTL_PERIPH_TIMER1, SYSCTL_PERIPH_TIMER2, SYSCTL_PERIPH_TIMER3, SYSCTL_PERIPH_TIMER4, SYSCTL_PERIPH_TIMER5, SYSCTL_PERIPH_TIMER6, SYSCTL_PERIPH_TIMER7, SYSCTL_PERIPH_UART0, SYSCTL_PERIPH_UART1, SYSCTL_PERIPH_UART2, SYSCTL_PERIPH_UART3, SYSCTL_PERIPH_UART4, SYSCTL_PERIPH_UART5, SYSCTL_PERIPH_UART6, SYSCTL_PERIPH_UART7, SYSCTL_PERIPH_UDMA, SYSCTL_PERIPH_USB0, SYSCTL_PERIPH_WDOG0, SYSCTL_PERIPH_WDOG1, SYSCTL_PERIPH_WTIMER0, SYSCTL_PERIPH_WTIMER1, SYSCTL_PERIPH_WTIMER2, SYSCTL_PERIPH_WTIMER3, SYSCTL_PERIPH_WTIMER4, or SYSCTL_PERIPH_WTIMER5

Returns
None.

Definition at line 1093 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_DCGCBASE.

1094 {
1095  //
1096  // Check the arguments.
1097  //
1098  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
1099 
1100  //
1101  // Enable this peripheral in deep-sleep mode.
1102  //
1103  HWREGBITW(SYSCTL_DCGCBASE + ((ui32Peripheral & 0xff00) >> 8),
1104  ui32Peripheral & 0xff) = 1;
1105 }
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_DCGCBASE
Definition: sysctl.c:345
#define HWREGBITW(x, b)
Definition: hw_types.h:54
void SysCtlPeripheralDisable ( uint32_t  ui32Peripheral)

Disables a peripheral.

Parameters
ui32Peripheralis the peripheral to disable.

This function disables a peripheral. Once disabled, they do not operate or respond to register reads/writes.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_ADC0, SYSCTL_PERIPH_ADC1, SYSCTL_PERIPH_CAN0, SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_CCM0,SYSCTL_PERIPH_COMP0, SYSCTL_PERIPH_EEPROM0, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_EPI0, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, SYSCTL_PERIPH_GPIOJ, SYSCTL_PERIPH_GPIOK, SYSCTL_PERIPH_GPIOL, SYSCTL_PERIPH_GPIOM, SYSCTL_PERIPH_GPION, SYSCTL_PERIPH_GPIOP, SYSCTL_PERIPH_GPIOQ, SYSCTL_PERIPH_GPIOR, SYSCTL_PERIPH_GPIOS, SYSCTL_PERIPH_GPIOT, SYSCTL_PERIPH_HIBERNATE, SYSCTL_PERIPH_I2C0, SYSCTL_PERIPH_I2C1, SYSCTL_PERIPH_I2C2, SYSCTL_PERIPH_I2C3, SYSCTL_PERIPH_I2C4, SYSCTL_PERIPH_I2C5, SYSCTL_PERIPH_I2C6, SYSCTL_PERIPH_I2C7, SYSCTL_PERIPH_I2C8, SYSCTL_PERIPH_I2C9, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_ONEWIRE0, SYSCTL_PERIPH_PWM0, SYSCTL_PERIPH_PWM1, SYSCTL_PERIPH_QEI0, SYSCTL_PERIPH_QEI1, SYSCTL_PERIPH_SSI0, SYSCTL_PERIPH_SSI1, SYSCTL_PERIPH_SSI2, SYSCTL_PERIPH_SSI3, SYSCTL_PERIPH_TIMER0, SYSCTL_PERIPH_TIMER1, SYSCTL_PERIPH_TIMER2, SYSCTL_PERIPH_TIMER3, SYSCTL_PERIPH_TIMER4, SYSCTL_PERIPH_TIMER5, SYSCTL_PERIPH_TIMER6, SYSCTL_PERIPH_TIMER7, SYSCTL_PERIPH_UART0, SYSCTL_PERIPH_UART1, SYSCTL_PERIPH_UART2, SYSCTL_PERIPH_UART3, SYSCTL_PERIPH_UART4, SYSCTL_PERIPH_UART5, SYSCTL_PERIPH_UART6, SYSCTL_PERIPH_UART7, SYSCTL_PERIPH_UDMA, SYSCTL_PERIPH_USB0, SYSCTL_PERIPH_WDOG0, SYSCTL_PERIPH_WDOG1, SYSCTL_PERIPH_WTIMER0, SYSCTL_PERIPH_WTIMER1, SYSCTL_PERIPH_WTIMER2, SYSCTL_PERIPH_WTIMER3, SYSCTL_PERIPH_WTIMER4, or SYSCTL_PERIPH_WTIMER5

Returns
None.

Definition at line 898 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_RCGCBASE.

899 {
900  //
901  // Check the arguments.
902  //
903  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
904 
905  //
906  // Disable this peripheral.
907  //
908  HWREGBITW(SYSCTL_RCGCBASE + ((ui32Peripheral & 0xff00) >> 8),
909  ui32Peripheral & 0xff) = 0;
910 }
#define ASSERT(expr)
Definition: debug.h:67
#define HWREGBITW(x, b)
Definition: hw_types.h:54
#define SYSCTL_RCGCBASE
Definition: sysctl.c:343
void SysCtlPeripheralEnable ( uint32_t  ui32Peripheral)

Enables a peripheral.

Parameters
ui32Peripheralis the peripheral to enable.

This function enables a peripheral. At power-up, all peripherals are disabled; they must be enabled in order to operate or respond to register reads/writes.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_ADC0, SYSCTL_PERIPH_ADC1, SYSCTL_PERIPH_CAN0, SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_CCM0,SYSCTL_PERIPH_COMP0, SYSCTL_PERIPH_EEPROM0, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_EPI0, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, SYSCTL_PERIPH_GPIOJ, SYSCTL_PERIPH_GPIOK, SYSCTL_PERIPH_GPIOL, SYSCTL_PERIPH_GPIOM, SYSCTL_PERIPH_GPION, SYSCTL_PERIPH_GPIOP, SYSCTL_PERIPH_GPIOQ, SYSCTL_PERIPH_GPIOR, SYSCTL_PERIPH_GPIOS, SYSCTL_PERIPH_GPIOT, SYSCTL_PERIPH_HIBERNATE, SYSCTL_PERIPH_I2C0, SYSCTL_PERIPH_I2C1, SYSCTL_PERIPH_I2C2, SYSCTL_PERIPH_I2C3, SYSCTL_PERIPH_I2C4, SYSCTL_PERIPH_I2C5, SYSCTL_PERIPH_I2C6, SYSCTL_PERIPH_I2C7, SYSCTL_PERIPH_I2C8, SYSCTL_PERIPH_I2C9, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_ONEWIRE0, SYSCTL_PERIPH_PWM0, SYSCTL_PERIPH_PWM1, SYSCTL_PERIPH_QEI0, SYSCTL_PERIPH_QEI1, SYSCTL_PERIPH_SSI0, SYSCTL_PERIPH_SSI1, SYSCTL_PERIPH_SSI2, SYSCTL_PERIPH_SSI3, SYSCTL_PERIPH_TIMER0, SYSCTL_PERIPH_TIMER1, SYSCTL_PERIPH_TIMER2, SYSCTL_PERIPH_TIMER3, SYSCTL_PERIPH_TIMER4, SYSCTL_PERIPH_TIMER5, SYSCTL_PERIPH_TIMER6, SYSCTL_PERIPH_TIMER7, SYSCTL_PERIPH_UART0, SYSCTL_PERIPH_UART1, SYSCTL_PERIPH_UART2, SYSCTL_PERIPH_UART3, SYSCTL_PERIPH_UART4, SYSCTL_PERIPH_UART5, SYSCTL_PERIPH_UART6, SYSCTL_PERIPH_UART7, SYSCTL_PERIPH_UDMA, SYSCTL_PERIPH_USB0, SYSCTL_PERIPH_WDOG0, SYSCTL_PERIPH_WDOG1, SYSCTL_PERIPH_WTIMER0, SYSCTL_PERIPH_WTIMER1, SYSCTL_PERIPH_WTIMER2, SYSCTL_PERIPH_WTIMER3, SYSCTL_PERIPH_WTIMER4, or SYSCTL_PERIPH_WTIMER5

Note
It takes five clock cycles after the write to enable a peripheral before the the peripheral is actually enabled. During this time, attempts to access the peripheral result in a bus fault. Care should be taken to ensure that the peripheral is not accessed during this brief time period.
Returns
None.

Definition at line 841 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_RCGCBASE.

Referenced by adc_init(), heart_init(), hw_driver_init(), and main().

842 {
843  //
844  // Check the arguments.
845  //
846  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
847 
848  //
849  // Enable this peripheral.
850  //
851  HWREGBITW(SYSCTL_RCGCBASE + ((ui32Peripheral & 0xff00) >> 8),
852  ui32Peripheral & 0xff) = 1;
853 }
#define ASSERT(expr)
Definition: debug.h:67
#define HWREGBITW(x, b)
Definition: hw_types.h:54
#define SYSCTL_RCGCBASE
Definition: sysctl.c:343

Here is the caller graph for this function:

void SysCtlPeripheralPowerOff ( uint32_t  ui32Peripheral)

Powers off a peripheral.

Parameters
ui32Peripheralis the peripheral to be powered off.

This function allows the power to a peripheral to be turned off. The peripheral continues to receive power when its clock is enabled, but the power is removed when its clock is disabled.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_CAN0,SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_USB0

Note
The ability to power off a peripheral varies based on the Tiva part in use. Please consult the data sheet for the part you are using to determine if this feature is available.
Returns
None.

Definition at line 703 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_PCBASE.

704 {
705  //
706  // Check the arguments.
707  //
708  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
709 
710  //
711  // Power off this peripheral.
712  //
713  HWREGBITW(SYSCTL_PCBASE + ((ui32Peripheral & 0xff00) >> 8),
714  ui32Peripheral & 0xff) = 0;
715 }
#define ASSERT(expr)
Definition: debug.h:67
#define HWREGBITW(x, b)
Definition: hw_types.h:54
#define SYSCTL_PCBASE
Definition: sysctl.c:346
void SysCtlPeripheralPowerOn ( uint32_t  ui32Peripheral)

Powers on a peripheral.

Parameters
ui32Peripheralis the peripheral to be powered on.

This function turns on the power to a peripheral. The peripheral continues to receive power even when its clock is not enabled.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_CAN0,SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_USB0

Note
The ability to power off a peripheral varies based on the Tiva part in use. Please consult the data sheet for the part you are using to determine if this feature is available.
Returns
None.

Definition at line 667 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_PCBASE.

668 {
669  //
670  // Check the arguments.
671  //
672  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
673 
674  //
675  // Power on this peripheral.
676  //
677  HWREGBITW(SYSCTL_PCBASE + ((ui32Peripheral & 0xff00) >> 8),
678  ui32Peripheral & 0xff) = 1;
679 }
#define ASSERT(expr)
Definition: debug.h:67
#define HWREGBITW(x, b)
Definition: hw_types.h:54
#define SYSCTL_PCBASE
Definition: sysctl.c:346
bool SysCtlPeripheralPresent ( uint32_t  ui32Peripheral)

Determines if a peripheral is present.

Parameters
ui32Peripheralis the peripheral in question.

This function determines if a particular peripheral is present in the device. Each member of the Tiva family has a different peripheral set; this function determines which peripherals are present on this device.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_ADC0, SYSCTL_PERIPH_ADC1, SYSCTL_PERIPH_CAN0, SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_CCM0,SYSCTL_PERIPH_COMP0, SYSCTL_PERIPH_EEPROM0, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_EPI0, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, SYSCTL_PERIPH_GPIOJ, SYSCTL_PERIPH_GPIOK, SYSCTL_PERIPH_GPIOL, SYSCTL_PERIPH_GPIOM, SYSCTL_PERIPH_GPION, SYSCTL_PERIPH_GPIOP, SYSCTL_PERIPH_GPIOQ, SYSCTL_PERIPH_GPIOR, SYSCTL_PERIPH_GPIOS, SYSCTL_PERIPH_GPIOT, SYSCTL_PERIPH_HIBERNATE, SYSCTL_PERIPH_I2C0, SYSCTL_PERIPH_I2C1, SYSCTL_PERIPH_I2C2, SYSCTL_PERIPH_I2C3, SYSCTL_PERIPH_I2C4, SYSCTL_PERIPH_I2C5, SYSCTL_PERIPH_I2C6, SYSCTL_PERIPH_I2C7, SYSCTL_PERIPH_I2C8, SYSCTL_PERIPH_I2C9, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_ONEWIRE0, SYSCTL_PERIPH_PWM0, SYSCTL_PERIPH_PWM1, SYSCTL_PERIPH_QEI0, SYSCTL_PERIPH_QEI1, SYSCTL_PERIPH_SSI0, SYSCTL_PERIPH_SSI1, SYSCTL_PERIPH_SSI2, SYSCTL_PERIPH_SSI3, SYSCTL_PERIPH_TIMER0, SYSCTL_PERIPH_TIMER1, SYSCTL_PERIPH_TIMER2, SYSCTL_PERIPH_TIMER3, SYSCTL_PERIPH_TIMER4, SYSCTL_PERIPH_TIMER5, SYSCTL_PERIPH_TIMER6, SYSCTL_PERIPH_TIMER7, SYSCTL_PERIPH_UART0, SYSCTL_PERIPH_UART1, SYSCTL_PERIPH_UART2, SYSCTL_PERIPH_UART3, SYSCTL_PERIPH_UART4, SYSCTL_PERIPH_UART5, SYSCTL_PERIPH_UART6, SYSCTL_PERIPH_UART7, SYSCTL_PERIPH_UDMA, SYSCTL_PERIPH_USB0, SYSCTL_PERIPH_WDOG0, SYSCTL_PERIPH_WDOG1, SYSCTL_PERIPH_WTIMER0, SYSCTL_PERIPH_WTIMER1, SYSCTL_PERIPH_WTIMER2, SYSCTL_PERIPH_WTIMER3, SYSCTL_PERIPH_WTIMER4, or SYSCTL_PERIPH_WTIMER5

Returns
Returns true if the specified peripheral is present and false if it is not.

Definition at line 568 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_PPBASE.

569 {
570  //
571  // Check the arguments.
572  //
573  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
574 
575  //
576  // See if this peripheral is present.
577  //
578  return(HWREGBITW(SYSCTL_PPBASE + ((ui32Peripheral & 0xff00) >> 8),
579  ui32Peripheral & 0xff));
580 }
#define SYSCTL_PPBASE
Definition: sysctl.c:341
#define ASSERT(expr)
Definition: debug.h:67
#define HWREGBITW(x, b)
Definition: hw_types.h:54
bool SysCtlPeripheralReady ( uint32_t  ui32Peripheral)

Determines if a peripheral is ready.

Parameters
ui32Peripheralis the peripheral in question.

This function determines if a particular peripheral is ready to be accessed. The peripheral may be in a non-ready state if it is not enabled, is being held in reset, or is in the process of becoming ready after being enabled or taken out of reset.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_ADC0, SYSCTL_PERIPH_ADC1, SYSCTL_PERIPH_CAN0, SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_CCM0,SYSCTL_PERIPH_COMP0, SYSCTL_PERIPH_EEPROM0, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_EPI0, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, SYSCTL_PERIPH_GPIOJ, SYSCTL_PERIPH_GPIOK, SYSCTL_PERIPH_GPIOL, SYSCTL_PERIPH_GPIOM, SYSCTL_PERIPH_GPION, SYSCTL_PERIPH_GPIOP, SYSCTL_PERIPH_GPIOQ, SYSCTL_PERIPH_GPIOR, SYSCTL_PERIPH_GPIOS, SYSCTL_PERIPH_GPIOT, SYSCTL_PERIPH_HIBERNATE, SYSCTL_PERIPH_I2C0, SYSCTL_PERIPH_I2C1, SYSCTL_PERIPH_I2C2, SYSCTL_PERIPH_I2C3, SYSCTL_PERIPH_I2C4, SYSCTL_PERIPH_I2C5, SYSCTL_PERIPH_I2C6, SYSCTL_PERIPH_I2C7, SYSCTL_PERIPH_I2C8, SYSCTL_PERIPH_I2C9, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_ONEWIRE0, SYSCTL_PERIPH_PWM0, SYSCTL_PERIPH_PWM1, SYSCTL_PERIPH_QEI0, SYSCTL_PERIPH_QEI1, SYSCTL_PERIPH_SSI0, SYSCTL_PERIPH_SSI1, SYSCTL_PERIPH_SSI2, SYSCTL_PERIPH_SSI3, SYSCTL_PERIPH_TIMER0, SYSCTL_PERIPH_TIMER1, SYSCTL_PERIPH_TIMER2, SYSCTL_PERIPH_TIMER3, SYSCTL_PERIPH_TIMER4, SYSCTL_PERIPH_TIMER5, SYSCTL_PERIPH_TIMER6, SYSCTL_PERIPH_TIMER7, SYSCTL_PERIPH_UART0, SYSCTL_PERIPH_UART1, SYSCTL_PERIPH_UART2, SYSCTL_PERIPH_UART3, SYSCTL_PERIPH_UART4, SYSCTL_PERIPH_UART5, SYSCTL_PERIPH_UART6, SYSCTL_PERIPH_UART7, SYSCTL_PERIPH_UDMA, SYSCTL_PERIPH_USB0, SYSCTL_PERIPH_WDOG0, SYSCTL_PERIPH_WDOG1, SYSCTL_PERIPH_WTIMER0, SYSCTL_PERIPH_WTIMER1, SYSCTL_PERIPH_WTIMER2, SYSCTL_PERIPH_WTIMER3, SYSCTL_PERIPH_WTIMER4, or SYSCTL_PERIPH_WTIMER5

Note
The ability to check for a peripheral being ready varies based on the Tiva part in use. Please consult the data sheet for the part you are using to determine if this feature is available.
Returns
Returns true if the specified peripheral is ready and false if it is not.

Definition at line 632 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_PRBASE.

Referenced by EMACPHYConfigSet().

633 {
634  //
635  // Check the arguments.
636  //
637  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
638 
639  //
640  // See if this peripheral is ready.
641  //
642  return(HWREGBITW(SYSCTL_PRBASE + ((ui32Peripheral & 0xff00) >> 8),
643  ui32Peripheral & 0xff));
644 }
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_PRBASE
Definition: sysctl.c:347
#define HWREGBITW(x, b)
Definition: hw_types.h:54

Here is the caller graph for this function:

void SysCtlPeripheralReset ( uint32_t  ui32Peripheral)

Performs a software reset of a peripheral.

Parameters
ui32Peripheralis the peripheral to reset.

This function performs a software reset of the specified peripheral. An individual peripheral reset signal is asserted for a brief period and then de-asserted, returning the internal state of the peripheral to its reset condition.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_ADC0, SYSCTL_PERIPH_ADC1, SYSCTL_PERIPH_CAN0, SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_CCM0,SYSCTL_PERIPH_COMP0, SYSCTL_PERIPH_EEPROM0, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_EPI0, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, SYSCTL_PERIPH_GPIOJ, SYSCTL_PERIPH_GPIOK, SYSCTL_PERIPH_GPIOL, SYSCTL_PERIPH_GPIOM, SYSCTL_PERIPH_GPION, SYSCTL_PERIPH_GPIOP, SYSCTL_PERIPH_GPIOQ, SYSCTL_PERIPH_GPIOR, SYSCTL_PERIPH_GPIOS, SYSCTL_PERIPH_GPIOT, SYSCTL_PERIPH_HIBERNATE, SYSCTL_PERIPH_I2C0, SYSCTL_PERIPH_I2C1, SYSCTL_PERIPH_I2C2, SYSCTL_PERIPH_I2C3, SYSCTL_PERIPH_I2C4, SYSCTL_PERIPH_I2C5, SYSCTL_PERIPH_I2C6, SYSCTL_PERIPH_I2C7, SYSCTL_PERIPH_I2C8, SYSCTL_PERIPH_I2C9, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_ONEWIRE0, SYSCTL_PERIPH_PWM0, SYSCTL_PERIPH_PWM1, SYSCTL_PERIPH_QEI0, SYSCTL_PERIPH_QEI1, SYSCTL_PERIPH_SSI0, SYSCTL_PERIPH_SSI1, SYSCTL_PERIPH_SSI2, SYSCTL_PERIPH_SSI3, SYSCTL_PERIPH_TIMER0, SYSCTL_PERIPH_TIMER1, SYSCTL_PERIPH_TIMER2, SYSCTL_PERIPH_TIMER3, SYSCTL_PERIPH_TIMER4, SYSCTL_PERIPH_TIMER5, SYSCTL_PERIPH_TIMER6, SYSCTL_PERIPH_TIMER7, SYSCTL_PERIPH_UART0, SYSCTL_PERIPH_UART1, SYSCTL_PERIPH_UART2, SYSCTL_PERIPH_UART3, SYSCTL_PERIPH_UART4, SYSCTL_PERIPH_UART5, SYSCTL_PERIPH_UART6, SYSCTL_PERIPH_UART7, SYSCTL_PERIPH_UDMA, SYSCTL_PERIPH_USB0, SYSCTL_PERIPH_WDOG0, SYSCTL_PERIPH_WDOG1, SYSCTL_PERIPH_WTIMER0, SYSCTL_PERIPH_WTIMER1, SYSCTL_PERIPH_WTIMER2, SYSCTL_PERIPH_WTIMER3, SYSCTL_PERIPH_WTIMER4, or SYSCTL_PERIPH_WTIMER5

Returns
None.

Definition at line 762 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_SRBASE.

Referenced by adc_init(), EEPROMInit(), EEPROMMassErase(), and EMACPHYConfigSet().

763 {
764  volatile uint_fast8_t ui8Delay;
765 
766  //
767  // Check the arguments.
768  //
769  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
770 
771  //
772  // Put the peripheral into the reset state.
773  //
774  HWREGBITW(SYSCTL_SRBASE + ((ui32Peripheral & 0xff00) >> 8),
775  ui32Peripheral & 0xff) = 1;
776 
777  //
778  // Delay for a little bit.
779  //
780  for(ui8Delay = 0; ui8Delay < 16; ui8Delay++)
781  {
782  }
783 
784  //
785  // Take the peripheral out of the reset state.
786  //
787  HWREGBITW(SYSCTL_SRBASE + ((ui32Peripheral & 0xff00) >> 8),
788  ui32Peripheral & 0xff) = 0;
789 }
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_SRBASE
Definition: sysctl.c:342
#define HWREGBITW(x, b)
Definition: hw_types.h:54

Here is the caller graph for this function:

void SysCtlPeripheralSleepDisable ( uint32_t  ui32Peripheral)

Disables a peripheral in sleep mode.

Parameters
ui32Peripheralis the peripheral to disable in sleep mode.

This function causes a peripheral to stop operating when the processor goes into sleep mode. Disabling peripherals while in sleep mode helps to lower the current draw of the device. If enabled (via SysCtlPeripheralEnable()), the peripheral automatically resumes operation when the processor leaves sleep mode, maintaining its entire state from before sleep mode was entered.

Sleep mode clocking of peripherals must be enabled via SysCtlPeripheralClockGating(); if disabled, the peripheral sleep mode configuration is maintained but has no effect when sleep mode is entered.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_ADC0, SYSCTL_PERIPH_ADC1, SYSCTL_PERIPH_CAN0, SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_CCM0,SYSCTL_PERIPH_COMP0, SYSCTL_PERIPH_EEPROM0, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_EPI0, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, SYSCTL_PERIPH_GPIOJ, SYSCTL_PERIPH_GPIOK, SYSCTL_PERIPH_GPIOL, SYSCTL_PERIPH_GPIOM, SYSCTL_PERIPH_GPION, SYSCTL_PERIPH_GPIOP, SYSCTL_PERIPH_GPIOQ, SYSCTL_PERIPH_GPIOR, SYSCTL_PERIPH_GPIOS, SYSCTL_PERIPH_GPIOT, SYSCTL_PERIPH_HIBERNATE, SYSCTL_PERIPH_I2C0, SYSCTL_PERIPH_I2C1, SYSCTL_PERIPH_I2C2, SYSCTL_PERIPH_I2C3, SYSCTL_PERIPH_I2C4, SYSCTL_PERIPH_I2C5, SYSCTL_PERIPH_I2C6, SYSCTL_PERIPH_I2C7, SYSCTL_PERIPH_I2C8, SYSCTL_PERIPH_I2C9, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_ONEWIRE0, SYSCTL_PERIPH_PWM0, SYSCTL_PERIPH_PWM1, SYSCTL_PERIPH_QEI0, SYSCTL_PERIPH_QEI1, SYSCTL_PERIPH_SSI0, SYSCTL_PERIPH_SSI1, SYSCTL_PERIPH_SSI2, SYSCTL_PERIPH_SSI3, SYSCTL_PERIPH_TIMER0, SYSCTL_PERIPH_TIMER1, SYSCTL_PERIPH_TIMER2, SYSCTL_PERIPH_TIMER3, SYSCTL_PERIPH_TIMER4, SYSCTL_PERIPH_TIMER5, SYSCTL_PERIPH_TIMER6, SYSCTL_PERIPH_TIMER7, SYSCTL_PERIPH_UART0, SYSCTL_PERIPH_UART1, SYSCTL_PERIPH_UART2, SYSCTL_PERIPH_UART3, SYSCTL_PERIPH_UART4, SYSCTL_PERIPH_UART5, SYSCTL_PERIPH_UART6, SYSCTL_PERIPH_UART7, SYSCTL_PERIPH_UDMA, SYSCTL_PERIPH_USB0, SYSCTL_PERIPH_WDOG0, SYSCTL_PERIPH_WDOG1, SYSCTL_PERIPH_WTIMER0, SYSCTL_PERIPH_WTIMER1, SYSCTL_PERIPH_WTIMER2, SYSCTL_PERIPH_WTIMER3, SYSCTL_PERIPH_WTIMER4, or SYSCTL_PERIPH_WTIMER5

Returns
None.

Definition at line 1027 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_SCGCBASE.

1028 {
1029  //
1030  // Check the arguments.
1031  //
1032  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
1033 
1034  //
1035  // Disable this peripheral in sleep mode.
1036  //
1037  HWREGBITW(SYSCTL_SCGCBASE + ((ui32Peripheral & 0xff00) >> 8),
1038  ui32Peripheral & 0xff) = 0;
1039 }
#define SYSCTL_SCGCBASE
Definition: sysctl.c:344
#define ASSERT(expr)
Definition: debug.h:67
#define HWREGBITW(x, b)
Definition: hw_types.h:54
void SysCtlPeripheralSleepEnable ( uint32_t  ui32Peripheral)

Enables a peripheral in sleep mode.

Parameters
ui32Peripheralis the peripheral to enable in sleep mode.

This function allows a peripheral to continue operating when the processor goes into sleep mode. Because the clocking configuration of the device does not change, any peripheral can safely continue operating while the processor is in sleep mode and can therefore wake the processor from sleep mode.

Sleep mode clocking of peripherals must be enabled via SysCtlPeripheralClockGating(); if disabled, the peripheral sleep mode configuration is maintained but has no effect when sleep mode is entered.

The ui32Peripheral parameter must be only one of the following values: SYSCTL_PERIPH_ADC0, SYSCTL_PERIPH_ADC1, SYSCTL_PERIPH_CAN0, SYSCTL_PERIPH_CAN1, SYSCTL_PERIPH_CCM0,SYSCTL_PERIPH_COMP0, SYSCTL_PERIPH_EEPROM0, SYSCTL_PERIPH_EMAC, SYSCTL_PERIPH_EPHY, SYSCTL_PERIPH_EPI0, SYSCTL_PERIPH_GPIOA, SYSCTL_PERIPH_GPIOB, SYSCTL_PERIPH_GPIOC, SYSCTL_PERIPH_GPIOD, SYSCTL_PERIPH_GPIOE, SYSCTL_PERIPH_GPIOF, SYSCTL_PERIPH_GPIOG, SYSCTL_PERIPH_GPIOH, SYSCTL_PERIPH_GPIOJ, SYSCTL_PERIPH_GPIOK, SYSCTL_PERIPH_GPIOL, SYSCTL_PERIPH_GPIOM, SYSCTL_PERIPH_GPION, SYSCTL_PERIPH_GPIOP, SYSCTL_PERIPH_GPIOQ, SYSCTL_PERIPH_GPIOR, SYSCTL_PERIPH_GPIOS, SYSCTL_PERIPH_GPIOT, SYSCTL_PERIPH_HIBERNATE, SYSCTL_PERIPH_I2C0, SYSCTL_PERIPH_I2C1, SYSCTL_PERIPH_I2C2, SYSCTL_PERIPH_I2C3, SYSCTL_PERIPH_I2C4, SYSCTL_PERIPH_I2C5, SYSCTL_PERIPH_I2C6, SYSCTL_PERIPH_I2C7, SYSCTL_PERIPH_I2C8, SYSCTL_PERIPH_I2C9, SYSCTL_PERIPH_LCD0, SYSCTL_PERIPH_ONEWIRE0, SYSCTL_PERIPH_PWM0, SYSCTL_PERIPH_PWM1, SYSCTL_PERIPH_QEI0, SYSCTL_PERIPH_QEI1, SYSCTL_PERIPH_SSI0, SYSCTL_PERIPH_SSI1, SYSCTL_PERIPH_SSI2, SYSCTL_PERIPH_SSI3, SYSCTL_PERIPH_TIMER0, SYSCTL_PERIPH_TIMER1, SYSCTL_PERIPH_TIMER2, SYSCTL_PERIPH_TIMER3, SYSCTL_PERIPH_TIMER4, SYSCTL_PERIPH_TIMER5, SYSCTL_PERIPH_TIMER6, SYSCTL_PERIPH_TIMER7, SYSCTL_PERIPH_UART0, SYSCTL_PERIPH_UART1, SYSCTL_PERIPH_UART2, SYSCTL_PERIPH_UART3, SYSCTL_PERIPH_UART4, SYSCTL_PERIPH_UART5, SYSCTL_PERIPH_UART6, SYSCTL_PERIPH_UART7, SYSCTL_PERIPH_UDMA, SYSCTL_PERIPH_USB0, SYSCTL_PERIPH_WDOG0, SYSCTL_PERIPH_WDOG1, SYSCTL_PERIPH_WTIMER0, SYSCTL_PERIPH_WTIMER1, SYSCTL_PERIPH_WTIMER2, SYSCTL_PERIPH_WTIMER3, SYSCTL_PERIPH_WTIMER4, or SYSCTL_PERIPH_WTIMER5

Returns
None.

Definition at line 962 of file sysctl.c.

References ASSERT, HWREGBITW, and SYSCTL_SCGCBASE.

963 {
964  //
965  // Check the arguments.
966  //
967  ASSERT(_SysCtlPeripheralValid(ui32Peripheral));
968 
969  //
970  // Enable this peripheral in sleep mode.
971  //
972  HWREGBITW(SYSCTL_SCGCBASE + ((ui32Peripheral & 0xff00) >> 8),
973  ui32Peripheral & 0xff) = 1;
974 }
#define SYSCTL_SCGCBASE
Definition: sysctl.c:344
#define ASSERT(expr)
Definition: debug.h:67
#define HWREGBITW(x, b)
Definition: hw_types.h:54
uint32_t SysCtlPIOSCCalibrate ( uint32_t  ui32Type)

Calibrates the precision internal oscillator.

Parameters
ui32Typeis the type of calibration to perform.

This function performs a calibration of the PIOSC. There are three types of calibration available; the desired calibration type as specified in ui32Type is one of:

  • SYSCTL_PIOSC_CAL_AUTO to perform automatic calibration using the 32-kHz clock from the hibernate module as a reference. This type is only possible on parts that have a hibernate module, and then only if it is enabled, a 32.768-kHz clock source is attached to the XOSC0/1 pins and the hibernate module's RTC is also enabled.
  • SYSCTL_PIOSC_CAL_FACT to reset the PIOSC calibration to the factory provided calibration.
  • SYSCTL_PIOSC_CAL_USER to set the PIOSC calibration to a user-supplied value. The value to be used is ORed into the lower 7-bits of this value, with 0x40 being the ``nominal'' value (in other words, if everything were perfect, 0x40 provides exactly 16 MHz). Values larger than 0x40 slow down PIOSC, and values smaller than 0x40 speed up PIOSC.
Returns
Returns 1 if the calibration was successful and 0 if it failed.

Definition at line 1937 of file sysctl.c.

References HWREG, SYSCTL_PIOSCCAL, SYSCTL_PIOSCCAL_CAL, SYSCTL_PIOSCCAL_UPDATE, SYSCTL_PIOSCCAL_UT_M, SYSCTL_PIOSCCAL_UTEN, SYSCTL_PIOSCSTAT, SYSCTL_PIOSCSTAT_CR_M, and SYSCTL_PIOSCSTAT_CRPASS.

1938 {
1939  //
1940  // Perform the requested calibration. If performing user calibration, the
1941  // UTEN bit must be set with one write, then the UT field in a second
1942  // write, and the UPDATE bit in a final write. For other calibration
1943  // types, a single write to set UPDATE or CAL is all that is required.
1944  //
1945  if(ui32Type & (SYSCTL_PIOSCCAL_UTEN | SYSCTL_PIOSCCAL_UPDATE))
1946  {
1949  ui32Type & (SYSCTL_PIOSCCAL_UTEN | SYSCTL_PIOSCCAL_UT_M);
1950  }
1951  HWREG(SYSCTL_PIOSCCAL) = ui32Type;
1952 
1953  //
1954  // See if an automatic calibration was requested.
1955  //
1956  if(ui32Type & SYSCTL_PIOSCCAL_CAL)
1957  {
1958  //
1959  // Wait for the automatic calibration to complete.
1960  //
1962  {
1963  }
1964 
1965  //
1966  // If the automatic calibration failed, return an error.
1967  //
1968  if((HWREG(SYSCTL_PIOSCSTAT) & SYSCTL_PIOSCSTAT_CR_M) !=
1970  {
1971  return(0);
1972  }
1973  }
1974 
1975  //
1976  // The calibration was successful.
1977  //
1978  return(1);
1979 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_PIOSCCAL_UTEN
Definition: hw_sysctl.h:1517
#define SYSCTL_PIOSCSTAT
Definition: hw_sysctl.h:107
#define SYSCTL_PIOSCCAL_UT_M
Definition: hw_sysctl.h:1520
#define SYSCTL_PIOSCCAL_CAL
Definition: hw_sysctl.h:1518
#define SYSCTL_PIOSCCAL
Definition: hw_sysctl.h:105
#define SYSCTL_PIOSCSTAT_CRPASS
Definition: hw_sysctl.h:1533
#define SYSCTL_PIOSCCAL_UPDATE
Definition: hw_sysctl.h:1519
#define SYSCTL_PIOSCSTAT_CR_M
Definition: hw_sysctl.h:1530
uint32_t SysCtlPWMClockGet ( void  )

Gets the current PWM clock configuration.

This function returns the current PWM clock configuration.

Returns
Returns the current PWM clock configuration; is one of SYSCTL_PWMDIV_1, SYSCTL_PWMDIV_2, SYSCTL_PWMDIV_4, SYSCTL_PWMDIV_8, SYSCTL_PWMDIV_16, SYSCTL_PWMDIV_32, or SYSCTL_PWMDIV_64.
Note
This function should only be used with TM4C123 devices. For other TM4C devices, the PWMClockGet() function should be used.

Definition at line 3195 of file sysctl.c.

References ASSERT, HWREG, SYSCTL_DC1, SYSCTL_DC1_PWM0, SYSCTL_DC1_PWM1, SYSCTL_PWMDIV_1, SYSCTL_RCC, SYSCTL_RCC_PWMDIV_M, and SYSCTL_RCC_USEPWMDIV.

3196 {
3197  //
3198  // Check that there is a PWM block on this part.
3199  //
3201 
3202  //
3203  // Return the current PWM clock configuration. Make sure that
3204  // SYSCTL_PWMDIV_1 is returned in all cases where the divider is disabled.
3205  //
3207  {
3208  //
3209  // The divider is not active so reflect this in the value we return.
3210  //
3211  return(SYSCTL_PWMDIV_1);
3212  }
3213  else
3214  {
3215  //
3216  // The divider is active so directly return the masked register value.
3217  //
3218  return(HWREG(SYSCTL_RCC) &
3219  (SYSCTL_RCC_USEPWMDIV | SYSCTL_RCC_PWMDIV_M));
3220  }
3221 }
#define SYSCTL_DC1
Definition: hw_sysctl.h:51
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_DC1_PWM0
Definition: hw_sysctl.h:665
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_RCC
Definition: hw_sysctl.h:70
#define SYSCTL_DC1_PWM1
Definition: hw_sysctl.h:664
#define SYSCTL_RCC_PWMDIV_M
Definition: hw_sysctl.h:1068
#define SYSCTL_RCC_USEPWMDIV
Definition: hw_sysctl.h:1067
#define SYSCTL_PWMDIV_1
Definition: sysctl.h:207
void SysCtlPWMClockSet ( uint32_t  ui32Config)

Sets the PWM clock configuration.

Parameters
ui32Configis the configuration for the PWM clock; it must be one of SYSCTL_PWMDIV_1, SYSCTL_PWMDIV_2, SYSCTL_PWMDIV_4, SYSCTL_PWMDIV_8, SYSCTL_PWMDIV_16, SYSCTL_PWMDIV_32, or SYSCTL_PWMDIV_64.

This function configures the rate of the clock provided to the PWM module as a ratio of the processor clock. This clock is used by the PWM module to generate PWM signals; its rate forms the basis for all PWM signals.

Note
This function should only be used with TM4C123 devices. For other TM4C devices, the PWMClockSet() function should be used.
The clocking of the PWM is dependent on the system clock rate as configured by SysCtlClockSet().
Returns
None.

Definition at line 3152 of file sysctl.c.

References ASSERT, HWREG, SYSCTL_DC1, SYSCTL_DC1_PWM0, SYSCTL_DC1_PWM1, SYSCTL_PWMDIV_1, SYSCTL_PWMDIV_16, SYSCTL_PWMDIV_2, SYSCTL_PWMDIV_32, SYSCTL_PWMDIV_4, SYSCTL_PWMDIV_64, SYSCTL_PWMDIV_8, SYSCTL_RCC, SYSCTL_RCC_PWMDIV_M, and SYSCTL_RCC_USEPWMDIV.

3153 {
3154  //
3155  // Check the arguments.
3156  //
3157  ASSERT((ui32Config == SYSCTL_PWMDIV_1) ||
3158  (ui32Config == SYSCTL_PWMDIV_2) ||
3159  (ui32Config == SYSCTL_PWMDIV_4) ||
3160  (ui32Config == SYSCTL_PWMDIV_8) ||
3161  (ui32Config == SYSCTL_PWMDIV_16) ||
3162  (ui32Config == SYSCTL_PWMDIV_32) ||
3163  (ui32Config == SYSCTL_PWMDIV_64));
3164 
3165  //
3166  // Check that there is a PWM block on this part.
3167  //
3169 
3170  //
3171  // Set the PWM clock configuration into the run-mode clock configuration
3172  // register.
3173  //
3176  ui32Config);
3177 }
#define SYSCTL_PWMDIV_64
Definition: sysctl.h:213
#define SYSCTL_DC1
Definition: hw_sysctl.h:51
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_DC1_PWM0
Definition: hw_sysctl.h:665
#define ASSERT(expr)
Definition: debug.h:67
#define SYSCTL_RCC
Definition: hw_sysctl.h:70
#define SYSCTL_DC1_PWM1
Definition: hw_sysctl.h:664
#define SYSCTL_PWMDIV_2
Definition: sysctl.h:208
#define SYSCTL_PWMDIV_16
Definition: sysctl.h:211
#define SYSCTL_RCC_PWMDIV_M
Definition: hw_sysctl.h:1068
#define SYSCTL_PWMDIV_8
Definition: sysctl.h:210
#define SYSCTL_RCC_USEPWMDIV
Definition: hw_sysctl.h:1067
#define SYSCTL_PWMDIV_4
Definition: sysctl.h:209
#define SYSCTL_PWMDIV_1
Definition: sysctl.h:207
#define SYSCTL_PWMDIV_32
Definition: sysctl.h:212
void SysCtlReset ( void  )

Resets the device.

This function performs a software reset of the entire device. The processor and all peripherals are reset and all device registers are returned to their default values (with the exception of the reset cause register, which maintains its current value but has the software reset bit set as well).

Returns
This function does not return.

Definition at line 1671 of file sysctl.c.

References HWREG, NVIC_APINT, NVIC_APINT_SYSRESETREQ, and NVIC_APINT_VECTKEY.

1672 {
1673  //
1674  // Perform a software reset request. This request causes the device to
1675  // reset, no further code is executed.
1676  //
1678 
1679  //
1680  // The device should have reset, so this should never be reached. Just in
1681  // case, loop forever.
1682  //
1683  while(1)
1684  {
1685  }
1686 }
#define NVIC_APINT
Definition: hw_nvic.h:116
#define HWREG(x)
Definition: hw_types.h:48
#define NVIC_APINT_SYSRESETREQ
Definition: hw_nvic.h:938
#define NVIC_APINT_VECTKEY
Definition: hw_nvic.h:927
uint32_t SysCtlResetBehaviorGet ( void  )

Returns the current types of reset issued due to reset events.

This function returns the types of resets issued when a configurable reset occurs. The value returned is a logical OR combination of the valid values that are described in the documentation for the ui32Behavior parameter of the SysCtlResetBehaviorSet() function.

Note
This function should only be used with Flurry-class devices.
Returns
The reset behaviors for all configurable resets.

Definition at line 2051 of file sysctl.c.

References HWREG, and SYSCTL_RESBEHAVCTL.

2052 {
2053  return(HWREG(SYSCTL_RESBEHAVCTL));
2054 }
#define SYSCTL_RESBEHAVCTL
Definition: hw_sysctl.h:118
#define HWREG(x)
Definition: hw_types.h:48
void SysCtlResetBehaviorSet ( uint32_t  ui32Behavior)

Sets the type of reset issued due to certain reset events.

Parameters
ui32Behaviorspecifies the types of resets for each of the configurable reset events.

This function sets the types of reset issued when a configurable reset event occurs. The reset events that are configurable are: Watchdog 0 or 1, a brown out and the external RSTn pin. The valid actions are either a system reset or a full POR sequence. See the data sheet for more information on the differences between a full POR and a system reset. All reset behaviors can be configured with a single call using the logical OR of the values defined below. Any reset option that is not specifically set remains configured for its default behavior. Either POR or system reset can be selected for each reset cause.

Valid values are logical combinations of the following:

  • SYSCTL_ONRST_WDOG0_POR configures a Watchdog 0 reset to perform a full POR.
  • SYSCTL_ONRST_WDOG0_SYS configures a Watchdog 0 reset to perform a system reset.
  • SYSCTL_ONRST_WDOG1_POR configures a Watchdog 1 reset to perform a full POR.
  • SYSCTL_ONRST_WDOG1_SYS configures a Watchdog 1 reset to perform a system reset.
  • SYSCTL_ONRST_BOR_POR configures a brown-out reset to perform a full POR.
  • SYSCTL_ONRST_BOR_SYS configures a brown-out reset to perform a system reset.
  • SYSCTL_ONRST_EXT_POR configures an external pin reset to perform a full POR.
  • SYSCTL_ONRST_EXT_SYS configures an external pin reset to perform a system reset.

Example: Set Watchdog 0 reset to trigger a POR and a brown-out reset to trigger a system reset while leaving the remaining resets with their default behaviors.

//! SysCtlResetBehaviorSet(SYSCTL_ONRST_WDOG0_POR | SYSCTL_ONRST_BOR_SYS);
//! 
\note This function cannot be used with TM4C123 devices.

\return None.  

Definition at line 2031 of file sysctl.c.

References HWREG, and SYSCTL_RESBEHAVCTL.

2032 {
2033  HWREG(SYSCTL_RESBEHAVCTL) = ui32Behavior;
2034 }
#define SYSCTL_RESBEHAVCTL
Definition: hw_sysctl.h:118
#define HWREG(x)
Definition: hw_types.h:48
void SysCtlResetCauseClear ( uint32_t  ui32Causes)

Clears reset reasons.

Parameters
ui32Causesare the reset causes to be cleared; must be a logical OR of SYSCTL_CAUSE_HSRVREQ, SYSCTL_CAUSE_HIB, SYSCTL_CAUSE_WDOG1, SYSCTL_CAUSE_SW, SYSCTL_CAUSE_WDOG0, SYSCTL_CAUSE_BOR, SYSCTL_CAUSE_POR, and/or SYSCTL_CAUSE_EXT.

This function clears the specified sticky reset reasons. Once cleared, another reset for the same reason can be detected, and a reset for a different reason can be distinguished (instead of having two reset causes set). If the reset reason is used by an application, all reset causes should be cleared after they are retrieved with SysCtlResetCauseGet().

Returns
None.

Definition at line 1787 of file sysctl.c.

References HWREG, and SYSCTL_RESC.

1788 {
1789  //
1790  // Clear the given reset reasons.
1791  //
1792  HWREG(SYSCTL_RESC) &= ~(ui32Causes);
1793 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_RESC
Definition: hw_sysctl.h:68
uint32_t SysCtlResetCauseGet ( void  )

Gets the reason for a reset.

This function returns the reason(s) for a reset. Because the reset reasons are sticky until either cleared by software or a power-on reset, multiple reset reasons may be returned if multiple resets have occurred. The reset reason is a logical OR of SYSCTL_CAUSE_HSRVREQ, SYSCTL_CAUSE_HIB, SYSCTL_CAUSE_WDOG1, SYSCTL_CAUSE_SW, SYSCTL_CAUSE_WDOG0, SYSCTL_CAUSE_BOR, SYSCTL_CAUSE_POR, and/or SYSCTL_CAUSE_EXT.

Returns
Returns the reason(s) for a reset.

Definition at line 1760 of file sysctl.c.

References HWREG, and SYSCTL_RESC.

1761 {
1762  //
1763  // Return the reset reasons.
1764  //
1765  return(HWREG(SYSCTL_RESC));
1766 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_RESC
Definition: hw_sysctl.h:68
void SysCtlSleep ( void  )

Puts the processor into sleep mode.

This function places the processor into sleep mode; it does not return until the processor returns to run mode. The peripherals that are enabled via SysCtlPeripheralSleepEnable() continue to operate and can wake up the processor (if automatic clock gating is enabled with SysCtlPeripheralClockGating(), otherwise all peripherals continue to operate).

Returns
None.

Definition at line 1703 of file sysctl.c.

References CPUwfi().

1704 {
1705  //
1706  // Wait for an interrupt.
1707  //
1708  CPUwfi();
1709 }
void CPUwfi(void)

Here is the call graph for this function:

void SysCtlSleepPowerSet ( uint32_t  ui32Config)

Configures the power to the flash and SRAM while in sleep mode.

Parameters
ui32Configis the required flash and SRAM power configuration.

This function allows the power configuration of the flash and SRAM while in sleep mode to be set. The ui32Config parameter is the logical OR of the flash power configuration and the SRAM power configuration.

The flash power configuration is specified as either:

  • SYSCTL_FLASH_NORMAL - The flash is left in fully powered mode, providing fast wake-up time but higher power consumption.
  • SYSCTL_FLASH_LOW_POWER - The flash is in low power mode, providing reduced power consumption but longer wake-up time.

The SRAM power configuration is specified as one of:

  • SYSCTL_SRAM_NORMAL - The SRAM is left in fully powered mode, providing fast wake-up time but higher power consumption.
  • SYSCTL_SRAM_STANDBY - The SRAM is placed into a lower power mode, providing reduced power consumption but longer wake-up time.
  • SYSCTL_SRAM_LOW_POWER - The SRAM is placed into lowest power mode, providing further reduced power consumption but longer wake-up time.
Note
The availability of this feature varies with the Tiva part in use. Please consult the data sheet for the part you are using to determine whether this support is available.
Returns
None.

Definition at line 1605 of file sysctl.c.

References HWREG, and SYSCTL_SLPPWRCFG.

1606 {
1607  //
1608  // Set the sleep-mode flash and SRAM power configuration.
1609  //
1610  HWREG(SYSCTL_SLPPWRCFG) = ui32Config;
1611 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_SLPPWRCFG
Definition: hw_sysctl.h:112
uint32_t SysCtlSRAMSizeGet ( void  )

Gets the size of the SRAM.

This function determines the size of the SRAM on the Tiva device.

Returns
The total number of bytes of SRAM.

Definition at line 452 of file sysctl.c.

References FLASH_SSIZE, and HWREG.

453 {
454  return((HWREG(FLASH_SSIZE) + 1) * 256);
455 }
#define HWREG(x)
Definition: hw_types.h:48
#define FLASH_SSIZE
Definition: hw_flash.h:62
void SysCtlUSBPLLDisable ( void  )

Powers down the USB PLL.

This function disables the USB controller's PLL, which is used by its physical layer. The USB registers are still accessible, but the physical layer no longer functions.

Note
This function should only be called on TM4C123 devices.
Returns
None.

Definition at line 3351 of file sysctl.c.

References HWREG, SYSCTL_RCC2, and SYSCTL_RCC2_USBPWRDN.

3352 {
3353  //
3354  // Turn off the USB PLL.
3355  //
3357 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_RCC2
Definition: hw_sysctl.h:74
#define SYSCTL_RCC2_USBPWRDN
Definition: hw_sysctl.h:1155
void SysCtlUSBPLLEnable ( void  )

Powers up the USB PLL.

This function enables the USB controller's PLL, which is used by its physical layer. This call is necessary before connecting to any external devices.

Note
This function should only be called on TM4C123 devices.
Returns
None.

Definition at line 3329 of file sysctl.c.

References HWREG, SYSCTL_RCC2, and SYSCTL_RCC2_USBPWRDN.

3330 {
3331  //
3332  // Turn on the USB PLL.
3333  //
3335 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_RCC2
Definition: hw_sysctl.h:74
#define SYSCTL_RCC2_USBPWRDN
Definition: hw_sysctl.h:1155
void SysCtlVoltageEventClear ( uint32_t  ui32Status)

Clears the voltage event status.

Parameters
ui32Statusis a bit mask of the voltage events to clear.

This function clears the current voltage events status for the values specified in the ui32Status parameter. The ui32Status value must be a logical OR of the following values:

  • SYSCTL_VESTAT_VDDBOR a brown-out event occurred on the VDD rail.
  • SYSCTL_VESTAT_VDDABOR a brown-out event occurred on the VDDA rail.

Example: Clear the current voltage event status.

//! //
//! // Clear all the current voltage events.
//! //
//! SysCtlVoltageEventClear(SysCtlVoltageEventStatus());
//! 
\note The availability of voltage event status varies with the
Tiva part in use.  Please consult the data sheet for the part you are
using to determine which interrupt sources are available.

\return None.  

Definition at line 3502 of file sysctl.c.

References HWREG, and SYSCTL_PWRTC.

3503 {
3504  //
3505  // Clear the requested voltage events.
3506  //
3507  HWREG(SYSCTL_PWRTC) |= ui32Status;
3508 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_PWRTC
Definition: hw_sysctl.h:69
void SysCtlVoltageEventConfig ( uint32_t  ui32Config)

Configures the response to system voltage events.

Parameters
ui32Configholds the configuration options for the voltage events.

This function configures the response to voltage-related events. These events are triggered when the voltage rails drop below certain levels. The ui32Config parameter provides the configuration for the voltage events and is a combination of the SYSCTL_VEVENT_* values.

The response to a brown out on the VDDA rail is set by using one of the following values:

  • SYSCTL_VEVENT_VDDABO_NONE - There is no action taken on a VDDA brown out.
  • SYSCTL_VEVENT_VDDABO_INT - A system interrupt is generated when a VDDA brown out occurs.
  • SYSCTL_VEVENT_VDDABO_NMI - An NMI is generated when a VDDA brown out occurs.
  • SYSCTL_VEVENT_VDDABO_RST - A reset is generated when a VDDA brown out occurs. The type of reset that is generated is controller by the SYSCTL_ONRST_BOR_* setting passed into the SysCtlResetBehaviorSet() function.

The response to a brown out on the VDD rail is set by using one of the following values:

  • SYSCTL_VEVENT_VDDBO_NONE - There is no action taken on a VDD brown out.
  • SYSCTL_VEVENT_VDDBO_INT - A system interrupt is generated when a VDD brown out occurs.
  • SYSCTL_VEVENT_VDDBO_NMI - An NMI is generated when a VDD brown out occurs.
  • SYSCTL_VEVENT_VDDBO_RST - A reset is generated when a VDD brown out occurs. The type of reset that is generated is controller by the SYSCTL_ONRST_BOR_* setting passed into the SysCtlResetBehaviorSet() function.

Example: Configure the voltage events to trigger an interrupt on a VDDA brown out, an NMI on a VDDC brown out and a reset on a VDD brown out.

//!
//! //
//! // Configure the BOR rest to trigger a full POR.  This is needed because
//! // the SysCtlVoltageEventConfig() call is triggering a reset so the type
//! // of reset is specified by this call.
//! //
//! SysCtlResetBehaviorSet(SYSCTL_ONRST_BOR_POR);
//!
//! //
//! // Trigger an interrupt on a VDDA brown out and a reset on a VDD brown out.
//! //
//! SysCtlVoltageEventConfig(SYSCTL_VEVENT_VDDABO_INT |
//!                          SYSCTL_VEVENT_VDDBO_RST);
//! 
\return None.  

Definition at line 3419 of file sysctl.c.

References HWREG, and SYSCTL_PTBOCTL.

3420 {
3421  //
3422  // Set the requested events.
3423  //
3424  HWREG(SYSCTL_PTBOCTL) = ui32Config;
3425 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_PTBOCTL
Definition: hw_sysctl.h:60
uint32_t SysCtlVoltageEventStatus ( void  )

Returns the voltage event status.

This function returns the voltage event status for the system controller. The value returned is a logical OR of the following values:

  • SYSCTL_VESTAT_VDDBOR a brown-out event occurred on the VDD rail.
  • SYSCTL_VESTAT_VDDABOR a brown-out event occurred on the VDDA rail.

The values returned from this function can be passed to the SysCtlVoltageEventClear() to clear the current voltage event status. Because voltage events are not cleared due to a reset, the voltage event status must be cleared by calling SysCtlVoltageEventClear().

Example: Clear the current voltage event status.

//! uint32_t ui32VoltageEvents;
//!
//! //
//! // Read the current voltage event status.
//! //
//! ui32VoltageEvents = SysCtlVoltageEventStatus();
//!
//! //
//! // Clear all the current voltage events.
//! //
//! SysCtlVoltageEventClear(ui32VoltageEvents);
//! 
\return The current voltage event status.

\note The availability of voltage events varies with the Tiva part
in use.  Please consult the data sheet for the part you are using to
determine which interrupt sources are available.  

Definition at line 3465 of file sysctl.c.

References HWREG, and SYSCTL_PWRTC.

3466 {
3467  //
3468  // Return the current voltage event status.
3469  //
3470  return(HWREG(SYSCTL_PWRTC));
3471 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSCTL_PWRTC
Definition: hw_sysctl.h:69

Variable Documentation

const uint32_t g_pppui32XTALtoVCO[2][18][2]
static

Definition at line 137 of file sysctl.c.

Referenced by SysCtlClockFreqSet().

const uint32_t g_pui32VCOFrequencies[2]
static
Initial value:
=
{
320000000,
480000000,
}

Definition at line 330 of file sysctl.c.

const uint32_t g_pui32Xtals[]
static
Initial value:
=
{
1000000,
1843200,
2000000,
2457600,
3579545,
3686400,
4000000,
4096000,
4915200,
5000000,
5120000,
6000000,
6144000,
7372800,
8000000,
8192000,
10000000,
12000000,
12288000,
13560000,
14318180,
16000000,
16384000,
18000000,
20000000,
24000000,
25000000
}

Definition at line 81 of file sysctl.c.

Referenced by SysCtlClockFreqSet(), and SysCtlClockGet().

const { ... } g_sXTALtoMEMTIM[]
Initial value:
=
{
}
#define SYSCTL_MEMTIM0_FBCHT_1_5
Definition: hw_sysctl.h:1241
#define SYSCTL_MEMTIM0_EBCHT_2_5
Definition: hw_sysctl.h:1226
#define SYSCTL_MEMTIM0_MB1
Definition: hw_sysctl.h:1235
#define SYSCTL_MEMTIM0_EWS_S
Definition: hw_sysctl.h:1254
#define SYSCTL_MEMTIM0_FBCHT_2_5
Definition: hw_sysctl.h:1244
#define SYSCTL_MEMTIM0_FBCE
Definition: hw_sysctl.h:1252
#define SYSCTL_MEMTIM0_FWS_S
Definition: hw_sysctl.h:1255
#define SYSCTL_MEMTIM0_FBCHT_3
Definition: hw_sysctl.h:1246
#define SYSCTL_MEMTIM0_EBCHT_3
Definition: hw_sysctl.h:1228
#define SYSCTL_MEMTIM0_EBCHT_3_5
Definition: hw_sysctl.h:1229
#define SYSCTL_MEMTIM0_EBCE
Definition: hw_sysctl.h:1234
#define SYSCTL_MEMTIM0_FBCHT_0_5
Definition: hw_sysctl.h:1238
#define SYSCTL_MEMTIM0_FBCHT_2
Definition: hw_sysctl.h:1243
#define SYSCTL_MEMTIM0_EBCHT_0_5
Definition: hw_sysctl.h:1220
#define SYSCTL_MEMTIM0_EBCHT_2
Definition: hw_sysctl.h:1225
#define SYSCTL_MEMTIM0_FBCHT_3_5
Definition: hw_sysctl.h:1247

Referenced by _SysCtlMemTimingGet().

uint32_t { ... } ui32Frequency

Definition at line 194 of file sysctl.c.

uint32_t { ... } ui32MemTiming

Definition at line 195 of file sysctl.c.