Standard header files file retained in can be included in the <i>normal</i> fashion:
</p>
<ul>
<code>include <stdio.h></code><br>
<code>include <sys/types.h></code><br>
etc.
</ul>
<p>
Directory structure:
</p>
<ul><pre>
include/
|-- <i>(standard header files)</i>
|-- arpa/
| `-- <i>(Standard header files)</i>
|-- cxx/
| `-- <i>(C++ standard header files)</i>
|-- net/
| `-- uip/
| `-- <i>(uIP specific header files)</i>
|-- netinet/
| `-- <i>(Standard header files)</i>
|-- nuttx/
| `-- <i>(NuttX specific header files)</i>
`- sys/
`-- <i>(More standard header files)</i>
</per></ul>
<h2>2.9 <aname="DirStructLib">nuttx/lib</a></h2>
<p>
This directory holds a collection of standard libc-like functions with custom
interfaces into NuttX.
</p>
<p>
Normally the logic in this file builds to a single library (<code>liblib.a</code>).
However, if NuttX is built as a separately compiled kernel (with <code>CONFIG_NUTTX_KERNEL=y</code>), then the contents of this directory are built as two libraries:
One for use by user programs (<code>libulib.a</code>) and one for use only within the <kernel> space (<code>libklib.a</code>).
</p>
<p>
These user/kernel space libraries (along with the sycalls of <ahref="#DirStructSyscall"><code>nuttx/syscall</code></a>) are needed to support the two differing protection domains.
</p>
<p>
Directory structure:
</p>
<ul><pre>
lib/
|-- libgen/
| `-- <i>(Implementation of functions from libgen.h)</i>
|-- math/
| `-- <i>(Implementation of functions from fixedmath.h)</i>
|-- misc/
| `-- <i>(Implementation of miscellaneous library functions)</i>
|-- mqueue/
| `-- <i>(Implementation of some functions from mqueue.h)</i>
|-- net/
| `-- <i>(Implementation of network-related library functions)</i>
|-- queue/
| `-- <i>(Implementation of functions from queue.h)</i>
|-- sched/
| `-- <i>(Implementation of some functions from sched.h)</i>
|-- semaphore/
| `-- <i>(Implementation of some functions from semaphore.h)</i>
|-- signal/
| `-- <i>(Implementation of some functions from signal.h)</i>
|-- stdio/
| `-- <i>(Implementation of functions from stdio.h)</i>
|-- stdlib/
| `-- <i>(Implementation of functions from stdlib.h)</i>
|-- string/
| `-- <i>(Implementation of functions from string.h)</i>
|-- time/
| `-- <i>(Implementation of some functions from time.h)</i>
`-- unistd/
`-- <i>(Implementation of some functions from unistd.h)</i>
<ahref="#boardconfigsubdirs">board-specific configuration files</a> into the top level directory which appears in the make files as the make variable, <code>${TOPDIR}</code>.
This could be done manually as follows:
</p>
<ul>
<li>Copy <code>configs/</code><i><board-name></i><code>/[</code><i><config-dir></i><code>/]Make.defs</code> to <code>${TOPDIR}/Make.defs</code>,<li>
<li>Copy <code>configs/</code><i><board-name></i><code>/[</code><i><config-dir></i><code>/]setenv.sh</code> to <code>${TOPDIR}/setenv.sh</code>, and</li>
<li>Copy <code>configs/</code><i><board-name></i><code>/[</code><i><config-dir></i><code>/]defconfig</code> to <code>${TOPDIR}/.config</code></li>
</ul>
<p>
And if <code>configs/</code><i><board-name></i><code>/[</code><i><config-dir></i><code>/appconfig</code> exists in the board configuration directory:
</p>
<ul>
<li>Copy <code>configs/</code><i><board-name></i><code>/[</code><i><config-dir></i><code>/appconfig</code> to <app-dir><code>/.config</code></li>
The NuttX version number expressed a major and minor number separated
by a period
<outfile-path>
The full path to the version file to be created
</pre></ul>
<p>
As an example, the following command will generate a version file for version 6.1 using the current SVN revision number:
</p>
<ul><pre>
tools/version.h -v 6.1 .version
</pre></ul>
<p>
The <code>.version</code> file is also used during the build process to create a C header file at <code>include/nuttx/version.h</code> that contains the same version information.
That version file may be used by your C applications for, as an example, reporting version information.
</p>
<p>
<b>Additional Configuration Steps</b>.
The remainder of configuration steps will be performed by <ahref="#topmakefile"><code>${TOPDIR}/Makefile</code></a>
the first time the system is built as described below.
</p>
<h2><aname="buildingnuttx">3.2 Building NuttX</a></h2>
<p>
<b>Building NuttX</b>.
Once NuttX has been configured as described <ahref="#configuringnuttx">above</a>, it may be built as follows:
</p>
<ul><pre>
cd ${TOPDIR}
source ./setenv.sh
make
</pre></ul>
<p>
The <code>${TOPDIR}</code> directory holds:
</p>
<ul>
<li>The top level <ahref="#topmakefile"><code>Makefile</code></a> that controls the NuttX build.
</ul>
<p>
That directory also holds:
</p>
<ul>
<li>The makefile fragment <ahref="#boardconfigsubdirs"><code>.config</code></a> that describes the current configuration.</li>
<li>The makefile fragment <ahref="#boardconfigsubdirs"><code>Make.defs</code></a> that provides customized build targets, and</li>
<li>The shell script <ahref="#boardconfigsubdirs"><code>setenv.sh</code></a> that sets up the configuration environment for the build.</li>
</ul>
<p>
The <ahref="#boardconfigsubdirs"><code>setenv.sh</code></a> contains Linux/Cygwin environmental settings that are needed for the build.
The specific environmental definitions are unique for each board but should include, as a minimum, updates to the <code>PATH</code> variable to include the full path to the architecture-specific toolchain identified in <ahref="#boardconfigsubdirs"><code>Make.defs</code></a>.
The <ahref="#boardconfigsubdirs"><code>setenv.sh</code></a> only needs to be source'ed at the beginning of a session.
The system can be re-made subsequently by just typing <code>make</code>.
</p>
<p>
<b>First Time Make.</b>
Additional configuration actions will be taken the first time that system is built.
These additional steps include:
</p>
<ul>
<li>Auto-generating the file <code>include/nuttx/config.h</code> using the <code>${TOPDIR}/.config</code> file.</li>
<li>Auto-generating the file <code>${TOPDIR}/.version</code> with version 0.0 if one does not exist.</li>
<li>Auto-generating the file <code>include/nuttx/version.h</code> using the <code>${TOPDIR}/.version</code> file.</li>
<li>Creating a link to <code>${TOPDIR}/arch/</code><i><arch-name></i><code>/include</code> at <code>${TOPDIR}/include/arch</code>.</li>
<li>Creating a link to <code>${TOPDIR}/configs/</code><i><board-name></i><code>/include</code> at <code>${TOPDIR}/include/arch/board</code>.</li>
<li>Creating a link to <code>${TOPDIR}/configs/</code><i><board-name></i><code>/src</code> at <code>${TOPDIR}/arch/</code><i><arch-name></i><code>/src/board</code></li>
<li>Creating a link to <code>${APPDIR}/include</code> at <code>${TOPDIR}/include/apps</code></li>
This is a debug interface exported by the architecture-specific logic.
Output one character on the console
</p>
<h3><aname="systemtime">4.1.20 System Time and Clock</a></h3>
<h4>4.1.20.1 Basic System Timer</h4>
<p><b>System Timer</b>
In most implementations, system time is provided by a timer interrupt.
That timer interrupt runs at rate determined by <code>CONFIG_MSEC_PER_TICKS</code> (default 10 or 100Hz).
The timer generates an interrupt each <code>CONFIG_MSEC_PER_TICKS</code> milliseconds and increments a counter called <code>g_system_timer</code>.
<code>g_system_timer</code> then provides a time-base for calculating <i>up-time</i> and elapsed time intervals in units of <code>CONFIG_MSEC_PER_TICKS</code>.
The range of <code>g_system_timer</code> is, by default, 32-bits.
However, if the MCU supports type <code>long long</code> and <code>CONFIG_SYSTEM_TIME16</code> is selected,
a 64-bit system timer will be supported instead.
</p>
<p><b>System Timer Accuracy</b>
On many system, the exact timer interval specified by <code>CONFIG_MSEC_PER_TICKS</code> cannot be achieved due to limitations in frequencies or in dividers.
As a result, the time interval specified by <code>CONFIG_MSEC_PER_TICKS</code> may only be approximate and there may be small errors in the apparent <i>up-time</i> time.
These small errors, however, will accumulate over time and after a long period of time may have an unacceptably large error in the apparent <i>up-time</i> of the MCU.
</p>
If the timer tick period generated by the hardware is not exactly <code>CONFIG_MSEC_PER_TICKS</code><i>and</i> if there you require accurate up-time for the MCU, then there are measures that you can take:
</p>
<ul>
<li>
Perhaps you can adjust <code>CONFIG_MSEC_PER_TICKS</code> to a different value so that an exactly <code>CONFIG_MSEC_PER_TICKS</code> can be accomplished.
</li>
<li>
Or you can use a technique known as <i>Delta-Sigma Modulation</i>. (Suggested by Uros Platise). Consider the example below.
</li>
</ul>
<p><b>Delta-Sigma Modulation Example</b>.
Consider this case: The system timer is a count-up timer driven at 32.768KHz.
There are dividers that can be used, but a divider of one yields the highest accuracy.
This counter counts up until the count equals a match value, then a timer interrupt is generated.
The desire frequency is 100Hz (<code>CONFIG_MSEC_PER_TICKS</code> is 10).
</p>
<p>
This exact frequency of 100Hz cannot be obtained in this case.
In order to obtain that exact frequency a match value of 327.68 would have to be provided.
The closest integer value is 328 but the ideal match value is between 327 and 328.
The closest value, 328, would yield an actual timer frequency of 99.9Hz!
That will may cause significant timing errors in certain usages.
</p>
<p>
Use of Delta-Sigma Modulation can eliminate this error in the long run.
Consider this example implementation:
</p>
<ol>
<li>
Initially an accumulator is zero an the match value is programmed to 328:
<ul><pre>
accumulator = 0;
match = 328;
</pre></ul>
</li>
<li>
On each timer interrupt, accumulator is updated with difference that, in this reflects, 100* the error in interval that just passed.
So on the first timer interrupt, the accumulator would be updated like:
<ul><pre>
if (match == 328)
{
accumulator += 32; // 100*(328 - 327.68)
}
else
{
accumulator -= 68; // (100*(327 - 327.68)
}
</pre></ul>
</li>
<li>
And on that same timer interrupt a new match value would be programmed:
<ul><pre>
if (accumulator <0)
{
match = 328;
}
else
{
match = 327;
}
</pre></ul>
</ol>
<p>
In this way, the timer interval is controlled from interrupt-to-interrupt to produce an average frequency of exactly 100Hz.
</p>
<h4>4.1.20.1 Hardware</h4>
<p>
To enable hardware module use the following configuration options:
<p>
<ul><dl>
<dt><code>CONFIG_RTC</code>
<dd>Enables general support for a hardware RTC.
Specific architectures may require other specific settings.
<dt><code>CONFIG_RTC_DATETIME</code>
<dd>There are two general types of RTC: (1) A simple battery backed counter that keeps the time when power
is down, and (2) A full date / time RTC the provides the date and time information, often in BCD format.
If <code>CONFIG_RTC_DATETIME</code> is selected, it specifies this second kind of RTC.
In this case, the RTC is used to "seed"" the normal NuttX timer and the NuttX system timer
provides for higher resoution time.
<dt><code>CONFIG_RTC_HIRES</code>
<dd>If <code>CONFIG_RTC_DATETIME</code> not selected, then the simple, battery backed counter is used.
There are two different implementations of such simple counters based on the time resolution of the counter:
The typical RTC keeps time to resolution of 1 second, usually supporting a 32-bit <code>time_t</code> value.
In this case, the RTC is used to "seed" the normal NuttX timer and the NuttX timer provides for higher resoution time.
If <code>CONFIG_RTC_HIRES</code> is enabled in the NuttX configuration, then the RTC provides higher resolution time and completely replaces the system timer for purpose of date and time.
<dt><code>CONFIG_RTC_FREQUENCY</code>
<dd>If <code>CONFIG_RTC_HIRES</code> is defined, then the frequency of the high resolution RTC must be provided.
If <code>CONFIG_RTC_HIRES</code> is not defined, <code>CONFIG_RTC_FREQUENCY</code> is assumed to be one.
<dt><code>CONFIG_RTC_ALARM</code>
<dd>Enable if the RTC hardware supports setting of an alarm.
A callback function will be executed when the alarm goes off
</dl></ul>
<p>
which requires the following base functions to read and set time:
</p>
<ul>
<li><code>up_rtcinitialize()</code>.
Initialize the hardware RTC per the selected configuration.
This function is called once during the OS initialization sequence
</li>
<li><code>up_rtc_time()</code>.
Get the current time in seconds. This is similar to the standard <code>time()</code> function.
This interface is only required if the low-resolution RTC/counter hardware implementation selected.
It is only used by the RTOS during intialization to set up the system time when <code>CONFIG_RTC</code> is set
but neither <code>CONFIG_RTC_HIRES</code> nor <code>CONFIG_RTC_DATETIME</code> are set.
</li>
<li><code>up_rtc_gettime()</code>.
Get the current time from the high resolution RTC clock/counter.
This interface is only supported by the hight-resolution RTC/counter hardware implementation.
It is used to replace the system timer (<code>g_system_tick</code>).
</li>
<li><code>up_rtc_settime()</code>.
Set the RTC to the provided time.
All RTC implementations must be able to set their time based on a standard timespec.
</li>
<li><code>up_rtc_setalarm()</code>.
Set up an alarm.
</li>
</ul>
<h4>4.1.20.2 System Tick and Time</h4>
<p>
The system tick is represented by::
</p>
<ul>
<li><code>g_system_timer</code></li>
</ul>
<p>
Running at rate of system base timer, used for time-slicing, and so forth.
</p>
<p>
If hardware RTC is present (<code>CONFIG_RTC</code>) and and high-resolution timing
is enabled (<code>CONFIG_RTC_HIRES</code>), then after successful
initiliazation variables are overriden by calls to <code>up_rtc_gettime()</code> which is
running continously even in power-down modes.
</p>
<p>
In the case of <code>CONFIG_RTC_HIRES</code> is set the <code>g_system_timer</code>
keeps counting at rate of a system timer, which however, is disabled in power-down mode.
By comparing this time and RTC (actual time) one may determine the actual system active time.
To retrieve that variable use:
</p>
<h2><aname="exports">4.2 APIs Exported by NuttX to Architecture-Specific Logic</a></h2>
<p>
These are standard interfaces that are exported by the OS
LED-related definitions are provided in two header files:
<ul>
<li>
LED definitions are provided for each board in the <code>board.h</code> that resides
in the <code><i><board-name></i>/include/board.h</code> file (which is also
linked to <code>include/arch/board/board.h</code> when the RTOS is configured).
Those definitions are discussed <ahref="#leddefinitions">below</a>.
</li>
<li>
The board-specific logic provides unique instances of the LED interfaces.
This is because the implementation of LED support may be very different
on different boards.
Prototypes for these board-specific implementations are, however, provided
in architecture-common header files.
That header file is usually at <code><i><arch-name></i>/src/common/up_internal.h</code>,
but could be at other locations in particular architectures.
These prototypes are discussed <ahref="#ledapis">below</a>.
</li>
</ul>
</p>
<h3><aname="leddefinitions">4.3.2 LED Definitions</a></h3>
<p>
The implementation of LED support is very specific to a board architecture.
Some boards have several LEDS, others have only one or two.
Some have none.
Others LED matrices and show alphanumeric data, etc.
The NuttX logic does not refer to specific LEDS, rather, it refers to an event to be shown on the LEDS
in whatever manner is appropriate for the board;
the way that this event is presented depends upon the hardware available on the board.
</p>
<p>
The model used by NuttX is that the board can show 8 events defined as follows in <code><i><board-name></i>/include/board.h</code>:
</p>
<ul><pre>
#define LED_STARTED ??
#define LED_HEAPALLOCATE ??
#define LED_IRQSENABLED ??
#define LED_STACKCREATED ??
#define LED_INIRQ ??
#define LED_SIGNAL ??
#define LED_ASSERTION ??
#define LED_PANIC ??
</pre></ul>
<p>
The specific value assigned to each pre-processor variable can be whatever makes the implementation easiest for the board logic.
The <i>meaning</i> associated with each definition is as follows:
</p>
<ul>
<li>
<code>LED_STARTED</code> is the value that describes the setting of the LEDs when the LED logic is first initialized.
This LED value is set but never cleared.
</li>
<li>
<code>LED_HEAPALLOCATE</code> indicates that the NuttX heap has been configured.
This is an important place in the boot sequence because if the memory is configured wrong, it will probably crash leaving this LED setting.
This LED value is set but never cleared.
</li>
<li>
<code>LED_IRQSENABLED</code> indicates that interrupts have been enabled.
Again, during bring-up (or if there are hardware problems), it is very likely that the system may crash just when interrupts are enabled, leaving this setting on the LEDs.
This LED value is set but never cleared.
</li>
<li>
<code>LED_STACKCREATED</code> is set each time a new stack is created.
If set, it means that the system attempted to start at least one new thread.
This LED value is set but never cleared.
</li>
<li>
<code>LED_INIRQ</code> is set and cleared on entry and exit from each interrupt.
If interrupts are working okay, this LED will have a dull glow.
</li>
<li>
<code>LED_SIGNAL</code> is set and cleared on entry and exit from a signal handler.
Signal handlers are tricky so this is especially useful during bring-up or a new architecture.
</li>
<li>
<code>LED_ASSERTION</code> is set if an assertion occurs.
</li>
<li>
<code>LED_PANIC</code> will blink at around 1Hz if the system panics and hangs.
</li>
</ul>
<h3><aname="ledapis">4.3.3 Common LED interfaces</a></h3>
<p>
The <code><i><arch-name></i>/src/common/up_internal.h</code> probably has definitions
like:
</p>
<ul><pre>
/* Defined in board/up_leds.c */
#ifdef CONFIG_ARCH_LEDS
extern void up_ledinit(void);
extern void up_ledon(int led);
extern void up_ledoff(int led);
#else
# define up_ledinit()
# define up_ledon(led)
# define up_ledoff(led)
#endif
</pre></ul>
<p>
Where:
<p>
<ul>
<li>
<code>void up_ledinit(void)</code> is called early in power-up initialization to initialize the LED hardware.
</li>
<li>
<code>up_ledon(int led)</code> is called to instantiate the LED presentation of the event.
The <code>led</code> argument is one of the definitions provided in <code><i><board-name></i>/include/board.h</code>.
</li>
<li>
<code>up_ledoff(int led</code>is called to terminate the LED presentation of the event.
The <code>led</code> argument is one of the definitions provided in <code><i><board-name></i>/include/board.h</code>.
Note that only <code>LED_INIRQ</code>, <code>LED_SIGNAL</code>, <code>LED_ASSERTION</code>, and <code>LED_PANIC</code>
Each USB host class driver must implement an instance of <code>struct usbhost_class_s</code>.
This structure is also defined in <code>include/nuttx/usb/usbhost.h</code>.
</p>
<p>
<b>Examples</b>:
<code>drivers/usbhost/usbhost_storage.c</code>
</p>
</li>
<li>
<p>
<b>USB Host Class Driver Registry</b>.
The NuttX USB host infrastructure includes a <i>registry</i>.
During its initialization, each USB host class driver must call the interface, <code>usbhost_registerclass()</code>
in order add its interface to the registery.
Later, when a USB device is connected, the USB host controller will look up the USB host class driver that is needed to support the connected device in this registry.
</p>
<p>
<b>Examples</b>:
<code>drivers/usbhost/usbhost_registry.c</code>, <code>drivers/usbhost/usbhost_registerclass.c</code>, and <code>drivers/usbhost/usbhost_findclass.c</code>,
</p>
</li>
<li>
<p>
<b>Detection and Enumeration of Connected Devices</b>.
Each USB host device controller supports two methods that are used to detect and enumeration newly connected devices
As part of this enumeration process, the driver will
(1) get the device's configuration descriptor,
(2) extract the class ID info from the configuration descriptor,
(3) call <code>usbhost_findclass(</code>) to find the class that supports this device,
(4) call the <code>create()</code> method on the <code>struct usbhost_registry_s interface</code> to get a class instance, and
finally (5) call the <code>connect()</code> method of the <code>struct usbhost_class_s</code> interface.
After that, the class is in charge of the sequence of operations.
</p>
</ul>
</p>
</li>
<li>
<p>
<b>Binding USB Host-Side Drivers</b>.
USB host-side controller drivers are not normally directly accessed by user code,
but are usually bound to another, higher level USB host class driver.
The class driver exports the standard NuttX device interface so that the connected USB device can be accessed just as with other, similar, on-board devices.
For example, the USB host mass storage class driver (<code>drivers/usbhost/usbhost_storage.c</code>) will register a standard, NuttX block driver interface (like <code>/dev/sda</code>)
that can be used to mount a file system just as with any other other block driver instance.
In general, the binding sequence is:
</p>
<p>
<ol>
<li>
<p>
Each USB host class driver includes an intialization entry point that is called from the
application at initialization time.
This driver calls <code>usbhost_registerclass()</code> during this initialization in order to makes itself available in the event the the device that it supports is connected.
</p>
<p>
<b>Examples</b>:
The function <code>usbhost_storageinit()</code> in the file <code>drivers/usbhost/usbhost_storage.c</code>
</p>
</li>
<li>
<p>
Each application must include a <i>waiter</i> thread thread that (1) calls the USB host controller driver's <code>wait()</code> to detect the connection of a device, and then
(2) call the USB host controller driver's <code>enumerate</code> method to bind the registered USB host class driver to the USB host controller driver.
</p>
<p>
<b>Examples</b>:
The function <code>nsh_waiter()</code> in the file <code>configs/nucleus2g/src/up_nsh.c</code> and
the function <code>nsh_waiter()</code> in the file <code>configs/olimex-lpc1766stk/src/up_nsh.c</code>.
</p>
</li>
<li>
<p>
As part of its operation during the binding operation, the USB host class driver will register an instances of a standard NuttX driver under the <code>/dev</code> directory.
To repeat the above example, the USB host mass storage class driver (<code>drivers/usbhost/usbhost_storage.c</code>) will register a standard, NuttX block driver interface (like <code>/dev/sda</code>)
that can be used to mount a file system just as with any other other block driver instance.
</p>
<p>
<b>Examples</b>:
See the call to <code>register_blockdriver()</code> in the function <code>usbhost_initvolume()</code> in the file <code>drivers/usbhost/usbhost_storage.c</code>.
</p>
</li>
</ol>
</p>
</li>
</ul>
<h3><aname="usbdevdrivers">6.3.10 USB Device-Side Drivers</a></h3>
<ul>
<li>
<p>
<b><code>include/nuttx/usb/usbdev.h</code></b>.
All structures and APIs needed to work with USB device-side drivers are provided in this header file.
General header files for the NuttX analog drivers reside in <code>include/nuttx/analog/</code>.
These header files includes both the application level interface to the analog driver as well as the interface between the "upper half" and "lower half" drivers.
Common analog logic and share-able analog drivers reside in the <code>drivers/analog/</code>.
</li>
<li>
Platform-specific drivers reside in <code>arch/</code><i><architecture></i><code>/src/</code><i><chip></i> directory for the specific processor <i><architecture></i> and for the specific <i><chip></i> analog peripheral devices.
The header file for the NuttX PWM driver reside at <code>include/nuttx/pwm.h</code>.
This header file includes both the application level interface to the PWM driver as well as the interface between the "upper half" and "lower half" drivers.
The PWM module uses a standard character driver framework.
However, since the PWM driver is a devices control interface and not a data transfer interface,
the majority of the functionality available to the application is implemented in driver ioctl calls.
Platform-specific PWM drivers reside in <code>arch/</code><i><architecture></i><code>/src/</code><i><chip></i> directory for the specific processor <i><architecture></i> and for the specific <i><chip></i> PWM peripheral devices.
<h3><aname="candrivers">6.3.13 CAN Drivers</a></h3>
<p>
NuttX supports only a very low-level CAN driver.
This driver supports only the data exchange and does not include any high-level CAN protocol.
The NuttX CAN driver is split into two parts:
</p>
<ol>
<li>
An "upper half", generic driver that provides the comman CAN interface to application level code, and
</li>
<li>
A "lower half", platform-specific driver that implements the low-level timer controls to implement the CAN functionality.
</li>
</ol>
<p>
Files supporting CAN can be found in the following locations:
</p>
<ul>
<li><b>Interface Definition</b>.
The header file for the NuttX CAN driver reside at <code>include/nuttx/can.h</code>.
This header file includes both the application level interface to the CAN driver as well as the interface between the "upper half" and "lower half" drivers.
The CAN module uses a standard character driver framework.
</li>
<li><b>"Upper Half" Driver</b>.
The generic, "upper half" CAN driver resides at <code>drivers/can.c</code>.
</li>
<li><b>"Lower Half" Drivers</b>.
Platform-specific CAN drivers reside in <code>arch/</code><i><architecture></i><code>/src/</code><i><chip></i> directory for the specific processor <i><architecture></i> and for the specific <i><chip></i> CAN peripheral devices.
This function is called by MCU-specific one-time at power on reset in order to initialize the power management capabilities.
This function must be called <i>very</i> early in the intialization sequence <i>before</i> any other device drivers are initialize (since they may attempt to register with the power management subsystem).
This function is called from the MCU-specific IDLE loop to monitor the the power management conditions.
This function returns the "recommended" power management state based on the PM configuration and activity reported in the last sampling periods.
The power management state is not automatically changed, however.
The IDLE loop must call <code>pm_changestate()</code> in order to make the state change.
</p>
<p>
These two steps are separated because the plaform-specific IDLE loop may have additional situational information that is not available to the the PM sub-system.
For example, the IDLE loop may know that the battery charge level is very low and may force lower power states even if there is activity.
</p>
<p>
NOTE: That these two steps are separated in time and, hence, the IDLE loop could be suspended for a long period of time between calling <code>pm_checkstate()</code> and <code>pm_changestate()</code>.
The IDLE loop may need to make these calls atomic by either disabling interrupts until the state change is completed.
These callback functions can be used to provide power management information to the driver.
</p>
<h4><aname="pmprepare">6.4.3.1 prepare()</a></h4>
<p><b>Function Prototype:</b></p>
<ul><pre>
int (*prepare)(FAR struct pm_callback_s *cb, enum pm_state_e pmstate);
</pre></ul>
<p><b>Description:</b>
Request the driver to prepare for a new power state.
This is a warning that the system is about to enter into a new power state.
The driver should begin whatever operations that may be required to enter power state.
The driver may abort the state change mode by returning a non-zero value from the callback function.
</p>
<p><b>Input Parameters:</b>
<dl>
<dt><code>cb</code>
<dd>Returned to the driver.
The driver version of the callback strucure may include additional, driver-specific state data at the end of the structure.
<dt><code>pmstate</code>
<dd>Identifies the new PM state
</dl>
</p>
<p><b>Returned Value:</b>
Zero (<code>OK</code>) means the event was successfully processed and that the driver is prepared for the PM state change.
Non-zero means that the driver is not prepared to perform the tasks needed achieve this power setting and will cause the state change to be aborted.
NOTE: The <code>prepare()</code> method will also be called when reverting from lower back to higher power consumption modes (say because another driver refused a lower power state change).
Drivers are not permitted to return non-zero values when reverting back to higher power
<code>libapps.a</code> is a static library ( an archive) that contains all of application object files.
</li>
<li>
<code>clean</code>.
Do whatever is appropriate to clean the application directories for a fresh build.
</li>
<li>
<code>distclean</code>.
Clean everthing -- auto-generated files, symbolic links etc. -- so that the directory contents are the same as the contents in your configuration management system.
This is only done when you change the NuttX configuration.
</li>
<li>
<code>context</code>.
Perform one-time configuration-related setup.
This might includes such things as creating auto-generated files or symbolic links for directory configurations.
</li>
<li>
<code>depend</code>.
Make or update the application build dependencies.
</li>
</ul>
</p>
<p>
When this application is invoked it will receive the setting <code>TOPDIR</code> like:
<code>TOPDIR</code> is the full path to the NuttX directory.
It can be used, for example, to include makefile fragments (e.g., <code>.config</code> or <code>Make.defs</code>) or to set up include file paths.
</p>
</li>
</ul>
<p>
Two-pass Build Options.
If the 2 pass build option is selected, then these options configure the make system build a extra link object.
This link object is assumed to be an incremental (relative) link object, but could be a static library (archive)
(some modification to this Makefile would be required if CONFIG_PASS1_TARGET generates an archive).
Pass 1 1ncremental (relative) link objects should be put into the processor-specific source directory
where other link objects will be created - ff the pass1 obect is an archive, it could go anywhere.
</p>
<ul>
<li>
<code>CONFIG_BUILD_2PASS</code>:
Enables the two pass build options.
</li>
</ul>
<p>
When the two pass build option is enabled, the following also apply:
</p>
<ul>
<li>
<p>
<code>CONFIG_PASS1_TARGET</code>: The name of the first pass build target.
</p>
</li>
<li><code>CONFIG_PASS1_BUILDIR</code>:
<p>
The path, relative to the top NuttX build directory to directory that contains the Makefile to build the first pass object.
The Makefile must support the following targets:
</p>
<p>
<ul>
<li>The special target <code>CONFIG_PASS1_TARGET</code> (if defined), and</li>
<li>The usual depend, clean, and distclean targets.</li>
</ul>
</p>
</li>
<li>
<code>CONFIG_PASS1_OBJECT</code>: May be used to include an extra, pass1 object into the final link.
This would probably be the object generated from the <code>CONFIG_PASS1_TARGET</code>.
It may be available at link time in the <code>arch/<architecture>/src</code> directory.
</li>
</ul>
<h2>Debug Options</h2>
<p>
General Debug setup options are provided to (1) enable and control debug console output, (2) to build NuttX for use with a debugger, and (3) to enable specific debug features:
This includes more extensive parameter checking, debug assertions, and other debug logic.
This option is also necessary (but not sufficient) to enable debug console output;
Debug console output must also be enabled on a subsystem-by-subsystem basis as described below.
</li>
<li>
<code>CONFIG_DEBUG_VERBOSE</code>: If debug console output is enabled, the option enables more verbose debug output.
Ignored if <code>CONFIG_DEBUG</code> is not defined.
If only <code>CONFIG_DEBUG</code> then the only output will be errors, warnings, and critical information.
If <code>CONFIG_DEBUG_VERBOSE</code> is defined in addition, then general debug comments will also be included in the console output.
</li>
<li>
<code>CONFIG_DEBUG_SYMBOLS</code>: build without optimization and with debug symbols (needed for use with a debugger).
This option has nothing to do with debug output.
</li>
<li>
<code>CONFIG_DEBUG_STACK</code>: a few ports include logic to monitor stack usage.
If the NuttX port supports this option, it would be enabled with this option.
This option also requires <code>CONFIG_DEBUG</code> to enable general debug features.
</li>
</ul>
<p>
If debug features are enabled with <code>CONFIG_DEBUG</code> (and possibly <code>CONFIG_DEBUG_VERBOSE</code>), then debug console output can also be enabled on a subsystem-by-subsystem basis.
Below are debug subsystems that are generally available on all platforms:
<ul>
<li>
<code>CONFIG_DEBUG_SCHED</code>: enable OS debug output (disabled by default)
</li>
<li>
<code>CONFIG_DEBUG_MM</code>: enable memory management debug output (disabled by default)
</li>
<li>
<code>CONFIG_DEBUG_NET</code>: enable network debug output (disabled by default)
</li>
<li>
<code>CONFIG_DEBUG_USB</code>: enable USB debug output (disabled by default)
</li>
<li>
<code>CONFIG_DEBUG_FS</code>: enable file system debug output (disabled by default)
</li>
<li>
<code>CONFIG_DEBUG_LIB</code>: enable C library debug output (disabled by default)
</li>
<li>
<code>CONFIG_DEBUG_BINFMT</code>: enable binary loader debug output (disabled by default)
</li>
<li>
<code>CONFIG_DEBUG_GRAPHICS</code>: enable NX graphics debug output (disabled by default)
</li>
</ul>
<p>
The following debug options may also be used with certain ports that support these features:
</p>
<ul>
<li>
<code>CONFIG_DEBUG_DMA</code>: enable DMA controller debug output (disabled by default)
</li>
<li>
<code>CONFIG_DEBUG_GPIO</code>: enable detail GPIO usage debug output (disabled by default)
</li>
<li>
<code>CONFIG_DEBUG_PAGING</code>: enable on-demand paging debug output (disabled by default)
This actual size of the paged text region (in pages).
This is also the number of virtual pages required to support the entire paged region.
The on-demand paging feature is intended to support only the case where the virtual paged text
area is much larger the available physical pages.
Otherwise, why would you enable on-demand paging?
</li>
<li>
<code>CONFIG_PAGING_NDATA</code>:
This is the number of data pages in the memory map.
The data region will extend to the end of RAM unless overridden by a setting in the configuration file.
<b>NOTE</b>:
In some architectures, it may be necessary to take some memory from the end of RAM for page tables
or other system usage.
The configuration settings and linker directives must be cognizant of that:
<code>CONFIG_PAGING_NDATA</code> should be defined to prevent the data region from extending all the way to the end of memory.
</li>
<li>
<code>CONFIG_PAGING_DEFPRIO</code>:
The default, minimum priority of the page fill worker thread.
The priority of the page fill work thread will be boosted boosted dynmically so that it matches the
priority of the task on behalf of which it peforms the fill.
This defines the minimum priority that will be used. Default: 50.
</li>
<li>
<code>CONFIG_PAGING_STACKSIZE</code>:
Defines the size of the allocated stack for the page fill worker thread. Default: 1024.
</li>
<li>
<code>CONFIG_PAGING_BLOCKINGFILL</code>:
The architecture specific <code>up_fillpage()</code> function may be blocking or non-blocking.
If defined, this setting indicates that the <code>up_fillpage()</code> implementation will block until the
transfer is completed. Default: Undefined (non-blocking).
</li>
<li>
<code>CONFIG_PAGING_WORKPERIOD</code>:
The page fill worker thread will wake periodically even if there is no mapping to do.
This selection controls that wake-up period (in microseconds).
This wake-up a failsafe that will handle any cases where a single is lost (that would
really be a bug and shouldn't happen!)
and also supports timeouts for case of non-blocking, asynchronous fills (see <code>CONFIG_PAGING_TIMEOUT_TICKS</code>).
</li>
<li>
<code>CONFIG_PAGING_TIMEOUT_TICKS</code>:
If defined, the implementation will monitor the (asynchronous) page fill logic.
If the fill takes longer than this number if microseconds, then a fatal error will be declared.
Default: No timeouts monitored.
</li>
<p>
Some architecture-specific settings.
Defaults are architecture specific.
If you don't know what you are doing, it is best to leave these undefined and try the system defaults:
</p>
<li>
<code>CONFIG_PAGING_VECPPAGE</code>:
This the physical address of the page in memory to be mapped to the vector address.
</li>
<li>
<code>CONFIG_PAGING_VECL2PADDR</code>:
This is the physical address of the L2 page table entry to use for the vector mapping.
</li>
<li>
<code>CONFIG_PAGING_VECL2VADDR</code>:
This is the virtual address of the L2 page table entry to use for the vector mapping.
</li>
<li>
<code>CONFIG_PAGING_BINPATH</code>:
If <code>CONFIG_PAGING_BINPATH</code> is defined, then it is the full path to a file on a mounted file system that contains a binary image of the NuttX executable.
Pages will be filled by reading from offsets into this file that correspond to virtual fault addresses.
</li>
<li>
<code>CONFIG_PAGING_MOUNTPT</code>:
If <code>CONFIG_PAGING_BINPATH</code> is defined, additional options may be provided to control the initialization of underlying devices.
<code>CONFIG_PAGING_MOUNTPT</code> identifies the mountpoint to be used if a device is mounted.
</li>
<li>
<code>CONFIG_PAGING_MINOR</code>:
Some mount operations require a "minor" number to identify the specific device instance.
Default: 0
</li>
<li>
<code>CONFIG_PAGING_SDSLOT</code>:
If <code>CONFIG_PAGING_BINPATH</code> is defined, additional options may be provided to control the initialization of underlying devices.
<code>CONFIG_PAGING_SDSLOT</code> identifies the slot number of the SD device to initialize.
This must be undefined if SD is not being used.
This should be defined to be zero for the typical device that has only a single slot (See <code>CONFIG_MMCSD_NSLOTS</code>).
If defined, <code>CONFIG_PAGING_SDSLOT</code> will instruct certain board-specific logic to initialize the media in this SD slot.
</li>
<li>
<code>CONFIG_PAGING_M25PX</code>:
Use the m25px.c FLASH driver.
If this is selected, then the MTD interface to the M25Px device will be used to support paging.
</li>
<li>
<code>CONFIG_PAGING_AT45DB</code>:
Use the at45db.c FLASH driver.
If this is selected, then the MTD interface to the Atmel AT45DB device will be used to support paging.
</li>
<li>
<code>CONFIG_PAGING_BINOFFSET</code>:
If CONFIG_PAGING_M25PX or CONFIG_PAGING_AT45DB is defined then CONFIG_PAGING_BINOFFSET will be used to specify the offset in bytes into the FLASH device where the NuttX binary image is located.
Default: 0
</li>
<li>
<code>CONFIG_PAGING_SPIPORT</code>:
If CONFIG_PAGING_M25PX or CONFIG_PAGING_AT45DB is defined and the device has multiple SPI busses (ports), then this configuration should be set to indicate which SPI port the device is connected.
Default: 0
</li>
</ul>
<p>
The following can be used to disable categories of APIs supported
by the OS. If the compiler supports weak functions, then it
should not be necessary to disable functions unless you want to
restrict usage of those APIs.
</p>
<p>
There are certain dependency relationships in these features.
</p>
<ul>
<li>
<code>mq_notify()</code> logic depends on signals to awaken tasks
waiting for queues to become full or empty.
</li>
<li>
<code>pthread_condtimedwait()</code> depends on signals to wake
There are cases where string data cannot be cannot be accessed by simply de-referencing a string pointer.
As examples:
</p>
<ul>
<li>
In Harvard architectures, data accesses and instruction accesses occur on different busses, perhaps concurrently.
All data accesses are performed on the data bus unless special machine instructions are used to read data from the instruction address space.
Also, in the typical MCU, the available SRAM data memory is much smaller that the non-volatile FLASH instruction memory.
So if the application requires many constant strings, the only practical solution may be to store those constant strings in FLASH memory where they can only be accessed using architecture-specific machine instructions.
</li>
<li>
A similar case is where strings are retained in "external" memory such as EEPROM or serial FLASH.
This case is similar only in that again special operations are required to obtain the string data;
it cannot be accessed directly from a string pointer.
</li>
</ul>
<p>
If <code>CONFIG_ARCH_ROMGETC</code> is defined, then the architecture-specific logic must export the function <code>up_romgetc()</code>.
<code>up_romgetc()</code> will simply read one byte of data from the instruction space.
</p>
<p>
If <code>CONFIG_ARCH_ROMGETC</code>, certain C stdio functions are effected:
(1) All format strings in <code>printf</code>, <code>fprintf</code>, <code>sprintf</code>, etc. are assumed to lie in FLASH
(string arguments for <code>%s</code> are still assumed to reside in SRAM).
And (2), the string argument to <code>puts</code> and <code>fputs</code> is assumed to reside in FLASH.
Clearly, these assumptions may have to modified for the particular needs of your environment.
There is no "one-size-fits-all" solution for this problem.
</p>
</ul>
<h2>Sizes of configurable things (0 disables)</h2>
<ul>
<li>
<code>CONFIG_MAX_TASKS</code>: The maximum number of simultaneously
active tasks. This value must be a power of two.
</li>
<li>
<code>CONFIG_NPTHREAD_KEYS</code>: The number of items of thread-
specific data that can be retained
</li>
<li>
<code>CONFIG_NFILE_DESCRIPTORS</code>: The maximum number of file
descriptors (one for each open)
</li>
<li>
<code>CONFIG_NFILE_STREAMS</code>: The maximum number of streams that
can be fopen'ed
</li>
<li>
<code>CONFIG_NAME_MAX</code>: The maximum size of a file name.
</li>
<li>
<code>CONFIG_STDIO_BUFFER_SIZE</code>: Size of the buffer to allocate
on fopen. (Only if CONFIG_NFILE_STREAMS > 0)
</li>
<li>
<code>CONFIG_STDIO_LINEBUFFER</code>:
If standard C buffered I/O is enabled (<code>CONFIG_STDIO_BUFFER_SIZE</code> > 0),
then this option may be added to force automatic, line-oriented flushing the output buffer
for <code>putc()</code>, <code>fputc()</code>, <code>putchar()</code>, <code>puts()</code>, <code>fputs()</code>,
<code>printf()</code>, <code>fprintf()</code>, and <code>vfprintf()</code>.
When a newline character is encountered in the output string, the output buffer will be flushed.
This (slightly) increases the NuttX footprint but supports the kind of behavior that people expect for <code>printf()</code>.
<li>
<code>CONFIG_NUNGET_CHARS</code>: Number of characters that can be
buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0)
</li>
<li>
<code>CONFIG_PREALLOC_MQ_MSGS</code>: The number of pre-allocated message
structures. The system manages a pool of preallocated
message structures to minimize dynamic allocations
</li>
<li>
<code>CONFIG_MQ_MAXMSGSIZE</code>: Message structures are allocated with
a fixed payload size given by this setting (does not include
other message structure overhead.
</li>
<li>
<code>CONFIG_PREALLOC_WDOGS</code>: The number of pre-allocated watchdog
structures. The system manages a pool of preallocated
watchdog structures to minimize dynamic allocations
</li>
<li>
<code>CONFIG_PREALLOC_IGMPGROUPS</code>: Pre-allocated IGMP groups are used
Only if needed from interrupt level group created (by the IGMP server).
Default: 4
</li>
<li>
<code>CONFIG_DEV_PIPE_SIZE</code>: Size, in bytes, of the buffer to allocated
for pipe and FIFO support (default is 1024).
</li>
</ul>
<h2>File Systems</h2>
<ul>
<li>
<code>CONFIG_FS_FAT</code>: Enable FAT file system support.
</li>
<li>
<code>CONFIG_FAT_SECTORSIZE</code>: Max supported sector size.
</li>
<li>
<code>CONFIG_FAT_LCNAMES</code>: Enable use of the NT-style upper/lower case 8.3 file name support.
</li>
<li>
<code>CONFIG_FAT_LFN</code>: Enable FAT long file names.
NOTE: Microsoft claims patents on FAT long file name technology.
Please read the disclaimer in the top-level COPYING file and only enable this feature if you understand these issues.
</li>
<li>
<code>CONFIG_FAT_MAXFNAME</code>: If <code>CONFIG_FAT_LFN</code> is defined, then the default, maximum long file name is 255 bytes.
This can eat up a lot of memory (especially stack space).
If you are willing to live with some non-standard, short long file names, then define this value.
A good choice would be the same value as selected for CONFIG_NAME_MAX which will limit the visibility of longer file names anyway.
</li>
<li>
<code>CONFIG_FS_FATTIME</code>: Support FAT date and time.
NOTE: There is not much sense in supporting FAT date and time unless you have a hardware RTC
or other way to get the time and date.
</li>
<li>
<code>CONFIG_FS_NXFFS</code>: Enable NuttX FLASH file system (NXFF) support.
</li>
<li>
<code>CONFIG_NXFFS_ERASEDSTATE</code>: The erased state of FLASH.
This must have one of the values of <code>0xff</code> or <code>0x00</code>.
Default: <code>0xff</code>.
</li>
<li>
<code>CONFIG_NXFFS_PACKTHRESHOLD</code>: When packing flash file data,
don't both with file chunks smaller than this number of data bytes.
Default: 32.
</li>
<li>
<code>CONFIG_NXFFS_MAXNAMLEN</code>: The maximum size of an NXFFS file name.
Default: 255.
</li>
<li>
<code>CONFIG_NXFFS_PACKTHRESHOLD</code>: When packing flash file data,
don't both with file chunks smaller than this number of data bytes.
Default: 32.
</li>
<li>
<code>CONFIG_NXFFS_TAILTHRESHOLD</code>: clean-up can either mean
packing files together toward the end of the file or, if file are
deleted at the end of the file, clean up can simply mean erasing
the end of FLASH memory so that it can be re-used again. However,
doing this can also harm the life of the FLASH part because it can
mean that the tail end of the FLASH is re-used too often. This
threshold determines if/when it is worth erased the tail end of FLASH
and making it available for re-use (and possible over-wear).
Default: 8192.
</li>
<li>
<code>CONFIG_FS_ROMFS</code>: Enable ROMFS file system support
</li>
<li>
<code>CONFIG_FS_RAMMAP</code>: For file systems that do not support
XIP, this option will enable a limited form of memory mapping that is
implemented by copying whole files into memory.
</li>
</ul>
<h2>Device Drivers</h2>
<h3>RTC</h3>
<ul>
<li>
<code>CONFIG_RTC</code>:
Enables general support for a hardware RTC.
Specific architectures may require other specific settings.
</li>
<li>
<code>CONFIG_RTC_DATETIME</code>:
There are two general types of RTC: (1) A simple battery backed counter that keeps the time when power
is down, and (2) A full date / time RTC the provides the date and time information, often in BCD format.
If <code>CONFIG_RTC_DATETIME</code> is selected, it specifies this second kind of RTC.
In this case, the RTC is used to "seed"" the normal NuttX timer and the NuttX system timer
provides for higher resoution time.
</li>
<li>
<code>CONFIG_RTC_HIRES</code>:
If <code>CONFIG_RTC_DATETIME</code> not selected, then the simple, battery backed counter is used.
There are two different implementations of such simple counters based on the time resolution of the counter:
The typical RTC keeps time to resolution of 1 second, usually supporting a 32-bit <code>time_t</code> value.
In this case, the RTC is used to "seed" the normal NuttX timer and the NuttX timer provides for higher resoution time.
If <code>CONFIG_RTC_HIRES</code> is enabled in the NuttX configuration, then the RTC provides higher resolution time and completely replaces the system timer for purpose of date and time.
</li>
<li>
<code>CONFIG_RTC_FREQUENCY</code>:
If <code>CONFIG_RTC_HIRES</code> is defined, then the frequency of the high resolution RTC must be provided.
If <code>CONFIG_RTC_HIRES</code> is not defined, <code>CONFIG_RTC_FREQUENCY</code> is assumed to be one.
</li>
<li>
<code>CONFIG_RTC_ALARM</code>:
Enable if the RTC hardware supports setting of an alarm.
A callback function will be executed when the alarm goes off
<code>CONFIG_ENC28J60_HALFDUPPLEX</code>: Default is full duplex
</li>
</ul>
<h2>Network Support</h2>
<h3>TCP/IP and UDP support via uIP</h3>
<ul>
<li>
<code>CONFIG_NET</code>: Enable or disable all network features
</li>
<li>
<code>CONFIG_NET_SLIP</code>: Selects the Serial Line Internet Protocol (SLIP) data link layer.
(This selection is discussed further <ahref="#slipdriver">below</a>).
</li>
<li>
<code>CONFIG_NET_NOINTS</code>: <code>CONFIG_NET_NOINT</code> indicates that uIP not called from the interrupt level.
If <code>CONFIG_NET_NOINTS</code> is defined, critical sections will be managed with semaphores;
Otherwise, it assumed that uIP will be called from interrupt level handling and critical sections will be managed by enabling and disabling interrupts.
</li>
<li>
<code>CONFIG_NET_MULTIBUFFER</code>: Traditionally, uIP has used a single buffer for all incoming and outgoing traffic.
If this configuration is selected, then the driver can manage multiple I/O buffers and can, for example, be filling one input buffer while sending another output buffer.
Or, as another example, the driver may support queuing of concurrent input/ouput and output transfers for better performance.
</li>
<li>
<code>CONFIG_NET_IPv6</code>: Build in support for IPv6
</li>
<li>
<code>CONFIG_NSOCKET_DESCRIPTORS</code>: Maximum number of socket descriptors per task/thread.
</li>
<li>
<code>CONFIG_NET_NACTIVESOCKETS</code>: Maximum number of concurrent socket operations (recv, send, etc.).
<code>CONFIG_PREALLOC_IGMPGROUPS</code>: Pre-allocated IGMP groups are used
Only if needed from interrupt level group created (by the IGMP server).
Default: 4
</li>
<li>
<code>CONFIG_NET_PINGADDRCONF</code>: Use "ping" packet for setting IP address
</li>
<li>
<code>CONFIG_NET_STATISTICS</code>: uIP statistics on or off
</li>
<li>
<code>CONFIG_NET_RECEIVE_WINDOW</code>: The size of the advertised receiver's window
</li>
<li>
<code>CONFIG_NET_ARPTAB_SIZE</code>: The size of the ARP table
</li>
<li>
<code>CONFIG_NET_ARP_IPIN</code>: Harvest IP/MAC address mappings for the ARP table from incoming IP packets.
</li>
<li>
<code>CONFIG_NET_BROADCAST</code>: Incoming UDP broadcast support
</li>
<li>
<code>CONFIG_NET_MULTICAST</code>: Outgoing multi-cast address support
</li>
<li>
<code>CONFIG_NET_FWCACHE_SIZE</code>: number of packets to remember when looking for duplicates
</li>
</ul>
<h3><aname="slipdriver">SLIP</a></h3>
<p>
The NuttX SLIP driver supports point-to-point IP communications over a serial port.
The default data link layer for uIP is Ethernet.
If <code>CONFIG_NET_SLIP</code> is defined in the NuttX configuration file, then SLIP will be supported.
The basic differences between the SLIP and Ethernet configurations is that when SLIP is selected:
<ul>
<li>The link level header (that comes before the IP header) is omitted.</li>
<li>All MAC address processing is suppressed.</li>
<li>ARP is disabled.</li>
</ul>
If <code>CONFIG_NET_SLIP</code> is not selected, then Ethernet will be used
(there is no need to define anything special in the configuration file to use Ethernet -- it is the default).
</p>
<ul>
<li>
<code>CONFIG_NET_SLIP</code>: Enables building of the SLIP driver.
SLIP requires at least one IP protocols selected and the following additional network settings: <code>CONFIG_NET_NOINTS</code> and <code>CONFIG_NET_MULTIBUFFER</code>.
<code>CONFIG_NET_BUFSIZE</code><i>must</i> be set to 296.
Other optional configuration settings that affect the SLIP driver: <code>CONFIG_NET_STATISTICS</code>.
Default: Ethernet.
</li>
<p>
If SLIP is selected, then the following SLIP options are available:
</p>
<li>
<code>CONFIG_CLIP_NINTERFACES</code>: Selects the number of physical SLIP interfaces to support. Default: 1
</li>
<li>
<code>CONFIG_SLIP_STACKSIZE</code>: Select the stack size of the SLIP RX and TX tasks. Default: 2048
</li>
<li>
<code>CONFIG_SLIP_DEFPRIO</code>: The priority of the SLIP RX and TX tasks. Default: 128
</li>
</li>
</ul>
<h3>UIP Network Utilities</h3>
<ul>
<li>
<code>CONFIG_NET_DHCP_LIGHT</code>: Reduces size of DHCP
</li>
<li>
<code>CONFIG_NET_RESOLV_ENTRIES</code>: Number of resolver entries
</li>
</ul>
<h3>THTTPD</h3>
<ul>
<li>
<code>CONFIG_THTTPD_PORT</code>: THTTPD Server port number
</li>
<li>
<code>CONFIG_THTTPD_IPADDR</code>: Server IP address (no host name)
<code>CONFIG_CDCSER_EP0MAXPACKET</code>: Endpoint 0 max packet size. Default 64.
</li>
<li>
<code>CONFIG_CDCSER_EPINTIN</code>: The logical 7-bit address of a hardware endpoint that supports
interrupt IN operation. Default 2.
</li>
<li>
<code>CONFIG_CDCSER_EPINTIN_FSSIZE</code>: Max package size for the interrupt IN endpoint if full speed mode. Default 64.
</li>
<li>
<code>CONFIG_CDCSER_EPINTIN_HSSIZE</code>: Max package size for the interrupt IN endpoint if high speed mode. Default 64.
</li>
<li>
<code>CONFIG_CDCSER_EPBULKOUT</code>: The logical 7-bit address of a hardware endpoint that supports
bulk OUT operation.
</li>
<li>
<code>CONFIG_CDCSER_EPBULKOUT_FSSIZE</code>: Max package size for the bulk OUT endpoint if full speed mode. Default 64.
</li>
<li>
<code>CONFIG_CDCSER_EPBULKOUT_HSSIZE</code>: Max package size for the bulk OUT endpoint if high speed mode. Default 512.
</li>
<li>
<code>CONFIG_CDCSER_EPBULKIN</code>: The logical 7-bit address of a hardware endpoint that supports
bulk IN operation
</li>
<li>
<code>CONFIG_CDCSER_EPBULKIN_FSSIZE</code>: Max package size for the bulk IN endpoint if full speed mode. Default 64.
</li>
<li>
<code>CONFIG_CDCSER_EPBULKIN_HSSIZE</code>: Max package size for the bulk IN endpoint if high speed mode. Default 512.
</li>
<li>
<code>CONFIG_CDCSER_NWRREQS</code> and <code>CONFIG_CDCSER_NRDREQS</code>: The number of write/read requests that can be in flight.
<code>CONFIG_CDCSER_NWRREQS</code> includes write requests used for both the interrupt and bulk IN endpoints.
Default 4.
</li>
<li>
<code>CONFIG_CDCSER_VENDORID</code> and <code>CONFIG_CDCSER_VENDORSTR</code>: The vendor ID code/string. Default 0x0525 and "NuttX,"
0x0525 is the Netchip vendor and should not be used in any products.
This default VID was selected for compatibility with the Linux CDC ACM default VID.
</li>
<li>
<code>CONFIG_CDCSER_PRODUCTID</code> and <code>CONFIG_CDCSER_PRODUCTSTR</code>: The product ID code/string. Default 0xa4a7 and "CDC/ACM Serial"
0xa4a7 was selected for compatibility with the Linux CDC ACM default PID.
</li>
<li>
<code>CONFIG_CDCSER_RXBUFSIZE</code> and <code>CONFIG_CDCSER_TXBUFSIZE</code>: Size of the serial receive/transmit buffers. Default 256.
<code>CONFIG_USBSTRGEPBULKOUT</code> and <code>CONFIG_USBSTRG_EPBULKIN</code>:
The logical 7-bit address of a hardware endpoints that support bulk OUT and IN operations
</li>
<li>
<code>CONFIG_USBSTRG_NWRREQS</code> and <code>CONFIG_USBSTRG_NRDREQS</code>:
The number of write/read requests that can be in flight
</li>
<li>
<code>CONFIG_USBSTRG_BULKINREQLEN</code> and <code>CONFIG_USBSTRG_BULKOUTREQLEN</code>:
The size of the buffer in each write/read request.
This value needs to be at least as large as the endpoint maxpacket and
ideally as large as a block device sector.
</li>
<li>
<code>CONFIG_USBSTRG_VENDORID</code> and <code>CONFIG_USBSTRG_VENDORSTR</code>:
The vendor ID code/string
</li>
<li>
<code>CONFIG_USBSTRG_PRODUCTID</code> and <code>CONFIG_USBSTRG_PRODUCTSTR</code>:
The product ID code/string
</li>
<li>
<code>CONFIG_USBSTRG_REMOVABLE</code>:
Select if the media is removable
</li>
</ul>
<h2>USB Host-Side Support</h2>
<h3>USB Host Controller Driver</h3>
<ul>
<li>
<code>CONFIG_USBHOST</code>: Enables USB host support
</li>
<li>
<code>CONFIG_USBHOST_NPREALLOC</code>: Number of pre-allocated class instances
</li>
<li>
<code>CONFIG_USBHOST_BULK_DISABLE</code>: On some architectures, selecting this setting will reduce driver size by disabling bulk endpoint support
</li>
<li>
<code>CONFIG_USBHOST_INT_DISABLE</code>: On some architectures, selecting this setting will reduce driver size by disabling interrupt endpoint support
</li>
<li>
<code>CONFIG_USBHOST_ISOC_DISABLE</code>: On some architectures, selecting this setting will reduce driver size by disabling isochronous endpoint support
<code>CONFIG_HIDKBD_NPOLLWAITERS</code>: If the poll() method is enabled, this defines the maximum number of threads that can be waiting for keyboard events. Default: 2.
</li>
<li>
<code>CONFIG_HIDKBD_RAWSCANCODES</code>: If set to <code>y</code> no conversion will be made on the raw keyboard scan codes. Default: ASCII conversion.
</li>
<li>
<code>CONFIG_HIDKBD_ALLSCANCODES</code>: If set to <code>y</code> all 231 possible scancodes will be converted to something. Default: 104 key US keyboard.
</li>
<li>
<code>CONFIG_HIDKBD_NODEBOUNCE</code>: If set to <code>y</code> normal debouncing is disabled. Default: Debounce/No repeat keys.