Nut/OS API

Collaboration diagram for Nut/OS API:
Operating System API. More...


Modules

 System Initialization
 Nut/OS initialization.
 System Configuration
 Nut/OS configuration structure.
 Thread Management
 Cooperative multi-threading support.
 Event Management
 Thread synchronization support.
 Timer Management
 Asynchronous timer support.
 Memory Management
 Dynamic memory management.
 Device Management
 Device driver support.
 Interrupt Management
 Interrupt support.
 Version Information
 Nut/OS version number.
 Application Candies
 In order to keep the kernel clean and small, it uses very basic functions only:.

Defines

#define NUTMEM_ALIGNMENT   sizeof(int)
#define NUTMEM_BOTTOM_ALIGN(s)   ((s) & ~(NUTMEM_ALIGNMENT - 1))
 Return the next lower aligned value.
#define NUTMEM_TOP_ALIGN(s)   NUTMEM_BOTTOM_ALIGN((s + (NUTMEM_ALIGNMENT - 1)))
 Return the next higher aligned value.
#define __byte_swap2(val)
#define __byte_swap4(val)
#define htons(x)   __byte_swap2(x)
 Convert short value from host to network byte order.
#define htonl(x)   __byte_swap4(x)
 Convert long value from host to network byte order.
#define ntohs(x)   __byte_swap2(x)
 Convert short value from network to host byte order.
#define ntohl(x)   __byte_swap4(x)
 Convert long value from network to host byte order.

Typedefs

typedef unsigned char u_char
 Unsigned 8-bit value.
typedef unsigned short u_short
 Unsigned 16-bit value.
typedef unsigned int u_int
 Unsigned int value.
typedef unsigned long u_long
 Unsigned 32-bit value.
typedef unsigned
long long 
u_longlong
 Unsigned 64-bit value.
typedef void * HANDLE
 Void pointer.
typedef unsigned
__PTRDIFF_TYPE__ 
uptr_t
 Unsigned register type.

Detailed Description

Operating System API.

This API supports the following features:


Define Documentation

#define NUTMEM_ALIGNMENT   sizeof(int)

Definition at line 178 of file types.h.

#define NUTMEM_BOTTOM_ALIGN (  )     ((s) & ~(NUTMEM_ALIGNMENT - 1))

Return the next lower aligned value.

Definition at line 185 of file types.h.

Referenced by NutHeapRootAdd().

#define NUTMEM_TOP_ALIGN (  )     NUTMEM_BOTTOM_ALIGN((s + (NUTMEM_ALIGNMENT - 1)))

Return the next higher aligned value.

Definition at line 190 of file types.h.

Referenced by NutHeapRootAdd(), NutHeapRootAlloc(), and NutHeapRootRealloc().

#define __byte_swap2 ( val   ) 

Value:

((((val) & 0xff) << 8) |        \
     (((val) & 0xff00) >> 8))

Definition at line 276 of file types.h.

#define __byte_swap4 ( val   ) 

Value:

((((val) & 0xff) << 24) |       \
     (((val) & 0xff00) << 8) |      \
     (((val) & 0xff0000) >> 8) |    \
     (((val) & 0xff000000) >> 24))

Definition at line 280 of file types.h.

#define htons (  )     __byte_swap2(x)

Convert short value from host to network byte order.

Definition at line 318 of file types.h.

Referenced by LcpTxProtRej(), NutArpAllocNetBuf(), NutArpInput(), NutEtherOutput(), NutIpcpInput(), NutIpcpOutput(), NutIpInput(), NutIpOutput(), NutLcpInput(), NutLcpOutput(), NutPapInput(), NutPapOutput(), NutPppOutput(), NutTcpAccept(), NutTcpConnect(), NutTcpOutput(), NutTcpReject(), NutUdpCreateSocket(), NutUdpOutput(), NutUdpReceiveFrom(), and NutWinsNameQuery().

#define htonl (  )     __byte_swap4(x)

Convert long value from host to network byte order.

Definition at line 327 of file types.h.

Referenced by LcpTxConfReq(), NutTcpOutput(), NutTcpReject(), and NutWinsNameQuery().

#define ntohs (  )     __byte_swap2(x)

Convert short value from network to host byte order.

Examples:
httpd/httpserv.c.

Definition at line 336 of file types.h.

Referenced by NutArpInput(), NutDumpIpcp(), NutDumpLcp(), NutDumpLcpOption(), NutDumpPap(), NutDumpPpp(), NutDumpSocketList(), NutEtherInput(), NutIpInput(), NutPppInput(), and NutWinsNameQuery().

#define ntohl (  )     __byte_swap4(x)

Convert long value from network to host byte order.

Definition at line 345 of file types.h.

Referenced by NutDumpLcpOption(), NutDumpTcpHeader(), NutSNTPGetTime(), NutTcpOutput(), and NutTcpReject().


Typedef Documentation

typedef unsigned char u_char

Unsigned 8-bit value.

Todo:
We should switch to stdint.h as suggested by Dirk Kaufmann. See feature request #1282721.
Examples:
canbus/candemo.c, ftpd/ftpserv.c, httpd/httpserv.c, inetq/inetq.c, logtime/logtime.c, nutpiper/nutpiper.c, playmp3/playmp3.c, portdio/portdio.c, rs232d/rs232d.c, snmpd/snmpd.c, and tcps/tcps.c.

Definition at line 200 of file types.h.

typedef unsigned short u_short

Unsigned 16-bit value.

Examples:
ftpd/ftpserv.c, nutpiper/nutpiper.c, pppc/pppc.c, and snmpd/snmpd.c.

Definition at line 203 of file types.h.

typedef unsigned int u_int

Unsigned int value.

Examples:
ftpd/ftpserv.c, portdio/portdio.c, tcps/tcps.c, and timers/timers.c.

Definition at line 207 of file types.h.

typedef unsigned long u_long

Unsigned 32-bit value.

Examples:
caltime/caltime.c, canbus/candemo.c, cppdemo/cppdemo.cc, events/events.c, ftpd/ftpserv.c, httpd/httpserv.c, inetq/inetq.c, logtime/logtime.c, nutpiper/nutpiper.c, playmp3/playmp3.c, portdio/portdio.c, pppc/pppc.c, rs232d/rs232d.c, snmpd/snmpd.c, tcps/tcps.c, threads/threads.c, timers/timers.c, and uart/uart.c.

Definition at line 210 of file types.h.

typedef unsigned long long u_longlong

Unsigned 64-bit value.

Definition at line 213 of file types.h.

typedef void* HANDLE

Void pointer.

Definition at line 218 of file types.h.

typedef unsigned __PTRDIFF_TYPE__ uptr_t

Unsigned register type.

The size of this type is equal to the size of a register, the hardware datapath or whatever might fit to give optimum performance for values from 0 to 255.

Typically 8 bit CPUs will use unsigned characters, 16 bit CPUs will use unsigned shorts etc.

Signed register type.

Similar to ureg_t, but for signed values from -128 to +127.

Unsigned pointer value type.

The size of this type is at least the size of a memory pointer. For CPUs with 16 address bits this will be an unsigned short.

Definition at line 271 of file types.h.


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