mirror of
https://github.com/apache/nuttx.git
synced 2026-09-27 18:58:27 +08:00
Remove up_assert_code
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/irq_unexpectedisr.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-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,6 +83,6 @@ int irq_unexpected_isr(int irq, FAR void *context)
|
||||
{
|
||||
(void)irqsave();
|
||||
lldbg("irq: %d\n", irq);
|
||||
PANIC(OSERR_UNEXPECTEDISR);
|
||||
PANIC();
|
||||
return OK; /* Won't get here */
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/************************************************************************
|
||||
* sched/mq_msgfree.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -129,6 +129,6 @@ void mq_msgfree(FAR mqmsg_t *mqmsg)
|
||||
}
|
||||
else
|
||||
{
|
||||
PANIC(OSERR_BADMSGTYPE);
|
||||
PANIC();
|
||||
}
|
||||
}
|
||||
|
||||
+6
-11
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/mq_rcvinternal.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008, 2012-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -292,16 +292,11 @@ ssize_t mq_doreceive(mqd_t mqdes, mqmsg_t *mqmsg, void *ubuffer, int *prio)
|
||||
* time the task is unblocked
|
||||
*/
|
||||
|
||||
if (!btcb)
|
||||
{
|
||||
PANIC(OSERR_MQNOTFULLCOUNT);
|
||||
}
|
||||
else
|
||||
{
|
||||
btcb->msgwaitq = NULL;
|
||||
msgq->nwaitnotfull--;
|
||||
up_unblock_task(btcb);
|
||||
}
|
||||
ASSERT(btcb);
|
||||
|
||||
btcb->msgwaitq = NULL;
|
||||
msgq->nwaitnotfull--;
|
||||
up_unblock_task(btcb);
|
||||
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
|
||||
+7
-22
@@ -203,18 +203,8 @@ FAR mqmsg_t *mq_msgalloc(void)
|
||||
|
||||
/* Check if we got an allocated message */
|
||||
|
||||
if (mqmsg)
|
||||
{
|
||||
mqmsg->type = MQ_ALLOC_DYN;
|
||||
}
|
||||
|
||||
/* No? We are dead */
|
||||
|
||||
else
|
||||
{
|
||||
sdbg("Out of messages\n");
|
||||
PANIC((uint32_t)OSERR_OUTOFMESSAGES);
|
||||
}
|
||||
ASSERT(mqmsg);
|
||||
mqmsg->type = MQ_ALLOC_DYN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,16 +426,11 @@ int mq_dosend(mqd_t mqdes, FAR mqmsg_t *mqmsg, const void *msg, size_t msglen, i
|
||||
|
||||
/* If one was found, unblock it */
|
||||
|
||||
if (!btcb)
|
||||
{
|
||||
PANIC(OSERR_MQNONEMPTYCOUNT);
|
||||
}
|
||||
else
|
||||
{
|
||||
btcb->msgwaitq = NULL;
|
||||
msgq->nwaitnotempty--;
|
||||
up_unblock_task(btcb);
|
||||
}
|
||||
ASSERT(btcb);
|
||||
|
||||
btcb->msgwaitq = NULL;
|
||||
msgq->nwaitnotempty--;
|
||||
up_unblock_task(btcb);
|
||||
}
|
||||
|
||||
irqrestore(saved_state);
|
||||
|
||||
+3
-29
@@ -113,46 +113,20 @@ void mq_waitirq(FAR struct tcb_s *wtcb, int errcode)
|
||||
/* Get the message queue associated with the waiter from the TCB */
|
||||
|
||||
msgq = wtcb->msgwaitq;
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!msgq)
|
||||
{
|
||||
/* In these states there must always be an associated message queue */
|
||||
DEBUGASSERT(msgq);
|
||||
|
||||
PANIC((uint32_t)OSERR_MQNOWAITER);
|
||||
}
|
||||
#endif
|
||||
wtcb->msgwaitq = NULL;
|
||||
|
||||
/* Decrement the count of waiters and cancel the wait */
|
||||
|
||||
if (wtcb->task_state == TSTATE_WAIT_MQNOTEMPTY)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (msgq->nwaitnotempty <= 0)
|
||||
{
|
||||
/* This state, there should be a positive, non-zero waiter
|
||||
* count.
|
||||
*/
|
||||
|
||||
PANIC((uint32_t)OSERR_MQNONEMPTYCOUNT);
|
||||
|
||||
}
|
||||
#endif
|
||||
DEBUGASSERT(msgq->nwaitnotempty > 0);
|
||||
msgq->nwaitnotempty--;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (msgq->nwaitnotfull <= 0)
|
||||
{
|
||||
/* This state, there should be a positive, non-zero waiter
|
||||
* count.
|
||||
*/
|
||||
|
||||
PANIC((uint32_t)OSERR_MQNOTFULLCOUNT);
|
||||
|
||||
}
|
||||
#endif
|
||||
DEBUGASSERT(msgq->nwaitnotfull > 0);
|
||||
msgq->nwaitnotfull--;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,36 +53,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* OS CRASH CODES: All must lie in the range 0-99 */
|
||||
|
||||
enum os_crash_codes_e
|
||||
{
|
||||
OSERR_NOERROR = 0, /* No error */
|
||||
OSERR_NOTIMPLEMENTED, /* Feature is not implemented */
|
||||
OSERR_INTERNAL, /* Internal logic error */
|
||||
OSERR_UNEXPECTEDISR, /* Received unexpected interrupt */
|
||||
OSERR_UNDEFINEDINSN, /* Undefined instruction */
|
||||
OSERR_ERREXCEPTION, /* Other CPU-detected errors */
|
||||
OSERR_OUTOFMEMORY, /* Insufficient memory */
|
||||
OSERR_OUTOFMESSAGES, /* Out of messages */
|
||||
OSERR_NOIDLETASK, /* There is no idle task */
|
||||
OSERR_MQNONEMPTYCOUNT, /* Expected waiter for non-empty queue */
|
||||
OSERR_MQNOTFULLCOUNT, /* Expected waiter for non-full queue */
|
||||
OSERR_MQNOWAITER, /* Expected a queue for the waiter */
|
||||
OSERR_BADWAITSEM, /* Already waiting for a semaphore */
|
||||
OSERR_BADMSGTYPE, /* Tried to free a bad message type */
|
||||
OSERR_FAILEDTOADDSIGNAL, /* Failed to add pending signal */
|
||||
OSERR_FAILEDTOREMOVESIGNAL, /* Failed to remove pending signal */
|
||||
OSERR_TIMEOUTNOTCB, /* Timed out, but not TCB registered */
|
||||
OSERR_NOPENDINGSIGNAL, /* Expected a signal to be pending */
|
||||
OSERR_BADDELETESTATE, /* Bad state in task deletion */
|
||||
OSERR_WDOGNOTFOUND, /* Active watchdog not found */
|
||||
OSERR_EXITFROMINTERRUPT, /* Interrupt code attempted to exit */
|
||||
OSERR_BADUNBLOCKSTATE, /* Attempt to unblock from bad state */
|
||||
OSERR_BADBLOCKSTATE, /* Attempt to block from bad state */
|
||||
OSERR_BADREPRIORITIZESTATE /* Attempt to reprioritize in bad state or priority */
|
||||
};
|
||||
|
||||
/* Special task IDS. Any negative PID is invalid. */
|
||||
|
||||
#define NULL_TASK_PROCESS_ID (pid_t)0
|
||||
|
||||
+26
-31
@@ -125,42 +125,37 @@ bool sched_mergepending(void)
|
||||
* the g_readytorun list!
|
||||
*/
|
||||
|
||||
if (!rtrtcb)
|
||||
ASSERT(rtrtcb);
|
||||
|
||||
/* The pndtcb goes just before rtrtcb */
|
||||
|
||||
rtrprev = rtrtcb->blink;
|
||||
if (!rtrprev)
|
||||
{
|
||||
PANIC(OSERR_NOIDLETASK);
|
||||
/* Special case: Inserting pndtcb at the head of the list */
|
||||
/* Inform the instrumentation layer that we are switching tasks */
|
||||
|
||||
sched_note_switch(rtrtcb, pndtcb);
|
||||
|
||||
/* Then insert at the head of the list */
|
||||
|
||||
pndtcb->flink = rtrtcb;
|
||||
pndtcb->blink = NULL;
|
||||
rtrtcb->blink = pndtcb;
|
||||
g_readytorun.head = (FAR dq_entry_t*)pndtcb;
|
||||
rtrtcb->task_state = TSTATE_TASK_READYTORUN;
|
||||
pndtcb->task_state = TSTATE_TASK_RUNNING;
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The pndtcb goes just before rtrtcb */
|
||||
/* Insert in the middle of the list */
|
||||
|
||||
rtrprev = rtrtcb->blink;
|
||||
if (!rtrprev)
|
||||
{
|
||||
/* Special case: Inserting pndtcb at the head of the list */
|
||||
/* Inform the instrumentation layer that we are switching tasks */
|
||||
|
||||
sched_note_switch(rtrtcb, pndtcb);
|
||||
|
||||
/* Then insert at the head of the list */
|
||||
|
||||
pndtcb->flink = rtrtcb;
|
||||
pndtcb->blink = NULL;
|
||||
rtrtcb->blink = pndtcb;
|
||||
g_readytorun.head = (FAR dq_entry_t*)pndtcb;
|
||||
rtrtcb->task_state = TSTATE_TASK_READYTORUN;
|
||||
pndtcb->task_state = TSTATE_TASK_RUNNING;
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Insert in the middle of the list */
|
||||
|
||||
pndtcb->flink = rtrtcb;
|
||||
pndtcb->blink = rtrprev;
|
||||
rtrprev->flink = pndtcb;
|
||||
rtrtcb->blink = pndtcb;
|
||||
pndtcb->task_state = TSTATE_TASK_READYTORUN;
|
||||
}
|
||||
pndtcb->flink = rtrtcb;
|
||||
pndtcb->blink = rtrprev;
|
||||
rtrprev->flink = pndtcb;
|
||||
rtrtcb->blink = pndtcb;
|
||||
pndtcb->task_state = TSTATE_TASK_READYTORUN;
|
||||
}
|
||||
|
||||
/* Set up for the next time through */
|
||||
|
||||
+1
-4
@@ -139,10 +139,7 @@ int sem_wait(FAR sem_t *sem)
|
||||
* semaphore
|
||||
*/
|
||||
|
||||
if (rtcb->waitsem != NULL)
|
||||
{
|
||||
PANIC(OSERR_BADWAITSEM);
|
||||
}
|
||||
ASSERT(rtcb->waitsem == NULL);
|
||||
|
||||
/* Handle the POSIX semaphore (but don't set the owner yet) */
|
||||
|
||||
|
||||
+1
-4
@@ -101,10 +101,7 @@ static FAR sigactq_t *sig_allocateaction(void)
|
||||
/* And try again */
|
||||
|
||||
sigact = (FAR sigactq_t*)sq_remfirst(&g_sigfreeaction);
|
||||
if (!sigact)
|
||||
{
|
||||
PANIC(OSERR_OUTOFMEMORY);
|
||||
}
|
||||
ASSERT(sigact);
|
||||
}
|
||||
|
||||
return sigact;
|
||||
|
||||
@@ -349,10 +349,7 @@ int sig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
|
||||
else
|
||||
{
|
||||
irqrestore(saved_state);
|
||||
if (!sig_addpendingsignal(stcb, info))
|
||||
{
|
||||
PANIC(OSERR_FAILEDTOADDSIGNAL);
|
||||
}
|
||||
ASSERT(sig_addpendingsignal(stcb, info));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -140,10 +140,7 @@ int sigsuspend(FAR const sigset_t *set)
|
||||
|
||||
unblocksigno = sig_lowest(&intersection);
|
||||
sigpend = sig_removependingsignal(rtcb, unblocksigno);
|
||||
if (!sigpend)
|
||||
{
|
||||
PANIC(OSERR_FAILEDTOREMOVESIGNAL);
|
||||
}
|
||||
ASSERT(sigpend);
|
||||
|
||||
sig_releasependingsignal(sigpend);
|
||||
irqrestore(saved_state);
|
||||
|
||||
+3
-10
@@ -104,12 +104,8 @@ static void sig_timeout(int argc, uint32_t itcb)
|
||||
uint32_t itcb;
|
||||
} u;
|
||||
|
||||
u.itcb = itcb;
|
||||
|
||||
if (!u.wtcb)
|
||||
{
|
||||
PANIC(OSERR_TIMEOUTNOTCB);
|
||||
}
|
||||
u.itcb = itcb;
|
||||
ASSERT(u.wtcb);
|
||||
|
||||
/* There may be a race condition -- make sure the task is
|
||||
* still waiting for a signal
|
||||
@@ -210,10 +206,7 @@ int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
||||
*/
|
||||
|
||||
sigpend = sig_removependingsignal(rtcb, sig_lowest(&intersection));
|
||||
if (!sigpend)
|
||||
{
|
||||
PANIC(OSERR_NOPENDINGSIGNAL);
|
||||
}
|
||||
ASSERT(sigpend);
|
||||
|
||||
/* Return the signal info to the caller if so requested */
|
||||
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ int task_terminate(pid_t pid, bool nonblocking)
|
||||
dtcb->task_state >= NUM_TASK_STATES)
|
||||
{
|
||||
sched_unlock();
|
||||
PANIC(OSERR_BADDELETESTATE);
|
||||
PANIC();
|
||||
}
|
||||
|
||||
/* Perform common task termination logic (flushing streams, calling
|
||||
|
||||
+22
-26
@@ -123,38 +123,34 @@ int wd_cancel (WDOG_ID wdid)
|
||||
* error has occurred because the watchdog is marked active!
|
||||
*/
|
||||
|
||||
if (!curr)
|
||||
ASSERT(curr);
|
||||
|
||||
/* If there is a watchdog in the timer queue after the one that
|
||||
* is being canceled, then it inherits the remaining ticks.
|
||||
*/
|
||||
|
||||
if (curr->next)
|
||||
{
|
||||
PANIC(OSERR_WDOGNOTFOUND);
|
||||
curr->next->lag += curr->lag;
|
||||
}
|
||||
|
||||
/* Now, remove the watchdog from the timer queue */
|
||||
|
||||
if (prev)
|
||||
{
|
||||
(void)sq_remafter((FAR sq_entry_t*)prev, &g_wdactivelist);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If there is a watchdog in the timer queue after the one that
|
||||
* is being canceled, then it inherits the remaining ticks.
|
||||
*/
|
||||
|
||||
if (curr->next)
|
||||
{
|
||||
curr->next->lag += curr->lag;
|
||||
}
|
||||
|
||||
/* Now, remove the watchdog from the timer queue */
|
||||
|
||||
if (prev)
|
||||
{
|
||||
(void)sq_remafter((FAR sq_entry_t*)prev, &g_wdactivelist);
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)sq_remfirst(&g_wdactivelist);
|
||||
}
|
||||
wdid->next = NULL;
|
||||
|
||||
/* Return success */
|
||||
|
||||
ret = OK;
|
||||
(void)sq_remfirst(&g_wdactivelist);
|
||||
}
|
||||
|
||||
wdid->next = NULL;
|
||||
|
||||
/* Return success */
|
||||
|
||||
ret = OK;
|
||||
|
||||
/* Mark the watchdog inactive */
|
||||
|
||||
wdid->active = false;
|
||||
|
||||
+1
-1
@@ -337,7 +337,7 @@ void wd_timer(void)
|
||||
{
|
||||
default:
|
||||
#ifdef CONFIG_DEBUG
|
||||
PANIC(OSERR_INTERNAL);
|
||||
PANIC();
|
||||
#endif
|
||||
case 0:
|
||||
(*((wdentry0_t)(wdog->func)))(0);
|
||||
|
||||
Reference in New Issue
Block a user