diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-04-25 15:19:59 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-04-25 15:19:59 -0600 |
commit | 1ffc15c3233c8d61953fc2ebc80b5d3c46fc429f (patch) | |
tree | 95050f5e635b87d26f4dd98612b05edf632b2a96 /nuttx/arch/z16/src/common | |
parent | 5f6e91b0ed1b373d0b4f963b0e0f8f7fe05ec766 (diff) | |
download | px4-nuttx-1ffc15c3233c8d61953fc2ebc80b5d3c46fc429f.tar.gz px4-nuttx-1ffc15c3233c8d61953fc2ebc80b5d3c46fc429f.tar.bz2 px4-nuttx-1ffc15c3233c8d61953fc2ebc80b5d3c46fc429f.zip |
Remove up_assert_code
Diffstat (limited to 'nuttx/arch/z16/src/common')
-rw-r--r-- | nuttx/arch/z16/src/common/up_assert.c | 39 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_blocktask.c | 115 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_doirq.c | 2 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_reprioritizertr.c | 2 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_unblocktask.c | 105 |
5 files changed, 108 insertions, 155 deletions
diff --git a/nuttx/arch/z16/src/common/up_assert.c b/nuttx/arch/z16/src/common/up_assert.c index 06c77a73e..c5efc174a 100644 --- a/nuttx/arch/z16/src/common/up_assert.c +++ b/nuttx/arch/z16/src/common/up_assert.c @@ -1,7 +1,7 @@ /**************************************************************************** * common/up_assert.c * - * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -140,40 +140,3 @@ void up_assert(void) up_registerdump(); _up_assert(EXIT_FAILURE); } - -/**************************************************************************** - * Name: up_assert_code - ****************************************************************************/ - -#ifdef CONFIG_HAVE_FILENAME -void up_assert_code(const uint8_t *filename, int lineno, int errorcode) -#else -void up_assert_code(int errorcode) -#endif -{ -#if CONFIG_TASK_NAME_SIZE > 0 - struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head; -#endif - - up_ledon(LED_ASSERTION); - -#ifdef CONFIG_HAVE_FILENAME -#if CONFIG_TASK_NAME_SIZE > 0 - 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 -#else -#if CONFIG_TASK_NAME_SIZE > 0 - lldbg("Assertion failed: task: %s error code: %d\n", rtcb->name, errorcode); -#else - lldbg("Assertion failed: error code: %d\n", errorcode); -#endif -#endif - - up_stackdump(); - up_registerdump(); - _up_assert(errorcode); -} diff --git a/nuttx/arch/z16/src/common/up_blocktask.c b/nuttx/arch/z16/src/common/up_blocktask.c index 93efee96f..56618ab3d 100644 --- a/nuttx/arch/z16/src/common/up_blocktask.c +++ b/nuttx/arch/z16/src/common/up_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * common/up_blocktask.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -86,88 +86,83 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state) { + FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head; + bool switch_needed; + /* 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 - { - FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head; - bool switch_needed; + ASSERT((tcb->task_state >= FIRST_READY_TO_RUN_STATE) && + (tcb->task_state <= LAST_READY_TO_RUN_STATE)); - /* dbg("Blocking TCB=%p\n", tcb); */ + /* dbg("Blocking TCB=%p\n", tcb); */ - /* 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. - */ + /* 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. + */ - switch_needed = sched_removereadytorun(tcb); + switch_needed = sched_removereadytorun(tcb); - /* Add the task to the specified blocked task list */ + /* Add the task to the specified blocked task list */ - sched_addblocked(tcb, (tstate_t)task_state); + sched_addblocked(tcb, (tstate_t)task_state); - /* If there are any pending tasks, then add them to the g_readytorun - * task list now - */ + /* If there are any pending tasks, then add them to the g_readytorun + * task list now + */ - if (g_pendingtasks.head) - { - switch_needed |= sched_mergepending(); - } + if (g_pendingtasks.head) + { + switch_needed |= sched_mergepending(); + } - /* Now, perform the context switch if one is needed */ + /* Now, perform the context switch if one is needed */ - if (switch_needed) + if (switch_needed) + { + /* Are we in an interrupt handler? */ + + if (IN_INTERRUPT) { - /* Are we in an interrupt handler? */ + /* Yes, then we have to do things differently. + * Just copy the current registers into the OLD rtcb. + */ - if (IN_INTERRUPT) - { - /* Yes, then we have to do things differently. - * Just copy the current registers into the OLD rtcb. - */ + SAVE_IRQCONTEXT(rtcb); - SAVE_IRQCONTEXT(rtcb); + /* 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 = (FAR struct tcb_s*)g_readytorun.head; + /* dbg("New Active Task TCB=%p\n", rtcb); */ - rtcb = (FAR struct tcb_s*)g_readytorun.head; - /* dbg("New Active Task TCB=%p\n", rtcb); */ + /* Then setup so that the context will be performed on exit + * from the interrupt. + */ - /* Then setup so that the context will be performed on exit - * from the interrupt. - */ + SET_IRQCONTEXT(rtcb); + } - SET_IRQCONTEXT(rtcb); - } + /* Copy the user C context into the TCB at the (old) head of the + * g_readytorun Task list. if SAVE_USERCONTEXT returns a non-zero + * value, then this is really the previously running task restarting! + */ - /* Copy the user C context into the TCB at the (old) head of the - * g_readytorun Task list. if SAVE_USERCONTEXT returns a non-zero - * value, then this is really the previously running task restarting! + else if (!SAVE_USERCONTEXT(rtcb)) + { + /* Restore the exception context of the rtcb at the (new) head + * of the g_readytorun task list. */ - else if (!SAVE_USERCONTEXT(rtcb)) - { - /* Restore the exception context of the rtcb at the (new) head - * of the g_readytorun task list. - */ - - rtcb = (FAR struct tcb_s*)g_readytorun.head; - /* dbg("New Active Task TCB=%p\n", rtcb); */ + rtcb = (FAR struct tcb_s*)g_readytorun.head; + /* dbg("New Active Task TCB=%p\n", rtcb); */ - /* Then switch contexts */ + /* Then switch contexts */ - RESTORE_USERCONTEXT(rtcb); - } + RESTORE_USERCONTEXT(rtcb); } } } diff --git a/nuttx/arch/z16/src/common/up_doirq.c b/nuttx/arch/z16/src/common/up_doirq.c index 9964f4432..fea0a86d2 100644 --- a/nuttx/arch/z16/src/common/up_doirq.c +++ b/nuttx/arch/z16/src/common/up_doirq.c @@ -84,7 +84,7 @@ FAR chipreg_t *up_doirq(int irq, FAR chipreg_t *regs) up_ledon(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS - PANIC(OSERR_ERREXCEPTION); + PANIC(); #else if ((unsigned)irq < NR_IRQS) { diff --git a/nuttx/arch/z16/src/common/up_reprioritizertr.c b/nuttx/arch/z16/src/common/up_reprioritizertr.c index 2eb5c2cdb..bbfee7845 100644 --- a/nuttx/arch/z16/src/common/up_reprioritizertr.c +++ b/nuttx/arch/z16/src/common/up_reprioritizertr.c @@ -100,7 +100,7 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority) #endif ) { - PANIC(OSERR_BADREPRIORITIZESTATE); + PANIC(); } else { diff --git a/nuttx/arch/z16/src/common/up_unblocktask.c b/nuttx/arch/z16/src/common/up_unblocktask.c index f63981ab5..a629b5066 100644 --- a/nuttx/arch/z16/src/common/up_unblocktask.c +++ b/nuttx/arch/z16/src/common/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * common/up_unblocktask.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -83,85 +83,80 @@ void up_unblock_task(FAR struct tcb_s *tcb) { + FAR struct tcb_s *rtcb = (FAR 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 - { - FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head; + ASSERT((tcb->task_state >= FIRST_BLOCKED_STATE) && + (tcb->task_state <= LAST_BLOCKED_STATE)); - /* dbg("Unblocking TCB=%p\n", tcb); */ + /* dbg("Unblocking TCB=%p\n", tcb); */ - /* 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 (IN_INTERRUPT) { - /* 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 context into the OLD rtcb. */ - if (IN_INTERRUPT) - { - /* Yes, then we have to do things differently. - * Just copy the current context into the OLD rtcb. - */ + SAVE_IRQCONTEXT(rtcb); - SAVE_IRQCONTEXT(rtcb); + /* 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 = (FAR struct tcb_s*)g_readytorun.head; + /* dbg("New Active Task TCB=%p\n", rtcb); */ - rtcb = (FAR struct tcb_s*)g_readytorun.head; - /* dbg("New Active Task TCB=%p\n", rtcb); */ + /* Then setup so that the context will be performed on exit + * from the interrupt. + */ - /* Then setup so that the context will be performed on exit - * from the interrupt. - */ + SET_IRQCONTEXT(rtcb); + } - SET_IRQCONTEXT(rtcb); - } + /* We are not in an interrupt handler. Copy the user C context + * into the TCB of the task that was previously active. if + * SAVE_USERCONTEXT returns a non-zero value, then this is really the + * previously running task restarting! + */ - /* We are not in an interrupt handler. Copy the user C context - * into the TCB of the task that was previously active. if - * SAVE_USERCONTEXT returns a non-zero value, then this is really the - * previously running task restarting! + else if (!SAVE_USERCONTEXT(rtcb)) + { + /* Restore the exception context of the new task that is ready to + * run (probably tcb). This is the new rtcb at the head of the + * g_readytorun task list. */ - else if (!SAVE_USERCONTEXT(rtcb)) - { - /* Restore the exception context of the new task that is ready to - * run (probably tcb). This is the new rtcb at the head of the - * g_readytorun task list. - */ - - rtcb = (FAR struct tcb_s*)g_readytorun.head; - /* dbg("New Active Task TCB=%p\n", rtcb); */ + rtcb = (FAR struct tcb_s*)g_readytorun.head; + /* dbg("New Active Task TCB=%p\n", rtcb); */ - /* Then switch contexts */ + /* Then switch contexts */ - RESTORE_USERCONTEXT(rtcb); - } + RESTORE_USERCONTEXT(rtcb); } } } |