Revision 1d3e002f core/src/aos_system.c
core/src/aos_system.c | ||
---|---|---|
141 | 141 |
* @brief Shell command to shutdown the system. |
142 | 142 |
*/ |
143 | 143 |
static aos_shellcommand_t _shellcmd_shutdown = { |
144 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
144 | 145 |
/* name */ "system:shutdown", |
146 |
#else |
|
147 |
/* name */ "module:shutdown", |
|
148 |
#endif |
|
145 | 149 |
/* callback */ _shellcmd_shutdowncb, |
146 | 150 |
/* next */ NULL, |
147 | 151 |
}; |
... | ... | |
544 | 548 |
{ |
545 | 549 |
aosDbgCheck(stream != NULL); |
546 | 550 |
|
551 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
|
547 | 552 |
// print help text |
548 | 553 |
if (argc != 2 || strcmp(argv[1], "--help") == 0) { |
549 | 554 |
chprintf(stream, "Usage: %s OPTION\n", argv[0]); |
... | ... | |
591 | 596 |
return AOS_INVALID_ARGUMENTS; |
592 | 597 |
} |
593 | 598 |
} |
599 |
#else /* AMIROOS_CFG_SSSP_ENABLE == false */ |
|
600 |
(void)argv; |
|
601 |
(void)argc; |
|
602 |
|
|
603 |
chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_SHUTDOWN); |
|
604 |
chThdTerminate(chThdGetSelfX()); |
|
605 |
return AOS_OK; |
|
606 |
#endif /* AMIROOS_CFG_SSSP_ENABLE */ |
|
594 | 607 |
} |
595 | 608 |
|
596 | 609 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
... | ... | |
991 | 1004 |
// update the system SSSP stage |
992 | 1005 |
aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_1; |
993 | 1006 |
|
994 |
// activate the SYS_PD control signal only, if this module initiated the shutdown |
|
995 | 1007 |
chSysLock(); |
1008 |
// activate the SYS_PD control signal only, if this module initiated the shutdown |
|
996 | 1009 |
if (shutdown != AOS_SHUTDOWN_PASSIVE) { |
997 | 1010 |
apalControlGpioSet(&moduleSsspGpioPd, APAL_GPIO_ON); |
998 | 1011 |
} |
... | ... | |
1022 | 1035 |
chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_RESTART); |
1023 | 1036 |
aosprintf("restarting system...\n"); |
1024 | 1037 |
break; |
1025 |
// must never occur |
|
1026 |
case AOS_SHUTDOWN_NONE: |
|
1027 |
default: |
|
1038 |
// must never occur
|
|
1039 |
case AOS_SHUTDOWN_NONE:
|
|
1040 |
default:
|
|
1028 | 1041 |
break; |
1029 | 1042 |
} |
1030 | 1043 |
|
Also available in: Unified diff