diff --git a/core/include/tos_k.h b/core/include/tos_k.h index 69ac2ed..b2f57bf 100644 --- a/core/include/tos_k.h +++ b/core/include/tos_k.h @@ -68,11 +68,5 @@ #endif #include #include -// #ifndef portGET_TASK_LOCK() -// #define portGET_TASK_LOCK() -// #endif -// #ifndef portRELEASE_TASK_LOCK() -// #define portRELEASE_TASK_LOCK() -// #endif #endif /* _TOS_K_H_ */ diff --git a/core/include/tos_sys.h b/core/include/tos_sys.h index 8af26d5..0147129 100644 --- a/core/include/tos_sys.h +++ b/core/include/tos_sys.h @@ -167,15 +167,61 @@ __API__ k_err_t tos_knl_sched_lock(void); * @retval K_ERR_NONE return successfully. */ __API__ k_err_t tos_knl_sched_unlock(void); -/////////////////new for smp////////////////////////////////////////// +//new API for smp #if (USE_SMP ==1u) -__API__ static void prvDisableInterruptsAndPortStartSchedulerOnCore( void ); -__API__ void smp_init_core0(void); +__KNL__ static void prvDisableInterruptsAndPortStartSchedulerOnCore( void ); +__KNL__ void smp_init_core0(void); +/** + * @brief init the kernels . + * + * @attention None + * + * @param None + * + * @return errcode + * @retval Non-#K_ERR_NONE return failed. + * @retval #K_ERR_NONE return successfully. + */ + __API__ k_err_t tos_knl_smp_init(void); __KNL__ int knl_is_idle_pre(k_task_t *task); +/** + * @brief start the kernels . + * + * @attention None + * + * @param None + * + * @return errcode + * @retval Non-#K_ERR_NONE return failed. + * @retval #K_ERR_NONE return successfully. + */ __API__ k_err_t tos_knl_start_smp(void); #if ( configUSE_CORE_AFFINITY == 1u ) +/** + * @brief Sets the core affinity mask for a task. + * It sets the cores on which a task can run. configUSE_CORE_AFFINITY must + be defined as 1 for this function to be available. + * + * @attention None + * + * @param[in] Task the task which is wanted to be affinited with the specific core + * CoreAffinityMask Define the core affinity mask + * Example usage:// on core 0 and core 2. + * uxCoreAffinityMask = ( ( 1 << 0 ) | ( 1 << 2 ) ); + * + * @return None + */ __API__ void tos_TaskCoreAffinitySet( k_task_t * Task, BaseType_t CoreAffinityMask ); +/** + * @brief Gets the core affinity mask for a task. + * + * @attention None + * + * @param[in] Task the task you want to get CoreAffinityMask from + * + * @return return the CoreAffinityMask + */ __API__ BaseType_t vTaskCoreAffinityGet( const k_task_t * Task ); #endif #endif diff --git a/core/tos_sys.c b/core/tos_sys.c index 2f8b5ad..ab10575 100644 --- a/core/tos_sys.c +++ b/core/tos_sys.c @@ -19,7 +19,7 @@ #if (USE_SMP ==1u) extern uint8_t ucPrimaryCoreNum ; -__API__ static void prvDisableInterruptsAndPortStartSchedulerOnCore( void ) +__KNL__ static void prvDisableInterruptsAndPortStartSchedulerOnCore( void ) { TOS_CPU_CPSR_ALLOC(); TOS_CPU_INT_DISABLE(); @@ -27,7 +27,7 @@ __API__ static void prvDisableInterruptsAndPortStartSchedulerOnCore( void ) tos_knl_start(); } -__API__ void smp_init_core0(void){ +__KNL__ void smp_init_core0(void){ /* No one else should use these! */ spin_lock_claim( configSMP_SPINLOCK_0 ); spin_lock_claim( configSMP_SPINLOCK_1 );