HC: Replace explicit references to g_readytorun with indirect references via the macro this_task()
This commit is contained in:
parent
c62177be00
commit
2b8d1fcbdb
@ -76,7 +76,7 @@
|
||||
|
||||
void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *rtcb = this_task();
|
||||
bool switch_needed;
|
||||
|
||||
/* Verify that the context switch can be performed */
|
||||
@ -97,7 +97,7 @@ void up_block_task(struct tcb_s *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
|
||||
/* If there are any pending tasks, then add them to the ready-to-run
|
||||
* task list now
|
||||
*/
|
||||
|
||||
@ -125,10 +125,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
||||
up_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the g_readytorun task list.
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
@ -142,17 +142,17 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
||||
}
|
||||
|
||||
/* Copy the user C context into the TCB at the (old) head of the
|
||||
* g_readytorun Task list. if up_saveusercontext returns a non-zero
|
||||
* ready-to-run Task list. if up_saveusercontext returns a non-zero
|
||||
* value, then this is really the previously running task restarting!
|
||||
*/
|
||||
|
||||
else if (!up_saveusercontext(rtcb->xcp.regs))
|
||||
{
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the g_readytorun task list.
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Make sure that the address environment for the previously
|
||||
|
@ -146,7 +146,7 @@ void _exit(int status)
|
||||
|
||||
(void)irqsave();
|
||||
|
||||
slldbg("TCB=%p exiting\n", g_readytorun.head);
|
||||
slldbg("TCB=%p exiting\n", this_task());
|
||||
|
||||
#if defined(CONFIG_DUMP_ON_EXIT) && defined(CONFIG_DEBUG)
|
||||
slldbg("Other tasks:\n");
|
||||
@ -161,7 +161,7 @@ void _exit(int status)
|
||||
* head of the list.
|
||||
*/
|
||||
|
||||
tcb = (struct tcb_s*)g_readytorun.head;
|
||||
tcb = this_task();
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Make sure that the address environment for the previously running
|
||||
|
@ -64,11 +64,11 @@
|
||||
|
||||
void up_release_pending(void)
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *rtcb = this_task();
|
||||
|
||||
slldbg("From TCB=%p\n", rtcb);
|
||||
|
||||
/* Merge the g_pendingtasks list into the g_readytorun task list */
|
||||
/* Merge the g_pendingtasks list into the ready-to-run task list */
|
||||
|
||||
/* sched_lock(); */
|
||||
if (sched_mergepending())
|
||||
@ -92,10 +92,10 @@ void up_release_pending(void)
|
||||
up_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the g_readytorun task list.
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
@ -117,10 +117,10 @@ void up_release_pending(void)
|
||||
else if (!up_saveusercontext(rtcb->xcp.regs))
|
||||
{
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the g_readytorun task list.
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Make sure that the address environment for the previously
|
||||
|
@ -92,7 +92,7 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *rtcb = this_task();
|
||||
bool switch_needed;
|
||||
|
||||
slldbg("TCB=%p PRI=%d\n", tcb, priority);
|
||||
@ -147,10 +147,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
||||
up_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the g_readytorun task list.
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
@ -164,17 +164,17 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
||||
}
|
||||
|
||||
/* Copy the exception context into the TCB at the (old) head of the
|
||||
* g_readytorun Task list. if up_saveusercontext returns a non-zero
|
||||
* ready-to-run Task list. if up_saveusercontext returns a non-zero
|
||||
* value, then this is really the previously running task restarting!
|
||||
*/
|
||||
|
||||
else if (!up_saveusercontext(rtcb->xcp.regs))
|
||||
{
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the g_readytorun task list.
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Make sure that the address environment for the previously
|
||||
|
@ -71,7 +71,7 @@
|
||||
|
||||
void up_unblock_task(struct tcb_s *tcb)
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *rtcb = this_task();
|
||||
|
||||
/* Verify that the context switch can be performed */
|
||||
|
||||
@ -83,7 +83,7 @@ void up_unblock_task(struct tcb_s *tcb)
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
* ready-to-run task list
|
||||
*/
|
||||
|
||||
if (sched_addreadytorun(tcb))
|
||||
@ -107,10 +107,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
||||
up_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Restore the exception context of the rtcb at the (new) head
|
||||
* of the g_readytorun task list.
|
||||
* of the ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
@ -133,10 +133,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
||||
{
|
||||
/* 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.
|
||||
* ready-to-run task list.
|
||||
*/
|
||||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Make sure that the address environment for the previously
|
||||
|
@ -191,7 +191,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
static void up_dumpstate(void)
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *rtcb = this_task();
|
||||
uint16_t sp = up_getsp();
|
||||
uint16_t ustackbase;
|
||||
uint16_t ustacksize;
|
||||
@ -293,7 +293,7 @@ static void _up_assert(int errorcode)
|
||||
{
|
||||
/* Are we in an interrupt handler or the idle task? */
|
||||
|
||||
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||
if (current_regs || (this_task())->pid == 0)
|
||||
{
|
||||
(void)irqsave();
|
||||
for (;;)
|
||||
@ -323,7 +323,7 @@ static void _up_assert(int errorcode)
|
||||
void up_assert(const uint8_t *filename, int lineno)
|
||||
{
|
||||
#ifdef CONFIG_PRINT_TASKNAME
|
||||
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *rtcb = this_task();
|
||||
#endif
|
||||
|
||||
board_autoled_on(LED_ASSERTION);
|
||||
@ -339,7 +339,7 @@ void up_assert(const uint8_t *filename, int lineno)
|
||||
up_dumpstate();
|
||||
|
||||
#ifdef CONFIG_BOARD_CRASHDUMP
|
||||
board_crashdump(up_getsp(), g_readytorun.head, filename, lineno);
|
||||
board_crashdump(up_getsp(), this_task(), filename, lineno);
|
||||
#endif
|
||||
|
||||
_up_assert(EXIT_FAILURE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user