Kernel: Update task switch and delete some unused variables

Signed-off-by: linzewen <linzewen@nucleisys.com>
This commit is contained in:
linzewen 2021-04-25 19:55:37 -07:00
parent 1639cf484d
commit dab3a81ac7
2 changed files with 12 additions and 16 deletions

View File

@ -87,7 +87,7 @@ extern VOID HalHwiDefaultHandler(VOID);
* *
* Solution: Pass in a valid non-null hardware interrupt handling function. * Solution: Pass in a valid non-null hardware interrupt handling function.
*/ */
// #define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01) #define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01)
/** /**
* @ingroup los_hwi * @ingroup los_hwi
@ -97,7 +97,7 @@ extern VOID HalHwiDefaultHandler(VOID);
* *
* Solution: Increase the configured maximum number of supported hardware interrupts. * Solution: Increase the configured maximum number of supported hardware interrupts.
*/ */
// #define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02) #define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02)
/** /**
* @ingroup los_hwi * @ingroup los_hwi
@ -107,7 +107,7 @@ extern VOID HalHwiDefaultHandler(VOID);
* *
* Solution: Expand the configured memory. * Solution: Expand the configured memory.
*/ */
// #define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03) #define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03)
/** /**
* @ingroup los_hwi * @ingroup los_hwi
@ -117,7 +117,7 @@ extern VOID HalHwiDefaultHandler(VOID);
* *
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created. * Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/ */
// #define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04) #define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04)
/** /**
* @ingroup los_hwi * @ingroup los_hwi
@ -127,7 +127,7 @@ extern VOID HalHwiDefaultHandler(VOID);
* *
* Solution: Ensure that the interrupt priority is valid. * Solution: Ensure that the interrupt priority is valid.
*/ */
// #define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05) #define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05)
/** /**
* @ingroup los_hwi * @ingroup los_hwi
@ -148,7 +148,7 @@ extern VOID HalHwiDefaultHandler(VOID);
* *
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created. * Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
*/ */
// #define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07) #define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07)
/** /**
* @ingroup los_hwi * @ingroup los_hwi
@ -158,7 +158,7 @@ extern VOID HalHwiDefaultHandler(VOID);
* *
* * Solution: Do not call the API during an interrupt. * * Solution: Do not call the API during an interrupt.
*/ */
// #define OS_ERRNO_HWI_INTERR LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x08) #define OS_ERRNO_HWI_INTERR LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x08)
/** /**
* @ingroup los_hwi * @ingroup los_hwi
@ -169,7 +169,7 @@ extern VOID HalHwiDefaultHandler(VOID);
* * Solution:check the input params hwiMode and irqParam of HalHwiCreate or HalHwiDelete whether adapt the current * * Solution:check the input params hwiMode and irqParam of HalHwiCreate or HalHwiDelete whether adapt the current
* hwi. * hwi.
*/ */
// #define OS_ERRNO_HWI_SHARED_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x09) #define OS_ERRNO_HWI_SHARED_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x09)
/** /**
* @ingroup los_hwi * @ingroup los_hwi
@ -190,7 +190,7 @@ extern VOID HalHwiDefaultHandler(VOID);
* *
* * Solution:check the hwi number or devid, make sure the hwi number or devid need to delete. * * Solution:check the hwi number or devid, make sure the hwi number or devid need to delete.
*/ */
// #define OS_ERRNO_HWI_HWINUM_UNCREATE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0b) #define OS_ERRNO_HWI_HWINUM_UNCREATE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0b)
extern UINT32 HalUnalignedAccessFix(UINTPTR mcause, UINTPTR mepc, UINTPTR mtval, VOID *sp); extern UINT32 HalUnalignedAccessFix(UINTPTR mcause, UINTPTR mepc, UINTPTR mtval, VOID *sp);

View File

@ -53,14 +53,14 @@ LITE_OS_SEC_TEXT_MINOR VOID HalSysExit(VOID)
LITE_OS_SEC_TEXT_INIT VOID *HalTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack) LITE_OS_SEC_TEXT_INIT VOID *HalTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
{ {
UINT32 index; UINT32 index;
UINT8 *stk; UINT8 *stk = 0;
TaskContext *context = NULL; TaskContext *context = NULL;
/* initialize the task stack, write magic num to stack top */ /* initialize the task stack, write magic num to stack top */
*((UINT32 *)(topStack)) = OS_TASK_MAGIC_WORD; *((UINT32 *)(topStack)) = OS_TASK_MAGIC_WORD;
stk = ((UINT8 *)topStack) + stackSize + sizeof(STACK_TYPE); stk = ((UINT8 *)topStack) + stackSize + sizeof(STACK_TYPE);
stk = (UINT8 *)ALIGN_DOWN((unsigned long)stk, REGBYTES); stk = (UINT8 *)ALIGN_DOWN((uintptr_t)stk, REGBYTES);
context = (TaskContext *)(stk - sizeof(TaskContext)); context = (TaskContext *)(stk - sizeof(TaskContext));
for (index = 1; index < sizeof(TaskContext)/ sizeof(STACK_TYPE); index ++) { for (index = 1; index < sizeof(TaskContext)/ sizeof(STACK_TYPE); index ++) {
@ -76,7 +76,6 @@ LITE_OS_SEC_TEXT_INIT VOID *HalTskStackInit(UINT32 taskID, UINT32 stackSize, VOI
return (VOID *)context; return (VOID *)context;
} }
extern BOOL g_taskScheduled;
extern LosTask g_losTask; extern LosTask g_losTask;
LITE_OS_SEC_TEXT_INIT UINT32 HalStartSchedule(OS_TICK_HANDLER handler) LITE_OS_SEC_TEXT_INIT UINT32 HalStartSchedule(OS_TICK_HANDLER handler)
{ {
@ -95,18 +94,15 @@ LITE_OS_SEC_TEXT_INIT UINT32 HalStartSchedule(OS_TICK_HANDLER handler)
VOID HalTaskSchedule(VOID) VOID HalTaskSchedule(VOID)
{ {
if (OsSchedTaskSwitch()) {
SysTimer_SetSWIRQ(); SysTimer_SetSWIRQ();
}
} }
VOID HalTaskSwitch(VOID) VOID HalTaskSwitch(VOID)
{ {
SysTimer_ClearSWIRQ(); SysTimer_ClearSWIRQ();
g_losTask.runTask->taskStatus &= ~OS_TASK_STATUS_RUNNING; OsSchedTaskSwitch();
/* Set newTask to runTask */ /* Set newTask to runTask */
g_losTask.runTask = g_losTask.newTask; g_losTask.runTask = g_losTask.newTask;
g_losTask.runTask->taskStatus |= OS_TASK_STATUS_RUNNING;
} }
LITE_OS_SEC_TEXT VOID HalTaskScheduleCheck(VOID) LITE_OS_SEC_TEXT VOID HalTaskScheduleCheck(VOID)