diff options
Diffstat (limited to 'nuttx/arch/arm/src/armv6-m')
-rw-r--r-- | nuttx/arch/arm/src/armv6-m/up_assert.c | 24 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv6-m/up_blocktask.c | 111 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv6-m/up_doirq.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv6-m/up_hardfault.c | 4 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv6-m/up_reprioritizertr.c | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv6-m/up_unblocktask.c | 93 |
6 files changed, 103 insertions, 133 deletions
diff --git a/nuttx/arch/arm/src/armv6-m/up_assert.c b/nuttx/arch/arm/src/armv6-m/up_assert.c index 86347672e..3afef2dff 100644 --- a/nuttx/arch/arm/src/armv6-m/up_assert.c +++ b/nuttx/arch/arm/src/armv6-m/up_assert.c @@ -307,6 +307,7 @@ void up_assert(const uint8_t *filename, int lineno) #endif up_ledon(LED_ASSERTION); + #ifdef CONFIG_PRINT_TASKNAME lldbg("Assertion failed at file:%s line: %d task: %s\n", filename, lineno, rtcb->name); @@ -314,28 +315,7 @@ void up_assert(const uint8_t *filename, int lineno) lldbg("Assertion failed at file:%s line: %d\n", filename, lineno); #endif - up_dumpstate(); - _up_assert(EXIT_FAILURE); -} -/**************************************************************************** - * Name: up_assert_code - ****************************************************************************/ - -void up_assert_code(const uint8_t *filename, int lineno, int errorcode) -{ -#ifdef CONFIG_PRINT_TASKNAME - struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head; -#endif - - up_ledon(LED_ASSERTION); -#ifdef CONFIG_PRINT_TASKNAME - lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n", - filename, lineno, rtcb->name, errorcode); -#else - lldbg("Assertion failed at file:%s line: %d error code: %d\n", - filename, lineno, errorcode); -#endif up_dumpstate(); - _up_assert(errorcode); + _up_assert(EXIT_FAILURE); } diff --git a/nuttx/arch/arm/src/armv6-m/up_blocktask.c b/nuttx/arch/arm/src/armv6-m/up_blocktask.c index a332cbefd..57db2b4aa 100644 --- a/nuttx/arch/arm/src/armv6-m/up_blocktask.c +++ b/nuttx/arch/arm/src/armv6-m/up_blocktask.c @@ -85,82 +85,77 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) { - /* Verify that the context switch can be performed */ - - if ((tcb->task_state < FIRST_READY_TO_RUN_STATE) || - (tcb->task_state > LAST_READY_TO_RUN_STATE)) - { - PANIC(OSERR_BADBLOCKSTATE); - } - else - { - struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head; - bool switch_needed; + struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head; + bool switch_needed; - /* Remove the tcb task from the ready-to-run list. If we - * are blocking the task at the head of the task list (the - * most likely case), then a context switch to the next - * ready-to-run task is needed. In this case, it should - * also be true that rtcb == tcb. - */ + /* Verify that the context switch can be performed */ - switch_needed = sched_removereadytorun(tcb); + ASSERT((tcb->task_state >= FIRST_READY_TO_RUN_STATE) && + (tcb->task_state <= LAST_READY_TO_RUN_STATE)); - /* Add the task to the specified blocked task list */ + /* Remove the tcb task from the ready-to-run list. If we + * are blocking the task at the head of the task list (the + * most likely case), then a context switch to the next + * ready-to-run task is needed. In this case, it should + * also be true that rtcb == tcb. + */ - sched_addblocked(tcb, (tstate_t)task_state); + switch_needed = sched_removereadytorun(tcb); - /* If there are any pending tasks, then add them to the g_readytorun - * task list now - */ + /* Add the task to the specified blocked task list */ - if (g_pendingtasks.head) - { - switch_needed |= sched_mergepending(); - } + sched_addblocked(tcb, (tstate_t)task_state); - /* Now, perform the context switch if one is needed */ + /* If there are any pending tasks, then add them to the g_readytorun + * task list now + */ - if (switch_needed) - { - /* Are we in an interrupt handler? */ + if (g_pendingtasks.head) + { + switch_needed |= sched_mergepending(); + } - if (current_regs) - { - /* Yes, then we have to do things differently. - * Just copy the current_regs into the OLD rtcb. - */ + /* Now, perform the context switch if one is needed */ - up_savestate(rtcb->xcp.regs); + if (switch_needed) + { + /* Are we in an interrupt handler? */ - /* Restore the exception context of the rtcb at the (new) head - * of the g_readytorun task list. - */ + if (current_regs) + { + /* Yes, then we have to do things differently. + * Just copy the current_regs into the OLD rtcb. + */ - rtcb = (struct tcb_s*)g_readytorun.head; + up_savestate(rtcb->xcp.regs); - /* Then switch contexts */ + /* Restore the exception context of the rtcb at the (new) head + * of the g_readytorun task list. + */ - up_restorestate(rtcb->xcp.regs); - } + rtcb = (struct tcb_s*)g_readytorun.head; - /* No, then we will need to perform the user context switch */ + /* Then switch contexts */ - else - { - /* Switch context to the context of the task at the head of the - * ready to run list. - */ + up_restorestate(rtcb->xcp.regs); + } - struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head; - up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs); + /* No, then we will need to perform the user context switch */ - /* up_switchcontext forces a context switch to the task at the - * head of the ready-to-run list. It does not 'return' in the - * normal sense. When it does return, it is because the blocked - * task is again ready to run and has execution priority. - */ - } + else + { + /* Switch context to the context of the task at the head of the + * ready to run list. + */ + + struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head; + up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs); + + /* up_switchcontext forces a context switch to the task at the + * head of the ready-to-run list. It does not 'return' in the + * normal sense. When it does return, it is because the blocked + * task is again ready to run and has execution priority. + */ } } } diff --git a/nuttx/arch/arm/src/armv6-m/up_doirq.c b/nuttx/arch/arm/src/armv6-m/up_doirq.c index 7dec21152..2edbc55dd 100644 --- a/nuttx/arch/arm/src/armv6-m/up_doirq.c +++ b/nuttx/arch/arm/src/armv6-m/up_doirq.c @@ -74,7 +74,7 @@ uint32_t *up_doirq(int irq, uint32_t *regs) { up_ledon(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS - PANIC(OSERR_ERREXCEPTION); + PANIC(); #else uint32_t *savestate; diff --git a/nuttx/arch/arm/src/armv6-m/up_hardfault.c b/nuttx/arch/arm/src/armv6-m/up_hardfault.c index 049f71d05..a2a0982a7 100644 --- a/nuttx/arch/arm/src/armv6-m/up_hardfault.c +++ b/nuttx/arch/arm/src/armv6-m/up_hardfault.c @@ -151,6 +151,6 @@ int up_hardfault(int irq, FAR void *context) (void)irqsave(); lldbg("PANIC!!! Hard fault\n"); - PANIC(OSERR_UNEXPECTEDISR); - return OK; + PANIC(); + return OK; /* Won't get here */ } diff --git a/nuttx/arch/arm/src/armv6-m/up_reprioritizertr.c b/nuttx/arch/arm/src/armv6-m/up_reprioritizertr.c index 0bc0d4170..07eeef14b 100644 --- a/nuttx/arch/arm/src/armv6-m/up_reprioritizertr.c +++ b/nuttx/arch/arm/src/armv6-m/up_reprioritizertr.c @@ -98,7 +98,7 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) #endif ) { - PANIC(OSERR_BADREPRIORITIZESTATE); + PANIC(); } else { diff --git a/nuttx/arch/arm/src/armv6-m/up_unblocktask.c b/nuttx/arch/arm/src/armv6-m/up_unblocktask.c index c496a8f43..e4bfede97 100644 --- a/nuttx/arch/arm/src/armv6-m/up_unblocktask.c +++ b/nuttx/arch/arm/src/armv6-m/up_unblocktask.c @@ -80,77 +80,72 @@ void up_unblock_task(struct tcb_s *tcb) { + struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head; + /* Verify that the context switch can be performed */ - if ((tcb->task_state < FIRST_BLOCKED_STATE) || - (tcb->task_state > LAST_BLOCKED_STATE)) - { - PANIC(OSERR_BADUNBLOCKSTATE); - } - else - { - struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head; + ASSERT((tcb->task_state >= FIRST_BLOCKED_STATE) && + (tcb->task_state <= LAST_BLOCKED_STATE)); - /* Remove the task from the blocked task list */ + /* Remove the task from the blocked task list */ - sched_removeblocked(tcb); + sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset its timeslice. This is only meaningful for round + * robin tasks but it doesn't here to do it for everything + */ #if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = CONFIG_RR_INTERVAL / MSEC_PER_TICK; + tcb->timeslice = CONFIG_RR_INTERVAL / MSEC_PER_TICK; #endif - /* Add the task in the correct location in the prioritized - * g_readytorun task list + /* Add the task in the correct location in the prioritized + * g_readytorun task list + */ + + if (sched_addreadytorun(tcb)) + { + /* The currently active task has changed! We need to do + * a context switch to the new task. + * + * Are we in an interrupt handler? */ - if (sched_addreadytorun(tcb)) + if (current_regs) { - /* The currently active task has changed! We need to do - * a context switch to the new task. - * - * Are we in an interrupt handler? + /* Yes, then we have to do things differently. + * Just copy the current_regs into the OLD rtcb. */ - if (current_regs) - { - /* Yes, then we have to do things differently. - * Just copy the current_regs into the OLD rtcb. - */ + up_savestate(rtcb->xcp.regs); - up_savestate(rtcb->xcp.regs); - - /* Restore the exception context of the rtcb at the (new) head - * of the g_readytorun task list. - */ + /* Restore the exception context of the rtcb at the (new) head + * of the g_readytorun task list. + */ - rtcb = (struct tcb_s*)g_readytorun.head; + rtcb = (struct tcb_s*)g_readytorun.head; - /* Then switch contexts */ + /* Then switch contexts */ - up_restorestate(rtcb->xcp.regs); - } + up_restorestate(rtcb->xcp.regs); + } - /* No, then we will need to perform the user context switch */ + /* No, then we will need to perform the user context switch */ - else - { - /* Switch context to the context of the task at the head of the - * ready to run list. - */ + else + { + /* Switch context to the context of the task at the head of the + * ready to run list. + */ - struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head; - up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs); + struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head; + up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs); - /* up_switchcontext forces a context switch to the task at the - * head of the ready-to-run list. It does not 'return' in the - * normal sense. When it does return, it is because the blocked - * task is again ready to run and has execution priority. - */ - } + /* up_switchcontext forces a context switch to the task at the + * head of the ready-to-run list. It does not 'return' in the + * normal sense. When it does return, it is because the blocked + * task is again ready to run and has execution priority. + */ } } } |