Nut/OS  4.10.3
API Reference
XgNutAvr32OsContext
Collaboration diagram for XgNutAvr32OsContext:

Data Structures

struct  SWITCHFRAME
 ARM7TDMI GCC context switch frame layout. More...
struct  ENTERFRAME
 Thread entry frame layout. More...

Functions

void NutThreadSwitch (void)
 Switch to another thread.
HANDLE NutThreadCreate (char *name, void(*fn)(void *), void *arg, size_t stackSize)
 Create a new thread.

Detailed Description

Copyright (C) 2001-2010 by egnite Software GmbH

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

For additional information see http://www.ethernut.de/


Function Documentation

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.

Note:
CPU interrupts must be disabled before calling this function.

Definition at line 168 of file context.c.

References runningThread, runQueue, _NUTTHREADINFO::td_sp, _NUTTHREADINFO::td_state, and TDS_RUNNING.

Referenced by NutThreadCreate(), NutThreadResume(), and NutThreadSetPriority().

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.

Parameters:
nameString containing the symbolic name of the new thread, up to 8 characters long.
fnThe thread's entry point, typically created by the THREAD macro.
argArgument pointer passed to the new thread.
stackSizeNumber of bytes of the stack space allocated for the new thread.
Note:
The thread must run in ARM mode. Thumb mode is not supported.
Returns:
Pointer to the NUTTHREADINFO structure or 0 to indicate an error.

Definition at line 161 of file context.c.

References ENTERFRAME::cef_pc, ENTERFRAME::cef_r12, SWITCHFRAME::csf_cpsr, SWITCHFRAME::csf_lr, DEADBEEF, 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 AhdlcAt91Init(), AhdlcAvrInit(), AsixInit(), cs8900Init(), CSNicInit(), DmInit(), EmacInit(), IDEInit(), LancInit(), main(), NicInit(), NutIdle(), NutInit(), NutPppInitStateMachine(), NutRegisterDiscovery(), NutRegisterKey(), NutRegisterLed(), NutSNTPStartThread(), NutTcpInitStateMachine(), Sc16is752UsartInit(), SJAInit(), upnp_Init(), and wlandrv_Init().

Here is the call graph for this function: