Revision 1ef74af5
core/inc/aos_confcheck.h | ||
---|---|---|
49 | 49 |
#error "AMIROOS_CFG_MAIN_LOOP_TIMEOUT not defined in aosconf.h" |
50 | 50 |
#endif |
51 | 51 |
|
52 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
53 |
|
|
52 | 54 |
/* |
53 | 55 |
* SSSP parameters and options |
54 | 56 |
*/ |
... | ... | |
80 | 82 |
#error "AMIROOS_CFG_SSSP_SYSSYNCPERIOD not defined in aosconf.h" |
81 | 83 |
#endif |
82 | 84 |
|
85 |
#endif |
|
83 | 86 |
/* |
84 | 87 |
* System shell options |
85 | 88 |
*/ |
core/inc/aos_system.h | ||
---|---|---|
63 | 63 |
*/ |
64 | 64 |
#define AOS_SYSTEM_EVENTFLAGS_RESTART (AOS_SYSTEM_EVENTFLAGS_SHUTDOWN | (eventflags_t)(1 << 4)) |
65 | 65 |
|
66 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
67 |
|
|
66 | 68 |
/** |
67 | 69 |
* @brief Major version of the implemented SSSP. |
68 | 70 |
*/ |
... | ... | |
79 | 81 |
*/ |
80 | 82 |
#define AOS_SYSTEM_SSSP_TIMEOUT (10 * AMIROOS_CFG_SSSP_SIGNALDELAY) |
81 | 83 |
|
84 |
#endif |
|
85 |
|
|
82 | 86 |
/** |
83 | 87 |
* @brief Enumerator to identify shutdown types. |
84 | 88 |
*/ |
... | ... | |
91 | 95 |
AOS_SHUTDOWN_RESTART, /**< Active saystem restart request. */ |
92 | 96 |
} aos_shutdown_t; |
93 | 97 |
|
98 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
99 |
|
|
94 | 100 |
/** |
95 | 101 |
* @brief Enumerator of the several stages of SSSP. |
96 | 102 |
*/ |
... | ... | |
113 | 119 |
AOS_SSSP_SHUTDOWN_3 = 0x38, /**< Identifier of SSSP shutdown phase stage 3. */ |
114 | 120 |
} aos_ssspstage_t; |
115 | 121 |
|
122 |
#endif |
|
123 |
|
|
124 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
116 | 125 |
/** |
117 | 126 |
* @brief Type to represent module IDs. |
118 | 127 |
*/ |
119 | 128 |
typedef uint16_t aos_ssspmoduleid_t; |
129 |
#endif |
|
130 |
|
|
120 | 131 |
|
121 | 132 |
/** |
122 | 133 |
* @brief AMiRo-OS base system structure. |
123 | 134 |
*/ |
124 | 135 |
typedef struct aos_system { |
125 |
|
|
136 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
126 | 137 |
/** |
127 | 138 |
* @brief SSSP relevant data. |
128 | 139 |
*/ |
... | ... | |
139 | 150 |
*/ |
140 | 151 |
aos_ssspmoduleid_t moduleId; |
141 | 152 |
} sssp; |
142 |
|
|
153 |
#endif |
|
143 | 154 |
/** |
144 | 155 |
* @brief System I/O stream. |
145 | 156 |
*/ |
... | ... | |
191 | 202 |
void aosSysInit(void); |
192 | 203 |
#endif |
193 | 204 |
void aosSysStart(void); |
205 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
194 | 206 |
eventmask_t aosSysSsspStartupOsInitSyncCheck(event_listener_t* syncEvtListener); |
207 |
#endif |
|
195 | 208 |
void aosSysGetUptimeX(aos_timestamp_t* ut); |
196 | 209 |
void aosSysGetDateTime(struct tm* dt); |
197 | 210 |
void aosSysSetDateTime(struct tm* dt); |
core/src/aos_main.cpp | ||
---|---|---|
61 | 61 |
*/ |
62 | 62 |
#define DELAYEVENT_MASK EVENT_MASK(4) |
63 | 63 |
|
64 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
65 |
|
|
64 | 66 |
/** |
65 | 67 |
* @brief CAN message identifier for initialization of the SSSP stack initialization sequence. |
66 | 68 |
*/ |
... | ... | |
76 | 78 |
*/ |
77 | 79 |
#define SSSP_STACKINIT_CANMSGID_ABORT 0x001 |
78 | 80 |
|
81 |
#endif |
|
82 |
|
|
79 | 83 |
/** |
80 | 84 |
* @brief CAN message identifier for calender synchronization message. |
81 | 85 |
*/ |
... | ... | |
129 | 133 |
return; |
130 | 134 |
} |
131 | 135 |
|
136 |
|
|
137 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
132 | 138 |
/** |
133 | 139 |
* @brief Callback function to be used during SSSP stack initialization sequence. |
134 | 140 |
* |
... | ... | |
144 | 150 |
|
145 | 151 |
return; |
146 | 152 |
} |
147 |
|
|
153 |
#endif |
|
148 | 154 |
/** |
149 | 155 |
* @brief Helper function to serialize data. |
150 | 156 |
* |
... | ... | |
241 | 247 |
|
242 | 248 |
return; |
243 | 249 |
} |
244 |
|
|
250 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
245 | 251 |
/** |
246 | 252 |
* @brief Implementation of the SSSP module stack initialization sequence (startup phase 3). |
247 | 253 |
* |
... | ... | |
837 | 843 |
|
838 | 844 |
return shutdown; |
839 | 845 |
} |
840 |
|
|
846 |
#endif |
|
841 | 847 |
/** |
842 | 848 |
* @brief Application entry point. |
843 | 849 |
*/ |
... | ... | |
928 | 934 |
#endif |
929 | 935 |
#endif |
930 | 936 |
|
937 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
931 | 938 |
/* event associations */ |
932 | 939 |
#if (AMIROOS_CFG_SSSP_STACK_START == true) && (AMIROOS_CFG_SSSP_STACK_END == true) |
933 | 940 |
chEvtRegisterMaskWithFlags(&aos.events.io, &_eventListenerIO, IOEVENT_MASK, MODULE_SSSP_EVENTFLAGS_PD | MODULE_SSSP_EVENTFLAGS_SYNC); |
... | ... | |
938 | 945 |
#else |
939 | 946 |
chEvtRegisterMaskWithFlags(&aos.events.io, &_eventListenerIO, IOEVENT_MASK, MODULE_SSSP_EVENTFLAGS_PD | MODULE_SSSP_EVENTFLAGS_SYNC | MODULE_SSSP_EVENTFLAGS_DN | MODULE_SSSP_EVENTFLAGS_UP); |
940 | 947 |
#endif |
948 |
#endif // end of AMIROOS_CFG_SSSP_ENABLE condition |
|
941 | 949 |
chEvtRegisterMask(&aos.events.os, &_eventListenerOS, OSEVENT_MASK); |
942 | 950 |
|
943 | 951 |
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_5) |
... | ... | |
1001 | 1009 |
#endif |
1002 | 1010 |
#endif |
1003 | 1011 |
|
1012 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
1004 | 1013 |
/* SSSP startup OS synchronization phase (end of startup stage 2) */ |
1005 | 1014 |
while ((shutdown == AOS_SHUTDOWN_NONE) && (eventmask = aosSysSsspStartupOsInitSyncCheck(&_eventListenerIO)) != 0) { |
1006 | 1015 |
/* |
... | ... | |
1198 | 1207 |
AMIROOS_CFG_MAIN_LOOP_HOOK_1(); |
1199 | 1208 |
#endif |
1200 | 1209 |
#endif |
1210 |
|
|
1201 | 1211 |
} |
1212 |
#endif |
|
1202 | 1213 |
|
1203 | 1214 |
/* |
1204 | 1215 |
* ########################################################################## |
core/src/aos_system.c | ||
---|---|---|
79 | 79 |
*/ |
80 | 80 |
static systime_t _synctime; |
81 | 81 |
|
82 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
82 | 83 |
#if (AMIROOS_CFG_SSSP_MASTER == true) || defined(__DOXYGEN__) |
83 | 84 |
/** |
84 | 85 |
* @brief Timer to drive the SYS_SYNC signal for system wide time synchronization according to SSSP. |
85 | 86 |
*/ |
86 | 87 |
static virtual_timer_t _syssynctimer; |
87 | 88 |
|
89 |
#endif |
|
90 |
|
|
88 | 91 |
/** |
89 | 92 |
* @brief Last uptime of system wide time synchronization. |
90 | 93 |
*/ |
91 | 94 |
static aos_timestamp_t _syssynctime; |
92 | 95 |
#endif |
93 | 96 |
|
97 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
94 | 98 |
#if ((AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)) || defined(__DOXYGEN__) |
95 | 99 |
/** |
96 | 100 |
* @brief Offset between local clock and system wide synchronization signal. |
... | ... | |
102 | 106 |
*/ |
103 | 107 |
#define SYSTEM_SYSSYNCSKEW_LPFACTOR (0.1f / AOS_SYSTEM_TIME_RESOLUTION) |
104 | 108 |
#endif |
109 |
#endif |
|
105 | 110 |
|
106 | 111 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
107 | 112 |
/** |
... | ... | |
246 | 251 |
#endif |
247 | 252 |
_printSystemInfoLine(stream, "Architecture", SYSTEM_INFO_NAMEWIDTH, "%s", PORT_ARCHITECTURE_NAME); |
248 | 253 |
_printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH); |
254 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
249 | 255 |
_printSystemInfoLine(stream, "AMiRo-OS" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (SSSP %u.%u)", AMIROOS_VERSION_MAJOR, AMIROOS_VERSION_MINOR, AMIROOS_VERSION_PATCH, AMIROOS_RELEASE_TYPE, AOS_SYSTEM_SSSP_VERSION_MAJOR, AOS_SYSTEM_SSSP_VERSION_MINOR); |
256 |
#endif |
|
250 | 257 |
_printSystemInfoLine(stream, "AMiRo-LLD" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (periphAL %u.%u)", AMIRO_LLD_VERSION_MAJOR, AMIRO_LLD_VERSION_MINOR, AMIRO_LLD_VERSION_PATCH, AMIRO_LLD_RELEASE_TYPE, PERIPHAL_VERSION_MAJOR, PERIPHAL_VERSION_MINOR); |
251 | 258 |
_printSystemInfoLine(stream, "ChibiOS/RT" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s", CH_KERNEL_MAJOR, CH_KERNEL_MINOR, CH_KERNEL_PATCH, (CH_KERNEL_STABLE == 1) ? "stable" : "non-stable"); |
252 | 259 |
_printSystemInfoLine(stream, "ChibiOS/HAL", SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s", CH_HAL_MAJOR, CH_HAL_MINOR, CH_HAL_PATCH, (CH_HAL_STABLE == 1) ? "stable" : "non-stable"); |
... | ... | |
257 | 264 |
// print static information about the bootloader |
258 | 265 |
_printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH); |
259 | 266 |
if (BL_CALLBACK_TABLE_ADDRESS->magicNumber == BL_MAGIC_NUMBER) { |
267 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
260 | 268 |
_printSystemInfoLine(stream, "AMiRo-BLT", SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (SSSP %u.%u)", BL_CALLBACK_TABLE_ADDRESS->vBootloader.major, BL_CALLBACK_TABLE_ADDRESS->vBootloader.minor, BL_CALLBACK_TABLE_ADDRESS->vBootloader.patch, |
261 | 269 |
(BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_Release) ? "stable" : |
262 | 270 |
(BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_ReleaseCandidate) ? "release candidate" : |
... | ... | |
265 | 273 |
(BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_PreAlpha) ? "pre-alpha" : |
266 | 274 |
"<release type unknown>", |
267 | 275 |
BL_CALLBACK_TABLE_ADDRESS->vSSSP.major, BL_CALLBACK_TABLE_ADDRESS->vSSSP.minor); |
276 |
|
|
268 | 277 |
if (BL_CALLBACK_TABLE_ADDRESS->vSSSP.major != AOS_SYSTEM_SSSP_VERSION_MAJOR) { |
269 | 278 |
if (stream) { |
270 | 279 |
chprintf(stream, "WARNING: Bootloader and AMiRo-OS implement incompatible SSSP versions!\n"); |
... | ... | |
272 | 281 |
aosprintf("WARNING: Bootloader and AMiRo-OS implement incompatible SSSP versions!\n"); |
273 | 282 |
} |
274 | 283 |
} |
284 |
#endif |
|
275 | 285 |
_printSystemInfoLine(stream, "Compiler", SYSTEM_INFO_NAMEWIDTH, "%s %u.%u.%u", (BL_CALLBACK_TABLE_ADDRESS->vCompiler.identifier == BL_VERSION_ID_GCC) ? "GCC" : "<compiler unknown>", BL_CALLBACK_TABLE_ADDRESS->vCompiler.major, BL_CALLBACK_TABLE_ADDRESS->vCompiler.minor, BL_CALLBACK_TABLE_ADDRESS->vCompiler.patch); // TODO: support other compilers than GCC |
276 | 286 |
} else { |
277 | 287 |
if (stream) { |
... | ... | |
283 | 293 |
|
284 | 294 |
// print dynamic information about the module |
285 | 295 |
_printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH); |
296 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
286 | 297 |
if (aos.sssp.moduleId != 0) { |
287 | 298 |
_printSystemInfoLine(stream, "Module ID", SYSTEM_INFO_NAMEWIDTH, "%u", aos.sssp.moduleId); |
288 | 299 |
} else { |
289 | 300 |
_printSystemInfoLine(stream, "Module ID", SYSTEM_INFO_NAMEWIDTH, "not available"); |
290 | 301 |
} |
302 |
#endif |
|
291 | 303 |
_printSystemInfoLine(stream, "Date", SYSTEM_INFO_NAMEWIDTH, "%s %02u-%02u-%04u", (dt.tm_wday == 0) ? "Sunday" : (dt.tm_wday == 1) ? "Monday" : (dt.tm_wday == 2) ? "Tuesday" : (dt.tm_wday == 3) ? "Wednesday" : (dt.tm_wday == 4) ? "Thursday" : (dt.tm_wday == 5) ? "Friday" : "Saturday", |
292 | 304 |
dt.tm_mday, |
293 | 305 |
dt.tm_mon + 1, |
... | ... | |
496 | 508 |
chprintf(stream, "%10u seconds\n", (uint8_t)(uptime % MICROSECONDS_PER_MINUTE / MICROSECONDS_PER_SECOND)); |
497 | 509 |
chprintf(stream, "%10u milliseconds\n", (uint16_t)(uptime % MICROSECONDS_PER_SECOND / MICROSECONDS_PER_MILLISECOND)); |
498 | 510 |
chprintf(stream, "%10u microseconds\n", (uint16_t)(uptime % MICROSECONDS_PER_MILLISECOND / MICROSECONDS_PER_MICROSECOND)); |
511 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
499 | 512 |
#if (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true) |
500 | 513 |
chprintf(stream, "SSSP synchronization offset: %.3fus per %uus\n", _syssyncskew, AMIROOS_CFG_SSSP_SYSSYNCPERIOD); |
501 | 514 |
#endif /* AMIROOS_CFG_SSSP_MASTER != true && AMIROOS_CFG_PROFILE == true */ |
502 | 515 |
_printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH); |
503 |
|
|
516 |
#endif |
|
504 | 517 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) |
505 | 518 |
// print shell info |
506 | 519 |
chprintf(stream, "System shell information:\n"); |
... | ... | |
621 | 634 |
return; |
622 | 635 |
} |
623 | 636 |
|
637 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
624 | 638 |
#if (AMIROOS_CFG_SSSP_MASTER != true) || defined(__DOXYGEN__) |
625 | 639 |
/** |
626 | 640 |
* @brief Callback function for the Sync signal interrupt. |
... | ... | |
664 | 678 |
return; |
665 | 679 |
} |
666 | 680 |
#endif |
681 |
#endif |
|
667 | 682 |
|
668 | 683 |
/** |
669 | 684 |
* @brief Callback function for the uptime accumulation timer. |
... | ... | |
686 | 701 |
|
687 | 702 |
return; |
688 | 703 |
} |
689 |
|
|
704 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
690 | 705 |
#if (AMIROOS_CFG_SSSP_MASTER == true) || defined (__DOXYGEN__) |
691 | 706 |
/** |
692 | 707 |
* @brief Periodic system synchronization callback function. |
... | ... | |
722 | 737 |
return; |
723 | 738 |
} |
724 | 739 |
#endif |
740 |
#endif |
|
725 | 741 |
|
726 | 742 |
/** |
727 | 743 |
* @brief AMiRo-OS system initialization. |
... | ... | |
742 | 758 |
chVTObjectInit(&_systimer); |
743 | 759 |
_synctime = 0; |
744 | 760 |
_uptime = 0; |
761 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
745 | 762 |
#if (AMIROOS_CFG_SSSP_MASTER == true) |
746 | 763 |
chVTObjectInit(&_syssynctimer); |
747 | 764 |
_syssynctime = 0; |
... | ... | |
749 | 766 |
#if (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true) |
750 | 767 |
_syssyncskew = 0.0f; |
751 | 768 |
#endif |
769 |
#endif |
|
752 | 770 |
|
771 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
753 | 772 |
/* initialize aos configuration */ |
754 | 773 |
aos.sssp.stage = AOS_SSSP_STARTUP_2_1; |
755 | 774 |
aos.sssp.moduleId = 0; |
775 |
#endif |
|
756 | 776 |
aosIOStreamInit(&aos.iostream); |
757 | 777 |
chEvtObjectInit(&aos.events.io); |
758 | 778 |
chEvtObjectInit(&aos.events.os); |
759 | 779 |
|
760 | 780 |
/* interrupt setup */ |
761 | 781 |
// PD signal |
782 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
762 | 783 |
palSetPadCallback(moduleSsspGpioPd.gpio->port, moduleSsspGpioPd.gpio->pad, _intCallback, &moduleSsspGpioPd.gpio->pad); |
763 | 784 |
palEnablePadEvent(moduleSsspGpioPd.gpio->port, moduleSsspGpioPd.gpio->pad, APAL2CH_EDGE(moduleSsspGpioPd.meta.edge)); |
764 | 785 |
// SYNC signal |
... | ... | |
778 | 799 |
palSetPadCallback(moduleSsspGpioUp.gpio->port, moduleSsspGpioUp.gpio->pad, _intCallback, &moduleSsspGpioUp.gpio->pad); |
779 | 800 |
palEnablePadEvent(moduleSsspGpioUp.gpio->port, moduleSsspGpioUp.gpio->pad, APAL2CH_EDGE(moduleSsspGpioUp.meta.edge)); |
780 | 801 |
#endif |
802 |
#endif |
|
781 | 803 |
#ifdef MODULE_INIT_INTERRUPTS |
782 | 804 |
// further interrupt signals |
783 | 805 |
MODULE_INIT_INTERRUPTS(); |
... | ... | |
809 | 831 |
*/ |
810 | 832 |
inline void aosSysStart(void) |
811 | 833 |
{ |
834 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
812 | 835 |
// update the system SSSP stage |
813 | 836 |
aos.sssp.stage = AOS_SSSP_OPERATION; |
814 | 837 |
|
... | ... | |
824 | 847 |
chSysUnlock(); |
825 | 848 |
} |
826 | 849 |
#endif |
850 |
#endif |
|
827 | 851 |
|
828 | 852 |
// print system information; |
829 | 853 |
_printSystemInfo((BaseSequentialStream*)&aos.iostream); |
... | ... | |
840 | 864 |
|
841 | 865 |
return; |
842 | 866 |
} |
843 |
|
|
867 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
844 | 868 |
/** |
845 | 869 |
* @brief Implements the SSSP startup synchronization step. |
846 | 870 |
* |
... | ... | |
891 | 915 |
return m; |
892 | 916 |
} |
893 | 917 |
} |
918 |
#endif |
|
894 | 919 |
|
895 | 920 |
/** |
896 | 921 |
* @brief Retrieves the system uptime. |
... | ... | |
949 | 974 |
// check arguments |
950 | 975 |
aosDbgCheck(shutdown != AOS_SHUTDOWN_NONE); |
951 | 976 |
|
977 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
952 | 978 |
#if (AMIROOS_CFG_SSSP_MASTER == true) |
953 | 979 |
// deactivate the system synchronization timer |
954 | 980 |
chVTReset(&_syssynctimer); |
... | ... | |
965 | 991 |
// activate the SYS_SYNC signal |
966 | 992 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_ON); |
967 | 993 |
chSysUnlock(); |
994 |
#endif |
|
968 | 995 |
|
969 | 996 |
switch (shutdown) { |
970 | 997 |
case AOS_SHUTDOWN_PASSIVE: |
... | ... | |
992 | 1019 |
default: |
993 | 1020 |
break; |
994 | 1021 |
} |
995 |
|
|
1022 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
996 | 1023 |
// update the system SSSP stage |
997 | 1024 |
aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_2; |
998 |
|
|
1025 |
#endif |
|
999 | 1026 |
return; |
1000 | 1027 |
} |
1001 | 1028 |
|
... | ... | |
1033 | 1060 |
// disable all interrupts |
1034 | 1061 |
irqDeinit(); |
1035 | 1062 |
|
1063 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
1036 | 1064 |
// update the system SSSP stage |
1037 | 1065 |
aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_3; |
1066 |
#endif |
|
1038 | 1067 |
|
1039 | 1068 |
// call bootloader callback depending on arguments |
1040 | 1069 |
switch (shutdown) { |
core/src/aos_system.c.autosave | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2016..2018 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
/** |
|
20 |
* @file aos_system.c |
|
21 |
* @brief System code. |
|
22 |
* @details Contains system initialization and shutdown routines |
|
23 |
* and system shell commands. |
|
24 |
* |
|
25 |
* @addtogroup aos_system |
|
26 |
* @{ |
|
27 |
*/ |
|
28 |
|
|
29 |
#include <aos_system.h> |
|
30 |
|
|
31 |
#include <amiroos.h> |
|
32 |
#include <amiroblt.h> |
|
33 |
#include <module.h> |
|
34 |
#include <string.h> |
|
35 |
#include <stdlib.h> |
|
36 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) |
|
37 |
#include <ch_test.h> |
|
38 |
#include <rt_test_root.h> |
|
39 |
#endif |
|
40 |
|
|
41 |
/** |
|
42 |
* @brief Period of the system timer. |
|
43 |
*/ |
|
44 |
#define SYSTIMER_PERIOD (TIME_MAX_SYSTIME - CH_CFG_ST_TIMEDELTA) |
|
45 |
|
|
46 |
/** |
|
47 |
* @brief Width of the printable system info text. |
|
48 |
*/ |
|
49 |
#define SYSTEM_INFO_WIDTH 70 |
|
50 |
|
|
51 |
/** |
|
52 |
* @brief Width of the name column of the system info table. |
|
53 |
*/ |
|
54 |
#define SYSTEM_INFO_NAMEWIDTH 14 |
|
55 |
|
|
56 |
/* forward declarations */ |
|
57 |
static void _printSystemInfo(BaseSequentialStream* stream); |
|
58 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) |
|
59 |
static int _shellcmd_configcb(BaseSequentialStream* stream, int argc, char* argv[]); |
|
60 |
static int _shellcmd_infocb(BaseSequentialStream* stream, int argc, char* argv[]); |
|
61 |
static int _shellcmd_shutdowncb(BaseSequentialStream* stream, int argc, char* argv[]); |
|
62 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) |
|
63 |
static int _shellcmd_kerneltestcb(BaseSequentialStream* stream, int argc, char* argv[]); |
|
64 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
|
65 |
#endif /* AMIROOS_CFG_SHELL_ENABLE == true */ |
|
66 |
|
|
67 |
/** |
|
68 |
* @brief Timer to accumulate system uptime. |
|
69 |
*/ |
|
70 |
static virtual_timer_t _systimer; |
|
71 |
|
|
72 |
/** |
|
73 |
* @brief Accumulated system uptime. |
|
74 |
*/ |
|
75 |
static aos_timestamp_t _uptime; |
|
76 |
|
|
77 |
/** |
|
78 |
* @brief Timer register value of last accumulation. |
|
79 |
*/ |
|
80 |
static systime_t _synctime; |
|
81 |
|
|
82 |
#if (AMIROOS_CFG_SSSP_MASTER == true) || defined(__DOXYGEN__) |
|
83 |
/** |
|
84 |
|