commit cda1472944648652764c6980f5ee3f3e91459ef3
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Mon Oct 28 11:15:03 2019 +0100

    Major SSSP overhaul:
    - SSSP no works even without Bootloader (AMiRo-OS implements startup and shutdown phases)
    - MSI and calendar synchronization are currently not available (WIP)
    - lots of minor changes

diff --git a/modules/PowerManagement_1-2/module.h b/modules/PowerManagement_1-2/module.h
index 5123605..6861ade 100644
--- a/modules/PowerManagement_1-2/module.h
+++ b/modules/PowerManagement_1-2/module.h
@@ -322,114 +322,113 @@ extern ROMCONST apalControlGpio_t moduleGpioChargeEn2;
 /**
  * @brief   Event flag to be set on a IR_INT1 / CHARGE_STAT1A interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_IRINT1           AOS_IOEVENT_FLAG(PAL_PAD(LINE_IR_INT1_N))
+#define MODULE_OS_GPIOEVENTFLAG_IRINT1          AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IR_INT1_N))
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATLOW1 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATLOW1     AOS_IOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATLOW1))
+#define MODULE_OS_GPIOEVENTFLAG_GAUGEBATLOW1    AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATLOW1))
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATGD1 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATGD1      AOS_IOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATGD1_N))
+#define MODULE_OS_GPIOEVENTFLAG_GAUGEBATGD1     AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATGD1_N))
 
 /**
  * @brief   Event flag to be set on a SYS_UART_DN interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN        AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_DN))
+#define MODULE_OS_GPIOEVENTFLAG_SYSUARTDN       AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_DN))
 
 /**
  * @brief   Event flag to be set on a IR_INT2 / CHARGE_STAT2A interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_IRINT2           AOS_IOEVENT_FLAG(PAL_PAD(LINE_IR_INT2_N))
+#define MODULE_OS_GPIOEVENTFLAG_IRINT2          AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IR_INT2_N))
 
 /**
  * @brief   Event flag to be set on a TOUCH_INT interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_TOUCHINT         AOS_IOEVENT_FLAG(PAL_PAD(LINE_TOUCH_INT_N))
+#define MODULE_OS_GPIOEVENTFLAG_TOUCHINT        AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_TOUCH_INT_N))
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATLOW2 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATLOW2     AOS_IOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATLOW2))
+#define MODULE_OS_GPIOEVENTFLAG_GAUGEBATLOW2    AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATLOW2))
 
 /**
  * @brief   Event flag to be set on a GAUGE_BATGD2 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_GAUGEBATGD2      AOS_IOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATGD2_N))
+#define MODULE_OS_GPIOEVENTFLAG_GAUGEBATGD2     AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_GAUGE_BATGD2_N))
 
 /**
  * @brief   Event flag to be set on a PATH_DC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_PATHDC           AOS_IOEVENT_FLAG(PAL_PAD(LINE_PATH_DC))
+#define MODULE_OS_GPIOEVENTFLAG_PATHDC          AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_PATH_DC))
 
 /**
  * @brief   Event flag to be set on a SYS_SPI_DIR interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSSPIDIR        AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_SPI_DIR))
+#define MODULE_OS_GPIOEVENTFLAG_SYSSPIDIR       AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_SPI_DIR))
 
 /**
  * @brief   Event flag to be set on a SYS_SYNC interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
+#define MODULE_OS_GPIOEVENTFLAG_SYSSYNC         AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
 
 /**
  * @brief   Event flag to be set on a SYS_PD interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSPD            AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
+#define MODULE_OS_GPIOEVENTFLAG_SYSPD           AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
 
 /**
  * @brief   Event flag to be set on a SYS_WARMRST interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST       AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_WARMRST_N))
+#define MODULE_OS_GPIOEVENTFLAG_SYSWARMRST      AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_WARMRST_N))
 
 /**
  * @brief   Event flag to be set on a SYS_UART_UP interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP        AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
+#define MODULE_OS_GPIOEVENTFLAG_SYSUARTUP       AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
 
-#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
+#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
 /**
  * @brief   Shell prompt text.
  */
 extern ROMCONST char* moduleShellPrompt;
-#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
+#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) */
 
 /**
  * @brief   Interrupt initialization macro.
- * @note    SSSP related interrupt signals are already initialized in 'aos_system.c'.
  */
 #define MODULE_INIT_INTERRUPTS() {                                            \
   /* IR_INT1 */                                                               \
-  palSetLineCallback(moduleGpioIrInt1.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioIrInt1.gpio->line);  \
+  palSetLineCallback(moduleGpioIrInt1.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioIrInt1.gpio->line);  \
   palEnableLineEvent(moduleGpioIrInt1.gpio->line, APAL2CH_EDGE(moduleGpioIrInt1.meta.edge));                  \
   /* GAUGE_BATLOW2 */                                                         \
-  palSetLineCallback(moduleGpioGaugeBatLow2.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioGaugeBatLow2.gpio->line);  \
+  palSetLineCallback(moduleGpioGaugeBatLow2.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioGaugeBatLow2.gpio->line);  \
   palEnableLineEvent(moduleGpioGaugeBatLow2.gpio->line, APAL2CH_EDGE(moduleGpioGaugeBatLow2.meta.edge));                  \
   /* GAUGE_BATGD2 */                                                          \
-  palSetLineCallback(moduleGpioGaugeBatGd2.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioGaugeBatGd2.gpio->line);  \
+  palSetLineCallback(moduleGpioGaugeBatGd2.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioGaugeBatGd2.gpio->line);  \
   palEnableLineEvent(moduleGpioGaugeBatGd2.gpio->line, APAL2CH_EDGE(moduleGpioGaugeBatGd2.meta.edge));                  \
   /* GAUGE_BATLOW1 */                                                         \
-  palSetLineCallback(moduleGpioGaugeBatLow1.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioGaugeBatLow1.gpio->line);  \
+  palSetLineCallback(moduleGpioGaugeBatLow1.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioGaugeBatLow1.gpio->line);  \
   palEnableLineEvent(moduleGpioGaugeBatLow1.gpio->line, APAL2CH_EDGE(moduleGpioGaugeBatLow1.meta.edge));                  \
   /* GAUGE_BATGD1 */                                                          \
-  palSetLineCallback(moduleGpioGaugeBatGd1.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioGaugeBatGd1.gpio->line);  \
+  palSetLineCallback(moduleGpioGaugeBatGd1.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioGaugeBatGd1.gpio->line);  \
   palEnableLineEvent(moduleGpioGaugeBatGd1.gpio->line, APAL2CH_EDGE(moduleGpioGaugeBatGd1.meta.edge));                  \
   /* IR_INT2 */                                                               \
-  palSetLineCallback(moduleGpioIrInt2.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioIrInt2.gpio->line);  \
+  palSetLineCallback(moduleGpioIrInt2.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioIrInt2.gpio->line);  \
   palEnableLineEvent(moduleGpioIrInt2.gpio->line, APAL2CH_EDGE(moduleGpioIrInt2.meta.edge));                  \
   /* TOUCH_INT */                                                             \
-  palSetLineCallback(moduleGpioTouchInt.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioTouchInt.gpio->line);  \
+  palSetLineCallback(moduleGpioTouchInt.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioTouchInt.gpio->line);  \
   palEnableLineEvent(moduleGpioTouchInt.gpio->line, APAL2CH_EDGE(moduleGpioTouchInt.meta.edge));                  \
   /* PATH_DC */                                                               \
-  palSetLineCallback(moduleGpioPathDc.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioPathDc.gpio->line);  \
+  palSetLineCallback(moduleGpioPathDc.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioPathDc.gpio->line);  \
   palEnableLineEvent(moduleGpioPathDc.gpio->line, APAL2CH_EDGE(moduleGpioPathDc.meta.edge));                  \
   /* SYS_SPI_DIR */                                                           \
-  palSetLineCallback(moduleGpioSysSpiDir.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioSysSpiDir.gpio->line);  \
+  palSetLineCallback(moduleGpioSysSpiDir.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioSysSpiDir.gpio->line);  \
   palEnableLineEvent(moduleGpioSysSpiDir.gpio->line, APAL2CH_EDGE(moduleGpioSysSpiDir.meta.edge));                  \
   /* SYS_WARMRST */                                                           \
-  palSetLineCallback(moduleGpioSysWarmrst.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioSysWarmrst.gpio->line);  \
+  palSetLineCallback(moduleGpioSysWarmrst.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioSysWarmrst.gpio->line);  \
   palEnableLineEvent(moduleGpioSysWarmrst.gpio->line, APAL2CH_EDGE(moduleGpioSysWarmrst.meta.edge));                  \
 }
 
@@ -437,7 +436,7 @@ extern ROMCONST char* moduleShellPrompt;
  * @brief   Test initialization hook.
  */
 #define MODULE_INIT_TESTS() {                                                 \
-  /* add unit-test shell commands */                                          \
+  /* add test commands to shell */                                            \
   aosShellAddCommand(&aos.shell, &moduleTestAdcShellCmd);                     \
   aosShellAddCommand(&aos.shell, &moduleTestAt24c01bShellCmd);                \
   aosShellAddCommand(&aos.shell, &moduleTestBq241xxShellCmd);                 \
@@ -496,6 +495,8 @@ extern ROMCONST char* moduleShellPrompt;
   pwmStop(&MODULE_HAL_PWM_BUZZER);                                            \
   moduleHalPwmBuzzerConfig.period = moduleHalPwmBuzzerConfig.frequency / PKxxxExxx_LLD_FREQUENCY_SPEC; \
   pwmStart(&MODULE_HAL_PWM_BUZZER, &moduleHalPwmBuzzerConfig);                \
+  /* CAN */                                                                   \
+  canStart(&MODULE_HAL_CAN, &moduleHalCanConfig);                             \
 }
 #if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__)
   #define MODULE_INIT_PERIPHERY_IF_SENSORRING() {                             \
@@ -525,6 +526,8 @@ extern ROMCONST char* moduleShellPrompt;
  * @brief   Periphery communication interface deinitialization hook.
  */
 #define MODULE_SHUTDOWN_PERIPHERY_IF() {                                      \
+  /* CAN */                                                                   \
+  canStop(&MODULE_HAL_CAN);                                                   \
   /* PWM */                                                                   \
   pwmStop(&MODULE_HAL_PWM_BUZZER);                                            \
   /* ADC */                                                                   \
@@ -544,45 +547,49 @@ extern ROMCONST char* moduleShellPrompt;
  */
 /*===========================================================================*/
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__)
+
 /**
  * @brief   PD signal GPIO.
  */
-#define moduleSsspGpioPd                        moduleGpioSysPd
+#define moduleSsspGpioPD                        moduleGpioSysPd
 
 /**
- * @brief   SYNC signal GPIO.
+ * @brief   S signal GPIO.
  */
-#define moduleSsspGpioSync                       moduleGpioSysSync
+#define moduleSsspGpioS                         moduleGpioSysSync
 
 /**
  * @brief   DN signal GPIO.
  */
-#define moduleSsspGpioDn                        moduleGpioSysUartDn
+#define moduleSsspGpioDN                        moduleGpioSysUartDn
 
 /**
  * @brief   UP signal GPIO.
  */
-#define moduleSsspGpioUp                        moduleGpioSysUartUp
+#define moduleSsspGpioUP                        moduleGpioSysUartUp
 
 /**
- * @brief   Event flags for PD signal events.
+ * @brief   Event flag for PD signal events.
  */
-#define MODULE_SSSP_EVENTFLAGS_PD               MODULE_OS_IOEVENTFLAGS_SYSPD
+#define MODULE_SSSP_EVENTFLAG_PD                MODULE_OS_GPIOEVENTFLAG_SYSPD
 
 /**
- * @brief   Event flags for SYNC signal events.
+ * @brief   Event flag for S signal events.
  */
-#define MODULE_SSSP_EVENTFLAGS_SYNC             MODULE_OS_IOEVENTFLAGS_SYSSYNC
+#define MODULE_SSSP_EVENTFLAG_S                 MODULE_OS_GPIOEVENTFLAG_SYSSYNC
 
 /**
- * @brief   Event flags for UP signal events.
+ * @brief   Event flag for UP signal events.
  */
-#define MODULE_SSSP_EVENTFLAGS_UP               MODULE_OS_IOEVENTFLAGS_SYSUARTUP
+#define MODULE_SSSP_EVENTFLAG_UP                MODULE_OS_GPIOEVENTFLAG_SYSUARTUP
 
 /**
- * @brief   Event flags for DN signal events.
+ * @brief   Event flag for DN signal events.
  */
-#define MODULE_SSSP_EVENTFLAGS_DN               MODULE_OS_IOEVENTFLAGS_SYSUARTDN
+#define MODULE_SSSP_EVENTFLAG_DN                MODULE_OS_GPIOEVENTFLAG_SYSUARTDN
+
+#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */
 
 /** @} */
 
