Commit Graph

3706 Commits

Author SHA1 Message Date
raiden00pl
33901969fe Fix nxstyle warnings 2020-10-10 12:24:28 -06:00
raiden00pl
1621305e79 drivers: Changed headers for apache 2.0 license 2020-10-10 12:24:28 -06:00
Masayuki Ishikawa
822497d021 drivers: note: Fix compile errors in noteram_driver.c
Summary:
- This commit fixes compile errors if CONFIG_DEBUG_ASSERTIONS=y

Impact:
- Affects noteram_driver only

Testing:
- Tested with spresense:wifi_smp with CONFIG_DEBUG_ASSERTIONS=y

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-06 16:42:40 +08:00
Nakamura, Yuuichi
89ea234af8 Add on-boot instrumentation support for note filter 2020-10-06 03:26:46 +08:00
Nakamura, Yuuichi
a373079a94 Fix /dev/note driver for task trace support 2020-10-06 03:26:46 +08:00
Nakamura, Yuuichi
6efecd2105 Add notectl driver 2020-10-06 03:26:46 +08:00
Nathan Hartman
80ce7800a9 Sources and Docs: Fix typos and nxstyle issues
Documentation/contributing/coding_style.rst:

    * Fix repeated words: ("this this").
    * Remove trailing spaces.

boards/z80/z80/z80sim/README.txt:

    * Fix repeated words: ("this this") and rewrap lines.

graphics/Kconfig,
libs/libc/math/Kconfig:

    * Fix repeated words: ("this this").

arch/arm/src/armv7-a/arm_assert.c,
arch/arm/src/armv7-r/arm_assert.c,
arch/arm/src/imxrt/imxrt_enet.c,
arch/arm/src/kinetis/kinetis_enet.c,
arch/arm/src/kinetis/kinetis_flexcan.c,
arch/arm/src/s32k1xx/s32k1xx_enet.c,
arch/arm/src/s32k1xx/s32k1xx_flexcan.c,
arch/arm/src/stm32/stm32_pwm.c,
arch/arm/src/stm32h7/stm32_pwm.c,
arch/arm/src/stm32l4/stm32l4_pwm.c,
arch/renesas/src/rx65n/rx65n_usbdev.c,
binfmt/libnxflat/libnxflat_bind.c,
drivers/pipes/pipe_common.c,
net/igmp/igmp_input.c,
net/tcp/tcp_conn.c,
sched/sched/sched_roundrobin.c:

    * Fix typo in comment ("this this").

arch/arm/src/cxd56xx/cxd56_usbdev.c,
arch/arm/src/lc823450/lc823450_usbdev.c:

    * Fix typo in comment and rewrap lines.

arch/arm/src/imxrt/imxrt_usbdev.c,
arch/arm/src/stm32/stm32_dac.c,
arch/arm/src/stm32f0l0g0/stm32_pwm.c,
arch/arm/src/stm32f7/stm32_pwm.c,
arch/arm/src/tiva/lm/lm4f_gpio.h,
fs/nxffs/nxffs_write.c,
include/nuttx/analog/pga11x.h,
include/nuttx/usb/usbdev.h,
net/mld/mld_join.c:

    * Fix typo in comment ("this this").
    * Fix nxstyle issues.
2020-10-02 04:54:52 +02:00
Brennan Ashton
f41b9a10b3 ws2812: moved SPI_LOCK and forgot to change spi drv var name
This snuck in durring a slight PR fixup.
2020-09-28 08:25:43 +01:00
Xiang Xiao
650e18baa1 serial: Shouldn't mangle pid when ISIG is changed
Let's check ISIG flag directly instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I060f70eefc79b1c34aa11ed4071179d2ae5fa5ca
2020-09-25 06:48:26 -07:00
Alexander Vasiljev
834e584169 spi_xx25xx: in write operation return the number of bytes written not the result of ee25xx_semtake 2020-09-25 04:51:25 -07:00
Xiang Xiao
eacca2b7a2 wireless/bluetooth: replace open with file_open in uart shim drivers
it is simpler than open and then file_detach

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I22585b7450804c6c012fecf369a8d7e25970c192
2020-09-23 15:08:18 -03:00
Masayuki Ishikawa
89cfaf1e6a drivers: audio: Fix cxd56.c for SMP
Summary:
- Add spin_unlock_irqrestore to avoid deadlock
- Improve cxd56_resume() sequence
- Remove AUDIO_MSG_USER and call cxd56_stop_dma() for buffering
- Remove redandant 'Lock interrupt' and 'Unlock interrupt'

Impact:
- Affects all use cases with cxd56.c audio driver

Testing:
- Tested with spresense:rndis and spresense:rndis_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-09-23 10:45:29 +02:00
spiriou
65bb956e5e pipe: check for writers first in case of pipe empty 2020-09-21 19:30:21 -07:00
Brennan Ashton
5498f72fa5 input: Q10 BlackBerry Keyboard from Solder Party
This adds support for the Q10 BlackBerry based keyboard
from Solder Party. https://www.solder.party/docs/keyboard-pmod/

They keyboard device registered at /dev/kbdN is fully compatible
with hidkbd and has been testing with the Keyboard FeatherWing
on the nRF52 platform.

The buttons are added as a standard discrete joystick if
optionally enabled.  The PMOD variant of this does not
include these buttons, but the Keyboard FeatherWing does.
This joystick is usually defined at /dev/djoyN and
can be used with the djoy example application.

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-09-21 07:40:42 -06:00
chao.an
614ac5b0f2 libs/libc/unistd: Implement pipe2(2) syscall
See the reference here:
https://www.man7.org/linux/man-pages/man2/pipe2.2.html

Change-Id: Ife19b9bdbde73c7421be381a094da67017819e63
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-18 20:01:26 -07:00
chao.an
8f52d4536c timers/watchdog: configable keep alive interval
Change-Id: I519f5f9e0a8ab7ca298f834af20f7ad437ef92a4
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-18 19:58:29 -07:00
Augusto Fraga Giachero
f92e9641cd Fix coding style issues
Fix long lines pointed by nxstyle.
2020-09-18 07:03:09 -07:00
Augusto Fraga Giachero
1efbb4c114 Fix build errors when using DEBUGASSERT
I never tested these drivers with debug assertions enabled as I should
have. This commit fixes build errors due to wrong variable names used.
2020-09-18 07:03:09 -07:00
Brennan Ashton
7554eedf9a input: STMPE811 GPIO interrupt bug fixes
This patch resolves to bugs in the GPIO interrupt logic:

1. Any pins did not have STMPE811_GPIO_RISING in their pincfg
   would clear the rising edge interrupt enable flag for all
   pins due to a masking bug.

2. Pins would never trigger a second interrupt.  There is an
   undocumented requirement that you have to clear both the
   GPIO interrupt status register __and__ also the edge
   detection status register.  Failure to clear either of
   these will result in no further interrupts being triggered.
   This requirement exists both for edge and level modes of
   operation.

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-09-17 21:32:05 -07:00
Gregory Nutt
415d83cf19 STMPE811: Fix name collision in include/nuttx/input/stmpe811.h
The macro name GPIO_PIN collides with naming used by many architectures:

    $ find . -name "*.h" | xargs grep "define GPIO_PIN[(]"
    ./arch/arm/src/am335x/hardware/am335x_gpio.h:#define GPIO_PIN(n)              (1 << ((n) & 0x1f)) /* Bit n: Pin n, n=0-31 */
    ./arch/arm/src/imx6/hardware/imx_gpio.h:#define GPIO_PIN(n)              (1 << (n)) /* Bit n: Pin n, n=0-31 */
    ./arch/arm/src/imxrt/hardware/imxrt_gpio.h:#define GPIO_PIN(n)              (1 << (n)) /* Bit n: Pin n, n=0-31 */
    ./arch/arm/src/lpc43xx/hardware/lpc43_gpio.h:#define GPIO_PIN(p)                 (1 << (p)) /* Bits 0-31: Read/write pin state */
    ./arch/arm/src/nrf52/nrf52_gpio.h:#  define GPIO_PIN(n)           ((n) << GPIO_PIN_SHIFT)
    ./arch/arm/src/nuc1xx/hardware/nuc_gpio.h:#define GPIO_PIN(n)                (1 << (n)) /* Bit n: GPIOx Pin[n] pin value */
    ./arch/avr/src/at32uc3/at32uc3_gpio.h:#define GPIO_PIN(n)              (1 << (n))
    ./include/nuttx/input/stmpe811.h:#define GPIO_PIN(n)                  (1 << (n))

This commit changes the name used by the STMPE811 driver to STMPE11_GPIO_PIN
2020-09-17 12:10:29 -07:00
Brennan Ashton
204e84f1ad input: Add SPI mode for STMPE811 touch screen controller
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-09-17 08:34:41 -06:00
Masayuki Ishikawa
e53970583e drivers: wireless: Apply NET_LL_IEEE80211 to gs2200m.c
Summary:
- This commit applies NET_LL_IEEE80211 to gs2200m.c
- Also selects DRIVERS_IEEE80211 in Kconfig

Impact:
- Affects use cases with gs2200m driver

Testing:
- Tested with spresense:wifi and spresense:wifi_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-09-17 09:24:39 +02:00
Brennan Ashton
e2fd1fdd84 LED: Support for WS2812 led controller (aka Adafruit NeoPixel)
The WS2812 is very common in LED strips as it is an integrated
controller and LED. It is driven by a single data line, but
the timing requirements can be met by using most SPI controllers
and the use of DMA.

This driver has been validated on the nRF52 arch both with a
single LED and a strip of 144.

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-09-16 10:35:56 -07:00
Brennan Ashton
26395a6908 mmcsd: Allow setting ID mode frequency vi Kconfig
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-09-16 03:13:43 -07:00
Xiang Xiao
77ae03788a note: Rename note driver to noteram driver
to reflect this is just a normal note driver with ram buffer

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-15 14:55:22 +08:00
raiden00pl
493b0bf074 drivers/timers/pwm.c: add missing new lines to some debug messages 2020-09-13 10:57:11 -03:00
Xiang Xiao
0c3930ba11 sched: Rename note_add to sched_note_add
to better match other sched_note_* function

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-12 08:42:30 -07:00
Masayuki Ishikawa
58317b1430 drivers: wireless: Fix warnings in gs2200m.c
Summary:
- This commit fixes warnings when we remove noreturn from _assert()

Impact:
- Should have no impact

Testing:
- Tested with spresense:wifi

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-09-11 08:25:31 +02:00
David Sidrane
55b48b14eb mmcsd_sdio: Arm the write complete detection
The Multiblock write path was missing the
   the SDIO_WAITENABLE with SDIOWAIT_WRCOMPLETE.

   This could be seen with debugging turned on as

   mmcsd_eventwait: ERROR: Awakened with 10
   mmcsd_transferready: ERROR: mmcsd_eventwait for transfer ready failed: -5
2020-09-10 14:55:41 +01:00
Xiang Xiao
952af92690 sched/note: Move the circle buffer code to driver
so the format code can be shared by different transport

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-07 11:54:10 +08:00
Xiang Xiao
f99719e260 Move note driver from drivers/syslog to drivers/note
it's better to put the note transport layer into a common folder

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-07 11:54:10 +08:00
Xiang Xiao
8e8f41faeb drivers/timer: auto select the related option in Kconfig
to avoid the user make the wrong combination in defconfig

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-04 16:16:51 -03:00
Ouss4
c98ec2ad3e drivers/sensors/mpu60x0.c: Correct comments. 2020-09-01 18:18:24 -03:00
Xiang Xiao
62a840f992 drivers/rwbuffer: Should call rwb_wrflush in rwb_uninitialize
to avoid lose the cached data in the write buffer

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-29 02:57:36 -07:00
Xiang Xiao
a86a3d4d02 drivers/rwbuffer: Remove the redundant check in rwb_initialize
the same check already done before

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-29 02:57:36 -07:00
Xiang Xiao
73723dd31c drivers/rwbuffer: Avoid ftl driver allocate the temporary erase buffer
If the buffer to be flushed isn't multipled by the erase size,
let's pad the buffer proactively to avoid the allocation in ftl.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I6d7904aafab93a7886a594319d65826b81cd3cd1

3Change-Id: I88276149cc7826e7416929ca60b06314e96079a6
2020-08-29 02:57:36 -07:00
leomarradke
8a2c480a48 arch: samd5e5:
- Add MTD progmem support.
- NVM USER PAGE IOCTLs support.

boards: metro-m4  Add support for:

- SmartFS inicialization.
- AT24 EEPROM.
- GPIO dev support.
- BQ27426 gauge inicialization.

drives: power
- Add BQ27426 fuel gauge support.

Testing:
- Build check only.

Signed-off-by: Leomar Mateus Radke  <leomar@falker.com.br>
2020-08-27 11:46:50 -03:00
Masayuki Ishikawa
07b4b219cd drivers: wireless: Refactor gs2200m.c
Summary:
- Remove unnecessay code from gs2200m_irq()
- Fix irq control in case that work_available() returns false

Impact:
- All use cases with gs2200m driver

Testing:
- Tested with spresense:wifi

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-08-25 11:49:21 +02:00
Xiang Xiao
b5f429c88b Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
Xiang Xiao
ae356001cf Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
Johannes Schock
83f6c94209 telnet.c: td_offset had been uint8_t. TELNET_RXBUFFER_SIZE over 256 had been broken. 2020-08-19 04:44:03 -05:00
David Sidrane
e21dd68755 mmcsd_sdio:Fix breakage from 997d4 SD not functional
When CONFIG_MMCSD_MULTIBLOCK_DISABLE is lit, all SD
   read/write failed. The function return the number of
   blocks in `ret`, set on entry to nsectors. That was
   then wiped out by using the ret for the mmcsd_takesem.

   Since the code had many path setting return, the choices for
   the fix could have been add a new varaible or simple init it
   were used. I choose the latter.
2020-08-19 03:22:09 -05:00
chao.an
f97b8436b3 drivers/bch: flush the dirty sector to keep the sector sequence
flush the dirty sector to keep the sector sequence before ftl write

Change-Id: I1096cce39965806d5c877c2929b5a2ecdab27ac9
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-17 23:38:57 -05:00
chao.an
ed3cddb684 drivers/bch: delay the sector flush
Delay the sector flush to avoid multiple earse/write operations in sequence write

Change-Id: If4331b7fc8d2c2061325533212b28e826141b411
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-17 23:38:57 -05:00
Gregory Nutt
2af62314d7 Fix build breakage from PR #1565
Fixes:

    ##[error]net/tun.c:837:13: error: conflicting types for 'tun_poll_expiry'
      837 | static void tun_poll_expiry(FAR void *arg)
          |             ^~~~~~~~~~~~~~~
    net/tun.c:196:13: note: previous declaration of 'tun_poll_expiry' was here
      196 | static void tun_poll_expiry(wdparm_t arg);
          |             ^~~~~~~~~~~~~~~

And

    ##[error]net/tun.c:881:57: error: passing argument 4 of 'wd_start' makes integer from pointer without a cast [-Werror=int-conversion]
      881 |   wd_start(&priv->txpoll, TUN_WDDELAY, tun_poll_expiry, priv);
          |                                                         ^~~~
          |                                                         |
          |                                                         struct tun_device_s *
    In file included from /github/workspace/sources/nuttx/include/nuttx/sched.h:41,
                     from /github/workspace/sources/nuttx/include/sched.h:34,
                     from /github/workspace/sources/nuttx/include/nuttx/arch.h:81,
                     from net/tun.c:60:
    /github/workspace/sources/nuttx/include/nuttx/wdog.h:134:42: note: expected 'wdparm_t' {aka 'long unsigned int'} but argument is of type 'struct tun_device_s *'
      134 |              wdentry_t wdentry, wdparm_t arg);
          |                                 ~~~~~~~~~^~~

And

    chip/cxd56_rtc.c: In function 'up_rtc_initialize':
    ##[error]chip/cxd56_rtc.c:358:3: error: too many arguments to function 'cxd56_rtc_initialize'
      358 |   cxd56_rtc_initialize(1, NULL);
          |   ^~~~~~~~~~~~~~~~~~~~
    chip/cxd56_rtc.c:253:13: note: declared here
      253 | static void cxd56_rtc_initialize(wdparm_t arg)
          |             ^~~~~~~~~~~~~~~~~~~~
2020-08-14 14:12:51 -03:00
Xiang Xiao
acca9fcc3b sched/wdog: Remove MAX_WDOGPARMS and related stuff
since the variable arguments are error prone and seldom used.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-14 08:19:50 -06:00
Ouss4
ccf7154f05 drivers: Add the configuration option to select a board specific folder. 2020-08-13 03:48:17 -05:00
Xiang Xiao
ed786986ed sensors/ak09912: Ensure ak09912_dev_s zero in ak09912_register
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-12 08:27:19 -03:00
Xiang Xiao
61ea875c94 Fix build break introduced by commit a0ce81d659
sam_ili9488.c:1605:7: error: label 'errout_with_dmadog' used but not defined
bcmf_sdio.c:855:16: error: passing argument 1 of 'wd_start' from incompatible pointer type

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-12 02:11:56 -07:00
Xiang Xiao
ae94688dc4 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-11 12:28:55 -06:00
Xiang Xiao
a0ce81d659 sched/wdog: Don't dynamically allocate wdog_s
to save the preserved space(1KB) and also avoid the heap overhead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I694073f68e1bd63960cedeea1ddec441437be025
2020-08-11 12:28:55 -06:00
zhongan
2818b6b2c0 drivers/rptun: Add 'RPTUN_CONFIG' interface.
Change-Id: I1c6177ffe0c49c385f0d784b1ff0dbb69b6432f8
Signed-off-by: zhongan <zhongan@xiaomi.com>
2020-08-11 15:58:27 +01:00
Masayuki Ishikawa
a104490b00 drivers: wireless: Add retry sequence in gs2200m_send_cmd()
Summary:
- This commit is a workaround to avoid errors in gs2200m_send_cmd()
- See the actual sequence in Testing for details

Impact:
- gs2200m driver

Testing:
- Test with spresense:wifi
- 1-1 Run tcpclient on NuttX and run nc on Linux
- 1-2 Stop nc on Linux then tcpclient also stops
- 1-3 Run tcpclient then the first AT+NCTCP will fail
- 1-4 But the second AT+NCTCP will succeed
- 2-1 Run tcpclient on NuttX and run nc on Linux
- 2-2 Stop nc on Linux then tcpclient also stops
- 2-3 Run tcpserver then the first AT+NSTCP will fail
- 2-4 But the second AT+NSTCP will succeed

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-08-11 01:25:40 -05:00
Huang Qi
fd78f83e02 drivers/video: Refine the update region notification mechanism
1.Expose the notification through fb_vtable_s::updatearea
2.Incorporate old nx_notify_rectangle into the new updatearea callback
3.Migrate the calle of nx_notify_rectangle to fb_vtable_s::updatearea

Change-Id: Ia3d1f73e8757b2d381586d76ec6adc16c810018d
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-08-10 08:08:33 +02:00
Johannes Schock
662e6789ea Added another usbid with proto = 1 (HighSpeed Hub). Nxstyle fixes. 2020-08-09 16:12:18 -03:00
Johannes Schock
2a11ad520b usbhost_storage.c: Fixed Bug in usbhost_freedevno(...), worked only for 'a'. 2020-08-09 11:54:04 -06:00
Johannes Schock
02a9228c1f Added USB MSC state change notifier in notifier work queue.
Added USB MSC automount for Freedom K28 using the above.
2020-08-09 11:54:04 -06:00
Xiang Xiao
f618de9c97 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
Xiang Xiao
4c706771c3 sched/wdog: Replace all callback argument from uint32_t to wdparm_t
and alwasy cast the argument of wd_start to wdparm_t

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
Masayuki Ishikawa
3b76666a1e drivers: usbdev: Fix default value for RNDIS_NWRREQS
Summary:
- Change default value for RNDIS_NWRREQS based on NET_TCP_WRITE_BUFFERS

Impact:
- This commit affects RNDIS use cases

Testing:
- spresense:rndis with CONFIG_NET_TCP_WRITE_BUFFERS=y

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-08-08 05:36:07 -05:00
Gregory Nutt
188d4b0fb4 user-space memalign() must not be called from within the OS.
drivers/net/ftmac100.c, libs/libc/stdlib/lib_aligned_alloc.c

A continuation of PRs #1507, #1510, and #1512.  See Issue #1481 for additional information.
2020-08-04 22:45:47 +01:00
Gregory Nutt
d09f6aaa72 Correct more improper use of malloc(), zalloc(), and free()
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));
2020-08-04 20:41:43 +01:00
Gregory Nutt
2dae970ec6 Fix cases where memory is allocated using malloc()
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().
2020-08-04 20:40:57 +01:00
Gregory Nutt
3cad9f498f drivers/mkrd.c
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).
2020-08-04 13:00:53 -05:00
YAMAMOTO Takashi
123a31e3a2 drivers/usbhost/hid_parser.c: nxstyle fixes 2020-08-03 22:52:31 -05:00
YAMAMOTO Takashi
59ba52aee8 drivers/usbhost/hid_parser.c: Fix out of range array accesses
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.
2020-08-03 22:52:31 -05:00
SPRESENSE
15be5e5e11 drivers/video: Store device operations table
Fix a bug which the device operation structure is not stored in
video_initialize().
2020-07-31 09:37:20 +02:00
SPRESENSE
3befe16f52 drivers/video: Support JPEG format in VIDEO_CAPTURE
Add support for the VIDEO stream with JPEG frames supported by ISX012.
2020-07-31 09:37:20 +02:00
YAMAMOTO Takashi
1a669e09cd drivers/syslog/syslog_write.c: nxstyle fix 2020-07-29 21:13:20 -07:00
YAMAMOTO Takashi
9274b67a45 syslog_default_write: Fix the return value
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.
2020-07-29 21:13:20 -07:00
Masayuki Ishikawa
8a7ecf0858 drivers: wireless: Fix null pointer dereference in gs2200m.c
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>
2020-07-28 23:02:20 -05:00
SPRESENSE
27835c8c0a ramlog: Add overwrite option to ramlog
Enable overwrite of circular buffer. If RAMLOG buffer overflows,
overwrite it from the top of buffer and always keep the latest log.
2020-07-28 04:00:18 -05:00
SPRESENSE
e249a2f82f Makefile: Fix Make.dep not updated by config changes
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.
2020-07-28 03:59:45 -05:00
SPRESENSE
d560ce65ff cxd56xx: spresense: Add some improvements and fix bugs for Spresense board
- 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
2020-07-28 09:13:05 +02:00
SPRESENSE
500ead8101 drivers/modem/altair: Update altair modem driver
- 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
2020-07-28 09:09:18 +02:00
Masayuki Ishikawa
b6218c67f8 drivers: audio: Replace license header with Apache License 2.0
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-28 00:47:39 -05:00
Johanne Schock
8792ade0fe Several USB improvements.
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
2020-07-24 13:24:53 -03:00
Xiang Xiao
a5ef3731b1 drivers/video: fb_read/fb_write need consider the current file position
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id3a475dac928ed3dff4eee96150badadf5210f44
2020-07-24 10:49:37 +02:00
Xiang Xiao
f044c82dae drivers/lcd: Remove the redundant LCD_HWCURSOR
reuse FB_HWCURSOR instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I568104a87b9c08308374a9723c248287332bc9e4
2020-07-24 10:47:02 +02:00
Xiang Xiao
da6bb94740 drivers/lcd: Don't select NX_LCDDRIVER automatically
since graphics/Kconfig already do the similar thing

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib2c1955a6b027cfa4e83c3b81ddfb505902dd85d
2020-07-24 10:47:02 +02:00
Xiang Xiao
131535dfe4 drivers/lcd: Fix the memory leak when board_graphics_setup fail
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I08a7ecc48b2c28b1c8c97f74e7a163ca67de6fca
2020-07-23 13:05:58 +01:00
SPRESENSE
e4b50c4ba0 drivers/mmcsd: Fix minor bugs
- 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.
2020-07-22 09:51:54 -05:00
Xiang Xiao
e1ecb3e27c libc: Don't define localtime[_r] to macro when CONFIG_LIBC_LOCALTIME not define
since libc++ declare these function in ctime by:
using ::localtime[_r];

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic0bb68b44c0cab838ab7cc34baee2aaa3ca8a9b5
2020-07-19 19:35:21 -07:00
Masayuki Ishikawa
0475540c83 drivers: wireless: Add 'select SCHED_LPWORK' to WL_GS2200M
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-19 21:11:46 -05:00
Xiang Xiao
aa57174eb9 rwbuffer: Optimize the buffer algorithm
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>
2020-07-19 13:13:50 -07:00
Xiang Xiao
e7034c102f rwbuffer: Fix the wrong remaining block calculation in invalidation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I00e6e7332f397bcddfd44e1b3c5c514a8f07923f
2020-07-19 13:13:50 -07:00
Masayuki Ishikawa
f5540e8922 drivers: wireless: Fix compile error with DEBUG_WIRELESS_INFO in gs2200m.c
Also, remove an inappropriate comment.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-17 11:59:27 +01:00
Adam Feuer
65a866fbe2 support for SAMA5D27 SDMMC peripheral
- MMC and SD Card driver
- ported from imxrt_usdhc.c

Squashed commit of the following:

commit 46cbe18ad6a6e41ec2727d839f86f5670577878a
Author: Adam Feuer <adam@starcat.io>
Date:   Wed Jul 15 10:28:02 2020 -0700

    nxstyle change - Public Function Prototypes

    - instead of Public Functions

commit 486b7b62e83a78ae15b114e34846900d8fef8248
Author: Adam Feuer <adam@starcat.io>
Date:   Wed Jul 15 10:06:51 2020 -0700

    nxstyle changes

commit 28280d585a40aac99fd0e538295828ea013739b7
Author: Adam Feuer <adam@starcat.io>
Date:   Wed Jul 15 10:06:29 2020 -0700

    removing unused enum value

commit 7da6ba437e7e023d348e63c497732fea985a2d1b
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 21:17:49 2020 -0700

    CI build error fixes

    - unused vars
    - incorrect method calls

commit 145a73449b9d1eaed8a6cbf47cb53fb5b7a551f6
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 17:29:56 2020 -0700

    adding #defines to prevent unused var warning

commit 47ed2c08235816caded26a019cf33899daed1621
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 16:29:07 2020 -0700

    removing obsolete config values

commit b43f129c03a8bb8dc57ae6984d124ce9e9306196
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 09:58:42 2020 -0700

    removed obsolete config setting

commit 23e3af846ac24cac928442c7af86c5d0ef183ad3
Merge: 8b47330fe5 6f6d61eec4
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 09:53:12 2020 -0700

    Merge remote-tracking branch 'upstream/master' into feature/sama5d27-sdmmc-support

commit 8b47330fe5bb49bbd1991f2f3e2c69bdfb833d2c
Author: Adam Feuer <adam@starcat.io>
Date:   Tue Jul 14 09:51:56 2020 -0700

    replaced license headers with Apache License 2.0

commit 865e69b9a84d077ab9e05c2056dc7a515222c6c7
Author: Adam Feuer <adam@starcat.io>
Date:   Thu Jul 9 18:38:01 2020 -0700

    SAMA5D2x SDMMC peripheral support (SD Card driver)

    - reading and writing at 25 MHz and 50Mhz
    - UHS_SDR50, UHS_DDR50, and UHS_SDR104 are supported
    - ported from imxrt_usdhc.c
    - only tested on SAMA5D27

    Squashed commit of the following:

    commit e3122baef2feaeb32bb00798ae56310b2cc5c448
    Author: Adam Feuer <adam@starcat.io>
    Date:   Thu Jul 9 18:30:03 2020 -0700

        added sdmmcnsh defconfig and basic docs

    commit 12a290d7465a0a006473ba67893bf891a7bcea83
    Author: Adam Feuer <adam@starcat.io>
    Date:   Thu Jul 9 17:50:06 2020 -0700

        nxstyle changes

    commit 33409c0f63c328dc200150ba883327cadf0300b2
    Author: Adam Feuer <adam@starcat.io>
    Date:   Thu Jul 9 16:15:00 2020 -0700

        add short delay to in recvshortcrc

        - to allow SDMMC to respond

    commit 3be7a7fb6f79900042d1fdbef72810f364ac5f62
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Thu Jul 9 10:54:59 2020 -0700

        added SDR50 and SDR104 SDMMC bus modes

    commit 2888408866548ca53e582ea1525178a7733617b4
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Thu Jul 9 10:54:25 2020 -0700

        comment formatting cleanup

    commit 06cf2c39193971155eaa6f9c89a39a88b53964a8
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Thu Jul 9 10:34:01 2020 -0700

        removed unneeded comment

    commit ac89b69231bdf19563754865fda93d4bbbb4488d
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Thu Jul 9 10:30:23 2020 -0700

        code cleanup

        - removing custinfo() logging
        - remove duplicate #defines
        - move var declarations to the beginning of methods

    commit bcd4abec7935ee9023ab72edfb02685dbeee243c
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Wed Jul 8 16:34:31 2020 -0700

        handle SDMA Boundary Pause interrupt (DMAINT)

        - SDMMC_INT_DINT
        - add to waitints
        - add handler to sam_interrupt

    commit e9da026c1270e999df520ee2c60487195799f58c
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Tue Jul 7 16:07:34 2020 -0700

        Kconfig setting for SDMMC bus speed

        - 25 and 50 MHz
        - 50 MHz is the default

    commit 9edc636b7f18f981d653f85970c3af0b80801778
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Mon Jul 6 21:55:51 2020 -0700

        added HSEN bit change for high speed mode

        - above 26 MHz

    commit b8e91c95b0f7b2f8220f02b1eb42b6134e0660d0
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Mon Jul 6 21:28:03 2020 -0700

        added calloc to fix bug

        - not sure why this works.

    commit 1ceaf2f8487fe39d4d6fb21adecd57e4c4992e07
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Mon Jul 6 21:25:47 2020 -0700

        removing spurious typo characters

    commit 14ba51743bcca35686b07a76f5af17bcce078a5f
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 18:10:46 2020 -0700

        nxstyle changes

    commit d8af26df47b7840117de0d3a44ec548b3a72bc2b
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 17:01:11 2020 -0700

        nxstyle changes

    commit 0ae532bd62d02c5ac36aa2192f31fa1f7f1cde99
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 16:37:17 2020 -0700

        remove long lines in comments - nxstyle

    commit 3d025a84f8e9ddb7f7a4570504118d782dd5574c
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 16:36:52 2020 -0700

        removed custinfo logging

    commit 366b5d9d241a42d693583679cb49aa7bf25615aa
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 16:35:08 2020 -0700

        removed custinfo logging

    commit c74396e4a4943873c7de5b6ffee193787c39baef
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 16:34:36 2020 -0700

        fixed typo

    commit 7f51e99d7f4c1e5e0bf71a84fd0b2467157fea59
    Merge: c40f8c1039 2481b1bfd5
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Sat Jul 4 15:33:06 2020 -0700

        Merge remote-tracking branch 'upstream/master' into feature/sama5d27-sdmmc-support

    commit c40f8c10390ecefeb3a113046edd6740b07ab31b
    Author: Adam Feuer <adam@adamfeuer.com>
    Date:   Thu Jul 2 22:08:20 2020 -0700

        SDMMC support for SAMA5D27
2020-07-16 23:39:37 +01:00
Oleg Evseev
b6ed3392a4 drivers/can: base readers checks on cd_readers list itself
Get rid of several useless dev vars
2020-07-11 15:06:56 -03:00
Oleg Evseev
06a5b1f566 drivers/can: fix tx_sem and rx_sem to be SEM_PRIO_NONE
issue 1354
2020-07-11 15:06:56 -03:00
Anthony Merlino
731594b7d2 drivers/eeprom/spi_xx25xx: Fixes build error. 2020-07-10 12:13:22 -07:00
Beat Küng
a349595316 gpio: extend gpio_pintype_e for pulldown/up and opendrain
- fix code style
- fix bool conversion when calling go_read()
2020-07-07 08:34:25 -05:00
Oleg Evseev
1798383a2d drivers/can: correct checking sem is locked
Object filled by nxsem_get_value can be zero or a negative number
fix for 190782c2959de2b28867022941e52f429d5d07fb

issue #1354
2020-07-06 09:53:22 -03:00
Oleg Evseev
908ee31e7d drivers/can: enter_critical_section in can_poll 2020-07-05 14:38:55 -03:00
Oleg Evseev
247bc10c26 drivers/can: fix wrong use of nxsem_getvalue
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
2020-07-05 14:38:55 -03:00
Claudio Micheli
7a346bee26 stm32f7: Add the option to include RTR in CAN header
Signed-off-by: Claudio Micheli <claudio@auterion.com>
2020-06-29 09:05:44 -03:00
Xiang Xiao
095e492cb3 libc: Replace nuttx/lib/math.h with math.h
Because user may replace math library with other implementation

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idb5f2a8b2a70302c8561553b3bcbc40529b5257f
2020-06-29 06:32:10 +02:00
Matias Nitsche
b3327419d3 tone: stop tone using 0 duty, not stop() 2020-06-25 11:04:14 +01:00
Matias Nitsche
10a9464bcf tone: start playing tune immediately without delay 2020-06-25 11:04:14 +01:00
Ouss4
701100f6f9 drivers/sensors/mpu60x0: Add I2C support. 2020-06-24 23:30:34 -03:00