malloc() and free() should never be used within the OS. This will work in the FLAT build because there is only a single heap, but will cause problems in PROTECTED and KERNEL build modes where there are separate heaps for user and kernel memory.
Typically kmm_malloc(), kmm_zalloc(), and kmm_free() should be called within the kernel in those build modes to use the kernel heap.
Memory is never free. Possible memory leak:
./boards/arm/cxd56xx/common/src/cxd56_crashdump.c: pdump = malloc(sizeof(fullcontext_t));
Memory allocated with malloc(), but freed with kmm_free():
./drivers/usbhost/usbhost_composite.c: cfgbuffer = (FAR uint8_t *)malloc(CUSTOM_CONFIG_BUFSIZE);
Memory is never freed in these cases. It is allocated in the driver initialization logic, but there is no corresponding uninitialization logic; memory is not freed on error conditions:
./arch/arm/src/lc823450/lc823450_i2s.c: priv = (struct lc823450_i2s_s *)zalloc(sizeof(struct lc823450_i2s_s));
./arch/arm/src/sam34/sam_spi.c: spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));
./arch/arm/src/sama5/sam_spi.c: spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));
./arch/arm/src/samv7/sam_spi.c: spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));
Memory is allocated with zalloc() but freed on error conditions with kmm_free():
./arch/arm/src/sama5/sam_ssc.c: priv = (struct sam_ssc_s *)zalloc(sizeof(struct sam_ssc_s));
./arch/arm/src/samv7/sam_ssc.c: priv = (struct sam_ssc_s *)zalloc(sizeof(struct sam_ssc_s));
./arch/arm/src/stm32/stm32_i2s.c: priv = (struct stm32_i2s_s *)zalloc(sizeof(struct stm32_i2s_s));
Memory is never freed:
./drivers/spi/spi_bitbang.c: priv = (FAR struct spi_bitbang_s *)zalloc(sizeof(struct spi_bitbang_s));
arch/arm/src/cxd56xx/cxd56_gnss.c, arch/arm/src/xmc4/xmc4_spi.c,
crypto/blake2s.c, drivers/lcd/pcf8574_lcd_backpack.c, drivers/lcd/st7032.c
User space memory should not be used within the OS and, when it is absolutely necessary to use user-space memory, it should be allocated using kumm_malloc().
drivers/net/telnet.c
drivers/wireless/bluetooth/bt_uart_bcm4343x.c
drivers/wireless/ieee802154/mrf24j40/mrf24j40.c
Kernel memory was allocated using kmm_malloc() or kmm_zalloc() but freed with with the user-space allocator free(). In the FLAT build, this is bad style, but not harmful because there is only a single, heap and malloc() and kmm_malloc() map to the same function.
But that is not true in the case of the PROTECTED or KERNEL builds. In those cases, there are separate heaps. kmm_malloc() will allocate from the kernel heap. free() will attempt to free the kernel memory from the user heap and will cause an assertion (or other obscure failure if assertions are disabled).
Found by clang-check:
usbhost/hid_parser.c:278:26: warning: Assigned value is garbage or undefined
usage[i] = usage[i + 1];
^ ~~~~~~~~~~~~
usbhost/hid_parser.c:321:34: warning: Assigned value is garbage or undefined
usage[i] = usage[i + 1];
^ ~~~~~~~~~~~~
2 warnings generated.
Found by clang-check:
syslog/syslog_write.c:96:7: warning: Value stored to 'nwritten' is never read
nwritten = g_syslog_channel->sc_write(buffer, buflen);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
Summary:
- This PR fixes null pointer dereference in gs2200m.c
Impact:
- This PR affects gs2200m driver.
Testing:
- Use spresense:wifi and run gs2200m daemon in STA mode.
- Then execute 'renew eth0' to obtain DHCP address.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Make.dep file should be updated by .config changed after first make.
There are 2 cases affected for this problem:
1) Add source files by config symbol
2) Include header files in #ifdef directive
These 2 cases may not be included in Make.dep and this may prevent the
differential build from working correctly.
- Add new functions of GNSS
- Support the lower PWM frequency
- Add CONFIG_CPUFREQ_RELEASE_LOCK
- Add high speed ADC support
- Add HPADC input gain configuration
- Add eMMC device
- Frame buffer support
- Fix SD/GNSS/sensor drivers not worked
- Build errors
- Fix nxstyle issues
- Add board specific logic to altair modem dirver
- Fix issue that SPI4 RX frequency violated AC Spec
- Remove dummy buffer in altair driver
- Fix priority of SPI transfer task is too low
- Remove unnecessary configuration
- Modify timeout value for RX ready
- Fix minor bugs
Kinetis: Reworked USB driver for setup out data phase.
Freedom K28: New config nshsdusb, with RNDIS support
PL2303: Try to avoid clone detection.
General: various nxstyle fixes
General: license changed
since graphics/Kconfig already do the similar thing
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib2c1955a6b027cfa4e83c3b81ddfb505902dd85d
- Add missing cancel process when the send command fails
- Make it possible to recover from SD initialization error
- Reduce time in changing transfer mode to 5msec from 500msec.
Replace usleep function instead of up_udelay in other to avoid
blocking other tasks from working.
since libc++ declare these function in ctime by:
using ::localtime[_r];
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic0bb68b44c0cab838ab7cc34baee2aaa3ca8a9b5
avoid the buffer flush as much as possible
Change-Id: I902f374e9540b36bd0b0c77a34cab5014a2c24fc
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
Bug caused increase of fifo->rx_sem with each received msg until finally after 32767 messages get into
DEBUGASSERT(sem->semcount<SEM_VALUE_MAX);
or stopping receiving anything at all without debug, while tx was working.
issue #1354
Because user may replace math library with other implementation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idb5f2a8b2a70302c8561553b3bcbc40529b5257f
In the previous implementation, cxd56_stop() checked the internal
state before sending AUDIO_MSG_STOP to the message queue. However,
if the worker thread took time to turn on AMP, cxd560_stop() was
not able to send the message and caused a deadlock.
This commit fixes this issue by always sending AUDIO_MSG_STOP
regardless of the internal state.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
The video stream driver must be intialized from the board to comply with NuttX
NOTE:
Please remove the initalization from any camera example
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Fix the build error by initializing the variables before we perform
th querry for the ext control.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
so the lower half driver don't need include the specific board.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icf6638a6865bac42150b5957376e55909f041d40
and let USERLED_LOWER depends on ARCH_HAVE_LEDS instead
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie03e76d90b61a3d8d3457ccdd319a247b6075fa8
so the lower half driver don't need include the specific board.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2ff5c30049a5c5e8ee90baea56e9f4cb1a8a4f87
Move global variable declaration out of include/nuttx/video/video.h and into the file where it is initialized. With some toolchains/environments, declaring globals in header files results in multiply defined symobl errors at link time. This corrects that build problem.
Reported by 권석근 <kwonsksj@gmail.com>:
I found a bug at "pty.c" during ssh server implementation.
When I turn on CONFIG_SERIAL_TERMIOS and OPOST|ONLCR on pty device
for nsh console's stdin/stdout (ssh shell service), I've got system crash.
Bugs at line 687 of pty.c, pty_write()
ntotal++;
when converting '\n' to '\r\n', pty_write() will return more than requested
(+1, for example) length. and this will break caller lib_fflush(), line 150
of lib_libfflush.c.
When she get (libfflush()) bytes_nwritten which is greater than nbuffer,
nbuffer goes to negative at line 150 and eventually destroys
*stream->fs_bufpos at line 163 of lib_libflush.c
Removing ntotal++; line 687 of pty.c will fix this bug.
BTW, nsh using ptm/pty as a ssh shell service works great with libssh +
mbedtls.
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.
Same as syslog/Make.defs to use #ifdef CONFIG_SYSLOG_RPMSG to build syslog_rpmsg.c
in which syslog_rpmsg_init defined.
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
Adds an initial Nuttx audio driver supporting the Spresense CXD56.
Being a work in progress the driver has a number of limitations:
- Audio playback only, no recording yet.
- Only 16 bit stereo playback is supported.
- In practice only 48kHz playback is supported due to missing SRC.
- Configure driver in "Device Drivers --> Audio Device Support".
lpc2148_spi1.c:142:24: warning: initialization of 'uint32_t (*)(struct spi_dev_s *, uint32_t)' {aka 'unsigned int (*)(struct spi_dev_s *, unsigned int)'} from incompatible pointer type 'uint16_t (*)(struct spi_dev_s *, uint16_t)' {aka 'short unsigned int (*)(struct spi_dev_s *, short unsigned int)'} [-Wincompatible-pointer-types]
142 | .send = spi_send,
| ^~~~~~~~
lpc2148_spi1.c:142:24: note: (near initialization for 'g_spiops.send')
In file included from ieee802154/mac802154_bind.c:49:
ieee802154/mac802154_internal.h: In function 'mac802154_setdevmode':
ieee802154/mac802154_internal.h:788:42: warning: converting a packed 'enum ieee802154_devmode_e' pointer (alignment 1) to a 'const union ieee802154_attr_u' pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
788 | (FAR const union ieee802154_attr_u *)&mode);
| ^~~~~~~~~~~~~~~~~
chip/stm32_hciuart.c: In function 'hciuart_read':
chip/stm32_hciuart.c:2104:30: warning: statement with no effect [-Wunused-value]
2104 | ntotal == (ssize_t)ret;
| ~~~~~~~^~~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c: In function 'bcmf_wl_auth_event_handler':
wireless/ieee80211/bcm43xxx/bcmf_driver.c:579:23: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
579 | type = bcmf_getle32(&event->type);
| ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c:580:25: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
580 | status = bcmf_getle32(&event->status);
| ^~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c: In function 'bcmf_wl_scan_event_handler':
wireless/ieee80211/bcm43xxx/bcmf_driver.c:619:25: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
619 | status = bcmf_getle32(&event->status);
| ^~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c:620:35: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
620 | escan_result_len = bcmf_getle32(&event->len);
| ^~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_bdc.c: In function 'bcmf_bdc_process_event_frame':
wireless/ieee80211/bcm43xxx/bcmf_bdc.c:166:27: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
166 | event_id = bcmf_getle32(&event_msg->event.type);
| ^~~~~~~~~~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c: In function 'sdio_io_rw_direct':
wireless/ieee80211/bcm43xxx/mmc_sdio.c:157:3: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
157 | ret = SDIO_RECVR5(dev, SD_ACMD52, (uint32_t *)&resp);
| ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
79 | begin_packed_struct struct sdio_resp_R5
| ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c: In function 'sdio_io_rw_extended':
wireless/ieee80211/bcm43xxx/mmc_sdio.c:239:11: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
239 | ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
| ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
79 | begin_packed_struct struct sdio_resp_R5
| ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:244:11: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
244 | ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
| ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
79 | begin_packed_struct struct sdio_resp_R5
| ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:257:7: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
257 | ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
| ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
79 | begin_packed_struct struct sdio_resp_R5
| ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:265:3: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
265 | SDIO_RECVR1(dev, SD_ACMD52ABRT, (uint32_t *)&resp);
| ^~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
79 | begin_packed_struct struct sdio_resp_R5
| ^~~~~~~~~~~~
chip/stm32_adc.c: In function 'adc_reset':
chip/stm32_adc.c:2860:7: warning: unused variable 'ret' [-Wunused-variable]
2860 | int ret;
| ^~~
chip/stm32_adc.c: In function 'adc_shutdown':
chip/stm32_adc.c:3044:7: warning: unused variable 'ret' [-Wunused-variable]
3044 | int ret;
| ^~~
chip/stm32_i2c.c:722:12: warning: 'stm32_i2c_sem_wait_noncancelable' defined but not used [-Wunused-function]
722 | static int stm32_i2c_sem_wait_noncancelable(FAR struct i2c_master_s *dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wireless/gs2200m.c: In function 'gs2200m_read':
wireless/gs2200m.c:727:20: warning: passing argument 1 of 'nxsem_wait' from incompatible pointer type [-Wincompatible-pointer-types]
727 | ret = nxsem_wait(dev);
| ^~~
| |
| struct gs2200m_dev_s *
.config:1207:warning: symbol value '' invalid for TESTING_OSTEST_FPUSIZE
platform/audio/cxd56_audio_analog.c:69:13: warning: inline function 'cxd56_audio_clock_is_enabled' declared but never defined
69 | inline bool cxd56_audio_clock_is_enabled(void);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
platform/audio/cxd56_audio_analog.c:68:13: warning: inline function 'cxd56_audio_clock_disable' declared but never defined
68 | inline void cxd56_audio_clock_disable(void);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
platform/audio/cxd56_audio_analog.c:67:13: warning: inline function 'cxd56_audio_clock_enable' declared but never defined
67 | inline void cxd56_audio_clock_enable(uint32_t clk, uint32_t div);
| ^~~~~~~~~~~~~~~~~~~~~~~~
chip/stm32_adc.c: In function 'adc_reset':
chip/stm32_adc.c:1348:7: warning: unused variable 'ret' [-Wunused-variable]
1348 | int ret;
| ^~~
chip/stm32_adc.c: In function 'adc_shutdown':
chip/stm32_adc.c:1496:7: warning: unused variable 'ret' [-Wunused-variable]
1496 | int ret;
| ^~~
chip/stm32_i2c.c:729:12: warning: 'stm32_i2c_sem_wait_uninterruptble' defined but not used [-Wunused-function]
729 | static int stm32_i2c_sem_wait_uninterruptble(FAR struct i2c_master_s *dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wireless/lpwan/sx127x/sx127x.c:147:52: warning: missing terminating ' character
147 | # warning OOK support is not complete, RX+TX doesn't work yet!
| ^
str71_spi.c:435:24: warning: initialization of 'uint32_t (*)(struct spi_dev_s *, uint32_t)' {aka 'unsigned int (*)(struct spi_dev_s *, unsigned int)'} from incompatible pointer type
'uint16_t (*)(struct spi_dev_s *, uint16_t)' {aka 'short unsigned int (*)(struct spi_dev_s *, short unsigned int)'} [-Wincompatible-pointer-types]
435 | .send = spi_send,
| ^~~~~~~~
str71_spi.c:435:24: note: (near initialization for 'g_spiops.send')
chip/pic32mx-lowconsole.c:147:24: warning: 'pic32mx_getreg' defined but not used [-Wunused-function]
static inline uint32_t pic32mx_getreg(uintptr_t uart_base,
^
chip/pic32mx-gpio.c:113:20: warning: 'pic32mx_value' defined but not used [-Wunused-function]
static inline bool pic32mx_value(uint16_t pinset)
^
chip/pic32mz-gpio.c:124:20: warning: 'pic32mz_value' defined but not used [-Wunused-function]
static inline bool pic32mz_value(pinset_t pinset)
^
chip/pic32mx-usbdev.c:3065:1: warning: 'pic32mx_epreserved' defined but not used [-Wunused-function]
pic32mx_epreserved(struct pic32mx_usbdev_s *priv, int epno)
^
mmcsd/mmcsd_spi.c: In function 'mmcsd_mediachanged':
mmcsd/mmcsd_spi.c:1938:7: warning: 'return' with a value, in function returning void
return ret;
^
In file included from partition/fs_partition.c:42:0:
partition/partition.h:66:19: warning: 'read_partition_block' defined but not used [-Wunused-function]
static inline int read_partition_block(FAR struct partition_state_s *state,
^
local/local_netpoll.c: In function 'local_pollsetup':
local/local_netpoll.c:305:1: warning: label 'pollerr' defined but not used [-Wunused-label]
pollerr:
^~~~~~~
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If3ea8f32b878aa218072130f7c3018f0d3c1aca5
arp/arp_notify.c:132:43: warning: for loop has empty body [-Wempty-body]
prev = curr, curr = curr->nt_flink);
^
sixlowpan/sixlowpan_tcpsend.c:806:31: warning: implicit conversion from 'unsigned int' to 'uint16_t' (aka 'unsigned short') changes value from 4294967295 to 65535 [-Wconstant-conversion]
_SO_TIMEOUT(psock->s_sndtimeo));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Numerous warnings like:
ieee802154_getreq.c:93:3: warning: implicit declaration of function 'memcpy' is invalid in C99 [-Wimplicit-function-declaration]
IEEE802154_EADDRCOPY(eaddr, req.attrval.mac.eaddr);
^
nxfonts/nxfonts_cache.c:839:35: warning: for loop has empty body [-Wempty-body]
fcache = fcache->flink);
bluetooth/bluetooth_finddev.c💯11: warning: implicit declaration of function 'memcmp' is invalid in C99 [-Wimplicit-function-declaration]
if (BLUETOOTH_ADDRCMP(dev->d_mac.radio.nv_addr, match->bf_addr))
^
rwbuffer.c:559:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (rwb->rhmaxblocks > 0 && rwb->rhnblocks > 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/telnet.c:1317:40: warning: result of comparison of constant 256 with expression of type 'uint8_t' (aka 'unsigned char') is always true [-Wtautological-constant-out-of-range-compare]
if (priv->td_pending < CONFIG_TELNET_RXBUFFER_SIZE)
~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
time/lib_localtime.c:569:32: warning: sizeof on pointer operation will return size of 'char *' instead of 'char [33]' [-Wsizeof-array-decay]
sizeof(lsp->fullname - 1) <= strlen(p) + strlen(name))
~~~~~~~~~~~~~ ^
The SDIO interface structure includes fields with names like recvR1 and others. These cause "Mixed case identifier" errors from nxstyle in all places they are uses.
This change performs a mass substition of recvR with recv_r to correct this coding standard violation.
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution: Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly. This commit is only for rwbuffer.c and those files under drivers/serial, drivers/timers, and drivers/usbdev.
This commit completes that step for all of the files under drivers/. Still remaining: All of the files under arch/.
This file is a work in progress and was accidentally committed with some other files. This PR backs out those changes until I can better verify the changes.
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution: Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly. This commit is only for those files under drivers/pipes and drivers/wireless.
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution: Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly. This commit is only for those files under drivers/audio, drivers/net, and drivers/lcd.
* Check return from nxsem_wait_initialize()
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution: Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly.
This commit is only for those files under drivers/eeprom.
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution: Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly. This commit is only for those files under drivers/input.
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution: Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly. This commit is only for those files under drivers/usbhost.
nxsem_timedwait_uninterruptible() must return -ECANCELED if the thread is canceled:
include/nuttx/semaphore.h: Return if nxsem_wait() returns ECANCELED meaning that the thread waiting for the semaphore has been canceled.
sched/semaphore/sem_timedwait.c: Same change (the inline version is in semaphore.h, the non-inlined version is in sem_tickwait.c).
drivers/sensors/lps25h.c and drivers/wireless/bluetooth/bt_uart_bcm4343x.c: Make sure that the caller deals correctly with the -ECANCELED return value.
Refer to issue 619.
* The appropriate size of stack varies among archs.
E.g. for 64-bit sim, 2048 is way too small, especially when the task
happens to use host OS functionalities.
I plan to allow an arch provide its own default.
* I plan to use this to replace hardcoded "STACKSIZE = 2048" in APPDIR.
This reverts commit b9ace36fcc.
This change was added by PR 625 but has a serious logic flaw. It removes all occurrences of INCDIROPT and replaces it with a definition in tools/Config.mk:
else ifeq ($(WINTOOL),y)
DEFINE = "$(TOPDIR)/tools/define.sh"
INCDIR = "$(TOPDIR)/tools/incdir.sh" -w
This logic flaw is the Config.mk is included in all Make.defs files BEFORE WINTOOL is defined. As a result, the definition is wrong in many places when building under Cygwin with a Windows native toolchain.
boards/z80/ez80/z20x/configs/w25boot/defconfig: Increase size of serial Tx buffer.
boards/z80/ez80/z20x/src/w25_main.c: Add some fflush() in necessary places. Greatly improves the usability of the UI.
boards/z80/ez80/z20x/README.txt: Trival update to README
drivers/serial/serial.c and tcdrain.c: Correct some typos.
alarminfo->active = false will kill the signal which will disable the interrupt.
In effect, periodic interrupt will behave like alarm interrupt.
So, removed alarminfo->active = false from rtc_periodic_callback() function
Update rtc.c
Eliminated unused function tun_ipv6multicast(). This eliminates a warning from the build test:
net/tun.c:1061:13: warning: 'tun_ipv6multicast' defined but not used [-Wunused-function]
static void tun_ipv6multicast(FAR struct tun_device_s *priv)
^~~~~~~~~~~~~~~~~
Author: Alan Carvalho de Assis <acassis@gmail.com>
Fix all nxstyle reported issues
Author: Robin Raymond <robin@opticaltone.com>
Fixed compilation issue with poll fds notification.
https://github.com/apache/incubator-nuttx/issues/483
arch/z80/src/ez80/ez80_spi.c: Do not configure SPI chip select pin. It is not used by the driver and configuring it just clobbers other usage of that pin. Add some additional debug outputs; correct some exiting debug outputs.
drivers/mtd/w25.c: Add some debug output.
boards/z80/ez80/z20x/src/ez80_w25.c: Correct SPI bus number used in initialization. Only SPI1 is supported.
arch/z80/src/ez80/ez80_timerisr.c: Some initial timer configuration fixes.
This sensor driver needs rework to match the needed layout for standar NuttX driver.
In the meantime it is moved to board specific sensors to fix the violation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* Adding support for BQ769x0 Battery Monitor IC (Work In Progress)
* Additional changes to support BQ769x0
* Store cell count and chip type when setting up
* Added shutdown, limits, charge/discharge switch, and clear faults operations
* Added support for current measurement; some cleanup
* Updated temperature reporting. Fixed negative current reporting.
* When setting safety limits, update limit structure with actual values used.
* Added note on battery limit structure
* Updates to BQ769x0. Re-ordered fault reporting, added fault cache, added ordered fault clearing
And remove syslog_init_e because all initialization is later now and we don't
distinguish the initialition phase anymore after ramlog don't need special
initialize.
Because we can get the same function by CONSOLE_SYSLOG/syslog_console_init.
BTW, it isn't a good choice to use g_ramlogfops as /dev/console since nsh
will read back what it send out which will surprise most people.
This commit does two things:
1. First, it reorganizes the driver Kconfig files so that each is self contained. Before, a part of the driver configuration was in drivers/Kconfig and the rest was in in drivers/xyz/Konfig. Now, all of the driver configuration is consolitated in the latter.
2. Second, this commit correct numerous serious errors introduced in a previous reorganization of the driver Kconfig files. This was first noted by Nicholas Chin in PR270 for the case of the drivers/i2c/Kconfig but some examination indicates that the error was introduced into several other Kconfig files as well.
The nature of the introduced error was basically this:
- Nothing must intervene between the menuconfig selection and the following conditional configuration otpions.
- A previous PR erroneously introduced unconditional options between the menuconfig and the following confditional logic, thus corrupting the driver menus.
This error was easy to make because the driver Kconfig files were not well modularized. Making them fully self-contained should eliminate this kind of error in the future.
Historically, the loopback driver used the largest packet size of all enabled link layer protocols. This permitted packets to be forward via the loopbak device with no major loss of performance. However, in experimenting with configurations where no other link layer protocols were enabled, this means the loopback packet size was set to the smallest possible size, to the SLIP minimum of 296 bytes. This resulted in terrible loopback performance.
This commit adds an option to increase the loopback packet size with the option CONFIG_NET_LOOPBACK_PACKETSIZE.
The loopback driver packet buffer should be quite large. The larger the loopback packet buffer, the better will be TCP performance of the loopback transfers. The Linux loopback device historically used packet buffers of size 16Kb, but that was increased in recent Linux versions to 64Kb. Those sizes may be excessive for resource constrained MCUs, however.
The network still enforces the lower limit that is the maximum packet size of all enabled link layer protocols. But this new option permits the loopback packet size to be increased from that.
* net/Kconfig: Adds CONFIG_NET_LOOPBACK_PKTSIZE option
* include/nuttx/net/netconfig.h: Assures that the packet size that is used is at least as large as the largest packet size of other link layer protocols.
* drivers/net/loopback.c: Use that larger packet size.
* boards/sim/sim/sim/configs/tcploop/defconfig: Set the loopback packet size to 1500
Trigger SGA and ECHO proactively in character mode otherwise Ubuntu bultin telnet can't enter this mode
Change-Id: I8aa2ab2b31c35007077c701c264b3971152435f0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Remove g_telnet_common global variable; we can reuse g_clients_sem as the lock guard
Change-Id: Ic3af9f2116f70523a4249b29c65bd1fb83ca4da2
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Telnet driver should return -EAGAIN is O_NONBLOCK is active also should report -EPIPE first
Change-Id: I7ad2df15377c7bec8e22d0f5d1b54f7ce33eb0db
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Refine Ctrl-C handling in telnet driver to avoid issue the kill more than once
Change-Id: I9fcec5d861ea85258170f379d741d2bb8e4d9b9e
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Splict common_ioctl into telnet_ioctl and factoral_ioctl. Rmove the wrong telnet_poll from g_factory_fops
Change-Id: I39f278763ff279d464c5be6728b9936c6cab16eb
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
* S32K add support for Nxp drone boards
* Update arch/arm/src/s32k1xx/hardware/s32k1xx_rtc.h codestyle
Co-Authored-By: David Sidrane <David.Sidrane@Nscdg.com>
Co-authored-by: Jari van Ewijk <jari.vanewijk@nxp.com>
Co-authored-by: David Sidrane <David.Sidrane@Nscdg.com>
* Remove the code duplication in tun_net_receive_tap and remove the unused filep field
* Shouldn't return -EBUSY in tun_write. Let the caller wait until the write buffer free
* Handle that write buffer is ready first correctly in tun_read
* Remove the unused tun_ipv6multicast
Gregory Nutt <gnutt@nuttx.org>
Run all .c and .h files modified in this PR through nxstyle and correct all coding standard problems.
Xiang Xiao <xiaoxiang@xiaomi.com>
Remove TIME_EXTENDED option to more conform C standard
Note: the code/data size increment is small
to fix the follow error:
Refresh skp16c26/ostest
LN: include/arch/board to /workspace/mirtos/nuttx/boards/renesas/m32262f8/skp16c26/include
LN: include/arch/chip to arch/renesas/include/m32262f8
Author: Gregory Nutt <gnutt@nuttx.org>
Run all .c and .h files in last PR through tools/nxstyle and correct all coding standard complaints.
Author: Oleg <ev.mipt@gmail.com>
* Fix CAN driver to work with internal OS interfaces. Store internal file pointer in f_priv and use it then to distinct readers (See issue #111)
* Store reader pointer in f_priv instead of filep
* Don't need in filep in can_reader_s
Author: Alan Carvalho de Assis <acassis@gmail.com>
Run nxstyle on .c and .h files and fix it
Author: Alin Jerpelea <alin.jerpelea@sony.com>
drivers: usbdev: minor fix
drivers: usbdev: usbmsc full speed not available
Change transfer size to be based on maxpacket size.
drivers: usbdev: Fix string ID calculation
For *_STRBASE defines, it already unnecessary because composite device setup
has been changed, it would be calculated by *_composite.c in board sources.
drivers: usbdev: Fix invalid/unsupported command processing
Mass Storage Class shall stall when invalid or unsupported commands
has been recieved.
drivers: usbdev: Remove unnecessary reset logic
drivers: usbdev: Flags comparison fix
drivers: usbdev: Descriptor type mismatch fix when dual speed is enabled
Author: Alan Carvalho de Assis <acassis@gmail.com>
Run nxstyle against .c .h files and fix it
Author: Adam Feuer <adam@starcat.io>
Summary
Adds CDC ECM Ethernet over USB High Speed for SAMA5D36-Xplained
(and maybe other boards) (most of the code was there already,
but didn't work out of the box for the SAMA5D36-Xplained)
Only SAMA5D36-Xplained has been tested so far
Impact
None if you don't use the CDC ECM Ethernet driver
On SAMA5D36-Xplained, this adds high-speed Internet connectivity
over USB 2.0 High Speed. via the USB CDC ECM Gadget driver.
It may work on other boards too.
This also fixed full-speed (low-speed) mode for the board too.
Limitations
Hasn't been tested on anything other than SAMA5D36-Xplained board.
TODO
Ideally this would include a composite RNDIS device so it would
also work seamlessly on Windows. That is for a future PR
Ideally this would include software to help configuration via
mDNS/DNS-SD for plug and play compatibility with Linux and macOS.
That is for a future PR.
Detail
Only a few lines of C driver code needed to be changed, since the
capability was there already. The rest is config and documentation.
Changes the SAMA5D3-Xplained board bringup to match the SAMA5D3-EK
board bringup
A helper script to configure Linux routing and iptables NAT is also
provided, along with documentation on how to use it.
Testing
Manual, on a Ubuntu Linux 19.10 system and MacOS 10.14.6 Mojave
MacBook Pro.
How To Verify
Follow the new CDC ECM Ethernet over USB instructions in the board
README.txt file
Commits:
remove non-UTF-8 chars in comment and reformat
removed unneeded comment markers
instructions for using the defconfigs
removed EMAC from config
- to prove this example only needs the CDC ECM Ethernet over USB to work
added CDC-ECM Ethernet over USB info to README
added U-Boot image
added netusb helper script
- this can configure the Linux network interface and routes
so you can ping or access the NuttX system via TCP/IP.
renamed defconfig dirs to be ethernet-over-usb
- was usb-over-ethernet which is not right
added USB DMA to defconfigs
updated readme with autoboot and debugging info
bringing ethernet-over-usb examples into parity
added cdc ecm ethernet over usb with telnetd config
added defconfig
only use phy interrupt if netdevices is ethernet
- because now netdevice could be CDC ECM ethernet over usb
which has no PHY interrupt
add bringup to Makefile
add bringup
app init cleanup
init cdc ecm driver and rndis driver; some cleanup
fixed some typos and odd characters
usb over ethernet working over usb 2.0 hs
Author: Alan Carvalho de Assis <acassis@gmail.com>
Run nxstyle on all .c and .h and fix all issues
Author: Alin Jerpelea <alin.jerpelea@sony.com>
drivers: mtd: smart: Add smartfs fsck feature
Support fsck to check and repair the smartfs file system. If the power
loss occurs during writing into the flash, the dead space are created
in flash after the next power cycle. To avoid this problem, introduce
fsck and keep the consistency of file system in initializing smartfs.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
commit 60927c5fb6a353994341601f55071c618e97682b
Author: Alin Jerpelea <alin.jerpelea@sony.com>
Date: Thu Dec 28 18:27:21 2017 +0900
drivers: mtd: smart: Fix duplicate sector selection in SmartFS
Add care for 16-bit sequence without CRC.
drivers: mtd: smart: Check CRC of duplicate sectors
In the illegal case by power-loss, when the multiple logical sectors are
duplicated, we compare the sequence number of each sector and select the newer
sector. Just in case, add CRC check for the newer sector. If the newer sector
has CRC error, then we use the older sector.
drivers: mtd: smart: SPI-Flash recovery from the initial error state
The FLASH may be not erased in the initial delivery state.
Just in case for the recovery of this fatal situation,
after once erasing the sector, return the sector as a free sector.
drivers: mtd: smart: Fix error handling in smartfs mtd driver
Add error handling in relocate sector.
drivers: mtd: smart: Fix initialize sector sequence value in smartfs
Fix initialization of sequence value into sector header and also avoid
unaligned memory access when CONFIG_MTD_SMART_ENABLE_CRC=n.
drivers: mtd: smart: Fix handling of duplicate sector in smartfs
In smartfs scan, if duplicate logical sector is found on the device,
then smartfs selects the winner sector by comparing sequence number,
and the loser sector is soon released. Fix a bug this loser sector
is registered into logical-to-physical sector mapping table.
Author: Alan Carvalho de Assis <acassis@gmail.com>
Run nxstyle to check .c and .h files and fix reported issues
Author: liuzhao <happypapa@yeah.net>
Add Quectel EC20 4G LTE Module USB CDC/ACM support