Revision 2dd2e257 core/src/aos_system.c
| core/src/aos_system.c | ||
|---|---|---|
| 55 | 55 |
|
| 56 | 56 |
/* forward declarations */ |
| 57 | 57 |
static void _printSystemInfo(BaseSequentialStream* stream); |
| 58 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) |
|
| 58 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true)
|
|
| 59 | 59 |
static int _shellcmd_configcb(BaseSequentialStream* stream, int argc, char* argv[]); |
| 60 | 60 |
static int _shellcmd_infocb(BaseSequentialStream* stream, int argc, char* argv[]); |
| 61 | 61 |
static int _shellcmd_shutdowncb(BaseSequentialStream* stream, int argc, char* argv[]); |
| 62 | 62 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) |
| 63 | 63 |
static int _shellcmd_kerneltestcb(BaseSequentialStream* stream, int argc, char* argv[]); |
| 64 | 64 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
| 65 |
#endif /* AMIROOS_CFG_SHELL_ENABLE == true */
|
|
| 65 |
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
|
|
| 66 | 66 |
|
| 67 | 67 |
/** |
| 68 | 68 |
* @brief Timer to accumulate system uptime. |
| ... | ... | |
| 103 | 103 |
#define SYSTEM_SYSSYNCSKEW_LPFACTOR (0.1f / AOS_SYSTEM_TIME_RESOLUTION) |
| 104 | 104 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) && (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true) */ |
| 105 | 105 |
|
| 106 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
|
| 106 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
|
|
| 107 | 107 |
/** |
| 108 | 108 |
* @brief Shell thread working area. |
| 109 | 109 |
*/ |
| ... | ... | |
| 149 | 149 |
/* callback */ _shellcmd_shutdowncb, |
| 150 | 150 |
/* next */ NULL, |
| 151 | 151 |
}; |
| 152 |
#endif /* AMIROOS_CFG_SHELL_ENABLE == true */ |
|
| 153 | 152 |
|
| 154 | 153 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
| 155 | 154 |
/** |
| ... | ... | |
| 161 | 160 |
/* next */ NULL, |
| 162 | 161 |
}; |
| 163 | 162 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
| 163 |
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */ |
|
| 164 | 164 |
|
| 165 | 165 |
/** |
| 166 | 166 |
* @brief Global system object. |
| ... | ... | |
| 315 | 315 |
return; |
| 316 | 316 |
} |
| 317 | 317 |
|
| 318 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
|
| 318 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
|
|
| 319 | 319 |
/** |
| 320 | 320 |
* @brief Callback function for the system:config shell command. |
| 321 | 321 |
* |
| ... | ... | |
| 517 | 517 |
#endif /* AMIROOS_CFG_SSSP_MASTER != true && AMIROOS_CFG_PROFILE == true */ |
| 518 | 518 |
_printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH); |
| 519 | 519 |
|
| 520 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) |
|
| 521 | 520 |
// print shell info |
| 522 | 521 |
chprintf(stream, "System shell information:\n"); |
| 523 | 522 |
chprintf(stream, "\tnumber of commands: %u\n", aosShellCountCommands(&aos.shell)); |
| ... | ... | |
| 530 | 529 |
#endif /* CH_DBG_FILL_THREADS == TRUE */ |
| 531 | 530 |
#endif /* AMIROOS_CFG_DBG == true */ |
| 532 | 531 |
_printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH); |
| 533 |
#endif /* AMIROOS_CFG_SHELL_ENABLE == true */ |
|
| 534 | 532 |
|
| 535 | 533 |
return AOS_OK; |
| 536 | 534 |
} |
| ... | ... | |
| 630 | 628 |
return retval; |
| 631 | 629 |
} |
| 632 | 630 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
| 633 |
#endif /* AMIROOS_CFG_SHELL_ENABLE == true */
|
|
| 631 |
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
|
|
| 634 | 632 |
|
| 635 | 633 |
// suppress warning in case no interrupt GPIOs are defined |
| 636 | 634 |
#pragma GCC diagnostic push |
| ... | ... | |
| 760 | 758 |
* |
| 761 | 759 |
* @param[in] shellPrompt String to be printed as prompt of the system shell. |
| 762 | 760 |
*/ |
| 763 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
|
| 761 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
|
|
| 764 | 762 |
void aosSysInit(const char* shellPrompt) |
| 765 | 763 |
#else |
| 766 | 764 |
void aosSysInit(void) |
| ... | ... | |
| 827 | 825 |
MODULE_INIT_INTERRUPTS(); |
| 828 | 826 |
#endif |
| 829 | 827 |
|
| 830 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) |
|
| 828 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true)
|
|
| 831 | 829 |
/* init shell */ |
| 832 | 830 |
aosShellInit(&aos.shell, |
| 833 | 831 |
&aos.events.os, |
| ... | ... | |
| 843 | 841 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) |
| 844 | 842 |
aosShellAddCommand(&aos.shell, &_shellcmd_kerneltest); |
| 845 | 843 |
#endif |
| 846 |
#endif /* AMIROOS_CFG_SHELL_ENABLE == true */
|
|
| 844 |
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */
|
|
| 847 | 845 |
|
| 848 | 846 |
return; |
| 849 | 847 |
} |
| ... | ... | |
| 875 | 873 |
_printSystemInfo((BaseSequentialStream*)&aos.iostream); |
| 876 | 874 |
aosprintf("\n");
|
| 877 | 875 |
|
| 878 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) |
|
| 876 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true)
|
|
| 879 | 877 |
// start system shell thread |
| 880 | 878 |
#if (CH_CFG_USE_THREADHIERARCHY == TRUE) |
| 881 | 879 |
aos.shell.thread = chThdCreateStatic(_shell_wa, sizeof(_shell_wa), AMIROOS_CFG_SHELL_THREADPRIO, aosShellThread, &aos.shell, &ch.mainthread); |
| ... | ... | |
| 1056 | 1054 |
*/ |
| 1057 | 1055 |
void aosSysStop(void) |
| 1058 | 1056 |
{
|
| 1059 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) |
|
| 1057 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true)
|
|
| 1060 | 1058 |
chThdWait(aos.shell.thread); |
| 1061 | 1059 |
#endif |
| 1062 | 1060 |
|
Also available in: Unified diff