diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index f31d0d8fdb..8fceef9c1d 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@
Last Updated: February 4, 2019
+Last Updated: February 18, 2019
@@ -97,94 +97,99 @@ 4.2.19up_prioritize_irq()
up_putc()
board_early_initialize()
board_late_initialize()
work_queue()
work_cancel()
work_signal()
work_available()
work_usrstart()
lpwork_boostpriority()
lpwork_restorepriority()
+ 4.5.2.3.1 work_queue()
work_cancel()
work_signal()
work_available()
work_usrstart()
lpwork_boostpriority()
lpwork_restorepriority()
up_addrenv_create()
up_addrenv_destroy()
up_addrenv_vtext()
up_addrenv_vdata()
up_addrenv_heapsize()
up_addrenv_select()
up_addrenv_restore()
up_addrenv_clone()
up_addrenv_attach()
up_addrenv_detach()
up_addrenv_ustackalloc()
up_addrenv_ustackfree()
up_addrenv_vustack()
up_addrenv_ustackselect()
up_addrenv_kstackalloc()
up_addrenv_kstackfree()
+ 4.6.1 up_addrenv_create()
up_addrenv_destroy()
up_addrenv_vtext()
up_addrenv_vdata()
up_addrenv_heapsize()
up_addrenv_select()
up_addrenv_restore()
up_addrenv_clone()
up_addrenv_attach()
up_addrenv_detach()
up_addrenv_ustackalloc()
up_addrenv_ustackfree()
up_addrenv_vustack()
up_addrenv_ustackselect()
up_addrenv_kstackalloc()
up_addrenv_kstackfree()
nx_start()
sched_process_timer()
sched_timer_expiration()
sched_alarm_expiration()
irq_dispatch()
+ 4.7.1 nx_start()
sched_process_timer()
sched_timer_expiration()
sched_alarm_expiration()
irq_dispatch()
boardctl()
Application Interfaceboardctl()
Application Interfaceup_testset()
up_cpu_index()
up_cpu_start()
up_cpu_pause()
up_cpu_resume()
+ 4.10.1 up_testset()
up_cpu_index()
up_cpu_start()
up_cpu_pause()
up_cpu_resume()
up_shmat()
up_shmdt()
up_shmat()
up_shmdt()
Common Board Interfaces.
- Any interface that is common to all boards should be prefixed with board_
and should also be prototyped in include/nuttx/arch.h
.
- These board_
definitions provide the interface between the board-level logic and the architecture-specific logic.
-
- There is also a configs/<board>/include/board.h
header file that can be used to communicate other board-specific information between the architecture logic and even application logic.
- Any definitions which are common between a single architecture and several boards should go in this board.h
header file;
- include/nuttx/arch.h
is reserved for board-related definitions common to all architectures.
+ Any interface that is common to all boards should be prefixed with board_
and should also be prototyped in include/nuttx/board.h
.
+ These board_
definitions provide the interface between the board-level logic and the commaon and architecture-specific logic.
@@ -2272,9 +2272,62 @@ The specific environmental definitions are unique for each board but should incl Output one character on the console
-
+ Exported board-specific interfaces are prototyped in the header file include/nuttx/board.h
.
+ There are many interfaces exported from board- to architecture-specific logic.
+ But there are only a few exported from board-specific logic to common NuttX logic.
+ Those few will be discussed in this paragraph.
+
+ All of the board-specific interfaces used by the NuttX OS logic are for controlled board initialization. + There are three points in time where you can insert custom, board-specific initialization logic: +
+
+ First, <arch>_board_initialize()
: This function is not called from the common OS logic, but rather from the architecture-specific power on reset logic.
+ This is used only for initialization of very low-level things like configuration of GPIO pins, power settings, DRAM initialization, etc.
+ The OS has not been initialized at this point, so you cannot allocate memory or initialize device drivers.
+
+ The other two board initialization hooks are called from the OS start-up logic and are described in the following paragraphs: +
+ +
+ The next level of initialization is performed by a call to up_initialize()
(in arch/<arch>/src/common/up_initialize.c
). The OS has been initialized at this point and it is okay to initialize drivers in this phase.
+ up_initialize()
is not a board-specific interface, but rather an architecture-specific, board-independent interface.
+
+ But at this same point in time, the OS will also call a board-specific initialization function named board_early_initialize()
if CONFIG_BOARD_EARLY_INITIALIZE=y
is selected in the configuration.
+ The context in which board_early_initialize()
executes is suitable for early initialization of most, simple device drivers and is a logical, board-specific extension of up_initialize().
+
+ board_early_initialize()
runs on the startup, initialization thread.
+ Some initialization operations cannot be performed on the start-up, initialization thread.
+ That is because the initialization thread cannot wait for event.
+ Waiting may be required, for example, to mount a file system or or initialize a device such as an SD card.
+ For this reason, such driver initialize must be deferred to board_late_initialize()
.
+
+ And, finally, just before the user application code starts.
+ If CONFIG_BOARD_LATE_INITIALIZE=y
is selected in the configuration, then an final, additional initialization call will be performed in the boot-up sequence to a function called board_late_initialize()
.
+ board_late_initialize()
will be called well after up_initialize()
and board_early_initialize()
are called.
+ board_late_initialize()
will be called just before the main application task is started.
+ This additional initialization phase may be used, for example, to initialize more complex, board-specific device drivers.
+
+ Waiting for events, use of I2C, SPI, etc are permissable in the context of board_late_initialize().
+ That is because board_late_initialize()
will run on a temporary, internal kernel thread.
+
System Timer In most implementations, system time is provided by a timer interrupt. @@ -2357,7 +2410,7 @@ else In this way, the timer interval is controlled from interrupt-to-interrupt to produce an average frequency of exactly 100Hz.
-To enable hardware module use the following configuration options:
@@ -2421,7 +2474,7 @@ else
The system tick is represented by::
@@ -2444,8 +2497,8 @@ else To retrieve that variable use: -Default System Timer. @@ -2484,13 +2537,13 @@ else Using an interval timer, one can anticipate when the next interesting OS event will occur, program the interval time and wait for it to fire. When the interval time fires, then the scheduled activity is performed.
-nuttx/arch/sim/src/up_tickless.c
. There is another example for the Atmel SAMA5 at nuttx/arch/arm/src/sama5/sam_tickless.c
. These paragraphs will explain how to provide the Tickless OS support to any platform.
-@@ -2541,7 +2594,7 @@ config ARCH_SIM
The interfaces that must be provided by the platform specified code are defined in include/nuttx/arch.h
, listed below, and summarized in the following paragraphs:
_timer_initialize()
_timer_initialize()
Function Prototype:
#include "up_internal.h" @@ -2626,7 +2679,7 @@ void <arch>_timer_initialize()(void); Called early in the initialization sequence before any special concurrency protections are required. -4.3.4.4.2
+up_timer_gettime()
4.4.4.4.2
up_timer_gettime()
Function Prototype:
#include <nuttx/arch.h> @@ -2650,7 +2703,7 @@ int up_timer_gettime(FAR struct timespec *ts); Called from the normal tasking context. The implementation must provide whatever mutual exclusion is necessary for correct operation. This can include disabling interrupts in order to assure atomic register operations. -4.3.4.4.3
+up_alarm_cancel()
4.4.4.4.3
up_alarm_cancel()
Function Prototype:
#include <nuttx/arch.h> @@ -2673,7 +2726,7 @@ int up_alarm_cancel(FAR struct timespec *ts); May be called from interrupt level handling or from the normal tasking level. interrupts may need to be disabled internally to assure non-reentrancy. -4.3.4.4.4
+up_alarm_start()
4.4.4.4.4
up_alarm_start()
Function Prototype:
#include <nuttx/arch.h> @@ -2696,7 +2749,7 @@ int up_alarm_start(FAR const struct timespec *ts); May be called from interrupt level handling or from the normal tasking level. Interrupts may need to be disabled internally to assure non-reentrancy. -4.3.4.4.5
+up_timer_cancel()
4.4.4.4.5
up_timer_cancel()
Function Prototype:
#include <nuttx/arch.h> @@ -2719,7 +2772,7 @@ int up_timer_cancel(FAR struct timespec *ts); May be called from interrupt level handling or from the normal tasking level. interrupts may need to be disabled internally to assure non-reentrancy. -4.3.4.4.6
+up_timer_start()
4.4.4.4.6
up_timer_start()
Function Prototype:
#include <nuttx/arch.h> @@ -2742,7 +2795,7 @@ int up_timer_start(FAR const struct timespec *ts); May be called from interrupt level handling or from the normal tasking level. Interrupts may need to be disabled internally to assure non-reentrancy. -4.3.5 Watchdog Timer Interfaces
+4.4.5 Watchdog Timer Interfaces
NuttX provides a general watchdog timer facility. This facility allows the NuttX user to specify a watchdog timer function @@ -2753,16 +2806,16 @@ int up_timer_start(FAR const struct timespec *ts); or
kill()
to communicate with NuttX tasks.
Function Prototype: @@ -2802,7 +2855,7 @@ Differences from the VxWorks interface include: initialization time). -
Function Prototype: @@ -2847,7 +2900,7 @@ Differences from the VxWorks interface include: before deallocating it (i.e., never returns ERROR). -
Function Prototype: @@ -2905,7 +2958,7 @@ to wdentry; VxWorks supports only a single parameter. The maximum number of parameters is determined by -
Function Prototype:
@@ -2938,7 +2991,7 @@ VxWorks provides the following comparable interface: STATUS wdCancel (WDOG_ID wdog);-
Function Prototype:
@@ -2962,7 +3015,7 @@ VxWorks provides the following comparable interface: means either that wdog is not valid or that the wdog has already expired. -When a watchdog expires, the callback function with this type is called:
@@ -2992,18 +3045,18 @@ typedef uint32_t wdparm_t; #endif -Work Queues. NuttX provides work queues. Work queues are threads that service a queue of work items to be performed. They are useful for off-loading work to a different threading context, for delayed processing, or for serializing activities.
-Classes of Work Queues. There are three different classes of work queues, each with different properties and intended usage. These class of work queues along with the common work queue interface are described in the following paragraphs.
-High Priority Kernel Work queue. The dedicated high-priority work queue is intended to handle delayed processing from interrupt handlers. This work queue is required for some drivers but, if there are no complaints, can be safely disabled. The high priority worker thread also performs garbage collection -- completing any delayed memory deallocations from interrupt handlers. If the high-priority worker thread is disabled, then that clean up will be performed either by (1) the low-priority worker thread, if enabled, and if not (2) the IDLE thread instead (which runs at the lowest of priority and may not be appropriate if memory reclamation is of high priority) @@ -3049,7 +3102,7 @@ typedef uint32_t wdparm_t; -
Low Priority Kernel Work Queue. This lower priority work queue is better suited for more extended, application oriented processing such as file system clean-up, memory garbage collection and asynchronous I/O operations. @@ -3090,7 +3143,7 @@ typedef uint32_t wdparm_t; -
Work Queue Accessibility. The high- and low-priority worker threads are kernel-mode threads. In the normal, flat NuttX build, these work queues are are useful to application code and may be shared. However, in the NuttX protected and kernel build modes, kernel mode code is isolated and cannot be accessed from user-mode code. @@ -3111,8 +3164,8 @@ typedef uint32_t wdparm_t; The stack size allocated for the lower priority worker thread. Default: 2048. -
Work queue IDs. @@ -3141,7 +3194,7 @@ typedef uint32_t wdparm_t; -
work_queue()
work_queue()
Function Prototype:
@@ -3218,7 +3271,7 @@ int work_queue(int qid, FAR struct work_s *work, worker_t worker, -4.4.2.3.2
+work_cancel()
4.5.2.3.2
work_cancel()
Function Prototype: #include <nuttx/wqueue.h> @@ -3260,7 +3313,7 @@ int work_cancel(int qid, FAR struct work_s *work); -
4.4.2.3.3
+work_signal()
4.5.2.3.3
work_signal()
Function Prototype: #include <nuttx/wqueue.h> @@ -3291,7 +3344,7 @@ int work_signal(int qid);
-4.4.2.3.4
+work_available()
4.5.2.3.4
work_available()
Function Prototype:
@@ -3322,7 +3375,7 @@ bool work_available(FAR struct work_s *work); -4.4.2.3.5
+work_usrstart()
4.5.2.3.5
work_usrstart()
Function Prototype:
@@ -3349,7 +3402,7 @@ int work_usrstart(void); -4.4.2.3.6
+lpwork_boostpriority()
4.5.2.3.6
lpwork_boostpriority()
Function Prototype:
@@ -3379,7 +3432,7 @@ void lpwork_boostpriority(uint8_t reqprio); Returned Value: None -4.4.2.3.7
+lpwork_restorepriority()
4.5.2.3.7
lpwork_restorepriority()
Function Prototype:
@@ -3409,7 +3462,7 @@ void lpwork_restorepriority(uint8_t reqprio); Returned Value: None -4.5 Address Environments
+4.6 Address Environments
CPUs that support memory management units (MMUs) may provide address environments within which tasks and their child threads execute. The configuration indicates the CPUs ability to support address environments by setting the configuration variable
CONFIG_ARCH_HAVE_ADDRENV=y
. @@ -3432,35 +3485,35 @@ void lpwork_restorepriority(uint8_t reqprio);
up_addrenv_create()
:
+ 4.6.1 up_addrenv_create()
:
Create an address environment.
up_addrenv_destroy()
:
+ 4.6.2 up_addrenv_destroy()
:
Destroy an address environment.
up_addrenv_vtext()
:
+ 4.6.3 up_addrenv_vtext()
:
Returns the virtual base address of the .text
address environment.
up_addrenv_vdata()
:
+ 4.6.4 up_addrenv_vdata()
:
Returns the virtual base address of the .bss
/.data
address environment.
up_addrenv_heapsize()
:
+ 4.6.5 up_addrenv_heapsize()
:
Return the initial heap size.
up_addrenv_select()
:
+ 4.6.6 up_addrenv_select()
:
Instantiate an address environment.
up_addrenv_restore()
:
+ 4.6.7 up_addrenv_restore()
:
Restore an address environment.
up_addrenv_clone()
:
+ 4.6.8 up_addrenv_clone()
:
Copy an address environment from one location to another.
up_addrenv_attach()
:
+ 4.6.9 up_addrenv_attach()
:
Clone the group address environment assigned to a new thread.
This operation is done when a pthread is created that share's the same address environment.
up_addrenv_detach()
:
+ 4.6.10 up_addrenv_detach()
:
Release the thread's reference to a group address environment when a task/thread exits.
up_addrenv_ustackalloc()
:
+ 4.6.11 up_addrenv_ustackalloc()
:
Create a stack address environment
up_addrenv_ustackfree()
:
+ 4.6.12 up_addrenv_ustackfree()
:
Destroy a stack address environment.
up_addrenv_vustack()
:
+ 4.6.13 up_addrenv_vustack()
:
Returns the virtual base address of the stack
up_addrenv_ustackselect()
:
+ 4.6.14 up_addrenv_ustackselect()
:
Instantiate a stack address environment
up_addrenv_kstackalloc()
:
+ 4.6.15 up_addrenv_kstackalloc()
:
Allocate the process kernel stack.
up_addrenv_kstackfree()
:
+ 4.6.16 up_addrenv_kstackfree()
:
Free the process kernel stack.
up_addrenv_create()
up_addrenv_create()
Function Prototype:
int up_addrenv_create(size_t textsize, size_t datasize, size_t heapsize, FAR group_addrenv_t *addrenv);
@@ -3559,7 +3612,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_destroy()
up_addrenv_destroy()
Function Prototype:
int up_addrenv_destroy(group_addrenv_t *addrenv);
@@ -3577,7 +3630,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_vtext()
up_addrenv_vtext()
Function Prototype:
int up_addrenv_vtext(FAR group_addrenv_t addrenv, FAR void **vtext);
@@ -3597,7 +3650,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_vdata()
up_addrenv_vdata()
Function Prototype:
int up_addrenv_vdata(FAR group_addrenv_t *addrenv, size_t textsize, FAR void **vdata);
@@ -3618,7 +3671,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_heapsize()
up_addrenv_heapsize()
Function Prototype:
ssize_t up_addrenv_heapsize(FAR const group_addrenv_t *addrenv);
@@ -3638,7 +3691,7 @@ void lpwork_restorepriority(uint8_t reqprio);
The initial heap size allocated is returned on success; a negated errno
value on failure.
up_addrenv_select()
up_addrenv_select()
Function Prototype:
int up_addrenv_select(group_addrenv_t *addrenv, save_addrenv_t *oldenv);
@@ -3662,7 +3715,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_restore()
up_addrenv_restore()
Function Prototype:
int up_addrenv_restore(save_addrenv_t oldenv);
@@ -3681,7 +3734,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_clone()
up_addrenv_clone()
Function Prototype:
int up_addrenv_clone(FAR const task_group_s *src, FAR struct task_group_s *dest);
@@ -3700,7 +3753,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_attach()
up_addrenv_attach()
Function Prototype:
int up_addrenv_attach(FAR struct task_group_s *group, FAR struct tcb_s *tcb);
@@ -3726,7 +3779,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_detach()
up_addrenv_detach()
Function Prototype:
int up_addrenv_detach(FAR struct task_group_s *group, FAR struct task_group_s *tcb);
@@ -3745,7 +3798,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_ustackalloc()
up_addrenv_ustackalloc()
Function Prototype:
int up_addrenv_ustackalloc(FAR struct tcb_s *tcb, size_t stacksize);
@@ -3767,7 +3820,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_ustackfree()
up_addrenv_ustackfree()
Function Prototype:
int up_addrenv_ustackfree(FAR struct tcb_s *tcb);
@@ -3788,7 +3841,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_vustack()
up_addrenv_vustack()
Function Prototype:
int up_addrenv_vustack(FAR const struct tcb_s *tcb, FAR void **vstack);
@@ -3809,7 +3862,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_ustackselect()
up_addrenv_ustackselect()
Function Prototype:
int up_addrenv_ustackselect(FAR const struct tcb_s *tcb);
@@ -3831,7 +3884,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_kstackalloc()
up_addrenv_kstackalloc()
Function Prototype:
int up_addrenv_kstackalloc(FAR struct tcb_s *tcb);
@@ -3853,7 +3906,7 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
up_addrenv_kstackfree()
up_addrenv_kstackfree()
Function Prototype:
int up_addrenv_kstackfree(FAR struct tcb_s *tcb);
@@ -3875,23 +3928,23 @@ void lpwork_restorepriority(uint8_t reqprio);
Zero (OK
) on success; a negated errno
value on failure.
These are standard interfaces that are exported by the OS for use by the architecture specific logic.
-nx_start()
nx_start()
To be provided
-To be provided
-sched_process_timer()
sched_process_timer()
Function Prototype:
#include <nuttx/arch.h> @@ -3906,7 +3959,7 @@ void sched_process_timer(void);CONFIG_USEC_PER_TICK
. -4.6.4
+sched_timer_expiration()
4.7.4
sched_timer_expiration()
Function Prototype:
#include <nuttx/arch.h> @@ -3929,7 +3982,7 @@ void sched_timer_expiration(void); Base code implementation assumes that this function is called from interrupt handling logic with interrupts disabled. -4.6.5
+sched_alarm_expiration()
4.7.5
sched_alarm_expiration()
Function Prototype:
#include <nuttx/arch.h> @@ -3952,7 +4005,7 @@ void sched_timer_expiration(void); Base code implementation assumes that this function is called from interrupt handling logic with interrupts disabled. -4.6.6
+irq_dispatch()
4.7.6
irq_dispatch()
Function Prototype:
void irq_dispatch(int irq, FAR void *context);
Description. @@ -3961,7 +4014,7 @@ void sched_timer_expiration(void); the appropriate, registered handling logic.
-4.7 Application OS vs. Internal OS Interfaces
+4.8 Application OS vs. Internal OS Interfaces
NuttX provides a standard, portable OS interface for use by applications. @@ -4042,7 +4095,7 @@ void sched_timer_expiration(void); -
4.8
+boardctl()
Application Interface4.9
boardctl()
Application InterfaceFunction Prototype:
ERROR
) is returned on failure with the errno
variable to to indicate the nature of the failure.
According to Wikipedia: "Symmetric multiprocessing (SMP) involves a symmetric multiprocessor system hardware and software architecture where two or more identical processors connect to a single, shared main memory, have full access to all I/O devices, and are controlled by a single operating system instance that treats all processors equally, reserving none for special purposes. Most multiprocessor systems today use an SMP architecture. In the case of multi-core processors, the SMP architecture applies to the cores, treating them as separate processors.
@@ -4106,7 +4159,7 @@ For a technical description of the NuttX implementation of SMP, see the NuttX -up_testset()
up_testset()
Function Prototype:
#include <nuttx/spinlock.h> @@ -4135,7 +4188,7 @@ spinlock_t up_testset(volatile FAR spinlock_t *lock); -4.9.2
+up_cpu_index()
4.10.2
up_cpu_index()
Function Prototype:
#include <nuttx/arch.h> @@ -4163,7 +4216,7 @@ int up_cpu_index(void); -4.9.3
+up_cpu_start()
4.10.3
up_cpu_start()
Function Prototype:
#include <nuttx/arch.h> @@ -4203,7 +4256,7 @@ int up_cpu_start(int cpu); -4.9.4
+up_cpu_pause()
4.10.4
up_cpu_pause()
Function Prototype:
#include <nuttx/arch.h> @@ -4235,7 +4288,7 @@ int up_cpu_pause(int cpu); -4.9.5
+up_cpu_resume()
4.10.5
up_cpu_resume()
Function Prototype:
#include <nuttx/arch.h> @@ -4267,7 +4320,7 @@ int up_cpu_resume(int cpu); -4.10 Shared Memory
+4.11 Shared Memory
Shared memory interfaces are only available with the NuttX kernel build (
-CONFIG_BUILD_KERNEL=y
). These interfaces support user memory regions that can be shared between multiple user processes. @@ -4276,7 +4329,7 @@ int up_cpu_resume(int cpu); Those interfaces are described below:4.10.1
+up_shmat()
4.11.1
up_shmat()
Function Prototype:
#include <nuttx/arch.h> @@ -4305,7 +4358,7 @@ int up_shmat(FAR uintptr_t *pages, unsigned int npages, uintptr_t vaddr); Zero (OK
) is returned on success; a negatederrno
value is returned on failure. -4.10.2
+up_shmdt()
4.11.2
up_shmdt()
Function Prototype:
#include <nuttx/arch.h> @@ -4331,7 +4384,7 @@ int up_shmdt(uintptr_t vaddr, unsigned int npages); Zero (OK
) is returned on success; a negatederrno
value is returned on failure. -4.11 On-Demand Paging
+4.12 On-Demand Paging
The NuttX On-Demand Paging feature permits embedded MCUs with some limited RAM space to execute large programs from some non-random access media. If the platform meets certain requirements, then NuttX can provide on-demand paging: @@ -4340,7 +4393,7 @@ int up_shmdt(uintptr_t vaddr, unsigned int npages); Please see the NuttX Demand Paging design document for further information.
-4.12 LED Support
+4.13 LED Support
A board architecture may or may not have LEDs. @@ -4350,7 +4403,7 @@ int up_shmdt(uintptr_t vaddr, unsigned int npages); However, the support provided by each architecture is sufficiently similar that it can be documented here.
-4.12.1 Header Files
+4.13.1 Header Files
LED-related definitions are provided in two header files: @@ -4374,7 +4427,7 @@ int up_shmdt(uintptr_t vaddr, unsigned int npages);
-4.12.2 LED Definitions
+4.13.2 LED Definitions
The implementation of LED support is very specific to a board architecture. @@ -4438,7 +4491,7 @@ int up_shmdt(uintptr_t vaddr, unsigned int npages); -
4.12.3 Common LED interfaces
+4.13.3 Common LED interfaces
The
include/nuttx/board.h
has declarations like: @@ -4488,7 +4541,7 @@ void board_autoled_off(int led); -4.13 I/O Buffer Management
+4.14 I/O Buffer Management
NuttX supports generic I/O buffer management (IOB) logic. This logic was originally added to support network I/O buffering, but has been generalized to meet buffering requirements by all device drivers. @@ -4520,7 +4573,7 @@ This objectives of this feature are: -4.13.1 Configuration Options
+4.14.1 Configuration Options
CONFIG_MM_IOB
@@ -4552,12 +4605,12 @@ This objectives of this feature are:
NOTE that this selection is not available if DEBUG features are not enabled (CONFIG_DEBUG_FEATURES
) with IOBs are being used to syslog buffering logic (CONFIG_SYSLOG_BUFFER
).
This structure represents one I/O buffer. A packet is contained by one or more I/O buffers in a chain. The io_pktlen
is only valid for the I/O buffer at the head of the chain.
@@ -4620,33 +4673,33 @@ struct iob_queue_s
#endif /* CONFIG_IOB_NCHAINS > 0 */
-
iob_initialize()
iob_alloc()
iob_tryalloc()
iob_free()
iob_free_chain()
iob_add_queue()
iob_tryadd_queue()
iob_remove_queue()
iob_peek_queue()
iob_free_queue()
iob_copyin()
iob_trycopyin()
iob_copyout()
iob_clone()
iob_concat()
iob_trimhead()
iob_trimhead_queue()
iob_trimtail()
iob_pack()
iob_contig()
iob_dump()
iob_initialize()
iob_alloc()
iob_tryalloc()
iob_free()
iob_free_chain()
iob_add_queue()
iob_tryadd_queue()
iob_remove_queue()
iob_peek_queue()
iob_free_queue()
iob_copyin()
iob_trycopyin()
iob_copyout()
iob_clone()
iob_concat()
iob_trimhead()
iob_trimhead_queue()
iob_trimtail()
iob_pack()
iob_contig()
iob_dump()
iob_initialize()
iob_initialize()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4657,7 +4710,7 @@ void iob_initialize(void); Set up the I/O buffers for normal operations. -4.13.4.2
+iob_alloc()
4.14.4.2
iob_alloc()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4668,7 +4721,7 @@ FAR struct iob_s *iob_alloc(bool throttled); Allocate an I/O buffer by taking the buffer at the head of the free list. -4.13.4.3
+iob_tryalloc()
4.14.4.3
iob_tryalloc()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4679,7 +4732,7 @@ FAR struct iob_s *iob_tryalloc(bool throttled); Try to allocate an I/O buffer by taking the buffer at the head of the free list without waiting for a buffer to become free. -4.13.4.4
+iob_free()
4.14.4.4
iob_free()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4690,7 +4743,7 @@ FAR struct iob_s *iob_free(FAR struct iob_s *iob); Free the I/O buffer at the head of a buffer chain returning it to the free list. The link to the next I/O buffer in the chain is return. -4.13.4.5
+iob_free_chain()
4.14.4.5
iob_free_chain()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4701,7 +4754,7 @@ void iob_free_chain(FAR struct iob_s *iob); Free an entire buffer chain, starting at the beginning of the I/O buffer chain -4.13.4.6
+iob_add_queue()
4.14.4.6
iob_add_queue()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4714,7 +4767,7 @@ int iob_add_queue(FAR struct iob_s *iob, FAR struct iob_queue_s *iobq); Add one I/O buffer chain to the end of a queue. May fail due to lack of resources. -4.13.4.7
+iob_tryadd_queue()
4.14.4.7
iob_tryadd_queue()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4727,7 +4780,7 @@ int iob_tryadd_queue(FAR struct iob_s *iob, FAR struct iob_queue_s *iobq); Add one I/O buffer chain to the end of a queue without waiting for resources to become free. -4.13.4.8
+iob_remove_queue()
4.14.4.8
iob_remove_queue()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4744,7 +4797,7 @@ FAR struct iob_s *iob_remove_queue(FAR struct iob_queue_s *iobq); Returns a reference to the I/O buffer chain at the head of the queue. -4.13.4.9
+iob_peek_queue()
4.14.4.9
iob_peek_queue()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4761,7 +4814,7 @@ FAR struct iob_s *iob_peek_queue(FAR struct iob_queue_s *iobq); Returns a reference to the I/O buffer chain at the head of the queue. -4.13.4.10
+iob_free_queue()
4.14.4.10
iob_free_queue()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4774,7 +4827,7 @@ void iob_free_queue(FAR struct iob_queue_s *qhead); Free an entire queue of I/O buffer chains. -4.13.4.11
+iob_copyin()
4.14.4.11
iob_copyin()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4786,7 +4839,7 @@ int iob_copyin(FAR struct iob_s *iob, FAR const uint8_t *src, Copy datalen
bytes from a user buffer into the I/O buffer chain, starting atoffset
, extending the chain as necessary. -4.13.4.12
+iob_trycopyin()
4.14.4.12
iob_trycopyin()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4798,7 +4851,7 @@ int iob_trycopyin(FAR struct iob_s *iob, FAR const uint8_t *src, Copy datalen
bytes from a user buffer into the I/O buffer chain, starting atoffset
, extending the chain as necessary BUT without waiting if buffers are not available. -4.13.4.13
+iob_copyout()
4.14.4.13
iob_copyout()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4810,7 +4863,7 @@ int iob_copyout(FAR uint8_t *dest, FAR const struct iob_s *iob, Copy datalen
bytes of data into the user buffer starting atoffset
in the I/O buffer, returning that actual number of bytes copied out. -4.13.4.14
+iob_clone()
4.14.4.14
iob_clone()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4821,7 +4874,7 @@ int iob_clone(FAR struct iob_s *iob1, FAR struct iob_s *iob2, bool throttled); Duplicate (and pack) the data iniob1
iniob2
.iob2
must be empty. -4.13.4.15
+iob_concat()
4.14.4.15
iob_concat()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4832,7 +4885,7 @@ void iob_concat(FAR struct iob_s *iob1, FAR struct iob_s *iob2); Concatenate iob_s chain iob2 to iob1. -4.13.4.16
+iob_trimhead()
4.14.4.16
iob_trimhead()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4843,7 +4896,7 @@ FAR struct iob_s *iob_trimhead(FAR struct iob_s *iob, unsigned int trimlen); Remove bytes from the beginning of an I/O chain. Emptied I/O buffers are freed and, hence, the beginning of the chain may change. -4.13.4.17
+iob_trimhead_queue()
4.14.4.17
iob_trimhead_queue()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4864,7 +4917,7 @@ FAR struct iob_s *iob_trimhead_queue(FAR struct iob_queue_s *qhead, The new iob at the head of the queue is returned. -4.13.4.18
+iob_trimtail()
4.14.4.18
iob_trimtail()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4875,7 +4928,7 @@ FAR struct iob_s *iob_trimtail(FAR struct iob_s *iob, unsigned int trimlen); Remove bytes from the end of an I/O chain. Emptied I/O buffers are freed NULL will be returned in the special case where the entry I/O buffer chain is freed. -4.13.4.19
+iob_pack()
4.14.4.19
iob_pack()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4886,7 +4939,7 @@ FAR struct iob_s *iob_pack(FAR struct iob_s *iob); Pack all data in the I/O buffer chain so that the data offset is zero and all but the final buffer in the chain are filled. Any emptied buffers at the end of the chain are freed. -4.13.4.20
+iob_contig()
4.14.4.20
iob_contig()
Function Prototype:
#include <nuttx/mm/iob.h> @@ -4897,7 +4950,7 @@ int iob_contig(FAR struct iob_s *iob, unsigned int len); Ensure that there islen
bytes of contiguous space at the beginning of the I/O buffer chain starting atiob
. -4.13.4.21
+iob_dump()
4.14.4.21
iob_dump()
Function Prototype:
#include <nuttx/mm/iob.h> diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index e80e4a2570..772fcbe639 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -72,19 +72,10 @@ * 3. Common Board Interfaces. * * Any interface that is common across all boards should be prefixed - * with board_ and should be prototyped in this header file. These - * board_ definitions provide the interface between the board-level + * with board_ and should be prototyped in the board.h header file. + * These board_ definitions provide the interface between the board-level * logic and the architecture-specific logic. * - * Board related declarations are retained the file include/nuttx/board.h. - * - * There is also a configs//include/board.h header file that - * can be used to communicate other board-specific information between - * the architecture logic and even application logic. Any definitions - * which are common between a single architecture and several boards - * should go in this board.h header file; this file is reserved for - * board-related definitions common to all architectures. - * * 4. Board-Specific Interfaces. * * Any interface which is unique to a board should be prefixed with diff --git a/sched/Kconfig b/sched/Kconfig index f2696b5896..9fb6fe9dbd 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -1151,8 +1151,8 @@ config BOARD_EARLY_INITIALIZE bool "Custom board early initialization" default n ---help--- - By default, there are three points in time where you can insert - custom initialization logic: + There are three points in time where you can insert custom, + board-specific initialization logic: 1) _board_initialize(): This function is used only for initialization of very low-level things like configuration of @@ -1167,7 +1167,7 @@ config BOARD_EARLY_INITIALIZE At this same point in time, the OS will also call a board- specific initialization function named board_early_initialize() - if CONFIG_BOARD_EARLY_INITIALIZE is selectd. The context in + if CONFIG_BOARD_EARLY_INITIALIZE is selected. The context in which board_early_initialize() executes is suitable for early initialization of most, simple device drivers and is a logical, board-specific extension of up_initialize(). @@ -1199,8 +1199,8 @@ config BOARD_LATE_INITIALIZE bool "Custom board late initialization" default n ---help--- - By default, there are three points in time where you can insert - custom initialization logic: + There are three points in time where you can insert custom, + board-specific initialization logic: 1) _board_initialize(): This function is used only for initialization of very low-level things like configuration of @@ -1215,7 +1215,7 @@ config BOARD_LATE_INITIALIZE At this same point in time, the OS will also call a board- specific initialization function named board_early_initialize() - if CONFIG_BOARD_EARLY_INITIALIZE is selectd. The context in + if CONFIG_BOARD_EARLY_INITIALIZE is selected. The context in which board_early_initialize() executes is suitable for early initialization of most, simple device drivers and is a logical, board-specific extension of up_initialize(). diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c index 9a5eef4d3f..1989477d00 100644 --- a/sched/init/nx_start.c +++ b/sched/init/nx_start.c @@ -573,6 +573,7 @@ void nx_start(void) g_nx_initstate = OSINIT_TASKLISTS; /* Initialize RTOS facilities *********************************************/ + /* Initialize the semaphore facility. This has to be done very early * because many subsystems depend upon fully functional semaphores. */ @@ -711,6 +712,8 @@ void nx_start(void) net_initialize(); #endif + /* Initialize Hardware Facilities *****************************************/ + /* The processor specific details of running the operating system * will be handled here. Such things as setting up interrupt * service routines and starting the clock are some of the things @@ -732,6 +735,8 @@ void nx_start(void) g_nx_initstate = OSINIT_HARDWARE; + /* Setup for Multi-Tasking ************************************************/ + #ifdef CONFIG_MM_SHM /* Initialize shared memory support */