69#ifdef LOSCFG_KERNEL_SMP
71#ifdef LOSCFG_KERNEL_SMP_CALL
73#define MP_CALL_LOCK(state) LOS_SpinLockSave(&g_mpCallSpin, &(state))
74#define MP_CALL_UNLOCK(state) LOS_SpinUnlockRestore(&g_mpCallSpin, (state))
79 target &= ~(1U << cpuid);
123 if (taskCB->
signal & SIGNAL_KILL) {
126 PRINT_WARN(
"GC collect task failed err:0x%x\n", ret);
132#ifdef LOSCFG_KERNEL_SMP_CALL
153 if (!(target & OS_MP_CPU_ALL)) {
157 for (index = 0; index < LOSCFG_KERNEL_CORE_NUM; index++) {
158 if (CPUID_TO_AFFI_MASK(index) & target) {
160 if (mpCallFunc == NULL) {
161 PRINT_ERR(
"smp func call malloc failed\n");
164 mpCallFunc->
func = func;
165 mpCallFunc->
args = args;
167 MP_CALL_LOCK(intSave);
169 MP_CALL_UNLOCK(intSave);
189 MP_CALL_LOCK(intSave);
191 list = LOS_DL_LIST_FIRST(&
g_percpu[cpuid].funcLink);
193 MP_CALL_UNLOCK(intSave);
195 mpCallFunc = LOS_DL_LIST_ENTRY(list,
MpCallFunc, node);
199 MP_CALL_LOCK(intSave);
201 MP_CALL_UNLOCK(intSave);
208 for (index = 0; index < LOSCFG_KERNEL_CORE_NUM; index++) {
221#ifdef LOSCFG_KERNEL_SMP_CALL
VOID HalIrqSendIpi(UINT32 target, UINT32 ipi)
STATIC INLINE UINT32 LOS_IntLock(VOID)
Disable all interrupts. | 关闭当前处理器所有中断响应
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit(LOS_DL_LIST *list)
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelete(LOS_DL_LIST *node)
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListAdd(LOS_DL_LIST *list, LOS_DL_LIST *node)
Insert a new node to a doubly linked list.
LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_ListEmpty(LOS_DL_LIST *list)
Identify whether a specified doubly linked list is empty. | 判断链表是否为空
VOID * LOS_MemAlloc(VOID *pool, UINT32 size)
从指定内存池中申请size长度的内存,注意这可不是从内核堆空间中申请内存
UINT32 LOS_MemFree(VOID *pool, VOID *ptr)
释放从指定动态内存中申请的内存
UINT8 * m_aucSysMem0
异常交互动态内存池地址的起始地址,当不支持异常交互特性时,m_aucSysMem0等于m_aucSysMem1。
LITE_OS_SEC_TEXT UINT32 LOS_SwtmrStart(UINT16 swtmrID)
接口函数 启动定时器 参数定时任务ID
VOID(* SWTMR_PROC_FUNC)(UINTPTR arg)
Define the type of a callback function that handles software timer timeout.
LITE_OS_SEC_TEXT_INIT UINT32 LOS_SwtmrCreate(UINT32 interval, UINT8 mode, SWTMR_PROC_FUNC handler, UINT16 *swtmrID, UINTPTR arg)
创建定时器,设置定时器的定时时长、定时器模式、回调函数,并返回定时器ID
LITE_OS_SEC_BSS UINT32 g_taskMaxNum
任务最大数量 默认128个
LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskID)
Delete a task.
LITE_OS_SEC_BSS LosTaskCB * g_taskCBArray
外部变量 任务池 默认128个
STATIC INLINE UINT32 ArchCurrCpuid(VOID)
VOID OsMpCollectTasks(VOID)
MP定时器处理函数, 递归检查所有可用任务
VOID OsMpWakeHandler(VOID)
硬中断唤醒处理函数
VOID OsMpFuncCall(UINT32 target, SMP_FUNC_CALL func, VOID *args)
OsMpFuncCall 向指定CPU的funcLink上注册回调函数, 该怎么理解这个函数呢 ? 具体有什么用呢 ? 可由CPU a核向b核发起一个请求,让b核去执行某个函数,...
VOID LOS_MpSchedule(UINT32 target)
VOID OsMpFuncCallInit(VOID)
CPU层级的回调模块初始化
VOID OsMpFuncCallHandler(VOID)
OsMpFuncCallHandler 回调向当前CPU注册过的函数
LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_mpCallSpin)
VOID OsMpScheduleHandler(VOID)
硬中断调度处理函数
VOID OsMpHaltHandler(VOID)
硬中断暂停处理函数
LOS_MODULE_INIT(OsMpInit, LOS_INIT_LEVEL_KMOD_TASK)
VOID(* SMP_FUNC_CALL)(VOID *args)
@ LOS_MP_IPI_SCHEDULE
!< 唤醒CPU
@ LOS_MP_IPI_FUNC_CALL
!< 停止CPU
Percpu g_percpu[LOSCFG_KERNEL_CORE_NUM]
CPU池,池大小由CPU核数决定
@ CPU_HALT
cpu in the halt | CPU处于暂停状态
STATIC INLINE Percpu * OsPercpuGet(VOID)
STATIC INLINE BOOL OsTaskIsRunning(const LosTaskCB *taskCB)
STATIC INLINE VOID OsSchedRunqueuePendingSet(VOID)
STATIC INLINE BOOL OsTaskIsUnused(const LosTaskCB *taskCB)
任务是否在使用
LOS_DL_LIST node
链表节点,将挂到 g_percpu[cpuid]上