Commit Graph

3626 Commits

Author SHA1 Message Date
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