Initialization
[AVR]

Collaboration diagram for Initialization:


Detailed Description

Starting Nut/OS.


Defines

#define NUTMEM_END   (u_short)(NUTMEM_START + (u_short)NUTMEM_SIZE - 1U)
 Last memory address without using external SRAM.
#define AVR_SLEEP_CTRL_REG   MCUCR

Functions

void NutInit (void)
 Nut/OS Initialization.
void NutAppMain (void *arg)
u_char NutThreadSetSleepMode (u_char mode)
 Sets the sleep mode to enter in Idle thread.
void NutIdle (void *arg)
 AVR Idle thread.

Variables

u_char idle_sleep_mode = SLEEP_MODE_NONE


Define Documentation

#define NUTMEM_END   (u_short)(NUTMEM_START + (u_short)NUTMEM_SIZE - 1U)

Last memory address without using external SRAM.

Todo:
Shall we support NUTRAMEND for backward compatibility? If, then let's do it in cfg/memory.h.

Definition at line 148 of file nutinit.c.

Referenced by NutInit().

#define AVR_SLEEP_CTRL_REG   MCUCR

Definition at line 174 of file nutinit.c.


Function Documentation

void NutInit ( void   ) 

Nut/OS Initialization.

Initializes the memory management and the thread system and starts an idle thread, which in turn initializes the timer management. Finally the application's main() function is called.

Definition at line 665 of file nutinit.c.

References BV, confos, HEAP_SIZE, HEAP_START, _CONFOS::hostname, MC_FMR, MC_FWS_2R3W, McuInit(), NUT_THREAD_IDLESTACK, NutGetCpuClock(), NutHeapAdd(), NutIdle(), NutLoadConfig(), NUTMEM_END, NutSaveConfig(), NutThreadCreate(), outp, outr, RXEN, strcpy(), TXEN, and UCR.

void NutAppMain ( void *  arg  ) 

u_char NutThreadSetSleepMode ( u_char  mode  ) 

Sets the sleep mode to enter in Idle thread.

If the idle thread is running, no other thread is active so we can safely put the mcu to sleep.

Parameters:
mode one of the sleep modes defined in avr/sleep.h or sleep_mode_none (don't enter sleep mode)
Returns:
previous sleep mode

Definition at line 424 of file nutinit.c.

References idle_sleep_mode.

void NutIdle ( void *  arg  ) 

AVR Idle thread.

Running at priority 254 in an endless loop.

Definition at line 437 of file nutinit.c.

References _BV, AVR_SLEEP_CTRL_REG, bit_is_set, cbi, idle_sleep_mode, main, NUT_THREAD_MAINSTACK, NutThreadCreate(), NutThreadDestroy(), NutThreadSetPriority(), NutThreadYield(), NutTimerInit(), sbi, and SLEEP_MODE_NONE.

Referenced by NutInit().


Variable Documentation

u_char idle_sleep_mode = SLEEP_MODE_NONE

Definition at line 168 of file nutinit.c.

Referenced by NutIdle(), and NutThreadSetSleepMode().


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/