Commit Graph

151 Commits

Author SHA1 Message Date
Xiang Xiao 2e91c07ca7 Remove the back slash from long literal string
since the back slash is only needed for the long macro definition

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-19 16:43:15 +01:00
Lwazi Dube 2dac5e1b6a bluetooth: Prevent btsak from repeatedly showing the same error. 2024-01-14 02:16:48 -08:00
Tiago Medicci Serrano fe156a40e3 wireless/bluetooth: Add option to set the HCI TX thread affinity
By enabling the config `CONFIG_BLUETOOTH_TXCMD_PINNED_TO_CORE` and
setting the value of `CONFIG_BLUETOOTH_TXCMD_CORE`, it's possible
to pin the HCI TX thread to a specific core on a SMP-enabled setup.
This is necessary for devices that require that the function that
sends data (`bt_send`) to be called from a specific core.
2023-10-24 22:41:44 +08:00
wanggang26 c3ccc30f83 wireless: enable O_CLOEXEC explicit
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-09-19 09:36:59 +08:00
chao an 5026a96cfa nxstyle: cleanup UTF-8 Unicode to ASCII
Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-18 11:54:17 -04:00
chao an 21d2cc741f wireless/bluetooth: correct judgment conditions
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-07 03:34:00 -07:00
raiden00pl 52d67a85d0 cmake: add missing bt_services.c 2023-07-10 22:24:44 +08:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Lwazi Dube a720984eb7 wireless/bluetooth: Add a generic access service.
Make NuttX peripheral visible to BLE apps.
2023-06-05 15:00:23 -03:00
chao an 589d4a9f8e net/semantic/parser: fix compile warning found by sparse
Reference:
https://linux.die.net/man/1/sparse

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-30 23:00:00 +08:00
Petro Karashchenko 1be4066b3c wireless/bluetooth: fix style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
Lwazi Dube 16fc1b47b9 wireless/bluetooth: Support removable bluetooth modules.
This bluetooth stack remains in an inconsistent state when
the bluetooth HCI module is removed. This change adds a
bt_netdev_unregister function that can be used to clean up
after a module is removed. Some global variables are also
set to their default values.
2023-05-07 15:03:01 +08:00
Lwazi Dube 0356d1403d wireless/bluetooth: Initialize private bt_driver_s member. 2023-04-30 00:41:22 +08:00
Petro Karashchenko 756e244b18 wireless/bluetooth: fix double buffer free
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-04-24 09:35:58 -07:00
chao an 3a0fdb019d nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:05:44 +08:00
Xiang Xiao d5689e070b net/arp: Remove nuttx/net/arp.h
1.move ARPHRD_ETHER to netinet/arp.h
1.move arp_entry_s to net/arp/arp.h
2.move arp_input to nuttx/net/netdev.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-16 22:10:59 +02:00
chao an b5507ea9a2 compile/attribute: minor fix for packed struct mismatch
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-06 03:50:20 +08:00
chao an 3e1c73f8c9 wireless/bluetooth: destroy nxsem properly 2022-11-21 01:15:48 +08:00
anjiahao a4563b8744 Fix the coding style and typo issue
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-14 09:34:04 +09:00
anjiahao d07792a343 Initialize global mutext/sem by NXMUTEX_INITIALIZER and SEM_INITIALIZER
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-14 09:34:04 +09:00
yinshengkai 85f727f232 tools: replace INCDIR to Makefile variable
In the past, header file paths were generated by the incdir command
Now they are generated by concatenating environment variables

In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
anjiahao e1ca516488 use SEM_INITIALIZER inside of NXSEM_INITIALIZER
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
anjiahao 5724c6b2e4 sem:remove sem default protocl
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
anjiahao d1d46335df Replace nxsem API when used as a lock with nxmutex API
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Xiang Xiao ba9486de4a iob: Remove iob_user_e enum and related code
since it is impossible to track producer and consumer
correctly if TCP/IP stack pass IOB directly to netdev

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-15 08:41:20 +03:00
larry ab33519b1b bluetooth: fix net lock imbalance in drop casse
Signed-off-by: larry <larry@transtekcorp.com>
2022-08-04 23:23:01 +08:00
Sergey Nikitenko 2421a591a5 bluetooth: fixing bt_buf addref/release balance 2022-07-26 16:01:07 +08:00
zhanghongyu 035d925864 devif: remove all devif_timer
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-06-02 20:11:50 -03:00
Xiang Xiao 1fb8c13e5e Replace nxsem_timedwait_uninterruptible with nxsem_tickwait_uninterruptible
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-15 13:55:58 +03:00
Petro Karashchenko 68902d8732 pid_t: unify usage of special task IDs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-22 21:22:32 +08:00
chao.an ef2097e439 wireless/bluetooth: fix build break if NET_6LOWPAN enabled
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-07 18:26:55 +08:00
Petro Karashchenko 3ccb657dc2 nuttx: remove space befone newline in logs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-27 21:01:19 -06:00
raiden00pl 5ac469441e wireless/bluetooth/bt_hcicore.c: allocated recv buffer must reserve BLUETOOTH_H4_HDRLEN for head
This was broken since 6c69b12000.
The first byte in io_data buffer must be the BT H4 packet type.
Without this change an assertion in bt_netdev.c:535 is always raised and nimble host layer crash.
2021-12-18 09:11:29 -06:00
Petro Karashchenko 51a2db6ffc Kconfig: improve uniformity
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-14 07:32:48 -06:00
Alin Jerpelea a09a9524b4 wireless: bluetooth: revert to the original license
Those files are ported from the Intel/Zephyr
arduino101_firmware_source-v1.tar package
where the code was released with a compatible 3-clause BSD license

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-09-01 11:56:31 +08:00
Alin Jerpelea 29bfbf8769 License: add Bluetooth LE support to the license guard
If ALLOW_BSD_COMPONENTS is not enabled in the license setup,
Bluetooth LE support will be disabled

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-08-27 02:56:22 +08: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
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
Nathan Hartman f61214cc0d mqueue, btqueue: Fix some typos (e.g., essage -> message)
include/nuttx/mqueue.h:
sched/mqueue/mq_msgqfree.c:
wireless/bluetooth/bt_queue.c:

    * Fix typos in comments only. No functional changes.
2021-05-25 07:39:24 +09: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
Gustavo Henrique Nihei 330eff36d7 sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
Gustavo Henrique Nihei 76acb32e29 Fix typos reported by codespell 2021-02-25 11:31:49 -08:00
Alin Jerpelea f59814e7d7 wireless: 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-02-19 08:07:47 -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
Matias N 45b392be7e nRF52: add support for building SoftDevice BLE controller 2021-02-02 14:40:26 -08:00
ligd f63db66382 mqueue: add file_mq_xx for kernel use
Change-Id: Ida12f5938388cca2f233a4cde90277a218033645
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-05 02:40:43 -06:00
Xiang Xiao d75895586a bluetooth: Don't call BT_LE162HOST in bt_buf_get_le16
since BT_GETUINT16 alredy convert the value to the little endian

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 08:50:16 +01:00
Xiang Xiao 5c0d430b99 bluetooth: replace leave_critical_section with spin_unlock_irqrestore
since the resouce in bt_buf is protected by spin_lock_irqresave

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 08:50:16 +01:00
Xiang Xiao d1dc0bf848 bluetooth: Fix typos in comment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-28 08:50:16 +01:00