EE445M RTOS
Taken at the University of Texas Spring 2015
Hibernate_api

Macros

#define DELAY_USECS   95
 
#define LOOP_CYCLES   3
 
#define HIBERNATE_WAKE_IO   CLASS_IS_TM4C129
 
#define HIBERNATE_CLOCK_OUTPUT   CLASS_IS_TM4C129
 

Functions

static void _HibernateWriteComplete (void)
 
void HibernateEnableExpClk (uint32_t ui32HibClk)
 
void HibernateDisable (void)
 
void HibernateClockConfig (uint32_t ui32Config)
 
void HibernateRTCEnable (void)
 
void HibernateRTCDisable (void)
 
void HibernateBatCheckStart (void)
 
uint32_t HibernateBatCheckDone (void)
 
void HibernateWakeSet (uint32_t ui32WakeFlags)
 
uint32_t HibernateWakeGet (void)
 
void HibernateLowBatSet (uint32_t ui32LowBatFlags)
 
uint32_t HibernateLowBatGet (void)
 
void HibernateRTCSet (uint32_t ui32RTCValue)
 
uint32_t HibernateRTCGet (void)
 
void HibernateRTCMatchSet (uint32_t ui32Match, uint32_t ui32Value)
 
uint32_t HibernateRTCMatchGet (uint32_t ui32Match)
 
void HibernateRTCSSMatchSet (uint32_t ui32Match, uint32_t ui32Value)
 
uint32_t HibernateRTCSSMatchGet (uint32_t ui32Match)
 
uint32_t HibernateRTCSSGet (void)
 
void HibernateRTCTrimSet (uint32_t ui32Trim)
 
uint32_t HibernateRTCTrimGet (void)
 
void HibernateDataSet (uint32_t *pui32Data, uint32_t ui32Count)
 
void HibernateDataGet (uint32_t *pui32Data, uint32_t ui32Count)
 
void HibernateRequest (void)
 
void HibernateIntEnable (uint32_t ui32IntFlags)
 
void HibernateIntDisable (uint32_t ui32IntFlags)
 
static uint32_t _HibernateIntNumberGet (void)
 
void HibernateIntRegister (void(*pfnHandler)(void))
 
void HibernateIntUnregister (void)
 
uint32_t HibernateIntStatus (bool bMasked)
 
void HibernateIntClear (uint32_t ui32IntFlags)
 
uint32_t HibernateIsActive (void)
 
void HibernateGPIORetentionEnable (void)
 
void HibernateGPIORetentionDisable (void)
 
bool HibernateGPIORetentionGet (void)
 
void HibernateCounterMode (uint32_t ui32Config)
 
static void _HibernateCalendarSet (uint32_t ui32Reg, struct tm *psTime)
 
void HibernateCalendarSet (struct tm *psTime)
 
int HibernateCalendarGet (struct tm *psTime)
 
void HibernateCalendarMatchSet (uint32_t ui32Index, struct tm *psTime)
 
void HibernateCalendarMatchGet (uint32_t ui32Index, struct tm *psTime)
 
void HibernateTamperEventsConfig (uint32_t ui32Config)
 
void HibernateTamperEnable (void)
 
void HibernateTamperDisable (void)
 
void HibernateTamperIOEnable (uint32_t ui32Input, uint32_t ui32Config)
 
void HibernateTamperIODisable (uint32_t ui32Input)
 
void HibernateTamperEventsClear (void)
 
void HibernateTamperEventsClearNoLock (void)
 
void HibernateTamperUnLock (void)
 
void HibernateTamperLock (void)
 
uint32_t HibernateTamperStatusGet (void)
 
bool HibernateTamperEventsGet (uint32_t ui32Index, uint32_t *pui32RTC, uint32_t *pui32Event)
 
void HibernateTamperExtOscRecover (void)
 
bool HibernateTamperExtOscValid (void)
 

Detailed Description

Macro Definition Documentation

#define DELAY_USECS   95

Definition at line 64 of file hibernate.c.

#define HIBERNATE_CLOCK_OUTPUT   CLASS_IS_TM4C129

Definition at line 87 of file hibernate.c.

Referenced by HibernateClockConfig().

#define HIBERNATE_WAKE_IO   CLASS_IS_TM4C129

Definition at line 79 of file hibernate.c.

Referenced by HibernateWakeGet(), and HibernateWakeSet().

#define LOOP_CYCLES   3

Definition at line 71 of file hibernate.c.

Function Documentation

static void _HibernateCalendarSet ( uint32_t  ui32Reg,
struct tm *  psTime 
)
static

Definition at line 1465 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_CAL0, HIB_CAL0_AMPM, HIB_CAL1_DOM_M, HIB_CAL1_DOM_S, HIB_CAL1_DOW_S, HIB_CAL1_MON_S, HIB_CAL1_YEAR_S, HIB_CALCTL, HIB_CALCTL_CAL24, HIB_CALCTL_CALEN, HIB_CALLD0, HIB_CALLD0_HR_M, HIB_CALLD0_HR_S, HIB_CALLD0_MIN_M, HIB_CALLD0_MIN_S, HIB_CALLD0_SEC_M, HIB_CALLD0_SEC_S, HIB_CALLD1, HIB_CALM0, HIB_CALM1, HIB_LOCK, HIB_LOCK_HIBLOCK_KEY, and HWREG.

Referenced by HibernateCalendarMatchSet(), and HibernateCalendarSet().

1466 {
1467  uint32_t ui32Time, ui32Date;
1468 
1470 
1471  //
1472  // Minutes and seconds are consistent in all modes.
1473  //
1474  ui32Time = (((psTime->tm_min << HIB_CALLD0_MIN_S) & HIB_CALLD0_MIN_M) |
1475  ((psTime->tm_sec << HIB_CALLD0_SEC_S) & HIB_CALLD0_SEC_M));
1476 
1477  //
1478  // 24 Hour time is used directly for Calendar set.
1479  //
1481  {
1482  ui32Time |= (psTime->tm_hour << HIB_CALLD0_HR_S);
1483 
1484  //
1485  // for Calendar match, if it is every hour, AMPM bit should be clear
1486  //
1487  if((ui32Reg == HIB_CALM0) && (psTime->tm_hour == 0xFF) )
1488  {
1489  //
1490  // clear AMPM bit
1491  //
1492  ui32Time &= ~HIB_CAL0_AMPM;
1493  }
1494  }
1495  else
1496  {
1497  //
1498  // In AM/PM time hours have to be capped at 12.
1499  // If the hours are all 1s, it means the match for the hour is
1500  // always true. We need to set 1F in the hw field.
1501  //
1502  if(psTime->tm_hour == 0xFF)
1503  {
1504  //
1505  // Match every hour.
1506  //
1507  ui32Time |= HIB_CALLD0_HR_M;
1508  }
1509  else if(psTime->tm_hour >= 12)
1510  {
1511  //
1512  // Need to set the PM bit if it is noon or later.
1513  //
1514  ui32Time |= (((psTime->tm_hour - 12) << HIB_CALLD0_HR_S) |
1515  HIB_CAL0_AMPM);
1516  }
1517  else
1518  {
1519  //
1520  // All other times are normal and AM.
1521  //
1522  ui32Time |= (psTime->tm_hour << HIB_CALLD0_HR_S);
1523  }
1524  }
1525 
1526  //
1527  // Create the date in the correct register format.
1528  //
1529  if(ui32Reg == HIB_CAL0)
1530  {
1531  //
1532  // We must add 1 to the month, since the time structure lists
1533  // the month from 0 to 11 and the HIB lists it from 1 to 12.
1534  //
1535  ui32Date = ((psTime->tm_mday << HIB_CAL1_DOM_S) |
1536  ((psTime->tm_mon + 1) << HIB_CAL1_MON_S) |
1537  (psTime->tm_wday << HIB_CAL1_DOW_S) |
1538  ((psTime->tm_year - 100) << HIB_CAL1_YEAR_S));
1539  }
1540  else
1541  {
1542  //
1543  // Wday, month and year are not included in the match
1544  // Functionality.
1545  //
1546  if(psTime->tm_mday == 0xFF)
1547  {
1548  //
1549  // program 0 to match every day
1550  //
1551  ui32Date = 0 << HIB_CAL1_DOM_M;
1552  }
1553  else
1554  {
1555  ui32Date = (psTime->tm_mday << HIB_CAL1_DOM_S);
1556  }
1557  }
1558 
1559  //
1560  // Load register requires unlock.
1561  //
1562  if(ui32Reg == HIB_CAL0)
1563  {
1564  //
1565  // Unlock the hibernate counter load registers.
1566  //
1569  }
1570 
1571  //
1572  // Set the requested time and date.
1573  //
1574  if(ui32Reg == HIB_CAL0)
1575  {
1576  HWREG(HIB_CALLD0) = ui32Time;
1578  HWREG(HIB_CALLD1) = ui32Date;
1580  }
1581  else
1582  {
1583  HWREG(HIB_CALM0) = ui32Time;
1585  HWREG(HIB_CALM1) = ui32Date;
1587  }
1588 
1589  //
1590  // Load register requires unlock.
1591  //
1592  if(ui32Reg == HIB_CAL0)
1593  {
1594  //
1595  // Lock the hibernate counter load registers.
1596  //
1597  HWREG(HIB_LOCK) = 0;
1599  }
1600 }
#define HIB_CAL1_DOM_M
Definition: hw_hibernate.h:270
#define HIB_CAL0
Definition: hw_hibernate.h:62
#define HIB_CAL1_MON_S
Definition: hw_hibernate.h:273
#define HIB_CALLD0_MIN_S
Definition: hw_hibernate.h:286
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CALLD0_SEC_S
Definition: hw_hibernate.h:287
#define HIB_CAL1_DOM_S
Definition: hw_hibernate.h:274
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_CALLD0_HR_S
Definition: hw_hibernate.h:285
#define HIB_CAL0_AMPM
Definition: hw_hibernate.h:253
#define HIB_CALLD0_MIN_M
Definition: hw_hibernate.h:283
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_CALCTL_CAL24
Definition: hw_hibernate.h:244
#define HIB_CALLD0
Definition: hw_hibernate.h:64
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
#define HIB_CALCTL_CALEN
Definition: hw_hibernate.h:245
#define HIB_CALM1
Definition: hw_hibernate.h:67
#define HIB_CALLD1
Definition: hw_hibernate.h:65
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107
#define HIB_CAL1_DOW_S
Definition: hw_hibernate.h:271
#define HIB_CALM0
Definition: hw_hibernate.h:66
#define HIB_CALLD0_HR_M
Definition: hw_hibernate.h:282
#define HIB_CALCTL
Definition: hw_hibernate.h:61
#define HIB_CALLD0_SEC_M
Definition: hw_hibernate.h:284
#define HIB_CAL1_YEAR_S
Definition: hw_hibernate.h:272

Here is the call graph for this function:

Here is the caller graph for this function:

static uint32_t _HibernateIntNumberGet ( void  )
static

Returns the hibernate module interrupt number.

This function returns the interrupt number for the hibernate module.

Returns
Returns a hibernate interrupt number or 0 if the interrupt does not exist.

Definition at line 1103 of file hibernate.c.

References CLASS_IS_TM4C129, INT_HIBERNATE_TM4C123, and INT_HIBERNATE_TM4C129.

Referenced by HibernateIntRegister(), and HibernateIntUnregister().

1104 {
1105  uint32_t ui32Int;
1106 
1107  //
1108  // Find the valid interrupt number for the hibernate module.
1109  //
1110  if(CLASS_IS_TM4C129)
1111  {
1112  ui32Int = INT_HIBERNATE_TM4C129;
1113  }
1114  else
1115  {
1116  ui32Int = INT_HIBERNATE_TM4C123;
1117  }
1118 
1119  return(ui32Int);
1120 }
#define INT_HIBERNATE_TM4C129
Definition: hw_ints.h:217
#define INT_HIBERNATE_TM4C123
Definition: hw_ints.h:106
#define CLASS_IS_TM4C129
Definition: hw_types.h:99

Here is the caller graph for this function:

uint32_t HibernateBatCheckDone ( void  )

Determines whether or not a forced battery check has completed.

This function determines whether the forced battery check initiated by a call to the HibernateBatCheckStart() function has completed. This function returns a non-zero value until the battery level check has completed. Once this function returns a value of zero, the Hibernation module has completed the battery check and the HibernateIntStatus() function can be used to check if the battery was low by checking if the value returned has the HIBERNATE_INT_LOW_BAT set.

Returns
The value is zero when the battery level check has completed or non-zero if the check is still in process.

Definition at line 379 of file hibernate.c.

References HIB_CTL, HIB_CTL_BATCHK, and HWREG.

380 {
381  //
382  // Read the current state of the battery check.
383  //
384  return(HWREG(HIB_CTL) & HIB_CTL_BATCHK);
385 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL
Definition: hw_hibernate.h:51
#define HIB_CTL_BATCHK
Definition: hw_hibernate.h:124
void HibernateBatCheckStart ( void  )

Forces the Hibernation module to initiate a check of the battery voltage.

This function forces the Hibernation module to initiate a check of the battery voltage immediately rather than waiting for the next check interval to pass. After calling this function, the application should call the HibernateBatCheckDone() function and wait for the function to return a zero value before calling the HibernateIntStatus() to check if the return code has the HIBERNATE_INT_LOW_BAT set. If HIBERNATE_INT_LOW_BAT is set, the battery level is low. The application can also enable the HIBERNATE_INT_LOW_BAT interrupt and wait for an interrupt to indicate that the battery level is low.

Note
A hibernation request is held off if a battery check is in progress.
Returns
None.

Definition at line 349 of file hibernate.c.

References _HibernateWriteComplete(), HIB_CTL, HIB_CTL_BATCHK, and HWREG.

350 {
351  //
352  // Initiated a forced battery check.
353  //
355 
356  //
357  // Wait for write completion
358  //
360 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107
#define HIB_CTL_BATCHK
Definition: hw_hibernate.h:124

Here is the call graph for this function:

int HibernateCalendarGet ( struct tm *  psTime)

Returns the Hibernation module's date and time in calendar mode.

Parameters
psTimeis the structure that is filled with the current date and time.

This function returns the current date and time in the structure provided by the psTime parameter. Regardless of the calendar mode, the psTime parameter uses a 24-hour representation of the time. This function can only be called when the Hibernation module is configured in calendar mode using the HibernateCounterMode() function with one of the calendar modes.

The only case where this function fails and returns a non-zero value is when the function detects that the counter is passing from the last second of the day to the first second of the next day. This exception must be handled in the application by waiting at least one second before calling again to get the updated calendar information.

Note
The hibernate calendar mode is not available on all Tiva devices. Please consult the data sheet to determine if the device you are using supports this feature in the Hibernation module.
Returns
Returns zero if the time and date were read successfully and returns a non-zero value if the psTime structure was not updated.

Definition at line 1661 of file hibernate.c.

References ASSERT, HIB_CAL0, HIB_CAL0_AMPM, HIB_CAL0_HR_M, HIB_CAL0_HR_S, HIB_CAL0_MIN_M, HIB_CAL0_MIN_S, HIB_CAL0_SEC_M, HIB_CAL0_SEC_S, HIB_CAL0_VALID, HIB_CAL1, HIB_CAL1_DOM_M, HIB_CAL1_DOM_S, HIB_CAL1_DOW_M, HIB_CAL1_DOW_S, HIB_CAL1_MON_M, HIB_CAL1_MON_S, HIB_CAL1_VALID, HIB_CAL1_YEAR_M, HIB_CAL1_YEAR_S, HIB_CALCTL, HIB_CALCTL_CAL24, HIB_CALCTL_CALEN, and HWREG.

1662 {
1663  uint32_t ui32Date, ui32Time;
1664 
1666 
1667  //
1668  // Wait for the value to be valid, this should never be more than a few
1669  // loops and should never hang.
1670  //
1671  do
1672  {
1673  ui32Date = HWREG(HIB_CAL1);
1674  }
1675  while((ui32Date & HIB_CAL1_VALID) == 0);
1676 
1677  //
1678  // Wait for the value to be valid, this should never be more than a few
1679  // loops and should never hang.
1680  //
1681  do
1682  {
1683  ui32Time = HWREG(HIB_CAL0);
1684  }
1685  while((ui32Time & HIB_CAL0_VALID) == 0);
1686 
1687  //
1688  // The date changed after reading the time so fail this call and let the
1689  // application call again since it knows how int32_t to wait until another
1690  // second passes.
1691  //
1692  if(ui32Date != HWREG(HIB_CAL1))
1693  {
1694  return(-1);
1695  }
1696 
1697  //
1698  // Populate the date and time fields in the psTime structure.
1699  // We must subtract 1 from the month, since the time structure lists
1700  // the month from 0 to 11 and the HIB lists it from 1 to 12.
1701  //
1702  psTime->tm_min = (ui32Time & HIB_CAL0_MIN_M) >> HIB_CAL0_MIN_S;
1703  psTime->tm_sec = (ui32Time & HIB_CAL0_SEC_M) >> HIB_CAL0_SEC_S;
1704  psTime->tm_mon = (((ui32Date & HIB_CAL1_MON_M) >> HIB_CAL1_MON_S) - 1);
1705  psTime->tm_mday = (ui32Date & HIB_CAL1_DOM_M) >> HIB_CAL1_DOM_S;
1706  psTime->tm_wday = (ui32Date & HIB_CAL1_DOW_M) >> HIB_CAL1_DOW_S;
1707  psTime->tm_year = ((ui32Date & HIB_CAL1_YEAR_M) >> HIB_CAL1_YEAR_S) + 100;
1708  psTime->tm_hour = (ui32Time & HIB_CAL0_HR_M) >> HIB_CAL0_HR_S;
1709 
1710  //
1711  // Fix up the hour in the non-24-hour mode and the time is in PM.
1712  //
1713  if(((HWREG(HIB_CALCTL) & HIB_CALCTL_CAL24) == 0) &&
1714  (ui32Time & HIB_CAL0_AMPM))
1715  {
1716  psTime->tm_hour += 12;
1717  }
1718 
1719  return(0);
1720 }
#define HIB_CAL1_DOM_M
Definition: hw_hibernate.h:270
#define HIB_CAL1
Definition: hw_hibernate.h:63
#define HIB_CAL0
Definition: hw_hibernate.h:62
#define HIB_CAL1_DOW_M
Definition: hw_hibernate.h:267
#define HIB_CAL0_SEC_M
Definition: hw_hibernate.h:256
#define HIB_CAL1_MON_S
Definition: hw_hibernate.h:273
#define HIB_CAL0_HR_S
Definition: hw_hibernate.h:257
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CAL1_YEAR_M
Definition: hw_hibernate.h:268
#define HIB_CAL1_DOM_S
Definition: hw_hibernate.h:274
#define HIB_CAL0_HR_M
Definition: hw_hibernate.h:254
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_CAL0_AMPM
Definition: hw_hibernate.h:253
#define HIB_CAL0_VALID
Definition: hw_hibernate.h:252
#define HIB_CALCTL_CAL24
Definition: hw_hibernate.h:244
#define HIB_CAL1_VALID
Definition: hw_hibernate.h:266
#define HIB_CALCTL_CALEN
Definition: hw_hibernate.h:245
#define HIB_CAL1_MON_M
Definition: hw_hibernate.h:269
#define HIB_CAL0_SEC_S
Definition: hw_hibernate.h:259
#define HIB_CAL1_DOW_S
Definition: hw_hibernate.h:271
#define HIB_CAL0_MIN_S
Definition: hw_hibernate.h:258
#define HIB_CAL0_MIN_M
Definition: hw_hibernate.h:255
#define HIB_CALCTL
Definition: hw_hibernate.h:61
#define HIB_CAL1_YEAR_S
Definition: hw_hibernate.h:272
void HibernateCalendarMatchGet ( uint32_t  ui32Index,
struct tm *  psTime 
)

Returns the Hibernation module's date and time match value in calendar mode.

Parameters
ui32Indexindicates which match register to access.
psTimeis the structure to fill with the current date and time match value.

This function returns the current date and time match value in the structure provided by the psTime parameter. Regardless of the mode, the psTime parameter uses a 24-hour clock representation of time. This function can only be called when the Hibernation module is configured in calendar mode using the HibernateCounterMode() function. The ui32Index value is reserved for future use and should always be zero.

Note
The hibernate calendar mode is not available on all Tiva devices. Please consult the data sheet to determine if the device you are using supports this feature in the Hibernation module.
Returns
Returns zero if the time and date match value were read successfully and returns a non-zero value if the psTime structure was not updated.

Definition at line 1785 of file hibernate.c.

References ASSERT, HIB_CAL0_AMPM, HIB_CAL0_HR_M, HIB_CAL0_HR_S, HIB_CAL0_MIN_M, HIB_CAL0_MIN_S, HIB_CAL0_SEC_M, HIB_CAL0_SEC_S, HIB_CAL1_DOM_M, HIB_CAL1_DOM_S, HIB_CALCTL, HIB_CALCTL_CAL24, HIB_CALCTL_CALEN, HIB_CALM0, HIB_CALM1, and HWREG.

1786 {
1787  uint32_t ui32Date, ui32Time;
1788 
1790 
1791  //
1792  // Get the date field.
1793  //
1794  ui32Date = HWREG(HIB_CALM1);
1795 
1796  //
1797  // Get the time field.
1798  //
1799  ui32Time = HWREG(HIB_CALM0);
1800 
1801  //
1802  // Populate the date and time fields in the psTime structure.
1803  //
1804  if((ui32Time & HIB_CAL0_MIN_M) == HIB_CAL0_MIN_M)
1805  {
1806  //
1807  // Match every minute
1808  //
1809  psTime->tm_min = 0xFF;
1810  }
1811  else
1812  {
1813  psTime->tm_min = (ui32Time & HIB_CAL0_MIN_M) >> HIB_CAL0_MIN_S;
1814  }
1815 
1816  if((ui32Time & HIB_CAL0_SEC_M) == HIB_CAL0_SEC_M)
1817  {
1818  //
1819  // Match every second
1820  //
1821  psTime->tm_sec = 0xFF;
1822  }
1823  else
1824  {
1825  psTime->tm_sec = (ui32Time & HIB_CAL0_SEC_M) >> HIB_CAL0_SEC_S;
1826  }
1827 
1828  if((ui32Time & HIB_CAL0_HR_M) == HIB_CAL0_HR_M)
1829  {
1830  //
1831  // Match every hour
1832  //
1833  psTime->tm_hour = 0xFF;
1834  }
1835  else
1836  {
1837  psTime->tm_hour = (ui32Time & HIB_CAL0_HR_M) >> HIB_CAL0_HR_S;
1838  }
1839 
1840  if((ui32Date & HIB_CAL1_DOM_M) == 0)
1841  {
1842  //
1843  // Match every day
1844  //
1845  psTime->tm_mday = 0xFF;
1846  }
1847  else
1848  {
1849  psTime->tm_mday = (ui32Date & HIB_CAL1_DOM_M) >> HIB_CAL1_DOM_S;
1850  }
1851 
1852  //
1853  // Fix up the hour in the non-24-hour mode and the time is in PM.
1854  //
1855  if(((HWREG(HIB_CALCTL) & HIB_CALCTL_CAL24) == 0) &&
1856  (ui32Time & HIB_CAL0_AMPM))
1857  {
1858  psTime->tm_hour += 12;
1859  }
1860 }
#define HIB_CAL1_DOM_M
Definition: hw_hibernate.h:270
#define HIB_CAL0_SEC_M
Definition: hw_hibernate.h:256
#define HIB_CAL0_HR_S
Definition: hw_hibernate.h:257
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CAL1_DOM_S
Definition: hw_hibernate.h:274
#define HIB_CAL0_HR_M
Definition: hw_hibernate.h:254
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_CAL0_AMPM
Definition: hw_hibernate.h:253
#define HIB_CALCTL_CAL24
Definition: hw_hibernate.h:244
#define HIB_CALCTL_CALEN
Definition: hw_hibernate.h:245
#define HIB_CALM1
Definition: hw_hibernate.h:67
#define HIB_CAL0_SEC_S
Definition: hw_hibernate.h:259
#define HIB_CALM0
Definition: hw_hibernate.h:66
#define HIB_CAL0_MIN_S
Definition: hw_hibernate.h:258
#define HIB_CAL0_MIN_M
Definition: hw_hibernate.h:255
#define HIB_CALCTL
Definition: hw_hibernate.h:61
void HibernateCalendarMatchSet ( uint32_t  ui32Index,
struct tm *  psTime 
)

Sets the Hibernation module's date and time match value in calendar mode.

Parameters
ui32Indexindicates which match register to access.
psTimeis the structure that holds all of the information to set the current date and time match values.

This function uses the psTime parameter to set the current date and time match value in the Hibernation module's calendar. Regardless of the mode, the psTime parameter uses a 24-hour clock representation of time. This function can only be called when the Hibernation module is configured in calendar mode using the HibernateCounterMode() function. The ui32Index value is reserved for future use and should always be zero. Calendar match can be enabled for every day, every hour, every minute or every second, setting any of these fields to 0xFF causes a match for that field. For example, setting the day of month field to 0xFF results in a calendar match daily at the same time.

Note
The hibernate calendar mode is not available on all Tiva devices. Please consult the data sheet to determine if the device you are using supports this feature in the Hibernation module.
Returns
None.

Definition at line 1750 of file hibernate.c.

References _HibernateCalendarSet(), and HIB_CALM0.

1751 {
1752  //
1753  // Set the Match value.
1754  //
1756 }
static void _HibernateCalendarSet(uint32_t ui32Reg, struct tm *psTime)
Definition: hibernate.c:1465
#define HIB_CALM0
Definition: hw_hibernate.h:66

Here is the call graph for this function:

void HibernateCalendarSet ( struct tm *  psTime)

Sets the Hibernation module's date and time in calendar mode.

Parameters
psTimeis the structure that holds the information for the current date and time.

This function uses the psTime parameter to set the current date and time when the Hibernation module is in calendar mode. Regardless of whether 24-hour or 12-hour mode is in use, the psTime structure uses a 24-hour representation of the time. This function can only be called when the hibernate counter is configured in calendar mode using the HibernateCounterMode() function with one of the calendar modes.

Note
The hibernate calendar mode is not available on all Tiva devices. Please consult the data sheet to determine if the device you are using supports this feature in the Hibernation module.
Returns
None.

Definition at line 1624 of file hibernate.c.

References _HibernateCalendarSet(), and HIB_CAL0.

1625 {
1626  //
1627  // Load a new date/time.
1628  //
1630 }
#define HIB_CAL0
Definition: hw_hibernate.h:62
static void _HibernateCalendarSet(uint32_t ui32Reg, struct tm *psTime)
Definition: hibernate.c:1465

Here is the call graph for this function:

void HibernateClockConfig ( uint32_t  ui32Config)

Configures the clock input for the Hibernation module.

Parameters
ui32Configis one of the possible configuration options for the clock input listed below.

This function is used to configure the clock input for the Hibernation module. The ui32Config parameter can be one of the following values:

  • HIBERNATE_OSC_DISABLE specifies that the internal oscillator is powered off. This option is used when an externally supplied oscillator is connected to the XOSC0 pin or to save power when the LFIOSC is used in devices that have an LFIOSC in the Hibernation module.
  • HIBERNATE_OSC_HIGHDRIVE specifies a higher drive strength when a 24-pF filter capacitor is used with a crystal.
  • HIBERNATE_OSC_LOWDRIVE specifies a lower drive strength when a 12-pF filter capacitor is used with a crystal.

On some devices, there is an option to use an internal low frequency oscillator (LFIOSC) as the clock source for the Hibernation module. Because of the low accuracy of this oscillator, this option should not be used when the system requires a real time counter. Adding the HIBERNATE_OSC_LFIOSC value enables the LFIOSC as the clock source to the Hibernation module.

  • HIBERNATE_OSC_LFIOSC enables the Hibernation module's internal low frequency oscillator as the clock to the Hibernation module.

This ui32Config also configures how the clock output from the hibernation is used to clock other peripherals in the system. The ALT clock settings allow clocking a subset of the peripherals. See the hibernate section in the datasheet to determine which peripherals can be clocked by the ALT clock outputs from the Hibernation module. The ui32Config parameter can have any combination of the following values:

  • HIBERNATE_OUT_SYSCLK enables the hibernate clock output to the system clock.

The HIBERNATE_OSC_DISABLE option is used to disable and power down the internal oscillator if an external clock source or no clock source is used instead of a 32.768-kHz crystal. In the case where an external crystal is used, either the HIBERNATE_OSC_HIGHDRIVE or HIBERNATE_OSC_LOWDRIVE is used. These settings optimizes the oscillator drive strength to match the size of the filter capacitor that is used with the external crystal circuit.

Returns
None.

Definition at line 225 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_CC, HIB_CTL, HIB_CTL_CLK32EN, HIBERNATE_CLOCK_OUTPUT, HIBERNATE_OSC_DISABLE, HIBERNATE_OSC_HIGHDRIVE, HIBERNATE_OSC_LFIOSC, HIBERNATE_OSC_LOWDRIVE, HIBERNATE_OUT_ALT1CLK, HIBERNATE_OUT_SYSCLK, and HWREG.

226 {
227  uint32_t ui32HIBCtl;
228 
230  HIBERNATE_OSC_DISABLE)) == 0);
231 
232  ui32HIBCtl = HWREG(HIB_CTL);
233 
234  //
235  // Clear the current configuration bits.
236  //
239 
240  //
241  // Set the new configuration bits.
242  //
243  ui32HIBCtl |= ui32Config & (HIBERNATE_OSC_HIGHDRIVE |
247 
248  //
249  // Must be sure that the 32KHz clock is enabled if the hibernate is about
250  // to switch to it.
251  //
252  if(ui32Config & HIBERNATE_OSC_LFIOSC)
253  {
254  ui32HIBCtl |= HIB_CTL_CLK32EN;
255  }
256 
257  //
258  // Set the hibernation clocking configuration.
259  //
260  HWREG(HIB_CTL) = ui32HIBCtl;
261 
262  //
263  // Wait for write completion
264  //
266 
267  //
268  // Write the output clock configuration for devices that support
269  // controlling the output clocks from the hibernate module.
270  //
272  {
273  HWREG(HIB_CC) = ui32Config & (HIBERNATE_OUT_SYSCLK |
275  }
276 }
#define HIB_CC
Definition: hw_hibernate.h:82
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIBERNATE_OSC_HIGHDRIVE
Definition: hibernate.h:103
#define HIBERNATE_OSC_DISABLE
Definition: hibernate.h:104
#define HIB_CTL_CLK32EN
Definition: hw_hibernate.h:128
#define HIBERNATE_OSC_LFIOSC
Definition: hibernate.h:101
#define HIBERNATE_OUT_ALT1CLK
Definition: hibernate.h:107
#define HIBERNATE_CLOCK_OUTPUT
Definition: hibernate.c:87
#define HIB_CTL
Definition: hw_hibernate.h:51
#define HIBERNATE_OSC_LOWDRIVE
Definition: hibernate.h:102
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107
#define HIBERNATE_OUT_SYSCLK
Definition: hibernate.h:106

Here is the call graph for this function:

void HibernateCounterMode ( uint32_t  ui32Config)

Configures the Hibernation module's internal counter mode.

Parameters
ui32Configis the configuration to use for the Hibernation module's counter.

This function configures the Hibernate module's counter mode to operate as a standard RTC counter or to operate in a calendar mode. The ui32Config parameter is used to provide the configuration for the counter and must include only one of the following values:

  • HIBERNATE_COUNTER_24HR specifies 24-hour calendar mode.
  • HIBERNATE_COUNTER_12HR specifies 12-hour AM/PM calendar mode.
  • HIBERNATE_COUNTER_RTC specifies RTC counter mode.

The HibernateCalendar functions can only be called when either HIBERNATE_COUNTER_24HR or HIBERNATE_COUNTER_12HR is specified.

Example: Configure hibernate counter to 24-hour calendar mode.

//!
//! //
//! // Configure the hibernate module counter to 24-hour calendar mode.
//! //
//! HibernateCounterMode(HIBERNATE_COUNTER_24HR);
//!
//! 
\note The hibernate calendar mode is not available on all Tiva
devices.  Please consult the data sheet to determine if the device you are
using supports this feature in the Hibernation module.

\return None.  

Definition at line 1446 of file hibernate.c.

References _HibernateWriteComplete(), HIB_CALCTL, and HWREG.

1447 {
1448  //
1449  // Set the requested configuration.
1450  //
1451  HWREG(HIB_CALCTL) = ui32Config;
1452 
1453  //
1454  // Wait for write completion
1455  //
1457 }
#define HWREG(x)
Definition: hw_types.h:48
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107
#define HIB_CALCTL
Definition: hw_hibernate.h:61

Here is the call graph for this function:

void HibernateDataGet ( uint32_t *  pui32Data,
uint32_t  ui32Count 
)

Reads a set of data from the battery-backed memory of the Hibernation module.

Parameters
pui32Datapoints to a location where the data that is read from the Hibernation module is stored.
ui32Countis the count of 32-bit words to read.

This function retrieves a set of data from the Hibernation module battery-backed memory that was previously stored with the HibernateDataSet() function. The caller must ensure that pui32Data points to a large enough memory block to hold all the data that is read from the battery-backed memory.

Returns
None.

Definition at line 929 of file hibernate.c.

References ASSERT, HIB_DATA, and HWREG.

930 {
931  uint32_t ui32Idx;
932 
933  //
934  // Check the arguments.
935  //
936  ASSERT(ui32Count <= 64);
937  ASSERT(pui32Data != 0);
938 
939  //
940  // Loop through all the words to be restored, reading one at a time.
941  //
942  for(ui32Idx = 0; ui32Idx < ui32Count; ui32Idx++)
943  {
944  //
945  // Read a word from the battery-backed storage area. No delay is
946  // required between reads.
947  //
948  pui32Data[ui32Idx] = HWREG(HIB_DATA + (ui32Idx * 4));
949  }
950 }
#define HIB_DATA
Definition: hw_hibernate.h:60
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
void HibernateDataSet ( uint32_t *  pui32Data,
uint32_t  ui32Count 
)

Stores data in the battery-backed memory of the Hibernation module.

Parameters
pui32Datapoints to the data that the caller wants to store in the memory of the Hibernation module.
ui32Countis the count of 32-bit words to store.

Stores a set of data in the Hibernation module battery-backed memory. This memory is preserved when the power to the processor is turned off and can be used to store application state information that is needed when the processor wakes. Up to 16 32-bit words can be stored in the battery-backed memory. The data can be restored by calling the HibernateDataGet() function.

Returns
None.

Definition at line 883 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_DATA, and HWREG.

884 {
885  uint32_t ui32Idx;
886 
887  //
888  // Check the arguments.
889  //
890  ASSERT(ui32Count <= 64);
891  ASSERT(pui32Data != 0);
892 
893  //
894  // Loop through all the words to be stored, storing one at a time.
895  //
896  for(ui32Idx = 0; ui32Idx < ui32Count; ui32Idx++)
897  {
898  //
899  // Write a word to the battery-backed storage area.
900  //
901  HWREG(HIB_DATA + (ui32Idx * 4)) = pui32Data[ui32Idx];
902 
903  //
904  // Wait for write completion
905  //
907  }
908 }
#define HIB_DATA
Definition: hw_hibernate.h:60
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateDisable ( void  )

Disables the Hibernation module for operation.

This function disables the Hibernation module. After this function is called, none of the Hibernation module features are available.

Returns
None.

Definition at line 160 of file hibernate.c.

References _HibernateWriteComplete(), HIB_CTL, HIB_CTL_CLK32EN, and HWREG.

161 {
162  //
163  // Turn off the clock enable bit.
164  //
166 
167  //
168  // Wait for write completion
169  //
171 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL_CLK32EN
Definition: hw_hibernate.h:128
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateEnableExpClk ( uint32_t  ui32HibClk)

Enables the Hibernation module for operation.

Parameters
ui32HibClkis the rate of the clock supplied to the Hibernation module.

This function enables the Hibernation module for operation. This function should be called before any of the Hibernation module features are used.

The peripheral clock is the same as the processor clock. This value is returned by SysCtlClockGet(), or it can be explicitly hard-coded if it is constant and known (to save the code/execution overhead of a call to SysCtlClockGet()).

Returns
None.

Definition at line 136 of file hibernate.c.

References _HibernateWriteComplete(), HIB_CTL, HIB_CTL_CLK32EN, and HWREG.

137 {
138  //
139  // Turn on the clock enable bit.
140  //
142 
143  //
144  // Wait for write complete following register load (above).
145  //
147 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL_CLK32EN
Definition: hw_hibernate.h:128
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateGPIORetentionDisable ( void  )

Disables GPIO retention after wake from hibernation.

This function disables the retention of the GPIO pin state during hibernation and allows the GPIO pins to be controlled by the system. If the HibernateGPIORetentionEnable() function is called before entering hibernation, this function must be called after returning from hibernation to allow the GPIO pins to be controlled by GPIO module.

Note
The hibernate GPIO retention setting is not available on all Tiva devices. Please consult the data sheet to determine if the device you are using supports this feature in the Hibernation module.
Returns
None.

Definition at line 1365 of file hibernate.c.

References _HibernateWriteComplete(), HIB_CTL, HIB_CTL_RETCLR, HIB_CTL_VDD3ON, and HWREG.

1366 {
1367  //
1368  // Reset the GPIO configuration after waking from hibernate and disable
1369  // the hibernate power to the pads.
1370  //
1372 
1373  //
1374  // Wait for write completion
1375  //
1377 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL_RETCLR
Definition: hw_hibernate.h:114
#define HIB_CTL_VDD3ON
Definition: hw_hibernate.h:126
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateGPIORetentionEnable ( void  )

Enables GPIO retention after wake from hibernation.

This function enables the GPIO pin state to be maintained during hibernation and remain active even when waking from hibernation. The GPIO module itself is reset upon entering hibernation and no longer controls the output pins. To maintain the current output level after waking from hibernation, the GPIO module must be reconfigured and then the HibernateGPIORetentionDisable() function must be called to return control of the GPIO pin to the GPIO module.

Note
The hibernation GPIO retention setting is not available on all Tiva devices. Please consult the data sheet to determine if the device you are using supports this feature in the Hibernation module.
Returns
None.

Definition at line 1334 of file hibernate.c.

References _HibernateWriteComplete(), HIB_CTL, HIB_CTL_RETCLR, HIB_CTL_VDD3ON, and HWREG.

1335 {
1336  //
1337  // Enable power to the pads and enable GPIO retention during hibernate.
1338  //
1340 
1341  //
1342  // Wait for write completion
1343  //
1345 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL_RETCLR
Definition: hw_hibernate.h:114
#define HIB_CTL_VDD3ON
Definition: hw_hibernate.h:126
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

bool HibernateGPIORetentionGet ( void  )

Returns the current setting for GPIO retention.

This function returns the current setting for GPIO retention in the hibernate module.

Note
The hibernation GPIO retention setting is not available on all Tiva devices. Please consult the data sheet to determine if the device you are using supports this feature in the Hibernation module.
Returns
Returns true if GPIO retention is enabled and false if GPIO retention is disabled.

Definition at line 1395 of file hibernate.c.

References HIB_CTL, HIB_CTL_RETCLR, HIB_CTL_VDD3ON, and HWREG.

1396 {
1397  //
1398  // Read the current GPIO retention configuration.
1399  //
1402  {
1403  return(true);
1404  }
1405  return(false);
1406 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL_RETCLR
Definition: hw_hibernate.h:114
#define HIB_CTL_VDD3ON
Definition: hw_hibernate.h:126
#define HIB_CTL
Definition: hw_hibernate.h:51
void HibernateIntClear ( uint32_t  ui32IntFlags)

Clears pending interrupts from the Hibernation module.

Parameters
ui32IntFlagsis the bit mask of the interrupts to be cleared.

This function clears the specified interrupt sources. This function must be called within the interrupt handler or else the handler is called again upon exit.

The ui32IntFlags parameter has the same definition as the ui32IntFlags parameter to the HibernateIntEnable() function.

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).
Returns
None.

Definition at line 1261 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_IC, HIBERNATE_INT_GPIO_WAKE, HIBERNATE_INT_LOW_BAT, HIBERNATE_INT_PIN_WAKE, HIBERNATE_INT_RESET_WAKE, HIBERNATE_INT_RTC_MATCH_0, HIBERNATE_INT_VDDFAIL, HIBERNATE_INT_WR_COMPLETE, and HWREG.

1262 {
1263  //
1264  // Check the arguments.
1265  //
1266  ASSERT(!(ui32IntFlags & ~(HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_LOW_BAT |
1272 
1273  //
1274  // Write the specified interrupt bits into the interrupt clear register.
1275  //
1276  HWREG(HIB_IC) |= ui32IntFlags;
1277 
1278  //
1279  // Wait for write completion
1280  //
1282 }
#define HIBERNATE_INT_WR_COMPLETE
Definition: hibernate.h:88
#define HIBERNATE_INT_RESET_WAKE
Definition: hibernate.h:85
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIBERNATE_INT_GPIO_WAKE
Definition: hibernate.h:87
#define HIBERNATE_INT_PIN_WAKE
Definition: hibernate.h:90
#define HIB_IC
Definition: hw_hibernate.h:56
#define HIBERNATE_INT_LOW_BAT
Definition: hibernate.h:91
#define HIBERNATE_INT_VDDFAIL
Definition: hibernate.h:84
#define HIBERNATE_INT_RTC_MATCH_0
Definition: hibernate.h:92
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateIntDisable ( uint32_t  ui32IntFlags)

Disables interrupts for the Hibernation module.

Parameters
ui32IntFlagsis the bit mask of the interrupts to be disabled.

This function disables the specified interrupt sources from the Hibernation module.

The ui32IntFlags parameter has the same definition as the ui32IntFlags parameter to the HibernateIntEnable() function.

Returns
None.

Definition at line 1069 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_IM, HIBERNATE_INT_GPIO_WAKE, HIBERNATE_INT_LOW_BAT, HIBERNATE_INT_PIN_WAKE, HIBERNATE_INT_RESET_WAKE, HIBERNATE_INT_RTC_MATCH_0, HIBERNATE_INT_VDDFAIL, HIBERNATE_INT_WR_COMPLETE, and HWREG.

1070 {
1071  //
1072  // Check the arguments.
1073  //
1074  ASSERT(!(ui32IntFlags & ~(HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_LOW_BAT |
1080 
1081  //
1082  // Clear the specified interrupt mask bits.
1083  //
1084  HWREG(HIB_IM) &= ~ui32IntFlags;
1085 
1086  //
1087  // Wait for write completion
1088  //
1090 }
#define HIBERNATE_INT_WR_COMPLETE
Definition: hibernate.h:88
#define HIBERNATE_INT_RESET_WAKE
Definition: hibernate.h:85
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_IM
Definition: hw_hibernate.h:52
#define HIBERNATE_INT_GPIO_WAKE
Definition: hibernate.h:87
#define HIBERNATE_INT_PIN_WAKE
Definition: hibernate.h:90
#define HIBERNATE_INT_LOW_BAT
Definition: hibernate.h:91
#define HIBERNATE_INT_VDDFAIL
Definition: hibernate.h:84
#define HIBERNATE_INT_RTC_MATCH_0
Definition: hibernate.h:92
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateIntEnable ( uint32_t  ui32IntFlags)

Enables interrupts for the Hibernation module.

Parameters
ui32IntFlagsis the bit mask of the interrupts to be enabled.

This function enables the specified interrupt sources from the Hibernation module.

The ui32IntFlags parameter must be the logical OR of any combination of the following:

  • HIBERNATE_INT_WR_COMPLETE - write complete interrupt
  • HIBERNATE_INT_PIN_WAKE - wake from pin interrupt
  • HIBERNATE_INT_LOW_BAT - low-battery interrupt
  • HIBERNATE_INT_RTC_MATCH_0 - RTC match 0 interrupt
  • HIBERNATE_INT_VDDFAIL - supply failure interrupt.
  • HIBERNATE_INT_RESET_WAKE - wake from reset pin interrupt
  • HIBERNATE_INT_GPIO_WAKE - wake from GPIO pin or reset pin interrupt.
Note
The HIBERNATE_INT_RESET_WAKE, HIBERNATE_INT_GPIO_WAKE, and HIBERNATE_INT_VDDFAIL settings are not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if these interrupt sources are available.
Returns
None.

Definition at line 1030 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_IM, HIBERNATE_INT_GPIO_WAKE, HIBERNATE_INT_LOW_BAT, HIBERNATE_INT_PIN_WAKE, HIBERNATE_INT_RESET_WAKE, HIBERNATE_INT_RTC_MATCH_0, HIBERNATE_INT_VDDFAIL, HIBERNATE_INT_WR_COMPLETE, and HWREG.

1031 {
1032  //
1033  // Check the arguments.
1034  //
1035  ASSERT(!(ui32IntFlags & ~(HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_LOW_BAT |
1041 
1042  //
1043  // Set the specified interrupt mask bits.
1044  //
1045  HWREG(HIB_IM) |= ui32IntFlags;
1046 
1047  //
1048  // Wait for write completion
1049  //
1051 }
#define HIBERNATE_INT_WR_COMPLETE
Definition: hibernate.h:88
#define HIBERNATE_INT_RESET_WAKE
Definition: hibernate.h:85
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_IM
Definition: hw_hibernate.h:52
#define HIBERNATE_INT_GPIO_WAKE
Definition: hibernate.h:87
#define HIBERNATE_INT_PIN_WAKE
Definition: hibernate.h:90
#define HIBERNATE_INT_LOW_BAT
Definition: hibernate.h:91
#define HIBERNATE_INT_VDDFAIL
Definition: hibernate.h:84
#define HIBERNATE_INT_RTC_MATCH_0
Definition: hibernate.h:92
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateIntRegister ( void(*)(void)  pfnHandler)

Registers an interrupt handler for the Hibernation module interrupt.

Parameters
pfnHandlerpoints to the function to be called when a hibernation interrupt occurs.

This function registers the interrupt handler in the system interrupt controller. The interrupt is enabled at the global level, but individual interrupt sources must still be enabled with a call to HibernateIntEnable().

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

Definition at line 1141 of file hibernate.c.

References _HibernateIntNumberGet(), ASSERT, IntEnable(), and IntRegister().

1142 {
1143  uint32_t ui32Int;
1144 
1145  //
1146  // Get the interrupt number for the Hibernate module.
1147  //
1148  ui32Int = _HibernateIntNumberGet();
1149 
1150  ASSERT(ui32Int != 0);
1151 
1152  //
1153  // Register the interrupt handler.
1154  //
1155  IntRegister(ui32Int, pfnHandler);
1156 
1157  //
1158  // Enable the hibernate module interrupt.
1159  //
1160  IntEnable(ui32Int);
1161 }
#define ASSERT(expr)
Definition: debug.h:67
static uint32_t _HibernateIntNumberGet(void)
Definition: hibernate.c:1103
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 HibernateIntStatus ( bool  bMasked)

Gets the current interrupt status of the Hibernation module.

Parameters
bMaskedis false to retrieve the raw interrupt status, and true to retrieve the masked interrupt status.

This function returns the interrupt status of the Hibernation module. The caller can use this function to determine the cause of a hibernation interrupt. Either the masked or raw interrupt status can be returned.

Note
A wake from reset pin also signals a wake from GPIO pin with the value returned being HIBERNATE_INT_GPIO_WAKE | HIBERNATE_INT_RESET_WAKE. Hence a wake from reset pin should take priority over wake from GPIO pin.
Returns
Returns the interrupt status as a bit field with the values as described in the HibernateIntEnable() function.

Definition at line 1220 of file hibernate.c.

References HIB_MIS, HIB_RIS, and HWREG.

1221 {
1222  //
1223  // Read and return the Hibernation module raw or masked interrupt status.
1224  //
1225  if(bMasked == true)
1226  {
1227  return(HWREG(HIB_MIS));
1228  }
1229  else
1230  {
1231  return(HWREG(HIB_RIS));
1232  }
1233 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_MIS
Definition: hw_hibernate.h:54
#define HIB_RIS
Definition: hw_hibernate.h:53
void HibernateIntUnregister ( void  )

Unregisters an interrupt handler for the Hibernation module interrupt.

This function unregisters the interrupt handler in the system interrupt controller. The interrupt is disabled at the global level, and the interrupt handler is no longer called.

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

Definition at line 1178 of file hibernate.c.

References _HibernateIntNumberGet(), ASSERT, IntDisable(), and IntUnregister().

1179 {
1180  uint32_t ui32Int;
1181 
1182  //
1183  // Get the interrupt number for the Hibernate module.
1184  //
1185  ui32Int = _HibernateIntNumberGet();
1186 
1187  ASSERT(ui32Int != 0);
1188 
1189  //
1190  // Disable the hibernate interrupt.
1191  //
1192  IntDisable(ui32Int);
1193 
1194  //
1195  // Unregister the interrupt handler.
1196  //
1197  IntUnregister(ui32Int);
1198 }
#define ASSERT(expr)
Definition: debug.h:67
void IntUnregister(uint32_t ui32Interrupt)
Definition: interrupt.c:381
static uint32_t _HibernateIntNumberGet(void)
Definition: hibernate.c:1103
void IntDisable(uint32_t ui32Interrupt)
Definition: interrupt.c:684

Here is the call graph for this function:

uint32_t HibernateIsActive ( void  )

Checks to see if the Hibernation module is already powered up.

This function queries the control register to determine if the module is already active. This function can be called at a power-on reset to help determine if the reset is due to a wake from hibernation or a cold start. If the Hibernation module is already active, then it does not need to be re-enabled, and its status can be queried immediately.

The software application should also use the HibernateIntStatus() function to read the raw interrupt status to determine the cause of the wake. The HibernateDataGet() function can be used to restore state. These combinations of functions can be used by the software to determine if the processor is waking from hibernation and the appropriate action to take as a result.

Returns
Returns true if the module is already active, and false if not.

Definition at line 1306 of file hibernate.c.

References HIB_CTL, HIB_CTL_CLK32EN, and HWREG.

1307 {
1308  //
1309  // Read the control register, and return true if the module is enabled.
1310  //
1311  return(HWREG(HIB_CTL) & HIB_CTL_CLK32EN ? 1 : 0);
1312 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL_CLK32EN
Definition: hw_hibernate.h:128
#define HIB_CTL
Definition: hw_hibernate.h:51
uint32_t HibernateLowBatGet ( void  )

Gets the currently configured low-battery detection behavior.

This function returns a value representing the currently configured low battery detection behavior.

The return value is a combination of the values described in the HibernateLowBatSet() function.

Returns
Returns a value indicating the configured low-battery detection.

Definition at line 607 of file hibernate.c.

References HIB_CTL, HIB_CTL_VBATSEL_M, HIBERNATE_LOW_BAT_ABORT, and HWREG.

608 {
609  //
610  // Read the supported low bat bits from the control register and return
611  // those bits to the caller.
612  //
614 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIBERNATE_LOW_BAT_ABORT
Definition: hibernate.h:73
#define HIB_CTL_VBATSEL_M
Definition: hw_hibernate.h:118
#define HIB_CTL
Definition: hw_hibernate.h:51
void HibernateLowBatSet ( uint32_t  ui32LowBatFlags)

Configures the low-battery detection.

Parameters
ui32LowBatFlagsspecifies behavior of low-battery detection.

This function enables the low-battery detection and whether hibernation is allowed if a low battery is detected. If low-battery detection is enabled, then a low-battery condition is indicated in the raw interrupt status register, which can be enabled to trigger an interrupt. Optionally, hibernation can be aborted if a low battery condition is detected.

The ui32LowBatFlags parameter is one of the following values:

  • HIBERNATE_LOW_BAT_DETECT - detect a low-battery condition
  • HIBERNATE_LOW_BAT_ABORT - detect a low-battery condition and abort hibernation if low-battery is detected

The other setting in the ui32LowBatFlags allows the caller to set one of the following voltage level trigger values :

  • HIBERNATE_LOW_BAT_1_9V - voltage low level is 1.9 V
  • HIBERNATE_LOW_BAT_2_1V - voltage low level is 2.1 V
  • HIBERNATE_LOW_BAT_2_3V - voltage low level is 2.3 V
  • HIBERNATE_LOW_BAT_2_5V - voltage low level is 2.5 V

Example: Abort hibernate if the voltage level is below 2.1 V.

//! HibernateLowBatSet(HIBERNATE_LOW_BAT_ABORT | HIBERNATE_LOW_BAT_2_1V);
//! 
\return None.  

Definition at line 571 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_CTL, HIB_CTL_VBATSEL_M, HIBERNATE_LOW_BAT_ABORT, and HWREG.

572 {
573  //
574  // Check the arguments.
575  //
576  ASSERT(!(ui32LowBatFlags &
578 
579  //
580  // Set the low-battery detect and abort bits in the control register,
581  // according to the parameter.
582  //
583  HWREG(HIB_CTL) = (ui32LowBatFlags |
586 
587  //
588  // Wait for write completion
589  //
591 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIBERNATE_LOW_BAT_ABORT
Definition: hibernate.h:73
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_CTL_VBATSEL_M
Definition: hw_hibernate.h:118
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateRequest ( void  )

Requests hibernation mode.

This function requests the Hibernation module to disable the external regulator, thus removing power from the processor and all peripherals. The Hibernation module remains powered from the battery or auxiliary power supply.

The Hibernation module re-enables the external regulator when one of the configured wake conditions occurs (such as RTC match or external WAKE pin). When the power is restored, the processor goes through a power-on reset although the Hibernation module is not reset. The processor can retrieve saved state information with the HibernateDataGet() function. Prior to calling the function to request hibernation mode, the conditions for waking must have already been set by using the HibernateWakeSet() function.

Note that this function may return because some time may elapse before the power is actually removed, or it may not be removed at all. For this reason, the processor continues to execute instructions for some time, and the caller should be prepared for this function to return. There are various reasons why the power may not be removed. For example, if the HibernateLowBatSet() function was used to configure an abort if low battery is detected, then the power is not removed if the battery voltage is too low. There may be other reasons related to the external circuit design, that a request for hibernation may not actually occur.

For all these reasons, the caller must be prepared for this function to return. The simplest way to handle it is to just enter an infinite loop and wait for the power to be removed.

Returns
None.

Definition at line 988 of file hibernate.c.

References _HibernateWriteComplete(), HIB_CTL, HIB_CTL_HIBREQ, and HWREG.

989 {
990  //
991  // Set the bit in the control register to cut main power to the processor.
992  //
994 
995  //
996  // Wait for write completion
997  //
999 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL_HIBREQ
Definition: hw_hibernate.h:131
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateRTCDisable ( void  )

Disables the RTC feature of the Hibernation module.

This function disables the RTC in the Hibernation module. After calling this function, the RTC features of the Hibernation module are not available.

Returns
None.

Definition at line 316 of file hibernate.c.

References _HibernateWriteComplete(), HIB_CTL, HIB_CTL_RTCEN, and HWREG.

317 {
318  //
319  // Turn off the RTC enable bit.
320  //
322 
323  //
324  // Wait for write completion
325  //
327 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL_RTCEN
Definition: hw_hibernate.h:132
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateRTCEnable ( void  )

Enables the RTC feature of the Hibernation module.

This function enables the RTC in the Hibernation module. The RTC can be used to wake the processor from hibernation at a certain time, or to generate interrupts at certain times. This function must be called before using any of the RTC features of the Hibernation module.

Returns
None.

Definition at line 291 of file hibernate.c.

References _HibernateWriteComplete(), HIB_CTL, HIB_CTL_RTCEN, and HWREG.

292 {
293  //
294  // Turn on the RTC enable bit.
295  //
297 
298  //
299  // Wait for write completion
300  //
302 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_CTL_RTCEN
Definition: hw_hibernate.h:132
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

uint32_t HibernateRTCGet ( void  )

Gets the value of the real time clock (RTC) counter.

This function gets the value of the RTC and returns it to the caller.

Returns
Returns the value of the RTC counter in seconds.

Definition at line 665 of file hibernate.c.

References HIB_RTCC, and HWREG.

666 {
667  //
668  // Return the value of the RTC counter register to the caller.
669  //
670  return(HWREG(HIB_RTCC));
671 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_RTCC
Definition: hw_hibernate.h:48
uint32_t HibernateRTCMatchGet ( uint32_t  ui32Match)

Gets the value of the requested RTC match register.

Parameters
ui32Matchis the index of the match register.

This function gets the value of the match register for the RTC. The only value that can be used with the ui32Match parameter is zero, other values are reserved for future use.

Returns
Returns the value of the requested match register.

Definition at line 718 of file hibernate.c.

References ASSERT, HIB_RTCM0, and HWREG.

719 {
720  ASSERT(ui32Match == 0);
721 
722  //
723  // Return the value of the match register to the caller.
724  //
725  return(HWREG(HIB_RTCM0));
726 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_RTCM0
Definition: hw_hibernate.h:49
void HibernateRTCMatchSet ( uint32_t  ui32Match,
uint32_t  ui32Value 
)

Sets the value of the RTC match register.

Parameters
ui32Matchis the index of the match register.
ui32Valueis the value for the match register.

This function sets a match register for the RTC. The Hibernation module can be configured to wake from hibernation, and/or generate an interrupt when the value of the RTC counter is the same as the match register.

Returns
None.

Definition at line 689 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_RTCM0, and HWREG.

690 {
691  ASSERT(ui32Match == 0);
692 
693  //
694  // Write the new match value to the match register.
695  //
696  HWREG(HIB_RTCM0) = ui32Value;
697 
698  //
699  // Wait for write completion
700  //
702 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_RTCM0
Definition: hw_hibernate.h:49
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateRTCSet ( uint32_t  ui32RTCValue)

Sets the value of the real time clock (RTC) counter.

Parameters
ui32RTCValueis the new value for the RTC.

This function sets the value of the RTC. The RTC counter contains the count in seconds when a 32.768kHz clock source is in use. The RTC must be enabled by calling HibernateRTCEnable() before calling this function.

Returns
None.

Definition at line 630 of file hibernate.c.

References _HibernateWriteComplete(), HIB_LOCK, HIB_LOCK_HIBLOCK_KEY, HIB_RTCLD, and HWREG.

631 {
632  //
633  // Load register requires unlock.
634  //
637 
638  //
639  // Write the new RTC value to the RTC load register.
640  //
641  HWREG(HIB_RTCLD) = ui32RTCValue;
642 
643  //
644  // Wait for write completion
645  //
647 
648  //
649  // Unlock.
650  //
651  HWREG(HIB_LOCK) = 0;
653 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107
#define HIB_RTCLD
Definition: hw_hibernate.h:50

Here is the call graph for this function:

uint32_t HibernateRTCSSGet ( void  )

Returns the current value of the RTC sub second count.

This function returns the current value of the sub second count for the RTC in 1/32768 of a second increments. The only value that can be used with the ui32Match parameter is zero, other values are reserved for future use.

Returns
The current RTC sub second count in 1/32768 seconds.

Definition at line 799 of file hibernate.c.

References HIB_RTCSS, HIB_RTCSS_RTCSSC_M, and HWREG.

800 {
801  //
802  // Read the current second RTC count.
803  //
805 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_RTCSS
Definition: hw_hibernate.h:58
#define HIB_RTCSS_RTCSSC_M
Definition: hw_hibernate.h:217
uint32_t HibernateRTCSSMatchGet ( uint32_t  ui32Match)

Returns the value of the requested RTC sub second match register.

Parameters
ui32Matchis the index of the match register.

This function returns the current value of the sub second match register for the RTC. The value returned is in 1/32768 second increments. The only value that can be used with the ui32Match parameter is zero, other values are reserved for future use.

Returns
Returns the value of the requested sub section match register.

Definition at line 776 of file hibernate.c.

References ASSERT, HIB_RTCSS, HIB_RTCSS_RTCSSM_S, and HWREG.

777 {
778  ASSERT(ui32Match == 0);
779 
780  //
781  // Read the current second RTC count.
782  //
783  return(HWREG(HIB_RTCSS) >> HIB_RTCSS_RTCSSM_S);
784 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_RTCSS
Definition: hw_hibernate.h:58
#define HIB_RTCSS_RTCSSM_S
Definition: hw_hibernate.h:218
void HibernateRTCSSMatchSet ( uint32_t  ui32Match,
uint32_t  ui32Value 
)

Sets the value of the RTC sub second match register.

Parameters
ui32Matchis the index of the match register.
ui32Valueis the value for the sub second match register.

This function sets the sub second match register for the RTC in 1/32768 of a second increments. The Hibernation module can be configured to wake from hibernation, and/or generate an interrupt when the value of the RTC counter is the same as the match combined with the sub second match register. The only value that can be used with the ui32Match parameter is zero, other values are reserved for future use.

Returns
None.

Definition at line 746 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_RTCSS, HIB_RTCSS_RTCSSM_S, and HWREG.

747 {
748  ASSERT(ui32Match == 0);
749 
750  //
751  // Write the new sub second match value to the sub second match register.
752  //
753  HWREG(HIB_RTCSS) = ui32Value << HIB_RTCSS_RTCSSM_S;
754 
755  //
756  // Wait for write complete to be signaled on later devices.
757  //
759 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_RTCSS
Definition: hw_hibernate.h:58
#define HIB_RTCSS_RTCSSM_S
Definition: hw_hibernate.h:218
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

uint32_t HibernateRTCTrimGet ( void  )

Gets the value of the RTC pre-divider trim register.

This function gets the value of the pre-divider trim register. This function can be used to get the current value of the trim register prior to making an adjustment by using the HibernateRTCTrimSet() function.

Returns
None.

Definition at line 856 of file hibernate.c.

References HIB_RTCT, and HWREG.

857 {
858  //
859  // Return the value of the trim register to the caller.
860  //
861  return(HWREG(HIB_RTCT));
862 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_RTCT
Definition: hw_hibernate.h:57
void HibernateRTCTrimSet ( uint32_t  ui32Trim)

Sets the value of the RTC pre-divider trim register.

Parameters
ui32Trimis the new value for the pre-divider trim register.

This function sets the value of the pre-divider trim register. The input time source is divided by the pre-divider to achieve a one-second clock rate. Once every 64 seconds, the value of the pre-divider trim register is applied to the pre-divider to allow fine-tuning of the RTC rate, in order to make corrections to the rate. The software application can make adjustments to the pre-divider trim register to account for variations in the accuracy of the input time source. The nominal value is 0x7FFF, and it can be adjusted up or down in order to fine-tune the RTC rate.

Returns
None.

Definition at line 826 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_RTCT, and HWREG.

827 {
828  //
829  // Check the arguments.
830  //
831  ASSERT(ui32Trim < 0x10000);
832 
833  //
834  // Write the new trim value to the trim register.
835  //
836  HWREG(HIB_RTCT) = ui32Trim;
837 
838  //
839  // Wait for write completion
840  //
842 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_RTCT
Definition: hw_hibernate.h:57
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateTamperDisable ( void  )

Disables the tamper feature.

This function is used to disable the tamper feature functionality. All other configuration settings are left unmodified, allowing a call to HibernateTamperEnable() to quickly enable the tamper feature with its previous configuration.

Note
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
None.

Definition at line 1986 of file hibernate.c.

References _HibernateWriteComplete(), HIB_LOCK, HIB_LOCK_HIBLOCK_KEY, HIB_TPCTL, HIB_TPCTL_TPEN, and HWREG.

1987 {
1988  //
1989  // Unlock the tamper registers.
1990  //
1993 
1994  //
1995  // Clear the tamper enable bit.
1996  //
1998 
1999  //
2000  // Wait for write completion.
2001  //
2003 
2004  //
2005  // Lock the tamper registers.
2006  //
2007  HWREG(HIB_LOCK) = 0;
2009 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_TPCTL_TPEN
Definition: hw_hibernate.h:350
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
#define HIB_TPCTL
Definition: hw_hibernate.h:69
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateTamperEnable ( void  )

Enables the tamper feature.

This function is used to enable the tamper feature functionality. This function should only be called after the global configuration is set with a call to HibernateTamperEventsConfig() and the tamper inputs have been configured with a call to HibernateTamperIOEnable().

Note
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
None.

Definition at line 1944 of file hibernate.c.

References _HibernateWriteComplete(), HIB_LOCK, HIB_LOCK_HIBLOCK_KEY, HIB_TPCTL, HIB_TPCTL_TPEN, and HWREG.

1945 {
1946  //
1947  // Unlock the tamper registers.
1948  //
1951 
1952  //
1953  // Set the tamper enable bit.
1954  //
1956 
1957  //
1958  // Wait for write completion.
1959  //
1961 
1962  //
1963  // Lock the tamper registers.
1964  //
1965  HWREG(HIB_LOCK) = 0;
1967 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_TPCTL_TPEN
Definition: hw_hibernate.h:350
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
#define HIB_TPCTL
Definition: hw_hibernate.h:69
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateTamperEventsClear ( void  )

Clears the tamper feature events.

This function is used to clear all tamper events. This function always clears the tamper feature event state indicator along with all tamper log entries. Logged event data should be retrieved with HibernateTamperEventsGet() prior to requesting a event clear.

HibernateTamperEventsClear() should be called prior to clearing the system control NMI that resulted from the tamper event.

Note
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
None.

Definition at line 2167 of file hibernate.c.

References _HibernateWriteComplete(), HIB_LOCK, HIB_LOCK_HIBLOCK_KEY, HIB_TPCTL, HIB_TPCTL_TPCLR, and HWREG.

2168 {
2169  //
2170  // Unlock the tamper registers.
2171  //
2174 
2175  //
2176  // Set the tamper event clear bit.
2177  //
2179 
2180  //
2181  // Wait for write completion.
2182  //
2184 
2185  //
2186  // Lock the tamper registers.
2187  //
2188  HWREG(HIB_LOCK) = 0;
2190 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
#define HIB_TPCTL
Definition: hw_hibernate.h:69
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107
#define HIB_TPCTL_TPCLR
Definition: hw_hibernate.h:349

Here is the call graph for this function:

void HibernateTamperEventsClearNoLock ( void  )

Clears the tamper feature events without Unlock and Lock.

This function is used to clear all tamper events without unlock/locking the tamper control registers, so API HibernateTamperUnLock() should be called before this function, and API HibernateTamperLock() should be called after to ensure that tamper control registers are locked.

This function doesn't block until the write is complete. Therefore, care must be taken to ensure the next immediate write will occure only after the write complete bit is set.

This function is used to implement a software workaround in NMI interrupt handler to fix an issue when a new tamper event could be missed during the clear of current tamper event.

Note
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
None.

Definition at line 2217 of file hibernate.c.

References _HibernateWriteComplete(), HIB_TPCTL, HIB_TPCTL_TPCLR, and HWREG.

2218 {
2219  //
2220  // Wait for write completion.
2221  //
2223 
2224  //
2225  // Set the tamper event clear bit.
2226  //
2228 
2229 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_TPCTL
Definition: hw_hibernate.h:69
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107
#define HIB_TPCTL_TPCLR
Definition: hw_hibernate.h:349

Here is the call graph for this function:

void HibernateTamperEventsConfig ( uint32_t  ui32Config)

Configures the tamper feature event response.

Parameters
ui32Configspecifies the configuration options for tamper events.

This function is used to configure the event response options for the tamper feature. The ui32Config parameter provides a combination of the HIBERNATE_TAMPER_EVENTS_* features to set these options. The application should choose from the following set of defines to determine what happens to the system when a tamper event occurs:

  • HIBERNATE_TAMPER_EVENTS_ERASE_ALL_HIB_MEM all of the Hibernation module's battery-backed RAM is cleared due to a tamper event
  • HIBERNATE_TAMPER_EVENTS_ERASE_HIGH_HIB_MEM the upper half of the Hibernation module's battery-backed RAM is cleared due to a tamper event
  • HIBERNATE_TAMPER_EVENTS_ERASE_LOW_HIB_MEM the lower half of the Hibernation module's battery-backed RAM is cleared due to a tamper event
  • HIBERNATE_TAMPER_EVENTS_ERASE_NO_HIB_MEM the Hibernation module's battery-backed RAM is not changed due to a tamper event
  • HIBERNATE_TAMPER_EVENTS_HIB_WAKE a tamper event wakes the MCU from hibernation
  • HIBERNATE_TAMPER_EVENTS_NO_HIB_WAKE a tamper event does not wake the MCU from hibernation
Note
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
None.

Definition at line 1895 of file hibernate.c.

References _HibernateWriteComplete(), HIB_LOCK, HIB_LOCK_HIBLOCK_KEY, HIB_TPCTL, HIB_TPCTL_MEMCLR_M, and HWREG.

1896 {
1897  uint32_t ui32Temp;
1898 
1899  //
1900  // Mask out the on-event configuration options.
1901  //
1902  ui32Temp = (HWREG(HIB_TPCTL) & ~HIB_TPCTL_MEMCLR_M);
1903 
1904  //
1905  // Unlock the tamper registers.
1906  //
1909 
1910  //
1911  // Set the on-event configuration.
1912  //
1913  HWREG(HIB_TPCTL) = (ui32Temp | ui32Config);
1914 
1915  //
1916  // Wait for write completion.
1917  //
1919 
1920  //
1921  // Lock the tamper registers.
1922  //
1923  HWREG(HIB_LOCK) = 0;
1925 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_TPCTL_MEMCLR_M
Definition: hw_hibernate.h:340
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
#define HIB_TPCTL
Definition: hw_hibernate.h:69
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

bool HibernateTamperEventsGet ( uint32_t  ui32Index,
uint32_t *  pui32RTC,
uint32_t *  pui32Event 
)

Returns a tamper log entry.

Parameters
ui32Indexis the index of the log entry to return.
pui32RTCis a pointer to the memory to store the logged RTC data.
pui32Eventis a pointer to the memory to store the logged tamper event.

This function is used to return a tamper log entry from the hibernate feature. The ui32Index specifies the zero-based index of the log entry to query and has a valid range of 0-3.

When this function returns, the pui32RTC value contains the time value and pui32Event parameter contains the tamper I/O event that triggered this log.

The format of the returned pui32RTC data is dependent on the configuration of the RTC within the Hibernation module. If the RTC is configured for counter mode, the returned data contains counted seconds from the RTC enable. If the RTC is configured for calendar mode, the data returned is formatted as follows:

//! +----------------------------------------------------------------------+
//! |  31:26  |  25:22  |     21:17      |  16:12  |   11:6    |    5:0    |
//! +----------------------------------------------------------------------+
//! |  year   |  month  |  day of month  |  hours  |  minutes  |  seconds  |
//! +----------------------------------------------------------------------+
//! 
The data returned in the \e pui32Events parameter could include any of the
following flags:

- \b HIBERNATE_TAMPER_EVENT_0 indicates a tamper event was triggered on I/O
signal 0
- \b HIBERNATE_TAMPER_EVENT_1 indicates a tamper event was triggered on I/O
signal 1
- \b HIBERNATE_TAMPER_EVENT_2 indicates a tamper event was triggered on I/O
signal 2
- \b HIBERNATE_TAMPER_EVENT_3 indicates a tamper event was triggered on I/O
signal 3
- \b HIBERNATE_TAMPER_EVENT_XOSC indicates an external oscillator failure
triggered the tamper event

\note Tamper event logs are not consumed when read and remain available
until cleared.  Events are only logged if unused log space is available.

\note The hibernate tamper feature is not available on all Tiva
devices.  Please consult the data sheet for the Tiva device that you
are using to determine if this feature is available.

\return Returns \b true if the \e pui32RTC and \e pui32Events were updated
successfully and returns \b false if the values were not updated.  

Definition at line 2416 of file hibernate.c.

References ASSERT, HIB_CAL0, HIB_CAL0_AMPM, HIB_CALCTL, HIB_CALCTL_CAL24, HIB_CALCTL_CALEN, HIB_TPLOG0, and HWREG.

2418 {
2419  uint32_t ui32Reg;
2420 
2421  //
2422  // Verify parameters.
2423  //
2424  ASSERT(pui32RTC);
2425  ASSERT(pui32Event);
2426  ASSERT(ui32Index < 4);
2427 
2428  //
2429  // Retrieve the event log data for the requested index if available.
2430  //
2431  ui32Reg = HWREG(HIB_TPLOG0 + ((ui32Index << 3) + 4));
2432  if(ui32Reg == 0)
2433  {
2434  //
2435  // No event data is available for this index.
2436  //
2437  return(false);
2438  }
2439 
2440  //
2441  // Store the event data in the provided location.
2442  //
2443  *pui32Event = ui32Reg;
2444 
2445  //
2446  // Retrieve the calendar information.
2447  //
2448  *pui32RTC = HWREG(HIB_TPLOG0 + (ui32Index << 3));
2449 
2450  //
2451  // Convert the hour to 24hr mode if the Calendar is enabled
2452  // and in 24hr mode.
2453  //
2456  {
2458  {
2459  //
2460  // Add 12 hour since it is PM
2461  //
2462  ui32Reg = ((*pui32RTC & 0X0001f000) + (12<<12)) & 0X0001f000;
2463  *pui32RTC &= ~0X0001f000;
2464  *pui32RTC |= ui32Reg;
2465  }
2466  }
2467 
2468  //
2469  // Return success.
2470  //
2471  return(true);
2472 }
#define HIB_CAL0
Definition: hw_hibernate.h:62
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_CAL0_AMPM
Definition: hw_hibernate.h:253
#define HIB_CALCTL_CAL24
Definition: hw_hibernate.h:244
#define HIB_CALCTL_CALEN
Definition: hw_hibernate.h:245
#define HIB_CALCTL
Definition: hw_hibernate.h:61
#define HIB_TPLOG0
Definition: hw_hibernate.h:72
void HibernateTamperExtOscRecover ( void  )

Attempts to recover the external oscillator.

This function is used to attempt to recover the external oscillator after a HIBERNATE_TAMPER_STATUS_EXT_OSC_FAILED status is reported. This function must not be called if the external oscillator is not used as the hibernation clock input. HibernateTamperExtOscValid() should be called before calling this function.

Note
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
None.

Definition at line 2492 of file hibernate.c.

References _HibernateWriteComplete(), HIB_LOCK, HIB_LOCK_HIBLOCK_KEY, HIB_TPSTAT, HIB_TPSTAT_XOSCFAIL, and HWREG.

2493 {
2494  //
2495  // Unlock the tamper registers.
2496  //
2499 
2500  //
2501  // Set the XOSCFAIL clear bit.
2502  //
2504 
2505  //
2506  // Wait for write completion.
2507  //
2509 
2510  //
2511  // Lock the tamper registers.
2512  //
2513  HWREG(HIB_LOCK) = 0;
2515 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_TPSTAT
Definition: hw_hibernate.h:70
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_TPSTAT_XOSCFAIL
Definition: hw_hibernate.h:364
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

bool HibernateTamperExtOscValid ( void  )

Reports if the external oscillator signal is active and stable.

This function should be used to verify the external oscillator is active and valid before attempting to recover from a HIBERNATE_TAMPER_STATUS_EXT_OSC_FAILED status by calling HibernateTamperExtOscRecover().

Note
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
Returns true if the external oscillator is both active and stable, otherwise a false indicator is returned.

Definition at line 2535 of file hibernate.c.

References HIBERNATE_TAMPER_STATUS_EXT_OSC_ACTIVE, HIBERNATE_TAMPER_STATUS_EXT_OSC_VALID, and HibernateTamperStatusGet().

2536 {
2539  {
2540  return(true);
2541  }
2542 
2543  return(false);
2544 }
#define HIBERNATE_TAMPER_STATUS_EXT_OSC_ACTIVE
Definition: hibernate.h:147
uint32_t HibernateTamperStatusGet(void)
Definition: hibernate.c:2321
#define HIBERNATE_TAMPER_STATUS_EXT_OSC_VALID
Definition: hibernate.h:151

Here is the call graph for this function:

void HibernateTamperIODisable ( uint32_t  ui32Input)

Disables an input to the tamper feature.

Parameters
ui32Inputis the tamper input to disable.

This function is used to disable an input to the tamper feature. The ui32Input parameter specifies the tamper signal to disable and has a valid range of 0-3.

Note
None of the GPIO API functions are needed to configure the tamper pins. The tamper pins configured by using this function overrides any configuration by GPIO APIs.
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
None.

Definition at line 2117 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_LOCK, HIB_LOCK_HIBLOCK_KEY, HIB_TPIO, HIB_TPIO_EN0, and HWREG.

2118 {
2119  //
2120  // Verify parameters.
2121  //
2122  ASSERT(ui32Input < 4);
2123 
2124  //
2125  // Unlock the tamper registers.
2126  //
2129 
2130  //
2131  // Clear the I/O enable bit.
2132  //
2133  HWREG(HIB_TPIO) &= ((~HIB_TPIO_EN0) << (ui32Input << 3));
2134 
2135  //
2136  // Wait for write completion.
2137  //
2139 
2140  //
2141  // Lock the tamper registers.
2142  //
2143  HWREG(HIB_LOCK) = 0;
2145 }
#define HWREG(x)
Definition: hw_types.h:48
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_TPIO
Definition: hw_hibernate.h:71
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
#define HIB_TPIO_EN0
Definition: hw_hibernate.h:390
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateTamperIOEnable ( uint32_t  ui32Input,
uint32_t  ui32Config 
)

Configures an input to the tamper feature.

Parameters
ui32Inputis the tamper input to configure.
ui32Configholds the configuration options for a given input to the tamper feature.

This function is used to configure an input to the tamper feature. The ui32Input parameter specifies the tamper signal to configure and has a valid range of 0-3. The ui32Config parameter provides the set of tamper features in the HIBERNATE_TAMPER_IO_* values. The values that are valid in the ui32Config parameter are:

  • HIBERNATE_TAMPER_IO_MATCH_SHORT configures the trigger to match after 2 hibernation clocks
  • HIBERNATE_TAMPER_IO_MATCH_LONG configures the trigger to match after 3071 hibernation clocks
  • HIBERNATE_TAMPER_IO_WPU_ENABLED turns on an internal weak pull up
  • HIBERNATE_TAMPER_IO_WPU_DISABLED turns off an internal weak pull up
  • HIBERNATE_TAMPER_IO_TRIGGER_HIGH sets the tamper event to active high
  • HIBERNATE_TAMPER_IO_TRIGGER_LOW sets the tamper event to active low
Note
None of the GPIO API functions are needed to configure the tamper pins. The tamper pins configured by using this function overrides any configuration by GPIO APIs.
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
None.

Definition at line 2046 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_LOCK, HIB_LOCK_HIBLOCK_KEY, HIB_TPIO, HIB_TPIO_EN0, HIB_TPIO_GFLTR0, HIB_TPIO_LEV0, HIB_TPIO_PUEN0, and HWREG.

2047 {
2048  uint32_t ui32Temp, ui32Mask;
2049 
2050  //
2051  // Verify parameters.
2052  //
2053  ASSERT(ui32Input < 4);
2054 
2055  //
2056  // Read the current tamper I/O configuration.
2057  //
2058  ui32Temp = HWREG(HIB_TPIO);
2059 
2060  //
2061  // Mask out configuration options for the requested input.
2062  //
2063  ui32Mask = (ui32Temp & (~((HIB_TPIO_GFLTR0 | HIB_TPIO_PUEN0 |
2065  (ui32Input << 3))));
2066 
2067  //
2068  // Set tamper I/O configuration for the requested input.
2069  //
2070  ui32Temp |= (ui32Mask | ((ui32Config | HIB_TPIO_EN0) << (ui32Input << 3)));
2071 
2072  //
2073  // Unlock the tamper registers.
2074  //
2077 
2078  //
2079  // Write to the register.
2080  //
2081  HWREG(HIB_TPIO) = ui32Temp;
2082 
2083  //
2084  // Wait for write completion.
2085  //
2087 
2088  //
2089  // Lock the tamper registers.
2090  //
2091  HWREG(HIB_LOCK) = 0;
2093 }
#define HIB_TPIO_LEV0
Definition: hw_hibernate.h:389
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_TPIO_PUEN0
Definition: hw_hibernate.h:387
#define ASSERT(expr)
Definition: debug.h:67
#define HIB_TPIO_GFLTR0
Definition: hw_hibernate.h:386
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_TPIO
Definition: hw_hibernate.h:71
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
#define HIB_TPIO_EN0
Definition: hw_hibernate.h:390
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

void HibernateTamperLock ( void  )

Lock temper registers.

This function is used to lock the temper control registers. This function should be used after calling API HibernateTamperEventsClearNoLock().

Note
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
None.

Definition at line 2272 of file hibernate.c.

References _HibernateWriteComplete(), HIB_LOCK, and HWREG.

2273 {
2274  //
2275  // Wait for write completion.
2276  //
2278 
2279  //
2280  // Lock the tamper registers.
2281  //
2282  HWREG(HIB_LOCK) = 0;
2284 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_LOCK
Definition: hw_hibernate.h:68
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

uint32_t HibernateTamperStatusGet ( void  )

Returns the current tamper feature status.

This function is used to return the tamper feature status. This function returns one of the values from this group of options:

  • HIBERNATE_TAMPER_STATUS_INACTIVE indicates tamper detection is disabled
  • HIBERNATE_TAMPER_STATUS_ACTIVE indicates tamper detection is enabled and ready
  • HIBERNATE_TAMPER_STATUS_EVENT indicates tamper event was detected

In addition, one of the values is included from this group:

  • HIBERNATE_TAMPER_STATUS_EXT_OSC_INACTIVE indicates the external oscillator is not active
  • HIBERNATE_TAMPER_STATUS_EXT_OSC_ACTIVE indicates the external oscillator is active

And one of the values is included from this group:

  • HIBERNATE_TAMPER_STATUS_EXT_OSC_FAILED indicates the external oscillator signal has transitioned from valid to invalid
  • HIBERNATE_TAMPER_STATUS_EXT_OSC_VALID indicates the external oscillator is providing a valid signal
Note
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
Returns a combination of the HIBERNATE_TAMPER_STATUS_* values.

Definition at line 2321 of file hibernate.c.

References HIB_TPSTAT, HIB_TPSTAT_STATE_M, HIB_TPSTAT_XOSCFAIL, HIB_TPSTAT_XOSCST, HIBERNATE_TAMPER_STATUS_EXT_OSC_ACTIVE, HIBERNATE_TAMPER_STATUS_EXT_OSC_VALID, HIBERNATE_TAMPER_STATUS_INACTIVE, and HWREG.

Referenced by HibernateTamperExtOscValid().

2322 {
2323  uint32_t ui32Status, ui32Reg;
2324 
2325  //
2326  // Retrieve the raw register value.
2327  //
2328  ui32Reg = HWREG(HIB_TPSTAT);
2329 
2330  //
2331  // Setup the oscillator status indicators.
2332  //
2333  ui32Status = (ui32Reg & (HIB_TPSTAT_XOSCST | HIB_TPSTAT_XOSCFAIL));
2334  ui32Status |= ((ui32Reg & HIB_TPSTAT_XOSCST) ? 0 :
2336  ui32Status |= ((ui32Reg & HIB_TPSTAT_XOSCFAIL) ? 0 :
2338 
2339  //
2340  // Retrieve the tamper status indicators.
2341  //
2342  ui32Status |= ((ui32Reg & HIB_TPSTAT_STATE_M) << 3);
2343 
2344  //
2345  // The HW shows "disabled" with a zero value, use bit[0] as a flag
2346  // for this purpose.
2347  //
2348  if((ui32Reg & HIB_TPSTAT_STATE_M) == 0)
2349  {
2350  ui32Status |= HIBERNATE_TAMPER_STATUS_INACTIVE;
2351  }
2352 
2353  //
2354  // Return the API status flags.
2355  //
2356  return(ui32Status);
2357 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_TPSTAT
Definition: hw_hibernate.h:70
#define HIB_TPSTAT_XOSCST
Definition: hw_hibernate.h:363
#define HIBERNATE_TAMPER_STATUS_INACTIVE
Definition: hibernate.h:141
#define HIBERNATE_TAMPER_STATUS_EXT_OSC_ACTIVE
Definition: hibernate.h:147
#define HIB_TPSTAT_XOSCFAIL
Definition: hw_hibernate.h:364
#define HIB_TPSTAT_STATE_M
Definition: hw_hibernate.h:357
#define HIBERNATE_TAMPER_STATUS_EXT_OSC_VALID
Definition: hibernate.h:151

Here is the caller graph for this function:

void HibernateTamperUnLock ( void  )

Unlock temper registers.

This function is used to unlock the temper control registers. This function should be only used before calling API HibernateTamperEventsClearNoLock().

Note
The hibernate tamper feature is not available on all Tiva devices. Please consult the data sheet for the Tiva device that you are using to determine if this feature is available.
Returns
None.

Definition at line 2247 of file hibernate.c.

References _HibernateWriteComplete(), HIB_LOCK, HIB_LOCK_HIBLOCK_KEY, and HWREG.

2248 {
2249  //
2250  // Unlock the tamper registers.
2251  //
2254 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function:

uint32_t HibernateWakeGet ( void  )

Gets the currently configured wake conditions for the Hibernation module.

This function returns the flags representing the wake configuration for the Hibernation module. The return value is a combination of the following flags:

  • HIBERNATE_WAKE_PIN - wake when the external wake pin is asserted
  • HIBERNATE_WAKE_RTC - wake when the RTC matches occurs
  • HIBERNATE_WAKE_LOW_BAT - wake from hibernation due to a low-battery level being detected
  • HIBERNATE_WAKE_GPIO - wake when a GPIO pin is asserted
  • HIBERNATE_WAKE_RESET - wake when a reset pin is asserted
Note
The HIBERNATE_WAKE_LOW_BAT, HIBERNATE_WAKE_GPIO, and HIBERNATE_WAKE_RESET parameters are only available on some Tiva devices.
On some Tiva devices a tamper event acts as a wake source for the Hibernation module. Refer the function HibernateTamperEventsConfig() to wake from hibernation on a tamper event.
Returns
Returns flags indicating the configured wake conditions.

Definition at line 512 of file hibernate.c.

References HIB_CTL, HIB_IO, HIBERNATE_WAKE_GPIO, HIBERNATE_WAKE_IO, HIBERNATE_WAKE_LOW_BAT, HIBERNATE_WAKE_PIN, HIBERNATE_WAKE_RESET, HIBERNATE_WAKE_RTC, and HWREG.

513 {
514  uint32_t ui32Ctrl;
515 
516  //
517  // Read the wake bits from the control register and return those bits to
518  // the caller.
519  //
521  {
522  ui32Ctrl = HWREG(HIB_CTL);
523  return((ui32Ctrl & (HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC |
525  ((HWREG(HIB_IO) << 16) & (HIBERNATE_WAKE_RESET |
527  }
528  else
529  {
532  }
533 }
#define HWREG(x)
Definition: hw_types.h:48
#define HIBERNATE_WAKE_RTC
Definition: hibernate.h:60
#define HIB_IO
Definition: hw_hibernate.h:59
#define HIBERNATE_WAKE_RESET
Definition: hibernate.h:63
#define HIBERNATE_WAKE_GPIO
Definition: hibernate.h:62
#define HIBERNATE_WAKE_LOW_BAT
Definition: hibernate.h:61
#define HIBERNATE_WAKE_PIN
Definition: hibernate.h:59
#define HIBERNATE_WAKE_IO
Definition: hibernate.c:79
#define HIB_CTL
Definition: hw_hibernate.h:51
void HibernateWakeSet ( uint32_t  ui32WakeFlags)

Configures the wake conditions for the Hibernation module.

Parameters
ui32WakeFlagsspecifies which conditions should be used for waking.

This function enables the conditions under which the Hibernation module wakes. The ui32WakeFlags parameter is the logical OR of any combination of the following:

  • HIBERNATE_WAKE_PIN - wake when the external wake pin is asserted.
  • HIBERNATE_WAKE_RTC - wake when the RTC match occurs.
  • HIBERNATE_WAKE_LOW_BAT - wake from hibernate due to a low-battery level being detected.
  • HIBERNATE_WAKE_GPIO - wake when a GPIO pin is asserted.
  • HIBERNATE_WAKE_RESET - wake when a reset pin is asserted.

If the HIBERNATE_WAKE_GPIO flag is set, then one of the GPIO configuration functions GPIOPinTypeWakeHigh() or GPIOPinTypeWakeLow() must be called to properly configure and enable a GPIO as a wake source for hibernation.

Note
The HIBERNATE_WAKE_GPIO and HIBERNATE_WAKE_RESET parameters are only available on some Tiva devices.
On some Tiva devices a tamper event acts as a wake source for the Hibernation module. Refer the function HibernateTamperEventsConfig() to wake from hibernation on a tamper event.
Returns
None.

Definition at line 420 of file hibernate.c.

References _HibernateWriteComplete(), ASSERT, HIB_CTL, HIB_CTL_VDD3ON, HIB_IO, HIB_IO_IOWRC, HIB_IO_WUUNLK, HIBERNATE_WAKE_GPIO, HIBERNATE_WAKE_IO, HIBERNATE_WAKE_LOW_BAT, HIBERNATE_WAKE_PIN, HIBERNATE_WAKE_RESET, HIBERNATE_WAKE_RTC, and HWREG.

421 {
422  //
423  // Check the arguments.
424  //
425  ASSERT(!(ui32WakeFlags & ~(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC |
428 
429  //
430  // Set the specified wake flags in the control register.
431  //
432  HWREG(HIB_CTL) = (ui32WakeFlags | (HWREG(HIB_CTL) &
436 
437  //
438  // Wait for write completion
439  //
441 
442  //
443  // Write the hibernate IO register if requested.
444  //
446  {
447  //
448  // If the reset or GPIOs are begin used as a wake source then the
449  // the VDD3ON needs to be set to allow the pads to remained
450  // powered.
451  //
452  if((ui32WakeFlags & (HIBERNATE_WAKE_RESET | HIBERNATE_WAKE_GPIO)) &&
453  ((HWREG(HIB_CTL) & HIB_CTL_VDD3ON) == 0))
454  {
455  //
456  // Make sure that VDD3ON mode is enabled so that the pads can
457  // retain their state.
458  //
460 
461  //
462  // Wait for write completion
463  //
465  }
466 
467  //
468  // Set the requested flags.
469  //
470  HWREG(HIB_IO) = (ui32WakeFlags >> 16) | HIB_IO_WUUNLK;
471 
472  //
473  // Spin until the write complete bit is set.
474  //
475  while((HWREG(HIB_IO) & HIB_IO_IOWRC) == 0)
476  {
477  }
478 
479  //
480  // Clear the write unlock bit.
481  //
483  }
484 }
#define HIB_IO_WUUNLK
Definition: hw_hibernate.h:228
#define HWREG(x)
Definition: hw_types.h:48
#define HIBERNATE_WAKE_RTC
Definition: hibernate.h:60
#define HIB_IO
Definition: hw_hibernate.h:59
#define ASSERT(expr)
Definition: debug.h:67
#define HIBERNATE_WAKE_RESET
Definition: hibernate.h:63
#define HIBERNATE_WAKE_GPIO
Definition: hibernate.h:62
#define HIBERNATE_WAKE_LOW_BAT
Definition: hibernate.h:61
#define HIBERNATE_WAKE_PIN
Definition: hibernate.h:59
#define HIB_IO_IOWRC
Definition: hw_hibernate.h:226
#define HIB_CTL_VDD3ON
Definition: hw_hibernate.h:126
#define HIBERNATE_WAKE_IO
Definition: hibernate.c:79
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107

Here is the call graph for this function: