diff --git a/Ubiquitous/XiZi/arch/arm/cortex-m23/pendsv.S b/Ubiquitous/XiZi/arch/arm/cortex-m23/pendsv.S index 4fcd6ee24..1c1fe65dc 100644 --- a/Ubiquitous/XiZi/arch/arm/cortex-m23/pendsv.S +++ b/Ubiquitous/XiZi/arch/arm/cortex-m23/pendsv.S @@ -76,7 +76,6 @@ PendSV_Handler: MOV R7, R11 STMIA R1!, {R4 - R7} /* push thread {R8 - R11} high register to thread stack */ switch_to_task: - BL UpdateRunningTask LDR R1, =InterruptToKtask LDR R1, [R1] diff --git a/Ubiquitous/XiZi/arch/arm/shared/pendsv.S b/Ubiquitous/XiZi/arch/arm/shared/pendsv.S index 561778f77..3461f4808 100644 --- a/Ubiquitous/XiZi/arch/arm/shared/pendsv.S +++ b/Ubiquitous/XiZi/arch/arm/shared/pendsv.S @@ -70,9 +70,6 @@ PendSV_Handler: switch_to_task: - PUSH {lr} - BL UpdateRunningTask - POP {lr} #ifdef TASK_ISOLATION PUSH {lr} diff --git a/Ubiquitous/XiZi/kernel/thread/CriticalArea.c b/Ubiquitous/XiZi/kernel/thread/CriticalArea.c index f313e30e8..2cc850ec5 100644 --- a/Ubiquitous/XiZi/kernel/thread/CriticalArea.c +++ b/Ubiquitous/XiZi/kernel/thread/CriticalArea.c @@ -95,7 +95,7 @@ uint16 GetOsAssignLockLevel(void) #include -static int16 KTaskOsAssignLockNest; +static uint16 KTaskOsAssignLockNest; /** * This function will get critical lock level. diff --git a/Ubiquitous/XiZi/kernel/thread/assign.c b/Ubiquitous/XiZi/kernel/thread/assign.c index 2bef0fe53..776b61f6a 100644 --- a/Ubiquitous/XiZi/kernel/thread/assign.c +++ b/Ubiquitous/XiZi/kernel/thread/assign.c @@ -87,6 +87,7 @@ SWITCH: Assign.ready_vector_done->remove(new_task); KTaskStatSetAsRunning(new_task); + Assign.os_running_task = new_task; SYS_KDEBUG_LOG(KDBG_SCHED, ("[%d]switch to priority#%d " @@ -162,6 +163,7 @@ SWITCH: Assign.ready_vector_done->remove(new_task); KTaskStatSetAsRunning(new_task); + Assign.os_running_task = new_task; SYS_KDEBUG_LOG(KDBG_SCHED, ("[%d]switch to priority#%d " @@ -327,6 +329,7 @@ x_err_t YieldOsAssign(void) Assign.ready_vector_done->remove(new_task); KTaskStatSetAsRunning(new_task); + Assign.os_running_task = new_task; SYS_KDEBUG_LOG(KDBG_SCHED, ("[%d]switch to priority#%d " diff --git a/Ubiquitous/XiZi/tool/shell/letter-shell/shell.c b/Ubiquitous/XiZi/tool/shell/letter-shell/shell.c index 6a923ece8..201178a12 100644 --- a/Ubiquitous/XiZi/tool/shell/letter-shell/shell.c +++ b/Ubiquitous/XiZi/tool/shell/letter-shell/shell.c @@ -1647,9 +1647,17 @@ void shellTask(void *param) while(RET_TRUE) { if (shell->read) { + memset(data, 0, KEY_LENGTH); + data_len = 0; + x_base lock; + data_len = shell->read(data); - for (i = 0; i < data_len; i++) { - shellHandler(shell, data[i]); + if(data_len > 0) { + int lock = CriticalAreaLock(); + for (i = 0; i < data_len; i++) { + shellHandler(shell, data[i]); + } + CriticalAreaUnLock(lock); } } } diff --git a/Ubiquitous/XiZi/tool/shell/letter-shell/shell_port.c b/Ubiquitous/XiZi/tool/shell/letter-shell/shell_port.c index 661cfb604..8f315ebdd 100644 --- a/Ubiquitous/XiZi/tool/shell/letter-shell/shell_port.c +++ b/Ubiquitous/XiZi/tool/shell/letter-shell/shell_port.c @@ -48,10 +48,13 @@ signed char userShellRead(char *data) { char read_length = 0; struct BusBlockReadParam read_param; - read_param.read_length = 0; - read_param.size = 1; - read_param.buffer = data; + memset(&read_param,0, sizeof(read_param)); + + read_param.read_length = 0; + read_param.size = KEY_LENGTH; + read_param.buffer = data; + BusDevReadData(console, &read_param); read_length = (char)read_param.read_length; @@ -120,7 +123,7 @@ int userShellInit(void) tid = KTaskCreate("letter-shell", shellTask, &shell, SHELL_TASK_STACK_SIZE, SHELL_TASK_PRIORITY); - + StartupKTask(tid); return 0; }