Add recording support to the Nuttx audio driver for Spresense.
- Supports 16 bit data with 48 kHz sample rate only for now.
- Supports 1 (dual mono) 2 or 4 channels.
- Only analog mics have been tested so digital is considered
unsupported.
- Remove per-thread errno from the TCB structure (pterrno)
- Remove get_errno() and set_errno() as functions. The macros are still available as stubs and will be needed in the future if we need to access the errno from a different address environment (KERNEL mode).
- Add errno value to the tls_info_s structure definitions
- Move sched/errno to libs/libc/errno. Replace old TCB access to the errno with TLS access to the errno.
Revert a portion of eca7059785 that
causes compiler warnings about unused variables if nx_start() is not
initializing any of the user-mode heap, kernel-mode heap, or page
allocator:
init/nx_start.c: In function 'nx_start':
init/nx_start.c:552:14: warning: unused variable 'heap_size'
[-Wunused-variable]
size_t heap_size;
^~~~~~~~~
init/nx_start.c:551:17: warning: unused variable 'heap_start'
[-Wunused-variable]
FAR void *heap_start;
^~~~~~~~~~
See dev@nuttx.apache.org mailing list discussion "New unused variables
warning in nx_start()" starting 6 May 2020, archived here:
https://lists.apache.org/thread.html/r3900727e6a06f4445d6eb881d065119ba6647daab89600c3d45d1424%40%3Cdev.nuttx.apache.org%3E
sched/init/nx_start.c:
* If none of MM_KERNEL_USRHEAP_INIT, CONFIG_MM_KERNEL_HEAP, or
CONFIG_MM_PGALLOC are defined, the variables heap_start and
heap_size were declared but never used.
* This change reinstates wrapping the block with a preprocessor
conditional to prevent the variables being declared if they will
not be used. This preprocessor condition was removed in the
above-mentioned commit.
In the past a very low effort interface was used:
- All parmeters were treated as though they were type uinptr_t, and
- The maximum number of parmeters (6) was passed in all cases.
The first is potentially wrong and the second is very inefficient. This commit improves this by:
- Making tools/mksyscall.c more intelligent, and
- Extending the syntax for variadic functions.
For example, in syscall.cvs, the open() API was represened like this:
"open","fcntl.h","","int","const char*","int","..."
In reality, open may take only a single optional argument of type mode_t which is not the same size as uintptr_t. And there is not reason to pass 6 parameters in that case.
And this has been extended to:
"open","fcntl.h","","int","const char*","int","...","mode_t"
The existence of the "mode_t" tells tools/mksyscall that there is at most one optional parameter and, if present, it is of type mode_t.
Move the logic to get TLS information from an inline function to a normal function. For the unaligned case, it is probably too large to be inlined.
Also fixes some minor things from review of previous commits.
CONFIG_TLS_ALIGNED will select the (legacy) aligned stack implementation of TLS. If CONFIG_TLS_ALIGNED is not defined, then the new, implementation of TLS using an unaligned stack will be enabled.
The "info" structure was used non initialized and causing bad sounds at
boot. The start() function is anyway called later on when actually playing
sounds.