Skip to content

Commit

Permalink
Merge pull request #231 from ingchips/develop
Browse files Browse the repository at this point in the history
release 8.4.6
  • Loading branch information
zjli-2019 authored Nov 28, 2023
2 parents e9baee4 + f6ccf22 commit 9b39732
Show file tree
Hide file tree
Showing 329 changed files with 18,816 additions and 8,177 deletions.
789 changes: 397 additions & 392 deletions bundles/exp/ING9168xx/apis.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions bundles/exp/ING9168xx/meta.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"app": {
"base": 33734656
"base": 33742848
},
"ram": {
"base": 536870912,
"size": 21524
"size": 21828
},
"rom": {
"base": 33562624,
"size": 168848
"size": 177784
},
"version": [
2,
2,
53
3,
4
]
}
Binary file modified bundles/exp/ING9168xx/platform.bin
Binary file not shown.
715 changes: 360 additions & 355 deletions bundles/exp/ING9187xx/apis.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions bundles/exp/ING9187xx/meta.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"app": {
"base": 163840
"base": 172032
},
"ram": {
"base": 536870912,
"size": 29980
"size": 30268
},
"rom": {
"base": 16384,
"size": 147176
"size": 152044
},
"version": [
1,
9,
39
43
]
}
Binary file modified bundles/exp/ING9187xx/platform.bin
Binary file not shown.
753 changes: 379 additions & 374 deletions bundles/exp/ING9188xx/apis.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions bundles/exp/ING9188xx/meta.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"app": {
"base": 172032
"base": 180224
},
"ram": {
"base": 536870912,
"size": 29980
"size": 30268
},
"rom": {
"base": 16384,
"size": 154084
"size": 158956
},
"version": [
1,
9,
39
43
]
}
Binary file modified bundles/exp/ING9188xx/platform.bin
Binary file not shown.
28 changes: 25 additions & 3 deletions bundles/exp/inc/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,13 @@ typedef enum {
#define ERROR_CODE_CONNECTION_FAILED_TO_BE_ESTABLISHED 0x3E
#define ERROR_CODE_MAC_CONNECTION_FAILED 0x3F
#define ERROR_CODE_COARSE_CLOCK_ADJUSTMENT_REJECTED_BUT_WILL_TRY_TO_ADJUST_USING_CLOCK_DRAGGING 0x40
#define ERROR_CODE_UNKNOWN_ADVERTISING_IDENTIFIER 0x42
#define ERROR_CODE_LIMIT_REACHED 0x43
#define ERROR_CODE_UNKNOWN_ADVERTISING_IDENTIFIER 0x42
#define ERROR_CODE_LIMIT_REACHED 0x43
#define ERROR_CODE_OP_CANCELLED_BY_HOST 0x44
#define ERROR_CODE_PACKET_TOO_LONG 0x45
#define ERROR_CODE_TOO_LATE 0x46
#define ERROR_CODE_TOO_EARLY 0x47

// HCI roles
#define HCI_ROLE_MASTER 0
#define HCI_ROLE_SLAVE 1
Expand Down Expand Up @@ -508,8 +513,15 @@ typedef enum {
#define HCI_SUBEVENT_LE_TRANSMIT_POWER_REPORTING 0x21
#define HCI_SUBEVENT_LE_BIGINFO_ADV_REPORT 0x22
#define HCI_SUBEVENT_LE_SUBRATE_CHANGE 0x23
#define HCI_SUBEVENT_LE_PERIODIC_ADVERTISING_SYNC_ESTABLISHED_V2 0x24
#define HCI_SUBEVENT_LE_PERIODIC_ADVERTISING_REPORT_V2 0x25
#define HCI_SUBEVENT_LE_PRD_ADV_SYNC_TRANSFER_RCVD_V2 0x26
#define HCI_SUBEVENT_PRD_ADV_SUBEVT_DATA_REQ 0x27
#define HCI_SUBEVENT_PRD_ADV_RSP_REPORT 0x28
#define HCI_SUBEVENT_LE_ENHANCED_CONNECTION_COMPLETE_V2 0x29

// Vendor specific subevents
#define HCI_SUBEVENT_LE_VENDOR_CONNECTION_ABORTED 0xFD
#define HCI_SUBEVENT_LE_VENDOR_CHANNEL_MAP_UPDATE 0xFE
#define HCI_SUBEVENT_LE_VENDOR_PRO_CONNECTIONLESS_IQ_REPORT 0xFF

Expand Down Expand Up @@ -686,7 +698,10 @@ typedef enum {
SM_CODE_IDENTITY_INFORMATION,
SM_CODE_IDENTITY_ADDRESS_INFORMATION,
SM_CODE_SIGNING_INFORMATION,
SM_CODE_SECURITY_REQUEST
SM_CODE_SECURITY_REQUEST,
SM_CODE_PAIRING_PUBLIC_KEY,
SM_CODE_PAIRING_DHKEY_CHECK,
SM_CODE_PAIRING_KEYPRESS_NOTIFICATION
} SECURITY_MANAGER_COMMANDS;

// IO Capability Values
Expand All @@ -703,6 +718,7 @@ typedef enum {
#define SM_AUTHREQ_NO_BONDING 0x00
#define SM_AUTHREQ_BONDING 0x01
#define SM_AUTHREQ_MITM_PROTECTION 0x04
#define SM_AUTHREQ_SC 0x08 // support of LE Secure Connections pairing

// Key distribution flags used by spec
#define SM_KEYDIST_ENC_KEY 0X01
Expand All @@ -720,6 +736,7 @@ typedef enum {
#define SM_STK_GENERATION_METHOD_JUST_WORKS 0x01
#define SM_STK_GENERATION_METHOD_OOB 0x02
#define SM_STK_GENERATION_METHOD_PASSKEY 0x04
#define SM_STK_GENERATION_METHOD_NUM_COMPARISON 0x08

// Pairing Failed Reasons
#define SM_REASON_RESERVED 0x00
Expand All @@ -732,6 +749,11 @@ typedef enum {
#define SM_REASON_COMMAND_NOT_SUPPORTED 0x07
#define SM_REASON_UNSPECIFIED_REASON 0x08
#define SM_REASON_REPEATED_ATTEMPTS 0x09
#define SM_REASON_REPEATED_ATTEMPTS 0x09
#define SM_REASON_INVALID_PARAMETERS 0x0a
#define SM_REASON_DHKEY_CHECK_FAILED 0x0b
#define SM_REASON_NUMERIC_COMPARISON_FAILED 0x0c
#define SM_REASON_KEY_REJECTED_FAILED 0x0f
// also, invalid parameters
// and reserved

Expand Down
6 changes: 6 additions & 0 deletions bundles/exp/inc/btstack_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@
*/
#define SM_EVENT_STATE_CHANGED 0xDC

/**
* @format H1B1
* @param handle
* @param show calculated numeric value that needs to be compared
*/
#define SM_EVENT_NUMERIC_COMPARISON_REQUEST 0xDD
// GAP

/**
Expand Down
59 changes: 58 additions & 1 deletion bundles/exp/inc/btstack_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,26 @@ static __INLINE hci_con_handle_t sm_event_numeric_comparison_get_handle(const ui
return little_endian_read_16(event, 2);
}

/**
* @brief Get field addr_type from event SM_EVENT_NUMERIC_COMPARISON_REQUEST
* @param event packet
* @return addr_type
* @note: btstack_type 1
*/
static __INLINE uint8_t sm_event_numeric_comparison_get_addr_type(const uint8_t * event){
return *decode_event_offset(event, uint8_t, 4);
}

/**
* @brief Get field address from event SM_EVENT_NUMERIC_COMPARISON_REQUEST
* @param event packet
* @param Pointer to storage for address
* @note: btstack_type B
*/
static __INLINE void sm_event_numeric_comparison_get_address(const uint8_t * event, uint8_t * address){
reverse_bd_addr(decode_event_offset(event, uint8_t, 5), address);
}

/**
* @brief Get field compare value from event SM_EVENT_NUMERIC_COMPARISON_REQUEST
* @param event packet
Expand Down Expand Up @@ -1386,6 +1406,43 @@ typedef struct le_meta_subrate_change
// Time Range: 100 ms to 32 s
} le_meta_subrate_change_t;

typedef struct le_meta_event_vendor_channel_map_update
{
// connection handle
uint16_t conn_handle;
// current channel map (the lower 37 bits are used)
// channel `n` is identified by bit `(channel_map & 0x7)` of `channel_map[n / 8]`
uint8_t channel_map[5];
} le_meta_event_vendor_channel_map_update_t;

// @brief BLE Link Layer security context
typedef struct le_security_ctx
{
uint8_t opaque[40];
} le_security_ctx_t;

typedef struct le_meta_event_vendor_connection_aborted
{
uint16_t conn_handle; // connection handle
uint8_t role; // role (0: master, 1: slave)
phy_type_t rx_phy; // Rx PHY
phy_type_t tx_phy; // Tx PHY
uint32_t access_addr; // Access address
uint32_t crc_init; // CRC init value
uint32_t interval; // interval in us
uint16_t sup_timeout; // supervision timeout in 10ms
uint8_t channel_map[5]; // channel map (lower 37 bits)
uint8_t ch_sel_algo; // channel selection algorithm (0: ALG #1, 1: ALG #2)
uint8_t hop_inc; // frequency hopping increment (only for ALG #1)
uint8_t last_unmapped_ch; // last unmapped channel (only for ALG #1)
uint16_t slave_latency; // slave latency
uint8_t sleep_clk_acc; // sleep clock accuracy
uint64_t next_event_time; // start time of next connection event
uint16_t next_event_counter; // event counter for next connection event
uint8_t security_enabled; // is security enabled
le_security_ctx_t security; // security context (available when enabled)
} le_meta_event_vendor_connection_aborted_t;

typedef struct le_mete_event_prd_adv_subevent_data_req
{
uint8_t adv_handle; // Used to identify a periodic advertising train
Expand Down Expand Up @@ -1446,7 +1503,7 @@ typedef struct le_mete_event_prd_adv_rsp_report
#define le_meta_conn_iq_report le_meta_event_conn_iq_report
#define le_meta_cte_req_failed_t le_meta_event_cte_req_failed_t
#define le_meta_cte_req_failed le_meta_event_cte_req_failed
#define le_meta_pro_connless_iq_report le_meta_event_pro_connless_iq_report
#define le_meta_pro_connless_iq_report_t le_meta_event_pro_connless_iq_report_t
#define le_meta_pro_connless_iq_report le_meta_event_pro_connless_iq_report
#define le_meta_connless_iq_report_t le_meta_event_connless_iq_report_t
#define le_meta_connless_iq_report le_meta_event_connless_iq_report
Expand Down
16 changes: 8 additions & 8 deletions bundles/exp/inc/gap.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ typedef enum

typedef uint8_t adv_event_properties_t;

#define PERIODIC_ADV_BIT_INC_TX BIT(6)
#define PERIODIC_ADV_BIT_INC_TX BIT(ADV_INC_TX_POWER)
typedef uint8_t periodic_adv_properties_t;

/**
Expand Down Expand Up @@ -1408,11 +1408,11 @@ uint8_t gap_test_end(void);

typedef struct
{
uint8_t subevent; // The subevent index of the data contained in this command. Range: 0x00 to 0x7F
uint8_t rsp_slot_start; // The first response slots to be used in this subevent
uint8_t rsp_slot_count; // The number of response slots to be used.
uint8_t data_len; // The number of octets in the `data`. [0..251]
uint8_t data[0]; // Advertising data
uint8_t subevent; // The subevent index of the data contained in this command. Range: 0x00 to 0x7F
uint8_t rsp_slot_start; // The first response slots to be used in this subevent
uint8_t rsp_slot_count; // The number of response slots to be used.
uint8_t data_len; // The number of octets in the `data`. [0..251]
const uint8_t * data; // Advertising data
} gap_prd_adv_subevent_data_t;

#pragma pack (pop)
Expand Down Expand Up @@ -1448,7 +1448,7 @@ uint8_t gap_set_periodic_adv_subevent_data(uint8_t adv_handle,
* @return 0: Message is sent out; Other: Message is not sent out
*/
uint8_t gap_set_periodic_adv_rsp_data(uint16_t sync_handle,
uint8_t request_event,
uint16_t request_event,
uint8_t request_subevent,
uint8_t rsp_subevent,
uint8_t rsp_slot,
Expand All @@ -1460,7 +1460,7 @@ uint8_t gap_set_periodic_adv_rsp_data(uint16_t sync_handle,
*
* @param[in] sync_handle Identify the PAwR train. Range: 0x0000 to 0x0EFF
* @param[in] periodic_adv_properties Properties (bit combination of \ref `adv_event_property_t`).
* Only 0 or (1 << ADV_INC_TX_POWER) is allowed.
* Only 0 or PERIODIC_ADV_BIT_INC_TX is allowed.
* @param[in] num_subevents Number of subevents. Range: 0x01 to 0x80
* @param[in] subevents Each subevent to synchronize with. Range 0x00 to 0x7F
* @return 0: Message is sent out; Other: Message is not sent out
Expand Down
8 changes: 4 additions & 4 deletions bundles/exp/inc/le_device_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ typedef struct le_device_memory_db {

// Identification
uint8_t addr_type;
uint8_t key_size;
uint8_t authenticated;
uint8_t authorized;
uint8_t key_size;
uint8_t authenticated;
uint8_t authorized:1;
uint8_t sm_sc:1;

bd_addr_t addr;
sm_key_t irk;
Expand All @@ -36,7 +37,6 @@ typedef struct le_device_memory_db {
// Signed Writes by us
sm_key_t local_csrk;
uint32_t local_counter;

} le_device_memory_db_t;

#pragma pack (pop)
Expand Down
43 changes: 32 additions & 11 deletions bundles/exp/inc/ll_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,36 +100,42 @@ void ll_hint_on_ce_len(const uint16_t conn_handle, const uint16_t min_ce_len, co

/**
****************************************************************************************
* @brief Create a connection directly (without advertising & initiating)
* @brief Create/Resume a connection directly (without advertising & initiating)
*
* @param[in] role connection role. master (0), slave (1)
* @param[in] addr_types address types for advertiser and initiator
* bit [0] for slave, bit [1] for master
* bit [0] for slave (advertiser)
* bit [1] for master (initiator)
* 0: public address; 1: random address
* @param[in] adv_addr address of advertiser
* @param[in] init_addr address of initiator
* @param[in] adv_addr address of advertiser (little-endian)
* @param[in] init_addr address of initiator (little-endian)
* @param[in] rx_phy Rx PHY (1: 1M, 2: 2M, 3: Coded)
* @param[in] tx_phy Tx PHY (1: 1M, 2: 2M, 3: Coded)
* @param[in] access_addr access address
* @param[in] crc_init CRC init
* @param[in] interval connection interval (unit: us)
* @param[in] sup_timeout supervision timeout (unit: 10ms)
* @param[in] channel_map channel map
* @param[in] ch_sel_algo channel selection algorithm (1 or 2)
* @param[in] hop_inc hop increment for CSA#1 ([5..16])
* @param[in] ch_sel_algo channel selection algorithm (0: ALG #1, 1: ALG #2)
* @param[in] hop_inc hop increment for CSA#1 ([5..16]) (only for ALG #1)
* @param[in] last_unmapped_ch last unmapped channel index (only for ALG #1)
* @param[in] min_ce_len information parameter about the minimum length of connection
* event needed for this LE connection.
* @param[in] max_ce_len information parameter about the maximum length of connection
* event needed for this LE connection.
* @param[in] start_time start time of the 1st connectin event
* @param[in] start_time start time of the 1st connection event
* @param[in] event_counter event counter for the 1st connection event
* @param[in] slave_latency slave latency
* @param[in] sleep_clk_acc sleep clock accuracy
* @param[in] sleep_clk_acc sleep clock accuracy (only for SLAVE role)
* @param[in] sync_window slave's sync window for 1st connection event
* @param[in] security link layer security context
* NULL: security not used
* otherwise: security is used, which is `le_security_ctx_t *` in
* `le_meta_event_vendor_connection_aborted_t`.
* @return 0 if successful else error code
****************************************************************************************
*/
int ll_create_conn(
uint8_t role,
int ll_create_conn(uint8_t role,
uint8_t addr_types,
const uint8_t *adv_addr,
const uint8_t *init_addr,
Expand All @@ -142,12 +148,15 @@ int ll_create_conn(
const uint8_t *channel_map,
uint8_t ch_sel_algo,
uint8_t hop_inc,
uint8_t last_unmapped_ch,
uint16_t min_ce_len,
uint16_t max_ce_len,
uint64_t start_time,
uint16_t event_counter,
uint16_t slave_latency,
uint8_t sleep_clk_acc,
uint32_t sync_window);
uint32_t sync_window,
const void *security);

/**
****************************************************************************************
Expand Down Expand Up @@ -236,6 +245,18 @@ int ll_get_conn_events_info(const uint16_t conn_handle,
uint16_t *event_count,
uint8_t *channel_ids);

/**
****************************************************************************************
* @brief Abort an existing connection
*
* After a connection is aborted, `HCI_SUBEVENT_VENDOR_CONNECTION_ABORTED` is emitted.
*
* @param[in] conn_handle handle of an existing connection
* @return 0 if aborting is ongoing else non-0
****************************************************************************************
*/
int ll_conn_abort(uint16_t conn_handle);

/**
****************************************************************************************
* @brief Set default antenna ID
Expand Down
Loading

0 comments on commit 9b39732

Please sign in to comment.