summaryrefslogtreecommitdiff
path: root/nuttx/arch/z16
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-04-25 15:19:59 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-04-25 15:19:59 -0600
commit1ffc15c3233c8d61953fc2ebc80b5d3c46fc429f (patch)
tree95050f5e635b87d26f4dd98612b05edf632b2a96 /nuttx/arch/z16
parent5f6e91b0ed1b373d0b4f963b0e0f8f7fe05ec766 (diff)
downloadnuttx-1ffc15c3233c8d61953fc2ebc80b5d3c46fc429f.tar.gz
nuttx-1ffc15c3233c8d61953fc2ebc80b5d3c46fc429f.tar.bz2
nuttx-1ffc15c3233c8d61953fc2ebc80b5d3c46fc429f.zip
Remove up_assert_code
Diffstat (limited to 'nuttx/arch/z16')
-rw-r--r--nuttx/arch/z16/src/common/up_assert.c39
-rw-r--r--nuttx/arch/z16/src/common/up_blocktask.c115
-rw-r--r--nuttx/arch/z16/src/common/up_doirq.c2
-rw-r--r--nuttx/arch/z16/src/common/up_reprioritizertr.c2
-rw-r--r--nuttx/arch/z16/src/common/up_unblocktask.c105
-rw-r--r--nuttx/arch/z16/src/z16f/z16f_serial.c4
-rw-r--r--nuttx/arch/z16/src/z16f/z16f_sysexec.c12
7 files changed, 119 insertions, 160 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);
}
}
}
diff --git a/nuttx/arch/z16/src/z16f/z16f_serial.c b/nuttx/arch/z16/src/z16f/z16f_serial.c
index b0f1a4674..28c3f94b7 100644
--- a/nuttx/arch/z16/src/z16f/z16f_serial.c
+++ b/nuttx/arch/z16/src/z16f/z16f_serial.c
@@ -443,7 +443,7 @@ static int z16f_rxinterrupt(int irq, void *context)
}
else
{
- PANIC(OSERR_INTERNAL);
+ PANIC();
}
priv = (struct z16f_uart_s*)dev->priv;
@@ -492,7 +492,7 @@ static int z16f_txinterrupt(int irq, void *context)
}
else
{
- PANIC(OSERR_INTERNAL);
+ PANIC();
}
priv = (struct z16f_uart_s*)dev->priv;
diff --git a/nuttx/arch/z16/src/z16f/z16f_sysexec.c b/nuttx/arch/z16/src/z16f/z16f_sysexec.c
index e824076b0..bd922237f 100644
--- a/nuttx/arch/z16/src/z16f/z16f_sysexec.c
+++ b/nuttx/arch/z16/src/z16f/z16f_sysexec.c
@@ -80,7 +80,6 @@
void z16f_sysexec(FAR chipreg_t *regs)
{
- int errcode = OSERR_ERREXCEPTION;
uint16_t excp;
/* Save that register reference so that it can be used for built-in
@@ -98,35 +97,42 @@ void z16f_sysexec(FAR chipreg_t *regs)
{
SYSDBG("SP OVERFLOW\n");
}
+
if ((excp & Z16F_SYSEXCP_PCOVF) != 0)
{
SYSDBG("PC OVERFLOW\n");
}
+
if ((excp & Z16F_SYSEXCP_DIV0) != 0)
{
SYSDBG("Divide by zero\n");
}
+
if ((excp & Z16F_SYSEXCP_DIVOVF) != 0)
{
SYSDBG("Divide overflow\n");
}
+
if ((excp & Z16F_SYSEXCP_ILL) != 0)
{
SYSDBG("Illegal instruction\n");
- errcode = OSERR_UNDEFINEDINSN;
}
+
if ((excp & Z16F_SYSEXCP_WDTOSC) != 0)
{
SYSDBG("WDT oscillator failure\n");
}
+
if ((excp & Z16F_SYSEXCP_PRIOSC) != 0)
{
SYSDBG("Primary Oscillator Failure\n");
}
+
if ((excp & Z16F_SYSEXCP_WDT) != 0)
{
SYSDBG("Watchdog timeout\n");
z16f_reset();
}
- PANIC(errcode);
+
+ PANIC();
}