Collaboration diagram for Context Switching:
![]() |
This code should work with other GCC distributions for the ARM CPU.
Functions | |
void | NutThreadSwitch (void) |
Switch to another thread. | |
HANDLE | NutThreadCreate (char *name, void(*fn)(void *), void *arg, size_t stackSize) |
Create a new thread. |
void NutThreadSwitch | ( | void | ) |
Switch to another thread.
Stop the current thread, saving its context. Then start the one with the highest priority, which is ready to run.
Application programs typically do not call this function.
Definition at line 182 of file context_icc.c.
References runningThread, runQueue, _NUTTHREADINFO::td_sp, _NUTTHREADINFO::td_state, and TDS_RUNNING.
HANDLE NutThreadCreate | ( | char * | name, | |
void(*)(void *) | fn, | |||
void * | arg, | |||
size_t | stackSize | |||
) |
Create a new thread.
If the current thread's priority is lower or equal than the default priority (64), then the current thread is stopped and the new one is started.
name | String containing the symbolic name of the new thread, up to 8 characters long. | |
fn | The thread's entry point, typically created by the THREAD macro. | |
arg | Argument pointer passed to the new thread. | |
stackSize | Number of bytes of the stack space allocated for the new thread. |
Definition at line 202 of file context.c.
References ARM_MODE_SVC, DEADBEEF, F_BIT, I_BIT, memcpy(), NutEnterCritical, NutExitCritical, NutHeapAlloc(), NutThreadAddPriQueue(), nutThreadList, NutThreadSwitch(), runningThread, runQueue, _NUTTHREADINFO::td_memory, _NUTTHREADINFO::td_name, _NUTTHREADINFO::td_next, _NUTTHREADINFO::td_priority, _NUTTHREADINFO::td_queue, _NUTTHREADINFO::td_sp, _NUTTHREADINFO::td_state, _NUTTHREADINFO::td_timer, TDS_READY, and TDS_RUNNING.
Referenced by AhdlcAvrInit(), AsixInit(), cs8900Init(), CSNicInit(), DisplayInit(), DmInit(), EmacInit(), IDEInit(), LancInit(), main(), NicInit(), NutIdle(), NutInit(), NutPppInitStateMachine(), NutRegisterDiscovery(), NutSNTPStartThread(), NutTcpInitStateMachine(), ScannerInit(), SJAInit(), and wlandrv_Init().