Skip to content

Commit ae419af

Browse files
author
ganghe
committed
[int][bug][zbt] Fix k_poll_signal issue, add crc32_sw, ead and random support.
Project: Bluetooth redmine: #5146, REDMINE-id ext-redmine: bug|feat#id [Description in detail] Affected branch: [master] Change-Id: If736d8e605c3322eb2c8dd5671ab3a5e96ad2791
1 parent 7b116ec commit ae419af

File tree

10 files changed

+551
-5
lines changed

10 files changed

+551
-5
lines changed

zephyr_bt/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ rsource "Kconfig.iso"
240240
rsource "common/Kconfig"
241241
rsource "host/Kconfig"
242242
rsource "Kconfig.tinycrypt"
243+
rsource "lib/Kconfig"
243244

244245
config BT_SHELL
245246
bool "Bluetooth shell"

zephyr_bt/host/l2cap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,9 +1431,9 @@ static void l2cap_chan_destroy(struct bt_l2cap_chan *chan)
14311431
* In the case where we are in the context of executing the rtx_work
14321432
* item, we don't sync as it will deadlock the workqueue.
14331433
*/
1434-
struct k_work_q *rtx_work_queue = le_chan->rtx_work.queue;
1434+
struct k_work_q *rtx_work_queue = le_chan->rtx_work.workqueue;
14351435

1436-
if (rtx_work_queue == NULL || k_current_get() != &rtx_work_queue->thread)
1436+
if (rtx_work_queue == NULL || k_current_get() != rtx_work_queue->work_thread)
14371437
{
14381438
k_work_cancel_delayable_sync(&le_chan->rtx_work, &le_chan->rtx_sync);
14391439
}

zephyr_bt/include/rtt4zephyr.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ enum
117117

118118
#define BUILD_ASSERT(...)
119119
#define ALWAYS_INLINE __inline
120+
#define FUNC_NORETURN __attribute__((__noreturn__))
120121
#define __noasan
121122
#define __fallthrough
122123
#define __noinit
@@ -166,6 +167,13 @@ enum
166167
#define CONFIG_SYS_CLOCK_EXISTS 1
167168
#define CONFIG_SYS_CLOCK_TICKS_PER_SEC RT_TICK_PER_SECOND
168169

170+
#define k_cycle_get_32() \
171+
HAL_DBG_DWT_GetCycles()
172+
173+
#ifndef CONFIG_SYS_CLOCK_MAX_TIMEOUT_DAYS
174+
#define CONFIG_SYS_CLOCK_MAX_TIMEOUT_DAYS 365
175+
#endif
176+
169177
/**
170178
* @brief Generate null timeout delay.
171179
*
@@ -343,7 +351,7 @@ typedef void (*k_thread_entry_t)(void *p1, void *p2, void *p3);
343351
#define K_KERNEL_STACK_DEFINE(sym, size) uint8_t sym[size]
344352
#define k_current_get() rt_current_thread
345353
void k_thread_start(k_tid_t thread);
346-
#define k_sleep(s) rt_thread_mdelay(s.ticks*1000)
354+
#define k_sleep(s) rt_thread_mdelay(s.ticks)
347355
#define k_msleep(s) rt_thread_mdelay(s.ticks)
348356
#define k_thread rt_thread
349357
k_tid_t k_thread_create(struct k_thread *new_thread,
@@ -411,6 +419,10 @@ rt_tick_t k_work_delayable_remaining_get(const struct rt_delayed_work *dwork);
411419
int k_work_reschedule2(struct k_work_delayable *dwork, rt_tick_t delay);
412420
bool k_work_flush(struct k_work *work, struct k_work_sync *sync);
413421
#define k_work_busy_get(work) (work)->flags
422+
static inline bool k_work_is_pending(const struct k_work *work)
423+
{
424+
return k_work_busy_get(work) != 0;
425+
}
414426

415427

416428
/*********** k_work_queue -> rt_workqueue *********************************/
@@ -792,5 +804,13 @@ uint32_t unused:
792804
__syscall int k_poll(struct k_poll_event *events, int num_events,
793805
k_timeout_t timeout);
794806

807+
808+
/**
809+
* @brief Reset a poll signal object's state to unsignaled.
810+
*
811+
* @param sig A poll signal object
812+
*/
813+
__syscall void k_poll_signal_reset(struct k_poll_signal *sig);
814+
795815
#endif
796816

zephyr_bt/include/zbt_rtt.h

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,11 +655,21 @@
655655
#define CONFIG_BT_DIS_FW_REV BT_DIS_FW_REV
656656
#endif
657657

658+
//BT_DIS_FW_REV_STR
659+
#ifdef BT_DIS_FW_REV_STR
660+
#define CONFIG_BT_DIS_FW_REV_STR BT_DIS_FW_REV_STR
661+
#endif
662+
658663
//BT_DIS_HW_REV
659664
#ifdef BT_DIS_HW_REV
660665
#define CONFIG_BT_DIS_HW_REV BT_DIS_HW_REV
661666
#endif
662667

668+
//BT_DIS_HW_REV_STR
669+
#ifdef BT_DIS_HW_REV_STR
670+
#define CONFIG_BT_DIS_HW_REV_STR BT_DIS_HW_REV_STR
671+
#endif
672+
663673
//BT_DIS_IEEE_RCDL
664674
#ifdef BT_DIS_IEEE_RCDL
665675
#define CONFIG_BT_DIS_IEEE_RCDL BT_DIS_IEEE_RCDL
@@ -705,16 +715,31 @@
705715
#define CONFIG_BT_DIS_SERIAL_NUMBER BT_DIS_SERIAL_NUMBER
706716
#endif
707717

718+
//BT_DIS_SERIAL_NUMBER_STR
719+
#ifdef BT_DIS_SERIAL_NUMBER_STR
720+
#define CONFIG_BT_DIS_SERIAL_NUMBER_STR BT_DIS_SERIAL_NUMBER_STR
721+
#endif
722+
708723
//BT_DIS_SETTINGS
709724
#ifdef BT_DIS_SETTINGS
710725
#define CONFIG_BT_DIS_SETTINGS BT_DIS_SETTINGS
711726
#endif
712727

728+
//BT_DIS_STR_MAX
729+
#ifdef BT_DIS_STR_MAX
730+
#define CONFIG_BT_DIS_STR_MAX BT_DIS_STR_MAX
731+
#endif
732+
713733
//BT_DIS_SW_REV
714734
#ifdef BT_DIS_SW_REV
715735
#define CONFIG_BT_DIS_SW_REV BT_DIS_SW_REV
716736
#endif
717737

738+
//BT_DIS_SW_REV_STR
739+
#ifdef BT_DIS_SW_REV_STR
740+
#define CONFIG_BT_DIS_SW_REV_STR BT_DIS_SW_REV_STR
741+
#endif
742+
718743
//BT_DIS_SYSTEM_ID
719744
#ifdef BT_DIS_SYSTEM_ID
720745
#define CONFIG_BT_DIS_SYSTEM_ID BT_DIS_SYSTEM_ID
@@ -730,6 +755,11 @@
730755
#define CONFIG_BT_DRIVER_RX_HIGH_PRIO BT_DRIVER_RX_HIGH_PRIO
731756
#endif
732757

758+
//BT_EAD
759+
#ifdef BT_EAD
760+
#define CONFIG_BT_EAD BT_EAD
761+
#endif
762+
733763
//BT_ECC
734764
#ifdef BT_ECC
735765
#define CONFIG_BT_ECC BT_ECC
@@ -1135,6 +1165,11 @@
11351165
#define CONFIG_BT_L2CAP_DYNAMIC_CHANNEL BT_L2CAP_DYNAMIC_CHANNEL
11361166
#endif
11371167

1168+
//BT_L2CAP_ECRED
1169+
#ifdef BT_L2CAP_ECRED
1170+
#define CONFIG_BT_L2CAP_ECRED BT_L2CAP_ECRED
1171+
#endif
1172+
11381173
//BT_L2CAP_SEG_RECV
11391174
#ifdef BT_L2CAP_SEG_RECV
11401175
#define CONFIG_BT_L2CAP_SEG_RECV BT_L2CAP_SEG_RECV
@@ -2060,6 +2095,86 @@
20602095
#define CONFIG_BT_OTS_CLIENT BT_OTS_CLIENT
20612096
#endif
20622097

2098+
//BT_OTS_DIR_LIST_OBJ
2099+
#ifdef BT_OTS_DIR_LIST_OBJ
2100+
#define CONFIG_BT_OTS_DIR_LIST_OBJ BT_OTS_DIR_LIST_OBJ
2101+
#endif
2102+
2103+
//BT_OTS_DIR_LIST_OBJ_NAME
2104+
#ifdef BT_OTS_DIR_LIST_OBJ_NAME
2105+
#define CONFIG_BT_OTS_DIR_LIST_OBJ_NAME BT_OTS_DIR_LIST_OBJ_NAME
2106+
#endif
2107+
2108+
//BT_OTS_L2CAP_CHAN_RX_MTU
2109+
#ifdef BT_OTS_L2CAP_CHAN_RX_MTU
2110+
#define CONFIG_BT_OTS_L2CAP_CHAN_RX_MTU BT_OTS_L2CAP_CHAN_RX_MTU
2111+
#endif
2112+
2113+
//BT_OTS_L2CAP_CHAN_TX_MTU
2114+
#ifdef BT_OTS_L2CAP_CHAN_TX_MTU
2115+
#define CONFIG_BT_OTS_L2CAP_CHAN_TX_MTU BT_OTS_L2CAP_CHAN_TX_MTU
2116+
#endif
2117+
2118+
//BT_OTS_MAX_INST_CNT
2119+
#ifdef BT_OTS_MAX_INST_CNT
2120+
#define CONFIG_BT_OTS_MAX_INST_CNT BT_OTS_MAX_INST_CNT
2121+
#endif
2122+
2123+
//BT_OTS_MAX_OBJ_CNT
2124+
#ifdef BT_OTS_MAX_OBJ_CNT
2125+
#define CONFIG_BT_OTS_MAX_OBJ_CNT BT_OTS_MAX_OBJ_CNT
2126+
#endif
2127+
2128+
//BT_OTS_OACP_CHECKSUM_SUPPORT
2129+
#ifdef BT_OTS_OACP_CHECKSUM_SUPPORT
2130+
#define CONFIG_BT_OTS_OACP_CHECKSUM_SUPPORT BT_OTS_OACP_CHECKSUM_SUPPORT
2131+
#endif
2132+
2133+
//BT_OTS_OACP_CREATE_SUPPORT
2134+
#ifdef BT_OTS_OACP_CREATE_SUPPORT
2135+
#define CONFIG_BT_OTS_OACP_CREATE_SUPPORT BT_OTS_OACP_CREATE_SUPPORT
2136+
#endif
2137+
2138+
//BT_OTS_OACP_DELETE_SUPPORT
2139+
#ifdef BT_OTS_OACP_DELETE_SUPPORT
2140+
#define CONFIG_BT_OTS_OACP_DELETE_SUPPORT BT_OTS_OACP_DELETE_SUPPORT
2141+
#endif
2142+
2143+
//BT_OTS_OACP_PATCH_SUPPORT
2144+
#ifdef BT_OTS_OACP_PATCH_SUPPORT
2145+
#define CONFIG_BT_OTS_OACP_PATCH_SUPPORT BT_OTS_OACP_PATCH_SUPPORT
2146+
#endif
2147+
2148+
//BT_OTS_OACP_READ_SUPPORT
2149+
#ifdef BT_OTS_OACP_READ_SUPPORT
2150+
#define CONFIG_BT_OTS_OACP_READ_SUPPORT BT_OTS_OACP_READ_SUPPORT
2151+
#endif
2152+
2153+
//BT_OTS_OACP_WRITE_SUPPORT
2154+
#ifdef BT_OTS_OACP_WRITE_SUPPORT
2155+
#define CONFIG_BT_OTS_OACP_WRITE_SUPPORT BT_OTS_OACP_WRITE_SUPPORT
2156+
#endif
2157+
2158+
//BT_OTS_OBJ_MAX_NAME_LEN
2159+
#ifdef BT_OTS_OBJ_MAX_NAME_LEN
2160+
#define CONFIG_BT_OTS_OBJ_MAX_NAME_LEN BT_OTS_OBJ_MAX_NAME_LEN
2161+
#endif
2162+
2163+
//BT_OTS_OBJ_NAME_WRITE_SUPPORT
2164+
#ifdef BT_OTS_OBJ_NAME_WRITE_SUPPORT
2165+
#define CONFIG_BT_OTS_OBJ_NAME_WRITE_SUPPORT BT_OTS_OBJ_NAME_WRITE_SUPPORT
2166+
#endif
2167+
2168+
//BT_OTS_OLCP_GO_TO_SUPPORT
2169+
#ifdef BT_OTS_OLCP_GO_TO_SUPPORT
2170+
#define CONFIG_BT_OTS_OLCP_GO_TO_SUPPORT BT_OTS_OLCP_GO_TO_SUPPORT
2171+
#endif
2172+
2173+
//BT_OTS_SECONDARY_SVC
2174+
#ifdef BT_OTS_SECONDARY_SVC
2175+
#define CONFIG_BT_OTS_SECONDARY_SVC BT_OTS_SECONDARY_SVC
2176+
#endif
2177+
20632178
//BT_PACS
20642179
#ifdef BT_PACS
20652180
#define CONFIG_BT_PACS BT_PACS

zephyr_bt/lib/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2023 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BT_EAD
5+
bool "Encrypted Advertising Data"
6+
select BT_HOST_CCM
7+
help
8+
Enable the Encrypted Advertising Data library

zephyr_bt/lib/SConscript

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from building import *
2+
3+
cwd = GetCurrentDir()
4+
src = ["ead.c"]
5+
6+
group = DefineGroup('zbt_ead', src, depend = ['BT_EAD'])
7+
8+
Return('group')

0 commit comments

Comments
 (0)