we are using segger RTT protocol over shared memory for two core log/trace: one is NuttX another Linux/Windows. But the base address of shared memory can only be known at runtime, so we change SEGGER_RTT_UNCACHED_OFF from macro to global variable, and update to the correct g_segger_offset after the shared memory is initialized by:
g_segger_offset = (uintptr_t)ishmem - (uintptr_t)&_SEGGER_RTT;
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
Initial implementation of RFC 5424 support (syslog protocol). Allows
users to force-format the syslog output in a RFC 5424 compatible way,
making NuttX systems 'originators' that are able to interface with
syslog 'collectors' and 'relays' (useful for logging to syslog servers).
In addition to regular formatting options for syslog output, users can
also add structured data (currently only timeQuality is implemented,
assuming no sync and no timezone is no known). Facilities and severities
now also follow RFC 5424. Support for additional features (like
more sdata elements, msgid, etc.) will need to be built into the syslog
implementation if desired.
This patch is a rework of the NuttX file descriptor implementation. The
goal is two-fold:
1. Improve POSIX compliance. The old implementation tied file description
to inode only, not the file struct. POSIX however dictates otherwise.
2. Fix a bug with descriptor duplication (dup2() and dup3()). There is
an existing race condition with this POSIX API that currently results
in a kernel side crash.
The crash occurs when a partially open / closed file descriptor is
duplicated. The reason for the crash is that even if the descriptor is
closed, the file might still be in use by the kernel (due to e.g. ongoing
write to file). The open file data is changed by file_dup3() and this
causes a crash in the device / drivers themselves as they lose access to
the inode and private data.
The fix is done by separating struct file into file and file descriptor
structs. The file struct can live on even if the descriptor is closed,
fixing the crash. This also fixes the POSIX issue, as two descriptors
can now point to the same file.
Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Use the flag CONFIG_ARCH_HAVE_PERF_EVENTS to detect whether the architecture specific code
provides the up_perf_* functions. Now it is mixed with CONFIG_ARCH_PERF_EVENTS, which should
select just whether the perf events (perf_*) are enabled for the configuration.
- drivers/timers/arch_alarm.c: Don't compile the up_perf_* functions here if the
CONFIG_ARCH_HAVE_PERF_EVENTS is defined
- arch/*/*_perf.c: Change CONFIG_ARCH_PERF_EVENTS -> CONFIG_ARCH_HAVE_PERF_EVENTS to
select whether architecture specific up_perf_* functions are provided
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
Add a configuration option CONFIG_SEGGER_SYSVIEW_POST_MORTEM to enable
logging continuously into a circular buffer
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
Don't assume that perf_getfreq returns nanoseconds, define the
SEGGER_SYSVIEW_TIMESTAMP_FREQ instead.
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
mtd/mtd_rwbuffer.c:42:
mtd/mtd_rwbuffer.c: In function 'mtd_erase':
mtd/mtd_rwbuffer.c:189:9: warning: format '%zx' expects argument of type 'size_t', but argument 3 has type 'long long int' [-Wformat=]
189 | finfo("block: %08zx nsectors: %zu\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190 | (intmax_t)block, nsectors);
| ~~~~~~~~~~~~~~~
| |
| long long int
mtd/mtd_rwbuffer.c:189:21: note: format string is defined here
189 | finfo("block: %08zx nsectors: %zu\n",
| ~~~~^
| |
| unsigned int
| %08llx
mtd/mtd_rwbuffer.c: In function 'mtd_ioctl':
mtd/mtd_rwbuffer.c:298:21: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
298 | finfo("blocksize: %d erasesize: %d neraseblocks: %d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
299 | geo->blocksize, geo->erasesize, geo->neraseblocks);
| ~~~~~~~~~~~~~~
| |
| uint32_t {aka long unsigned int}
...
Signed-off-by: chao an <anchao.archer@bytedance.com>
if rpmsg triggers force flushing when the master core provides lower putc,
characters will be duplicated caused by SYSLOG_DEFAULT also send the char to lower half.
in this PR, we disable force put char to lower putc if CONFIG_SYSLOG_DEFAULT is enabled
Signed-off-by: chao an <anchao.archer@bytedance.com>
The ADS1115 driver uses the `nxsig_usleep()` function to sleep for a
65us delay, but with a 1ms tick resolution and the context-switching
overhead, this is much more than 1ms. Introducing `up_udelay` (even with
a larger duration because of the unreliability of busy-waiting) speeds
up sampling noticeably.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
fix various coding style issues for drivers/sensors:
- remove redundant `#define CONFIG_XXX` that should be provided from Kconfig
- correct section banners
- remove empty section banners
- fix some function banners
Signed-off-by: raiden00pl <raiden00@railab.me>
Fix frame reception when CANFD is not enabled and there are many message in
the RX buffer.
The previous implementation assumed that the size of the data in the RX buffer
is constant, which is not true. Fortunately, the amount of
data in the buffer can be easily read from frame->fmt.rwcnt.
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
Add support for BME688 sensor based on BME680 implementation.
The BME688 is nearly identical to the BME680, and this implementation
reuses much of the existing BME680 code. However, there are some differences
related to gas measurements that make it impractical to use the same driver
without significantly complicating it. BME688 also supports parallel mode
which isn't yet supported.
Signed-off-by: raiden00pl <raiden00@railab.me>
This revises the post-IRQ interruption control logic so that to balance
the disable/enable operations for both chardev and socketcan cases.
Checked with chardev/socketcan on qemu-intel64.
Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
fix an unaligned pointer error for arm32 build:
ctucanfd_pci.c:1361:7: warning: converting a packed 'struct ctucanfd_frame_s'
pointer (alignment 1) to a 'uint32_t' {aka 'long unsigned int'} pointer (alignment 4)
may result in an unaligned pointer value [-Waddress-of-packed-member]
1361 | ptr = (FAR uint32_t *)&rxframe;
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
Move can_bytes2dlc() and can_dlc2bytes() to a common CAN file
that can be shared between socketCAN implementation and CAN
character driver.
This is the first step to simplifying the logic repeated in
many CAN drivers.
Signed-off-by: raiden00pl <raiden00@railab.me>
So far the NuttX implementation of OP-TEE has been using
registered memory references to pass non-registered memory
to OP-TEE OS, passing the physical address of the memory
in what is normally used as a 'cookie'. This was compatible
with the Openvela framework, but no other OP-TEE OS.
Fix this by passing temporary memory instead with the standard
non-contiguous (OPTEE_MSG_ATTR_NONCONTIG) flag.
Signed-off-by: George Poulios <gpoulios@census-labs.com>
This is mostly to handle the case that the user calls
close() before calling close() on the shm. In that case
optee_close() frees the shm and then optee_shm_close()
operates on an invalid reference. Fix that.
Signed-off-by: George Poulios <gpoulios@census-labs.com>
This is no longer (exactly) the linked list entry that it
used to be, but rather an associated pointer in an idr tree
entry. Plain 'optee_shm' is more concise, and more appropriate.
Changes also reg_pair_to_uintptr() to reg_pair_to_ptr() for
better readability in invocations.
Signed-off-by: George Poulios <gpoulios@census-labs.com>
Previous implementation was not compatible with GlobalPlatform
API in the following ways:
- Registered mem IDs would begin from negatives when it should
have been greater than or equal to 0
- Register IOCTL would return 0 on success, when it should have
been returning a file descriptor.
- Register IOCTL would expect the user-space client to specify
TEE_SHM_* flags dictating its behaviour when in fact, libteec
never specifies flags.
This commit fixes all those issues. It uses nuttx/idr.h instead
of a linked list, and it uses `file_allocate` to provide file
descriptors for registered shared memory. Upon close(fd), the
memory is de-registered and freed accordingly. It also updates
the documentation accordingly.
Signed-off-by: George Poulios <gpoulios@census-labs.com>
Some calls to `optee_is_valid_range()` would return
-EINVAL and some would return -EACCESS. Change all to
-EFAULT (Bad Address) which is more appropriate.
Signed-off-by: George Poulios <gpoulios@census-labs.com>
Option COMPOSITE_VENDORSTR should be described as composite vendor
string, not vendor id. This is consistent with other USB devices.
Also fixes a typo in USBDEV_EPBUFFER_ALIGNMENT.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Call SDIO_DMARECVSETUP instead of SDIO_RECVSETUP if CONFIG_SDIO_DMA
is defined, aligning with other callings of in mmcsd_sdio.c.
Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
So far NuttX has supported OP-TEE interfacing over
local and RPMsg sockets. This commit introduces support
for direct invocation of OP-TEE through arm SMCs. The
SMC transport is enabled through CONFIG_DEV_OPTEE_SMC.
This SMC implementation has been tested only with arm64,
OP-TEE rev 4.4.
Note that it does not support reverse direction RPCs,
i.e. from the Secure World to the Normal World to
something like optee supplicant. A basic RPC handling
skeleton is provided with implementation for some
basic functions (alloc/free mem, and foreign interrupts)
but no supplicant command handling.
(+one minor change s/parm/param in arch/arm64/include/syscall
to satisfy the spellchecker during PR)
Signed-off-by: George Poulios <gpoulios@census-labs.com>
Adds support for SHM_REGISTER IOCTL. Registration can
be requested both against the driver (for automatic cleanup)
and against the secure OS (for sharing).
Introduces also `optee_{msg,free}_alloc()` to allocate
aligned memory for message arguments depending on the
`alignment` specified in the driver's private data. For
alignment greater than word size, memory is allocated on the
heap, otherwise it's allocated on the stack (similar to the
previous implementation but using `alloca()` instead).
Signed-off-by: George Poulios <gpoulios@census-labs.com>
Besides a few checks for NULL IOCTL argument values, this
commits introduces also a check to ensure that user specified
memory (mainly IOCTL arguments) indeed belongs to the user.
This is applicable only with `CONFIG_ARCH_ADDRENV`.
Signed-off-by: George Poulios <gpoulios@census-labs.com>
Prepares the ground for introducing new transports to
the OP-TEE driver. "transports" as in alternatives to
RPMsg and local network.
Signed-off-by: George Poulios <gpoulios@census-labs.com>
Adds Kconfig-selected splashscreen options used when the driver is first registered
* Includes a new Python script in ./tools to create RLE bitmap files
* Includes default NS logo btimaps in 320x320, 160x160 and 80x80 resolutions along with their PNG files
Signed-off-by: Tim Hardisty timh@jti.uk.com>
The MCP47X6 series consists of the following single channel DAC chips:
- MCP4706 (8 bit)
- MCP4716 (10 bit)
- MCP4726 (12 bit)
The driver supports the following configurations:
- gain
- power down
- voltage reference
Persistent configuration storage in the internal EEPROM is not
implemented.
ax99100 export each serial port as a separate PCI device function
so we have to handle this properly.
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>