Revision 41fc7088

View differences:

core/src/aos_main.cpp
947 947
#else
948 948
  chEvtRegisterMaskWithFlags(&aos.events.io, &_eventListenerIO, IOEVENT_MASK, MODULE_SSSP_EVENTFLAGS_PD | MODULE_SSSP_EVENTFLAGS_SYNC | MODULE_SSSP_EVENTFLAGS_DN | MODULE_SSSP_EVENTFLAGS_UP);
949 949
#endif
950
#endif /* AMIROOS_CFG_SSSP_ENABLE == true */
950
#else /* AMIROOS_CFG_SSSP_ENABLE == false */
951
  chEvtRegisterMask(&aos.events.io, &_eventListenerIO, IOEVENT_MASK);
952
#endif /* AMIROOS_CFG_SSSP_ENABLE */
951 953
  chEvtRegisterMask(&aos.events.os, &_eventListenerOS, OSEVENT_MASK);
952 954

  
953 955
#if defined(AMIROOS_CFG_MAIN_INIT_HOOK_5)
......
1166 1168
        if (eventflags & MODULE_SSSP_EVENTFLAGS_PD) {
1167 1169
          shutdown = AOS_SHUTDOWN_PASSIVE;
1168 1170
        }
1169
#endif
1170 1171
        // all other events
1171 1172
#ifdef MODULE_MAIN_LOOP_IO_EVENT
1172 1173
        else {
1173 1174
          MODULE_MAIN_LOOP_IO_EVENT(eventmask, eventflags);
1174 1175
        }
1175 1176
#endif
1177
#else /* AMIROOS_CFG_SSSP_ENABLE == false */
1178
#ifdef MODULE_MAIN_LOOP_IO_EVENT
1179
        MODULE_MAIN_LOOP_IO_EVENT(eventmask, eventflags);
1180
#endif
1181
#endif /* AMIROOS_CFG_SSSP_ENABLE */
1176 1182
        break;
1177 1183

  
1178 1184
      // if this was an OS event
......
1201 1207
      // if this was any other event (should be impossible to occur)
1202 1208
      default:
1203 1209
        eventflags = 0;
1210
#if (AMIROOS_CFG_MAIN_LOOP_TIMEOUT == 0)
1204 1211
        _unexpectedEventError(eventmask, eventflags);
1212
#endif
1205 1213
        break;
1206 1214
    }
1207 1215

  
core/src/aos_system.c
1075 1075
  aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_3;
1076 1076
#endif
1077 1077

  
1078
  // call bootloader callback depending on arguments
1079
  switch (shutdown) {
1080
    case AOS_SHUTDOWN_PASSIVE:
1081
      BL_CALLBACK_TABLE_ADDRESS->cbHandleShutdownRequest();
1082
      break;
1083
    case AOS_SHUTDOWN_HIBERNATE:
1084
      BL_CALLBACK_TABLE_ADDRESS->cbShutdownHibernate();
1085
      break;
1086
    case AOS_SHUTDOWN_DEEPSLEEP:
1087
      BL_CALLBACK_TABLE_ADDRESS->cbShutdownDeepsleep();
1088
      break;
1089
    case AOS_SHUTDOWN_TRANSPORTATION:
1090
      BL_CALLBACK_TABLE_ADDRESS->cbShutdownTransportation();
1091
      break;
1092
    case AOS_SHUTDOWN_RESTART:
1093
      BL_CALLBACK_TABLE_ADDRESS->cbShutdownRestart();
1094
      break;
1095
    // must never occur
1096
    case AOS_SHUTDOWN_NONE:
1097
    default:
1098
      break;
1078
  // validate bootloader
1079
  if ((BL_CALLBACK_TABLE_ADDRESS->magicNumber == BL_MAGIC_NUMBER) &&
1080
      (BL_CALLBACK_TABLE_ADDRESS->vBootloader.major == BL_VERSION_MAJOR) &&
1081
      (BL_CALLBACK_TABLE_ADDRESS->vBootloader.minor >= BL_VERSION_MINOR)) {
1082
    // call bootloader callback depending on arguments
1083
    switch (shutdown) {
1084
      case AOS_SHUTDOWN_PASSIVE:
1085
        BL_CALLBACK_TABLE_ADDRESS->cbHandleShutdownRequest();
1086
        break;
1087
      case AOS_SHUTDOWN_HIBERNATE:
1088
        BL_CALLBACK_TABLE_ADDRESS->cbShutdownHibernate();
1089
        break;
1090
      case AOS_SHUTDOWN_DEEPSLEEP:
1091
        BL_CALLBACK_TABLE_ADDRESS->cbShutdownDeepsleep();
1092
        break;
1093
      case AOS_SHUTDOWN_TRANSPORTATION:
1094
        BL_CALLBACK_TABLE_ADDRESS->cbShutdownTransportation();
1095
        break;
1096
      case AOS_SHUTDOWN_RESTART:
1097
        BL_CALLBACK_TABLE_ADDRESS->cbShutdownRestart();
1098
        break;
1099
      // must never occur
1100
      case AOS_SHUTDOWN_NONE:
1101
      default:
1102
        break;
1103
    }
1104
  } else {
1105
    // fallback if bootloader was found to be invalid
1106
    aosprintf("Bootloader incompatible or not available!\n");
1107
    chThdSleep(TIME_INFINITE);
1099 1108
  }
1100 1109

  
1101 1110
  return;

Also available in: Unified diff