64 |
64 |
*/
|
65 |
65 |
#define DELAYEVENT_MASK EVENT_MASK(4)
|
66 |
66 |
|
67 |
|
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__)
|
|
67 |
#if ((AMIROOS_CFG_SSSP_ENABLE == true) && (HAL_USE_CAN == TRUE)) || defined(__DOXYGEN__)
|
|
68 |
#define SSSP_STAGE3_ENABLE true
|
|
69 |
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) && (HAL_USE_CAN == TRUE) */
|
|
70 |
#define SSSP_STAGE3_ENABLE false
|
|
71 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) && (HAL_USE_CAN == TRUE) */
|
|
72 |
|
|
73 |
#if (SSSP_STAGE3_ENABLE == true) || defined(__DOXYGEN__)
|
68 |
74 |
|
69 |
75 |
/**
|
70 |
76 |
* @brief CAN message identifier for initialization of the SSSP stack initialization sequence.
|
... | ... | |
81 |
87 |
*/
|
82 |
88 |
#define SSSP_STACKINIT_CANMSGID_ABORT 0x001
|
83 |
89 |
|
84 |
|
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */
|
|
90 |
#endif /* (SSSP_STAGE3_ENABLE == true) */
|
85 |
91 |
|
|
92 |
#if (AMIROOS_CFG_SSSP_ENABLE != true) || defined(__DOXYGEN__)
|
86 |
93 |
/**
|
87 |
94 |
* @brief Default shutdown mode if SSSP is unavailable.
|
88 |
95 |
*/
|
89 |
96 |
#define AOS_SHUTDOWN_DEFAULT AOS_SHUTDOWN_DEEPSLEEP
|
90 |
|
|
91 |
97 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
|
92 |
98 |
|
|
99 |
#if (HAL_USE_CAN == TRUE) || defined(__DOXYGEN__)
|
93 |
100 |
/**
|
94 |
101 |
* @brief CAN message identifier for calender synchronization message.
|
95 |
102 |
*/
|
96 |
103 |
#define CALENDERSYNC_CANMSGID 0x004
|
|
104 |
#endif /* (HAL_USE_CAN == TRUE) */
|
97 |
105 |
|
98 |
106 |
/******************************************************************************/
|
99 |
107 |
/* EXPORTED VARIABLES */
|
... | ... | |
159 |
167 |
return;
|
160 |
168 |
}
|
161 |
169 |
|
162 |
|
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__)
|
|
170 |
#if (SSSP_STAGE3_ENABLE == true) || defined(__DOXYGEN__)
|
163 |
171 |
/**
|
164 |
172 |
* @brief Callback function to be used during SSSP stack initialization sequence.
|
165 |
173 |
*
|
... | ... | |
175 |
183 |
|
176 |
184 |
return;
|
177 |
185 |
}
|
178 |
|
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
|
|
186 |
#endif /* (SSSP_STAGE3_ENABLE == true) */
|
179 |
187 |
|
180 |
188 |
/**
|
181 |
189 |
* @brief Helper function to serialize data.
|
... | ... | |
278 |
286 |
|
279 |
287 |
#endif /* (HAL_USE_RTC == TRUE) */
|
280 |
288 |
|
281 |
|
#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__)
|
|
289 |
#if (SSSP_STAGE3_ENABLE) || defined(__DOXYGEN__)
|
282 |
290 |
/**
|
283 |
291 |
* @brief Implementation of the SSSP module stack initialization sequence (startup phase 3).
|
284 |
292 |
*
|
... | ... | |
885 |
893 |
|
886 |
894 |
return shutdown;
|
887 |
895 |
}
|
888 |
|
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
|
|
896 |
#endif /* (SSSP_STAGE3_ENABLE == true) */
|
889 |
897 |
|
890 |
898 |
/**
|
891 |
899 |
* @brief Application entry point.
|
... | ... | |
990 |
998 |
#if defined(MODULE_INIT_PERIPHERY_COMM)
|
991 |
999 |
MODULE_INIT_PERIPHERY_COMM();
|
992 |
1000 |
#endif /* defined(MODULE_INIT_PERIPHERY_COMM) */
|
993 |
|
#if (AMIROOS_CFG_SSSP_ENABLE == true)
|
994 |
|
// CAN (mandatory)
|
995 |
|
canStart(&MODULE_HAL_CAN, &moduleHalCanConfig);
|
996 |
|
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
|
|
1001 |
#if (SSSP_STAGE3_ENABLE == true )
|
|
1002 |
// CAN
|
|
1003 |
if (MODULE_HAL_CAN.state == CAN_STOP) {
|
|
1004 |
canStart(&MODULE_HAL_CAN, &moduleHalCanConfig);
|
|
1005 |
}
|
|
1006 |
#endif /* (SSSP_STAGE3_ENABLE == true) */
|
997 |
1007 |
// user interface (if any)
|
998 |
1008 |
#if defined(MODULE_HAL_PROGIF)
|
999 |
1009 |
aosIOChannelInit(&_stdiochannel, (BaseAsynchronousChannel*)&MODULE_HAL_PROGIF);
|
... | ... | |
1088 |
1098 |
}
|
1089 |
1099 |
}
|
1090 |
1100 |
|
|
1101 |
#if (HAL_USE_CAN == TRUE)
|
|
1102 |
|
1091 |
1103 |
/*
|
1092 |
1104 |
* There must be no delays at this point, thus no hook is allowed.
|
1093 |
1105 |
*/
|
... | ... | |
1096 |
1108 |
if (shutdown == AOS_SHUTDOWN_NONE) {
|
1097 |
1109 |
shutdown = _ssspModuleStackInitialization();
|
1098 |
1110 |
}
|
1099 |
|
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
|
1100 |
1111 |
|
1101 |
1112 |
/*
|
1102 |
1113 |
* There must be no delays at this point, thus no hook is allowed.
|
1103 |
1114 |
*/
|
1104 |
1115 |
|
1105 |
|
#if (AMIROOS_CFG_SSSP_ENABLE == true) && (HAL_USE_RTC == TRUE)
|
|
1116 |
#if (HAL_USE_RTC == TRUE)
|
1106 |
1117 |
/* synchronize calendars */
|
1107 |
1118 |
if (shutdown == AOS_SHUTDOWN_NONE) {
|
1108 |
1119 |
#if (AMIROOS_CFG_SSSP_MASTER == true)
|
... | ... | |
1160 |
1171 |
#endif /* (AMIROOS_CFG_SSSP_MASTER == true) */
|
1161 |
1172 |
aosDbgPrintf("\n");
|
1162 |
1173 |
}
|
1163 |
|
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) && (HAL_USE_RTC == TRUE) */
|
|
1174 |
#endif /* (HAL_USE_RTC == TRUE) */
|
|
1175 |
#endif /* (HAL_USE_CAN == TRUE) */
|
|
1176 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
|
1164 |
1177 |
|
1165 |
1178 |
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_8)
|
1166 |
1179 |
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_8_ARGS)
|
... | ... | |
1324 |
1337 |
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3) */
|
1325 |
1338 |
|
1326 |
1339 |
/* stop all periphery communication */
|
1327 |
|
#if (AMIROOS_CFG_SSSP_ENABLE == true)
|
1328 |
|
// CAN (mandatory)
|
1329 |
|
canStop(&MODULE_HAL_CAN);
|
1330 |
|
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
|
1331 |
1340 |
#if defined(MODULE_SHUTDOWN_PERIPHERY_COMM)
|
1332 |
1341 |
MODULE_SHUTDOWN_PERIPHERY_COMM();
|
1333 |
1342 |
#endif /* defined(MODULE_SHUTDOWN_PERIPHERY_COMM) */
|
|
1343 |
#if (HAL_USE_CAN == TRUE)
|
|
1344 |
if (MODULE_HAL_CAN.state != CAN_STOP) {
|
|
1345 |
canStop(&MODULE_HAL_CAN);
|
|
1346 |
}
|
|
1347 |
#endif /* (HAL_USE_CAN == TRUE) */
|
1334 |
1348 |
|
1335 |
1349 |
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_4)
|
1336 |
1350 |
#if defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_4_ARGS)
|