From bf1e6224d569612dabb8fac071417e7b0db65bdf Mon Sep 17 00:00:00 2001
From: Gregory Nutt Input Parameters: Returned Value:sched_alarm_expiration()
4.5.6 irq_dispatch()
- 4.6 On-Demand Paging
- 4.7 LED Support
+ 4.6 Shared Memory
- 4.7.1 Header Files
+ 4.7 On-Demand Paging
- 4.7.2 LED Definitions
- 4.7.3 Common LED interfaces
+ 4.6.1 up_shmat()
+ 4.6.2 up_shmdt()
+
+ 4.8 LED Support
+
5.0 NuttX File System
@@ -3352,7 +3357,9 @@ VxWorks provides the following comparable interface:
-
tcb
: The TCB of the thread that no longer requires the kernel stack.tcb
: The TCB of the thread that no longer requires the kernel stack.
+
@@ -3441,8 +3448,71 @@ void sched_timer_expiration(void);
the appropriate, registered handling logic.
+ 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.
+ The user interfaces are provided in the standard header file include/sys/shm.h>
.
+ All logic to support shared memory is implemented within the NuttX kernel with the exception of two low-level functions that are require to configure the platform-specific MMU resources.
+ Those interfaces are described below:
+
up_shmat()
Function Prototype:
+
+#include <nuttx/arch.h> +#ifdef CONFIG_MM_SHM +int up_shmat(FAR uintptr_t *pages, unsigned int npages, uintptr_t vaddr); +#endif + +Description:
+
Input Parameters:
+pages
: A pointer to the first element in a array of physical address, each corresponding to one page of memory.
+ npages
: The number of pages in the list of physical pages to be mapped.
+ vaddr
: The virtual address corresponding to the beginning of the (contiguous) virtual address region.
+ Returned Value:
+OK
) is returned on success; a negated errno
value is returned on failure.
+up_shmdt()
Function Prototype:
+
+#include <nuttx/arch.h> +#ifdef CONFIG_MM_SHM +int up_shmdt(uintptr_t vaddr, unsigned int npages); +#endif + +Description:
+
Input Parameters:
+vaddr
: The virtual address corresponding to the beginning of the (contiguous) virtual address region.
+ npages
: T The number of pages to be unmapped.
+ Returned Value:
+OK
) is returned on success; a negated errno
value is returned on failure.
+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: @@ -3451,7 +3521,7 @@ void sched_timer_expiration(void); Please see the NuttX Demand Paging design document for further information.
-A board architecture may or may not have LEDs. @@ -3461,7 +3531,7 @@ void sched_timer_expiration(void); However, the support provided by each architecture is sufficiently similar that it can be documented here.
-LED-related definitions are provided in two header files: @@ -3485,7 +3555,7 @@ void sched_timer_expiration(void);
-The implementation of LED support is very specific to a board architecture. @@ -3549,7 +3619,7 @@ void sched_timer_expiration(void); -
The <arch-name>/src/common/up_internal.h
probably has definitions
diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html
index 68a191917a..fbef436618 100644
--- a/Documentation/NuttxUserGuide.html
+++ b/Documentation/NuttxUserGuide.html
@@ -9049,9 +9049,6 @@ int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_
- NOTE: This is advance documentation. These interfaces are not yet available as of this writing. If you are reading this note, then double check; since these interfaces are under development now, I may have simply failed to remove it. -
shmget
diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index aa65d33c92..7a8b9d0004 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -1188,6 +1188,50 @@ int up_addrenv_kstackalloc(FAR struct tcb_s *tcb); int up_addrenv_kstackfree(FAR struct tcb_s *tcb); #endif +/**************************************************************************** + * Name: up_shmat + * + * Description: + * Attach, i.e, map, on shared memory region to a user virtual address + * + * Input Parameters: + * pages - A pointer to the first element in a array of physical address, + * each corresponding to one page of memory. + * npages - The number of pages in the list of physical pages to be mapped. + * vaddr - The virtual address corresponding to the beginning of the + * (contiguous) virtual address region. + * + * Returned Value: + * Zero (OK) is returned on success; a negated errno value is returned + * on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_MM_SHM +int up_shmat(FAR uintptr_t *pages, unsigned int npages, uintptr_t vaddr); +#endif + +/**************************************************************************** + * Name: up_shmdt + * + * Description: + * Detach, i.e, unmap, on shared memory region from a user virtual address + * + * Input Parameters: + * vaddr - The virtual address corresponding to the beginning of the + * (contiguous) virtual address region. + * npages - The number of pages to be unmapped + * + * Returned Value: + * Zero (OK) is returned on success; a negated errno value is returned + * on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_MM_SHM +int up_shmdt(uintptr_t vaddr, unsigned int npages); +#endif + /**************************************************************************** * Name: up_interrupt_context *