EE445M RTOS
Taken at the University of Texas Spring 2015
hibernate.c
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // hibernate.c - Driver for the Hibernation module
4 //
5 // Copyright (c) 2007-2014 Texas Instruments Incorporated. All rights reserved.
6 // Software License Agreement
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
12 // Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright
16 // notice, this list of conditions and the following disclaimer in the
17 // documentation and/or other materials provided with the
18 // distribution.
19 //
20 // Neither the name of Texas Instruments Incorporated nor the names of
21 // its contributors may be used to endorse or promote products derived
22 // from this software without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 //
36 // This is part of revision 2.1.0.12573 of the Tiva Peripheral Driver Library.
37 //
38 //*****************************************************************************
39 
40 //*****************************************************************************
41 //
44 //
45 //*****************************************************************************
46 
47 #include <stdbool.h>
48 #include <stdint.h>
49 #include <time.h>
50 #include "inc/hw_hibernate.h"
51 #include "inc/hw_ints.h"
52 #include "inc/hw_sysctl.h"
53 #include "inc/hw_types.h"
54 #include "driverlib/debug.h"
55 #include "driverlib/hibernate.h"
56 #include "driverlib/interrupt.h"
57 #include "driverlib/sysctl.h"
58 
59 //*****************************************************************************
60 //
61 // The delay in microseconds for writing to the Hibernation module registers.
62 //
63 //*****************************************************************************
64 #define DELAY_USECS 95
65 
66 //*****************************************************************************
67 //
68 // The number of processor cycles to execute one pass of the delay loop.
69 //
70 //*****************************************************************************
71 #define LOOP_CYCLES 3
72 
73 //*****************************************************************************
74 //
75 // A macro used to determine whether the target part supports Wake from IO
76 // pins.
77 //
78 //*****************************************************************************
79 #define HIBERNATE_WAKE_IO CLASS_IS_TM4C129
80 
81 //*****************************************************************************
82 //
83 // A macro used to determine whether the target part supports Wake from IO
84 // pins.
85 //
86 //*****************************************************************************
87 #define HIBERNATE_CLOCK_OUTPUT CLASS_IS_TM4C129
88 
89 //*****************************************************************************
90 //
104 //
105 //*****************************************************************************
106 static void
108 {
109  //
110  // Spin until the write complete bit is set.
111  //
112  while(!(HWREG(HIB_CTL) & HIB_CTL_WRC))
113  {
114  }
115 }
116 
117 //*****************************************************************************
118 //
133 //
134 //*****************************************************************************
135 void
136 HibernateEnableExpClk(uint32_t ui32HibClk)
137 {
138  //
139  // Turn on the clock enable bit.
140  //
142 
143  //
144  // Wait for write complete following register load (above).
145  //
147 }
148 
149 //*****************************************************************************
150 //
157 //
158 //*****************************************************************************
159 void
161 {
162  //
163  // Turn off the clock enable bit.
164  //
166 
167  //
168  // Wait for write completion
169  //
171 }
172 
173 //*****************************************************************************
174 //
222 //
223 //*****************************************************************************
224 void
225 HibernateClockConfig(uint32_t ui32Config)
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 }
277 
278 //*****************************************************************************
279 //
288 //
289 //*****************************************************************************
290 void
292 {
293  //
294  // Turn on the RTC enable bit.
295  //
297 
298  //
299  // Wait for write completion
300  //
302 }
303 
304 //*****************************************************************************
305 //
313 //
314 //*****************************************************************************
315 void
317 {
318  //
319  // Turn off the RTC enable bit.
320  //
322 
323  //
324  // Wait for write completion
325  //
327 }
328 
329 //*****************************************************************************
330 //
346 //
347 //*****************************************************************************
348 void
350 {
351  //
352  // Initiated a forced battery check.
353  //
355 
356  //
357  // Wait for write completion
358  //
360 }
361 
362 //*****************************************************************************
363 //
376 //
377 //*****************************************************************************
378 uint32_t
380 {
381  //
382  // Read the current state of the battery check.
383  //
384  return(HWREG(HIB_CTL) & HIB_CTL_BATCHK);
385 }
386 
387 //*****************************************************************************
388 //
417 //
418 //*****************************************************************************
419 void
420 HibernateWakeSet(uint32_t ui32WakeFlags)
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 }
485 
486 //*****************************************************************************
487 //
509 //
510 //*****************************************************************************
511 uint32_t
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 }
534 
535 //*****************************************************************************
536 //
568 //
569 //*****************************************************************************
570 void
571 HibernateLowBatSet(uint32_t ui32LowBatFlags)
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 }
592 
593 //*****************************************************************************
594 //
604 //
605 //*****************************************************************************
606 uint32_t
608 {
609  //
610  // Read the supported low bat bits from the control register and return
611  // those bits to the caller.
612  //
614 }
615 
616 //*****************************************************************************
617 //
627 //
628 //*****************************************************************************
629 void
630 HibernateRTCSet(uint32_t ui32RTCValue)
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 }
654 
655 //*****************************************************************************
656 //
662 //
663 //*****************************************************************************
664 uint32_t
666 {
667  //
668  // Return the value of the RTC counter register to the caller.
669  //
670  return(HWREG(HIB_RTCC));
671 }
672 
673 //*****************************************************************************
674 //
686 //
687 //*****************************************************************************
688 void
689 HibernateRTCMatchSet(uint32_t ui32Match, uint32_t ui32Value)
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 }
703 
704 //*****************************************************************************
705 //
715 //
716 //*****************************************************************************
717 uint32_t
718 HibernateRTCMatchGet(uint32_t ui32Match)
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 }
727 
728 //*****************************************************************************
729 //
743 //
744 //*****************************************************************************
745 void
746 HibernateRTCSSMatchSet(uint32_t ui32Match, uint32_t ui32Value)
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 }
760 
761 //*****************************************************************************
762 //
773 //
774 //*****************************************************************************
775 uint32_t
776 HibernateRTCSSMatchGet(uint32_t ui32Match)
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 }
785 
786 //*****************************************************************************
787 //
796 //
797 //*****************************************************************************
798 uint32_t
800 {
801  //
802  // Read the current second RTC count.
803  //
805 }
806 
807 //*****************************************************************************
808 //
823 //
824 //*****************************************************************************
825 void
826 HibernateRTCTrimSet(uint32_t ui32Trim)
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 }
843 
844 //*****************************************************************************
845 //
853 //
854 //*****************************************************************************
855 uint32_t
857 {
858  //
859  // Return the value of the trim register to the caller.
860  //
861  return(HWREG(HIB_RTCT));
862 }
863 
864 //*****************************************************************************
865 //
880 //
881 //*****************************************************************************
882 void
883 HibernateDataSet(uint32_t *pui32Data, uint32_t ui32Count)
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 }
909 
910 //*****************************************************************************
911 //
926 //
927 //*****************************************************************************
928 void
929 HibernateDataGet(uint32_t *pui32Data, uint32_t ui32Count)
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 }
951 
952 //*****************************************************************************
953 //
985 //
986 //*****************************************************************************
987 void
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 }
1000 
1001 //*****************************************************************************
1002 //
1027 //
1028 //*****************************************************************************
1029 void
1030 HibernateIntEnable(uint32_t ui32IntFlags)
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 }
1052 
1053 //*****************************************************************************
1054 //
1066 //
1067 //*****************************************************************************
1068 void
1069 HibernateIntDisable(uint32_t ui32IntFlags)
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 }
1091 
1092 //*****************************************************************************
1093 //
1100 //
1101 //*****************************************************************************
1102 static uint32_t
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 }
1121 
1122 //*****************************************************************************
1123 //
1138 //
1139 //*****************************************************************************
1140 void
1141 HibernateIntRegister(void (*pfnHandler)(void))
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 }
1162 
1163 //*****************************************************************************
1164 //
1175 //
1176 //*****************************************************************************
1177 void
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 }
1199 
1200 //*****************************************************************************
1201 //
1217 //
1218 //*****************************************************************************
1219 uint32_t
1220 HibernateIntStatus(bool bMasked)
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 }
1234 
1235 //*****************************************************************************
1236 //
1258 //
1259 //*****************************************************************************
1260 void
1261 HibernateIntClear(uint32_t ui32IntFlags)
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 }
1283 
1284 //*****************************************************************************
1285 //
1303 //
1304 //*****************************************************************************
1305 uint32_t
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 }
1313 
1314 //*****************************************************************************
1315 //
1331 //
1332 //*****************************************************************************
1333 void
1335 {
1336  //
1337  // Enable power to the pads and enable GPIO retention during hibernate.
1338  //
1340 
1341  //
1342  // Wait for write completion
1343  //
1345 }
1346 
1347 //*****************************************************************************
1348 //
1362 //
1363 //*****************************************************************************
1364 void
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 }
1378 
1379 //*****************************************************************************
1380 //
1392 //
1393 //*****************************************************************************
1394 bool
1396 {
1397  //
1398  // Read the current GPIO retention configuration.
1399  //
1402  {
1403  return(true);
1404  }
1405  return(false);
1406 }
1407 
1408 //*****************************************************************************
1409 //
1443 //
1444 //*****************************************************************************
1445 void
1446 HibernateCounterMode(uint32_t ui32Config)
1447 {
1448  //
1449  // Set the requested configuration.
1450  //
1451  HWREG(HIB_CALCTL) = ui32Config;
1452 
1453  //
1454  // Wait for write completion
1455  //
1457 }
1458 
1459 //*****************************************************************************
1460 //
1461 // Internal function to parse the time structure to set the calendar fields.
1462 //
1463 //*****************************************************************************
1464 static void
1465 _HibernateCalendarSet(uint32_t ui32Reg, struct tm *psTime)
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 }
1601 
1602 //*****************************************************************************
1603 //
1621 //
1622 //*****************************************************************************
1623 void
1624 HibernateCalendarSet(struct tm *psTime)
1625 {
1626  //
1627  // Load a new date/time.
1628  //
1630 }
1631 
1632 //*****************************************************************************
1633 //
1658 //
1659 //*****************************************************************************
1660 int
1661 HibernateCalendarGet(struct tm *psTime)
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 }
1721 
1722 //*****************************************************************************
1723 //
1747 //
1748 //*****************************************************************************
1749 void
1750 HibernateCalendarMatchSet(uint32_t ui32Index, struct tm *psTime)
1751 {
1752  //
1753  // Set the Match value.
1754  //
1756 }
1757 
1758 //*****************************************************************************
1759 //
1782 //
1783 //*****************************************************************************
1784 void
1785 HibernateCalendarMatchGet(uint32_t ui32Index, struct tm *psTime)
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 }
1861 
1862 //*****************************************************************************
1863 //
1892 //
1893 //*****************************************************************************
1894 void
1895 HibernateTamperEventsConfig(uint32_t ui32Config)
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 }
1926 
1927 //*****************************************************************************
1928 //
1941 //
1942 //*****************************************************************************
1943 void
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 }
1968 
1969 //*****************************************************************************
1970 //
1983 //
1984 //*****************************************************************************
1985 void
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 }
2010 
2011 //*****************************************************************************
2012 //
2043 //
2044 //*****************************************************************************
2045 void
2046 HibernateTamperIOEnable(uint32_t ui32Input, uint32_t ui32Config)
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 }
2094 
2095 //*****************************************************************************
2096 //
2114 //
2115 //*****************************************************************************
2116 void
2117 HibernateTamperIODisable(uint32_t ui32Input)
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 }
2146 
2147 //*****************************************************************************
2148 //
2164 //
2165 //*****************************************************************************
2166 void
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 }
2191 
2192 //*****************************************************************************
2193 //
2214 //
2215 //*****************************************************************************
2216 void
2218 {
2219  //
2220  // Wait for write completion.
2221  //
2223 
2224  //
2225  // Set the tamper event clear bit.
2226  //
2228 
2229 }
2230 
2231 //*****************************************************************************
2232 //
2244 //
2245 //*****************************************************************************
2246 void
2248 {
2249  //
2250  // Unlock the tamper registers.
2251  //
2254 }
2255 
2256 //*****************************************************************************
2257 //
2269 //
2270 //*****************************************************************************
2271 void
2273 {
2274  //
2275  // Wait for write completion.
2276  //
2278 
2279  //
2280  // Lock the tamper registers.
2281  //
2282  HWREG(HIB_LOCK) = 0;
2284 }
2285 
2286 //*****************************************************************************
2287 //
2318 //
2319 //*****************************************************************************
2320 uint32_t
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 }
2358 
2359 //*****************************************************************************
2360 //
2413 //
2414 //*****************************************************************************
2415 bool
2416 HibernateTamperEventsGet(uint32_t ui32Index, uint32_t *pui32RTC,
2417  uint32_t *pui32Event)
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 }
2473 
2474 //*****************************************************************************
2475 //
2489 //
2490 //*****************************************************************************
2491 void
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 }
2516 
2517 //*****************************************************************************
2518 //
2532 //
2533 //*****************************************************************************
2534 bool
2536 {
2539  {
2540  return(true);
2541  }
2542 
2543  return(false);
2544 }
2545 
2546 //*****************************************************************************
2547 //
2548 // Close the Doxygen group.
2550 //
2551 //*****************************************************************************
#define HIB_CAL1_DOM_M
Definition: hw_hibernate.h:270
#define HIB_CAL1
Definition: hw_hibernate.h:63
uint32_t HibernateWakeGet(void)
Definition: hibernate.c:512
#define HIB_CAL0
Definition: hw_hibernate.h:62
#define HIBERNATE_INT_WR_COMPLETE
Definition: hibernate.h:88
#define HIB_DATA
Definition: hw_hibernate.h:60
#define HIB_CAL1_DOW_M
Definition: hw_hibernate.h:267
#define HIBERNATE_INT_RESET_WAKE
Definition: hibernate.h:85
void HibernateRTCDisable(void)
Definition: hibernate.c:316
#define HIB_TPIO_LEV0
Definition: hw_hibernate.h:389
#define HIB_CAL0_SEC_M
Definition: hw_hibernate.h:256
#define INT_HIBERNATE_TM4C129
Definition: hw_ints.h:217
#define HIB_CAL1_MON_S
Definition: hw_hibernate.h:273
#define HIB_CAL0_HR_S
Definition: hw_hibernate.h:257
#define HIB_IO_WUUNLK
Definition: hw_hibernate.h:228
uint32_t HibernateIsActive(void)
Definition: hibernate.c:1306
#define HIB_CALLD0_MIN_S
Definition: hw_hibernate.h:286
#define HIB_CC
Definition: hw_hibernate.h:82
#define HWREG(x)
Definition: hw_types.h:48
void HibernateTamperUnLock(void)
Definition: hibernate.c:2247
#define HIB_TPSTAT
Definition: hw_hibernate.h:70
void HibernateRTCSSMatchSet(uint32_t ui32Match, uint32_t ui32Value)
Definition: hibernate.c:746
#define HIB_CAL1_YEAR_M
Definition: hw_hibernate.h:268
void HibernateRequest(void)
Definition: hibernate.c:988
bool HibernateGPIORetentionGet(void)
Definition: hibernate.c:1395
#define HIBERNATE_WAKE_RTC
Definition: hibernate.h:60
#define HIB_IO
Definition: hw_hibernate.h:59
#define HIB_CALLD0_SEC_S
Definition: hw_hibernate.h:287
#define INT_HIBERNATE_TM4C123
Definition: hw_ints.h:106
#define HIB_CTL_RETCLR
Definition: hw_hibernate.h:114
void HibernateIntEnable(uint32_t ui32IntFlags)
Definition: hibernate.c:1030
void HibernateTamperEnable(void)
Definition: hibernate.c:1944
#define HIBERNATE_LOW_BAT_ABORT
Definition: hibernate.h:73
#define HIB_CAL1_DOM_S
Definition: hw_hibernate.h:274
#define HIB_TPIO_PUEN0
Definition: hw_hibernate.h:387
#define HIB_CAL0_HR_M
Definition: hw_hibernate.h:254
#define ASSERT(expr)
Definition: debug.h:67
void HibernateTamperEventsConfig(uint32_t ui32Config)
Definition: hibernate.c:1895
void HibernateIntDisable(uint32_t ui32IntFlags)
Definition: hibernate.c:1069
#define HIB_TPSTAT_XOSCST
Definition: hw_hibernate.h:363
void HibernateDataGet(uint32_t *pui32Data, uint32_t ui32Count)
Definition: hibernate.c:929
void HibernateCalendarMatchSet(uint32_t ui32Index, struct tm *psTime)
Definition: hibernate.c:1750
#define HIB_IM
Definition: hw_hibernate.h:52
uint32_t HibernateIntStatus(bool bMasked)
Definition: hibernate.c:1220
void HibernateTamperIODisable(uint32_t ui32Input)
Definition: hibernate.c:2117
uint32_t HibernateBatCheckDone(void)
Definition: hibernate.c:379
#define HIBERNATE_INT_GPIO_WAKE
Definition: hibernate.h:87
#define HIB_CALLD0_HR_S
Definition: hw_hibernate.h:285
void HibernateGPIORetentionDisable(void)
Definition: hibernate.c:1365
#define HIBERNATE_INT_PIN_WAKE
Definition: hibernate.h:90
#define HIBERNATE_TAMPER_STATUS_INACTIVE
Definition: hibernate.h:141
void HibernateClockConfig(uint32_t ui32Config)
Definition: hibernate.c:225
void HibernateDisable(void)
Definition: hibernate.c:160
#define HIB_TPIO_GFLTR0
Definition: hw_hibernate.h:386
#define HIB_CTL_HIBREQ
Definition: hw_hibernate.h:131
bool HibernateTamperEventsGet(uint32_t ui32Index, uint32_t *pui32RTC, uint32_t *pui32Event)
Definition: hibernate.c:2416
void HibernateRTCMatchSet(uint32_t ui32Match, uint32_t ui32Value)
Definition: hibernate.c:689
#define HIBERNATE_WAKE_RESET
Definition: hibernate.h:63
#define HIB_CAL0_AMPM
Definition: hw_hibernate.h:253
void HibernateIntUnregister(void)
Definition: hibernate.c:1178
void HibernateTamperEventsClearNoLock(void)
Definition: hibernate.c:2217
uint32_t HibernateRTCTrimGet(void)
Definition: hibernate.c:856
#define HIB_TPCTL_TPEN
Definition: hw_hibernate.h:350
#define HIB_CALLD0_MIN_M
Definition: hw_hibernate.h:283
void HibernateGPIORetentionEnable(void)
Definition: hibernate.c:1334
#define HIB_MIS
Definition: hw_hibernate.h:54
#define HIB_RTCM0
Definition: hw_hibernate.h:49
#define HIBERNATE_OSC_HIGHDRIVE
Definition: hibernate.h:103
#define HIB_CTL_RTCEN
Definition: hw_hibernate.h:132
#define HIB_RTCSS
Definition: hw_hibernate.h:58
#define HIB_TPCTL_MEMCLR_M
Definition: hw_hibernate.h:340
#define HIBERNATE_WAKE_GPIO
Definition: hibernate.h:62
#define HIB_LOCK
Definition: hw_hibernate.h:68
#define HIB_RTCSS_RTCSSM_S
Definition: hw_hibernate.h:218
void HibernateRTCEnable(void)
Definition: hibernate.c:291
void HibernateTamperDisable(void)
Definition: hibernate.c:1986
void HibernateTamperEventsClear(void)
Definition: hibernate.c:2167
#define HIBERNATE_TAMPER_STATUS_EXT_OSC_ACTIVE
Definition: hibernate.h:147
#define HIBERNATE_OSC_DISABLE
Definition: hibernate.h:104
uint32_t HibernateTamperStatusGet(void)
Definition: hibernate.c:2321
#define HIB_CAL0_VALID
Definition: hw_hibernate.h:252
uint32_t HibernateRTCSSGet(void)
Definition: hibernate.c:799
void HibernateLowBatSet(uint32_t ui32LowBatFlags)
Definition: hibernate.c:571
void HibernateDataSet(uint32_t *pui32Data, uint32_t ui32Count)
Definition: hibernate.c:883
#define HIB_CTL_VBATSEL_M
Definition: hw_hibernate.h:118
void HibernateWakeSet(uint32_t ui32WakeFlags)
Definition: hibernate.c:420
#define HIB_TPSTAT_XOSCFAIL
Definition: hw_hibernate.h:364
#define HIB_TPSTAT_STATE_M
Definition: hw_hibernate.h:357
#define HIB_CTL_CLK32EN
Definition: hw_hibernate.h:128
#define HIBERNATE_WAKE_LOW_BAT
Definition: hibernate.h:61
uint32_t HibernateRTCSSMatchGet(uint32_t ui32Match)
Definition: hibernate.c:776
#define HIB_CALCTL_CAL24
Definition: hw_hibernate.h:244
void HibernateCalendarSet(struct tm *psTime)
Definition: hibernate.c:1624
uint32_t HibernateRTCGet(void)
Definition: hibernate.c:665
#define HIB_TPIO
Definition: hw_hibernate.h:71
uint32_t HibernateRTCMatchGet(uint32_t ui32Match)
Definition: hibernate.c:718
#define HIBERNATE_WAKE_PIN
Definition: hibernate.h:59
uint32_t HibernateLowBatGet(void)
Definition: hibernate.c:607
#define HIBERNATE_OSC_LFIOSC
Definition: hibernate.h:101
void HibernateCalendarMatchGet(uint32_t ui32Index, struct tm *psTime)
Definition: hibernate.c:1785
#define HIB_CALLD0
Definition: hw_hibernate.h:64
#define HIB_IC
Definition: hw_hibernate.h:56
#define HIB_LOCK_HIBLOCK_KEY
Definition: hw_hibernate.h:330
#define HIBERNATE_INT_LOW_BAT
Definition: hibernate.h:91
#define HIB_TPCTL
Definition: hw_hibernate.h:69
#define HIB_IO_IOWRC
Definition: hw_hibernate.h:226
void HibernateEnableExpClk(uint32_t ui32HibClk)
Definition: hibernate.c:136
void IntUnregister(uint32_t ui32Interrupt)
Definition: interrupt.c:381
void HibernateTamperExtOscRecover(void)
Definition: hibernate.c:2492
#define HIB_CAL1_VALID
Definition: hw_hibernate.h:266
static uint32_t _HibernateIntNumberGet(void)
Definition: hibernate.c:1103
#define HIB_CALCTL_CALEN
Definition: hw_hibernate.h:245
#define HIB_RTCSS_RTCSSC_M
Definition: hw_hibernate.h:217
#define HIB_CALM1
Definition: hw_hibernate.h:67
#define HIB_CAL1_MON_M
Definition: hw_hibernate.h:269
#define HIB_CALLD1
Definition: hw_hibernate.h:65
#define HIB_CTL_VDD3ON
Definition: hw_hibernate.h:126
#define HIB_CAL0_SEC_S
Definition: hw_hibernate.h:259
void HibernateBatCheckStart(void)
Definition: hibernate.c:349
void HibernateRTCTrimSet(uint32_t ui32Trim)
Definition: hibernate.c:826
#define HIBERNATE_OUT_ALT1CLK
Definition: hibernate.h:107
void HibernateIntRegister(void(*pfnHandler)(void))
Definition: hibernate.c:1141
#define HIBERNATE_CLOCK_OUTPUT
Definition: hibernate.c:87
#define HIB_RTCT
Definition: hw_hibernate.h:57
int HibernateCalendarGet(struct tm *psTime)
Definition: hibernate.c:1661
#define HIBERNATE_WAKE_IO
Definition: hibernate.c:79
void HibernateCounterMode(uint32_t ui32Config)
Definition: hibernate.c:1446
#define HIBERNATE_INT_VDDFAIL
Definition: hibernate.h:84
#define HIB_CTL
Definition: hw_hibernate.h:51
static void _HibernateCalendarSet(uint32_t ui32Reg, struct tm *psTime)
Definition: hibernate.c:1465
#define CLASS_IS_TM4C129
Definition: hw_types.h:99
#define HIB_RIS
Definition: hw_hibernate.h:53
#define HIBERNATE_INT_RTC_MATCH_0
Definition: hibernate.h:92
#define HIB_TPIO_EN0
Definition: hw_hibernate.h:390
#define HIBERNATE_TAMPER_STATUS_EXT_OSC_VALID
Definition: hibernate.h:151
#define HIB_RTCC
Definition: hw_hibernate.h:48
#define HIBERNATE_OSC_LOWDRIVE
Definition: hibernate.h:102
static void _HibernateWriteComplete(void)
Definition: hibernate.c:107
#define HIB_RTCLD
Definition: hw_hibernate.h:50
bool HibernateTamperExtOscValid(void)
Definition: hibernate.c:2535
#define HIB_TPCTL_TPCLR
Definition: hw_hibernate.h:349
#define HIB_CAL1_DOW_S
Definition: hw_hibernate.h:271
#define HIB_CTL_WRC
Definition: hw_hibernate.h:113
#define HIB_CALM0
Definition: hw_hibernate.h:66
#define HIB_CAL0_MIN_S
Definition: hw_hibernate.h:258
#define HIB_CALLD0_HR_M
Definition: hw_hibernate.h:282
#define HIBERNATE_OUT_SYSCLK
Definition: hibernate.h:106
void IntDisable(uint32_t ui32Interrupt)
Definition: interrupt.c:684
void HibernateTamperLock(void)
Definition: hibernate.c:2272
#define HIB_CAL0_MIN_M
Definition: hw_hibernate.h:255
#define HIB_CALCTL
Definition: hw_hibernate.h:61
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Definition: interrupt.c:309
void IntEnable(uint32_t ui32Interrupt)
Definition: interrupt.c:610
void HibernateTamperIOEnable(uint32_t ui32Input, uint32_t ui32Config)
Definition: hibernate.c:2046
#define HIB_CTL_BATCHK
Definition: hw_hibernate.h:124
#define HIB_CALLD0_SEC_M
Definition: hw_hibernate.h:284
void HibernateRTCSet(uint32_t ui32RTCValue)
Definition: hibernate.c:630
void HibernateIntClear(uint32_t ui32IntFlags)
Definition: hibernate.c:1261
#define HIB_CAL1_YEAR_S
Definition: hw_hibernate.h:272
#define HIB_TPLOG0
Definition: hw_hibernate.h:72