Revision 9ebb11a9
core/inc/aos_confcheck.h | ||
---|---|---|
53 | 53 |
* SSSP parameters and options |
54 | 54 |
*/ |
55 | 55 |
|
56 |
#ifndef AMIROOS_CFG_SSSP_MASTER
|
|
57 |
#error "AMIROOS_CFG_SSSP_MASTER not defined in aosconf.h"
|
|
56 |
#ifndef AMIROOS_CFG_SSSP_ENABLE
|
|
57 |
#error "AMIROOS_CFG_SSSP_ENABLE not defined in aosconf.h"
|
|
58 | 58 |
#endif |
59 | 59 |
|
60 |
#ifndef AMIROOS_CFG_SSSP_STACK_START |
|
61 |
#error "AMIROOS_CFG_SSSP_STACK_START not defined in aosconf.h" |
|
62 |
#endif |
|
60 |
# if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
63 | 61 |
|
64 |
#ifndef AMIROOS_CFG_SSSP_STACK_END
|
|
65 |
#error "AMIROOS_CFG_SSSP_STACK_END not defined in aosconf.h"
|
|
66 |
#endif |
|
62 |
#ifndef AMIROOS_CFG_SSSP_MASTER
|
|
63 |
#error "AMIROOS_CFG_SSSP_MASTER not defined in aosconf.h"
|
|
64 |
#endif
|
|
67 | 65 |
|
68 |
#if (AMIROOS_CFG_SSSP_STACK_START == true) && (AMIROOS_CFG_SSSP_STACK_END == true) |
|
69 |
#warning "AMIROOS_CFG_SSSP_STACK_START and AMIROOS_CFG_SSSP_STACK_END both enabled in aosconf.h" |
|
70 |
#if (AMIROOS_CFG_SSSP_MASTER != true) |
|
71 |
#error "AMIROOS_CFG_SSSP_MASTER must be enabled in this case" |
|
66 |
#ifndef AMIROOS_CFG_SSSP_STACK_START |
|
67 |
#error "AMIROOS_CFG_SSSP_STACK_START not defined in aosconf.h" |
|
72 | 68 |
#endif |
73 |
#endif |
|
74 | 69 |
|
75 |
#ifndef AMIROOS_CFG_SSSP_SIGNALDELAY |
|
76 |
#error "AMIROOS_CFG_SSSP_SIGNALDELAY not defined in aosconf.h" |
|
77 |
#endif |
|
70 |
#ifndef AMIROOS_CFG_SSSP_STACK_END |
|
71 |
#error "AMIROOS_CFG_SSSP_STACK_END not defined in aosconf.h" |
|
72 |
#endif |
|
73 |
|
|
74 |
#if (AMIROOS_CFG_SSSP_STACK_START == true) && (AMIROOS_CFG_SSSP_STACK_END == true) |
|
75 |
#warning "AMIROOS_CFG_SSSP_STACK_START and AMIROOS_CFG_SSSP_STACK_END both enabled in aosconf.h" |
|
76 |
#if (AMIROOS_CFG_SSSP_MASTER != true) |
|
77 |
#error "AMIROOS_CFG_SSSP_MASTER must be enabled in this case" |
|
78 |
#endif |
|
79 |
#endif |
|
80 |
|
|
81 |
#ifndef AMIROOS_CFG_SSSP_SIGNALDELAY |
|
82 |
#error "AMIROOS_CFG_SSSP_SIGNALDELAY not defined in aosconf.h" |
|
83 |
#endif |
|
84 |
|
|
85 |
#ifndef AMIROOS_CFG_SSSP_SYSSYNCPERIOD |
|
86 |
#error "AMIROOS_CFG_SSSP_SYSSYNCPERIOD not defined in aosconf.h" |
|
87 |
#endif |
|
78 | 88 |
|
79 |
#ifndef AMIROOS_CFG_SSSP_SYSSYNCPERIOD |
|
80 |
#error "AMIROOS_CFG_SSSP_SYSSYNCPERIOD not defined in aosconf.h" |
|
81 | 89 |
#endif |
82 | 90 |
|
83 | 91 |
/* |
core/inc/aos_system.h | ||
---|---|---|
65 | 65 |
#define AOS_SYSTEM_EVENTFLAGS_RESTART (AOS_SYSTEM_EVENTFLAGS_SHUTDOWN | (eventflags_t)(1 << 4)) |
66 | 66 |
|
67 | 67 |
/** |
68 |
* @brief Enumerator to identify shutdown types. |
|
69 |
*/ |
|
70 |
typedef enum aos_shutdown { |
|
71 |
AOS_SHUTDOWN_NONE, /**< Default value if no shutdown action was initiated */ |
|
72 |
AOS_SHUTDOWN_PASSIVE, /**< Passive shutdown (initiated by another module). */ |
|
73 |
AOS_SHUTDOWN_HIBERNATE, /**< Active shutdown to hibernate mode. */ |
|
74 |
AOS_SHUTDOWN_DEEPSLEEP, /**< Active shutdown to deepsleep mode. */ |
|
75 |
AOS_SHUTDOWN_TRANSPORTATION, /**< Active shutdown to transportation mode. */ |
|
76 |
AOS_SHUTDOWN_RESTART, /**< Active saystem restart request. */ |
|
77 |
} aos_shutdown_t; |
|
78 |
|
|
79 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__) |
|
80 |
|
|
81 |
/** |
|
68 | 82 |
* @brief Major version of the implemented SSSP. |
69 | 83 |
*/ |
70 | 84 |
#define AOS_SYSTEM_SSSP_VERSION_MAJOR 1 |
... | ... | |
81 | 95 |
#define AOS_SYSTEM_SSSP_TIMEOUT (10 * AMIROOS_CFG_SSSP_SIGNALDELAY) |
82 | 96 |
|
83 | 97 |
/** |
84 |
* @brief Enumerator to identify shutdown types. |
|
85 |
*/ |
|
86 |
typedef enum aos_shutdown { |
|
87 |
AOS_SHUTDOWN_NONE, /**< Default value if no shutdown action was initiated */ |
|
88 |
AOS_SHUTDOWN_PASSIVE, /**< Passive shutdown (initiated by another module). */ |
|
89 |
AOS_SHUTDOWN_HIBERNATE, /**< Active shutdown to hibernate mode. */ |
|
90 |
AOS_SHUTDOWN_DEEPSLEEP, /**< Active shutdown to deepsleep mode. */ |
|
91 |
AOS_SHUTDOWN_TRANSPORTATION, /**< Active shutdown to transportation mode. */ |
|
92 |
AOS_SHUTDOWN_RESTART, /**< Active saystem restart request. */ |
|
93 |
} aos_shutdown_t; |
|
94 |
|
|
95 |
/** |
|
96 | 98 |
* @brief Enumerator of the several stages of SSSP. |
97 | 99 |
*/ |
98 | 100 |
typedef enum aos_ssspstage { |
... | ... | |
119 | 121 |
*/ |
120 | 122 |
typedef uint16_t aos_ssspmoduleid_t; |
121 | 123 |
|
124 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
125 |
|
|
122 | 126 |
/** |
123 | 127 |
* @brief AMiRo-OS base system structure. |
124 | 128 |
*/ |
125 | 129 |
typedef struct aos_system { |
126 |
|
|
130 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__) |
|
127 | 131 |
/** |
128 | 132 |
* @brief SSSP relevant data. |
129 | 133 |
*/ |
... | ... | |
140 | 144 |
*/ |
141 | 145 |
aos_ssspmoduleid_t moduleId; |
142 | 146 |
} sssp; |
147 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
143 | 148 |
|
144 | 149 |
/** |
145 | 150 |
* @brief System I/O stream. |
... | ... | |
192 | 197 |
void aosSysInit(void); |
193 | 198 |
#endif |
194 | 199 |
void aosSysStart(void); |
200 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined (__DOXYGEN__) |
|
195 | 201 |
eventmask_t aosSysSsspStartupOsInitSyncCheck(event_listener_t* syncEvtListener); |
202 |
#endif |
|
196 | 203 |
void aosSysGetUptimeX(aos_timestamp_t* ut); |
197 | 204 |
void aosSysGetDateTime(struct tm* dt); |
198 | 205 |
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) || defined(__DOXYGEN__) |
|
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 /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
82 |
|
|
79 | 83 |
/** |
80 | 84 |
* @brief CAN message identifier for calender synchronization message. |
81 | 85 |
*/ |
... | ... | |
129 | 133 |
return; |
130 | 134 |
} |
131 | 135 |
|
136 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__) |
|
132 | 137 |
/** |
133 | 138 |
* @brief Callback function to be used during SSSP stack initialization sequence. |
134 | 139 |
* |
... | ... | |
144 | 149 |
|
145 | 150 |
return; |
146 | 151 |
} |
152 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
147 | 153 |
|
148 | 154 |
/** |
149 | 155 |
* @brief Helper function to serialize data. |
... | ... | |
242 | 248 |
return; |
243 | 249 |
} |
244 | 250 |
|
251 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__) |
|
245 | 252 |
/** |
246 | 253 |
* @brief Implementation of the SSSP module stack initialization sequence (startup phase 3). |
247 | 254 |
* |
... | ... | |
404 | 411 |
aosDbgPrintf("PD evt\n"); |
405 | 412 |
// deactivate S and UP |
406 | 413 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF); |
407 |
#if (AMIROOS_CFG_SSSP_STACK_END != true)
|
|
414 |
#if (AMIROOS_CFG_SSSP_STACK_END != true) |
|
408 | 415 |
apalControlGpioSet(&moduleSsspGpioUp, APAL_GPIO_OFF); |
409 |
#endif
|
|
416 |
#endif |
|
410 | 417 |
// set shutdown flag and exit the loop |
411 | 418 |
shutdown = AOS_SHUTDOWN_PASSIVE; |
412 | 419 |
break; |
... | ... | |
837 | 844 |
|
838 | 845 |
return shutdown; |
839 | 846 |
} |
847 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
840 | 848 |
|
841 | 849 |
/** |
842 | 850 |
* @brief Application entry point. |
... | ... | |
929 | 937 |
#endif |
930 | 938 |
|
931 | 939 |
/* event associations */ |
940 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
932 | 941 |
#if (AMIROOS_CFG_SSSP_STACK_START == true) && (AMIROOS_CFG_SSSP_STACK_END == true) |
933 | 942 |
chEvtRegisterMaskWithFlags(&aos.events.io, &_eventListenerIO, IOEVENT_MASK, MODULE_SSSP_EVENTFLAGS_PD | MODULE_SSSP_EVENTFLAGS_SYNC); |
934 | 943 |
#elif (AMIROOS_CFG_SSSP_STACK_START == true) |
... | ... | |
938 | 947 |
#else |
939 | 948 |
chEvtRegisterMaskWithFlags(&aos.events.io, &_eventListenerIO, IOEVENT_MASK, MODULE_SSSP_EVENTFLAGS_PD | MODULE_SSSP_EVENTFLAGS_SYNC | MODULE_SSSP_EVENTFLAGS_DN | MODULE_SSSP_EVENTFLAGS_UP); |
940 | 949 |
#endif |
950 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
941 | 951 |
chEvtRegisterMask(&aos.events.os, &_eventListenerOS, OSEVENT_MASK); |
942 | 952 |
|
943 | 953 |
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_5) |
... | ... | |
1001 | 1011 |
#endif |
1002 | 1012 |
#endif |
1003 | 1013 |
|
1014 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
1004 | 1015 |
/* SSSP startup OS synchronization phase (end of startup stage 2) */ |
1005 | 1016 |
while ((shutdown == AOS_SHUTDOWN_NONE) && (eventmask = aosSysSsspStartupOsInitSyncCheck(&_eventListenerIO)) != 0) { |
1006 | 1017 |
/* |
... | ... | |
1040 | 1051 |
if (shutdown == AOS_SHUTDOWN_NONE) { |
1041 | 1052 |
shutdown = _ssspModuleStackInitialization(); |
1042 | 1053 |
} |
1054 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
1043 | 1055 |
|
1044 | 1056 |
/* |
1045 | 1057 |
* There must be no delays at this point, thus no hook is allowed. |
1046 | 1058 |
*/ |
1047 | 1059 |
|
1048 |
/* snychronize calendars */ |
|
1060 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
1061 |
/* synchronize calendars */ |
|
1049 | 1062 |
if (shutdown == AOS_SHUTDOWN_NONE) { |
1050 | 1063 |
#if (AMIROOS_CFG_SSSP_MASTER == true) |
1051 | 1064 |
CANTxFrame frame; |
... | ... | |
1068 | 1081 |
canTransmitTimeout(&MODULE_HAL_CAN, CAN_ANY_MAILBOX, &frame, TIME_IMMEDIATE); |
1069 | 1082 |
|
1070 | 1083 |
aosDbgPrintf("done\n"); |
1071 |
#else |
|
1084 |
#else /* AMIROOS_CFG_SSSP_MASTER == false */
|
|
1072 | 1085 |
CANRxFrame frame; |
1073 | 1086 |
uint64_t encoded; |
1074 | 1087 |
struct tm t; |
... | ... | |
1094 | 1107 |
} else { |
1095 | 1108 |
aosDbgPrintf("fail (timeout)\n"); |
1096 | 1109 |
} |
1097 |
#endif |
|
1110 |
#endif /* AMIROOS_CFG_SSSP_MASTER == false */
|
|
1098 | 1111 |
aosDbgPrintf("\n"); |
1099 | 1112 |
} |
1113 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
1100 | 1114 |
|
1101 | 1115 |
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_8) |
1102 | 1116 |
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_8_ARGS) |
... | ... | |
1147 | 1161 |
case IOEVENT_MASK: |
1148 | 1162 |
// evaluate flags |
1149 | 1163 |
eventflags = chEvtGetAndClearFlags(&_eventListenerIO); |
1164 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
1150 | 1165 |
// PD event |
1151 | 1166 |
if (eventflags & MODULE_SSSP_EVENTFLAGS_PD) { |
1152 | 1167 |
shutdown = AOS_SHUTDOWN_PASSIVE; |
1153 | 1168 |
} |
1169 |
#endif |
|
1154 | 1170 |
// all other events |
1155 | 1171 |
#ifdef MODULE_MAIN_LOOP_IO_EVENT |
1156 | 1172 |
else { |
core/src/aos_system.c | ||
---|---|---|
79 | 79 |
*/ |
80 | 80 |
static systime_t _synctime; |
81 | 81 |
|
82 |
#if (AMIROOS_CFG_SSSP_MASTER == true) || defined(__DOXYGEN__)
|
|
82 |
#if ((AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER == true)) || defined(__DOXYGEN__)
|
|
83 | 83 |
/** |
84 | 84 |
* @brief Timer to drive the SYS_SYNC signal for system wide time synchronization according to SSSP. |
85 | 85 |
*/ |
... | ... | |
91 | 91 |
static aos_timestamp_t _syssynctime; |
92 | 92 |
#endif |
93 | 93 |
|
94 |
#if ((AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)) || defined(__DOXYGEN__) |
|
94 |
#if ((AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)) || defined(__DOXYGEN__)
|
|
95 | 95 |
/** |
96 | 96 |
* @brief Offset between local clock and system wide synchronization signal. |
97 | 97 |
*/ |
... | ... | |
101 | 101 |
* @brief Weighting factor for the low-pass filter used for calculating the @p _syssyncskew value. |
102 | 102 |
*/ |
103 | 103 |
#define SYSTEM_SYSSYNCSKEW_LPFACTOR (0.1f / AOS_SYSTEM_TIME_RESOLUTION) |
104 |
#endif |
|
104 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true) */
|
|
105 | 105 |
|
106 | 106 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
107 | 107 |
/** |
... | ... | |
250 | 250 |
#endif |
251 | 251 |
_printSystemInfoLine(stream, "Architecture", SYSTEM_INFO_NAMEWIDTH, "%s", PORT_ARCHITECTURE_NAME); |
252 | 252 |
_printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH); |
253 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
253 | 254 |
_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); |
255 |
#else |
|
256 |
_printSystemInfoLine(stream, "AMiRo-OS" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s", AMIROOS_VERSION_MAJOR, AMIROOS_VERSION_MINOR, AMIROOS_VERSION_PATCH, AMIROOS_RELEASE_TYPE); |
|
257 |
#endif |
|
254 | 258 |
_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); |
255 | 259 |
_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"); |
256 | 260 |
_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"); |
... | ... | |
269 | 273 |
(BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_PreAlpha) ? "pre-alpha" : |
270 | 274 |
"<release type unknown>", |
271 | 275 |
BL_CALLBACK_TABLE_ADDRESS->vSSSP.major, BL_CALLBACK_TABLE_ADDRESS->vSSSP.minor); |
276 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
272 | 277 |
if (BL_CALLBACK_TABLE_ADDRESS->vSSSP.major != AOS_SYSTEM_SSSP_VERSION_MAJOR) { |
273 | 278 |
if (stream) { |
274 | 279 |
chprintf(stream, "WARNING: Bootloader and AMiRo-OS implement incompatible SSSP versions!\n"); |
... | ... | |
276 | 281 |
aosprintf("WARNING: Bootloader and AMiRo-OS implement incompatible SSSP versions!\n"); |
277 | 282 |
} |
278 | 283 |
} |
284 |
#endif |
|
279 | 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 |
280 | 286 |
} else { |
281 | 287 |
if (stream) { |
... | ... | |
287 | 293 |
|
288 | 294 |
// print dynamic information about the module |
289 | 295 |
_printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH); |
296 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
290 | 297 |
if (aos.sssp.moduleId != 0) { |
291 | 298 |
_printSystemInfoLine(stream, "Module ID", SYSTEM_INFO_NAMEWIDTH, "%u", aos.sssp.moduleId); |
292 | 299 |
} else { |
293 | 300 |
_printSystemInfoLine(stream, "Module ID", SYSTEM_INFO_NAMEWIDTH, "not available"); |
294 | 301 |
} |
302 |
#endif |
|
295 | 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", |
296 | 304 |
dt.tm_mday, |
297 | 305 |
dt.tm_mon + 1, |
... | ... | |
500 | 508 |
chprintf(stream, "%10u seconds\n", (uint8_t)(uptime % MICROSECONDS_PER_MINUTE / MICROSECONDS_PER_SECOND)); |
501 | 509 |
chprintf(stream, "%10u milliseconds\n", (uint16_t)(uptime % MICROSECONDS_PER_SECOND / MICROSECONDS_PER_MILLISECOND)); |
502 | 510 |
chprintf(stream, "%10u microseconds\n", (uint16_t)(uptime % MICROSECONDS_PER_MILLISECOND / MICROSECONDS_PER_MICROSECOND)); |
503 |
#if (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true) |
|
511 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)
|
|
504 | 512 |
chprintf(stream, "SSSP synchronization offset: %.3fus per %uus\n", _syssyncskew, AMIROOS_CFG_SSSP_SYSSYNCPERIOD); |
505 | 513 |
#endif /* AMIROOS_CFG_SSSP_MASTER != true && AMIROOS_CFG_PROFILE == true */ |
506 | 514 |
_printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH); |
... | ... | |
625 | 633 |
return; |
626 | 634 |
} |
627 | 635 |
|
628 |
#if (AMIROOS_CFG_SSSP_MASTER != true) || defined(__DOXYGEN__)
|
|
636 |
#if ((AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER != true)) || defined(__DOXYGEN__)
|
|
629 | 637 |
/** |
630 | 638 |
* @brief Callback function for the Sync signal interrupt. |
631 | 639 |
* |
... | ... | |
667 | 675 |
|
668 | 676 |
return; |
669 | 677 |
} |
670 |
#endif |
|
678 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER != true) */
|
|
671 | 679 |
|
672 | 680 |
/** |
673 | 681 |
* @brief Callback function for the uptime accumulation timer. |
... | ... | |
691 | 699 |
return; |
692 | 700 |
} |
693 | 701 |
|
694 |
#if (AMIROOS_CFG_SSSP_MASTER == true) || defined (__DOXYGEN__)
|
|
702 |
#if ((AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER == true)) || defined (__DOXYGEN__)
|
|
695 | 703 |
/** |
696 | 704 |
* @brief Periodic system synchronization callback function. |
697 | 705 |
* @details Toggles the SYS_SYNC signal and reconfigures the system synchronization timer. |
... | ... | |
725 | 733 |
|
726 | 734 |
return; |
727 | 735 |
} |
728 |
#endif |
|
736 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER == true) */
|
|
729 | 737 |
|
730 | 738 |
/** |
731 | 739 |
* @brief AMiRo-OS system initialization. |
... | ... | |
744 | 752 |
|
745 | 753 |
/* set local variables */ |
746 | 754 |
chVTObjectInit(&_systimer); |
755 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
747 | 756 |
_synctime = 0; |
748 | 757 |
_uptime = 0; |
749 | 758 |
#if (AMIROOS_CFG_SSSP_MASTER == true) |
... | ... | |
753 | 762 |
#if (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true) |
754 | 763 |
_syssyncskew = 0.0f; |
755 | 764 |
#endif |
765 |
#else /* AMIROOS_CFG_SSSP_ENABLE == false */ |
|
766 |
// start the uptime counter |
|
767 |
chSysLock(); |
|
768 |
_synctime = chVTGetSystemTimeX(); |
|
769 |
_uptime = 0; |
|
770 |
chVTSetI(&_systimer, SYSTIMER_PERIOD, &_uptimeCallback, NULL); |
|
771 |
chSysUnlock(); |
|
772 |
#endif /* AMIROOS_CFG_SSSP_ENABLE */ |
|
756 | 773 |
|
757 | 774 |
/* initialize aos configuration */ |
775 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
758 | 776 |
aos.sssp.stage = AOS_SSSP_STARTUP_2_1; |
759 | 777 |
aos.sssp.moduleId = 0; |
778 |
#endif |
|
760 | 779 |
aosIOStreamInit(&aos.iostream); |
761 | 780 |
chEvtObjectInit(&aos.events.io); |
762 | 781 |
chEvtObjectInit(&aos.events.os); |
763 | 782 |
|
764 | 783 |
/* interrupt setup */ |
784 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
765 | 785 |
// PD signal |
766 | 786 |
palSetPadCallback(moduleSsspGpioPd.gpio->port, moduleSsspGpioPd.gpio->pad, _intCallback, &moduleSsspGpioPd.gpio->pad); |
767 | 787 |
palEnablePadEvent(moduleSsspGpioPd.gpio->port, moduleSsspGpioPd.gpio->pad, APAL2CH_EDGE(moduleSsspGpioPd.meta.edge)); |
... | ... | |
782 | 802 |
palSetPadCallback(moduleSsspGpioUp.gpio->port, moduleSsspGpioUp.gpio->pad, _intCallback, &moduleSsspGpioUp.gpio->pad); |
783 | 803 |
palEnablePadEvent(moduleSsspGpioUp.gpio->port, moduleSsspGpioUp.gpio->pad, APAL2CH_EDGE(moduleSsspGpioUp.meta.edge)); |
784 | 804 |
#endif |
805 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
785 | 806 |
#ifdef MODULE_INIT_INTERRUPTS |
786 | 807 |
// further interrupt signals |
787 | 808 |
MODULE_INIT_INTERRUPTS(); |
... | ... | |
803 | 824 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) |
804 | 825 |
aosShellAddCommand(&aos.shell, &_shellcmd_kerneltest); |
805 | 826 |
#endif |
806 |
#endif |
|
827 |
#endif /* AMIROOS_CFG_SHELL_ENABLE == true */
|
|
807 | 828 |
|
808 | 829 |
return; |
809 | 830 |
} |
... | ... | |
813 | 834 |
*/ |
814 | 835 |
inline void aosSysStart(void) |
815 | 836 |
{ |
837 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
816 | 838 |
// update the system SSSP stage |
817 | 839 |
aos.sssp.stage = AOS_SSSP_OPERATION; |
818 | 840 |
|
... | ... | |
828 | 850 |
chSysUnlock(); |
829 | 851 |
} |
830 | 852 |
#endif |
853 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
831 | 854 |
|
832 | 855 |
// print system information; |
833 | 856 |
_printSystemInfo((BaseSequentialStream*)&aos.iostream); |
... | ... | |
845 | 868 |
return; |
846 | 869 |
} |
847 | 870 |
|
871 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__) |
|
848 | 872 |
/** |
849 | 873 |
* @brief Implements the SSSP startup synchronization step. |
850 | 874 |
* |
... | ... | |
895 | 919 |
return m; |
896 | 920 |
} |
897 | 921 |
} |
922 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
898 | 923 |
|
899 | 924 |
/** |
900 | 925 |
* @brief Retrieves the system uptime. |
... | ... | |
953 | 978 |
// check arguments |
954 | 979 |
aosDbgCheck(shutdown != AOS_SHUTDOWN_NONE); |
955 | 980 |
|
981 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
956 | 982 |
#if (AMIROOS_CFG_SSSP_MASTER == true) |
957 | 983 |
// deactivate the system synchronization timer |
958 | 984 |
chVTReset(&_syssynctimer); |
... | ... | |
969 | 995 |
// activate the SYS_SYNC signal |
970 | 996 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_ON); |
971 | 997 |
chSysUnlock(); |
998 |
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */ |
|
972 | 999 |
|
973 | 1000 |
switch (shutdown) { |
974 | 1001 |
case AOS_SHUTDOWN_PASSIVE: |
... | ... | |
997 | 1024 |
break; |
998 | 1025 |
} |
999 | 1026 |
|
1027 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
1000 | 1028 |
// update the system SSSP stage |
1001 | 1029 |
aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_2; |
1030 |
#endif |
|
1002 | 1031 |
|
1003 | 1032 |
return; |
1004 | 1033 |
} |
... | ... | |
1037 | 1066 |
// disable all interrupts |
1038 | 1067 |
irqDeinit(); |
1039 | 1068 |
|
1069 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
1040 | 1070 |
// update the system SSSP stage |
1041 | 1071 |
aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_3; |
1072 |
#endif |
|
1042 | 1073 |
|
1043 | 1074 |
// call bootloader callback depending on arguments |
1044 | 1075 |
switch (shutdown) { |
modules/DiWheelDrive_1-1/aosconf.h | ||
---|---|---|
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
/** |
20 |
* @file
|
|
20 |
* @file |
|
21 | 21 |
* @brief AMiRo-OS Configuration file for the DiWheelDrive v1.1 module. |
22 | 22 |
* @details Contains the application specific AMiRo-OS settings. |
23 | 23 |
* |
... | ... | |
98 | 98 |
/*===========================================================================*/ |
99 | 99 |
|
100 | 100 |
/** |
101 |
* @brief Flag to enable SSSP. |
|
102 |
*/ |
|
103 |
#if !defined(OS_CFG_SSSP_ENABLE) |
|
104 |
#define AMIROOS_CFG_SSSP_ENABLE true |
|
105 |
#else |
|
106 |
#define AMIROOS_CFG_SSSP_ENABLE OS_CFG_SSSP_ENABLE |
|
107 |
#endif |
|
108 |
|
|
109 |
/** |
|
101 | 110 |
* @brief Flag to set the module as SSSP master. |
102 | 111 |
* @details There must be only one module with this flag set to true in a system. |
103 | 112 |
*/ |
modules/LightRing_1-0/aosconf.h | ||
---|---|---|
98 | 98 |
/*===========================================================================*/ |
99 | 99 |
|
100 | 100 |
/** |
101 |
* @brief Flag to enable SSSP. |
|
102 |
*/ |
|
103 |
#if !defined(OS_CFG_SSSP_ENABLE) |
|
104 |
#define AMIROOS_CFG_SSSP_ENABLE true |
|
105 |
#else |
|
106 |
#define AMIROOS_CFG_SSSP_ENABLE OS_CFG_SSSP_ENABLE |
|
107 |
#endif |
|
108 |
|
|
109 |
/** |
|
101 | 110 |
* @brief Flag to set the module as SSSP master. |
102 | 111 |
* @details There must be only one module with this flag set to true in a system. |
103 | 112 |
*/ |
modules/PowerManagement_1-1/aosconf.h | ||
---|---|---|
98 | 98 |
/*===========================================================================*/ |
99 | 99 |
|
100 | 100 |
/** |
101 |
* @brief Flag to enable SSSP. |
|
102 |
*/ |
|
103 |
#if !defined(OS_CFG_SSSP_ENABLE) |
|
104 |
#define AMIROOS_CFG_SSSP_ENABLE true |
|
105 |
#else |
|
106 |
#define AMIROOS_CFG_SSSP_ENABLE OS_CFG_SSSP_ENABLE |
|
107 |
#endif |
|
108 |
|
|
109 |
/** |
|
101 | 110 |
* @brief Flag to set the module as SSSP master. |
102 | 111 |
* @details There must be only one module with this flag set to true in a system. |
103 | 112 |
*/ |
Also available in: Unified diff