1 /* 2 * Copyright (c) 2009-2022 Huawei Technologies Co., Ltd. All rights reserved. 3 * 4 * UniProton is licensed under Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * http://license.coscl.org.cn/MulanPSL2 8 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 9 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 10 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 11 * See the Mulan PSL v2 for more details. 12 * Create: 2009-12-22 13 * Description: 任务切换钩子独立文件 14 */ 15 #include "prt_task_internal.h" 16 17 OS_SEC_L4_BSS struct TskModInfo g_tskModInfo; 18 19 OS_SEC_BSS TskEntryFunc g_tskIdleEntry; 20 /* 任务中创建删除时调用钩子 */ 21 OS_SEC_BSS TaskNameAddFunc g_taskNameAdd; 22 OS_SEC_BSS TaskNameGetFunc g_taskNameGet; 23 OS_SEC_BSS volatile TskCoresleep g_taskCoreSleep; 24 25 OS_SEC_BSS U32 g_tskMaxNum; 26 OS_SEC_BSS struct TagTskCb *g_tskCbArray; 27 OS_SEC_BSS U32 g_tskBaseId; 28 29 OS_SEC_BSS TskHandle g_idleTaskId; 30 OS_SEC_BSS U16 g_uniTaskLock; 31 OS_SEC_BSS struct TagTskCb *g_highestTask; 32 OsTskSwitchHookCaller(U32 prevPid,U32 nextPid)33OS_SEC_TEXT void OsTskSwitchHookCaller(U32 prevPid, U32 nextPid) 34 { 35 UNI_FLAG |= OS_FLG_SYS_ACTIVE; 36 OS_MHOOK_ACTIVATE_PARA2(OS_HOOK_TSK_SWITCH, prevPid, nextPid); 37 UNI_FLAG &= ~OS_FLG_SYS_ACTIVE; 38 } 39 OsTskMaxNumGet(void)40OS_SEC_L4_TEXT U32 OsTskMaxNumGet(void) 41 { 42 return g_tskMaxNum; 43 } 44