Commit Graph

574 Commits

Author SHA1 Message Date
Xiang Xiao
5b2a17b892 Include assert.h in necessary place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-08 13:06:08 -07:00
Xiang Xiao
2e54df0f35 Don't include assert.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-03 08:36:03 -07:00
Masayuki Ishikawa
ab7ceb26e0 drivers: wireless: Remove ASSERT() in _check_pkt_q_empty() in gs2200m.c
Summary:
- During Wi-Fi stress test, sometimes ASSERT() happens in gs2200m.c
- This commit removes the ASSERT() but calls _remove_all_pkt()
  for a workaround.

Impact:
- None

Testing:
- Tested with spresense:wifi_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-05-31 21:27:28 -05:00
Xiang Xiao
d7f96003cf Don't include debug.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 06:42:02 +09:00
chao.an
6c69b12000 wireless/bluetooth: decoupling bt_driver_s and bt_buf_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-31 09:50:54 -03:00
Alin Jerpelea
13e4f9b6b2 drivers: update licenses to Apache
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-05-31 02:58:08 -05:00
Xiang Xiao
001e7c3e76 sched: Don't include nuttx/sched.h inside sched.h
But let nuttx/sched.h include sched.h instead to
avoid expose nuttx kernel API to userspace.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 12:11:53 +09:00
Masayuki Ishikawa
97e6d35c3a drivers: wireless: Fix AT command response handling in gs2200m.c
Summary:
- When sending an AT command during receiving a bulk packet,
  the bulk packet might be put in the AT command response.
- To handle such the case, gs2200m_send_cmd2() is newly
  introduced instead of using gs2200m_send_cmd(dev, cmd, NULL)

Impact:
- All use cases that send an AT command in gs2200m.c

Testing:
- Tested with renew and nxplayer with spresense:wifi

Reported-by: Masatoshi Ueno <Masatoshi.Ueno@sony.com>
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-04-15 21:28:25 -05:00
Masayuki Ishikawa
fa5daea3d9 drivers: wireless: Fix to receive a UDP packet partially in gs2200m.c
Summary:
- When receiving a UDP packet partially, the rest of the packet
  must be discarded.

Impact:
- None

Testing:
- Tested with a UDP sample program

Reported-by: Masatoshi Ueno <Masatoshi.Ueno@sony.com>
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-04-13 10:37:15 -05:00
Xiang Xiao
3f9908f7d1 Remove the unnecessary math.h inclusion
or move from header file to source file since math.h doesn't always exist

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-04-12 22:58:23 -04:00
Anthony Merlino
b21cb3308a Fixes race condition in event wait logic of SDMMC driver.
This change makes it so that the timeout is set as part of the SDIO_WAITENABLE call instead of the SDIO_EVENTWAIT call. By doing so, you eliminate all opportunity for a race condition.

stm32h7:sdmmc Check if busy ended early
2021-04-05 23:08:45 -05:00
Alin Jerpelea
e1d361eddf drivers: nxstyle fixes
Fixes for errors reported by nxstyle

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-05 07:31:45 -05:00
Alin Jerpelea
0fc329d814 driver: Ales Verbic: update licenses to Apache
Ales Verbic has submitted the ICLA and we can migrate the licenses
 to Apache.

Uros Platise has submitted the ICLA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-05 06:13:17 -05:00
Xiang Xiao
5f3a98b5a8 libc/assert: Reference the expression in all case
to avoid the warning "defined but not used"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I55b7c092d0f2e5882fc1784987657c10cdf2d90b
2021-04-03 21:00:41 +01:00
Alin Jerpelea
08e5378b11 NuttX: Gregory Nutt: update licenses to Apache
Several licenses were missed in the initial work

David Sidrane has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-03 04:20:31 -07:00
Alin Jerpelea
d2c4d4c543 drivers: wireless: fix Mixed Case errors
Fix Mixed Case errors reported by nxstyle

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-01 12:13:12 -05:00
Alin Jerpelea
7a29e1f5fb drivers: Nxstyle fixes
Nxstyle fixes to pass CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-01 12:13:12 -05:00
Alin Jerpelea
190582c764 boards: stm32: Laurent Latil: update licenses to Apache
Laurent Latil has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-01 12:13:12 -05:00
Alin Jerpelea
b4a33b5ec0 NuttX: Uros Platise: update licenses to Apache
Uros Platise has submitted the ICLA and we can migrate the licenses
 to Apache.

David Sidrane has submitted the ICLA and we can migrate the licenses
 to Apache.

Bob Feretich has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-01 12:13:12 -05:00
Alin Jerpelea
0abc1017ab drivers: nxstyle fixes
nxstyle fixes to pass CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-20 19:22:58 -07:00
Alin Jerpelea
c798076084 drivers: Author Sebastien Lorquet: update licenses to Apache
Sebastien Lorquet has submitted the ICL and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-20 19:22:58 -07:00
Gustavo Henrique Nihei
330eff36d7 sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
Gustavo Henrique Nihei
47cb41c92f makefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
Alin Jerpelea
ccff570e6f drivers: nxstyle fixes
nxstyle fixes to pass the CI.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-04 18:32:27 -08:00
Alin Jerpelea
e5b6305f4a drivers: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-04 18:32:27 -08:00
Gustavo Henrique Nihei
c76e201ebd drivers/i2s: Fix nxstyle issues 2021-02-25 18:57:18 -08:00
Gustavo Henrique Nihei
55d66f60a3 drivers: Fix typos reported by codespell 2021-02-25 18:57:18 -08:00
Masayuki Ishikawa
d87f350831 arch, boards, drivers, include, sched, wireless: Change spinlock APIs.
Summary:
- This commit changes spinlock APIs (spin_lock_irqsave/spin_unlock_irqrestore)
- In the previous implementation, the global spinlock (i.e. g_irq_spin) was used.
- This commit allows to use caller specific spinlock but also supports to use
  g_irq_spin for backword compatibility (In this case, NULL must be specified)

Impact:
- None

Testing:
- Tested with the following configurations
- spresnse:wifi, spresense:wifi_smp
- esp32-devkitc:smp (QEMU), sabre6-quad:smp (QEMU)
- maxi-bit:smp (QEMU), sim:smp
- stm32f4discovery:wifi

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-02-07 21:28:56 -08:00
Masayuki Ishikawa
0c68ddb760 drivers: wireless: Change retry condition in gs2200m_hal_write()
Summary:
- During Wi-Fi stress test, I noticed that ASSERT() happened
  in gs2200m_hal_write(). Actually, this happens in 20-40 hours.
- In this case, resp[1] was always 0x0 which is not defined
  in the spec.
- In the previous implementation, retry was only done in case of
  WR_RESP_NOK. (0x13)
- This commit changes this condition and it reties in case of
  0x0 as well

Impact:
- gs2200m driver

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

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-02-03 10:29:05 +01:00
Masayuki Ishikawa
c6ed7dd760 drivers: wireless: Fix _read_data() in gs2200m.c
Summary:
- During reviewing the GS2200M document, I noticed that
   _read_data() implementation is incorrect.
- Actually, we do not use "SPI Byte Stuffing for SPI-NO-DMA"
  but use "SPI Command Response (SPI-DMA)", so the sequence
  should use SPI_RECVBLOCK().

Impact:
- gs2200m.c only

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

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-01-25 19:13:17 -08:00
Masayuki Ishikawa
8a72ab1a50 drivers: wireless: Print error massages with wlerr() in gs2200m.c
Summary:
- I noticed that some error messages are printed with wlinfo()
- This commit prints such error messages with wlerr()

Impact:
- No impact

Testing:
- Tested with spresense:wifi
- NOTE: CONFIG_DEBUG_WIRELESS_ERROR must be enabled

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-01-24 20:03:53 -08:00
Masayuki Ishikawa
11a842333f drivers: wireless: Fix ASSERT() in _read_data_len() in gs2200m.c
Summary:
- During stress test with spresense:wifi (non-SMP), I noticed
  sometimes ASSERT() happened in _read_data_len()
- Actually, up_udelay(50) has been added to avoid the ASSERT
- However, I finally noticed that it should be moved before
  calling dready()
- Also, I cofirmed that we can reduced the time from 50 to 30
- NOTE: we need at least 15us in my experience

Impact:
- gs2200m.c only

Testing:
- Tested with following configurations
- spresense:wifi, spresense:wifi_smp, stm32f4discovery:wifi

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-01-17 21:43:23 -08:00
Xiang Xiao
7df322c6be bluetooth: Move the lower half null check to common place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-17 20:49:19 -08:00
Xiang Xiao
9103184722 bluetooth: Rename *bt_uart_shim_getdevice to btuart_shim_getdevice
follow other bluetooth driver convention(e.g. btuart_register)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-17 20:49:19 -08:00
chao.an
c8a6f31a33 wireless/bluetooth: move H4_* definition to external
Reference the define from board or arch driver

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-16 11:18:26 -08:00
chao.an
f308ac1583 wireless/bluetooth: add more hci event definitions
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-16 11:18:26 -08:00
chao.an
605cd77a23 wireless/bluetooth: remove the host dependency
HCI driver should not depend on the bluetooth host

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-16 11:18:26 -08:00
Xiang Xiao
0536953ded Kernel module should prefer functions with nx/kmm prefix
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 08:57:58 +01:00
Xiang Xiao
d9b1cb3d27 bluetooth: BLUETOOTH_BCM4343X shouldn't select BLUETOOTH_UART_SHIM
since bcm4343x bluetooth driver doesn't depend on uart shim driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-29 18:11:21 -08:00
Xiang Xiao
753cb6c22b bluetooth: Remove BLUETOOTH_UART_BT860 from Kconfig
it isn't difference from BLUETOOTH_UART_OTHER, so let's use the later instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-29 18:11:21 -08:00
Xiang Xiao
c612c068e1 bt_uart_shim: Setup pollfd with file* correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 10:38:42 +01:00
Xiang Xiao
c258fe0f85 bt_uart_shim: Make CONFIG_SERIAL_TERMIOS optional
since the caller don't always need to use setbaud callback

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 10:38:42 +01:00
Xiang Xiao
9f463fd3da bt_uart_shim: Remove g_lowerstatic static variable
let's initialize the callback directly to save the memory

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 10:38:42 +01:00
Xiang Xiao
8ce2d376cc bt_uart_shim: Don't hardcode the thread stack size
so let's change 1024 to CONFIG_DEFAULT_TASKSIZE

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 10:38:42 +01:00
Xiang Xiao
c0cd125bf3 bt_uart_shim: Support the multiple instances
by removing the global variables(g_n)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 10:38:42 +01:00
Xiang Xiao
aec3220fae bt_uart_shim: Correct the prototype of bt_uart_shim_getdevice
1.Add const to the path argument
2.Return the explicit type(struct btuart_lowerhalf_s *)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 10:38:42 +01:00
Xiang Xiao
d85cf99a65 bt_uart: Retry the lower half operation if -EINTR is returned
to handle the partial write and read gracefully

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 10:38:03 +01:00
Xiang Xiao
1d8397a36d bt_uart: Don't call rxdrain in the successful path
because the physical uart bus may receive the next packet asynchronously

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 10:38:03 +01:00
Xiang Xiao
ca5d8d8660 bt_uart: Fix the minor typo in bt_uart driver
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 10:38:03 +01:00
Xiang Xiao
6a30d7ad6b bt_uart: Remove static variables in btuart_rxwork
to support mulitple bluetooth controllers

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 10:38:03 +01:00