Code cleanup and simplification.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14189 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
519b4aa13c
commit
bee30522c4
|
@ -31,41 +31,6 @@ static const ShellConfig shell_cfg1 = {
|
||||||
commands
|
commands
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Core 1 OS instance.
|
|
||||||
*/
|
|
||||||
os_instance_t ch1;
|
|
||||||
|
|
||||||
#if (CH_CFG_NO_IDLE_THREAD == FALSE) || defined(__DOXYGEN__)
|
|
||||||
/**
|
|
||||||
* @brief Default instance idle thread working area.
|
|
||||||
*/
|
|
||||||
THD_WORKING_AREA(ch_c1_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
|
|
||||||
extern stkalign_t __c1_main_thread_stack_base__, __c1_main_thread_stack_end__;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Core 1 OS instance configuration.
|
|
||||||
*/
|
|
||||||
static const os_instance_config_t core1_cfg = {
|
|
||||||
.name = "c1",
|
|
||||||
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
|
|
||||||
.mainthread_base = &__c1_main_thread_stack_base__,
|
|
||||||
.mainthread_end = &__c1_main_thread_stack_end__,
|
|
||||||
#elif CH_CFG_USE_DYNAMIC == TRUE
|
|
||||||
.mainthread_base = NULL,
|
|
||||||
.mainthread_end = NULL,
|
|
||||||
#endif
|
|
||||||
#if CH_CFG_NO_IDLE_THREAD == FALSE
|
|
||||||
.idlethread_base = THD_WORKING_AREA_BASE(ch_c1_idle_thread_wa),
|
|
||||||
.idlethread_end = THD_WORKING_AREA_END(ch_c1_idle_thread_wa)
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Green LED blinker thread, times are in milliseconds.
|
* Green LED blinker thread, times are in milliseconds.
|
||||||
*/
|
*/
|
||||||
|
@ -91,7 +56,7 @@ void c1_main(void) {
|
||||||
* system initialization on the other side.
|
* system initialization on the other side.
|
||||||
*/
|
*/
|
||||||
chSysWaitSystemState(ch_sys_running);
|
chSysWaitSystemState(ch_sys_running);
|
||||||
chSchObjectInit(&ch1, &core1_cfg);
|
chSchObjectInit(&ch1, &ch_core1_cfg);
|
||||||
|
|
||||||
/* It is alive now.*/
|
/* It is alive now.*/
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
|
|
@ -292,10 +292,17 @@
|
||||||
|
|
||||||
#if !defined(__DOXYGEN__)
|
#if !defined(__DOXYGEN__)
|
||||||
extern ch_system_t ch_system;
|
extern ch_system_t ch_system;
|
||||||
|
|
||||||
|
extern const os_instance_config_t ch_core0_cfg;
|
||||||
extern os_instance_t ch0;
|
extern os_instance_t ch0;
|
||||||
extern stkalign_t ch_idle_thread_wa[];
|
|
||||||
|
#if PORT_CORES_NUMBER > 1
|
||||||
|
extern const os_instance_config_t ch_core1_cfg;
|
||||||
|
extern os_instance_t ch1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* !defined(__DOXYGEN__) */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,17 +45,75 @@
|
||||||
ch_system_t ch_system;
|
ch_system_t ch_system;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default OS instance.
|
* @brief Core 0 OS instance.
|
||||||
*/
|
*/
|
||||||
os_instance_t ch0;
|
os_instance_t ch0;
|
||||||
|
|
||||||
#if (CH_CFG_NO_IDLE_THREAD == FALSE) || defined(__DOXYGEN__)
|
#if (CH_CFG_NO_IDLE_THREAD == FALSE) || defined(__DOXYGEN__)
|
||||||
/**
|
/**
|
||||||
* @brief Default instance idle thread working area.
|
* @brief Working area for core 0 idle thread.
|
||||||
*/
|
*/
|
||||||
THD_WORKING_AREA(ch_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE);
|
THD_WORKING_AREA(ch_c0_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE);
|
||||||
|
|
||||||
|
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
|
||||||
|
extern stkalign_t __main_thread_stack_base__, __main_thread_stack_end__;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Core 0 OS instance configuration.
|
||||||
|
*/
|
||||||
|
const os_instance_config_t ch_core0_cfg = {
|
||||||
|
.name = "c0",
|
||||||
|
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
|
||||||
|
.mainthread_base = &__main_thread_stack_base__,
|
||||||
|
.mainthread_end = &__main_thread_stack_end__,
|
||||||
|
#elif CH_CFG_USE_DYNAMIC == TRUE
|
||||||
|
.mainthread_base = NULL,
|
||||||
|
.mainthread_end = NULL,
|
||||||
|
#endif
|
||||||
|
#if CH_CFG_NO_IDLE_THREAD == FALSE
|
||||||
|
.idlethread_base = THD_WORKING_AREA_BASE(ch_c0_idle_thread_wa),
|
||||||
|
.idlethread_end = THD_WORKING_AREA_END(ch_c0_idle_thread_wa)
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (PORT_CORES_NUMBER > 1) || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* @brief Core 1 OS instance.
|
||||||
|
*/
|
||||||
|
os_instance_t ch1;
|
||||||
|
|
||||||
|
#if (CH_CFG_NO_IDLE_THREAD == FALSE) || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* @brief Working area for core 1 idle thread.
|
||||||
|
*/
|
||||||
|
THD_WORKING_AREA(ch_c1_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
|
||||||
|
extern stkalign_t __c1_main_thread_stack_base__, __c1_main_thread_stack_end__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Core 1 OS instance configuration.
|
||||||
|
*/
|
||||||
|
const os_instance_config_t ch_core1_cfg = {
|
||||||
|
.name = "c1",
|
||||||
|
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
|
||||||
|
.mainthread_base = &__c1_main_thread_stack_base__,
|
||||||
|
.mainthread_end = &__c1_main_thread_stack_end__,
|
||||||
|
#elif CH_CFG_USE_DYNAMIC == TRUE
|
||||||
|
.mainthread_base = NULL,
|
||||||
|
.mainthread_end = NULL,
|
||||||
|
#endif
|
||||||
|
#if CH_CFG_NO_IDLE_THREAD == FALSE
|
||||||
|
.idlethread_base = THD_WORKING_AREA_BASE(ch_c1_idle_thread_wa),
|
||||||
|
.idlethread_end = THD_WORKING_AREA_END(ch_c1_idle_thread_wa)
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
#endif /* PORT_CORES_NUMBER > 1 */
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Module local types. */
|
/* Module local types. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -122,29 +180,7 @@ void chSysInit(void) {
|
||||||
__oslib_init();
|
__oslib_init();
|
||||||
|
|
||||||
/* Initializing default OS instance.*/
|
/* Initializing default OS instance.*/
|
||||||
{
|
chSchObjectInit(&ch0, &ch_core0_cfg);
|
||||||
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
|
|
||||||
extern stkalign_t __main_thread_stack_base__,
|
|
||||||
__main_thread_stack_end__;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const os_instance_config_t default_cfg = {
|
|
||||||
.name = "c0",
|
|
||||||
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
|
|
||||||
.mainthread_base = &__main_thread_stack_base__,
|
|
||||||
.mainthread_end = &__main_thread_stack_end__,
|
|
||||||
#elif CH_CFG_USE_DYNAMIC == TRUE
|
|
||||||
.mainthread_base = NULL,
|
|
||||||
.mainthread_end = NULL,
|
|
||||||
#endif
|
|
||||||
#if CH_CFG_NO_IDLE_THREAD == FALSE
|
|
||||||
.idlethread_base = THD_WORKING_AREA_BASE(ch_idle_thread_wa),
|
|
||||||
.idlethread_end = THD_WORKING_AREA_END(ch_idle_thread_wa)
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
chSchObjectInit(&ch0, &default_cfg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* It is alive now.*/
|
/* It is alive now.*/
|
||||||
ch_system.state = ch_sys_running;
|
ch_system.state = ch_sys_running;
|
||||||
|
|
Loading…
Reference in New Issue