diff --git a/drivers/bluetooth/hci/h4.c b/drivers/bluetooth/hci/h4.c index 2443d24263e..c3ef746891d 100644 --- a/drivers/bluetooth/hci/h4.c +++ b/drivers/bluetooth/hci/h4.c @@ -42,26 +42,26 @@ static struct { struct net_buf *buf; struct k_fifo fifo; - uint16_t remaining; - uint16_t discard; + u16_t remaining; + u16_t discard; bool have_hdr; bool discardable; - uint8_t hdr_len; + u8_t hdr_len; - uint8_t type; + u8_t type; union { struct bt_hci_evt_hdr evt; struct bt_hci_acl_hdr acl; - uint8_t hdr[4]; + u8_t hdr[4]; }; } rx = { .fifo = K_FIFO_INITIALIZER(rx.fifo), }; static struct { - uint8_t type; + u8_t type; struct net_buf *buf; struct k_fifo fifo; } tx = { @@ -99,7 +99,7 @@ static inline void get_acl_hdr(void) struct bt_hci_acl_hdr *hdr = &rx.acl; int to_read = sizeof(*hdr) - rx.remaining; - rx.remaining -= uart_fifo_read(h4_dev, (uint8_t *)hdr + to_read, + rx.remaining -= uart_fifo_read(h4_dev, (u8_t *)hdr + to_read, rx.remaining); if (!rx.remaining) { rx.remaining = sys_le16_to_cpu(hdr->len); @@ -113,7 +113,7 @@ static inline void get_evt_hdr(void) struct bt_hci_evt_hdr *hdr = &rx.evt; int to_read = rx.hdr_len - rx.remaining; - rx.remaining -= uart_fifo_read(h4_dev, (uint8_t *)hdr + to_read, + rx.remaining -= uart_fifo_read(h4_dev, (u8_t *)hdr + to_read, rx.remaining); if (rx.hdr_len == sizeof(*hdr) && rx.remaining < sizeof(*hdr)) { switch (rx.evt.evt) { @@ -223,7 +223,7 @@ static void rx_thread(void *p1, void *p2, void *p3) static size_t h4_discard(struct device *uart, size_t len) { - uint8_t buf[33]; + u8_t buf[33]; return uart_fifo_read(uart, buf, min(len, sizeof(buf))); } diff --git a/drivers/bluetooth/hci/h5.c b/drivers/bluetooth/hci/h5.c index 9e39a2b53eb..41c485825fe 100644 --- a/drivers/bluetooth/hci/h5.c +++ b/drivers/bluetooth/hci/h5.c @@ -42,7 +42,7 @@ static struct k_delayed_work retx_work; #define HCI_3WIRE_LINK_PKT 0x0f #define HCI_VENDOR_PKT 0xff -static bool reliable_packet(uint8_t type) +static bool reliable_packet(u8_t type) { switch (type) { case HCI_COMMAND_PKT: @@ -87,11 +87,11 @@ static struct h5 { struct k_fifo rx_queue; struct k_fifo unack_queue; - uint8_t tx_win; - uint8_t tx_ack; - uint8_t tx_seq; + u8_t tx_win; + u8_t tx_ack; + u8_t tx_seq; - uint8_t rx_ack; + u8_t rx_ack; enum { UNINIT, @@ -107,13 +107,13 @@ static struct h5 { } rx_state; } h5; -static uint8_t unack_queue_len; +static u8_t unack_queue_len; -static const uint8_t sync_req[] = { 0x01, 0x7e }; -static const uint8_t sync_rsp[] = { 0x02, 0x7d }; +static const u8_t sync_req[] = { 0x01, 0x7e }; +static const u8_t sync_rsp[] = { 0x02, 0x7d }; /* Third byte may change */ -static uint8_t conf_req[3] = { 0x03, 0xfc }; -static const uint8_t conf_rsp[] = { 0x04, 0x7b }; +static u8_t conf_req[3] = { 0x03, 0xfc }; +static const u8_t conf_rsp[] = { 0x04, 0x7b }; /* H5 signal buffers pool */ #define CONFIG_BLUETOOTH_MAX_SIG_LEN 3 @@ -135,7 +135,7 @@ static void h5_reset_rx(void) h5.rx_state = START; } -static int h5_unslip_byte(uint8_t *byte) +static int h5_unslip_byte(u8_t *byte) { int count; @@ -164,8 +164,8 @@ static int h5_unslip_byte(uint8_t *byte) static void process_unack(void) { - uint8_t next_seq = h5.tx_seq; - uint8_t number_removed = unack_queue_len; + u8_t next_seq = h5.tx_seq; + u8_t number_removed = unack_queue_len; if (!unack_queue_len) { return; @@ -211,7 +211,7 @@ static void process_unack(void) } } -static void h5_print_header(const uint8_t *hdr, const char *str) +static void h5_print_header(const u8_t *hdr, const char *str) { if (H5_HDR_RELIABLE(hdr)) { BT_DBG("%s REL: seq %u ack %u crc %u type %u len %u", @@ -226,7 +226,7 @@ static void h5_print_header(const uint8_t *hdr, const char *str) } #if defined(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER) -static void hexdump(const char *str, const uint8_t *packet, size_t length) +static void hexdump(const char *str, const u8_t *packet, size_t length) { int n = 0; @@ -260,7 +260,7 @@ static void hexdump(const char *str, const uint8_t *packet, size_t length) #define hexdump(str, packet, length) #endif -static uint8_t h5_slip_byte(uint8_t byte) +static u8_t h5_slip_byte(u8_t byte) { switch (byte) { case SLIP_DELIMITER: @@ -277,9 +277,9 @@ static uint8_t h5_slip_byte(uint8_t byte) } } -static void h5_send(const uint8_t *payload, uint8_t type, int len) +static void h5_send(const u8_t *payload, u8_t type, int len) { - uint8_t hdr[4]; + u8_t hdr[4]; int i; hexdump("<= ", payload, len); @@ -338,7 +338,7 @@ static void retx_timeout(struct k_work *work) /* Queue unack packets to the beginning of the queue */ while ((buf = net_buf_get(&h5.unack_queue, K_NO_WAIT))) { /* include also packet type */ - net_buf_push(buf, sizeof(uint8_t)); + net_buf_push(buf, sizeof(u8_t)); net_buf_put(&h5.tx_queue, buf); h5.tx_seq = (h5.tx_seq - 1) & 0x07; unack_queue_len--; @@ -364,7 +364,7 @@ static void ack_timeout(struct k_work *work) stack_analyze("rx_stack", rx_stack, sizeof(rx_stack)); } -static void h5_process_complete_packet(uint8_t *hdr) +static void h5_process_complete_packet(u8_t *hdr) { struct net_buf *buf; @@ -402,7 +402,7 @@ static void h5_process_complete_packet(uint8_t *hdr) } } -static inline struct net_buf *get_evt_buf(uint8_t evt) +static inline struct net_buf *get_evt_buf(u8_t evt) { struct net_buf *buf; @@ -427,9 +427,9 @@ static inline struct net_buf *get_evt_buf(uint8_t evt) static void bt_uart_isr(struct device *unused) { static int remaining; - uint8_t byte; + u8_t byte; int ret; - static uint8_t hdr[4]; + static u8_t hdr[4]; ARG_UNUSED(unused); @@ -570,14 +570,14 @@ static void bt_uart_isr(struct device *unused) } } -static uint8_t h5_get_type(struct net_buf *buf) +static u8_t h5_get_type(struct net_buf *buf) { return net_buf_pull_u8(buf); } static int h5_queue(struct net_buf *buf) { - uint8_t type; + u8_t type; BT_DBG("buf %p type %u len %u", buf, bt_buf_get_type(buf), buf->len); @@ -609,7 +609,7 @@ static void tx_thread(void) while (true) { struct net_buf *buf; - uint8_t type; + u8_t type; BT_DBG("link_state %u", h5.link_state); @@ -641,7 +641,7 @@ static void tx_thread(void) } } -static void h5_set_txwin(uint8_t *conf) +static void h5_set_txwin(u8_t *conf) { conf[2] = h5.tx_win & 0x07; } diff --git a/drivers/bluetooth/hci/spi.c b/drivers/bluetooth/hci/spi.c index a311ce68aa4..ad49cb87fdd 100644 --- a/drivers/bluetooth/hci/spi.c +++ b/drivers/bluetooth/hci/spi.c @@ -57,8 +57,8 @@ */ #define SPI_MAX_MSG_LEN 255 /* As defined by X-NUCLEO-IDB04A1 BSP */ -static uint8_t rxmsg[SPI_MAX_MSG_LEN]; -static uint8_t txmsg[SPI_MAX_MSG_LEN]; +static u8_t rxmsg[SPI_MAX_MSG_LEN]; +static u8_t txmsg[SPI_MAX_MSG_LEN]; static struct device *spi_dev; #if defined(CONFIG_BLUETOOTH_SPI_BLUENRG) @@ -82,10 +82,10 @@ static struct spi_config spi_conf = { #if defined(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER) #include -static inline void spi_dump_message(const uint8_t *pre, uint8_t *buf, - uint8_t size) +static inline void spi_dump_message(const u8_t *pre, u8_t *buf, + u8_t size) { - uint8_t i, c; + u8_t i, c; printk("%s (%d): ", pre, size); for (i = 0; i < size; i++) { @@ -101,15 +101,15 @@ static inline void spi_dump_message(const uint8_t *pre, uint8_t *buf, } #else static inline -void spi_dump_message(const uint8_t *pre, uint8_t *buf, uint8_t size) {} +void spi_dump_message(const u8_t *pre, u8_t *buf, u8_t size) {} #endif -static inline uint16_t bt_spi_get_cmd(uint8_t *txmsg) +static inline u16_t bt_spi_get_cmd(u8_t *txmsg) { return (txmsg[CMD_OCF] << 8) | txmsg[CMD_OGF]; } -static inline uint16_t bt_spi_get_evt(uint8_t *rxmsg) +static inline u16_t bt_spi_get_evt(u8_t *rxmsg) { return (rxmsg[EVT_VENDOR_CODE_MSB] << 8) | rxmsg[EVT_VENDOR_CODE_LSB]; } @@ -120,7 +120,7 @@ static void bt_spi_isr(struct device *unused1, struct gpio_callback *unused2, k_sem_give(&sem_request); } -static void bt_spi_handle_vendor_evt(uint8_t *rxmsg) +static void bt_spi_handle_vendor_evt(u8_t *rxmsg) { switch (bt_spi_get_evt(rxmsg)) { case EVT_BLUE_INITIALIZED: @@ -133,10 +133,10 @@ static void bt_spi_handle_vendor_evt(uint8_t *rxmsg) static void bt_spi_rx_thread(void) { struct net_buf *buf; - uint8_t header_master[5] = { SPI_READ, 0x00, 0x00, 0x00, 0x00 }; - uint8_t header_slave[5]; + u8_t header_master[5] = { SPI_READ, 0x00, 0x00, 0x00, 0x00 }; + u8_t header_slave[5]; struct bt_hci_acl_hdr acl_hdr; - uint8_t size; + u8_t size; memset(&txmsg, 0xFF, SPI_MAX_MSG_LEN); @@ -213,8 +213,8 @@ static void bt_spi_rx_thread(void) static int bt_spi_send(struct net_buf *buf) { - uint8_t header[5] = { SPI_WRITE, 0x00, 0x00, 0x00, 0x00 }; - uint32_t pending; + u8_t header[5] = { SPI_WRITE, 0x00, 0x00, 0x00, 0x00 }; + u32_t pending; /* Buffer needs an additional byte for type */ if (buf->len >= SPI_MAX_MSG_LEN) { diff --git a/drivers/bluetooth/nble/conn.c b/drivers/bluetooth/nble/conn.c index 45429132a43..dacfb320dd5 100644 --- a/drivers/bluetooth/nble/conn.c +++ b/drivers/bluetooth/nble/conn.c @@ -79,7 +79,7 @@ void bt_conn_unref(struct bt_conn *conn) BT_DBG("handle %u ref %u", conn->handle, atomic_get(&conn->ref)); } -struct bt_conn *bt_conn_lookup_handle(uint16_t handle) +struct bt_conn *bt_conn_lookup_handle(u16_t handle) { int i; @@ -133,8 +133,8 @@ int bt_conn_get_info(const struct bt_conn *conn, struct bt_conn_info *info) return 0; } -static inline bool bt_le_conn_params_valid(uint16_t min, uint16_t max, - uint16_t latency, uint16_t timeout) +static inline bool bt_le_conn_params_valid(u16_t min, u16_t max, + u16_t latency, u16_t timeout) { if (min > max || min < 6 || max > 3200) { return false; @@ -184,7 +184,7 @@ int bt_conn_le_param_update(struct bt_conn *conn, return 0; } -int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason) +int bt_conn_disconnect(struct bt_conn *conn, u8_t reason) { struct nble_gap_disconnect_req req; @@ -323,7 +323,7 @@ int bt_conn_security(struct bt_conn *conn, bt_security_t sec) return err; } -uint8_t bt_conn_enc_key_size(struct bt_conn *conn) +u8_t bt_conn_enc_key_size(struct bt_conn *conn) { return 0; } diff --git a/drivers/bluetooth/nble/conn.h b/drivers/bluetooth/nble/conn.h index 297efb34aa2..6fcf5457cb3 100644 --- a/drivers/bluetooth/nble/conn.h +++ b/drivers/bluetooth/nble/conn.h @@ -4,4 +4,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -struct bt_conn *bt_conn_lookup_handle(uint16_t handle); +struct bt_conn *bt_conn_lookup_handle(u16_t handle); diff --git a/drivers/bluetooth/nble/conn_internal.h b/drivers/bluetooth/nble/conn_internal.h index c1729b5423a..403bbcfecf8 100644 --- a/drivers/bluetooth/nble/conn_internal.h +++ b/drivers/bluetooth/nble/conn_internal.h @@ -5,8 +5,8 @@ */ struct bt_conn { - uint16_t handle; - uint8_t role; + u16_t handle; + u8_t role; atomic_t ref; bt_addr_le_t dst; @@ -14,9 +14,9 @@ struct bt_conn { bt_security_t sec_level; bt_security_t required_sec_level; - uint16_t interval; - uint16_t latency; - uint16_t timeout; + u16_t interval; + u16_t latency; + u16_t timeout; enum { BT_CONN_DISCONNECTED, diff --git a/drivers/bluetooth/nble/gap.c b/drivers/bluetooth/nble/gap.c index c536b1aea58..900a831a05f 100644 --- a/drivers/bluetooth/nble/gap.c +++ b/drivers/bluetooth/nble/gap.c @@ -33,7 +33,7 @@ #define NBLE_VERSION_PATCH(v) (((v) >> 0) & 0xFF) /* Set the firmware compatible with Nordic BLE RPC */ -static const uint32_t compatible_firmware = NBLE_VERSION(4, 0, 31); +static const u32_t compatible_firmware = NBLE_VERSION(4, 0, 31); static bt_ready_cb_t bt_ready_cb; static bt_le_scan_cb_t *scan_dev_found_cb; @@ -121,7 +121,7 @@ static int set_ad(struct nble_eir_data *eir, const struct bt_data *ad, int i; for (i = 0; i < ad_len; i++) { - uint8_t *p; + u8_t *p; /* Check if ad fit in the remaining buffer */ if (eir->len + ad[i].data_len + 2 > 31) { @@ -277,7 +277,7 @@ int bt_le_scan_start(const struct bt_le_scan_param *param, bt_le_scan_cb_t cb) } void on_nble_gap_adv_report_evt(const struct nble_gap_adv_report_evt *evt, - const uint8_t *buf, uint8_t len) + const u8_t *buf, u8_t len) { BT_DBG(""); @@ -312,7 +312,7 @@ void on_nble_gap_scan_start_stop_rsp(const struct nble_common_rsp *rsp) BT_DBG(""); } -void nble_log(const struct nble_log_s *param, char *format, uint8_t len) +void nble_log(const struct nble_log_s *param, char *format, u8_t len) { #if defined(CONFIG_BLUETOOTH_DEBUG) /* Build meaningful output */ @@ -348,7 +348,7 @@ void on_nble_common_rsp(const struct nble_common_rsp *rsp) BT_DBG("status %d", rsp->status); } -void rpc_init_cb(uint32_t version, bool compatible) +void rpc_init_cb(u32_t version, bool compatible) { BT_DBG(""); diff --git a/drivers/bluetooth/nble/gap_internal.h b/drivers/bluetooth/nble/gap_internal.h index b260c3b8b1a..7589219a051 100644 --- a/drivers/bluetooth/nble/gap_internal.h +++ b/drivers/bluetooth/nble/gap_internal.h @@ -45,13 +45,13 @@ enum NBLE_GAP_SM_EVT { }; struct nble_log_s { - uint8_t param0; - uint8_t param1; - uint8_t param2; - uint8_t param3; + u8_t param0; + u8_t param1; + u8_t param2; + u8_t param3; }; -void nble_log(const struct nble_log_s *par, char *data, uint8_t len); +void nble_log(const struct nble_log_s *par, char *data, u8_t len); struct nble_common_rsp { int status; @@ -70,13 +70,13 @@ void on_nble_common_rsp(const struct nble_common_rsp *rsp); void nble_panic_req(void); struct nble_version { - uint8_t version; - uint8_t major; - uint8_t minor; - uint8_t patch; + u8_t version; + u8_t major; + u8_t minor; + u8_t patch; char version_string[20]; - uint8_t build_hash[4]; - uint8_t hash[4]; + u8_t build_hash[4]; + u8_t hash[4]; }; typedef void (*ble_get_version_cb_t)(const struct nble_version *ver); @@ -103,44 +103,44 @@ enum NBLE_GAP_SVC_ATTR_TYPE { struct nble_gap_device_name { /* Security mode for writing device name, see BLE_GAP_SEC_MODES */ - uint8_t sec_mode; + u8_t sec_mode; /* 0: no authorization, 1: authorization required */ - uint8_t authorization; + u8_t authorization; /* Device name length (0-248) */ - uint8_t len; - uint8_t name_array[20]; + u8_t len; + u8_t name_array[20]; }; struct nble_conn_param { /* minimal connection interval: range 0x0006 to 0x0c80 (unit 1.25ms) */ - uint16_t interval_min; + u16_t interval_min; /* maximum connection interval: range 0x0006 to 0x0c80 must be bigger then min! */ - uint16_t interval_max; + u16_t interval_max; /* maximum connection slave latency: 0x0000 to 0x01f3 */ - uint16_t slave_latency; + u16_t slave_latency; /* link supervision timeout: 0x000a to 0x0c80 (unit 10ms) */ - uint16_t link_sup_to; + u16_t link_sup_to; }; struct nble_gap_service_req { /* GAP Characteristics attribute type see NBLE_GAP_SVC_ATTR_TYPE */ - uint16_t attr_type; + u16_t attr_type; union { struct nble_gap_device_name name; /* Appearance UUID */ - uint16_t appearance; + u16_t appearance; /* Preferred Peripheral Connection Parameters */ struct nble_conn_param ppcp; /* Central Address Resolution support 0: no, 1: yes */ - uint8_t car; + u8_t car; }; }; void nble_gap_service_req(const struct nble_gap_service_req *req); struct nble_dbg_req { - uint32_t u0; - uint32_t u1; + u32_t u0; + u32_t u1; void *user_data; }; @@ -148,8 +148,8 @@ void nble_dbg_req(const struct nble_dbg_req *req); struct nble_dbg_rsp { int status; - uint32_t u0; - uint32_t u1; + u32_t u0; + u32_t u1; void *user_data; }; @@ -192,8 +192,8 @@ struct nble_get_bda_rsp { void on_nble_get_bda_rsp(const struct nble_get_bda_rsp *rsp); struct nble_eir_data { - uint8_t len; - uint8_t data[31]; + u8_t len; + u8_t data[31]; }; struct nble_gap_set_adv_data_req { @@ -206,15 +206,15 @@ struct nble_gap_set_adv_data_req { void nble_gap_set_adv_data_req(struct nble_gap_set_adv_data_req *req); struct nble_gap_set_adv_params_req { - uint16_t timeout; + u16_t timeout; /* min interval 0xffff: use default 0x0800 */ - uint16_t interval_min; + u16_t interval_min; /* max interval 0xffff: use default 0x0800 */ - uint16_t interval_max; + u16_t interval_max; /* advertisement types see GAP_ADV_TYPES */ - uint8_t type; + u8_t type; /* filter policy to apply with white list */ - uint8_t filter_policy; + u8_t filter_policy; /* bd address of peer device in case of directed advertisement */ bt_addr_le_t peer_bda; }; @@ -228,7 +228,7 @@ void on_nble_gap_start_adv_rsp(const struct nble_common_rsp *rsp); void nble_gap_stop_adv_req(void *user_data); struct nble_gap_conn_update_req { - uint16_t conn_handle; + u16_t conn_handle; struct nble_conn_param params; }; @@ -237,8 +237,8 @@ void nble_gap_conn_update_req(const struct nble_gap_conn_update_req *req); void on_nble_gap_conn_update_rsp(const struct nble_common_rsp *rsp); struct nble_gap_disconnect_req { - uint16_t conn_handle; - uint8_t reason; + u16_t conn_handle; + u8_t reason; }; void nble_gap_disconnect_req(const struct nble_gap_disconnect_req *req); @@ -253,16 +253,16 @@ void on_nble_sm_config_rsp(struct nble_sm_config_rsp *rsp); struct nble_sm_pairing_param { /* authentication level see BLE_GAP_SM_OPTIONS */ - uint8_t auth; - uint8_t io_capabilities; - uint8_t max_key_size; - uint8_t min_key_size; - uint8_t oob_flag; + u8_t auth; + u8_t io_capabilities; + u8_t max_key_size; + u8_t min_key_size; + u8_t oob_flag; }; struct nble_sm_security_req { struct bt_conn *conn; - uint16_t conn_handle; + u16_t conn_handle; /* Local authentication/bonding parameters */ struct nble_sm_pairing_param params; }; @@ -275,17 +275,17 @@ enum NBLE_SM_PASSKEY_TYPE { }; struct nble_sm_passkey { - uint8_t type; /* see NBLE_SM_PASSKEY_TYPE */ + u8_t type; /* see NBLE_SM_PASSKEY_TYPE */ union { - uint32_t passkey; - uint8_t oob[16]; - uint8_t reason; + u32_t passkey; + u8_t oob[16]; + u8_t reason; }; }; struct nble_sm_passkey_reply_req { struct bt_conn *conn; - uint16_t conn_handle; + u16_t conn_handle; struct nble_sm_passkey params; }; @@ -306,7 +306,7 @@ void on_nble_sm_common_rsp(const struct nble_sm_common_rsp *rsp); struct nble_sm_pairing_response_req { struct bt_conn *conn; - uint16_t conn_handle; + u16_t conn_handle; struct nble_sm_pairing_param params; }; @@ -314,22 +314,22 @@ void nble_sm_pairing_response_req(const struct nble_sm_pairing_response_req *req struct nble_sm_error_req { struct bt_conn *conn; - uint16_t conn_handle; - uint8_t reason; + u16_t conn_handle; + u8_t reason; }; void nble_sm_error_req(const struct nble_sm_error_req *req); struct nble_gap_set_rssi_report_req { - uint16_t conn_handle; + u16_t conn_handle; /* RSSI operation see NBLE_GAP_RSSI_OPS */ - uint8_t op; + u8_t op; /* Channel for RSSI enabling */ - uint8_t channel; + u8_t channel; /* minimum RSSI dBm change to report a new RSSI value */ - uint8_t delta_dBm; + u8_t delta_dBm; /* number of delta_dBm changes before sending a new RSSI report */ - uint8_t min_count; + u8_t min_count; }; void nble_gap_set_rssi_report_req(const struct nble_gap_set_rssi_report_req *req, @@ -338,12 +338,12 @@ void nble_gap_set_rssi_report_req(const struct nble_gap_set_rssi_report_req *req void on_nble_gap_set_rssi_report_rsp(const struct nble_common_rsp *rsp); struct nble_scan_param { - uint16_t interval; - uint16_t window; + u16_t interval; + u16_t window; /* Unused for the connection request */ - uint8_t scan_type; + u8_t scan_type; /* Unused for the connection request */ - uint8_t use_whitelist; + u8_t use_whitelist; }; struct nble_gap_start_scan_req { @@ -379,7 +379,7 @@ void nble_uas_rssi_calibrate_req(const struct nble_uas_rssi_calibrate_req *req); /* Temporary patch: RSSI processing for UAS */ struct nble_uas_bucket_change { - uint8_t distance; + u8_t distance; }; void on_nble_uas_bucket_change(const struct nble_uas_bucket_change *par); @@ -389,7 +389,7 @@ void nble_gap_dtm_init_req(void *user_data); void on_nble_gap_dtm_init_rsp(void *user_data); struct nble_gap_set_tx_power_req { - int8_t tx_power; + s8_t tx_power; }; void nble_gap_set_tx_power_req(const struct nble_gap_set_tx_power_req *req); @@ -398,18 +398,18 @@ void on_nble_gap_set_tx_power_rsp(const struct nble_common_rsp *rsp); struct nble_conn_values { /* Connection interval (unit 1.25 ms) */ - uint16_t interval; + u16_t interval; /* Connection latency (unit interval) */ - uint16_t latency; + u16_t latency; /* Connection supervision timeout (unit 10ms)*/ - uint16_t supervision_to; + u16_t supervision_to; }; struct nble_gap_connect_evt { - uint16_t conn_handle; + u16_t conn_handle; struct nble_conn_values conn_values; /* 0 if connected as master, otherwise as slave */ - uint8_t role_slave; + u8_t role_slave; /* Address of peer device */ bt_addr_le_t peer_bda; }; @@ -417,14 +417,14 @@ struct nble_gap_connect_evt { void on_nble_gap_connect_evt(const struct nble_gap_connect_evt *evt); struct nble_gap_disconnect_evt { - uint16_t conn_handle; - uint8_t hci_reason; + u16_t conn_handle; + u8_t hci_reason; }; void on_nble_gap_disconnect_evt(const struct nble_gap_disconnect_evt *evt); struct nble_gap_conn_update_evt { - uint16_t conn_handle; + u16_t conn_handle; struct nble_conn_values conn_values; }; @@ -432,16 +432,16 @@ void on_nble_gap_conn_update_evt(const struct nble_gap_conn_update_evt *evt); struct nble_gap_adv_report_evt { bt_addr_le_t addr; - int8_t rssi; - uint8_t adv_type; + s8_t rssi; + u8_t adv_type; }; void on_nble_gap_adv_report_evt(const struct nble_gap_adv_report_evt *evt, - const uint8_t *data, uint8_t len); + const u8_t *data, u8_t len); struct nble_gap_dir_adv_timeout_evt { - uint16_t conn_handle; - uint16_t error; + u16_t conn_handle; + u16_t error; }; void on_nble_gap_dir_adv_timeout_evt(const struct nble_gap_dir_adv_timeout_evt *evt); @@ -449,22 +449,22 @@ void on_nble_gap_dir_adv_timeout_evt(const struct nble_gap_dir_adv_timeout_evt * #define BLE_GAP_RSSI_EVT_SIZE 32 struct nble_gap_rssi_evt { - uint16_t conn_handle; - int8_t rssi_data[BLE_GAP_RSSI_EVT_SIZE]; + u16_t conn_handle; + s8_t rssi_data[BLE_GAP_RSSI_EVT_SIZE]; }; void on_nble_gap_rssi_evt(const struct nble_gap_rssi_evt *evt); struct nble_sm_passkey_req_evt { - uint16_t conn_handle; - uint8_t key_type; + u16_t conn_handle; + u8_t key_type; }; void on_nble_sm_passkey_req_evt(const struct nble_sm_passkey_req_evt *evt); struct nble_sm_passkey_disp_evt { - uint16_t conn_handle; - uint32_t passkey; + u16_t conn_handle; + u32_t passkey; }; void on_nble_sm_passkey_disp_evt(const struct nble_sm_passkey_disp_evt *evt); @@ -478,12 +478,12 @@ enum NBLE_SM_STATUS_EVT { struct nble_link_sec { bt_security_t sec_level; - uint8_t enc_size; + u8_t enc_size; }; struct nble_sm_status_evt { - uint16_t conn_handle; - uint8_t evt_type; /* see NBLE_SM_STATUS_EVT */ + u16_t conn_handle; + u8_t evt_type; /* see NBLE_SM_STATUS_EVT */ int status; union { struct nble_link_sec enc_link_sec; @@ -494,21 +494,21 @@ struct nble_sm_status_evt { void on_nble_sm_status_evt(const struct nble_sm_status_evt *evt); struct nble_sec_param { - uint8_t auth; - uint8_t io_capabilities; - uint8_t min_key_size; - uint8_t max_key_size; + u8_t auth; + u8_t io_capabilities; + u8_t min_key_size; + u8_t max_key_size; }; struct nble_sm_pairing_request_evt { - uint16_t conn_handle; + u16_t conn_handle; struct nble_sec_param sec_param; }; void on_nble_sm_pairing_request_evt(const struct nble_sm_pairing_request_evt *evt); struct nble_sm_security_request_evt { - uint16_t conn_handle; + u16_t conn_handle; struct nble_sec_param sec_param; }; @@ -516,7 +516,7 @@ void on_nble_sm_security_request_evt(const struct nble_sm_security_request_evt * struct nble_sm_bond_info; typedef void (*ble_bond_info_cb_t)(const struct nble_sm_bond_info *info, - const bt_addr_le_t *addr, uint16_t len, + const bt_addr_le_t *addr, u16_t len, void *user_data); struct nble_sm_bond_info_req { @@ -529,8 +529,8 @@ void nble_sm_bond_info_req(const struct nble_sm_bond_info_req *req); struct nble_sm_bond_info { int err; - uint8_t addr_count; - uint8_t irk_count; + u8_t addr_count; + u8_t irk_count; }; struct nble_sm_bond_info_rsp { @@ -540,29 +540,29 @@ struct nble_sm_bond_info_rsp { }; void on_nble_sm_bond_info_rsp(const struct nble_sm_bond_info_rsp *rsp, - const bt_addr_le_t *peer_addr, uint16_t len); + const bt_addr_le_t *peer_addr, u16_t len); struct nble_uart_test_req { /* Test type: 1 = start peer test, 2 = loopback test */ - uint16_t test_type; + u16_t test_type; /* Test type 1: Number of test events packets sent from peer to host */ - uint16_t nb_loops; + u16_t nb_loops; /* Test type 1: The maximum delay between packets (in ms) */ - uint16_t max_delay; + u16_t max_delay; /* Test type 1: The maximum length of packets (in bytes) */ - uint16_t max_len; + u16_t max_len; }; void nble_uart_test_req(const struct nble_uart_test_req *req, - const uint8_t *data, uint8_t len); + const u8_t *data, u8_t len); struct nble_uart_test_evt { /* Number of loops executed */ - uint16_t nb_loops; + u16_t nb_loops; }; void on_nble_uart_test_evt(const struct nble_uart_test_evt *evt, - const uint8_t *data, uint8_t len); + const u8_t *data, u8_t len); /* * The following functions are NOT RPC functions @@ -580,19 +580,19 @@ enum NBLE_GAP_RSSI_OPS { NBLE_GAP_RSSI_ENABLE_REPORT }; -typedef void (*rssi_report_t)(const int8_t *rssi_data); +typedef void (*rssi_report_t)(const s8_t *rssi_data); typedef void (*rssi_report_resp_t)(int status); struct ble_rssi_report_params { /* RSSI operation see NBLE_GAP_RSSI_OPS */ - uint8_t op; + u8_t op; /* Channel for RSSI enabling */ - uint8_t channel; + u8_t channel; /* minimum RSSI dBm change to report a new RSSI value */ - uint8_t delta_dBm; + u8_t delta_dBm; /* number of delta_dBm changes before sending a new RSSI report */ - uint8_t min_count; + u8_t min_count; }; void ble_gap_set_rssi_report(struct ble_rssi_report_params *par, diff --git a/drivers/bluetooth/nble/gatt.c b/drivers/bluetooth/nble/gatt.c index 1df440828b5..2d3a1484bdc 100644 --- a/drivers/bluetooth/nble/gatt.c +++ b/drivers/bluetooth/nble/gatt.c @@ -34,11 +34,11 @@ static K_FIFO_DEFINE(queue); struct nble_gatt_service { const struct bt_gatt_attr *attrs; - uint16_t attr_count; + u16_t attr_count; }; static struct nble_gatt_service svc_db[BLE_GATTS_MAX_SERVICES]; -static uint8_t svc_count; +static u8_t svc_count; static sys_slist_t subscriptions; @@ -48,9 +48,9 @@ static sys_slist_t subscriptions; * @param uuid Pointer to the UUID to copy * @return The length required to store the UUID in the memory */ -static uint8_t bt_gatt_uuid_memcpy(uint8_t *buf, const struct bt_uuid *uuid) +static u8_t bt_gatt_uuid_memcpy(u8_t *buf, const struct bt_uuid *uuid) { - uint8_t *ptr = buf; + u8_t *ptr = buf; /* Store the type of the UUID */ *ptr = uuid->type; @@ -58,7 +58,7 @@ static uint8_t bt_gatt_uuid_memcpy(uint8_t *buf, const struct bt_uuid *uuid) /* Store the UUID data */ if (uuid->type == BT_UUID_TYPE_16) { - uint16_t le16; + u16_t le16; le16 = sys_cpu_to_le16(BT_UUID_16(uuid)->val); memcpy(ptr, &le16, sizeof(le16)); @@ -85,9 +85,9 @@ static struct bt_uuid *whitelist[] = { BT_UUID_GAP_PPCP }; -static int attr_read(struct bt_gatt_attr *attr, uint8_t *data, size_t len) +static int attr_read(struct bt_gatt_attr *attr, u8_t *data, size_t len) { - uint8_t i; + u8_t i; int data_size; if (!data) { @@ -118,8 +118,8 @@ int bt_gatt_register(struct bt_gatt_attr *attrs, size_t count) struct nble_gatts_register_req param; size_t i; /* TODO: Replace the following with net_buf */ - uint8_t attr_table[NBLE_BUF_SIZE]; - uint8_t attr_table_size; + u8_t attr_table[NBLE_BUF_SIZE]; + u8_t attr_table_size; if (!attrs || !count) { return -EINVAL; @@ -174,7 +174,7 @@ int bt_gatt_register(struct bt_gatt_attr *attrs, size_t count) void on_nble_gatts_register_rsp(const struct nble_gatts_register_rsp *rsp, const struct nble_gatt_attr_handles *handles, - uint8_t len) + u8_t len) { int i; struct bt_gatt_attr *head_svc_attr; @@ -217,13 +217,13 @@ void on_nble_gatts_register_rsp(const struct nble_gatts_register_rsp *rsp, #endif } -void bt_gatt_foreach_attr(uint16_t start_handle, uint16_t end_handle, +void bt_gatt_foreach_attr(u16_t start_handle, u16_t end_handle, bt_gatt_attr_func_t func, void *user_data) { int i; for (i = 0; i < svc_count; i++) { - uint16_t attr_count = svc_db[i].attr_count; + u16_t attr_count = svc_db[i].attr_count; const struct bt_gatt_attr *attr; int j; @@ -245,12 +245,12 @@ void bt_gatt_foreach_attr(uint16_t start_handle, uint16_t end_handle, struct bt_gatt_attr *bt_gatt_attr_next(const struct bt_gatt_attr *attr) { - uint16_t i; + u16_t i; for (i = 0; i < svc_count; i++) { if (attr >= svc_db[i].attrs && attr < svc_db[i].attrs + svc_db[i].attr_count) { - uint8_t attr_i; + u8_t attr_i; attr_i = (attr - svc_db[i].attrs) + 1; @@ -270,10 +270,10 @@ struct bt_gatt_attr *bt_gatt_attr_next(const struct bt_gatt_attr *attr) } ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr, - void *buf, uint16_t buf_len, uint16_t offset, - const void *value, uint16_t value_len) + void *buf, u16_t buf_len, u16_t offset, + const void *value, u16_t value_len) { - uint16_t len; + u16_t len; BT_DBG("handle 0x%04x offset %u", attr->handle, offset); @@ -295,12 +295,12 @@ ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr, ssize_t bt_gatt_attr_read_service(struct bt_conn *conn, const struct bt_gatt_attr *attr, - void *buf, uint16_t len, uint16_t offset) + void *buf, u16_t len, u16_t offset) { struct bt_uuid *uuid = attr->user_data; if (uuid->type == BT_UUID_TYPE_16) { - uint16_t uuid16 = sys_cpu_to_le16(BT_UUID_16(uuid)->val); + u16_t uuid16 = sys_cpu_to_le16(BT_UUID_16(uuid)->val); return bt_gatt_attr_read(conn, attr, buf, len, offset, &uuid16, 2); @@ -312,7 +312,7 @@ ssize_t bt_gatt_attr_read_service(struct bt_conn *conn, ssize_t bt_gatt_attr_read_included(struct bt_conn *conn, const struct bt_gatt_attr *attr, - void *buf, uint16_t len, uint16_t offset) + void *buf, u16_t len, u16_t offset) { /* * bt_gatt_attr_read uses memcpy to copy the address of the attr @@ -331,21 +331,21 @@ ssize_t bt_gatt_attr_read_included(struct bt_conn *conn, } struct gatt_chrc { - uint8_t properties; - uint16_t value_handle; + u8_t properties; + u16_t value_handle; union { - uint16_t uuid16; - uint8_t uuid[16]; + u16_t uuid16; + u8_t uuid[16]; }; } __packed; ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset) + u16_t len, u16_t offset) { struct bt_gatt_chrc *chrc = attr->user_data; struct gatt_chrc pdu; - uint8_t value_len; + u8_t value_len; pdu.properties = chrc->properties; @@ -367,7 +367,7 @@ ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn, ssize_t bt_gatt_attr_read_ccc(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset) + u16_t len, u16_t offset) { return BT_GATT_ERR(BT_ATT_ERR_NOT_SUPPORTED); } @@ -376,7 +376,7 @@ static void gatt_ccc_changed(const struct bt_gatt_attr *attr, struct _bt_gatt_ccc *ccc) { int i; - uint16_t value = 0x0000; + u16_t value = 0x0000; for (i = 0; i < ccc->cfg_len; i++) { if (ccc->cfg[i].value > value) { @@ -394,10 +394,10 @@ static void gatt_ccc_changed(const struct bt_gatt_attr *attr, ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, - uint16_t len, uint16_t offset, uint8_t flags) + u16_t len, u16_t offset, u8_t flags) { struct _bt_gatt_ccc *ccc = attr->user_data; - const uint16_t *data = buf; + const u16_t *data = buf; size_t i; if (offset > sizeof(*data)) { @@ -448,10 +448,10 @@ ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn, ssize_t bt_gatt_attr_read_cep(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset) + u16_t len, u16_t offset) { struct bt_gatt_cep *value = attr->user_data; - uint16_t props = sys_cpu_to_le16(value->properties); + u16_t props = sys_cpu_to_le16(value->properties); return bt_gatt_attr_read(conn, attr, buf, len, offset, &props, sizeof(props)); @@ -459,7 +459,7 @@ ssize_t bt_gatt_attr_read_cep(struct bt_conn *conn, ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset) + u16_t len, u16_t offset) { char *value = attr->user_data; @@ -469,7 +469,7 @@ ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn, ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset) + u16_t len, u16_t offset) { struct bt_gatt_cpf *value = attr->user_data; @@ -491,7 +491,7 @@ static int notify(struct bt_conn *conn, const struct bt_gatt_attr *attr, notif.params.offset = 0; notif.cback = NULL; - nble_gatts_notify_req(¬if, (uint8_t *)data, len); + nble_gatts_notify_req(¬if, (u8_t *)data, len); return 0; } @@ -544,14 +544,14 @@ static int indicate(struct bt_conn *conn, } struct notify_data { - uint16_t type; + u16_t type; const struct bt_gatt_attr *attr; const void *data; - uint16_t len; + u16_t len; struct bt_gatt_indicate_params *params; }; -static uint8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data) { struct notify_data *data = user_data; struct _bt_gatt_ccc *ccc; @@ -603,7 +603,7 @@ static uint8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data) } int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr, - const void *data, uint16_t len) + const void *data, u16_t len) { struct notify_data nfy; @@ -734,11 +734,11 @@ int bt_gatt_discover(struct bt_conn *conn, return 0; } -static uint16_t parse_include(struct bt_conn *conn, +static u16_t parse_include(struct bt_conn *conn, struct bt_gatt_discover_params *params, - const uint8_t *data, uint8_t len) + const u8_t *data, u8_t len) { - uint16_t end_handle = 0; + u16_t end_handle = 0; int i; for (i = 0; len > 0; i++) { @@ -782,11 +782,11 @@ static uint16_t parse_include(struct bt_conn *conn, return end_handle; } -static uint16_t parse_service(struct bt_conn *conn, +static u16_t parse_service(struct bt_conn *conn, struct bt_gatt_discover_params *params, - const uint8_t *data, uint8_t len) + const u8_t *data, u8_t len) { - uint16_t end_handle = 0; + u16_t end_handle = 0; int i; for (i = 0; len > 0; i++) { @@ -813,11 +813,11 @@ static uint16_t parse_service(struct bt_conn *conn, return end_handle; } -static uint16_t parse_characteristic(struct bt_conn *conn, +static u16_t parse_characteristic(struct bt_conn *conn, struct bt_gatt_discover_params *params, - const uint8_t *data, uint8_t len) + const u8_t *data, u8_t len) { - uint16_t end_handle = 0; + u16_t end_handle = 0; int i; for (i = 0; len > 0; i++) { @@ -846,11 +846,11 @@ static uint16_t parse_characteristic(struct bt_conn *conn, return end_handle; } -static uint16_t parse_descriptor(struct bt_conn *conn, +static u16_t parse_descriptor(struct bt_conn *conn, struct bt_gatt_discover_params *params, - const uint8_t *data, uint8_t len) + const u8_t *data, u8_t len) { - uint16_t end_handle = 0; + u16_t end_handle = 0; int i; for (i = 0; len > 0; i++) { @@ -885,9 +885,9 @@ static void *gatt_get_private(struct bt_conn *conn) } void on_nble_gattc_discover_rsp(const struct nble_gattc_discover_rsp *rsp, - const uint8_t *data, uint8_t data_len) + const u8_t *data, u8_t data_len) { - uint16_t end_handle = 0; + u16_t end_handle = 0; struct bt_gatt_discover_params *params; struct bt_conn *conn; int status; @@ -1006,7 +1006,7 @@ int bt_gatt_read(struct bt_conn *conn, struct bt_gatt_read_params *params) } void on_nble_gattc_read_rsp(const struct nble_gattc_read_rsp *rsp, - uint8_t *data, uint8_t len) + u8_t *data, u8_t len) { struct bt_gatt_read_params *params = rsp->user_data; struct bt_conn *conn; @@ -1052,7 +1052,7 @@ done: } void on_nble_gattc_read_multi_rsp(const struct nble_gattc_read_rsp *rsp, - uint8_t *data, uint8_t len) + u8_t *data, u8_t len) { struct bt_gatt_read_params *params = rsp->user_data; struct bt_conn *conn; @@ -1113,7 +1113,7 @@ int bt_gatt_write(struct bt_conn *conn, struct bt_gatt_write_params *params) return 0; } -static void gatt_write_ccc_rsp(struct bt_conn *conn, uint8_t err, +static void gatt_write_ccc_rsp(struct bt_conn *conn, u8_t err, struct bt_gatt_write_params *params) { BT_DBG("conn %p err %u", conn, err); @@ -1149,8 +1149,8 @@ void on_nble_gattc_write_rsp(const struct nble_gattc_write_rsp *rsp) bt_conn_unref(conn); } -int bt_gatt_write_without_response(struct bt_conn *conn, uint16_t handle, - const void *data, uint16_t length, +int bt_gatt_write_without_response(struct bt_conn *conn, u16_t handle, + const void *data, u16_t length, bool sign) { struct nble_gattc_write_req req; @@ -1304,7 +1304,7 @@ int bt_gatt_subscribe(struct bt_conn *conn, } void on_nble_gattc_value_evt(const struct nble_gattc_value_evt *ev, - uint8_t *data, uint8_t length) + u8_t *data, u8_t length) { sys_snode_t *node, *tmp, *prev = NULL; struct bt_conn *conn; @@ -1403,8 +1403,8 @@ void bt_gatt_cancel(struct bt_conn *conn, void *params) BT_DBG(""); } -static int32_t prep_write_evt(const struct nble_gatts_write_evt *ev, - const uint8_t *data, uint8_t len) +static s32_t prep_write_evt(const struct nble_gatts_write_evt *ev, + const u8_t *data, u8_t len) { #if CONFIG_BLUETOOTH_ATT_PREPARE_COUNT > 0 const struct bt_gatt_attr *attr = ev->attr; @@ -1443,11 +1443,11 @@ static int32_t prep_write_evt(const struct nble_gatts_write_evt *ev, #endif } -static int32_t write_evt(struct bt_conn *conn, +static s32_t write_evt(struct bt_conn *conn, const struct bt_gatt_attr *attr, - uint16_t offset, const uint8_t *data, uint8_t len) + u16_t offset, const u8_t *data, u8_t len) { - int32_t status; + s32_t status; status = attr->write(conn, attr, data, len, offset, 0); if (status < 0) { @@ -1463,7 +1463,7 @@ static int32_t write_evt(struct bt_conn *conn, } void on_nble_gatts_write_evt(const struct nble_gatts_write_evt *ev, - const uint8_t *buf, uint8_t buflen) + const u8_t *buf, u8_t buflen) { const struct bt_gatt_attr *attr = ev->attr; struct bt_conn *conn = bt_conn_lookup_handle(ev->conn_handle); @@ -1548,7 +1548,7 @@ void on_nble_gatts_read_evt(const struct nble_gatts_read_evt *ev) struct nble_gatts_read_reply_req reply_data; const struct bt_gatt_attr *attr; /* TODO: Replace the following with net_buf */ - uint8_t data[BLE_GATT_MTU_SIZE] = { 0 }; + u8_t data[BLE_GATT_MTU_SIZE] = { 0 }; int len; attr = ev->attr; diff --git a/drivers/bluetooth/nble/gatt_internal.h b/drivers/bluetooth/nble/gatt_internal.h index 365b9f5dad7..6a1280307fc 100644 --- a/drivers/bluetooth/nble/gatt_internal.h +++ b/drivers/bluetooth/nble/gatt_internal.h @@ -25,39 +25,39 @@ void bt_gatt_init(void); */ struct nble_gatts_attr { /* Attribute permissions */ - uint16_t perm; + u16_t perm; /* Attribute variable data size */ - uint16_t data_size; + u16_t data_size; /* Attribute variable data: always starts with the UUID and data follows */ - uint8_t data[]; + u8_t data[]; }; struct nble_gatts_register_req { /* Base address of the attribute table in the Quark mem space */ struct bt_gatt_attr *attr_base; /* Number of of attributes in this service */ - uint8_t attr_count; + u8_t attr_count; /* Size of struct bt_gatt_attr */ - uint8_t attr_size; + u8_t attr_size; }; void nble_gatts_register_req(const struct nble_gatts_register_req *req, - uint8_t *data, uint16_t len); + u8_t *data, u16_t len); struct nble_gatts_register_rsp { int status; struct bt_gatt_attr *attr_base; /* Number of attributes successfully added */ - uint8_t attr_count; + u8_t attr_count; }; struct nble_gatt_attr_handles { - uint16_t handle; + u16_t handle; }; void on_nble_gatts_register_rsp(const struct nble_gatts_register_rsp *rsp, const struct nble_gatt_attr_handles *attrs, - uint8_t len); + u8_t len); enum nble_gatt_wr_flag { NBLE_GATT_WR_FLAG_REPLY = 1, @@ -66,52 +66,52 @@ enum nble_gatt_wr_flag { struct nble_gatts_write_evt { struct bt_gatt_attr *attr; - uint16_t conn_handle; - uint16_t offset; + u16_t conn_handle; + u16_t offset; /* see nble_gatt_wr_flag */ - uint8_t flag; + u8_t flag; }; void on_nble_gatts_write_evt(const struct nble_gatts_write_evt *evt, - const uint8_t *data, uint8_t len); + const u8_t *data, u8_t len); struct nble_gatts_write_reply_req { - uint16_t conn_handle; - uint16_t offset; - int32_t status; + u16_t conn_handle; + u16_t offset; + s32_t status; }; void nble_gatts_write_reply_req(const struct nble_gatts_write_reply_req *req, - const uint8_t *data, uint8_t len); + const u8_t *data, u8_t len); struct nble_gatts_write_exec_evt { - uint16_t conn_handle; - uint8_t flag; + u16_t conn_handle; + u8_t flag; }; void on_nble_gatts_write_exec_evt(const struct nble_gatts_write_exec_evt *evt); struct nble_gatts_read_evt { struct bt_gatt_attr *attr; - uint16_t conn_handle; - uint16_t offset; + u16_t conn_handle; + u16_t offset; }; void on_nble_gatts_read_evt(const struct nble_gatts_read_evt *evt); struct nble_gatts_read_reply_req { - uint16_t conn_handle; - uint16_t offset; - int32_t status; + u16_t conn_handle; + u16_t offset; + s32_t status; }; void nble_gatts_read_reply_req(const struct nble_gatts_read_reply_req *req, - uint8_t *data, uint16_t len); + u8_t *data, u16_t len); struct nble_gatts_value_change_param { const struct bt_gatt_attr *attr; - uint16_t conn_handle; - uint16_t offset; + u16_t conn_handle; + u16_t offset; }; struct nble_gatts_notify_req { @@ -121,12 +121,12 @@ struct nble_gatts_notify_req { }; void nble_gatts_notify_req(const struct nble_gatts_notify_req *req, - const uint8_t *data, uint16_t len); + const u8_t *data, u16_t len); struct nble_gatts_notify_tx_evt { bt_gatt_notify_func_t cback; int status; - uint16_t conn_handle; + u16_t conn_handle; struct bt_gatt_attr *attr; }; @@ -139,13 +139,13 @@ struct nble_gatts_indicate_req { }; void nble_gatts_indicate_req(const struct nble_gatts_indicate_req *req, - const uint8_t *data, uint8_t len); + const u8_t *data, u8_t len); struct nble_gatts_indicate_rsp { bt_gatt_indicate_func_t cback; struct bt_gatt_attr *attr; int status; - uint16_t conn_handle; + u16_t conn_handle; }; void on_nble_gatts_indicate_rsp(const struct nble_gatts_indicate_rsp *rsp); @@ -153,60 +153,60 @@ void on_nble_gatts_indicate_rsp(const struct nble_gatts_indicate_rsp *rsp); #define DISCOVER_FLAGS_UUID_PRESENT 1 struct nble_gatt_handle_range { - uint16_t start_handle; - uint16_t end_handle; + u16_t start_handle; + u16_t end_handle; }; struct nble_gattc_discover_req { void *user_data; struct bt_uuid_128 uuid; struct nble_gatt_handle_range handle_range; - uint16_t conn_handle; - uint8_t type; - uint8_t flags; + u16_t conn_handle; + u8_t type; + u8_t flags; }; void nble_gattc_discover_req(const struct nble_gattc_discover_req *req); struct nble_gattc_primary { - uint16_t handle; + u16_t handle; struct nble_gatt_handle_range range; struct bt_uuid_128 uuid; }; struct nble_gattc_included { - uint16_t handle; + u16_t handle; struct nble_gatt_handle_range range; struct bt_uuid_128 uuid; }; struct nble_gattc_characteristic { - uint16_t handle; - uint8_t prop; - uint16_t value_handle; + u16_t handle; + u8_t prop; + u16_t value_handle; struct bt_uuid_128 uuid; }; struct nble_gattc_descriptor { - uint16_t handle; + u16_t handle; struct bt_uuid_128 uuid; }; struct nble_gattc_discover_rsp { - int32_t status; + s32_t status; void *user_data; - uint16_t conn_handle; - uint8_t type; + u16_t conn_handle; + u8_t type; }; void on_nble_gattc_discover_rsp(const struct nble_gattc_discover_rsp *rsp, - const uint8_t *data, uint8_t len); + const u8_t *data, u8_t len); struct nble_gattc_read_req { void *user_data; - uint16_t conn_handle; - uint16_t handle; - uint16_t offset; + u16_t conn_handle; + u16_t handle; + u16_t offset; }; void nble_gattc_read_req(const struct nble_gattc_read_req *req); @@ -214,28 +214,28 @@ void nble_gattc_read_req(const struct nble_gattc_read_req *req); struct nble_gattc_read_rsp { int status; void *user_data; - uint16_t conn_handle; - uint16_t handle; - uint16_t offset; + u16_t conn_handle; + u16_t handle; + u16_t offset; }; void on_nble_gattc_read_rsp(const struct nble_gattc_read_rsp *rsp, - uint8_t *data, uint8_t len); + u8_t *data, u8_t len); struct nble_gattc_read_multi_req { void *user_data; - uint16_t conn_handle; + u16_t conn_handle; }; void nble_gattc_read_multi_req(const struct nble_gattc_read_multi_req *req, - const uint16_t *handles, uint16_t len); + const u16_t *handles, u16_t len); void on_nble_gattc_read_multi_rsp(const struct nble_gattc_read_rsp *rsp, - uint8_t *data, uint8_t len); + u8_t *data, u8_t len); struct nble_gattc_write_param; -typedef void (*nble_att_func_t)(struct bt_conn *conn, uint8_t err, +typedef void (*nble_att_func_t)(struct bt_conn *conn, u8_t err, const struct nble_gattc_write_param *par); struct nble_gattc_write_param { @@ -246,21 +246,21 @@ struct nble_gattc_write_param { }; struct nble_gattc_write_req { - uint16_t conn_handle; - uint16_t handle; - uint16_t offset; + u16_t conn_handle; + u16_t handle; + u16_t offset; /* different than 0 if response required */ - uint8_t with_resp; + u8_t with_resp; struct nble_gattc_write_param wr_params; }; void nble_gattc_write_req(const struct nble_gattc_write_req *req, - const uint8_t *data, uint16_t len); + const u8_t *data, u16_t len); struct nble_gattc_write_rsp { int status; - uint16_t conn_handle; - uint16_t handle; + u16_t conn_handle; + u16_t handle; struct nble_gattc_write_param wr_params; }; @@ -276,11 +276,11 @@ enum NBLE_GATTC_EVT { struct nble_gattc_value_evt { int status; - uint16_t conn_handle; - uint16_t handle; + u16_t conn_handle; + u16_t handle; /* see NBLE_GATTC_VALUE_EVT */ - uint8_t type; + u8_t type; }; void on_nble_gattc_value_evt(const struct nble_gattc_value_evt *evt, - uint8_t *data, uint8_t len); + u8_t *data, u8_t len); diff --git a/drivers/bluetooth/nble/rpc.h b/drivers/bluetooth/nble/rpc.h index 34524de6628..99eba657c07 100644 --- a/drivers/bluetooth/nble/rpc.h +++ b/drivers/bluetooth/nble/rpc.h @@ -31,7 +31,7 @@ enum { * @return Pointer to the allocated buffer, the allocation shall not fail, * error must be handled internally */ -struct net_buf *rpc_alloc_cb(uint16_t length); +struct net_buf *rpc_alloc_cb(u16_t length); /** * RPC transmission function, must be implemented by the user of the RPC. @@ -48,7 +48,7 @@ void rpc_transmit_cb(struct net_buf *buf); * * @param version Local version to send to the peer. */ -void rpc_init(uint32_t version); +void rpc_init(u32_t version); /** * RPC initialization packet reception function, can optionally be implemented @@ -61,13 +61,13 @@ void rpc_init(uint32_t version); * @param version Peer advertised version. * @param compatible True if the peer runs a compatible RPC framework. */ -void rpc_init_cb(uint32_t version, bool compatible); +void rpc_init_cb(u32_t version, bool compatible); /** RPC serialize hash number generation. * * @return The unique identifier of the RPC deserialization. */ -uint32_t rpc_serialize_hash(void); +u32_t rpc_serialize_hash(void); /** * RPC serialization function to serialize a function that does not require any @@ -75,7 +75,7 @@ uint32_t rpc_serialize_hash(void); * * @param fn_index Index of the function */ -void rpc_serialize_none(uint8_t fn_index); +void rpc_serialize_none(u8_t fn_index); /** * RPC serialization function to serialize a function that expects a structure @@ -85,8 +85,8 @@ void rpc_serialize_none(uint8_t fn_index); * @param struct_data Pointer to the structure to serialize * @param struct_length Length of the structure to serialize */ -void rpc_serialize_s(uint8_t fn_index, const void *struct_data, - uint8_t struct_length); +void rpc_serialize_s(u8_t fn_index, const void *struct_data, + u8_t struct_length); /** * RPC serialization function to serialize a function that expects a structure @@ -97,8 +97,8 @@ void rpc_serialize_s(uint8_t fn_index, const void *struct_data, * @param struct_length Length of the structure to serialize * @param p_priv Pointer to serialize */ -void rpc_serialize_s_p(uint8_t fn_index, const void *struct_data, - uint8_t struct_length, void *p_priv); +void rpc_serialize_s_p(u8_t fn_index, const void *struct_data, + u8_t struct_length, void *p_priv); /** * RPC serialization function to serialize a function that expects a pointer as @@ -107,7 +107,7 @@ void rpc_serialize_s_p(uint8_t fn_index, const void *struct_data, * @param fn_index Index of the function * @param p_priv Pointer to serialize */ -void rpc_serialize_p(uint8_t fn_index, void *p_priv); +void rpc_serialize_p(u8_t fn_index, void *p_priv); /** * RPC serialization function to serialize a function that expects a structure @@ -119,9 +119,9 @@ void rpc_serialize_p(uint8_t fn_index, void *p_priv); * @param vbuf Pointer to the buffer to serialize * @param vbuf_length Length of the buffer to serialize */ -void rpc_serialize_s_b(uint8_t fn_index, const void *struct_data, - uint8_t struct_length, const void *vbuf, - uint16_t vbuf_length); +void rpc_serialize_s_b(u8_t fn_index, const void *struct_data, + u8_t struct_length, const void *vbuf, + u16_t vbuf_length); /** * RPC serialization function to serialize a function that expects a structure @@ -134,9 +134,9 @@ void rpc_serialize_s_b(uint8_t fn_index, const void *struct_data, * @param vbuf2_length Length of the buffer2 to serialize * @param p_priv Pointer to serialize */ -void rpc_serialize_b_b_p(uint8_t fn_index, const void *vbuf1, - uint16_t vbuf1_length, const void *vbuf2, - uint16_t vbuf2_length, void *p_priv); +void rpc_serialize_b_b_p(u8_t fn_index, const void *vbuf1, + u16_t vbuf1_length, const void *vbuf2, + u16_t vbuf2_length, void *p_priv); /** * RPC serialization function to serialize a function that expects a structure @@ -149,9 +149,9 @@ void rpc_serialize_b_b_p(uint8_t fn_index, const void *vbuf1, * @param vbuf_length Length of the buffer to serialize * @param p_priv Pointer to serialize */ -void rpc_serialize_s_b_p(uint8_t fn_index, const void *struct_data, - uint8_t struct_length, const void *vbuf, - uint16_t vbuf_length, void *p_priv); +void rpc_serialize_s_b_p(u8_t fn_index, const void *struct_data, + u8_t struct_length, const void *vbuf, + u16_t vbuf_length, void *p_priv); /** * RPC serialization function to serialize a function that expects a structure @@ -166,10 +166,10 @@ void rpc_serialize_s_b_p(uint8_t fn_index, const void *struct_data, * @param vbuf2_length2 Length of the buffer2 to serialize * @param p_priv Pointer to serialize */ -void rpc_serialize_s_b_b_p(uint8_t fn_index, const void *struct_data, - uint8_t struct_length, const void *vbuf1, - uint16_t vbuf1_length, const void *vbuf2, - uint16_t vbuf2_length, void *p_priv); +void rpc_serialize_s_b_b_p(u8_t fn_index, const void *struct_data, + u8_t struct_length, const void *vbuf1, + u16_t vbuf1_length, const void *vbuf2, + u16_t vbuf2_length, void *p_priv); /** * RPC deserialization function, shall be invoked when a buffer is received @@ -183,5 +183,5 @@ void rpc_deserialize(struct net_buf *buf); * * @return The unique identifier of the RPC deserialization. */ -uint32_t rpc_deserialize_hash(void); +u32_t rpc_deserialize_hash(void); diff --git a/drivers/bluetooth/nble/rpc_deserialize.c b/drivers/bluetooth/nble/rpc_deserialize.c index 29ef88cbbbf..a37ff48d567 100644 --- a/drivers/bluetooth/nble/rpc_deserialize.c +++ b/drivers/bluetooth/nble/rpc_deserialize.c @@ -90,11 +90,11 @@ LIST_FN_SIG_S_B_B_P #define FN_SIG_S_B_B_P(__fn, __s, __type1, __length1, __type2, \ __length2, __type3) sizeof(*((__s)0)), -static uint8_t m_size_s[] = { LIST_FN_SIG_S }; -static uint8_t m_size_s_b[] = { LIST_FN_SIG_S_B }; -static uint8_t m_size_s_p[] = { LIST_FN_SIG_S_P }; -static uint8_t m_size_s_b_p[] = { LIST_FN_SIG_S_B_P }; -static uint8_t m_size_s_b_b_p[] = { LIST_FN_SIG_S_B_B_P }; +static u8_t m_size_s[] = { LIST_FN_SIG_S }; +static u8_t m_size_s_b[] = { LIST_FN_SIG_S_B }; +static u8_t m_size_s_p[] = { LIST_FN_SIG_S_P }; +static u8_t m_size_s_b_p[] = { LIST_FN_SIG_S_B_P }; +static u8_t m_size_s_b_b_p[] = { LIST_FN_SIG_S_B_B_P }; #undef FN_SIG_NONE #undef FN_SIG_S @@ -156,16 +156,16 @@ static void (*m_fct_none[])(void) = { LIST_FN_SIG_NONE }; static void (*m_fct_s[])(void *structure) = { LIST_FN_SIG_S }; static void (*m_fct_p[])(void *pointer) = { LIST_FN_SIG_P }; static void (*m_fct_s_b[])(void *structure, void *buffer, - uint8_t length) = { LIST_FN_SIG_S_B }; -static void (*m_fct_b_b_p[])(void *buffer1, uint8_t length1, - void *buffer2, uint8_t length2, + u8_t length) = { LIST_FN_SIG_S_B }; +static void (*m_fct_b_b_p[])(void *buffer1, u8_t length1, + void *buffer2, u8_t length2, void *pointer) = { LIST_FN_SIG_B_B_P }; static void (*m_fct_s_p[])(void *structure, void *pointer) = { LIST_FN_SIG_S_P }; -static void (*m_fct_s_b_p[])(void *structure, void *buffer, uint8_t length, +static void (*m_fct_s_b_p[])(void *structure, void *buffer, u8_t length, void *pointer) = { LIST_FN_SIG_S_B_P }; -static void (*m_fct_s_b_b_p[])(void *structure, void *buffer1, uint8_t length1, - void *buffer2, uint8_t length2, +static void (*m_fct_s_b_b_p[])(void *structure, void *buffer1, u8_t length1, + void *buffer2, u8_t length2, void *pointer) = { LIST_FN_SIG_S_B_B_P }; /* Build debug table to help development with this "robust" macro stuff */ @@ -263,9 +263,9 @@ static char *debug_func_s_b_b_p[] = { LIST_FN_SIG_S_B_B_P}; hash = DJB2_HASH(hash, sizeof(*((__s)0))); \ } while (0); -uint32_t rpc_deserialize_hash(void) +u32_t rpc_deserialize_hash(void) { - uint32_t hash = 5381; + u32_t hash = 5381; LIST_FN_SIG_NONE; LIST_FN_SIG_S; @@ -287,18 +287,18 @@ static void panic(int err) } } -static void deserialize_struct(struct net_buf *buf, const uint8_t **struct_ptr, - uint8_t *struct_length) +static void deserialize_struct(struct net_buf *buf, const u8_t **struct_ptr, + u8_t *struct_length) { *struct_length = net_buf_pull_u8(buf); *struct_ptr = buf->data; net_buf_pull(buf, *struct_length); } -static void deserialize_buf(struct net_buf *buf, const uint8_t **buf_ptr, - uint16_t *buf_len) +static void deserialize_buf(struct net_buf *buf, const u8_t **buf_ptr, + u16_t *buf_len) { - uint8_t b; + u8_t b; /* Get the current byte */ b = net_buf_pull_u8(buf); @@ -306,7 +306,7 @@ static void deserialize_buf(struct net_buf *buf, const uint8_t **buf_ptr, if (b & 0x80) { /* Get the current byte */ b = net_buf_pull_u8(buf); - *buf_len += (uint16_t)b << 7; + *buf_len += (u16_t)b << 7; } /* Return the values */ @@ -321,7 +321,7 @@ static void deserialize_ptr(struct net_buf *buf, uintptr_t *priv) net_buf_pull(buf, sizeof(*priv)); } -static void deserialize_none(uint8_t fn_index, struct net_buf *buf) +static void deserialize_none(u8_t fn_index, struct net_buf *buf) { (void)buf; @@ -332,10 +332,10 @@ static void deserialize_none(uint8_t fn_index, struct net_buf *buf) m_fct_none[fn_index](); } -static void deserialize_s(uint8_t fn_index, struct net_buf *buf) +static void deserialize_s(u8_t fn_index, struct net_buf *buf) { - const uint8_t *struct_ptr; - uint8_t struct_length; + const u8_t *struct_ptr; + u8_t struct_length; deserialize_struct(buf, &struct_ptr, &struct_length); @@ -352,7 +352,7 @@ static void deserialize_s(uint8_t fn_index, struct net_buf *buf) } } -static void deserialize_p(uint8_t fn_index, struct net_buf *buf) +static void deserialize_p(u8_t fn_index, struct net_buf *buf) { uintptr_t priv; @@ -365,12 +365,12 @@ static void deserialize_p(uint8_t fn_index, struct net_buf *buf) m_fct_p[fn_index]((void *)priv); } -static void deserialize_s_b(uint8_t fn_index, struct net_buf *buf) +static void deserialize_s_b(u8_t fn_index, struct net_buf *buf) { - const uint8_t *p_struct_data; - uint8_t struct_length; - const uint8_t *p_vbuf; - uint16_t vbuf_length; + const u8_t *p_struct_data; + u8_t struct_length; + const u8_t *p_vbuf; + u16_t vbuf_length; deserialize_struct(buf, &p_struct_data, &struct_length); deserialize_buf(buf, &p_vbuf, &vbuf_length); @@ -396,12 +396,12 @@ static void deserialize_s_b(uint8_t fn_index, struct net_buf *buf) } } -static void deserialize_b_b_p(uint8_t fn_index, struct net_buf *buf) +static void deserialize_b_b_p(u8_t fn_index, struct net_buf *buf) { - const uint8_t *p_vbuf1; - uint16_t vbuf1_length; - const uint8_t *p_vbuf2; - uint16_t vbuf2_length; + const u8_t *p_vbuf1; + u16_t vbuf1_length; + const u8_t *p_vbuf2; + u16_t vbuf2_length; uintptr_t priv; deserialize_buf(buf, &p_vbuf1, &vbuf1_length); @@ -432,10 +432,10 @@ static void deserialize_b_b_p(uint8_t fn_index, struct net_buf *buf) } } -static void deserialize_s_p(uint8_t fn_index, struct net_buf *buf) +static void deserialize_s_p(u8_t fn_index, struct net_buf *buf) { - const uint8_t *p_struct_data; - uint8_t struct_length; + const u8_t *p_struct_data; + u8_t struct_length; uintptr_t priv; deserialize_struct(buf, &p_struct_data, &struct_length); @@ -454,12 +454,12 @@ static void deserialize_s_p(uint8_t fn_index, struct net_buf *buf) } } -static void deserialize_s_b_p(uint8_t fn_index, struct net_buf *buf) +static void deserialize_s_b_p(u8_t fn_index, struct net_buf *buf) { - const uint8_t *p_struct_data; - uint8_t struct_length; - const uint8_t *p_vbuf; - uint16_t vbuf_length; + const u8_t *p_struct_data; + u8_t struct_length; + const u8_t *p_vbuf; + u16_t vbuf_length; uintptr_t priv; deserialize_struct(buf, &p_struct_data, &struct_length); @@ -488,14 +488,14 @@ static void deserialize_s_b_p(uint8_t fn_index, struct net_buf *buf) } } -static void deserialize_s_b_b_p(uint8_t fn_index, struct net_buf *buf) +static void deserialize_s_b_b_p(u8_t fn_index, struct net_buf *buf) { - const uint8_t *p_struct_data; - uint8_t struct_length; - const uint8_t *p_vbuf1; - uint16_t vbuf1_length; - const uint8_t *p_vbuf2; - uint16_t vbuf2_length; + const u8_t *p_struct_data; + u8_t struct_length; + const u8_t *p_vbuf1; + u16_t vbuf1_length; + const u8_t *p_vbuf2; + u16_t vbuf2_length; uintptr_t priv; deserialize_struct(buf, &p_struct_data, &struct_length); @@ -533,14 +533,14 @@ static void deserialize_s_b_b_p(uint8_t fn_index, struct net_buf *buf) } } -static void deserialize_control(uint8_t fn_index, struct net_buf *buf) +static void deserialize_control(u8_t fn_index, struct net_buf *buf) { - const uint8_t *p_struct_data; - uint8_t struct_length; + const u8_t *p_struct_data; + u8_t struct_length; struct { - uint32_t version; - uint32_t ser_hash; - uint32_t des_hash; + u32_t version; + u32_t ser_hash; + u32_t des_hash; } struct_data; switch (fn_index) { @@ -566,8 +566,8 @@ static void deserialize_control(uint8_t fn_index, struct net_buf *buf) void rpc_deserialize(struct net_buf *buf) { - uint8_t fn_index; - uint8_t sig_type; + u8_t fn_index; + u8_t sig_type; sig_type = buf->data[0]; fn_index = buf->data[1]; @@ -633,6 +633,6 @@ void rpc_deserialize(struct net_buf *buf) } __weak -void rpc_init_cb(uint32_t version, bool compatible) +void rpc_init_cb(u32_t version, bool compatible) { } diff --git a/drivers/bluetooth/nble/rpc_functions_to_ble_core.h b/drivers/bluetooth/nble/rpc_functions_to_ble_core.h index ce4008fc301..d19f3023771 100644 --- a/drivers/bluetooth/nble/rpc_functions_to_ble_core.h +++ b/drivers/bluetooth/nble/rpc_functions_to_ble_core.h @@ -57,28 +57,28 @@ #define LIST_FN_SIG_S_B \ FN_SIG_S_B(nble_gatts_register_req, \ const struct nble_gatts_register_req *, \ - uint8_t *, uint16_t) \ + u8_t *, u16_t) \ FN_SIG_S_B(nble_gatts_notify_req, \ const struct nble_gatts_notify_req *, \ - const uint8_t *, uint16_t) \ + const u8_t *, u16_t) \ FN_SIG_S_B(nble_gatts_indicate_req, \ const struct nble_gatts_indicate_req *, \ - const uint8_t *, uint8_t) \ + const u8_t *, u8_t) \ FN_SIG_S_B(nble_gatts_read_reply_req, \ const struct nble_gatts_read_reply_req *, \ - uint8_t *, uint16_t) \ + u8_t *, u16_t) \ FN_SIG_S_B(nble_gattc_write_req, \ const struct nble_gattc_write_req *, \ - const uint8_t *, uint16_t) \ + const u8_t *, u16_t) \ FN_SIG_S_B(nble_gattc_read_multi_req, \ const struct nble_gattc_read_multi_req *, \ - const uint16_t *, uint16_t) \ + const u16_t *, u16_t) \ FN_SIG_S_B(nble_uart_test_req, \ const struct nble_uart_test_req *, \ - const uint8_t *, uint8_t) \ + const u8_t *, u8_t) \ FN_SIG_S_B(nble_gatts_write_reply_req, \ const struct nble_gatts_write_reply_req *, \ - const uint8_t *, uint8_t) + const u8_t *, u8_t) #define LIST_FN_SIG_B_B_P diff --git a/drivers/bluetooth/nble/rpc_functions_to_quark.h b/drivers/bluetooth/nble/rpc_functions_to_quark.h index cb8b25c7f66..2cda5e1e528 100644 --- a/drivers/bluetooth/nble/rpc_functions_to_quark.h +++ b/drivers/bluetooth/nble/rpc_functions_to_quark.h @@ -73,35 +73,35 @@ #define LIST_FN_SIG_S_B \ FN_SIG_S_B(nble_log, const struct nble_log_s *, char *, \ - uint8_t) \ + u8_t) \ FN_SIG_S_B(on_nble_gattc_value_evt, \ const struct nble_gattc_value_evt *, \ - uint8_t *, uint8_t) \ + u8_t *, u8_t) \ FN_SIG_S_B(on_nble_gatts_write_evt, \ const struct nble_gatts_write_evt *, \ - const uint8_t *, uint8_t) \ + const u8_t *, u8_t) \ FN_SIG_S_B(on_nble_gatts_register_rsp, \ const struct nble_gatts_register_rsp *, \ const struct nble_gatt_attr_handles *, \ - uint8_t) \ + u8_t) \ FN_SIG_S_B(on_nble_gattc_discover_rsp, \ const struct nble_gattc_discover_rsp *, \ - const uint8_t *, uint8_t) \ + const u8_t *, u8_t) \ FN_SIG_S_B(on_nble_gap_adv_report_evt, \ const struct nble_gap_adv_report_evt *, \ - const uint8_t *, uint8_t) \ + const u8_t *, u8_t) \ FN_SIG_S_B(on_nble_sm_bond_info_rsp, \ const struct nble_sm_bond_info_rsp *, \ - const bt_addr_le_t *, uint16_t) \ + const bt_addr_le_t *, u16_t) \ FN_SIG_S_B(on_nble_gattc_read_rsp, \ const struct nble_gattc_read_rsp *, \ - uint8_t *, uint8_t) \ + u8_t *, u8_t) \ FN_SIG_S_B(on_nble_gattc_read_multi_rsp, \ const struct nble_gattc_read_rsp *, \ - uint8_t *, uint8_t) \ + u8_t *, u8_t) \ FN_SIG_S_B(on_nble_uart_test_evt, \ const struct nble_uart_test_evt *, \ - const uint8_t *, uint8_t) + const u8_t *, u8_t) #define LIST_FN_SIG_B_B_P diff --git a/drivers/bluetooth/nble/rpc_serialize.c b/drivers/bluetooth/nble/rpc_serialize.c index c65f3312e7f..d05544323d4 100644 --- a/drivers/bluetooth/nble/rpc_serialize.c +++ b/drivers/bluetooth/nble/rpc_serialize.c @@ -177,9 +177,9 @@ LIST_FN_SIG_S_B_B_P hash = DJB2_HASH(hash, sizeof(*((__s)0))); \ } while (0); -uint32_t rpc_serialize_hash(void) +u32_t rpc_serialize_hash(void) { - uint32_t hash = 5381; + u32_t hash = 5381; LIST_FN_SIG_NONE; LIST_FN_SIG_S; @@ -202,19 +202,19 @@ static void _send(struct net_buf *buf) rpc_transmit_cb(buf); } -static uint16_t encoded_structlen(uint8_t structlen) +static u16_t encoded_structlen(u8_t structlen) { return 1 + structlen; } -static void serialize_struct(struct net_buf *buf, const uint8_t *struct_data, - uint8_t struct_length) +static void serialize_struct(struct net_buf *buf, const u8_t *struct_data, + u8_t struct_length) { net_buf_add_u8(buf, struct_length); net_buf_add_mem(buf, struct_data, struct_length); } -static uint16_t encoded_buflen(const uint8_t *buf, uint16_t buflen) +static u16_t encoded_buflen(const u8_t *buf, u16_t buflen) { if (!buf) { return 1; @@ -227,11 +227,11 @@ static uint16_t encoded_buflen(const uint8_t *buf, uint16_t buflen) } } -static void serialize_buf(struct net_buf *buf, const uint8_t *data, - uint16_t len) +static void serialize_buf(struct net_buf *buf, const u8_t *data, + u16_t len) { - uint16_t varint; - uint8_t *p; + u16_t varint; + u8_t *p; if (!data) { len = 0; @@ -255,7 +255,7 @@ static void serialize_p(struct net_buf *buf, void *ptr) net_buf_add_mem(buf, &val, sizeof(val)); } -void rpc_serialize_none(uint8_t fn_index) +void rpc_serialize_none(u8_t fn_index) { struct net_buf *buf; @@ -267,8 +267,8 @@ void rpc_serialize_none(uint8_t fn_index) _send(buf); } -void rpc_serialize_s(uint8_t fn_index, const void *struct_data, - uint8_t struct_length) +void rpc_serialize_s(u8_t fn_index, const void *struct_data, + u8_t struct_length) { struct net_buf *buf; @@ -283,7 +283,7 @@ void rpc_serialize_s(uint8_t fn_index, const void *struct_data, _send(buf); } -void rpc_serialize_p(uint8_t fn_index, void *priv) +void rpc_serialize_p(u8_t fn_index, void *priv) { struct net_buf *buf; @@ -296,9 +296,9 @@ void rpc_serialize_p(uint8_t fn_index, void *priv) _send(buf); } -void rpc_serialize_s_b(uint8_t fn_index, const void *struct_data, - uint8_t struct_length, const void *vbuf, - uint16_t vbuf_length) +void rpc_serialize_s_b(u8_t fn_index, const void *struct_data, + u8_t struct_length, const void *vbuf, + u16_t vbuf_length) { struct net_buf *buf; @@ -315,9 +315,9 @@ void rpc_serialize_s_b(uint8_t fn_index, const void *struct_data, _send(buf); } -void rpc_serialize_b_b_p(uint8_t fn_index, const void *vbuf1, - uint16_t vbuf1_length, const void *vbuf2, - uint16_t vbuf2_length, void *priv) +void rpc_serialize_b_b_p(u8_t fn_index, const void *vbuf1, + u16_t vbuf1_length, const void *vbuf2, + u16_t vbuf2_length, void *priv) { struct net_buf *buf; @@ -335,8 +335,8 @@ void rpc_serialize_b_b_p(uint8_t fn_index, const void *vbuf1, _send(buf); } -void rpc_serialize_s_p(uint8_t fn_index, const void *struct_data, - uint8_t struct_length, void *priv) +void rpc_serialize_s_p(u8_t fn_index, const void *struct_data, + u8_t struct_length, void *priv) { struct net_buf *buf; @@ -352,9 +352,9 @@ void rpc_serialize_s_p(uint8_t fn_index, const void *struct_data, _send(buf); } -void rpc_serialize_s_b_p(uint8_t fn_index, const void *struct_data, - uint8_t struct_length, const void *vbuf, - uint16_t vbuf_length, void *priv) +void rpc_serialize_s_b_p(u8_t fn_index, const void *struct_data, + u8_t struct_length, const void *vbuf, + u16_t vbuf_length, void *priv) { struct net_buf *buf; @@ -372,10 +372,10 @@ void rpc_serialize_s_b_p(uint8_t fn_index, const void *struct_data, _send(buf); } -void rpc_serialize_s_b_b_p(uint8_t fn_index, const void *struct_data, - uint8_t struct_length, const void *vbuf1, - uint16_t vbuf1_length, const void *vbuf2, - uint16_t vbuf2_length, void *priv) +void rpc_serialize_s_b_b_p(u8_t fn_index, const void *struct_data, + u8_t struct_length, const void *vbuf1, + u16_t vbuf1_length, const void *vbuf2, + u16_t vbuf2_length, void *priv) { struct net_buf *buf; @@ -395,13 +395,13 @@ void rpc_serialize_s_b_b_p(uint8_t fn_index, const void *struct_data, _send(buf); } -void rpc_init(uint32_t version) +void rpc_init(u32_t version) { struct net_buf *buf; struct { - uint32_t version; - uint32_t ser_hash; - uint32_t des_hash; + u32_t version; + u32_t ser_hash; + u32_t des_hash; } struct_data; struct_data.version = version; @@ -412,6 +412,6 @@ void rpc_init(uint32_t version) net_buf_add_u8(buf, SIG_TYPE_CONTROL); net_buf_add_u8(buf, 0); - serialize_struct(buf, (uint8_t *)&struct_data, sizeof(struct_data)); + serialize_struct(buf, (u8_t *)&struct_data, sizeof(struct_data)); _send(buf); } diff --git a/drivers/bluetooth/nble/smp.c b/drivers/bluetooth/nble/smp.c index 2d6095b0a20..4475a0e7f3d 100644 --- a/drivers/bluetooth/nble/smp.c +++ b/drivers/bluetooth/nble/smp.c @@ -65,7 +65,7 @@ struct bt_smp { atomic_t flags; /* Type of method used for pairing */ - uint8_t method; + u8_t method; }; static struct bt_smp bt_smp_pool[CONFIG_BLUETOOTH_MAX_CONN]; @@ -121,7 +121,7 @@ void bt_smp_disconnected(struct bt_conn *conn) } /* based on table 2.8 Core Spec 2.3.5.1 Vol. 3 Part H */ -static const uint8_t gen_method_legacy[5 /* remote */][5 /* local */] = { +static const u8_t gen_method_legacy[5 /* remote */][5 /* local */] = { { JUST_WORKS, JUST_WORKS, PASSKEY_INPUT, JUST_WORKS, PASSKEY_INPUT }, { JUST_WORKS, JUST_WORKS, PASSKEY_INPUT, JUST_WORKS, PASSKEY_INPUT }, { PASSKEY_DISPLAY, PASSKEY_DISPLAY, PASSKEY_INPUT, JUST_WORKS, @@ -131,7 +131,7 @@ static const uint8_t gen_method_legacy[5 /* remote */][5 /* local */] = { PASSKEY_ROLE }, }; -static uint8_t get_io_capa(void) +static u8_t get_io_capa(void) { if (!nble.auth) { return BT_SMP_IO_NO_INPUT_OUTPUT; @@ -160,10 +160,10 @@ static uint8_t get_io_capa(void) return BT_SMP_IO_NO_INPUT_OUTPUT; } -static uint8_t legacy_get_pair_method(struct bt_smp *smp, uint8_t remote_io) +static u8_t legacy_get_pair_method(struct bt_smp *smp, u8_t remote_io) { - uint8_t local_io = get_io_capa(); - uint8_t method; + u8_t local_io = get_io_capa(); + u8_t method; if (remote_io > BT_SMP_IO_KEYBOARD_DISPLAY) return JUST_WORKS; @@ -187,7 +187,7 @@ static uint8_t legacy_get_pair_method(struct bt_smp *smp, uint8_t remote_io) return method; } -static uint8_t get_auth(uint8_t auth) +static u8_t get_auth(u8_t auth) { if (get_io_capa() == BT_SMP_IO_NO_INPUT_OUTPUT) { auth &= ~(BT_SMP_AUTH_MITM); @@ -198,7 +198,7 @@ static uint8_t get_auth(uint8_t auth) return auth; } -static uint8_t legacy_pairing_req(struct bt_smp *smp, +static u8_t legacy_pairing_req(struct bt_smp *smp, const struct nble_sec_param *par) { struct nble_sm_pairing_response_req req; @@ -490,7 +490,7 @@ static void nble_security_reply(struct bt_conn *conn, nble_sm_passkey_reply_req(&rsp); } -static int sm_error(struct bt_conn *conn, uint8_t reason) +static int sm_error(struct bt_conn *conn, u8_t reason) { struct nble_sm_passkey params; diff --git a/drivers/bluetooth/nble/uart.c b/drivers/bluetooth/nble/uart.c index ab2476f058b..de2e7c9ab8e 100644 --- a/drivers/bluetooth/nble/uart.c +++ b/drivers/bluetooth/nble/uart.c @@ -33,9 +33,9 @@ * @note this structure must be self-aligned and self-packed */ struct ipc_uart_header { - uint16_t len; /**< Length of IPC message. */ - uint8_t channel; /**< Channel number of IPC message. */ - uint8_t src_cpu_id; /**< CPU id of IPC sender. */ + u16_t len; /**< Length of IPC message. */ + u8_t channel; /**< Channel number of IPC message. */ + u8_t src_cpu_id; /**< CPU id of IPC sender. */ } __packed; /* TODO: check size */ @@ -73,7 +73,7 @@ static void rx_thread(void) } } -struct net_buf *rpc_alloc_cb(uint16_t length) +struct net_buf *rpc_alloc_cb(u16_t length) { struct net_buf *buf; @@ -125,7 +125,7 @@ void rpc_transmit_cb(struct net_buf *buf) static size_t nble_discard(struct device *uart, size_t len) { /* FIXME: correct size for nble */ - uint8_t buf[33]; + u8_t buf[33]; return uart_fifo_read(uart, buf, min(len, sizeof(buf))); } @@ -138,7 +138,7 @@ static void bt_uart_isr(struct device *unused) while (uart_irq_update(nble_dev) && uart_irq_is_pending(nble_dev)) { static struct ipc_uart_header hdr; - static uint8_t hdr_bytes; + static u8_t hdr_bytes; int read; if (!uart_irq_rx_ready(nble_dev)) { @@ -160,7 +160,7 @@ static void bt_uart_isr(struct device *unused) if (hdr_bytes < sizeof(hdr)) { /* Get packet type */ hdr_bytes += uart_fifo_read(nble_dev, - (uint8_t *)&hdr + hdr_bytes, + (u8_t *)&hdr + hdr_bytes, sizeof(hdr) - hdr_bytes); if (hdr_bytes < sizeof(hdr)) { continue; diff --git a/drivers/bluetooth/nrf51_pm.c b/drivers/bluetooth/nrf51_pm.c index 1214693d895..58e69031ef7 100644 --- a/drivers/bluetooth/nrf51_pm.c +++ b/drivers/bluetooth/nrf51_pm.c @@ -32,7 +32,7 @@ int nrf51_allow_sleep(void) int nrf51_init(struct device *dev) { - uint8_t c; + u8_t c; int ret; nrf51_gpio = device_get_binding("GPIO_0"); diff --git a/drivers/bluetooth/util.h b/drivers/bluetooth/util.h index 74bd38dd94a..503800c0a9b 100644 --- a/drivers/bluetooth/util.h +++ b/drivers/bluetooth/util.h @@ -8,7 +8,7 @@ static inline void bt_uart_drain(struct device *dev) { - uint8_t c; + u8_t c; while (uart_fifo_read(dev, &c, 1)) { continue; diff --git a/include/bluetooth/a2dp-codec.h b/include/bluetooth/a2dp-codec.h index c00b8d1fb42..3c0ea3e916b 100644 --- a/include/bluetooth/a2dp-codec.h +++ b/include/bluetooth/a2dp-codec.h @@ -59,11 +59,11 @@ extern "C" { /** @brief SBC Codec */ struct bt_a2dp_codec_sbc_params { /** First two octets of configuration */ - uint8_t config[2]; + u8_t config[2]; /** Minimum Bitpool Value */ - uint8_t min_bitpool; + u8_t min_bitpool; /** Maximum Bitpool Value */ - uint8_t max_bitpool; + u8_t max_bitpool; } __packed; #ifdef __cplusplus diff --git a/include/bluetooth/a2dp.h b/include/bluetooth/a2dp.h index cf66eb74460..f1aaead46ca 100644 --- a/include/bluetooth/a2dp.h +++ b/include/bluetooth/a2dp.h @@ -38,15 +38,15 @@ enum bt_a2dp_codec_id { /** @brief Preset for the endpoint */ struct bt_a2dp_preset { /** Length of preset */ - uint8_t len; + u8_t len; /** Preset */ - uint8_t preset[0]; + u8_t preset[0]; }; /** @brief Stream End Point */ struct bt_a2dp_endpoint { /** Code ID */ - uint8_t codec_id; + u8_t codec_id; /** Stream End Point Information */ struct bt_avdtp_seid_lsep info; /** Pointer to preset codec chosen */ @@ -102,7 +102,7 @@ struct bt_a2dp *bt_a2dp_connect(struct bt_conn *conn); * @return 0 in case of success and error code in case of error. */ int bt_a2dp_register_endpoint(struct bt_a2dp_endpoint *endpoint, - uint8_t media_type, uint8_t role); + u8_t media_type, u8_t role); #ifdef __cplusplus } diff --git a/include/bluetooth/att.h b/include/bluetooth/att.h index 45155f31343..d321c5cf68e 100644 --- a/include/bluetooth/att.h +++ b/include/bluetooth/att.h @@ -41,8 +41,8 @@ extern "C" { #define BT_ATT_ERR_PROCEDURE_IN_PROGRESS 0xfe #define BT_ATT_ERR_OUT_OF_RANGE 0xff -typedef void (*bt_att_func_t)(struct bt_conn *conn, uint8_t err, - const void *pdu, uint16_t length, +typedef void (*bt_att_func_t)(struct bt_conn *conn, u8_t err, + const void *pdu, u16_t length, void *user_data); typedef void (*bt_att_destroy_t)(void *user_data); diff --git a/include/bluetooth/avdtp.h b/include/bluetooth/avdtp.h index feeaae13926..ceb84a85df4 100644 --- a/include/bluetooth/avdtp.h +++ b/include/bluetooth/avdtp.h @@ -17,17 +17,17 @@ extern "C" { /** @brief AVDTP SEID Information */ struct bt_avdtp_seid_info { /** Stream End Point ID */ - uint8_t id:6; + u8_t id:6; /** End Point usage status */ - uint8_t inuse:1; + u8_t inuse:1; /** Reserved */ - uint8_t rfa0:1; + u8_t rfa0:1; /** Media-type of the End Point */ - uint8_t media_type:4; + u8_t media_type:4; /** TSEP of the End Point */ - uint8_t tsep:1; + u8_t tsep:1; /** Reserved */ - uint8_t rfa1:3; + u8_t rfa1:3; } __packed; /** @brief AVDTP Local SEP*/ @@ -43,7 +43,7 @@ struct bt_avdtp_stream { struct bt_l2cap_br_chan chan; /* Transport Channel*/ struct bt_avdtp_seid_info lsep; /* Configured Local SEP */ struct bt_avdtp_seid_info rsep; /* Configured Remote SEP*/ - uint8_t state; /* current state of the stream */ + u8_t state; /* current state of the stream */ struct bt_avdtp_stream *next; }; diff --git a/include/bluetooth/bluetooth.h b/include/bluetooth/bluetooth.h index b0928a588d6..e24e352a19f 100644 --- a/include/bluetooth/bluetooth.h +++ b/include/bluetooth/bluetooth.h @@ -63,9 +63,9 @@ int bt_enable(bt_ready_cb_t cb); * bt_le_adv_start() function. */ struct bt_data { - uint8_t type; - uint8_t data_len; - const uint8_t *data; + u8_t type; + u8_t data_len; + const u8_t *data; }; /** @brief Helper to declare elements of bt_data arrays @@ -81,7 +81,7 @@ struct bt_data { { \ .type = (_type), \ .data_len = (_data_len), \ - .data = (const uint8_t *)(_data), \ + .data = (const u8_t *)(_data), \ } /** @brief Helper to declare elements of bt_data arrays @@ -93,8 +93,8 @@ struct bt_data { * @param _bytes Variable number of single-byte parameters */ #define BT_DATA_BYTES(_type, _bytes...) \ - BT_DATA(_type, ((uint8_t []) { _bytes }), \ - sizeof((uint8_t []) { _bytes })) + BT_DATA(_type, ((u8_t []) { _bytes }), \ + sizeof((u8_t []) { _bytes })) /** Advertising options */ enum { @@ -110,13 +110,13 @@ enum { /** LE Advertising Parameters. */ struct bt_le_adv_param { /** Bit-field of advertising options */ - uint8_t options; + u8_t options; /** Minimum Advertising Interval (N * 0.625) */ - uint16_t interval_min; + u16_t interval_min; /** Maximum Advertising Interval (N * 0.625) */ - uint16_t interval_max; + u16_t interval_max; /** Optional pre-defined (random) own address. Currently * the only permitted use of this is for NRPA with @@ -181,24 +181,24 @@ int bt_le_adv_stop(void); * @param adv_type Type of advertising response from advertiser. * @param data Buffer containig advertiser data. */ -typedef void bt_le_scan_cb_t(const bt_addr_le_t *addr, int8_t rssi, - uint8_t adv_type, struct net_buf_simple *buf); +typedef void bt_le_scan_cb_t(const bt_addr_le_t *addr, s8_t rssi, + u8_t adv_type, struct net_buf_simple *buf); /** LE scan parameters */ struct bt_le_scan_param { /** Scan type (BT_HCI_LE_SCAN_ACTIVE or BT_HCI_LE_SCAN_PASSIVE) */ - uint8_t type; + u8_t type; /** Duplicate filtering (BT_HCI_LE_SCAN_FILTER_DUP_ENABLE or * BT_HCI_LE_SCAN_FILTER_DUP_DISABLE) */ - uint8_t filter_dup; + u8_t filter_dup; /** Scan interval (N * 0.625 ms) */ - uint16_t interval; + u16_t interval; /** Scan window (N * 0.625 ms) */ - uint16_t window; + u16_t window; }; /** Helper to declare scan parameters inline @@ -278,19 +278,19 @@ int bt_le_oob_get_local(struct bt_le_oob *oob); /** @brief BR/EDR discovery result structure */ struct bt_br_discovery_result { /** private */ - uint8_t _priv[4]; + u8_t _priv[4]; /** Remote device address */ bt_addr_t addr; /** RSSI from inquiry */ - int8_t rssi; + s8_t rssi; /** Class of Device */ - uint8_t cod[3]; + u8_t cod[3]; /** Extended Inquiry Response */ - uint8_t eir[240]; + u8_t eir[240]; }; /** @typedef bt_br_discovery_cb_t @@ -312,7 +312,7 @@ struct bt_br_discovery_param { /** Maximum length of the discovery in units of 1.28 seconds. * Valid range is 0x01 - 0x30. */ - uint8_t length; + u8_t length; /** True if limited discovery procedure is to be used. */ bool limited; diff --git a/include/bluetooth/buf.h b/include/bluetooth/buf.h index 1485b87ac4b..c37e04c5228 100644 --- a/include/bluetooth/buf.h +++ b/include/bluetooth/buf.h @@ -50,7 +50,7 @@ enum bt_buf_type { * K_NO_WAIT and K_FOREVER. * @return A new buffer. */ -struct net_buf *bt_buf_get_rx(int32_t timeout); +struct net_buf *bt_buf_get_rx(s32_t timeout); /** Allocate a buffer for an HCI Command Complete/Status Event * @@ -61,7 +61,7 @@ struct net_buf *bt_buf_get_rx(int32_t timeout); * K_NO_WAIT and K_FOREVER. * @return A new buffer. */ -struct net_buf *bt_buf_get_cmd_complete(int32_t timeout); +struct net_buf *bt_buf_get_cmd_complete(s32_t timeout); /** Set the buffer type * @@ -70,7 +70,7 @@ struct net_buf *bt_buf_get_cmd_complete(int32_t timeout); */ static inline void bt_buf_set_type(struct net_buf *buf, enum bt_buf_type type) { - *(uint8_t *)net_buf_user_data(buf) = type; + *(u8_t *)net_buf_user_data(buf) = type; } /** Get the buffer type @@ -81,7 +81,7 @@ static inline void bt_buf_set_type(struct net_buf *buf, enum bt_buf_type type) */ static inline enum bt_buf_type bt_buf_get_type(struct net_buf *buf) { - return *(uint8_t *)net_buf_user_data(buf); + return *(u8_t *)net_buf_user_data(buf); } /** diff --git a/include/bluetooth/conn.h b/include/bluetooth/conn.h index 9a97dbafcc7..28dc5a42cd1 100644 --- a/include/bluetooth/conn.h +++ b/include/bluetooth/conn.h @@ -31,10 +31,10 @@ struct bt_conn; /** Connection parameters for LE connections */ struct bt_le_conn_param { - uint16_t interval_min; - uint16_t interval_max; - uint16_t latency; - uint16_t timeout; + u16_t interval_min; + u16_t interval_max; + u16_t latency; + u16_t timeout; }; /** Helper to declare connection parameters inline @@ -113,9 +113,9 @@ enum { struct bt_conn_le_info { const bt_addr_le_t *src; /** Source Address */ const bt_addr_le_t *dst; /** Destination Address */ - uint16_t interval; /** Connection interval */ - uint16_t latency; /** Connection slave latency */ - uint16_t timeout; /** Connection supervision timeout */ + u16_t interval; /** Connection interval */ + u16_t latency; /** Connection slave latency */ + u16_t timeout; /** Connection supervision timeout */ }; /** BR/EDR Connection Info Structure */ @@ -138,9 +138,9 @@ enum { * @param br BR/EDR Connection specific Info */ struct bt_conn_info { - uint8_t type; + u8_t type; - uint8_t role; + u8_t role; union { struct bt_conn_le_info le; @@ -178,7 +178,7 @@ int bt_conn_le_param_update(struct bt_conn *conn, * * @return Zero on success or (negative) error code on failure. */ -int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason); +int bt_conn_disconnect(struct bt_conn *conn, u8_t reason); /** @brief Initiate an LE connection to a remote device. * @@ -276,7 +276,7 @@ int bt_conn_security(struct bt_conn *conn, bt_security_t sec); * * @return Encryption key size. */ -uint8_t bt_conn_enc_key_size(struct bt_conn *conn); +u8_t bt_conn_enc_key_size(struct bt_conn *conn); /** @brief Connection callback structure. * @@ -298,7 +298,7 @@ struct bt_conn_cb { * @param conn New connection object. * @param err HCI error. Zero for success, non-zero otherwise. */ - void (*connected)(struct bt_conn *conn, uint8_t err); + void (*connected)(struct bt_conn *conn, u8_t err); /** @brief A connection has been disconnected. * @@ -308,7 +308,7 @@ struct bt_conn_cb { * @param conn Connection object. * @param reason HCI reason for the disconnection. */ - void (*disconnected)(struct bt_conn *conn, uint8_t reason); + void (*disconnected)(struct bt_conn *conn, u8_t reason); /** @brief LE connection parameter update request. * @@ -344,8 +344,8 @@ struct bt_conn_cb { * @param latency Connection latency. * @param timeout Connection supervision timeout. */ - void (*le_param_updated)(struct bt_conn *conn, uint16_t interval, - uint16_t latency, uint16_t timeout); + void (*le_param_updated)(struct bt_conn *conn, u16_t interval, + u16_t latency, u16_t timeout); #if defined(CONFIG_BLUETOOTH_SMP) /** @brief Remote Identity Address has been resolved. * diff --git a/include/bluetooth/crypto.h b/include/bluetooth/crypto.h index fb7f4e1d1a9..8ee807ff84d 100644 --- a/include/bluetooth/crypto.h +++ b/include/bluetooth/crypto.h @@ -49,8 +49,8 @@ int bt_rand(void *buf, size_t len); * * @return Zero on success or error code otherwise. */ -int bt_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16], - uint8_t enc_data[16]); +int bt_encrypt_le(const u8_t key[16], const u8_t plaintext[16], + u8_t enc_data[16]); /** @brief AES encrypt big-endian data. * @@ -64,8 +64,8 @@ int bt_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16], * * @return Zero on success or error code otherwise. */ -int bt_encrypt_be(const uint8_t key[16], const uint8_t plaintext[16], - uint8_t enc_data[16]); +int bt_encrypt_be(const u8_t key[16], const u8_t plaintext[16], + u8_t enc_data[16]); #ifdef __cplusplus } diff --git a/include/bluetooth/gatt.h b/include/bluetooth/gatt.h index 55c52fc3e15..56877587fe2 100644 --- a/include/bluetooth/gatt.h +++ b/include/bluetooth/gatt.h @@ -111,8 +111,8 @@ struct bt_gatt_attr { */ ssize_t (*read)(struct bt_conn *conn, const struct bt_gatt_attr *attr, - void *buf, uint16_t len, - uint16_t offset); + void *buf, u16_t len, + u16_t offset); /** Attribute write callback * @@ -128,15 +128,15 @@ struct bt_gatt_attr { */ ssize_t (*write)(struct bt_conn *conn, const struct bt_gatt_attr *attr, - const void *buf, uint16_t len, - uint16_t offset, uint8_t flags); + const void *buf, u16_t len, + u16_t offset, u8_t flags); /** Attribute user data */ void *user_data; /** Attribute handle */ - uint16_t handle; + u16_t handle; /** Attribute permissions */ - uint8_t perm; + u8_t perm; #if defined(CONFIG_BLUETOOTH_GATT_DYNAMIC_DB) sys_snode_t node; #endif /* CONFIG_BLUETOOTH_GATT_DYNAMIC_DB */ @@ -147,7 +147,7 @@ struct bt_gatt_service { /** Service UUID. */ const struct bt_uuid *uuid; /** Service end handle. */ - uint16_t end_handle; + u16_t end_handle; }; /** @brief Include Attribute Value. */ @@ -155,9 +155,9 @@ struct bt_gatt_include { /** Service UUID. */ const struct bt_uuid *uuid; /** Service start handle. */ - uint16_t start_handle; + u16_t start_handle; /** Service end handle. */ - uint16_t end_handle; + u16_t end_handle; }; /* Characteristic Properties Bit field values */ @@ -219,7 +219,7 @@ struct bt_gatt_chrc { /** Characteristic UUID. */ const struct bt_uuid *uuid; /** Characteristic properties. */ - uint8_t properties; + u8_t properties; }; /* Characteristic Extended Properties Bit field values */ @@ -229,7 +229,7 @@ struct bt_gatt_chrc { /** @brief Characteristic Extended Properties Attribute Value. */ struct bt_gatt_cep { /** Characteristic Extended properties */ - uint16_t properties; + u16_t properties; }; /* Client Characteristic Configuration Values */ @@ -250,21 +250,21 @@ struct bt_gatt_cep { /* Client Characteristic Configuration Attribute Value */ struct bt_gatt_ccc { /** Client Characteristic Configuration flags */ - uint16_t flags; + u16_t flags; }; /** @brief GATT Characteristic Presentation Format Attribute Value. */ struct bt_gatt_cpf { /** Format of the value of the characteristic */ - uint8_t format; + u8_t format; /** Exponent field to determine how the value of this characteristic is further formatted */ - int8_t exponent; + s8_t exponent; /** Unit of the characteristic */ - uint16_t unit; + u16_t unit; /** Name space of the description */ - uint8_t name_space; + u8_t name_space; /** Description of the characteristic as defined in a higher layer profile */ - uint16_t description; + u16_t description; } __packed; /* Server API */ @@ -296,7 +296,7 @@ enum { * @return BT_GATT_ITER_CONTINUE if should continue to the next attribute * or BT_GATT_ITER_STOP to stop. */ -typedef uint8_t (*bt_gatt_attr_func_t)(const struct bt_gatt_attr *attr, +typedef u8_t (*bt_gatt_attr_func_t)(const struct bt_gatt_attr *attr, void *user_data); /** @brief Attribute iterator. @@ -308,7 +308,7 @@ typedef uint8_t (*bt_gatt_attr_func_t)(const struct bt_gatt_attr *attr, * @param func Callback function. * @param user_data Data to pass to the callback. */ -void bt_gatt_foreach_attr(uint16_t start_handle, uint16_t end_handle, +void bt_gatt_foreach_attr(u16_t start_handle, u16_t end_handle, bt_gatt_attr_func_t func, void *user_data); /** @brief Iterate to the next attribute @@ -337,8 +337,8 @@ struct bt_gatt_attr *bt_gatt_attr_next(const struct bt_gatt_attr *attr); * case of error. */ ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr, - void *buf, uint16_t buf_len, uint16_t offset, - const void *value, uint16_t value_len); + void *buf, u16_t buf_len, u16_t offset, + const void *value, u16_t value_len); /** @brief Read Service Attribute helper. * @@ -357,7 +357,7 @@ ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr, */ ssize_t bt_gatt_attr_read_service(struct bt_conn *conn, const struct bt_gatt_attr *attr, - void *buf, uint16_t len, uint16_t offset); + void *buf, u16_t len, u16_t offset); /** @def BT_GATT_SERVICE * @brief Generic Service Declaration Macro. @@ -422,7 +422,7 @@ ssize_t bt_gatt_attr_read_service(struct bt_conn *conn, */ ssize_t bt_gatt_attr_read_included(struct bt_conn *conn, const struct bt_gatt_attr *attr, - void *buf, uint16_t len, uint16_t offset); + void *buf, u16_t len, u16_t offset); /** @def BT_GATT_INCLUDE_SERVICE * @brief Include Service Declaration Macro. @@ -456,7 +456,7 @@ ssize_t bt_gatt_attr_read_included(struct bt_conn *conn, */ ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset); + u16_t len, u16_t offset); /** @def BT_GATT_CHARACTERISTIC * @brief Characteristic Declaration Macro. @@ -480,18 +480,18 @@ struct bt_gatt_ccc_cfg { /** Config peer address. */ bt_addr_le_t peer; /** Config peer value. */ - uint16_t value; + u16_t value; /** Config valid flag. */ - uint8_t valid; + u8_t valid; }; /* Internal representation of CCC value */ struct _bt_gatt_ccc { struct bt_gatt_ccc_cfg *cfg; size_t cfg_len; - uint16_t value; + u16_t value; void (*cfg_changed)(const struct bt_gatt_attr *attr, - uint16_t value); + u16_t value); }; /** @brief Read Client Characteristic Configuration Attribute helper. @@ -511,7 +511,7 @@ struct _bt_gatt_ccc { */ ssize_t bt_gatt_attr_read_ccc(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset); + u16_t len, u16_t offset); /** @brief Write Client Characteristic Configuration Attribute helper. * @@ -530,7 +530,7 @@ ssize_t bt_gatt_attr_read_ccc(struct bt_conn *conn, */ ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, - uint16_t len, uint16_t offset, uint8_t flags); + u16_t len, u16_t offset, u8_t flags); /** @def BT_GATT_CCC * @brief Client Characteristic Configuration Declaration Macro. @@ -568,7 +568,7 @@ ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn, */ ssize_t bt_gatt_attr_read_cep(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset); + u16_t len, u16_t offset); /** @def BT_GATT_CEP * @brief Characteristic Extended Properties Declaration Macro. @@ -602,7 +602,7 @@ ssize_t bt_gatt_attr_read_cep(struct bt_conn *conn, */ ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset); + u16_t len, u16_t offset); /** @def BT_GATT_CUD * @brief Characteristic User Format Descriptor Declaration Macro. @@ -637,7 +637,7 @@ ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn, */ ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset); + u16_t len, u16_t offset); /** @def BT_GATT_CPF * @brief Characteristic Presentation Format Descriptor Declaration Macro. @@ -686,7 +686,7 @@ ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn, * @param len Attribute value length. */ int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr, - const void *data, uint16_t len); + const void *data, u16_t len); /** @typedef bt_gatt_indicate_func_t * @brief Indication complete result callback. @@ -697,7 +697,7 @@ int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr, */ typedef void (*bt_gatt_indicate_func_t)(struct bt_conn *conn, const struct bt_gatt_attr *attr, - uint8_t err); + u8_t err); /** @brief GATT Indicate Value parameters */ struct bt_gatt_indicate_params { @@ -709,7 +709,7 @@ struct bt_gatt_indicate_params { /** Indicate Value data*/ const void *data; /** Indicate Value length*/ - uint16_t len; + u16_t len; }; /** @brief Indicate attribute value change. @@ -738,7 +738,7 @@ int bt_gatt_indicate(struct bt_conn *conn, * * @return MTU in bytes */ -uint16_t bt_gatt_get_mtu(struct bt_conn *conn); +u16_t bt_gatt_get_mtu(struct bt_conn *conn); /* Client API */ @@ -746,7 +746,7 @@ uint16_t bt_gatt_get_mtu(struct bt_conn *conn); struct bt_gatt_exchange_params { struct bt_att_req _req; /** Response callback */ - void (*func)(struct bt_conn *conn, uint8_t err, + void (*func)(struct bt_conn *conn, u8_t err, struct bt_gatt_exchange_params *params); }; @@ -782,7 +782,7 @@ struct bt_gatt_discover_params; * @return BT_GATT_ITER_CONTINUE if should continue attribute discovery * or BT_GATT_ITER_STOP to stop discovery procedure. */ -typedef uint8_t (*bt_gatt_discover_func_t)(struct bt_conn *conn, +typedef u8_t (*bt_gatt_discover_func_t)(struct bt_conn *conn, const struct bt_gatt_attr *attr, struct bt_gatt_discover_params *params); @@ -804,19 +804,19 @@ struct bt_gatt_discover_params { union { struct { /** Include service attribute declaration handle */ - uint16_t attr_handle; + u16_t attr_handle; /** Included service start handle */ - uint16_t start_handle; + u16_t start_handle; /** Included service end handle */ - uint16_t end_handle; + u16_t end_handle; } _included; /** Discover start handle */ - uint16_t start_handle; + u16_t start_handle; }; /** Discover end handle */ - uint16_t end_handle; + u16_t end_handle; /** Discover type */ - uint8_t type; + u8_t type; }; /** @brief GATT Discover function @@ -858,9 +858,9 @@ struct bt_gatt_read_params; * @param data Attribute value data. NULL means read has completed. * @param length Attribute value length. */ -typedef uint8_t (*bt_gatt_read_func_t)(struct bt_conn *conn, uint8_t err, +typedef u8_t (*bt_gatt_read_func_t)(struct bt_conn *conn, u8_t err, struct bt_gatt_read_params *params, - const void *data, uint16_t length); + const void *data, u16_t length); /** @brief GATT Read parameters * @param func Read attribute callback @@ -877,10 +877,10 @@ struct bt_gatt_read_params { size_t handle_count; union { struct __single { - uint16_t handle; - uint16_t offset; + u16_t handle; + u16_t offset; } single; - uint16_t *handles; + u16_t *handles; }; }; @@ -907,7 +907,7 @@ struct bt_gatt_write_params; * @param err ATT error code. * @param params Write parameters used. */ -typedef void (*bt_gatt_write_func_t)(struct bt_conn *conn, uint8_t err, +typedef void (*bt_gatt_write_func_t)(struct bt_conn *conn, u8_t err, struct bt_gatt_write_params *params); /** @brief GATT Write parameters */ @@ -916,13 +916,13 @@ struct bt_gatt_write_params { /** Response callback */ bt_gatt_write_func_t func; /** Attribute handle */ - uint16_t handle; + u16_t handle; /** Attribute data offset */ - uint16_t offset; + u16_t offset; /** Data to be written */ const void *data; /** Length of the data */ - uint16_t length; + u16_t length; }; /** @brief Write Attribute Value by handle @@ -953,8 +953,8 @@ int bt_gatt_write(struct bt_conn *conn, struct bt_gatt_write_params *params); * * @return 0 in case of success or negative value in case of error. */ -int bt_gatt_write_without_response(struct bt_conn *conn, uint16_t handle, - const void *data, uint16_t length, +int bt_gatt_write_without_response(struct bt_conn *conn, u16_t handle, + const void *data, u16_t length, bool sign); struct bt_gatt_subscribe_params; @@ -967,9 +967,9 @@ struct bt_gatt_subscribe_params; * @param data Attribute value data. If NULL then subscription was removed. * @param length Attribute value length. */ -typedef uint8_t (*bt_gatt_notify_func_t)(struct bt_conn *conn, +typedef u8_t (*bt_gatt_notify_func_t)(struct bt_conn *conn, struct bt_gatt_subscribe_params *params, - const void *data, uint16_t length); + const void *data, u16_t length); /* Subscription flags */ enum { @@ -992,13 +992,13 @@ struct bt_gatt_subscribe_params { /** Notification value callback */ bt_gatt_notify_func_t notify; /** Subscribe value handle */ - uint16_t value_handle; + u16_t value_handle; /** Subscribe CCC handle */ - uint16_t ccc_handle; + u16_t ccc_handle; /** Subscribe value */ - uint16_t value; + u16_t value; /** Subscription flags */ - uint8_t flags; + u8_t flags; sys_snode_t node; }; diff --git a/include/bluetooth/hci.h b/include/bluetooth/hci.h index a34d202c145..23c01cce3ec 100644 --- a/include/bluetooth/hci.h +++ b/include/bluetooth/hci.h @@ -24,11 +24,11 @@ extern "C" { #define BT_ADDR_LE_RANDOM_ID 0x03 typedef struct { - uint8_t val[6]; + u8_t val[6]; } bt_addr_t; typedef struct { - uint8_t type; + u8_t type; bt_addr_t a; } bt_addr_le_t; @@ -131,8 +131,8 @@ static inline bool bt_addr_le_is_identity(const bt_addr_le_t *addr) #define BT_LE_AD_NO_BREDR 0x04 /* BR/EDR not supported */ struct bt_hci_evt_hdr { - uint8_t evt; - uint8_t len; + u8_t evt; + u8_t len; } __packed; #define BT_HCI_EVT_HDR_SIZE 2 @@ -145,14 +145,14 @@ struct bt_hci_evt_hdr { #define bt_acl_handle_pack(h, f) ((h) | ((f) << 12)) struct bt_hci_acl_hdr { - uint16_t handle; - uint16_t len; + u16_t handle; + u16_t len; } __packed; #define BT_HCI_ACL_HDR_SIZE 4 struct bt_hci_cmd_hdr { - uint16_t opcode; - uint8_t param_len; + u16_t opcode; + u8_t param_len; } __packed; #define BT_HCI_CMD_HDR_SIZE 3 @@ -296,9 +296,9 @@ struct bt_hci_cmd_hdr { #define BT_HCI_OP_INQUIRY BT_OP(BT_OGF_LINK_CTRL, 0x0001) struct bt_hci_op_inquiry { - uint8_t lap[3]; - uint8_t length; - uint8_t num_rsp; + u8_t lap[3]; + u8_t length; + u8_t num_rsp; } __packed; #define BT_HCI_OP_INQUIRY_CANCEL BT_OP(BT_OGF_LINK_CTRL, 0x0002) @@ -306,17 +306,17 @@ struct bt_hci_op_inquiry { #define BT_HCI_OP_CONNECT BT_OP(BT_OGF_LINK_CTRL, 0x0005) struct bt_hci_cp_connect { bt_addr_t bdaddr; - uint16_t packet_type; - uint8_t pscan_rep_mode; - uint8_t reserved; - uint16_t clock_offset; - uint8_t allow_role_switch; + u16_t packet_type; + u8_t pscan_rep_mode; + u8_t reserved; + u16_t clock_offset; + u8_t allow_role_switch; } __packed; #define BT_HCI_OP_DISCONNECT BT_OP(BT_OGF_LINK_CTRL, 0x0006) struct bt_hci_cp_disconnect { - uint16_t handle; - uint8_t reason; + u16_t handle; + u8_t reason; } __packed; #define BT_HCI_OP_CONNECT_CANCEL BT_OP(BT_OGF_LINK_CTRL, 0x0008) @@ -324,48 +324,48 @@ struct bt_hci_cp_connect_cancel { bt_addr_t bdaddr; } __packed; struct bt_hci_rp_connect_cancel { - uint8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; #define BT_HCI_OP_ACCEPT_CONN_REQ BT_OP(BT_OGF_LINK_CTRL, 0x0009) struct bt_hci_cp_accept_conn_req { bt_addr_t bdaddr; - uint8_t role; + u8_t role; } __packed; #define BT_HCI_OP_SETUP_SYNC_CONN BT_OP(BT_OGF_LINK_CTRL, 0x0028) struct bt_hci_cp_setup_sync_conn { - uint16_t handle; - uint32_t tx_bandwidth; - uint32_t rx_bandwidth; - uint16_t max_latency; - uint16_t content_format; - uint8_t retrans_effort; - uint16_t pkt_type; + u16_t handle; + u32_t tx_bandwidth; + u32_t rx_bandwidth; + u16_t max_latency; + u16_t content_format; + u8_t retrans_effort; + u16_t pkt_type; } __packed; #define BT_HCI_OP_ACCEPT_SYNC_CONN_REQ BT_OP(BT_OGF_LINK_CTRL, 0x0029) struct bt_hci_cp_accept_sync_conn_req { bt_addr_t bdaddr; - uint32_t tx_bandwidth; - uint32_t rx_bandwidth; - uint16_t max_latency; - uint16_t content_format; - uint8_t retrans_effort; - uint16_t pkt_type; + u32_t tx_bandwidth; + u32_t rx_bandwidth; + u16_t max_latency; + u16_t content_format; + u8_t retrans_effort; + u16_t pkt_type; } __packed; #define BT_HCI_OP_REJECT_CONN_REQ BT_OP(BT_OGF_LINK_CTRL, 0x000a) struct bt_hci_cp_reject_conn_req { bt_addr_t bdaddr; - uint8_t reason; + u8_t reason; } __packed; #define BT_HCI_OP_LINK_KEY_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x000b) struct bt_hci_cp_link_key_reply { bt_addr_t bdaddr; - uint8_t link_key[16]; + u8_t link_key[16]; } __packed; #define BT_HCI_OP_LINK_KEY_NEG_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x000c) @@ -376,11 +376,11 @@ struct bt_hci_cp_link_key_neg_reply { #define BT_HCI_OP_PIN_CODE_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x000d) struct bt_hci_cp_pin_code_reply { bt_addr_t bdaddr; - uint8_t pin_len; - uint8_t pin_code[16]; + u8_t pin_len; + u8_t pin_code[16]; } __packed; struct bt_hci_rp_pin_code_reply { - uint8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; @@ -389,27 +389,27 @@ struct bt_hci_cp_pin_code_neg_reply { bt_addr_t bdaddr; } __packed; struct bt_hci_rp_pin_code_neg_reply { - uint8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; #define BT_HCI_OP_AUTH_REQUESTED BT_OP(BT_OGF_LINK_CTRL, 0x0011) struct bt_hci_cp_auth_requested { - uint16_t handle; + u16_t handle; } __packed; #define BT_HCI_OP_SET_CONN_ENCRYPT BT_OP(BT_OGF_LINK_CTRL, 0x0013) struct bt_hci_cp_set_conn_encrypt { - uint16_t handle; - uint8_t encrypt; + u16_t handle; + u8_t encrypt; } __packed; #define BT_HCI_OP_REMOTE_NAME_REQUEST BT_OP(BT_OGF_LINK_CTRL, 0x0019) struct bt_hci_cp_remote_name_request { bt_addr_t bdaddr; - uint8_t pscan_rep_mode; - uint8_t reserved; - uint16_t clock_offset; + u8_t pscan_rep_mode; + u8_t reserved; + u16_t clock_offset; } __packed; #define BT_HCI_OP_REMOTE_NAME_CANCEL BT_OP(BT_OGF_LINK_CTRL, 0x001a) @@ -417,32 +417,32 @@ struct bt_hci_cp_remote_name_cancel { bt_addr_t bdaddr; } __packed; struct bt_hci_rp_remote_name_cancel { - uint8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; #define BT_HCI_OP_READ_REMOTE_FEATURES BT_OP(BT_OGF_LINK_CTRL, 0x001b) struct bt_hci_cp_read_remote_features { - uint16_t handle; + u16_t handle; } __packed; #define BT_HCI_OP_READ_REMOTE_EXT_FEATURES BT_OP(BT_OGF_LINK_CTRL, 0x001c) struct bt_hci_cp_read_remote_ext_features { - uint16_t handle; - uint8_t page; + u16_t handle; + u8_t page; } __packed; #define BT_HCI_OP_READ_REMOTE_VERSION_INFO BT_OP(BT_OGF_LINK_CTRL, 0x001d) struct bt_hci_cp_read_remote_version_info { - uint16_t handle; + u16_t handle; } __packed; #define BT_HCI_OP_IO_CAPABILITY_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002b) struct bt_hci_cp_io_capability_reply { bt_addr_t bdaddr; - uint8_t capability; - uint8_t oob_data; - uint8_t authentication; + u8_t capability; + u8_t oob_data; + u8_t authentication; } __packed; #define BT_HCI_OP_USER_CONFIRM_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002c) @@ -451,14 +451,14 @@ struct bt_hci_cp_user_confirm_reply { bt_addr_t bdaddr; } __packed; struct bt_hci_rp_user_confirm_reply { - uint8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; #define BT_HCI_OP_USER_PASSKEY_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002e) struct bt_hci_cp_user_passkey_reply { bt_addr_t bdaddr; - uint32_t passkey; + u32_t passkey; } __packed; #define BT_HCI_OP_USER_PASSKEY_NEG_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002f) @@ -469,19 +469,19 @@ struct bt_hci_cp_user_passkey_neg_reply { #define BT_HCI_OP_IO_CAPABILITY_NEG_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x0034) struct bt_hci_cp_io_capability_neg_reply { bt_addr_t bdaddr; - uint8_t reason; + u8_t reason; } __packed; #define BT_HCI_OP_SET_EVENT_MASK BT_OP(BT_OGF_BASEBAND, 0x0001) struct bt_hci_cp_set_event_mask { - uint8_t events[8]; + u8_t events[8]; } __packed; #define BT_HCI_OP_RESET BT_OP(BT_OGF_BASEBAND, 0x0003) #define BT_HCI_OP_WRITE_LOCAL_NAME BT_OP(BT_OGF_BASEBAND, 0x0013) struct bt_hci_write_local_name { - uint8_t local_name[248]; + u8_t local_name[248]; } __packed; #define BT_HCI_OP_WRITE_PAGE_TIMEOUT BT_OP(BT_OGF_BASEBAND, 0x0018) @@ -496,42 +496,42 @@ struct bt_hci_write_local_name { #define BT_HCI_OP_HOST_BUFFER_SIZE BT_OP(BT_OGF_BASEBAND, 0x0033) struct bt_hci_cp_host_buffer_size { - uint16_t acl_mtu; - uint8_t sco_mtu; - uint16_t acl_pkts; - uint16_t sco_pkts; + u16_t acl_mtu; + u8_t sco_mtu; + u16_t acl_pkts; + u16_t sco_pkts; } __packed; struct bt_hci_handle_count { - uint16_t handle; - uint16_t count; + u16_t handle; + u16_t count; } __packed; #define BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS BT_OP(BT_OGF_BASEBAND, 0x0035) struct bt_hci_cp_host_num_completed_packets { - uint8_t num_handles; + u8_t num_handles; struct bt_hci_handle_count h[0]; } __packed; #define BT_HCI_OP_WRITE_INQUIRY_MODE BT_OP(BT_OGF_BASEBAND, 0x0045) struct bt_hci_cp_write_inquiry_mode { - uint8_t mode; + u8_t mode; } __packed; #define BT_HCI_OP_WRITE_SSP_MODE BT_OP(BT_OGF_BASEBAND, 0x0056) struct bt_hci_cp_write_ssp_mode { - uint8_t mode; + u8_t mode; } __packed; #define BT_HCI_OP_LE_WRITE_LE_HOST_SUPP BT_OP(BT_OGF_BASEBAND, 0x006d) struct bt_hci_cp_write_le_host_supp { - uint8_t le; - uint8_t simul; + u8_t le; + u8_t simul; } __packed; #define BT_HCI_OP_WRITE_SC_HOST_SUPP BT_OP(BT_OGF_BASEBAND, 0x007a) struct bt_hci_cp_write_sc_host_supp { - uint8_t sc_support; + u8_t sc_support; } __packed; /* HCI version from Assigned Numbers */ @@ -548,80 +548,80 @@ struct bt_hci_cp_write_sc_host_supp { #define BT_HCI_OP_READ_LOCAL_VERSION_INFO BT_OP(BT_OGF_INFO, 0x0001) struct bt_hci_rp_read_local_version_info { - uint8_t status; - uint8_t hci_version; - uint16_t hci_revision; - uint8_t lmp_version; - uint16_t manufacturer; - uint16_t lmp_subversion; + u8_t status; + u8_t hci_version; + u16_t hci_revision; + u8_t lmp_version; + u16_t manufacturer; + u16_t lmp_subversion; } __packed; #define BT_HCI_OP_READ_SUPPORTED_COMMANDS BT_OP(BT_OGF_INFO, 0x0002) struct bt_hci_rp_read_supported_commands { - uint8_t status; - uint8_t commands[64]; + u8_t status; + u8_t commands[64]; } __packed; #define BT_HCI_OP_READ_LOCAL_EXT_FEATURES BT_OP(BT_OGF_INFO, 0x0004) struct bt_hci_cp_read_local_ext_features { - uint8_t page; + u8_t page; }; struct bt_hci_rp_read_local_ext_features { - uint8_t status; - uint8_t page; - uint8_t max_page; - uint8_t ext_features[8]; + u8_t status; + u8_t page; + u8_t max_page; + u8_t ext_features[8]; } __packed; #define BT_HCI_OP_READ_LOCAL_FEATURES BT_OP(BT_OGF_INFO, 0x0003) struct bt_hci_rp_read_local_features { - uint8_t status; - uint8_t features[8]; + u8_t status; + u8_t features[8]; } __packed; #define BT_HCI_OP_READ_BUFFER_SIZE BT_OP(BT_OGF_INFO, 0x0005) struct bt_hci_rp_read_buffer_size { - uint8_t status; - uint16_t acl_max_len; - uint8_t sco_max_len; - uint16_t acl_max_num; - uint16_t sco_max_num; + u8_t status; + u16_t acl_max_len; + u8_t sco_max_len; + u16_t acl_max_num; + u16_t sco_max_num; } __packed; #define BT_HCI_OP_READ_BD_ADDR BT_OP(BT_OGF_INFO, 0x0009) struct bt_hci_rp_read_bd_addr { - uint8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; #define BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE BT_OP(BT_OGF_STATUS, 0x0008) struct bt_hci_cp_read_encryption_key_size { - uint16_t handle; + u16_t handle; } __packed; struct bt_hci_rp_read_encryption_key_size { - uint8_t status; - uint16_t handle; - uint8_t key_size; + u8_t status; + u16_t handle; + u8_t key_size; } __packed; /* BLE */ #define BT_HCI_OP_LE_SET_EVENT_MASK BT_OP(BT_OGF_LE, 0x0001) struct bt_hci_cp_le_set_event_mask { - uint8_t events[8]; + u8_t events[8]; } __packed; #define BT_HCI_OP_LE_READ_BUFFER_SIZE BT_OP(BT_OGF_LE, 0x0002) struct bt_hci_rp_le_read_buffer_size { - uint8_t status; - uint16_t le_max_len; - uint8_t le_max_num; + u8_t status; + u16_t le_max_len; + u8_t le_max_num; } __packed; #define BT_HCI_OP_LE_READ_LOCAL_FEATURES BT_OP(BT_OGF_LE, 0x0003) struct bt_hci_rp_le_read_local_features { - uint8_t status; - uint8_t features[8]; + u8_t status; + u8_t features[8]; } __packed; #define BT_HCI_OP_LE_SET_RANDOM_ADDRESS BT_OP(BT_OGF_LE, 0x0005) @@ -640,31 +640,31 @@ struct bt_hci_cp_le_set_random_address { #define BT_HCI_OP_LE_SET_ADV_PARAM BT_OP(BT_OGF_LE, 0x0006) struct bt_hci_cp_le_set_adv_param { - uint16_t min_interval; - uint16_t max_interval; - uint8_t type; - uint8_t own_addr_type; + u16_t min_interval; + u16_t max_interval; + u8_t type; + u8_t own_addr_type; bt_addr_le_t direct_addr; - uint8_t channel_map; - uint8_t filter_policy; + u8_t channel_map; + u8_t filter_policy; } __packed; #define BT_HCI_OP_LE_READ_ADV_CHAN_TX_POWER BT_OP(BT_OGF_LE, 0x0007) struct bt_hci_rp_le_read_chan_tx_power { - uint8_t status; - int8_t tx_power_level; + u8_t status; + s8_t tx_power_level; } __packed; #define BT_HCI_OP_LE_SET_ADV_DATA BT_OP(BT_OGF_LE, 0x0008) struct bt_hci_cp_le_set_adv_data { - uint8_t len; - uint8_t data[31]; + u8_t len; + u8_t data[31]; } __packed; #define BT_HCI_OP_LE_SET_SCAN_RSP_DATA BT_OP(BT_OGF_LE, 0x0009) struct bt_hci_cp_le_set_scan_rsp_data { - uint8_t len; - uint8_t data[31]; + u8_t len; + u8_t data[31]; } __packed; #define BT_HCI_LE_ADV_DISABLE 0x00 @@ -672,7 +672,7 @@ struct bt_hci_cp_le_set_scan_rsp_data { #define BT_HCI_OP_LE_SET_ADV_ENABLE BT_OP(BT_OGF_LE, 0x000a) struct bt_hci_cp_le_set_adv_enable { - uint8_t enable; + u8_t enable; } __packed; /* Scan types */ @@ -681,11 +681,11 @@ struct bt_hci_cp_le_set_adv_enable { #define BT_HCI_LE_SCAN_ACTIVE 0x01 struct bt_hci_cp_le_set_scan_param { - uint8_t scan_type; - uint16_t interval; - uint16_t window; - uint8_t addr_type; - uint8_t filter_policy; + u8_t scan_type; + u16_t interval; + u16_t window; + u8_t addr_type; + u8_t filter_policy; } __packed; #define BT_HCI_OP_LE_SET_SCAN_ENABLE BT_OP(BT_OGF_LE, 0x000c) @@ -697,31 +697,31 @@ struct bt_hci_cp_le_set_scan_param { #define BT_HCI_LE_SCAN_FILTER_DUP_ENABLE 0x01 struct bt_hci_cp_le_set_scan_enable { - uint8_t enable; - uint8_t filter_dup; + u8_t enable; + u8_t filter_dup; } __packed; #define BT_HCI_OP_LE_CREATE_CONN BT_OP(BT_OGF_LE, 0x000d) struct bt_hci_cp_le_create_conn { - uint16_t scan_interval; - uint16_t scan_window; - uint8_t filter_policy; + u16_t scan_interval; + u16_t scan_window; + u8_t filter_policy; bt_addr_le_t peer_addr; - uint8_t own_addr_type; - uint16_t conn_interval_min; - uint16_t conn_interval_max; - uint16_t conn_latency; - uint16_t supervision_timeout; - uint16_t min_ce_len; - uint16_t max_ce_len; + u8_t own_addr_type; + u16_t conn_interval_min; + u16_t conn_interval_max; + u16_t conn_latency; + u16_t supervision_timeout; + u16_t min_ce_len; + u16_t max_ce_len; } __packed; #define BT_HCI_OP_LE_CREATE_CONN_CANCEL BT_OP(BT_OGF_LE, 0x000e) #define BT_HCI_OP_LE_READ_WL_SIZE BT_OP(BT_OGF_LE, 0x000f) struct bt_hci_rp_le_read_wl_size { - uint8_t status; - uint8_t wl_size; + u8_t status; + u8_t wl_size; } __packed; #define BT_HCI_OP_LE_CLEAR_WL BT_OP(BT_OGF_LE, 0x0010) @@ -738,163 +738,163 @@ struct bt_hci_cp_le_rem_dev_from_wl { #define BT_HCI_OP_LE_CONN_UPDATE BT_OP(BT_OGF_LE, 0x0013) struct hci_cp_le_conn_update { - uint16_t handle; - uint16_t conn_interval_min; - uint16_t conn_interval_max; - uint16_t conn_latency; - uint16_t supervision_timeout; - uint16_t min_ce_len; - uint16_t max_ce_len; + u16_t handle; + u16_t conn_interval_min; + u16_t conn_interval_max; + u16_t conn_latency; + u16_t supervision_timeout; + u16_t min_ce_len; + u16_t max_ce_len; } __packed; #define BT_HCI_OP_LE_SET_HOST_CHAN_CLASSIF BT_OP(BT_OGF_LE, 0x0014) struct bt_hci_cp_le_set_host_chan_classif { - uint8_t ch_map[5]; + u8_t ch_map[5]; } __packed; #define BT_HCI_OP_LE_READ_CHAN_MAP BT_OP(BT_OGF_LE, 0x0015) struct bt_hci_cp_le_read_chan_map { - uint16_t handle; + u16_t handle; } __packed; struct bt_hci_rp_le_read_ch_map { - uint8_t status; - uint16_t handle; - uint8_t ch_map[5]; + u8_t status; + u16_t handle; + u8_t ch_map[5]; } __packed; #define BT_HCI_OP_LE_READ_REMOTE_FEATURES BT_OP(BT_OGF_LE, 0x0016) struct bt_hci_cp_le_read_remote_features { - uint16_t handle; + u16_t handle; } __packed; #define BT_HCI_OP_LE_ENCRYPT BT_OP(BT_OGF_LE, 0x0017) struct bt_hci_cp_le_encrypt { - uint8_t key[16]; - uint8_t plaintext[16]; + u8_t key[16]; + u8_t plaintext[16]; } __packed; struct bt_hci_rp_le_encrypt { - uint8_t status; - uint8_t enc_data[16]; + u8_t status; + u8_t enc_data[16]; } __packed; #define BT_HCI_OP_LE_RAND BT_OP(BT_OGF_LE, 0x0018) struct bt_hci_rp_le_rand { - uint8_t status; - uint8_t rand[8]; + u8_t status; + u8_t rand[8]; } __packed; #define BT_HCI_OP_LE_START_ENCRYPTION BT_OP(BT_OGF_LE, 0x0019) struct bt_hci_cp_le_start_encryption { - uint16_t handle; - uint64_t rand; - uint16_t ediv; - uint8_t ltk[16]; + u16_t handle; + u64_t rand; + u16_t ediv; + u8_t ltk[16]; } __packed; #define BT_HCI_OP_LE_LTK_REQ_REPLY BT_OP(BT_OGF_LE, 0x001a) struct bt_hci_cp_le_ltk_req_reply { - uint16_t handle; - uint8_t ltk[16]; + u16_t handle; + u8_t ltk[16]; } __packed; struct bt_hci_rp_le_ltk_req_reply { - uint8_t status; - uint16_t handle; + u8_t status; + u16_t handle; } __packed; #define BT_HCI_OP_LE_LTK_REQ_NEG_REPLY BT_OP(BT_OGF_LE, 0x001b) struct bt_hci_cp_le_ltk_req_neg_reply { - uint16_t handle; + u16_t handle; } __packed; struct bt_hci_rp_le_ltk_req_neg_reply { - uint8_t status; - uint16_t handle; + u8_t status; + u16_t handle; } __packed; #define BT_HCI_OP_LE_READ_SUPP_STATES BT_OP(BT_OGF_LE, 0x001c) struct bt_hci_rp_le_read_supp_states { - uint8_t status; - uint8_t le_states[8]; + u8_t status; + u8_t le_states[8]; } __packed; #define BT_HCI_OP_LE_RX_TEST BT_OP(BT_OGF_LE, 0x001d) struct bt_hci_cp_le_rx_test { - uint8_t rx_ch; + u8_t rx_ch; } __packed; #define BT_HCI_OP_LE_TX_TEST BT_OP(BT_OGF_LE, 0x001e) struct bt_hci_cp_le_tx_test { - uint8_t tx_ch; - uint8_t test_data_len; - uint8_t pkt_payload; + u8_t tx_ch; + u8_t test_data_len; + u8_t pkt_payload; } __packed; #define BT_HCI_OP_LE_TEST_END BT_OP(BT_OGF_LE, 0x001f) struct bt_hci_rp_le_test_end { - uint8_t status; - uint16_t rx_pkt_count; + u8_t status; + u16_t rx_pkt_count; } __packed; #define BT_HCI_OP_LE_CONN_PARAM_REQ_REPLY BT_OP(BT_OGF_LE, 0x0020) struct bt_hci_cp_le_conn_param_req_reply { - uint16_t handle; - uint16_t interval_min; - uint16_t interval_max; - uint16_t latency; - uint16_t timeout; - uint16_t min_ce_len; - uint16_t max_ce_len; + u16_t handle; + u16_t interval_min; + u16_t interval_max; + u16_t latency; + u16_t timeout; + u16_t min_ce_len; + u16_t max_ce_len; } __packed; struct bt_hci_rp_le_conn_param_req_reply { - uint8_t status; - uint16_t handle; + u8_t status; + u16_t handle; } __packed; #define BT_HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY BT_OP(BT_OGF_LE, 0x0021) struct bt_hci_cp_le_conn_param_req_neg_reply { - uint16_t handle; - uint8_t reason; + u16_t handle; + u8_t reason; } __packed; struct bt_hci_rp_le_conn_param_req_neg_reply { - uint8_t status; - uint16_t handle; + u8_t status; + u16_t handle; } __packed; #define BT_HCI_OP_LE_SET_DATA_LEN BT_OP(BT_OGF_LE, 0x0022) struct bt_hci_cp_le_set_data_len { - uint16_t handle; - uint16_t tx_octets; - uint16_t tx_time; + u16_t handle; + u16_t tx_octets; + u16_t tx_time; } __packed; struct bt_hci_rp_le_set_data_len { - uint8_t status; - uint16_t handle; + u8_t status; + u16_t handle; } __packed; #define BT_HCI_OP_LE_READ_DEFAULT_DATA_LEN BT_OP(BT_OGF_LE, 0x0023) struct bt_hci_rp_le_read_default_data_len { - uint8_t status; - uint16_t max_tx_octets; - uint16_t max_tx_time; + u8_t status; + u16_t max_tx_octets; + u16_t max_tx_time; } __packed; #define BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN BT_OP(BT_OGF_LE, 0x0024) struct bt_hci_cp_le_write_default_data_len { - uint16_t max_tx_octets; - uint16_t max_tx_time; + u16_t max_tx_octets; + u16_t max_tx_time; } __packed; #define BT_HCI_OP_LE_P256_PUBLIC_KEY BT_OP(BT_OGF_LE, 0x0025) #define BT_HCI_OP_LE_GENERATE_DHKEY BT_OP(BT_OGF_LE, 0x0026) struct bt_hci_cp_le_generate_dhkey { - uint8_t key[64]; + u8_t key[64]; } __packed; #define BT_HCI_OP_LE_ADD_DEV_TO_RL BT_OP(BT_OGF_LE, 0x0027) struct bt_hci_cp_le_add_dev_to_rl { bt_addr_le_t peer_id_addr; - uint8_t peer_irk[16]; - uint8_t local_irk[16]; + u8_t peer_irk[16]; + u8_t local_irk[16]; } __packed; #define BT_HCI_OP_LE_REM_DEV_FROM_RL BT_OP(BT_OGF_LE, 0x0028) @@ -906,8 +906,8 @@ struct bt_hci_cp_le_rem_dev_from_rl { #define BT_HCI_OP_LE_READ_RL_SIZE BT_OP(BT_OGF_LE, 0x002a) struct bt_hci_rp_le_read_rl_size { - uint8_t status; - uint8_t rl_size; + u8_t status; + u8_t rl_size; } __packed; #define BT_HCI_OP_LE_READ_PEER_RPA BT_OP(BT_OGF_LE, 0x002b) @@ -915,7 +915,7 @@ struct bt_hci_cp_le_read_peer_rpa { bt_addr_le_t peer_id_addr; } __packed; struct bt_hci_rp_le_read_peer_rpa { - uint8_t status; + u8_t status; bt_addr_t peer_rpa; } __packed; @@ -924,7 +924,7 @@ struct bt_hci_cp_le_read_local_rpa { bt_addr_le_t peer_id_addr; } __packed; struct bt_hci_rp_le_read_local_rpa { - uint8_t status; + u8_t status; bt_addr_t local_rpa; } __packed; @@ -933,21 +933,21 @@ struct bt_hci_rp_le_read_local_rpa { #define BT_HCI_OP_LE_SET_ADDR_RES_ENABLE BT_OP(BT_OGF_LE, 0x002d) struct bt_hci_cp_le_set_addr_res_enable { - uint8_t enable; + u8_t enable; } __packed; #define BT_HCI_OP_LE_SET_RPA_TIMEOUT BT_OP(BT_OGF_LE, 0x002e) struct bt_hci_cp_le_set_rpa_timeout { - uint8_t rpa_timeout; + u8_t rpa_timeout; } __packed; #define BT_HCI_OP_LE_READ_MAX_DATA_LEN BT_OP(BT_OGF_LE, 0x002f) struct bt_hci_rp_le_read_max_data_len { - uint8_t status; - uint16_t max_tx_octets; - uint16_t max_tx_time; - uint16_t max_rx_octets; - uint16_t max_rx_time; + u8_t status; + u16_t max_tx_octets; + u16_t max_tx_time; + u16_t max_rx_octets; + u16_t max_rx_time; } __packed; #define BT_HCI_LE_PHY_1M 0x01 @@ -956,13 +956,13 @@ struct bt_hci_rp_le_read_max_data_len { #define BT_HCI_OP_LE_READ_PHY BT_OP(BT_OGF_LE, 0x0030) struct bt_hci_cp_le_read_phy { - uint16_t handle; + u16_t handle; } __packed; struct bt_hci_rp_le_read_phy { - uint8_t status; - uint16_t conn_handle; - uint8_t tx_phy; - uint8_t rx_phy; + u8_t status; + u16_t conn_handle; + u8_t tx_phy; + u8_t rx_phy; } __packed; #define BT_HCI_LE_PHY_TX_ANY 0x00 @@ -974,9 +974,9 @@ struct bt_hci_rp_le_read_phy { #define BT_HCI_OP_LE_SET_DEFAULT_PHY BT_OP(BT_OGF_LE, 0x0031) struct bt_hci_cp_le_set_default_phy { - uint8_t all_phys; - uint8_t tx_phys; - uint8_t rx_phys; + u8_t all_phys; + u8_t tx_phys; + u8_t rx_phys; } __packed; #define BT_HCI_LE_PHY_CODED_ANY 0x00 @@ -985,11 +985,11 @@ struct bt_hci_cp_le_set_default_phy { #define BT_HCI_OP_LE_SET_PHY BT_OP(BT_OGF_LE, 0x0032) struct bt_hci_cp_le_set_phy { - uint16_t conn_handle; - uint8_t all_phys; - uint8_t tx_phys; - uint8_t rx_phys; - uint8_t phy_opts; + u16_t conn_handle; + u8_t all_phys; + u8_t tx_phys; + u8_t rx_phys; + u8_t phy_opts; } __packed; #define BT_HCI_LE_MOD_INDEX_STANDARD 0x00 @@ -997,9 +997,9 @@ struct bt_hci_cp_le_set_phy { #define BT_HCI_OP_LE_ENH_RX_TEST BT_OP(BT_OGF_LE, 0x0033) struct bt_hci_cp_le_enh_rx_test { - uint8_t rx_ch; - uint8_t phy; - uint8_t mod_index; + u8_t rx_ch; + u8_t phy; + u8_t mod_index; } __packed; /* Extends BT_HCI_LE_PHY */ @@ -1008,15 +1008,15 @@ struct bt_hci_cp_le_enh_rx_test { #define BT_HCI_OP_LE_ENH_TX_TEST BT_OP(BT_OGF_LE, 0x0034) struct bt_hci_cp_le_enh_tx_test { - uint8_t tx_ch; - uint8_t test_data_len; - uint8_t pkt_payload; - uint8_t phy; + u8_t tx_ch; + u8_t test_data_len; + u8_t pkt_payload; + u8_t phy; } __packed; #define BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR BT_OP(BT_OGF_LE, 0x0035) struct bt_hci_cp_le_set_adv_set_random_addr { - uint8_t handle; + u8_t handle; bt_addr_t bdaddr; } __packed; @@ -1030,24 +1030,24 @@ struct bt_hci_cp_le_set_adv_set_random_addr { #define BT_HCI_OP_LE_SET_EXT_ADV_PARAM BT_OP(BT_OGF_LE, 0x0036) struct bt_hci_cp_le_set_ext_adv_param { - uint8_t handle; - uint16_t props; - uint8_t prim_min_interval[3]; - uint8_t prim_max_interval[3]; - uint8_t prim_channel_map; - uint8_t own_addr_type; + u8_t handle; + u16_t props; + u8_t prim_min_interval[3]; + u8_t prim_max_interval[3]; + u8_t prim_channel_map; + u8_t own_addr_type; bt_addr_le_t peer_addr; - uint8_t filter_policy; - int8_t tx_power; - uint8_t prim_adv_phy; - uint8_t sec_adv_max_skip; - uint8_t sec_adv_phy; - uint8_t sid; - uint8_t scan_req_notify_enable; + u8_t filter_policy; + s8_t tx_power; + u8_t prim_adv_phy; + u8_t sec_adv_max_skip; + u8_t sec_adv_phy; + u8_t sid; + u8_t scan_req_notify_enable; } __packed; struct bt_hci_rp_le_set_ext_adv_param { - uint8_t status; - int8_t tx_power; + u8_t status; + s8_t tx_power; } __packed; #define BT_HCI_LE_EXT_ADV_OP_INTERM_FRAG 0x00 @@ -1061,81 +1061,81 @@ struct bt_hci_rp_le_set_ext_adv_param { #define BT_HCI_OP_LE_SET_EXT_ADV_DATA BT_OP(BT_OGF_LE, 0x0037) struct bt_hci_cp_le_set_ext_adv_data { - uint8_t handle; - uint8_t op; - uint8_t frag_pref; - uint8_t len; - uint8_t data[251]; + u8_t handle; + u8_t op; + u8_t frag_pref; + u8_t len; + u8_t data[251]; } __packed; #define BT_HCI_OP_LE_SET_EXT_SCAN_RSP_DATA BT_OP(BT_OGF_LE, 0x0038) struct bt_hci_cp_le_set_ext_scan_rsp_data { - uint8_t handle; - uint8_t op; - uint8_t frag_pref; - uint8_t len; - uint8_t data[251]; + u8_t handle; + u8_t op; + u8_t frag_pref; + u8_t len; + u8_t data[251]; } __packed; #define BT_HCI_OP_LE_SET_EXT_ADV_ENABLE BT_OP(BT_OGF_LE, 0x0039) struct bt_hci_ext_adv_set { - uint8_t handle; - uint16_t duration; - uint8_t max_ext_adv_evts; + u8_t handle; + u16_t duration; + u8_t max_ext_adv_evts; } __packed; struct bt_hci_cp_le_set_ext_adv_enable { - uint8_t enable; - uint8_t set_num; + u8_t enable; + u8_t set_num; struct bt_hci_ext_adv_set s[0]; } __packed; #define BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN BT_OP(BT_OGF_LE, 0x003a) struct bt_hci_rp_le_read_max_adv_data_len { - uint8_t status; - uint16_t max_adv_data_len; + u8_t status; + u16_t max_adv_data_len; } __packed; #define BT_HCI_OP_LE_READ_NUM_ADV_SETS BT_OP(BT_OGF_LE, 0x003b) struct bt_hci_rp_le_read_num_adv_sets { - uint8_t status; - uint8_t num_sets; + u8_t status; + u8_t num_sets; } __packed; #define BT_HCI_OP_LE_REMOVE_ADV_SET BT_OP(BT_OGF_LE, 0x003c) struct bt_hci_cp_le_remove_adv_set { - uint8_t handle; + u8_t handle; } __packed; #define BT_HCI_OP_CLEAR_ADV_SETS BT_OP(BT_OGF_LE, 0x003d) #define BT_HCI_OP_LE_SET_PER_ADV_PARAM BT_OP(BT_OGF_LE, 0x003e) struct bt_hci_cp_le_set_per_adv_param { - uint8_t handle; - uint16_t min_interval; - uint16_t max_interval; - uint16_t props; + u8_t handle; + u16_t min_interval; + u16_t max_interval; + u16_t props; } __packed; #define BT_HCI_OP_LE_SET_PER_ADV_DATA BT_OP(BT_OGF_LE, 0x003f) struct bt_hci_cp_le_set_per_adv_data { - uint8_t handle; - uint8_t op; - uint8_t len; - uint8_t data[251]; + u8_t handle; + u8_t op; + u8_t len; + u8_t data[251]; } __packed; #define BT_HCI_OP_LE_SET_PER_ADV_ENABLE BT_OP(BT_OGF_LE, 0x0040) struct bt_hci_cp_le_set_per_adv_enable { - uint8_t enable; - uint8_t handle; + u8_t enable; + u8_t handle; } __packed; #define BT_HCI_OP_LE_SET_EXT_SCAN_PARAM BT_OP(BT_OGF_LE, 0x0041) struct bt_hci_ext_scan_phy { - uint8_t type; - uint16_t interval; - uint16_t window; + u8_t type; + u16_t interval; + u16_t window; } __packed; #define BT_HCI_LE_EXT_SCAN_PHY_1M BIT(0) @@ -1143,9 +1143,9 @@ struct bt_hci_ext_scan_phy { #define BT_HCI_LE_EXT_SCAN_PHY_CODED BIT(2) struct bt_hci_cp_le_set_ext_scan_param { - uint8_t own_addr_type; - uint8_t filter_policy; - uint8_t phys; + u8_t own_addr_type; + u8_t filter_policy; + u8_t phys; struct bt_hci_ext_scan_phy p[0]; } __packed; @@ -1154,87 +1154,87 @@ struct bt_hci_cp_le_set_ext_scan_param { #define BT_HCI_OP_LE_SET_EXT_SCAN_ENABLE BT_OP(BT_OGF_LE, 0x0042) struct bt_hci_cp_le_set_ext_scan_enable { - uint8_t enable; - uint8_t filter_dup; - uint16_t duration; - uint16_t period; + u8_t enable; + u8_t filter_dup; + u16_t duration; + u16_t period; } __packed; #define BT_HCI_OP_LE_EXT_CREATE_CONN BT_OP(BT_OGF_LE, 0x0043) struct bt_hci_ext_conn_phy { - uint16_t interval; - uint16_t window; - uint16_t conn_interval_min; - uint16_t conn_interval_max; - uint16_t conn_latency; - uint16_t supervision_timeout; - uint16_t min_ce_len; - uint16_t max_ce_len; + u16_t interval; + u16_t window; + u16_t conn_interval_min; + u16_t conn_interval_max; + u16_t conn_latency; + u16_t supervision_timeout; + u16_t min_ce_len; + u16_t max_ce_len; } __packed; struct bt_hci_cp_le_ext_create_conn { - uint8_t filter_policy; - uint8_t own_addr_type; + u8_t filter_policy; + u8_t own_addr_type; bt_addr_le_t peer_addr; - uint8_t phys; + u8_t phys; struct bt_hci_ext_conn_phy p[0]; } __packed; #define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC BT_OP(BT_OGF_LE, 0x0044) struct bt_hci_cp_le_per_adv_create_sync { - uint8_t filter_policy; - uint8_t sid; + u8_t filter_policy; + u8_t sid; bt_addr_le_t addr; - uint16_t skip; - uint16_t sync_timeout; - uint8_t unused; + u16_t skip; + u16_t sync_timeout; + u8_t unused; } __packed; #define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC_CANCEL BT_OP(BT_OGF_LE, 0x0045) #define BT_HCI_OP_LE_PER_ADV_TERMINATE_SYNC BT_OP(BT_OGF_LE, 0x0046) struct bt_hci_cp_le_per_adv_terminate_sync { - uint16_t handle; + u16_t handle; } __packed; #define BT_HCI_OP_LE_ADD_DEV_TO_PER_ADV_LIST BT_OP(BT_OGF_LE, 0x0047) struct bt_hci_cp_le_add_dev_to_per_adv_list { bt_addr_le_t addr; - uint8_t sid; + u8_t sid; } __packed; #define BT_HCI_OP_LE_REM_DEV_FROM_PER_ADV_LIST BT_OP(BT_OGF_LE, 0x0048) struct bt_hci_cp_le_rem_dev_from_per_adv_list { bt_addr_le_t addr; - uint8_t sid; + u8_t sid; } __packed; #define BT_HCI_OP_LE_CLEAR_PER_ADV_LIST BT_OP(BT_OGF_LE, 0x0049) #define BT_HCI_OP_LE_READ_PER_ADV_LIST_SIZE BT_OP(BT_OGF_LE, 0x004a) struct bt_hci_rp_le_read_per_adv_list_size { - uint8_t status; - uint8_t list_size; + u8_t status; + u8_t list_size; } __packed; #define BT_HCI_OP_LE_READ_TX_POWER BT_OP(BT_OGF_LE, 0x004b) struct bt_hci_rp_le_read_tx_power { - uint8_t status; - int8_t min_tx_power; - int8_t max_tx_power; + u8_t status; + s8_t min_tx_power; + s8_t max_tx_power; } __packed; #define BT_HCI_OP_LE_READ_RF_PATH_COMP BT_OP(BT_OGF_LE, 0x004c) struct bt_hci_rp_le_read_rf_path_comp { - uint8_t status; - int16_t tx_path_comp; - int16_t rx_path_comp; + u8_t status; + s16_t tx_path_comp; + s16_t rx_path_comp; } __packed; #define BT_HCI_OP_LE_WRITE_RF_PATH_COMP BT_OP(BT_OGF_LE, 0x004d) struct bt_hci_cp_le_write_rf_path_comp { - int16_t tx_path_comp; - int16_t rx_path_comp; + s16_t tx_path_comp; + s16_t rx_path_comp; } __packed; #define BT_HCI_LE_PRIVACY_MODE_NETWORK 0x00 @@ -1243,7 +1243,7 @@ struct bt_hci_cp_le_write_rf_path_comp { #define BT_HCI_OP_LE_SET_PRIVACY_MODE BT_OP(BT_OGF_LE, 0x004e) struct bt_hci_cp_le_set_privacy_mode { bt_addr_le_t id_addr; - uint8_t mode; + u8_t mode; } __packed; /* Event definitions */ @@ -1252,95 +1252,95 @@ struct bt_hci_cp_le_set_privacy_mode { #define BT_HCI_EVT_INQUIRY_COMPLETE 0x01 struct bt_hci_evt_inquiry_complete { - uint8_t status; + u8_t status; } __packed; #define BT_HCI_EVT_CONN_COMPLETE 0x03 struct bt_hci_evt_conn_complete { - uint8_t status; - uint16_t handle; + u8_t status; + u16_t handle; bt_addr_t bdaddr; - uint8_t link_type; - uint8_t encr_enabled; + u8_t link_type; + u8_t encr_enabled; } __packed; #define BT_HCI_EVT_CONN_REQUEST 0x04 struct bt_hci_evt_conn_request { bt_addr_t bdaddr; - uint8_t dev_class[3]; - uint8_t link_type; + u8_t dev_class[3]; + u8_t link_type; } __packed; #define BT_HCI_EVT_DISCONN_COMPLETE 0x05 struct bt_hci_evt_disconn_complete { - uint8_t status; - uint16_t handle; - uint8_t reason; + u8_t status; + u16_t handle; + u8_t reason; } __packed; #define BT_HCI_EVT_AUTH_COMPLETE 0x06 struct bt_hci_evt_auth_complete { - uint8_t status; - uint16_t handle; + u8_t status; + u16_t handle; } __packed; #define BT_HCI_EVT_REMOTE_NAME_REQ_COMPLETE 0x07 struct bt_hci_evt_remote_name_req_complete { - uint8_t status; + u8_t status; bt_addr_t bdaddr; - uint8_t name[248]; + u8_t name[248]; } __packed; #define BT_HCI_EVT_ENCRYPT_CHANGE 0x08 struct bt_hci_evt_encrypt_change { - uint8_t status; - uint16_t handle; - uint8_t encrypt; + u8_t status; + u16_t handle; + u8_t encrypt; } __packed; #define BT_HCI_EVT_REMOTE_FEATURES 0x0b struct bt_hci_evt_remote_features { - uint8_t status; - uint16_t handle; - uint8_t features[8]; + u8_t status; + u16_t handle; + u8_t features[8]; } __packed; #define BT_HCI_EVT_REMOTE_VERSION_INFO 0x0c struct bt_hci_evt_remote_version_info { - uint8_t status; - uint16_t handle; - uint8_t version; - uint16_t manufacturer; - uint8_t subversion; + u8_t status; + u16_t handle; + u8_t version; + u16_t manufacturer; + u8_t subversion; } __packed; #define BT_HCI_EVT_CMD_COMPLETE 0x0e struct bt_hci_evt_cmd_complete { - uint8_t ncmd; - uint16_t opcode; + u8_t ncmd; + u16_t opcode; } __packed; struct bt_hci_evt_cc_status { - uint8_t status; + u8_t status; } __packed; #define BT_HCI_EVT_CMD_STATUS 0x0f struct bt_hci_evt_cmd_status { - uint8_t status; - uint8_t ncmd; - uint16_t opcode; + u8_t status; + u8_t ncmd; + u16_t opcode; } __packed; #define BT_HCI_EVT_ROLE_CHANGE 0x12 struct bt_hci_evt_role_change { - uint8_t status; + u8_t status; bt_addr_t bdaddr; - uint8_t role; + u8_t role; } __packed; #define BT_HCI_EVT_NUM_COMPLETED_PACKETS 0x13 struct bt_hci_evt_num_completed_packets { - uint8_t num_handles; + u8_t num_handles; struct bt_hci_handle_count h[0]; } __packed; @@ -1368,58 +1368,58 @@ struct bt_hci_evt_link_key_req { #define BT_HCI_EVT_LINK_KEY_NOTIFY 0x18 struct bt_hci_ev_link_key_notify { bt_addr_t bdaddr; - uint8_t link_key[16]; - uint8_t key_type; + u8_t link_key[16]; + u8_t key_type; } __packed; #define BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI 0x22 struct bt_hci_evt_inquiry_result_with_rssi { bt_addr_t addr; - uint8_t pscan_rep_mode; - uint8_t reserved; - uint8_t cod[3]; - uint16_t clock_offset; - int8_t rssi; + u8_t pscan_rep_mode; + u8_t reserved; + u8_t cod[3]; + u16_t clock_offset; + s8_t rssi; } __packed; #define BT_HCI_EVT_REMOTE_EXT_FEATURES 0x23 struct bt_hci_evt_remote_ext_features { - uint8_t status; - uint16_t handle; - uint8_t page; - uint8_t max_page; - uint8_t features[8]; + u8_t status; + u16_t handle; + u8_t page; + u8_t max_page; + u8_t features[8]; } __packed; #define BT_HCI_EVT_SYNC_CONN_COMPLETE 0x2c struct bt_hci_evt_sync_conn_complete { - uint8_t status; - uint16_t handle; + u8_t status; + u16_t handle; bt_addr_t bdaddr; - uint8_t link_type; - uint8_t tx_interval; - uint8_t retansmission_window; - uint16_t rx_pkt_length; - uint16_t tx_pkt_length; - uint8_t air_mode; + u8_t link_type; + u8_t tx_interval; + u8_t retansmission_window; + u16_t rx_pkt_length; + u16_t tx_pkt_length; + u8_t air_mode; } __packed; #define BT_HCI_EVT_EXTENDED_INQUIRY_RESULT 0x2f struct bt_hci_evt_extended_inquiry_result { - uint8_t num_reports; + u8_t num_reports; bt_addr_t addr; - uint8_t pscan_rep_mode; - uint8_t reserved; - uint8_t cod[3]; - uint16_t clock_offset; - int8_t rssi; - uint8_t eir[240]; + u8_t pscan_rep_mode; + u8_t reserved; + u8_t cod[3]; + u16_t clock_offset; + s8_t rssi; + u8_t eir[240]; } __packed; #define BT_HCI_EVT_ENCRYPT_KEY_REFRESH_COMPLETE 0x30 struct bt_hci_evt_encrypt_key_refresh_complete { - uint8_t status; - uint16_t handle; + u8_t status; + u16_t handle; } __packed; #define BT_HCI_EVT_IO_CAPA_REQ 0x31 @@ -1430,15 +1430,15 @@ struct bt_hci_evt_io_capa_req { #define BT_HCI_EVT_IO_CAPA_RESP 0x32 struct bt_hci_evt_io_capa_resp { bt_addr_t bdaddr; - uint8_t capability; - uint8_t oob_data; - uint8_t authentication; + u8_t capability; + u8_t oob_data; + u8_t authentication; } __packed; #define BT_HCI_EVT_USER_CONFIRM_REQ 0x33 struct bt_hci_evt_user_confirm_req { bt_addr_t bdaddr; - uint32_t passkey; + u32_t passkey; } __packed; #define BT_HCI_EVT_USER_PASSKEY_REQ 0x34 @@ -1448,24 +1448,24 @@ struct bt_hci_evt_user_passkey_req { #define BT_HCI_EVT_SSP_COMPLETE 0x36 struct bt_hci_evt_ssp_complete { - uint8_t status; + u8_t status; bt_addr_t bdaddr; } __packed; #define BT_HCI_EVT_USER_PASSKEY_NOTIFY 0x3b struct bt_hci_evt_user_passkey_notify { bt_addr_t bdaddr; - uint32_t passkey; + u32_t passkey; } __packed; #define BT_HCI_EVT_LE_META_EVENT 0x3e struct bt_hci_evt_le_meta_event { - uint8_t subevent; + u8_t subevent; } __packed; #define BT_HCI_EVT_AUTH_PAYLOAD_TIMEOUT_EXP 0x57 struct bt_hci_evt_auth_payload_timeout_exp { - uint16_t handle; + u16_t handle; } __packed; #define BT_HCI_ROLE_MASTER 0x00 @@ -1473,174 +1473,174 @@ struct bt_hci_evt_auth_payload_timeout_exp { #define BT_HCI_EVT_LE_CONN_COMPLETE 0x01 struct bt_hci_evt_le_conn_complete { - uint8_t status; - uint16_t handle; - uint8_t role; + u8_t status; + u16_t handle; + u8_t role; bt_addr_le_t peer_addr; - uint16_t interval; - uint16_t latency; - uint16_t supv_timeout; - uint8_t clock_accuracy; + u16_t interval; + u16_t latency; + u16_t supv_timeout; + u8_t clock_accuracy; } __packed; #define BT_HCI_EVT_LE_ADVERTISING_REPORT 0x02 struct bt_hci_ev_le_advertising_info { - uint8_t evt_type; + u8_t evt_type; bt_addr_le_t addr; - uint8_t length; - uint8_t data[0]; + u8_t length; + u8_t data[0]; } __packed; struct bt_hci_ev_le_advertising_report { - uint8_t num_reports; + u8_t num_reports; struct bt_hci_ev_le_advertising_info adv_info[0]; } __packed; #define BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE 0x03 struct bt_hci_evt_le_conn_update_complete { - uint8_t status; - uint16_t handle; - uint16_t interval; - uint16_t latency; - uint16_t supv_timeout; + u8_t status; + u16_t handle; + u16_t interval; + u16_t latency; + u16_t supv_timeout; } __packed; #define BT_HCI_EV_LE_REMOTE_FEAT_COMPLETE 0x04 struct bt_hci_ev_le_remote_feat_complete { - uint8_t status; - uint16_t handle; - uint8_t features[8]; + u8_t status; + u16_t handle; + u8_t features[8]; } __packed; #define BT_HCI_EVT_LE_LTK_REQUEST 0x05 struct bt_hci_evt_le_ltk_request { - uint16_t handle; - uint64_t rand; - uint16_t ediv; + u16_t handle; + u64_t rand; + u16_t ediv; } __packed; #define BT_HCI_EVT_LE_CONN_PARAM_REQ 0x06 struct bt_hci_evt_le_conn_param_req { - uint16_t handle; - uint16_t interval_min; - uint16_t interval_max; - uint16_t latency; - uint16_t timeout; + u16_t handle; + u16_t interval_min; + u16_t interval_max; + u16_t latency; + u16_t timeout; } __packed; #define BT_HCI_EVT_LE_DATA_LEN_CHANGE 0x07 struct bt_hci_evt_le_data_len_change { - uint16_t handle; - uint16_t max_tx_octets; - uint16_t max_tx_time; - uint16_t max_rx_octets; - uint16_t max_rx_time; + u16_t handle; + u16_t max_tx_octets; + u16_t max_tx_time; + u16_t max_rx_octets; + u16_t max_rx_time; } __packed; #define BT_HCI_EVT_LE_P256_PUBLIC_KEY_COMPLETE 0x08 struct bt_hci_evt_le_p256_public_key_complete { - uint8_t status; - uint8_t key[64]; + u8_t status; + u8_t key[64]; } __packed; #define BT_HCI_EVT_LE_GENERATE_DHKEY_COMPLETE 0x09 struct bt_hci_evt_le_generate_dhkey_complete { - uint8_t status; - uint8_t dhkey[32]; + u8_t status; + u8_t dhkey[32]; } __packed; #define BT_HCI_EVT_LE_ENH_CONN_COMPLETE 0x0a struct bt_hci_evt_le_enh_conn_complete { - uint8_t status; - uint16_t handle; - uint8_t role; + u8_t status; + u16_t handle; + u8_t role; bt_addr_le_t peer_addr; bt_addr_t local_rpa; bt_addr_t peer_rpa; - uint16_t interval; - uint16_t latency; - uint16_t supv_timeout; - uint8_t clock_accuracy; + u16_t interval; + u16_t latency; + u16_t supv_timeout; + u8_t clock_accuracy; } __packed; #define BT_HCI_EVT_LE_DIRECT_ADV_REPORT 0x0b struct bt_hci_ev_le_direct_adv_info { - uint8_t evt_type; + u8_t evt_type; bt_addr_le_t dir_addr; bt_addr_le_t addr; - int8_t rssi; + s8_t rssi; } __packed; struct bt_hci_ev_le_direct_adv_report { - uint8_t num_reports; + u8_t num_reports; struct bt_hci_ev_le_direct_adv_info direct_adv_info[0]; } __packed; #define BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE 0x0c struct bt_hci_evt_le_phy_update_complete { - uint8_t status; - uint16_t handle; - uint8_t tx_phy; - uint8_t rx_phy; + u8_t status; + u16_t handle; + u8_t tx_phy; + u8_t rx_phy; } __packed; #define BT_HCI_EVT_LE_EXT_ADVERTISING_REPORT 0x0d struct bt_hci_ev_le_ext_advertising_info { - uint8_t evt_type; + u8_t evt_type; bt_addr_le_t addr; - uint8_t prim_phy; - uint8_t sec_phy; - uint8_t sid; - int8_t tx_power; - int8_t rssi; - uint16_t interval; + u8_t prim_phy; + u8_t sec_phy; + u8_t sid; + s8_t tx_power; + s8_t rssi; + u16_t interval; bt_addr_le_t direct_addr; - uint8_t length; - uint8_t data[0]; + u8_t length; + u8_t data[0]; } __packed; struct bt_hci_ev_le_ext_advertising_report { - uint8_t num_reports; + u8_t num_reports; struct bt_hci_ev_le_ext_advertising_info adv_info[0]; } __packed; #define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED 0x0e struct bt_hci_evt_le_per_adv_sync_established { - uint8_t status; - uint16_t handle; - uint8_t sid; + u8_t status; + u16_t handle; + u8_t sid; bt_addr_le_t adv_addr; - uint8_t phy; - uint16_t interval; - uint8_t clock_accuracy; + u8_t phy; + u16_t interval; + u8_t clock_accuracy; } __packed; #define BT_HCI_EVT_LE_PER_ADVERTISING_REPORT 0x0f struct bt_hci_ev_le_per_advertising_report { - uint16_t handle; - int8_t tx_power; - int8_t rssi; - uint8_t unused; - uint8_t data_status; - uint8_t length; - uint8_t data[0]; + u16_t handle; + s8_t tx_power; + s8_t rssi; + u8_t unused; + u8_t data_status; + u8_t length; + u8_t data[0]; } __packed; #define BT_HCI_EVT_LE_PER_ADV_SYNC_LOST 0x10 struct bt_hci_evt_le_per_adv_sync_lost { - uint16_t handle; + u16_t handle; } __packed; #define BT_HCI_EVT_LE_SCAN_TIMEOUT 0x11 #define BT_HCI_EVT_LE_ADV_SET_TERMINATED 0x12 struct bt_hci_evt_le_per_adv_set_terminated { - uint8_t status; - uint8_t adv_handle; - uint16_t conn_handle; - uint8_t num_completed_ext_adv_evts; + u8_t status; + u8_t adv_handle; + u16_t conn_handle; + u8_t num_completed_ext_adv_evts; } __packed; #define BT_HCI_EVT_LE_SCAN_REQ_RECEIVED 0x13 struct bt_hci_evt_le_scan_req_received { - uint8_t handle; + u8_t handle; bt_addr_le_t addr; } __packed; @@ -1649,8 +1649,8 @@ struct bt_hci_evt_le_scan_req_received { #define BT_HCI_EVT_LE_CHAN_SEL_ALGO 0x14 struct bt_hci_evt_le_chan_sel_algo { - uint16_t handle; - uint8_t chan_sel_algo; + u16_t handle; + u8_t chan_sel_algo; } __packed; /* Event mask bits */ diff --git a/include/bluetooth/hfp_hf.h b/include/bluetooth/hfp_hf.h index 5ddc645e304..509a811bb83 100644 --- a/include/bluetooth/hfp_hf.h +++ b/include/bluetooth/hfp_hf.h @@ -40,9 +40,9 @@ enum bt_hfp_hf_at_cmd { /** @brief HFP HF Command completion field */ struct bt_hfp_hf_cmd_complete { /* Command complete status */ - uint8_t type; + u8_t type; /* CME error number to be added */ - uint8_t cme; + u8_t cme; }; /** @brief HFP profile application callback */ @@ -71,7 +71,7 @@ struct bt_hfp_hf_cb { * @param conn Connection object. * @param value service indicator value received from the AG. */ - void (*service)(struct bt_conn *conn, uint32_t value); + void (*service)(struct bt_conn *conn, u32_t value); /** HF indicator Callback * * This callback provides call indicator value to the application @@ -79,7 +79,7 @@ struct bt_hfp_hf_cb { * @param conn Connection object. * @param value call indicator value received from the AG. */ - void (*call)(struct bt_conn *conn, uint32_t value); + void (*call)(struct bt_conn *conn, u32_t value); /** HF indicator Callback * * This callback provides call setup indicator value to the application @@ -87,7 +87,7 @@ struct bt_hfp_hf_cb { * @param conn Connection object. * @param value call setup indicator value received from the AG. */ - void (*call_setup)(struct bt_conn *conn, uint32_t value); + void (*call_setup)(struct bt_conn *conn, u32_t value); /** HF indicator Callback * * This callback provides call held indicator value to the application @@ -95,7 +95,7 @@ struct bt_hfp_hf_cb { * @param conn Connection object. * @param value call held indicator value received from the AG. */ - void (*call_held)(struct bt_conn *conn, uint32_t value); + void (*call_held)(struct bt_conn *conn, u32_t value); /** HF indicator Callback * * This callback provides signal indicator value to the application @@ -103,7 +103,7 @@ struct bt_hfp_hf_cb { * @param conn Connection object. * @param value signal indicator value received from the AG. */ - void (*signal)(struct bt_conn *conn, uint32_t value); + void (*signal)(struct bt_conn *conn, u32_t value); /** HF indicator Callback * * This callback provides roaming indicator value to the application @@ -111,7 +111,7 @@ struct bt_hfp_hf_cb { * @param conn Connection object. * @param value roaming indicator value received from the AG. */ - void (*roam)(struct bt_conn *conn, uint32_t value); + void (*roam)(struct bt_conn *conn, u32_t value); /** HF indicator Callback * * This callback battery service indicator value to the application @@ -119,7 +119,7 @@ struct bt_hfp_hf_cb { * @param conn Connection object. * @param value battery indicator value received from the AG. */ - void (*battery)(struct bt_conn *conn, uint32_t value); + void (*battery)(struct bt_conn *conn, u32_t value); /** HF incoming call Ring indication callback to application * * If this callback is provided it will be called whenever there diff --git a/include/bluetooth/l2cap.h b/include/bluetooth/l2cap.h index 2e803a2aba9..addbc111927 100644 --- a/include/bluetooth/l2cap.h +++ b/include/bluetooth/l2cap.h @@ -81,9 +81,9 @@ struct bt_l2cap_chan { #if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) bt_l2cap_chan_state_t state; /** Remote PSM to be connected */ - uint16_t psm; + u16_t psm; /** Helps match request context during CoC */ - uint8_t ident; + u8_t ident; bt_security_t required_sec_level; #endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */ }; @@ -91,13 +91,13 @@ struct bt_l2cap_chan { /** @brief LE L2CAP Endpoint structure. */ struct bt_l2cap_le_endpoint { /** Endpoint CID */ - uint16_t cid; + u16_t cid; /** Endpoint Maximum Transmission Unit */ - uint16_t mtu; + u16_t mtu; /** Endpoint Maximum PDU payload Size */ - uint16_t mps; + u16_t mps; /** Endpoint initial credits */ - uint16_t init_credits; + u16_t init_credits; /** Endpoint credits */ struct k_sem credits; }; @@ -116,7 +116,7 @@ struct bt_l2cap_le_chan { struct net_buf *tx_buf; /** Segment SDU packet from upper layer */ struct net_buf *_sdu; - uint16_t _sdu_len; + u16_t _sdu_len; }; /** @def BT_L2CAP_LE_CHAN(_ch) @@ -133,9 +133,9 @@ struct bt_l2cap_le_chan { /** @brief BREDR L2CAP Endpoint structure. */ struct bt_l2cap_br_endpoint { /** Endpoint CID */ - uint16_t cid; + u16_t cid; /** Endpoint Maximum Transmission Unit */ - uint16_t mtu; + u16_t mtu; }; /** @brief BREDR L2CAP Channel structure. */ @@ -186,7 +186,7 @@ struct bt_l2cap_chan_ops { * by HCI layer and set to 0 when success and to non-zero (reference to * HCI Error Codes) when security/authentication failed. */ - void (*encrypt_change)(struct bt_l2cap_chan *chan, uint8_t hci_status); + void (*encrypt_change)(struct bt_l2cap_chan *chan, u8_t hci_status); /** Channel alloc_buf callback * @@ -215,7 +215,7 @@ struct bt_l2cap_chan_ops { /** @brief L2CAP Server structure. */ struct bt_l2cap_server { /** Server PSM */ - uint16_t psm; + u16_t psm; /** Required minimim security level */ bt_security_t sec_level; @@ -278,7 +278,7 @@ int bt_l2cap_br_server_register(struct bt_l2cap_server *server); * @return 0 in case of success or negative value in case of error. */ int bt_l2cap_chan_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan, - uint16_t psm); + u16_t psm); /** @brief Disconnect L2CAP channel * diff --git a/include/bluetooth/rfcomm.h b/include/bluetooth/rfcomm.h index 3da79574a88..560d28c036a 100644 --- a/include/bluetooth/rfcomm.h +++ b/include/bluetooth/rfcomm.h @@ -90,10 +90,10 @@ struct bt_rfcomm_dlc { bt_security_t required_sec_level; bt_rfcomm_role_t role; - uint16_t mtu; - uint8_t dlci; - uint8_t state; - uint8_t rx_credit; + u16_t mtu; + u8_t dlci; + u8_t state; + u8_t rx_credit; /* Stack for TX fiber */ BT_STACK(stack, 256); @@ -101,7 +101,7 @@ struct bt_rfcomm_dlc { struct bt_rfcomm_server { /** Server Channel */ - uint8_t channel; + u8_t channel; /** Server accept callback * @@ -143,7 +143,7 @@ int bt_rfcomm_server_register(struct bt_rfcomm_server *server); * @return 0 in case of success or negative value in case of error. */ int bt_rfcomm_dlc_connect(struct bt_conn *conn, struct bt_rfcomm_dlc *dlc, - uint8_t channel); + u8_t channel); /** @brief Send data to RFCOMM * diff --git a/include/bluetooth/sdp.h b/include/bluetooth/sdp.h index 70a0a1022df..b9b18cebdf1 100644 --- a/include/bluetooth/sdp.h +++ b/include/bluetooth/sdp.h @@ -271,24 +271,24 @@ extern "C" { /** @brief SDP Generic Data Element Value. */ struct bt_sdp_data_elem { - uint8_t type; - uint32_t data_size; - uint32_t total_size; + u8_t type; + u32_t data_size; + u32_t total_size; const void *data; }; /** @brief SDP Attribute Value. */ struct bt_sdp_attribute { - uint16_t id; /* Attribute ID */ + u16_t id; /* Attribute ID */ struct bt_sdp_data_elem val; /* Attribute data */ }; /** @brief SDP Service Record Value. */ struct bt_sdp_record { - uint32_t handle; /* Redundant, for quick ref */ + u32_t handle; /* Redundant, for quick ref */ struct bt_sdp_attribute *attrs; /* Base addr of attr array */ size_t attr_count; /* Number of attributes */ - uint8_t index; /* Index of the record in LL */ + u8_t index; /* Index of the record in LL */ struct bt_sdp_record *next; }; @@ -301,17 +301,17 @@ struct bt_sdp_record { /** @def BT_SDP_ARRAY_8 * @brief Declare an array of 8-bit elements in an attribute. */ -#define BT_SDP_ARRAY_8(...) ((uint8_t[]) {__VA_ARGS__}) +#define BT_SDP_ARRAY_8(...) ((u8_t[]) {__VA_ARGS__}) /** @def BT_SDP_ARRAY_16 * @brief Declare an array of 16-bit elements in an attribute. */ -#define BT_SDP_ARRAY_16(...) ((uint16_t[]) {__VA_ARGS__}) +#define BT_SDP_ARRAY_16(...) ((u16_t[]) {__VA_ARGS__}) /** @def BT_SDP_ARRAY_32 * @brief Declare an array of 32-bit elements in an attribute. */ -#define BT_SDP_ARRAY_32(...) ((uint32_t[]) {__VA_ARGS__}) +#define BT_SDP_ARRAY_32(...) ((u32_t[]) {__VA_ARGS__}) /** @def BT_SDP_TYPE_SIZE * @brief Declare a fixed-size data element header. @@ -506,7 +506,7 @@ enum { * record data and continue discovery for given UUID. By returning * BT_SDP_DISCOVER_UUID_CONTINUE user allows this discovery continuation. */ -typedef uint8_t (*bt_sdp_discover_func_t) +typedef u8_t (*bt_sdp_discover_func_t) (struct bt_conn *conn, struct bt_sdp_client_result *result); /** @brief Main user structure used in SDP discovery of remote. */ @@ -573,7 +573,7 @@ enum bt_sdp_proto { * value is found, or negative if error occurred during processing. */ int bt_sdp_get_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto, - uint16_t *param); + u16_t *param); /** @brief Get profile version. * @@ -587,8 +587,8 @@ int bt_sdp_get_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto, * * @return 0 on success, negative value if error occurred during processing. */ -int bt_sdp_get_profile_version(const struct net_buf *buf, uint16_t profile, - uint16_t *version); +int bt_sdp_get_profile_version(const struct net_buf *buf, u16_t profile, + u16_t *version); /** @brief Get SupportedFeatures attribute value * @@ -600,7 +600,7 @@ int bt_sdp_get_profile_version(const struct net_buf *buf, uint16_t profile, * * @return 0 on success if feature found and valid, negative in case any error */ -int bt_sdp_get_features(const struct net_buf *buf, uint16_t *features); +int bt_sdp_get_features(const struct net_buf *buf, u16_t *features); #ifdef __cplusplus } #endif diff --git a/include/bluetooth/storage.h b/include/bluetooth/storage.h index dd8c132585b..ef6eb8ad2b6 100644 --- a/include/bluetooth/storage.h +++ b/include/bluetooth/storage.h @@ -34,7 +34,7 @@ enum { BT_STORAGE_ID_ADDR, /** Local Identity Resolving Key. - * Type: uint8_t key[16] + * Type: u8_t key[16] */ BT_STORAGE_LOCAL_IRK, @@ -59,7 +59,7 @@ enum { BT_STORAGE_LTK, /** Identity Resolving Key - * Type: uint8_t key[16] + * Type: u8_t key[16] */ BT_STORAGE_IRK, }; @@ -74,12 +74,12 @@ enum { }; struct bt_storage_ltk { - uint8_t flags; + u8_t flags; /* Encryption key size used to generate key */ - uint8_t size; - uint16_t ediv; - uint8_t rand[8]; - uint8_t val[16]; + u8_t size; + u16_t ediv; + u8_t rand[8]; + u8_t val[16]; }; struct bt_storage { @@ -93,7 +93,7 @@ struct bt_storage { * @return Number of bytes read or negative error value on * failure. */ - ssize_t (*read)(const bt_addr_le_t *addr, uint16_t key, + ssize_t (*read)(const bt_addr_le_t *addr, u16_t key, void *data, size_t length); /** Write the value of a key to storage. @@ -106,7 +106,7 @@ struct bt_storage { * @return Number of bytes written or negative error value on * failure. */ - ssize_t (*write)(const bt_addr_le_t *addr, uint16_t key, + ssize_t (*write)(const bt_addr_le_t *addr, u16_t key, const void *data, size_t length); /** Clear all keys for a specific address diff --git a/include/bluetooth/uuid.h b/include/bluetooth/uuid.h index 56d7633d2cb..5d06c3921db 100644 --- a/include/bluetooth/uuid.h +++ b/include/bluetooth/uuid.h @@ -32,22 +32,22 @@ enum { /** @brief This is a 'tentative' type and should be used as a pointer only */ struct bt_uuid { - uint8_t type; + u8_t type; }; struct bt_uuid_16 { struct bt_uuid uuid; - uint16_t val; + u16_t val; }; struct bt_uuid_32 { struct bt_uuid uuid; - uint32_t val; + u32_t val; }; struct bt_uuid_128 { struct bt_uuid uuid; - uint8_t val[16]; + u8_t val[16]; }; #define BT_UUID_INIT_16(value) \ diff --git a/include/drivers/bluetooth/hci_driver.h b/include/drivers/bluetooth/hci_driver.h index 16533dc2d50..56c7e6d4ced 100644 --- a/include/drivers/bluetooth/hci_driver.h +++ b/include/drivers/bluetooth/hci_driver.h @@ -39,7 +39,7 @@ extern "C" { * @return true if the event can be processed in the RX thread, false * if it cannot. */ -static inline bool bt_hci_evt_is_prio(uint8_t evt) +static inline bool bt_hci_evt_is_prio(u8_t evt) { switch (evt) { case BT_HCI_EVT_CMD_COMPLETE: diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 49561779778..b469874498a 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -68,7 +68,7 @@ config BLUETOOTH_CONTROLLER_TX_BUFFER_SIZE then controller will perform fragmentation before transmitting on the the packet on air. Maximum is set to 16384 due to implementation limitations (use of - uint16_t for size/length variables). + u16_t for size/length variables). config BLUETOOTH_CONTROLLER_COMPANY_ID prompt "Company Id" diff --git a/subsys/bluetooth/controller/hal/ccm.h b/subsys/bluetooth/controller/hal/ccm.h index f6eec37904d..54abc4fab32 100644 --- a/subsys/bluetooth/controller/hal/ccm.h +++ b/subsys/bluetooth/controller/hal/ccm.h @@ -9,11 +9,11 @@ #define _CCM_H_ struct ccm { - uint8_t key[16]; - uint64_t counter; - uint8_t direction:1; - uint8_t resv1:7; - uint8_t iv[8]; + u8_t key[16]; + u64_t counter; + u8_t direction:1; + u8_t resv1:7; + u8_t iv[8]; } __packed; #endif /* _CCM_H_ */ diff --git a/subsys/bluetooth/controller/hal/cntr.h b/subsys/bluetooth/controller/hal/cntr.h index 9224d063aee..1f686872a60 100644 --- a/subsys/bluetooth/controller/hal/cntr.h +++ b/subsys/bluetooth/controller/hal/cntr.h @@ -9,9 +9,9 @@ #define _CNTR_H_ void cntr_init(void); -uint32_t cntr_start(void); -uint32_t cntr_stop(void); -uint32_t cntr_cnt_get(void); -void cntr_cmp_set(uint8_t cmp, uint32_t value); +u32_t cntr_start(void); +u32_t cntr_stop(void); +u32_t cntr_cnt_get(void); +void cntr_cmp_set(u8_t cmp, u32_t value); #endif /* _CNTR_H_ */ diff --git a/subsys/bluetooth/controller/hal/debug.h b/subsys/bluetooth/controller/hal/debug.h index 48f35bd44e2..5a2662cc153 100644 --- a/subsys/bluetooth/controller/hal/debug.h +++ b/subsys/bluetooth/controller/hal/debug.h @@ -9,7 +9,7 @@ #define _HAL_DEBUG_H_ #ifdef CONFIG_BLUETOOTH_CONTROLLER_ASSERT_HANDLER -void bt_controller_assert_handle(char *file, uint32_t line); +void bt_controller_assert_handle(char *file, u32_t line); #define LL_ASSERT(cond) if (!(cond)) { \ bt_controller_assert_handle(__FILE__, \ __LINE__); \ diff --git a/subsys/bluetooth/controller/hal/ecb.h b/subsys/bluetooth/controller/hal/ecb.h index 474c83938d8..522fd177199 100644 --- a/subsys/bluetooth/controller/hal/ecb.h +++ b/subsys/bluetooth/controller/hal/ecb.h @@ -8,31 +8,31 @@ #ifndef _ECB_H_ #define _ECB_H_ -typedef void (*ecb_fp) (uint32_t status, uint8_t *cipher_be, +typedef void (*ecb_fp) (u32_t status, u8_t *cipher_be, void *context); struct ecb { - uint8_t in_key_be[16]; - uint8_t in_clear_text_be[16]; - uint8_t out_cipher_text_be[16]; + u8_t in_key_be[16]; + u8_t in_clear_text_be[16]; + u8_t out_cipher_text_be[16]; /* if not null reverse copy into in_key_be */ - uint8_t *in_key_le; + u8_t *in_key_le; /* if not null reverse copy into in_clear_text_be */ - uint8_t *in_clear_text_le; + u8_t *in_clear_text_le; ecb_fp fp_ecb; void *context; }; -void ecb_encrypt_be(uint8_t const *const key_be, - uint8_t const *const clear_text_be, - uint8_t * const cipher_text_be); -void ecb_encrypt(uint8_t const *const key_le, - uint8_t const *const clear_text_le, - uint8_t * const cipher_text_le, - uint8_t * const cipher_text_be); -uint32_t ecb_encrypt_nonblocking(struct ecb *ecb); +void ecb_encrypt_be(u8_t const *const key_be, + u8_t const *const clear_text_be, + u8_t * const cipher_text_be); +void ecb_encrypt(u8_t const *const key_le, + u8_t const *const clear_text_le, + u8_t * const cipher_text_le, + u8_t * const cipher_text_be); +u32_t ecb_encrypt_nonblocking(struct ecb *ecb); void isr_ecb(void *param); -uint32_t ecb_ut(void); +u32_t ecb_ut(void); #endif /* _ECB_H_ */ diff --git a/subsys/bluetooth/controller/hal/nrf5/cntr.c b/subsys/bluetooth/controller/hal/nrf5/cntr.c index 0701f830a22..fc56bceb0ad 100644 --- a/subsys/bluetooth/controller/hal/nrf5/cntr.c +++ b/subsys/bluetooth/controller/hal/nrf5/cntr.c @@ -15,7 +15,7 @@ #define NRF_RTC NRF_RTC0 #endif -static uint8_t _refcount; +static u8_t _refcount; void cntr_init(void) { @@ -26,7 +26,7 @@ void cntr_init(void) RTC_INTENSET_COMPARE1_Msk); } -uint32_t cntr_start(void) +u32_t cntr_start(void) { if (_refcount++) { return 1; @@ -37,7 +37,7 @@ uint32_t cntr_start(void) return 0; } -uint32_t cntr_stop(void) +u32_t cntr_stop(void) { LL_ASSERT(_refcount); @@ -50,12 +50,12 @@ uint32_t cntr_stop(void) return 0; } -uint32_t cntr_cnt_get(void) +u32_t cntr_cnt_get(void) { return NRF_RTC->COUNTER; } -void cntr_cmp_set(uint8_t cmp, uint32_t value) +void cntr_cmp_set(u8_t cmp, u32_t value) { NRF_RTC->CC[cmp] = value; } diff --git a/subsys/bluetooth/controller/hal/nrf5/ecb.c b/subsys/bluetooth/controller/hal/nrf5/ecb.c index f4b444faf63..ddf5fd3d09c 100644 --- a/subsys/bluetooth/controller/hal/nrf5/ecb.c +++ b/subsys/bluetooth/controller/hal/nrf5/ecb.c @@ -16,16 +16,16 @@ #include "hal/debug.h" struct ecb_param { - uint8_t key[16]; - uint8_t clear_text[16]; - uint8_t cipher_text[16]; + u8_t key[16]; + u8_t clear_text[16]; + u8_t cipher_text[16]; } __packed; static void do_ecb(struct ecb_param *ecb) { do { NRF_ECB->TASKS_STOPECB = 1; - NRF_ECB->ECBDATAPTR = (uint32_t)ecb; + NRF_ECB->ECBDATAPTR = (u32_t)ecb; NRF_ECB->EVENTS_ENDECB = 0; NRF_ECB->EVENTS_ERRORECB = 0; NRF_ECB->TASKS_STARTECB = 1; @@ -40,9 +40,9 @@ static void do_ecb(struct ecb_param *ecb) NRF_ECB->ECBDATAPTR = 0; } -void ecb_encrypt_be(uint8_t const *const key_be, - uint8_t const *const clear_text_be, - uint8_t * const cipher_text_be) +void ecb_encrypt_be(u8_t const *const key_be, + u8_t const *const clear_text_be, + u8_t * const cipher_text_be) { struct ecb_param ecb; @@ -54,10 +54,10 @@ void ecb_encrypt_be(uint8_t const *const key_be, memcpy(cipher_text_be, &ecb.cipher_text[0], sizeof(ecb.cipher_text)); } -void ecb_encrypt(uint8_t const *const key_le, - uint8_t const *const clear_text_le, - uint8_t * const cipher_text_le, - uint8_t * const cipher_text_be) +void ecb_encrypt(u8_t const *const key_le, + u8_t const *const clear_text_le, + u8_t * const cipher_text_le, + u8_t * const cipher_text_be) { struct ecb_param ecb; @@ -77,7 +77,7 @@ void ecb_encrypt(uint8_t const *const key_le, } } -uint32_t ecb_encrypt_nonblocking(struct ecb *ecb) +u32_t ecb_encrypt_nonblocking(struct ecb *ecb) { /* prepare to be used in a BE AES h/w */ if (ecb->in_key_le) { @@ -91,7 +91,7 @@ uint32_t ecb_encrypt_nonblocking(struct ecb *ecb) } /* setup the encryption h/w */ - NRF_ECB->ECBDATAPTR = (uint32_t)ecb; + NRF_ECB->ECBDATAPTR = (u32_t)ecb; NRF_ECB->EVENTS_ENDECB = 0; NRF_ECB->EVENTS_ERRORECB = 0; NRF_ECB->INTENSET = ECB_INTENSET_ERRORECB_Msk | ECB_INTENSET_ENDECB_Msk; @@ -142,12 +142,12 @@ void isr_ecb(void *param) } struct ecb_ut_context { - uint32_t volatile done; - uint32_t status; - uint8_t cipher_text[16]; + u32_t volatile done; + u32_t status; + u8_t cipher_text[16]; }; -static void ecb_cb(uint32_t status, uint8_t *cipher_be, void *context) +static void ecb_cb(u32_t status, u8_t *cipher_be, void *context) { struct ecb_ut_context *ecb_ut_context = (struct ecb_ut_context *)context; @@ -160,16 +160,16 @@ static void ecb_cb(uint32_t status, uint8_t *cipher_be, void *context) } } -uint32_t ecb_ut(void) +u32_t ecb_ut(void) { - uint8_t key[16] = { + u8_t key[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; - uint8_t clear_text[16] = { + u8_t clear_text[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; - uint8_t cipher_text[16]; - uint32_t status = 0; + u8_t cipher_text[16]; + u32_t status = 0; struct ecb ecb; struct ecb_ut_context context; diff --git a/subsys/bluetooth/controller/hal/nrf5/radio.c b/subsys/bluetooth/controller/hal/nrf5/radio.c index 3732baa8a21..c203fa59a89 100644 --- a/subsys/bluetooth/controller/hal/nrf5/radio.c +++ b/subsys/bluetooth/controller/hal/nrf5/radio.c @@ -60,30 +60,30 @@ void radio_reset(void) RADIO_POWER_POWER_Msk); } -void radio_phy_set(uint8_t phy) +void radio_phy_set(u8_t phy) { NRF_RADIO->MODE = - (((phy) ? (uint32_t)phy : RADIO_MODE_MODE_Ble_1Mbit) << + (((phy) ? (u32_t)phy : RADIO_MODE_MODE_Ble_1Mbit) << RADIO_MODE_MODE_Pos) & RADIO_MODE_MODE_Msk; } -void radio_tx_power_set(uint32_t power) +void radio_tx_power_set(u32_t power) { /* TODO map power to h/w values. */ NRF_RADIO->TXPOWER = power; } -void radio_freq_chan_set(uint32_t chan) +void radio_freq_chan_set(u32_t chan) { NRF_RADIO->FREQUENCY = chan; } -void radio_whiten_iv_set(uint32_t iv) +void radio_whiten_iv_set(u32_t iv) { NRF_RADIO->DATAWHITEIV = iv; } -void radio_aa_set(uint8_t *aa) +void radio_aa_set(u8_t *aa) { NRF_RADIO->TXADDRESS = (((0UL) << RADIO_TXADDRESS_TXADDRESS_Pos) & @@ -94,7 +94,7 @@ void radio_aa_set(uint8_t *aa) NRF_RADIO->BASE0 = (aa[2] << 24) | (aa[1] << 16) | (aa[0] << 8); } -void radio_pkt_configure(uint8_t preamble16, uint8_t bits_len, uint8_t max_len) +void radio_pkt_configure(u8_t preamble16, u8_t bits_len, u8_t max_len) { #if defined(CONFIG_SOC_SERIES_NRF51X) ARG_UNUSED(preamble16); @@ -106,7 +106,7 @@ void radio_pkt_configure(uint8_t preamble16, uint8_t bits_len, uint8_t max_len) NRF_RADIO->PCNF0 = ((((1UL) << RADIO_PCNF0_S0LEN_Pos) & RADIO_PCNF0_S0LEN_Msk) | - ((((uint32_t)bits_len) << RADIO_PCNF0_LFLEN_Pos) & + ((((u32_t)bits_len) << RADIO_PCNF0_LFLEN_Pos) & RADIO_PCNF0_LFLEN_Msk) | #if !defined(CONFIG_SOC_SERIES_NRF51X) (((RADIO_PCNF0_S1INCL_Include) << @@ -116,11 +116,11 @@ void radio_pkt_configure(uint8_t preamble16, uint8_t bits_len, uint8_t max_len) RADIO_PCNF0_PLEN_8bit) << RADIO_PCNF0_PLEN_Pos) & RADIO_PCNF0_PLEN_Msk) | #endif - ((((uint32_t)8-bits_len) << + ((((u32_t)8-bits_len) << RADIO_PCNF0_S1LEN_Pos) & RADIO_PCNF0_S1LEN_Msk)); - NRF_RADIO->PCNF1 = (((((uint32_t)max_len) << RADIO_PCNF1_MAXLEN_Pos) & + NRF_RADIO->PCNF1 = (((((u32_t)max_len) << RADIO_PCNF1_MAXLEN_Pos) & RADIO_PCNF1_MAXLEN_Msk) | (((0UL) << RADIO_PCNF1_STATLEN_Pos) & RADIO_PCNF1_STATLEN_Msk) | @@ -135,12 +135,12 @@ void radio_pkt_configure(uint8_t preamble16, uint8_t bits_len, uint8_t max_len) void radio_pkt_rx_set(void *rx_packet) { - NRF_RADIO->PACKETPTR = (uint32_t)rx_packet; + NRF_RADIO->PACKETPTR = (u32_t)rx_packet; } void radio_pkt_tx_set(void *tx_packet) { - NRF_RADIO->PACKETPTR = (uint32_t)tx_packet; + NRF_RADIO->PACKETPTR = (u32_t)tx_packet; } void radio_rx_enable(void) @@ -168,27 +168,27 @@ void radio_status_reset(void) NRF_RADIO->EVENTS_DISABLED = 0; } -uint32_t radio_is_ready(void) +u32_t radio_is_ready(void) { return NRF_RADIO->EVENTS_READY; } -uint32_t radio_is_done(void) +u32_t radio_is_done(void) { return NRF_RADIO->EVENTS_END; } -uint32_t radio_has_disabled(void) +u32_t radio_has_disabled(void) { return NRF_RADIO->EVENTS_DISABLED; } -uint32_t radio_is_idle(void) +u32_t radio_is_idle(void) { return (NRF_RADIO->STATE == 0); } -void radio_crc_configure(uint32_t polynomial, uint32_t iv) +void radio_crc_configure(u32_t polynomial, u32_t iv) { NRF_RADIO->CRCCNF = (((RADIO_CRCCNF_SKIPADDR_Skip) << RADIO_CRCCNF_SKIPADDR_Pos) & @@ -199,13 +199,13 @@ void radio_crc_configure(uint32_t polynomial, uint32_t iv) NRF_RADIO->CRCINIT = iv; } -uint32_t radio_crc_is_valid(void) +u32_t radio_crc_is_valid(void) { return NRF_RADIO->CRCSTATUS; } -static uint8_t MALIGN(4) _pkt_empty[PDU_EM_SIZE_MAX]; -static uint8_t MALIGN(4) _pkt_scratch[ +static u8_t MALIGN(4) _pkt_empty[PDU_EM_SIZE_MAX]; +static u8_t MALIGN(4) _pkt_scratch[ ((RADIO_PDU_LEN_MAX + 3) > PDU_AC_SIZE_MAX) ? (RADIO_PDU_LEN_MAX + 3) : PDU_AC_SIZE_MAX]; @@ -246,7 +246,7 @@ void radio_rssi_measure(void) RADIO_SHORTS_DISABLED_RSSISTOP_Msk); } -uint32_t radio_rssi_get(void) +u32_t radio_rssi_get(void) { return NRF_RADIO->RSSISAMPLE; } @@ -256,27 +256,27 @@ void radio_rssi_status_reset(void) NRF_RADIO->EVENTS_RSSIEND = 0; } -uint32_t radio_rssi_is_ready(void) +u32_t radio_rssi_is_ready(void) { return NRF_RADIO->EVENTS_RSSIEND; } -void radio_filter_configure(uint8_t bitmask_enable, - uint8_t bitmask_addr_type, - uint8_t *bdaddr) +void radio_filter_configure(u8_t bitmask_enable, + u8_t bitmask_addr_type, + u8_t *bdaddr) { - uint8_t index; + u8_t index; for (index = 0; index < 8; index++) { - NRF_RADIO->DAB[index] = ((uint32_t)bdaddr[3] << 24) | - ((uint32_t)bdaddr[2] << 16) | - ((uint32_t)bdaddr[1] << 8) | + NRF_RADIO->DAB[index] = ((u32_t)bdaddr[3] << 24) | + ((u32_t)bdaddr[2] << 16) | + ((u32_t)bdaddr[1] << 8) | bdaddr[0]; - NRF_RADIO->DAP[index] = ((uint32_t)bdaddr[5] << 8) | bdaddr[4]; + NRF_RADIO->DAP[index] = ((u32_t)bdaddr[5] << 8) | bdaddr[4]; bdaddr += 6; } - NRF_RADIO->DACNF = ((uint32_t)bitmask_addr_type << 8) | bitmask_enable; + NRF_RADIO->DACNF = ((u32_t)bitmask_addr_type << 8) | bitmask_enable; } void radio_filter_disable(void) @@ -290,12 +290,12 @@ void radio_filter_status_reset(void) NRF_RADIO->EVENTS_DEVMISS = 0; } -uint32_t radio_filter_has_match(void) +u32_t radio_filter_has_match(void) { return NRF_RADIO->EVENTS_DEVMATCH; } -void radio_bc_configure(uint32_t n) +void radio_bc_configure(u32_t n) { NRF_RADIO->BCC = n; NRF_RADIO->SHORTS |= RADIO_SHORTS_ADDRESS_BCSTART_Msk; @@ -306,7 +306,7 @@ void radio_bc_status_reset(void) NRF_RADIO->EVENTS_BCMATCH = 0; } -uint32_t radio_bc_has_match(void) +u32_t radio_bc_has_match(void) { return NRF_RADIO->EVENTS_BCMATCH; } @@ -320,12 +320,12 @@ void radio_tmr_status_reset(void) PPI_CHEN_CH6_Msk | PPI_CHEN_CH7_Msk); } -void radio_tmr_tifs_set(uint32_t tifs) +void radio_tmr_tifs_set(u32_t tifs) { NRF_RADIO->TIFS = tifs; } -uint32_t radio_tmr_start(uint8_t trx, uint32_t ticks_start, uint32_t remainder) +u32_t radio_tmr_start(u8_t trx, u32_t ticks_start, u32_t remainder) { if ((!(remainder / 1000000UL)) || (remainder & 0x80000000)) { ticks_start--; @@ -345,21 +345,21 @@ uint32_t radio_tmr_start(uint8_t trx, uint32_t ticks_start, uint32_t remainder) NRF_RTC0->EVTENSET = RTC_EVTENSET_COMPARE2_Msk; NRF_RTC0->EVENTS_COMPARE[2] = 0; - NRF_PPI->CH[1].EEP = (uint32_t)&(NRF_RTC0->EVENTS_COMPARE[2]); - NRF_PPI->CH[1].TEP = (uint32_t)&(NRF_TIMER0->TASKS_START); + NRF_PPI->CH[1].EEP = (u32_t)&(NRF_RTC0->EVENTS_COMPARE[2]); + NRF_PPI->CH[1].TEP = (u32_t)&(NRF_TIMER0->TASKS_START); NRF_PPI->CHENSET = PPI_CHEN_CH1_Msk; if (trx) { NRF_PPI->CH[0].EEP = - (uint32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]); + (u32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]); NRF_PPI->CH[0].TEP = - (uint32_t)&(NRF_RADIO->TASKS_TXEN); + (u32_t)&(NRF_RADIO->TASKS_TXEN); NRF_PPI->CHENSET = PPI_CHEN_CH0_Msk; } else { NRF_PPI->CH[0].EEP = - (uint32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]); + (u32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]); NRF_PPI->CH[0].TEP = - (uint32_t)&(NRF_RADIO->TASKS_RXEN); + (u32_t)&(NRF_RADIO->TASKS_RXEN); NRF_PPI->CHENSET = PPI_CHEN_CH0_Msk; } @@ -372,40 +372,40 @@ void radio_tmr_stop(void) NRF_TIMER0->TASKS_SHUTDOWN = 1; } -void radio_tmr_hcto_configure(uint32_t hcto) +void radio_tmr_hcto_configure(u32_t hcto) { NRF_TIMER0->CC[2] = hcto; NRF_TIMER0->EVENTS_COMPARE[2] = 0; - NRF_PPI->CH[4].EEP = (uint32_t)&(NRF_RADIO->EVENTS_ADDRESS); - NRF_PPI->CH[4].TEP = (uint32_t)&(NRF_TIMER0->TASKS_CAPTURE[2]); - NRF_PPI->CH[5].EEP = (uint32_t)&(NRF_TIMER0->EVENTS_COMPARE[2]); - NRF_PPI->CH[5].TEP = (uint32_t)&(NRF_RADIO->TASKS_DISABLE); + NRF_PPI->CH[4].EEP = (u32_t)&(NRF_RADIO->EVENTS_ADDRESS); + NRF_PPI->CH[4].TEP = (u32_t)&(NRF_TIMER0->TASKS_CAPTURE[2]); + NRF_PPI->CH[5].EEP = (u32_t)&(NRF_TIMER0->EVENTS_COMPARE[2]); + NRF_PPI->CH[5].TEP = (u32_t)&(NRF_RADIO->TASKS_DISABLE); NRF_PPI->CHENSET = (PPI_CHEN_CH4_Msk | PPI_CHEN_CH5_Msk); } void radio_tmr_aa_capture(void) { - NRF_PPI->CH[2].EEP = (uint32_t)&(NRF_RADIO->EVENTS_READY); - NRF_PPI->CH[2].TEP = (uint32_t)&(NRF_TIMER0->TASKS_CAPTURE[0]); - NRF_PPI->CH[3].EEP = (uint32_t)&(NRF_RADIO->EVENTS_ADDRESS); - NRF_PPI->CH[3].TEP = (uint32_t)&(NRF_TIMER0->TASKS_CAPTURE[1]); + NRF_PPI->CH[2].EEP = (u32_t)&(NRF_RADIO->EVENTS_READY); + NRF_PPI->CH[2].TEP = (u32_t)&(NRF_TIMER0->TASKS_CAPTURE[0]); + NRF_PPI->CH[3].EEP = (u32_t)&(NRF_RADIO->EVENTS_ADDRESS); + NRF_PPI->CH[3].TEP = (u32_t)&(NRF_TIMER0->TASKS_CAPTURE[1]); NRF_PPI->CHENSET = (PPI_CHEN_CH2_Msk | PPI_CHEN_CH3_Msk); } -uint32_t radio_tmr_aa_get(void) +u32_t radio_tmr_aa_get(void) { return (NRF_TIMER0->CC[1] - NRF_TIMER0->CC[0]); } void radio_tmr_end_capture(void) { - NRF_PPI->CH[7].EEP = (uint32_t)&(NRF_RADIO->EVENTS_END); - NRF_PPI->CH[7].TEP = (uint32_t)&(NRF_TIMER0->TASKS_CAPTURE[2]); + NRF_PPI->CH[7].EEP = (u32_t)&(NRF_RADIO->EVENTS_END); + NRF_PPI->CH[7].TEP = (u32_t)&(NRF_TIMER0->TASKS_CAPTURE[2]); NRF_PPI->CHENSET = PPI_CHEN_CH7_Msk; } -uint32_t radio_tmr_end_get(void) +u32_t radio_tmr_end_get(void) { return NRF_TIMER0->CC[2]; } @@ -415,12 +415,12 @@ void radio_tmr_sample(void) NRF_TIMER0->TASKS_CAPTURE[3] = 1; } -uint32_t radio_tmr_sample_get(void) +u32_t radio_tmr_sample_get(void) { return NRF_TIMER0->CC[3]; } -static uint8_t MALIGN(4) _ccm_scratch[(RADIO_PDU_LEN_MAX - 4) + 16]; +static u8_t MALIGN(4) _ccm_scratch[(RADIO_PDU_LEN_MAX - 4) + 16]; void *radio_ccm_rx_pkt_set(struct ccm *ccm, void *pkt) { @@ -433,17 +433,17 @@ void *radio_ccm_rx_pkt_set(struct ccm *ccm, void *pkt) #endif ((CCM_MODE_MODE_Decryption << CCM_MODE_MODE_Pos) & CCM_MODE_MODE_Msk); - NRF_CCM->CNFPTR = (uint32_t)ccm; - NRF_CCM->INPTR = (uint32_t)_pkt_scratch; - NRF_CCM->OUTPTR = (uint32_t)pkt; - NRF_CCM->SCRATCHPTR = (uint32_t)_ccm_scratch; + NRF_CCM->CNFPTR = (u32_t)ccm; + NRF_CCM->INPTR = (u32_t)_pkt_scratch; + NRF_CCM->OUTPTR = (u32_t)pkt; + NRF_CCM->SCRATCHPTR = (u32_t)_ccm_scratch; NRF_CCM->SHORTS = 0; NRF_CCM->EVENTS_ENDKSGEN = 0; NRF_CCM->EVENTS_ENDCRYPT = 0; NRF_CCM->EVENTS_ERROR = 0; - NRF_PPI->CH[6].EEP = (uint32_t)&(NRF_RADIO->EVENTS_ADDRESS); - NRF_PPI->CH[6].TEP = (uint32_t)&(NRF_CCM->TASKS_CRYPT); + NRF_PPI->CH[6].EEP = (u32_t)&(NRF_RADIO->EVENTS_ADDRESS); + NRF_PPI->CH[6].TEP = (u32_t)&(NRF_CCM->TASKS_CRYPT); NRF_PPI->CHENSET = PPI_CHEN_CH6_Msk; NRF_CCM->TASKS_KSGEN = 1; @@ -462,10 +462,10 @@ void *radio_ccm_tx_pkt_set(struct ccm *ccm, void *pkt) #endif ((CCM_MODE_MODE_Encryption << CCM_MODE_MODE_Pos) & CCM_MODE_MODE_Msk); - NRF_CCM->CNFPTR = (uint32_t)ccm; - NRF_CCM->INPTR = (uint32_t)pkt; - NRF_CCM->OUTPTR = (uint32_t)_pkt_scratch; - NRF_CCM->SCRATCHPTR = (uint32_t)_ccm_scratch; + NRF_CCM->CNFPTR = (u32_t)ccm; + NRF_CCM->INPTR = (u32_t)pkt; + NRF_CCM->OUTPTR = (u32_t)_pkt_scratch; + NRF_CCM->SCRATCHPTR = (u32_t)_ccm_scratch; NRF_CCM->SHORTS = CCM_SHORTS_ENDKSGEN_CRYPT_Msk; NRF_CCM->EVENTS_ENDKSGEN = 0; NRF_CCM->EVENTS_ENDCRYPT = 0; @@ -473,8 +473,8 @@ void *radio_ccm_tx_pkt_set(struct ccm *ccm, void *pkt) #if defined(CONFIG_SOC_SERIES_NRF51X) /* set up PPI to enable CCM */ - NRF_PPI->CH[6].EEP = (uint32_t)&(NRF_RADIO->EVENTS_READY); - NRF_PPI->CH[6].TEP = (uint32_t)&(NRF_CCM->TASKS_KSGEN); + NRF_PPI->CH[6].EEP = (u32_t)&(NRF_RADIO->EVENTS_READY); + NRF_PPI->CH[6].TEP = (u32_t)&(NRF_CCM->TASKS_KSGEN); NRF_PPI->CHENSET = PPI_CHEN_CH6_Msk; #elif 0 /* encrypt tx packet */ @@ -497,7 +497,7 @@ void *radio_ccm_tx_pkt_set(struct ccm *ccm, void *pkt) return _pkt_scratch; } -uint32_t radio_ccm_is_done(void) +u32_t radio_ccm_is_done(void) { NRF_CCM->INTENSET = CCM_INTENSET_ENDCRYPT_Msk; while (NRF_CCM->EVENTS_ENDCRYPT == 0) { @@ -511,29 +511,29 @@ uint32_t radio_ccm_is_done(void) return (NRF_CCM->EVENTS_ERROR == 0); } -uint32_t radio_ccm_mic_is_valid(void) +u32_t radio_ccm_mic_is_valid(void) { return NRF_CCM->MICSTATUS; } -static uint8_t MALIGN(4) _aar_scratch[3]; +static u8_t MALIGN(4) _aar_scratch[3]; -void radio_ar_configure(uint32_t nirk, void *irk) +void radio_ar_configure(u32_t nirk, void *irk) { NRF_AAR->ENABLE = 1; NRF_AAR->NIRK = nirk; - NRF_AAR->IRKPTR = (uint32_t)irk; - NRF_AAR->ADDRPTR = (uint32_t)NRF_RADIO->PACKETPTR; - NRF_AAR->SCRATCHPTR = (uint32_t)_aar_scratch[0]; + NRF_AAR->IRKPTR = (u32_t)irk; + NRF_AAR->ADDRPTR = (u32_t)NRF_RADIO->PACKETPTR; + NRF_AAR->SCRATCHPTR = (u32_t)_aar_scratch[0]; radio_bc_configure(64); - NRF_PPI->CH[6].EEP = (uint32_t)&(NRF_RADIO->EVENTS_BCMATCH); - NRF_PPI->CH[6].TEP = (uint32_t)&(NRF_AAR->TASKS_START); + NRF_PPI->CH[6].EEP = (u32_t)&(NRF_RADIO->EVENTS_BCMATCH); + NRF_PPI->CH[6].TEP = (u32_t)&(NRF_AAR->TASKS_START); NRF_PPI->CHENSET = PPI_CHEN_CH6_Msk; } -uint32_t radio_ar_match_get(void) +u32_t radio_ar_match_get(void) { return NRF_AAR->STATUS; } @@ -549,7 +549,7 @@ void radio_ar_status_reset(void) radio_bc_status_reset(); } -uint32_t radio_ar_has_match(void) +u32_t radio_ar_has_match(void) { return (radio_bc_has_match() && (NRF_AAR->EVENTS_END) && diff --git a/subsys/bluetooth/controller/hal/nrf5/rand.c b/subsys/bluetooth/controller/hal/nrf5/rand.c index 2cdd6705df6..61a40b2ea86 100644 --- a/subsys/bluetooth/controller/hal/nrf5/rand.c +++ b/subsys/bluetooth/controller/hal/nrf5/rand.c @@ -15,15 +15,15 @@ #define RAND_RESERVED (4) struct rand { - uint8_t count; - uint8_t first; - uint8_t last; - uint8_t rand[1]; + u8_t count; + u8_t first; + u8_t last; + u8_t rand[1]; }; static struct rand *rng; -void rand_init(uint8_t *context, uint8_t context_len) +void rand_init(u8_t *context, u8_t context_len) { LL_ASSERT(context_len > sizeof(struct rand)); @@ -38,10 +38,10 @@ void rand_init(uint8_t *context, uint8_t context_len) NRF_RNG->TASKS_START = 1; } -size_t rand_get(size_t octets, uint8_t *rand) +size_t rand_get(size_t octets, u8_t *rand) { - uint8_t reserved; - uint8_t first; + u8_t reserved; + u8_t first; while (octets) { if (rng->first == rng->last) { @@ -80,7 +80,7 @@ void isr_rand(void *param) ARG_UNUSED(param); if (NRF_RNG->EVENTS_VALRDY) { - uint8_t last; + u8_t last; last = rng->last + 1; if (last == rng->count) { diff --git a/subsys/bluetooth/controller/hal/radio.h b/subsys/bluetooth/controller/hal/radio.h index d6851482178..afe3d63c702 100644 --- a/subsys/bluetooth/controller/hal/radio.h +++ b/subsys/bluetooth/controller/hal/radio.h @@ -26,12 +26,12 @@ void isr_radio(void); void radio_isr_set(radio_isr_fp fp_radio_isr); void radio_reset(void); -void radio_phy_set(uint8_t phy); -void radio_tx_power_set(uint32_t power); -void radio_freq_chan_set(uint32_t chan); -void radio_whiten_iv_set(uint32_t iv); -void radio_aa_set(uint8_t *aa); -void radio_pkt_configure(uint8_t preamble16, uint8_t bits_len, uint8_t max_len); +void radio_phy_set(u8_t phy); +void radio_tx_power_set(u32_t power); +void radio_freq_chan_set(u32_t chan); +void radio_whiten_iv_set(u32_t iv); +void radio_aa_set(u8_t *aa); +void radio_pkt_configure(u8_t preamble16, u8_t bits_len, u8_t max_len); void radio_pkt_rx_set(void *rx_packet); void radio_pkt_tx_set(void *tx_packet); void radio_rx_enable(void); @@ -39,13 +39,13 @@ void radio_tx_enable(void); void radio_disable(void); void radio_status_reset(void); -uint32_t radio_is_ready(void); -uint32_t radio_is_done(void); -uint32_t radio_has_disabled(void); -uint32_t radio_is_idle(void); +u32_t radio_is_ready(void); +u32_t radio_is_done(void); +u32_t radio_has_disabled(void); +u32_t radio_is_idle(void); -void radio_crc_configure(uint32_t polynomial, uint32_t iv); -uint32_t radio_crc_is_valid(void); +void radio_crc_configure(u32_t polynomial, u32_t iv); +u32_t radio_crc_is_valid(void); void *radio_pkt_empty_get(void); void *radio_pkt_scratch_get(void); @@ -55,41 +55,41 @@ void radio_switch_complete_and_tx(void); void radio_switch_complete_and_disable(void); void radio_rssi_measure(void); -uint32_t radio_rssi_get(void); +u32_t radio_rssi_get(void); void radio_rssi_status_reset(void); -uint32_t radio_rssi_is_ready(void); +u32_t radio_rssi_is_ready(void); -void radio_filter_configure(uint8_t bitmask_enable, - uint8_t bitmask_addr_type, - uint8_t *bdaddr); +void radio_filter_configure(u8_t bitmask_enable, + u8_t bitmask_addr_type, + u8_t *bdaddr); void radio_filter_disable(void); void radio_filter_status_reset(void); -uint32_t radio_filter_has_match(void); +u32_t radio_filter_has_match(void); -void radio_bc_configure(uint32_t n); +void radio_bc_configure(u32_t n); void radio_bc_status_reset(void); -uint32_t radio_bc_has_match(void); +u32_t radio_bc_has_match(void); void radio_tmr_status_reset(void); -void radio_tmr_tifs_set(uint32_t tifs); -uint32_t radio_tmr_start(uint8_t trx, uint32_t ticks_start, uint32_t remainder); +void radio_tmr_tifs_set(u32_t tifs); +u32_t radio_tmr_start(u8_t trx, u32_t ticks_start, u32_t remainder); void radio_tmr_stop(void); -void radio_tmr_hcto_configure(uint32_t hcto); +void radio_tmr_hcto_configure(u32_t hcto); void radio_tmr_aa_capture(void); -uint32_t radio_tmr_aa_get(void); +u32_t radio_tmr_aa_get(void); void radio_tmr_end_capture(void); -uint32_t radio_tmr_end_get(void); +u32_t radio_tmr_end_get(void); void radio_tmr_sample(void); -uint32_t radio_tmr_sample_get(void); +u32_t radio_tmr_sample_get(void); void *radio_ccm_rx_pkt_set(struct ccm *ccm, void *pkt); void *radio_ccm_tx_pkt_set(struct ccm *ccm, void *pkt); -uint32_t radio_ccm_is_done(void); -uint32_t radio_ccm_mic_is_valid(void); +u32_t radio_ccm_is_done(void); +u32_t radio_ccm_mic_is_valid(void); -void radio_ar_configure(uint32_t nirk, void *irk); -uint32_t radio_ar_match_get(void); +void radio_ar_configure(u32_t nirk, void *irk); +u32_t radio_ar_match_get(void); void radio_ar_status_reset(void); -uint32_t radio_ar_has_match(void); +u32_t radio_ar_has_match(void); #endif diff --git a/subsys/bluetooth/controller/hal/rand.h b/subsys/bluetooth/controller/hal/rand.h index ca20c85585e..a09c2dec69a 100644 --- a/subsys/bluetooth/controller/hal/rand.h +++ b/subsys/bluetooth/controller/hal/rand.h @@ -8,8 +8,8 @@ #ifndef _RAND_H_ #define _RAND_H_ -void rand_init(uint8_t *context, uint8_t context_len); -size_t rand_get(size_t octets, uint8_t *rand); +void rand_init(u8_t *context, u8_t context_len); +size_t rand_get(size_t octets, u8_t *rand); void isr_rand(void *param); #endif /* _RAND_H_ */ diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index aab06056fb4..aea30c9c6d2 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -33,26 +33,26 @@ * by hci_cmd_handle() and then used during the creation of cmd complete and * cmd status events to avoid passing it up the call chain. */ -static uint16_t _opcode; +static u16_t _opcode; #if CONFIG_BLUETOOTH_CONTROLLER_DUP_FILTER_LEN > 0 /* Scan duplicate filter */ struct dup { - uint8_t mask; + u8_t mask; bt_addr_le_t addr; }; static struct dup dup_filter[CONFIG_BLUETOOTH_CONTROLLER_DUP_FILTER_LEN]; -static int32_t dup_count; -static uint32_t dup_curr; +static s32_t dup_count; +static u32_t dup_curr; #endif #define DEFAULT_EVENT_MASK 0x1fffffffffff #define DEFAULT_LE_EVENT_MASK 0x1f -static uint64_t event_mask = DEFAULT_EVENT_MASK; -static uint64_t le_event_mask = DEFAULT_LE_EVENT_MASK; +static u64_t event_mask = DEFAULT_EVENT_MASK; +static u64_t le_event_mask = DEFAULT_LE_EVENT_MASK; -static void evt_create(struct net_buf *buf, uint8_t evt, uint8_t len) +static void evt_create(struct net_buf *buf, u8_t evt, u8_t len) { struct bt_hci_evt_hdr *hdr; @@ -61,7 +61,7 @@ static void evt_create(struct net_buf *buf, uint8_t evt, uint8_t len) hdr->len = len; } -static void *cmd_complete(struct net_buf **buf, uint8_t plen) +static void *cmd_complete(struct net_buf **buf, u8_t plen) { struct bt_hci_evt_cmd_complete *cc; @@ -76,7 +76,7 @@ static void *cmd_complete(struct net_buf **buf, uint8_t plen) return net_buf_add(*buf, plen); } -static struct net_buf *cmd_status(uint8_t status) +static struct net_buf *cmd_status(u8_t status) { struct bt_hci_evt_cmd_status *cs; struct net_buf *buf; @@ -92,7 +92,7 @@ static struct net_buf *cmd_status(uint8_t status) return buf; } -static void *meta_evt(struct net_buf *buf, uint8_t subevt, uint8_t melen) +static void *meta_evt(struct net_buf *buf, u8_t subevt, u8_t melen) { struct bt_hci_evt_le_meta_event *me; @@ -106,8 +106,8 @@ static void *meta_evt(struct net_buf *buf, uint8_t subevt, uint8_t melen) static void disconnect(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_disconnect *cmd = (void *)buf->data; - uint16_t handle; - uint32_t status; + u16_t handle; + u32_t status; handle = sys_le16_to_cpu(cmd->handle); status = ll_terminate_ind_send(handle, cmd->reason); @@ -118,8 +118,8 @@ static void disconnect(struct net_buf *buf, struct net_buf **evt) static void read_remote_ver_info(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_read_remote_version_info *cmd = (void *)buf->data; - uint16_t handle; - uint32_t status; + u16_t handle; + u32_t status; handle = sys_le16_to_cpu(cmd->handle); status = ll_version_ind_send(handle); @@ -127,7 +127,7 @@ static void read_remote_ver_info(struct net_buf *buf, struct net_buf **evt) *evt = cmd_status((!status) ? 0x00 : BT_HCI_ERR_CMD_DISALLOWED); } -static int link_control_cmd_handle(uint8_t ocf, struct net_buf *cmd, +static int link_control_cmd_handle(u8_t ocf, struct net_buf *cmd, struct net_buf **evt) { switch (ocf) { @@ -172,7 +172,7 @@ static void reset(struct net_buf *buf, struct net_buf **evt) ccst->status = 0x00; } -static int ctrl_bb_cmd_handle(uint8_t ocf, struct net_buf *cmd, +static int ctrl_bb_cmd_handle(u8_t ocf, struct net_buf *cmd, struct net_buf **evt) { switch (ocf) { @@ -276,7 +276,7 @@ static void read_bd_addr(struct net_buf *buf, struct net_buf **evt) ll_address_get(0, &rp->bdaddr.val[0]); } -static int info_cmd_handle(uint8_t ocf, struct net_buf *cmd, +static int info_cmd_handle(u8_t ocf, struct net_buf *cmd, struct net_buf **evt) { switch (ocf) { @@ -355,10 +355,10 @@ static void le_set_adv_param(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_set_adv_param *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - uint8_t const c_adv_type[] = { + u8_t const c_adv_type[] = { PDU_ADV_TYPE_ADV_IND, PDU_ADV_TYPE_DIRECT_IND, PDU_ADV_TYPE_SCAN_IND, PDU_ADV_TYPE_NONCONN_IND }; - uint16_t min_interval; + u16_t min_interval; min_interval = sys_le16_to_cpu(cmd->min_interval); @@ -408,7 +408,7 @@ static void le_set_adv_enable(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_set_adv_enable *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - uint32_t status; + u32_t status; status = ll_adv_enable(cmd->enable); @@ -420,8 +420,8 @@ static void le_set_scan_param(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_set_scan_param *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - uint16_t interval; - uint16_t window; + u16_t interval; + u16_t window; interval = sys_le16_to_cpu(cmd->interval); window = sys_le16_to_cpu(cmd->window); @@ -437,7 +437,7 @@ static void le_set_scan_enable(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_set_scan_enable *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - uint32_t status; + u32_t status; #if CONFIG_BLUETOOTH_CONTROLLER_DUP_FILTER_LEN > 0 /* initialize duplicate filtering */ @@ -457,12 +457,12 @@ static void le_set_scan_enable(struct net_buf *buf, struct net_buf **evt) static void le_create_connection(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_create_conn *cmd = (void *)buf->data; - uint16_t supervision_timeout; - uint16_t conn_interval_max; - uint16_t scan_interval; - uint16_t conn_latency; - uint16_t scan_window; - uint32_t status; + u16_t supervision_timeout; + u16_t conn_interval_max; + u16_t scan_interval; + u16_t conn_latency; + u16_t scan_window; + u32_t status; scan_interval = sys_le16_to_cpu(cmd->scan_interval); scan_window = sys_le16_to_cpu(cmd->scan_window); @@ -483,7 +483,7 @@ static void le_create_connection(struct net_buf *buf, struct net_buf **evt) static void le_create_conn_cancel(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_evt_cc_status *ccst; - uint32_t status; + u32_t status; status = ll_connect_disable(); @@ -515,7 +515,7 @@ static void le_add_dev_to_wl(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_add_dev_to_wl *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - uint32_t status; + u32_t status; status = ll_filter_add(cmd->addr.type, &cmd->addr.a.val[0]); @@ -527,7 +527,7 @@ static void le_rem_dev_from_wl(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_rem_dev_from_wl *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - uint32_t status; + u32_t status; status = ll_filter_remove(cmd->addr.type, &cmd->addr.a.val[0]); @@ -538,11 +538,11 @@ static void le_rem_dev_from_wl(struct net_buf *buf, struct net_buf **evt) static void le_conn_update(struct net_buf *buf, struct net_buf **evt) { struct hci_cp_le_conn_update *cmd = (void *)buf->data; - uint16_t supervision_timeout; - uint16_t conn_interval_max; - uint16_t conn_latency; - uint32_t status; - uint16_t handle; + u16_t supervision_timeout; + u16_t conn_interval_max; + u16_t conn_latency; + u32_t status; + u16_t handle; handle = sys_le16_to_cpu(cmd->handle); conn_interval_max = sys_le16_to_cpu(cmd->conn_interval_max); @@ -562,7 +562,7 @@ static void le_set_host_chan_classif(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_set_host_chan_classif *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - uint32_t status; + u32_t status; status = ll_chm_update(&cmd->ch_map[0]); @@ -573,8 +573,8 @@ static void le_set_host_chan_classif(struct net_buf *buf, struct net_buf **evt) static void le_read_remote_features(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_read_remote_features *cmd = (void *)buf->data; - uint32_t status; - uint16_t handle; + u32_t status; + u16_t handle; handle = sys_le16_to_cpu(cmd->handle); status = ll_feature_req_send(handle); @@ -586,7 +586,7 @@ static void le_encrypt(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_encrypt *cmd = (void *)buf->data; struct bt_hci_rp_le_encrypt *rp; - uint8_t enc_data[16]; + u8_t enc_data[16]; ecb_encrypt(cmd->key, cmd->plaintext, enc_data, NULL); @@ -599,7 +599,7 @@ static void le_encrypt(struct net_buf *buf, struct net_buf **evt) static void le_rand(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_rp_le_rand *rp; - uint8_t count = sizeof(rp->rand); + u8_t count = sizeof(rp->rand); rp = cmd_complete(evt, sizeof(*rp)); rp->status = 0x00; @@ -610,13 +610,13 @@ static void le_rand(struct net_buf *buf, struct net_buf **evt) static void le_start_encryption(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_start_encryption *cmd = (void *)buf->data; - uint32_t status; - uint16_t handle; + u32_t status; + u16_t handle; handle = sys_le16_to_cpu(cmd->handle); status = ll_enc_req_send(handle, - (uint8_t *)&cmd->rand, - (uint8_t *)&cmd->ediv, + (u8_t *)&cmd->rand, + (u8_t *)&cmd->ediv, &cmd->ltk[0]); *evt = cmd_status((!status) ? 0x00 : BT_HCI_ERR_CMD_DISALLOWED); @@ -626,8 +626,8 @@ static void le_ltk_req_reply(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_ltk_req_reply *cmd = (void *)buf->data; struct bt_hci_rp_le_ltk_req_reply *rp; - uint32_t status; - uint16_t handle; + u32_t status; + u16_t handle; handle = sys_le16_to_cpu(cmd->handle); status = ll_start_enc_req_send(handle, 0x00, &cmd->ltk[0]); @@ -641,8 +641,8 @@ static void le_ltk_req_neg_reply(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_ltk_req_neg_reply *cmd = (void *)buf->data; struct bt_hci_rp_le_ltk_req_neg_reply *rp; - uint32_t status; - uint16_t handle; + u32_t status; + u16_t handle; handle = sys_le16_to_cpu(cmd->handle); status = ll_start_enc_req_send(handle, BT_HCI_ERR_PIN_OR_KEY_MISSING, @@ -667,11 +667,11 @@ static void le_conn_param_req_reply(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_conn_param_req_reply *cmd = (void *)buf->data; struct bt_hci_rp_le_conn_param_req_reply *rp; - uint16_t interval_max; - uint16_t latency; - uint16_t timeout; - uint32_t status; - uint16_t handle; + u16_t interval_max; + u16_t latency; + u16_t timeout; + u32_t status; + u16_t handle; handle = sys_le16_to_cpu(cmd->handle); interval_max = sys_le16_to_cpu(cmd->interval_max); @@ -691,8 +691,8 @@ static void le_conn_param_req_neg_reply(struct net_buf *buf, { struct bt_hci_cp_le_conn_param_req_neg_reply *cmd = (void *)buf->data; struct bt_hci_rp_le_conn_param_req_neg_reply *rp; - uint32_t status; - uint16_t handle; + u32_t status; + u16_t handle; handle = sys_le16_to_cpu(cmd->handle); status = ll_conn_update(handle, 2, cmd->reason, 0, 0, 0); @@ -707,9 +707,9 @@ static void le_set_data_len(struct net_buf *buf, struct net_buf **evt) { struct bt_hci_cp_le_set_data_len *cmd = (void *)buf->data; struct bt_hci_rp_le_set_data_len *rp; - uint32_t status; - uint16_t tx_octets; - uint16_t handle; + u32_t status; + u16_t tx_octets; + u16_t handle; handle = sys_le16_to_cpu(cmd->handle); tx_octets = sys_le16_to_cpu(cmd->tx_octets); @@ -736,7 +736,7 @@ static void le_write_default_data_len(struct net_buf *buf, { struct bt_hci_cp_le_write_default_data_len *cmd = (void *)buf->data; struct bt_hci_evt_cc_status *ccst; - uint32_t status; + u32_t status; status = ll_length_default_set(cmd->max_tx_octets, cmd->max_tx_time); @@ -756,7 +756,7 @@ static void le_read_max_data_len(struct net_buf *buf, struct net_buf **evt) } #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ -static int controller_cmd_handle(uint8_t ocf, struct net_buf *cmd, +static int controller_cmd_handle(u8_t ocf, struct net_buf *cmd, struct net_buf **evt) { switch (ocf) { @@ -902,7 +902,7 @@ struct net_buf *hci_cmd_handle(struct net_buf *cmd) struct bt_hci_evt_cc_status *ccst; struct bt_hci_cmd_hdr *chdr; struct net_buf *evt = NULL; - uint8_t ocf; + u8_t ocf; int err; if (cmd->len < sizeof(*chdr)) { @@ -956,9 +956,9 @@ int hci_acl_handle(struct net_buf *buf) { struct radio_pdu_node_tx *radio_pdu_node_tx; struct bt_hci_acl_hdr *acl; - uint16_t handle; - uint8_t flags; - uint16_t len; + u16_t handle; + u8_t flags; + u16_t len; if (buf->len < sizeof(*acl)) { BT_ERR("No HCI ACL header"); @@ -999,17 +999,17 @@ int hci_acl_handle(struct net_buf *buf) return 0; } -static void le_advertising_report(struct pdu_data *pdu_data, uint8_t *b, +static void le_advertising_report(struct pdu_data *pdu_data, u8_t *b, struct net_buf *buf) { - const uint8_t c_adv_type[] = { 0x00, 0x01, 0x03, 0xff, 0x04, + const u8_t c_adv_type[] = { 0x00, 0x01, 0x03, 0xff, 0x04, 0xff, 0x02 }; struct bt_hci_ev_le_advertising_report *sep; struct pdu_adv *adv = (struct pdu_adv *)pdu_data; struct bt_hci_ev_le_advertising_info *adv_info; - uint8_t data_len; - uint8_t *rssi; - uint8_t info_len; + u8_t data_len; + u8_t *rssi; + u8_t info_len; if (!(event_mask & BT_EVT_MASK_LE_META_EVENT) || !(le_event_mask & BT_EVT_MASK_LE_ADVERTISING_REPORT)) { @@ -1069,7 +1069,7 @@ fill_report: sizeof(*sep) + info_len); sep->num_reports = 1; - adv_info = (void *)(((uint8_t *)sep) + sizeof(*sep)); + adv_info = (void *)(((u8_t *)sep) + sizeof(*sep)); adv_info->evt_type = c_adv_type[adv->type]; adv_info->addr.type = adv->tx_addr; @@ -1085,7 +1085,7 @@ fill_report: } -static void le_conn_complete(struct pdu_data *pdu_data, uint16_t handle, +static void le_conn_complete(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_le_conn_complete *sep; @@ -1111,7 +1111,7 @@ static void le_conn_complete(struct pdu_data *pdu_data, uint16_t handle, sep->clock_accuracy = radio_cc->mca; } -static void disconn_complete(struct pdu_data *pdu_data, uint16_t handle, +static void disconn_complete(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_disconn_complete *ep; @@ -1125,10 +1125,10 @@ static void disconn_complete(struct pdu_data *pdu_data, uint16_t handle, ep->status = 0x00; ep->handle = sys_cpu_to_le16(handle); - ep->reason = *((uint8_t *)pdu_data); + ep->reason = *((u8_t *)pdu_data); } -static void le_conn_update_complete(struct pdu_data *pdu_data, uint16_t handle, +static void le_conn_update_complete(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_le_conn_update_complete *sep; @@ -1151,7 +1151,7 @@ static void le_conn_update_complete(struct pdu_data *pdu_data, uint16_t handle, sep->supv_timeout = sys_cpu_to_le16(radio_cu->timeout); } -static void enc_refresh_complete(struct pdu_data *pdu_data, uint16_t handle, +static void enc_refresh_complete(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_encrypt_key_refresh_complete *ep; @@ -1168,7 +1168,7 @@ static void enc_refresh_complete(struct pdu_data *pdu_data, uint16_t handle, } #if defined(CONFIG_BLUETOOTH_CONTROLLER_LE_PING) -static void auth_payload_timeout_exp(struct pdu_data *pdu_data, uint16_t handle, +static void auth_payload_timeout_exp(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_auth_payload_timeout_exp *ep; @@ -1181,7 +1181,7 @@ static void auth_payload_timeout_exp(struct pdu_data *pdu_data, uint16_t handle, #endif /* CONFIG_BLUETOOTH_CONTROLLER_LE_PING */ #if defined(CONFIG_BLUETOOTH_CONTROLLER_CHAN_SEL_2) -static void le_chan_sel_algo(struct pdu_data *pdu_data, uint16_t handle, +static void le_chan_sel_algo(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_le_chan_sel_algo *sep; @@ -1205,8 +1205,8 @@ static void le_chan_sel_algo(struct pdu_data *pdu_data, uint16_t handle, static void encode_control(struct radio_pdu_node_rx *node_rx, struct pdu_data *pdu_data, struct net_buf *buf) { - uint8_t *b = (uint8_t *)node_rx; - uint16_t handle; + u8_t *b = (u8_t *)node_rx; + u16_t handle; handle = node_rx->hdr.handle; @@ -1274,7 +1274,7 @@ static void encode_control(struct radio_pdu_node_rx *node_rx, } } -static void le_ltk_request(struct pdu_data *pdu_data, uint16_t handle, +static void le_ltk_request(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_le_ltk_request *sep; @@ -1288,12 +1288,12 @@ static void le_ltk_request(struct pdu_data *pdu_data, uint16_t handle, sep->handle = sys_cpu_to_le16(handle); memcpy(&sep->rand, pdu_data->payload.llctrl.ctrldata.enc_req.rand, - sizeof(uint64_t)); + sizeof(u64_t)); memcpy(&sep->ediv, pdu_data->payload.llctrl.ctrldata.enc_req.ediv, - sizeof(uint16_t)); + sizeof(u16_t)); } -static void encrypt_change(uint8_t err, uint16_t handle, +static void encrypt_change(u8_t err, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_encrypt_change *ep; @@ -1310,8 +1310,8 @@ static void encrypt_change(uint8_t err, uint16_t handle, ep->encrypt = !err ? 1 : 0; } -static void le_remote_feat_complete(uint8_t status, struct pdu_data *pdu_data, - uint16_t handle, struct net_buf *buf) +static void le_remote_feat_complete(u8_t status, struct pdu_data *pdu_data, + u16_t handle, struct net_buf *buf) { struct bt_hci_ev_le_remote_feat_complete *sep; @@ -1333,7 +1333,7 @@ static void le_remote_feat_complete(uint8_t status, struct pdu_data *pdu_data, } } -static void le_unknown_rsp(struct pdu_data *pdu_data, uint16_t handle, +static void le_unknown_rsp(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { @@ -1350,7 +1350,7 @@ static void le_unknown_rsp(struct pdu_data *pdu_data, uint16_t handle, } } -static void remote_version_info(struct pdu_data *pdu_data, uint16_t handle, +static void remote_version_info(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_remote_version_info *ep; @@ -1372,7 +1372,7 @@ static void remote_version_info(struct pdu_data *pdu_data, uint16_t handle, pdu_data->payload.llctrl.ctrldata.version_ind.sub_version_number; } -static void le_conn_param_req(struct pdu_data *pdu_data, uint16_t handle, +static void le_conn_param_req(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_le_conn_param_req *sep; @@ -1393,7 +1393,7 @@ static void le_conn_param_req(struct pdu_data *pdu_data, uint16_t handle, sep->timeout = pdu_data->payload.llctrl.ctrldata.conn_param_req.timeout; } -static void le_data_len_change(struct pdu_data *pdu_data, uint16_t handle, +static void le_data_len_change(struct pdu_data *pdu_data, u16_t handle, struct net_buf *buf) { struct bt_hci_evt_le_data_len_change *sep; @@ -1419,7 +1419,7 @@ static void le_data_len_change(struct pdu_data *pdu_data, uint16_t handle, static void encode_data_ctrl(struct radio_pdu_node_rx *node_rx, struct pdu_data *pdu_data, struct net_buf *buf) { - uint16_t handle = node_rx->hdr.handle; + u16_t handle = node_rx->hdr.handle; switch (pdu_data->payload.llctrl.opcode) { case PDU_DATA_LLCTRL_TYPE_ENC_REQ: @@ -1467,9 +1467,9 @@ void hci_acl_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf) { struct bt_hci_acl_hdr *acl; struct pdu_data *pdu_data; - uint16_t handle_flags; - uint16_t handle; - uint8_t *data; + u16_t handle_flags; + u16_t handle; + u8_t *data; pdu_data = (struct pdu_data *)node_rx->pdu_data; handle = node_rx->hdr.handle; @@ -1509,12 +1509,12 @@ void hci_evt_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf) } } -void hci_num_cmplt_encode(struct net_buf *buf, uint16_t handle, uint8_t num) +void hci_num_cmplt_encode(struct net_buf *buf, u16_t handle, u8_t num) { struct bt_hci_evt_num_completed_packets *ep; struct bt_hci_handle_count *hc; - uint8_t num_handles; - uint8_t len; + u8_t num_handles; + u8_t len; num_handles = 1; diff --git a/subsys/bluetooth/controller/hci/hci_driver.c b/subsys/bluetooth/controller/hci/hci_driver.c index 25ced39f0dc..19c6476bbb9 100644 --- a/subsys/bluetooth/controller/hci/hci_driver.c +++ b/subsys/bluetooth/controller/hci/hci_driver.c @@ -47,8 +47,8 @@ static BT_STACK_NOINIT(prio_recv_thread_stack, static BT_STACK_NOINIT(recv_thread_stack, CONFIG_BLUETOOTH_RX_STACK_SIZE); #if defined(CONFIG_INIT_STACKS) -static uint32_t prio_ts; -static uint32_t rx_ts; +static u32_t prio_ts; +static u32_t rx_ts; #endif static void prio_recv_thread(void *p1, void *p2, void *p3) @@ -56,8 +56,8 @@ static void prio_recv_thread(void *p1, void *p2, void *p3) while (1) { struct radio_pdu_node_rx *node_rx; struct net_buf *buf; - uint8_t num_cmplt; - uint16_t handle; + u8_t num_cmplt; + u16_t handle; while ((num_cmplt = radio_rx_get(&node_rx, &handle))) { @@ -173,7 +173,7 @@ static int cmd_handle(struct net_buf *buf) static int hci_driver_send(struct net_buf *buf) { - uint8_t type; + u8_t type; int err; BT_DBG("enter"); @@ -207,7 +207,7 @@ static int hci_driver_send(struct net_buf *buf) static int hci_driver_open(void) { - uint32_t err; + u32_t err; DEBUG_INIT(); diff --git a/subsys/bluetooth/controller/hci/hci_internal.h b/subsys/bluetooth/controller/hci/hci_internal.h index ce951e1ce33..679ce4ea5e9 100644 --- a/subsys/bluetooth/controller/hci/hci_internal.h +++ b/subsys/bluetooth/controller/hci/hci_internal.h @@ -12,6 +12,6 @@ struct net_buf *hci_cmd_handle(struct net_buf *cmd); int hci_acl_handle(struct net_buf *acl); void hci_evt_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf); void hci_acl_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf); -void hci_num_cmplt_encode(struct net_buf *buf, uint16_t handle, uint8_t num); +void hci_num_cmplt_encode(struct net_buf *buf, u16_t handle, u8_t num); bool hci_evt_is_discardable(struct radio_pdu_node_rx *node_rx); #endif /* _HCI_CONTROLLER_H_ */ diff --git a/subsys/bluetooth/controller/include/ll.h b/subsys/bluetooth/controller/include/ll.h index 3dd5a2265a9..6d7e3e932da 100644 --- a/subsys/bluetooth/controller/include/ll.h +++ b/subsys/bluetooth/controller/include/ll.h @@ -10,49 +10,49 @@ int ll_init(struct k_sem *sem_rx); void ll_reset(void); -void ll_address_get(uint8_t addr_type, uint8_t *p_bdaddr); -void ll_address_set(uint8_t addr_type, uint8_t const *const p_bdaddr); -void ll_adv_params_set(uint16_t interval, uint8_t adv_type, - uint8_t own_addr_type, uint8_t direct_addr_type, - uint8_t const *const p_direct_addr, uint8_t chl_map, - uint8_t filter_policy); -void ll_adv_data_set(uint8_t len, uint8_t const *const p_data); -void ll_scan_data_set(uint8_t len, uint8_t const *const p_data); -uint32_t ll_adv_enable(uint8_t enable); -void ll_scan_params_set(uint8_t scan_type, uint16_t interval, uint16_t window, - uint8_t own_addr_type, uint8_t filter_policy); -uint32_t ll_scan_enable(uint8_t enable); +void ll_address_get(u8_t addr_type, u8_t *p_bdaddr); +void ll_address_set(u8_t addr_type, u8_t const *const p_bdaddr); +void ll_adv_params_set(u16_t interval, u8_t adv_type, + u8_t own_addr_type, u8_t direct_addr_type, + u8_t const *const p_direct_addr, u8_t chl_map, + u8_t filter_policy); +void ll_adv_data_set(u8_t len, u8_t const *const p_data); +void ll_scan_data_set(u8_t len, u8_t const *const p_data); +u32_t ll_adv_enable(u8_t enable); +void ll_scan_params_set(u8_t scan_type, u16_t interval, u16_t window, + u8_t own_addr_type, u8_t filter_policy); +u32_t ll_scan_enable(u8_t enable); void ll_filter_clear(void); -uint32_t ll_filter_add(uint8_t addr_type, uint8_t *addr); -uint32_t ll_filter_remove(uint8_t addr_type, uint8_t *addr); +u32_t ll_filter_add(u8_t addr_type, u8_t *addr); +u32_t ll_filter_remove(u8_t addr_type, u8_t *addr); void ll_irk_clear(void); -uint32_t ll_irk_add(uint8_t *irk); -uint32_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window, - uint8_t filter_policy, uint8_t peer_addr_type, - uint8_t *p_peer_addr, uint8_t own_addr_type, - uint16_t interval, uint16_t latency, - uint16_t timeout); -uint32_t ll_connect_disable(void); -uint32_t ll_conn_update(uint16_t handle, uint8_t cmd, uint8_t status, - uint16_t interval, uint16_t latency, - uint16_t timeout); -uint32_t ll_chm_update(uint8_t *chm); -uint32_t ll_chm_get(uint16_t handle, uint8_t *chm); -uint32_t ll_enc_req_send(uint16_t handle, uint8_t *rand, uint8_t *ediv, - uint8_t *ltk); -uint32_t ll_start_enc_req_send(uint16_t handle, uint8_t err_code, - uint8_t const *const ltk); -uint32_t ll_feature_req_send(uint16_t handle); -uint32_t ll_version_ind_send(uint16_t handle); -uint32_t ll_terminate_ind_send(uint16_t handle, uint8_t reason); +u32_t ll_irk_add(u8_t *irk); +u32_t ll_create_connection(u16_t scan_interval, u16_t scan_window, + u8_t filter_policy, u8_t peer_addr_type, + u8_t *p_peer_addr, u8_t own_addr_type, + u16_t interval, u16_t latency, + u16_t timeout); +u32_t ll_connect_disable(void); +u32_t ll_conn_update(u16_t handle, u8_t cmd, u8_t status, + u16_t interval, u16_t latency, + u16_t timeout); +u32_t ll_chm_update(u8_t *chm); +u32_t ll_chm_get(u16_t handle, u8_t *chm); +u32_t ll_enc_req_send(u16_t handle, u8_t *rand, u8_t *ediv, + u8_t *ltk); +u32_t ll_start_enc_req_send(u16_t handle, u8_t err_code, + u8_t const *const ltk); +u32_t ll_feature_req_send(u16_t handle); +u32_t ll_version_ind_send(u16_t handle); +u32_t ll_terminate_ind_send(u16_t handle, u8_t reason); #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) -uint32_t ll_length_req_send(uint16_t handle, uint16_t tx_octets); -void ll_length_default_get(uint16_t *max_tx_octets, uint16_t *max_tx_time); -uint32_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time); -void ll_length_max_get(uint16_t *max_tx_octets, uint16_t *max_tx_time, - uint16_t *max_rx_octets, uint16_t *max_rx_time); +u32_t ll_length_req_send(u16_t handle, u16_t tx_octets); +void ll_length_default_get(u16_t *max_tx_octets, u16_t *max_tx_time); +u32_t ll_length_default_set(u16_t max_tx_octets, u16_t max_tx_time); +void ll_length_max_get(u16_t *max_tx_octets, u16_t *max_tx_time, + u16_t *max_rx_octets, u16_t *max_rx_time); #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ #endif /* _LL_H_ */ diff --git a/subsys/bluetooth/controller/ll_sw/crypto.c b/subsys/bluetooth/controller/ll_sw/crypto.c index 907eb9953e9..25578cc571a 100644 --- a/subsys/bluetooth/controller/ll_sw/crypto.c +++ b/subsys/bluetooth/controller/ll_sw/crypto.c @@ -29,8 +29,8 @@ int bt_rand(void *buf, size_t len) return 0; } -int bt_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16], - uint8_t enc_data[16]) +int bt_encrypt_le(const u8_t key[16], const u8_t plaintext[16], + u8_t enc_data[16]) { BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16)); @@ -41,8 +41,8 @@ int bt_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16], return 0; } -int bt_encrypt_be(const uint8_t key[16], const uint8_t plaintext[16], - uint8_t enc_data[16]) +int bt_encrypt_be(const u8_t key[16], const u8_t plaintext[16], + u8_t enc_data[16]) { BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16)); diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.c b/subsys/bluetooth/controller/ll_sw/ctrl.c index b2f029747a0..e622360b2df 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.c +++ b/subsys/bluetooth/controller/ll_sw/ctrl.c @@ -39,7 +39,7 @@ #define RADIO_PREAMBLE_TO_ADDRESS_US 40 #define RADIO_HCTO_US (150 + 2 + 2 + \ RADIO_PREAMBLE_TO_ADDRESS_US) -#define RADIO_CONN_EVENTS(x, y) ((uint16_t)((x) / (y))) +#define RADIO_CONN_EVENTS(x, y) ((u16_t)((x) / (y))) #define RADIO_TICKER_JITTER_US 16 #define RADIO_TICKER_START_PART_US 300 @@ -80,13 +80,13 @@ enum state { struct advertiser { struct shdr hdr; - uint8_t chl_map:3; - uint8_t chl_map_current:3; - uint8_t filter_policy:2; + u8_t chl_map:3; + u8_t chl_map_current:3; + u8_t filter_policy:2; - uint8_t filter_enable_bitmask; - uint8_t filter_addr_type_bitmask; - uint8_t filter_bdaddr[8][BDADDR_SIZE]; + u8_t filter_enable_bitmask; + u8_t filter_addr_type_bitmask; + u8_t filter_bdaddr[8][BDADDR_SIZE]; struct radio_adv_data adv_data; struct radio_adv_data scan_data; @@ -97,69 +97,69 @@ struct advertiser { struct observer { struct shdr hdr; - uint8_t scan_type:1; - uint8_t scan_state:1; - uint8_t scan_chan:2; - uint8_t filter_policy:2; - uint8_t adv_addr_type:1; - uint8_t init_addr_type:1; + u8_t scan_type:1; + u8_t scan_state:1; + u8_t scan_chan:2; + u8_t filter_policy:2; + u8_t adv_addr_type:1; + u8_t init_addr_type:1; - uint8_t adv_addr[BDADDR_SIZE]; - uint8_t init_addr[BDADDR_SIZE]; - uint32_t ticks_window; + u8_t adv_addr[BDADDR_SIZE]; + u8_t init_addr[BDADDR_SIZE]; + u32_t ticks_window; - uint8_t filter_enable_bitmask; - uint8_t filter_addr_type_bitmask; - uint8_t filter_bdaddr[8][BDADDR_SIZE]; + u8_t filter_enable_bitmask; + u8_t filter_addr_type_bitmask; + u8_t filter_bdaddr[8][BDADDR_SIZE]; - uint16_t conn_interval; - uint16_t conn_latency; - uint16_t conn_timeout; - uint32_t ticks_conn_slot; + u16_t conn_interval; + u16_t conn_latency; + u16_t conn_timeout; + u32_t ticks_conn_slot; struct connection *conn; - uint32_t win_offset_us; + u32_t win_offset_us; }; static struct { struct device *hf_clock; - uint32_t ticks_anchor; - uint32_t remainder_anchor; + u32_t ticks_anchor; + u32_t remainder_anchor; - uint8_t volatile ticker_id_prepare; - uint8_t volatile ticker_id_event; - uint8_t volatile ticker_id_stop; + u8_t volatile ticker_id_prepare; + u8_t volatile ticker_id_event; + u8_t volatile ticker_id_stop; enum role volatile role; enum state state; - uint8_t filter_enable_bitmask; - uint8_t filter_addr_type_bitmask; - uint8_t filter_bdaddr[8][BDADDR_SIZE]; + u8_t filter_enable_bitmask; + u8_t filter_addr_type_bitmask; + u8_t filter_bdaddr[8][BDADDR_SIZE]; - uint8_t nirk; - uint8_t irk[RADIO_IRK_COUNT_MAX][16]; + u8_t nirk; + u8_t irk[RADIO_IRK_COUNT_MAX][16]; struct advertiser advertiser; struct observer observer; void *conn_pool; void *conn_free; - uint8_t connection_count; + u8_t connection_count; struct connection *conn_curr; - uint8_t packet_counter; - uint8_t crc_expire; + u8_t packet_counter; + u8_t crc_expire; - uint8_t data_chan_map[5]; - uint8_t data_chan_count; - uint8_t sca; + u8_t data_chan_map[5]; + u8_t data_chan_count; + u8_t sca; #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) /* DLE global settings */ - uint16_t default_tx_octets; - uint16_t default_tx_time; + u16_t default_tx_octets; + u16_t default_tx_time; #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ /** @todo below members to be made role specific and quota managed for @@ -168,15 +168,15 @@ static struct { /* Advertiser, Observer, and Connections Rx data pool */ void *pkt_rx_data_pool; void *pkt_rx_data_free; - uint16_t packet_data_octets_max; - uint16_t packet_rx_data_pool_size; - uint16_t packet_rx_data_size; - uint8_t packet_rx_data_count; + u16_t packet_data_octets_max; + u16_t packet_rx_data_pool_size; + u16_t packet_rx_data_size; + u8_t packet_rx_data_count; /* Free queue Rx data buffers */ struct radio_pdu_node_rx **packet_rx; - uint8_t packet_rx_count; - uint8_t volatile packet_rx_last; - uint8_t packet_rx_acquire; + u8_t packet_rx_count; + u8_t volatile packet_rx_last; + u8_t packet_rx_acquire; /* Controller to Host event-cum-data queue */ void *link_rx_pool; @@ -184,44 +184,44 @@ static struct { void *link_rx_head; void *volatile link_rx_tail; - uint8_t link_rx_data_quota; + u8_t link_rx_data_quota; /* Connections common Tx ctrl and data pool */ void *pkt_tx_ctrl_pool; void *pkt_tx_ctrl_free; void *pkt_tx_data_pool; void *pkt_tx_data_free; - uint16_t packet_tx_data_size; + u16_t packet_tx_data_size; /* Host to Controller Tx, and Controller to Host Num complete queue */ struct pdu_data_q_tx *pkt_tx; struct pdu_data_q_tx *pkt_release; - uint8_t packet_tx_count; - uint8_t volatile packet_tx_first; - uint8_t packet_tx_last; - uint8_t packet_release_first; - uint8_t volatile packet_release_last; + u8_t packet_tx_count; + u8_t volatile packet_tx_first; + u8_t packet_tx_last; + u8_t packet_release_first; + u8_t volatile packet_release_last; - uint16_t fc_handle[TRIPLE_BUFFER_SIZE]; - uint8_t volatile fc_req; - uint8_t fc_ack; - uint8_t fc_ena; + u16_t fc_handle[TRIPLE_BUFFER_SIZE]; + u8_t volatile fc_req; + u8_t fc_ack; + u8_t fc_ena; - uint32_t ticks_active_to_start; + u32_t ticks_active_to_start; struct connection *conn_upd; } _radio; -static uint16_t const gc_lookup_ppm[] = { 500, 250, 150, 100, 75, 50, 30, 20 }; +static u16_t const gc_lookup_ppm[] = { 500, 250, 150, 100, 75, 50, 30, 20 }; static void common_init(void); -static void ticker_success_assert(uint32_t status, void *params); -static void ticker_stop_adv_assert(uint32_t status, void *params); -static void ticker_stop_obs_assert(uint32_t status, void *params); -static void ticker_update_adv_assert(uint32_t status, void *params); -static void ticker_update_slave_assert(uint32_t status, void *params); -static void event_inactive(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context); +static void ticker_success_assert(u32_t status, void *params); +static void ticker_stop_adv_assert(u32_t status, void *params); +static void ticker_stop_obs_assert(u32_t status, void *params); +static void ticker_update_adv_assert(u32_t status, void *params); +static void ticker_update_slave_assert(u32_t status, void *params); +static void event_inactive(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context); #if defined(RADIO_UNIT_TEST) && \ defined(CONFIG_BLUETOOTH_CONTROLLER_CHAN_SEL_2) @@ -229,54 +229,54 @@ static void chan_sel_2_ut(void); #endif /* CONFIG_BLUETOOTH_CONTROLLER_CHAN_SEL_2 */ static void adv_setup(void); -static void event_adv(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context); -static void event_obs(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context); -static void event_slave_prepare(uint32_t ticks_at_expire, - uint32_t remainder, uint16_t lazy, +static void event_adv(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context); +static void event_obs(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context); +static void event_slave_prepare(u32_t ticks_at_expire, + u32_t remainder, u16_t lazy, void *context); -static void event_slave(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context); -static void event_master_prepare(uint32_t ticks_at_expire, - uint32_t remainder, uint16_t lazy, +static void event_slave(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context); +static void event_master_prepare(u32_t ticks_at_expire, + u32_t remainder, u16_t lazy, void *context); -static void event_master(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context); +static void event_master(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context); static void rx_packet_set(struct connection *conn, struct pdu_data *pdu_data_rx); static void tx_packet_set(struct connection *conn, struct pdu_data *pdu_data_tx); static void prepare_pdu_data_tx(struct connection *conn, struct pdu_data **pdu_data_tx); -static void packet_rx_allocate(uint8_t max); +static void packet_rx_allocate(u8_t max); #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) -static uint8_t packet_rx_acquired_count_get(void); +static u8_t packet_rx_acquired_count_get(void); #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ -static struct radio_pdu_node_rx *packet_rx_reserve_get(uint8_t count); +static struct radio_pdu_node_rx *packet_rx_reserve_get(u8_t count); static void packet_rx_enqueue(void); -static void packet_tx_enqueue(uint8_t max); +static void packet_tx_enqueue(u8_t max); static struct pdu_data *empty_tx_enqueue(struct connection *conn); static void ctrl_tx_enqueue(struct connection *conn, struct radio_pdu_node_tx *node_tx); -static void pdu_node_tx_release(uint16_t handle, +static void pdu_node_tx_release(u16_t handle, struct radio_pdu_node_tx *node_tx); static void connection_release(struct connection *conn); -static uint32_t conn_update(struct connection *conn, +static u32_t conn_update(struct connection *conn, struct pdu_data *pdu_data_rx); -static uint32_t is_peer_compatible(struct connection *conn); -static uint32_t conn_update_req(struct connection *conn); -static uint32_t chan_map_update(struct connection *conn, +static u32_t is_peer_compatible(struct connection *conn); +static u32_t conn_update_req(struct connection *conn); +static u32_t chan_map_update(struct connection *conn, struct pdu_data *pdu_data_rx); static void enc_req_reused_send(struct connection *conn, struct radio_pdu_node_tx *node_tx); -static void terminate_ind_rx_enqueue(struct connection *conn, uint8_t reason); +static void terminate_ind_rx_enqueue(struct connection *conn, u8_t reason); static void enc_rsp_send(struct connection *conn); static void start_enc_rsp_send(struct connection *conn, struct pdu_data *pdu_ctrl_tx); -static void unknown_rsp_send(struct connection *conn, uint8_t type); +static void unknown_rsp_send(struct connection *conn, u8_t type); static void feature_rsp_send(struct connection *conn); static void pause_enc_rsp_send(struct connection *conn); static void version_ind_send(struct connection *conn); @@ -286,30 +286,30 @@ static void ping_resp_send(struct connection *conn); #endif /* CONFIG_BLUETOOTH_CONTROLLER_LE_PING */ static void reject_ind_ext_send(struct connection *conn, - uint8_t reject_opcode, - uint8_t error_code); + u8_t reject_opcode, + u8_t error_code); #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) static void length_resp_send(struct connection *conn, - uint16_t eff_rx_octets, - uint16_t eff_tx_octets); + u16_t eff_rx_octets, + u16_t eff_tx_octets); #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ -static uint32_t role_disable(uint8_t ticker_id_primary, - uint8_t ticker_id_stop); -static void rx_fc_lock(uint16_t handle); +static u32_t role_disable(u8_t ticker_id_primary, + u8_t ticker_id_stop); +static void rx_fc_lock(u16_t handle); /***************************************************************************** *RADIO ****************************************************************************/ -uint32_t radio_init(void *hf_clock, uint8_t sca, uint8_t connection_count_max, - uint8_t rx_count_max, uint8_t tx_count_max, - uint16_t packet_data_octets_max, - uint16_t packet_tx_data_size, uint8_t *mem_radio, - uint16_t mem_size) +u32_t radio_init(void *hf_clock, u8_t sca, u8_t connection_count_max, + u8_t rx_count_max, u8_t tx_count_max, + u16_t packet_data_octets_max, + u16_t packet_tx_data_size, u8_t *mem_radio, + u16_t mem_size) { - uint32_t retcode; - uint8_t *mem_radio_end; + u32_t retcode; + u8_t *mem_radio_end; /* intialise hf_clock device to use in prepare */ _radio.hf_clock = hf_clock; @@ -420,7 +420,7 @@ uint32_t radio_init(void *hf_clock, uint8_t sca, uint8_t connection_count_max, void ll_reset(void) { - uint16_t conn_handle; + u16_t conn_handle; /* disable advertiser events */ role_disable(RADIO_TICKER_ID_ADV, RADIO_TICKER_ID_ADV_STOP); @@ -582,8 +582,8 @@ static inline void isr_radio_state_tx(void) } } -static inline uint32_t isr_rx_adv(uint8_t devmatch_ok, uint8_t irkmatch_ok, - uint8_t irkmatch_id, uint8_t rssi_ready) +static inline u32_t isr_rx_adv(u8_t devmatch_ok, u8_t irkmatch_ok, + u8_t irkmatch_id, u8_t rssi_ready) { struct pdu_adv *pdu_adv, *_pdu_adv; struct radio_pdu_node_rx *radio_pdu_node_rx; @@ -605,7 +605,7 @@ static inline uint32_t isr_rx_adv(uint8_t devmatch_ok, uint8_t irkmatch_ok, /* use the latest scan data, if any */ if (_radio.advertiser.scan_data.first != _radio. advertiser.scan_data.last) { - uint8_t first; + u8_t first; first = _radio.advertiser.scan_data.first + 1; if (first == DOUBLE_BUFFER_SIZE) { @@ -626,11 +626,11 @@ static inline uint32_t isr_rx_adv(uint8_t devmatch_ok, uint8_t irkmatch_ok, ((_radio.fc_ena == 0) || (_radio.fc_req == _radio.fc_ack)) && (_radio.advertiser.conn)) { struct radio_le_conn_cmplt *radio_le_conn_cmplt; - uint32_t ticks_slot_offset; - uint32_t conn_interval_us; + u32_t ticks_slot_offset; + u32_t conn_interval_us; struct pdu_data *pdu_data; struct connection *conn; - uint32_t ticker_status; + u32_t ticker_status; if (IS_ENABLED(CONFIG_BLUETOOTH_CONTROLLER_CHAN_SEL_2) && pdu_adv->chan_sel) { @@ -741,11 +741,11 @@ static inline uint32_t isr_rx_adv(uint8_t devmatch_ok, uint8_t irkmatch_ok, &pdu_data->payload; if (pdu_adv->chan_sel) { - uint16_t aa_ls = - ((uint16_t)conn->access_addr[1] << 8) | + u16_t aa_ls = + ((u16_t)conn->access_addr[1] << 8) | conn->access_addr[0]; - uint16_t aa_ms = - ((uint16_t)conn->access_addr[3] << 8) | + u16_t aa_ms = + ((u16_t)conn->access_addr[3] << 8) | conn->access_addr[2]; conn->data_chan_sel = 1; @@ -816,7 +816,7 @@ static inline uint32_t isr_rx_adv(uint8_t devmatch_ok, uint8_t irkmatch_ok, RADIO_TICKER_ID_FIRST_CONNECTION + conn->handle, (_radio.ticks_anchor - ticks_slot_offset), TICKER_US_TO_TICKS(radio_tmr_end_get() - - RADIO_TX_CHAIN_DELAY_US + (((uint64_t) pdu_adv-> + RADIO_TX_CHAIN_DELAY_US + (((u64_t) pdu_adv-> payload.connect_ind.lldata.win_offset + 1) * 1250) - RADIO_RX_READY_DELAY_US - (RADIO_TICKER_JITTER_US << 1)), TICKER_US_TO_TICKS(conn_interval_us), @@ -833,7 +833,7 @@ static inline uint32_t isr_rx_adv(uint8_t devmatch_ok, uint8_t irkmatch_ok, return 1; } -static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready) +static inline u32_t isr_rx_obs(u8_t irkmatch_id, u8_t rssi_ready) { struct pdu_adv *pdu_adv_rx; @@ -866,13 +866,13 @@ static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready) TICKER_TICKS_TO_US(_radio.observer.hdr.ticks_slot))) { struct radio_le_conn_cmplt *radio_le_conn_cmplt; struct radio_pdu_node_rx *radio_pdu_node_rx; - uint32_t ticks_slot_offset; + u32_t ticks_slot_offset; struct pdu_adv *pdu_adv_tx; struct pdu_data *pdu_data; - uint32_t conn_interval_us; + u32_t conn_interval_us; struct connection *conn; - uint32_t ticker_status; - uint32_t conn_space_us; + u32_t ticker_status; + u32_t conn_space_us; if (IS_ENABLED(CONFIG_BLUETOOTH_CONTROLLER_CHAN_SEL_2) && pdu_adv_rx->chan_sel) { @@ -915,7 +915,7 @@ static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready) pdu_adv_tx->payload.connect_ind.lldata. win_size = 1; conn_interval_us = - (uint32_t)_radio.observer.conn_interval * 1250; + (u32_t)_radio.observer.conn_interval * 1250; if (_radio.observer.win_offset_us == 0) { conn_space_us = radio_tmr_end_get() - RADIO_TX_CHAIN_DELAY_US + 502 + 1250 - @@ -923,7 +923,7 @@ static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready) pdu_adv_tx->payload.connect_ind.lldata.win_offset = 0; } else { conn_space_us = _radio.observer. win_offset_us; - while ((conn_space_us & ((uint32_t)1 << 31)) || + while ((conn_space_us & ((u32_t)1 << 31)) || (conn_space_us < (radio_tmr_end_get() - RADIO_TX_CHAIN_DELAY_US + 502 + 1250 - @@ -1016,11 +1016,11 @@ static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready) &pdu_data->payload; if (pdu_adv_rx->chan_sel) { - uint16_t aa_ls = - ((uint16_t)conn->access_addr[1] << 8) | + u16_t aa_ls = + ((u16_t)conn->access_addr[1] << 8) | conn->access_addr[0]; - uint16_t aa_ms = - ((uint16_t)conn->access_addr[3] << 8) | + u16_t aa_ms = + ((u16_t)conn->access_addr[3] << 8) | conn->access_addr[2]; conn->data_chan_sel = 1; @@ -1097,7 +1097,7 @@ static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready) } /* save the RSSI value */ - ((uint8_t *)pdu_adv_rx)[offsetof(struct pdu_adv, payload) + + ((u8_t *)pdu_adv_rx)[offsetof(struct pdu_adv, payload) + pdu_adv_rx->len] = (rssi_ready) ? (radio_rssi_get() & 0x7F) : 0x7F; @@ -1154,7 +1154,7 @@ static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready) } /* save the RSSI value */ - ((uint8_t *)pdu_adv_rx)[offsetof(struct pdu_adv, payload) + + ((u8_t *)pdu_adv_rx)[offsetof(struct pdu_adv, payload) + pdu_adv_rx->len] = (rssi_ready) ? (radio_rssi_get() & 0x7f) : 0x7f; @@ -1172,10 +1172,10 @@ static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready) return 1; } -static inline uint8_t isr_rx_conn_pkt_ack(struct pdu_data *pdu_data_tx, +static inline u8_t isr_rx_conn_pkt_ack(struct pdu_data *pdu_data_tx, struct radio_pdu_node_tx **node_tx) { - uint8_t terminate = 0; + u8_t terminate = 0; switch (pdu_data_tx->payload.llctrl.opcode) { case PDU_DATA_LLCTRL_TYPE_TERMINATE_IND: @@ -1323,9 +1323,9 @@ isr_rx_conn_pkt_release(struct radio_pdu_node_tx *node_tx) return NULL; } -static inline uint32_t feat_get(uint8_t *features) +static inline u32_t feat_get(u8_t *features) { - uint32_t feat; + u32_t feat; feat = ~RADIO_BLE_FEAT_BIT_MASK_VALID | features[0] | (features[1] << 8) | (features[2] << 16); @@ -1336,7 +1336,7 @@ static inline uint32_t feat_get(uint8_t *features) static inline void isr_rx_conn_pkt_ctrl_rej(struct radio_pdu_node_rx *radio_pdu_node_rx, - uint8_t *rx_enqueue) + u8_t *rx_enqueue) { /* reset ctrl procedure */ _radio.conn_curr->llcp_ack = _radio.conn_curr->llcp_req; @@ -1393,12 +1393,12 @@ isr_rx_conn_pkt_ctrl_rej(struct radio_pdu_node_rx *radio_pdu_node_rx, } #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) -static inline uint8_t isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx, - uint8_t *rx_enqueue) +static inline u8_t isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx, + u8_t *rx_enqueue) { - uint16_t eff_rx_octets; - uint16_t eff_tx_octets; - uint8_t nack = 0; + u16_t eff_rx_octets; + u16_t eff_tx_octets; + u8_t nack = 0; eff_rx_octets = _radio.conn_curr->max_rx_octets; eff_tx_octets = _radio.conn_curr->max_tx_octets; @@ -1446,7 +1446,7 @@ static inline uint8_t isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx, /* check if change in rx octets */ if (eff_rx_octets != _radio.conn_curr->max_rx_octets) { - uint16_t free_count_rx; + u16_t free_count_rx; free_count_rx = packet_rx_acquired_count_get() + mem_free_count_get(_radio.pkt_rx_data_free); @@ -1513,12 +1513,12 @@ static inline uint8_t isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx, } #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ -static inline uint8_t +static inline u8_t isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *radio_pdu_node_rx, - uint8_t *rx_enqueue) + u8_t *rx_enqueue) { struct pdu_data *pdu_data_rx; - uint8_t nack = 0; + u8_t nack = 0; pdu_data_rx = (struct pdu_data *)radio_pdu_node_rx->pdu_data; switch (pdu_data_rx->payload.llctrl.opcode) { @@ -1960,14 +1960,14 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *radio_pdu_node_rx, return nack; } -static inline uint32_t +static inline u32_t isr_rx_conn_pkt(struct radio_pdu_node_rx *radio_pdu_node_rx, - struct radio_pdu_node_tx **tx_release, uint8_t *rx_enqueue) + struct radio_pdu_node_tx **tx_release, u8_t *rx_enqueue) { struct pdu_data *pdu_data_rx; struct pdu_data *pdu_data_tx; - uint8_t terminate = 0; - uint8_t nack = 0; + u8_t terminate = 0; + u8_t nack = 0; /* Reset CRC expiry counter */ _radio.crc_expire = 0; @@ -1981,7 +1981,7 @@ isr_rx_conn_pkt(struct radio_pdu_node_rx *radio_pdu_node_rx, if (_radio.conn_curr->empty == 0) { struct radio_pdu_node_tx *node_tx; - uint8_t pdu_data_tx_len, pdu_data_tx_ll_id; + u8_t pdu_data_tx_len, pdu_data_tx_ll_id; node_tx = _radio.conn_curr->pkt_tx_head; pdu_data_tx = (struct pdu_data *) @@ -2040,13 +2040,13 @@ isr_rx_conn_pkt(struct radio_pdu_node_rx *radio_pdu_node_rx, ((_radio.fc_req != 0) && (_radio.fc_handle[_radio.fc_req - 1] == _radio.conn_curr->handle)))))) { - uint8_t ccm_rx_increment = 0; + u8_t ccm_rx_increment = 0; if (pdu_data_rx->len != 0) { /* If required, wait for CCM to finish */ if (_radio.conn_curr->enc_rx) { - uint32_t done; + u32_t done; done = radio_ccm_is_done(); LL_ASSERT(done); @@ -2124,34 +2124,34 @@ isr_rx_conn_pkt(struct radio_pdu_node_rx *radio_pdu_node_rx, return 0; } -static inline void isr_rx_conn(uint8_t crc_ok, uint8_t trx_done, - uint8_t rssi_ready) +static inline void isr_rx_conn(u8_t crc_ok, u8_t trx_done, + u8_t rssi_ready) { struct radio_pdu_node_rx *radio_pdu_node_rx; struct radio_pdu_node_tx *tx_release = NULL; - uint8_t is_empty_pdu_tx_retry; + u8_t is_empty_pdu_tx_retry; struct pdu_data *pdu_data_rx; struct pdu_data *pdu_data_tx; - uint8_t rx_enqueue = 0; - uint8_t crc_close = 0; + u8_t rx_enqueue = 0; + u8_t crc_close = 0; #if defined(CONFIG_BLUETOOTH_CONTROLLER_PROFILE_ISR) - static uint8_t s_lmax; - static uint8_t s_lmin = (uint8_t) -1; - static uint8_t s_lprv; - static uint8_t s_max; - static uint8_t s_min = (uint8_t) -1; - static uint8_t s_prv; - uint32_t sample; - uint8_t latency, elapsed, prv; - uint8_t chg = 0; + static u8_t s_lmax; + static u8_t s_lmin = (u8_t) -1; + static u8_t s_lprv; + static u8_t s_max; + static u8_t s_min = (u8_t) -1; + static u8_t s_prv; + u32_t sample; + u8_t latency, elapsed, prv; + u8_t chg = 0; #endif /* CONFIG_BLUETOOTH_CONTROLLER_PROFILE_ISR */ #if defined(CONFIG_BLUETOOTH_CONTROLLER_CONN_RSSI) /* Collect RSSI for connection */ if (_radio.packet_counter == 0) { if (rssi_ready) { - uint8_t rssi = radio_rssi_get(); + u8_t rssi = radio_rssi_get(); _radio.conn_curr->rssi_latest = rssi; @@ -2178,7 +2178,7 @@ static inline void isr_rx_conn(uint8_t crc_ok, uint8_t trx_done, radio_pdu_node_rx->hdr.type = NODE_RX_TYPE_DC_PDU; if (crc_ok) { - uint32_t terminate; + u32_t terminate; terminate = isr_rx_conn_pkt(radio_pdu_node_rx, &tx_release, &rx_enqueue); @@ -2308,7 +2308,7 @@ isr_rx_conn_exit: } /* check for +/- 1us change */ - prv = ((uint16_t)s_lprv + latency) >> 1; + prv = ((u16_t)s_lprv + latency) >> 1; if (prv != s_lprv) { s_lprv = latency; chg = 1; @@ -2329,7 +2329,7 @@ isr_rx_conn_exit: } /* check for +/- 1us change */ - prv = ((uint16_t)s_prv + elapsed) >> 1; + prv = ((u16_t)s_prv + elapsed) >> 1; if (prv != s_prv) { s_prv = elapsed; chg = 1; @@ -2358,11 +2358,11 @@ isr_rx_conn_exit: return; } -static inline void isr_radio_state_rx(uint8_t trx_done, uint8_t crc_ok, - uint8_t devmatch_ok, uint8_t irkmatch_ok, - uint8_t irkmatch_id, uint8_t rssi_ready) +static inline void isr_radio_state_rx(u8_t trx_done, u8_t crc_ok, + u8_t devmatch_ok, u8_t irkmatch_ok, + u8_t irkmatch_id, u8_t rssi_ready) { - uint32_t err; + u32_t err; if (!((trx_done) || ((SILENT_CONNECTION) && (_radio.role == ROLE_SLAVE)))) { @@ -2413,9 +2413,9 @@ static inline void isr_radio_state_rx(uint8_t trx_done, uint8_t crc_ok, } } -static inline uint32_t isr_close_adv(void) +static inline u32_t isr_close_adv(void) { - uint32_t dont_close = 0; + u32_t dont_close = 0; if ((_radio.state == STATE_CLOSE) && (_radio.advertiser.chl_map_current != 0)) { @@ -2438,8 +2438,8 @@ static inline uint32_t isr_close_adv(void) &_radio.advertiser.adv_data.data[_radio.advertiser.adv_data.first][0]; if ((_radio.state == STATE_CLOSE) && (pdu_adv->type != PDU_ADV_TYPE_DIRECT_IND)) { - uint32_t ticker_status; - uint8_t random_delay; + u32_t ticker_status; + u8_t random_delay; /** @todo use random 0-10 */ random_delay = 10; @@ -2469,9 +2469,9 @@ static inline uint32_t isr_close_adv(void) return dont_close; } -static inline uint32_t isr_close_obs(void) +static inline u32_t isr_close_obs(void) { - uint32_t dont_close = 0; + u32_t dont_close = 0; if (_radio.state == STATE_CLOSE) { dont_close = 1; @@ -2508,12 +2508,12 @@ static inline uint32_t isr_close_obs(void) static inline void isr_close_conn(void) { - uint16_t ticks_drift_plus; - uint16_t ticks_drift_minus; - uint16_t latency_event; - uint16_t elapsed_event; - uint16_t lazy; - uint8_t force; + u16_t ticks_drift_plus; + u16_t ticks_drift_minus; + u16_t latency_event; + u16_t elapsed_event; + u16_t lazy; + u8_t force; /* Local initiated terminate happened */ if (_radio.conn_curr == 0) { @@ -2541,9 +2541,9 @@ static inline void isr_close_conn(void) if ((_radio.packet_counter != 0) && ((!SILENT_CONNECTION) || (_radio.packet_counter != 0xFF))) { if (_radio.role == ROLE_SLAVE) { - uint32_t start_to_address_actual_us; - uint32_t start_to_address_expected_us; - uint32_t window_widening_event_us; + u32_t start_to_address_actual_us; + u32_t start_to_address_expected_us; + u32_t window_widening_event_us; /* calculate the drift in ticks */ start_to_address_actual_us = radio_tmr_aa_get(); @@ -2558,7 +2558,7 @@ static inline void isr_close_conn(void) ticks_drift_plus = TICKER_US_TO_TICKS(window_widening_event_us); ticks_drift_minus = - TICKER_US_TO_TICKS((uint64_t)(start_to_address_expected_us - + TICKER_US_TO_TICKS((u64_t)(start_to_address_expected_us - start_to_address_actual_us)); } else { ticks_drift_plus = @@ -2661,7 +2661,7 @@ static inline void isr_close_conn(void) _radio.conn_curr->role.slave.force >>= 1; if (force) { _radio.conn_curr->role.slave.force |= - ((uint32_t)1 << 31); + ((u32_t)1 << 31); } } } @@ -2773,8 +2773,8 @@ static inline void isr_close_conn(void) if ((ticks_drift_plus != 0) || (ticks_drift_minus != 0) || (lazy != 0) || (force != 0)) { - uint32_t ticker_status; - uint8_t ticker_id = RADIO_TICKER_ID_FIRST_CONNECTION + + u32_t ticker_status; + u8_t ticker_id = RADIO_TICKER_ID_FIRST_CONNECTION + _radio.conn_curr->handle; /* Call to ticker_update can fail under the race @@ -2789,7 +2789,7 @@ static inline void isr_close_conn(void) ticker_id, ticks_drift_plus, ticks_drift_minus, 0, 0, lazy, force, ticker_update_slave_assert, - (void *)(uint32_t)ticker_id); + (void *)(u32_t)ticker_id); LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || (ticker_status == TICKER_STATUS_BUSY) || (_radio.ticker_id_stop == ticker_id)); @@ -2798,7 +2798,7 @@ static inline void isr_close_conn(void) static inline void isr_radio_state_close(void) { - uint32_t dont_close = 0; + u32_t dont_close = 0; switch (_radio.role) { case ROLE_ADV: @@ -2874,12 +2874,12 @@ static inline void isr_radio_state_close(void) static void isr(void) { - uint8_t trx_done; - uint8_t crc_ok; - uint8_t devmatch_ok; - uint8_t irkmatch_ok; - uint8_t irkmatch_id; - uint8_t rssi_ready; + u8_t trx_done; + u8_t crc_ok; + u8_t devmatch_ok; + u8_t irkmatch_ok; + u8_t irkmatch_id; + u8_t rssi_ready; DEBUG_RADIO_ISR(1); @@ -2942,7 +2942,7 @@ static void isr(void) } #if (RADIO_TICKER_USER_ID_WORKER_PRIO == RADIO_TICKER_USER_ID_JOB_PRIO) -static void ticker_job_disable(uint32_t status, void *op_context) +static void ticker_job_disable(u32_t status, void *op_context) { ARG_UNUSED(status); ARG_UNUSED(op_context); @@ -2954,19 +2954,19 @@ static void ticker_job_disable(uint32_t status, void *op_context) } #endif -static void ticker_if_done(uint32_t status, void *ops_context) +static void ticker_if_done(u32_t status, void *ops_context) { - *((uint32_t volatile *)ops_context) = status; + *((u32_t volatile *)ops_context) = status; } -static void ticker_success_assert(uint32_t status, void *params) +static void ticker_success_assert(u32_t status, void *params) { ARG_UNUSED(params); LL_ASSERT(status == TICKER_STATUS_SUCCESS); } -static void ticker_stop_adv_assert(uint32_t status, void *params) +static void ticker_stop_adv_assert(u32_t status, void *params) { ARG_UNUSED(params); @@ -2985,7 +2985,7 @@ static void ticker_stop_adv_assert(uint32_t status, void *params) } } -static void ticker_stop_obs_assert(uint32_t status, void *params) +static void ticker_stop_obs_assert(u32_t status, void *params) { ARG_UNUSED(params); @@ -3004,7 +3004,7 @@ static void ticker_stop_obs_assert(uint32_t status, void *params) } } -static void ticker_update_adv_assert(uint32_t status, void *params) +static void ticker_update_adv_assert(u32_t status, void *params) { ARG_UNUSED(params); @@ -3012,9 +3012,9 @@ static void ticker_update_adv_assert(uint32_t status, void *params) (_radio.ticker_id_stop == RADIO_TICKER_ID_ADV)); } -static void ticker_update_slave_assert(uint32_t status, void *params) +static void ticker_update_slave_assert(u32_t status, void *params) { - uint8_t ticker_id = (uint32_t)params & 0xFF; + u8_t ticker_id = (u32_t)params & 0xFF; LL_ASSERT((status == TICKER_STATUS_SUCCESS) || (_radio.ticker_id_stop == ticker_id)); @@ -3022,9 +3022,9 @@ static void ticker_update_slave_assert(uint32_t status, void *params) static void mayfly_radio_active(void *params) { - static uint8_t s_active; + static u8_t s_active; - if ((uint32_t)params) { + if ((u32_t)params) { if (s_active++) { return; } @@ -3045,13 +3045,13 @@ static void mayfly_radio_active(void *params) } } -static void event_active(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_active(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { static void *s_link[2]; static struct mayfly s_mfy_radio_active = {0, 0, s_link, (void *)1, mayfly_radio_active}; - uint32_t retval; + u32_t retval; ARG_UNUSED(ticks_at_expire); ARG_UNUSED(remainder); @@ -3073,13 +3073,13 @@ static void mayfly_radio_inactive(void *params) DEBUG_RADIO_CLOSE(0); } -static void event_inactive(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_inactive(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { static void *s_link[2]; static struct mayfly s_mfy_radio_inactive = {0, 0, s_link, NULL, mayfly_radio_inactive}; - uint32_t retval; + u32_t retval; ARG_UNUSED(ticks_at_expire); ARG_UNUSED(remainder); @@ -3100,13 +3100,13 @@ static void mayfly_xtal_start(void *params) clock_control_on(_radio.hf_clock, NULL); } -static void event_xtal(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_xtal(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { static void *s_link[2]; static struct mayfly s_mfy_xtal_start = {0, 0, s_link, NULL, mayfly_xtal_start}; - uint32_t retval; + u32_t retval; ARG_UNUSED(ticks_at_expire); ARG_UNUSED(remainder); @@ -3129,16 +3129,16 @@ static void mayfly_xtal_stop(void *params) } #if defined(CONFIG_BLUETOOTH_CONTROLLER_XTAL_ADVANCED) -static void mayfly_xtal_retain(uint8_t caller_id, uint8_t retain) +static void mayfly_xtal_retain(u8_t caller_id, u8_t retain) { - static uint8_t s_xtal_retained; + static u8_t s_xtal_retained; if (retain) { if (!s_xtal_retained) { static void *s_link[2]; static struct mayfly s_mfy_xtal_start = {0, 0, s_link, NULL, mayfly_xtal_start}; - uint32_t retval; + u32_t retval; /* Only user id job will try to retain the XTAL. */ LL_ASSERT(caller_id == RADIO_TICKER_USER_ID_JOB); @@ -3158,7 +3158,7 @@ static void mayfly_xtal_retain(uint8_t caller_id, uint8_t retain) {0, 0, s_link[1], NULL, mayfly_xtal_stop} }; struct mayfly *p_mfy_xtal_stop = NULL; - uint32_t retval; + u32_t retval; s_xtal_retained = 0; @@ -3184,7 +3184,7 @@ static void mayfly_xtal_retain(uint8_t caller_id, uint8_t retain) } } -static void prepare_reduced(uint32_t status, void *op_context) +static void prepare_reduced(u32_t status, void *op_context) { /* It is acceptable that ticker_update will fail, if ticker is stopped; * for example, obs ticker is stopped on connection estblishment but @@ -3193,11 +3193,11 @@ static void prepare_reduced(uint32_t status, void *op_context) if (status == 0) { struct shdr *hdr = (struct shdr *)op_context; - hdr->ticks_xtal_to_start |= ((uint32_t)1 << 31); + hdr->ticks_xtal_to_start |= ((u32_t)1 << 31); } } -static void prepare_normal(uint32_t status, void *op_context) +static void prepare_normal(u32_t status, void *op_context) { /* It is acceptable that ticker_update will fail, if ticker is stopped; * for example, obs ticker is stopped on connection estblishment but @@ -3206,22 +3206,22 @@ static void prepare_normal(uint32_t status, void *op_context) if (status == 0) { struct shdr *hdr = (struct shdr *)op_context; - hdr->ticks_xtal_to_start &= ~((uint32_t)1 << 31); + hdr->ticks_xtal_to_start &= ~((u32_t)1 << 31); } } static void prepare_normal_set(struct shdr *hdr, - uint8_t ticker_user_id, - uint8_t ticker_id) + u8_t ticker_user_id, + u8_t ticker_id) { - if (hdr->ticks_xtal_to_start & ((uint32_t)1 << 31)) { - uint32_t ticker_status; - uint32_t ticks_prepare_to_start = + if (hdr->ticks_xtal_to_start & ((u32_t)1 << 31)) { + u32_t ticker_status; + u32_t ticks_prepare_to_start = (hdr->ticks_active_to_start > hdr->ticks_preempt_to_start) ? hdr-> ticks_active_to_start : hdr->ticks_preempt_to_start; - uint32_t ticks_drift_minus = - (hdr->ticks_xtal_to_start & (~((uint32_t)1 << 31))) - + u32_t ticks_drift_minus = + (hdr->ticks_xtal_to_start & (~((u32_t)1 << 31))) - ticks_prepare_to_start; ticker_status = @@ -3236,10 +3236,10 @@ static void prepare_normal_set(struct shdr *hdr, } #if (RADIO_TICKER_PREEMPT_PART_US <= RADIO_TICKER_PREEMPT_PART_MIN_US) -static uint32_t preempt_calc(struct shdr *hdr, uint8_t ticker_id, - uint32_t ticks_at_expire) +static u32_t preempt_calc(struct shdr *hdr, u8_t ticker_id, + u32_t ticks_at_expire) { - uint32_t diff = + u32_t diff = ticker_ticks_diff_get(ticker_ticks_now_get(), ticks_at_expire); diff += 3; @@ -3271,10 +3271,10 @@ static uint32_t preempt_calc(struct shdr *hdr, uint8_t ticker_id, */ static void mayfly_xtal_stop_calc(void *params) { - uint32_t ticks_to_expire; - uint32_t ticks_current; - uint8_t ticker_id; - uint32_t ret; + u32_t ticks_to_expire; + u32_t ticks_current; + u8_t ticker_id; + u32_t ret; ticker_id = 0xff; ticks_to_expire = 0; @@ -3291,10 +3291,10 @@ static void mayfly_xtal_stop_calc(void *params) if (ticker_id >= RADIO_TICKER_ID_ADV) { #if defined(CONFIG_BLUETOOTH_CONTROLLER_SCHED_ADVANCED) - uint8_t ticker_id_current = ((uint32_t)params & 0xff); + u8_t ticker_id_current = ((u32_t)params & 0xff); struct connection *conn_curr = NULL; #endif /* CONFIG_BLUETOOTH_CONTROLLER_SCHED_ADVANCED */ - uint32_t ticks_prepare_to_start; + u32_t ticks_prepare_to_start; struct connection *conn = NULL; struct shdr *hdr = NULL; @@ -3321,9 +3321,9 @@ static void mayfly_xtal_stop_calc(void *params) hdr->ticks_preempt_to_start) ? hdr->ticks_active_to_start : hdr->ticks_preempt_to_start; - if ((hdr->ticks_xtal_to_start & ((uint32_t)1 << 31)) != 0) { + if ((hdr->ticks_xtal_to_start & ((u32_t)1 << 31)) != 0) { ticks_to_expire -= ((hdr->ticks_xtal_to_start & - (~((uint32_t)1 << 31))) - + (~((u32_t)1 << 31))) - ticks_prepare_to_start); } else { /* Postpone the primary because we dont have @@ -3331,10 +3331,10 @@ static void mayfly_xtal_stop_calc(void *params) */ if (hdr->ticks_xtal_to_start > ticks_prepare_to_start) { - uint32_t ticks_drift_plus = + u32_t ticks_drift_plus = hdr->ticks_xtal_to_start - ticks_prepare_to_start; - uint32_t ticker_status; + u32_t ticker_status; ticker_status = ticker_update( @@ -3369,10 +3369,10 @@ static void mayfly_xtal_stop_calc(void *params) conn_curr->hdr.ticks_active_to_start : conn_curr->hdr.ticks_preempt_to_start; if ((conn_curr->hdr.ticks_xtal_to_start & - ((uint32_t)1 << 31)) != 0) { + ((u32_t)1 << 31)) != 0) { ticks_to_expire += ((conn_curr->hdr.ticks_xtal_to_start & - (~((uint32_t)1 << 31))) - + (~((u32_t)1 << 31))) - ticks_prepare_to_start); } } @@ -3382,7 +3382,7 @@ static void mayfly_xtal_stop_calc(void *params) */ if ((conn) && (conn_curr) && (conn_curr->conn_interval == conn->conn_interval)) { - uint32_t ticks_conn_interval = + u32_t ticks_conn_interval = TICKER_US_TO_TICKS(conn->conn_interval * 1250); /* remove laziness, if any, from @@ -3401,7 +3401,7 @@ static void mayfly_xtal_stop_calc(void *params) (TICKER_US_TO_TICKS(RADIO_TICKER_XTAL_OFFSET_US + 625) + conn_curr->hdr.ticks_slot))) { - uint32_t status; + u32_t status; status = conn_update_req(conn_curr); if ((status == 2) && @@ -3414,7 +3414,7 @@ static void mayfly_xtal_stop_calc(void *params) (TICKER_US_TO_TICKS(RADIO_TICKER_XTAL_OFFSET_US + 625) + conn_curr->hdr.ticks_slot))) { - uint32_t status; + u32_t status; status = conn_update_req(conn); if ((status == 2) && @@ -3457,23 +3457,23 @@ static void mayfly_xtal_stop_calc(void *params) #endif /* CONFIG_BLUETOOTH_CONTROLLER_XTAL_ADVANCED */ #if defined(CONFIG_BLUETOOTH_CONTROLLER_SCHED_ADVANCED) -static void sched_after_mstr_free_slot_get(uint8_t user_id, - uint32_t ticks_slot_abs, - uint32_t *ticks_anchor, - uint32_t *us_offset) +static void sched_after_mstr_free_slot_get(u8_t user_id, + u32_t ticks_slot_abs, + u32_t *ticks_anchor, + u32_t *us_offset) { - uint8_t ticker_id; - uint8_t ticker_id_prev; - uint32_t ticks_to_expire; - uint32_t ticks_to_expire_prev; - uint32_t ticks_slot_prev_abs; + u8_t ticker_id; + u8_t ticker_id_prev; + u32_t ticks_to_expire; + u32_t ticks_to_expire_prev; + u32_t ticks_slot_prev_abs; ticker_id = ticker_id_prev = 0xff; ticks_to_expire = ticks_to_expire_prev = *us_offset = 0; ticks_slot_prev_abs = 0; while (1) { struct connection *conn; - uint32_t ret; + u32_t ret; ret = ticker_next_slot_get(RADIO_TICKER_INSTANCE_ID_RADIO, user_id, &ticker_id, ticks_anchor, @@ -3491,10 +3491,10 @@ static void sched_after_mstr_free_slot_get(uint8_t user_id, conn = mem_get(_radio.conn_pool, CONNECTION_T_SIZE, (ticker_id - RADIO_TICKER_ID_FIRST_CONNECTION)); if ((conn) && (conn->role.master.role == 0)) { - uint32_t ticks_to_expire_normal = ticks_to_expire; + u32_t ticks_to_expire_normal = ticks_to_expire; - if (conn->hdr.ticks_xtal_to_start & ((uint32_t)1 << 31)) { - uint32_t ticks_prepare_to_start = + if (conn->hdr.ticks_xtal_to_start & ((u32_t)1 << 31)) { + u32_t ticks_prepare_to_start = (conn->hdr.ticks_active_to_start > conn->hdr.ticks_preempt_to_start) ? conn->hdr.ticks_active_to_start : @@ -3502,7 +3502,7 @@ static void sched_after_mstr_free_slot_get(uint8_t user_id, ticks_to_expire_normal -= ((conn->hdr.ticks_xtal_to_start & - (~((uint32_t)1 << 31))) - + (~((u32_t)1 << 31))) - ticks_prepare_to_start); } @@ -3529,12 +3529,12 @@ static void sched_after_mstr_free_slot_get(uint8_t user_id, } } -static void sched_after_mstr_free_offset_get(uint16_t conn_interval, - uint32_t ticks_slot, - uint32_t ticks_anchor, - uint32_t *win_offset_us) +static void sched_after_mstr_free_offset_get(u16_t conn_interval, + u32_t ticks_slot, + u32_t ticks_anchor, + u32_t *win_offset_us) { - uint32_t ticks_anchor_offset = ticks_anchor; + u32_t ticks_anchor_offset = ticks_anchor; sched_after_mstr_free_slot_get(RADIO_TICKER_USER_ID_JOB, (TICKER_US_TO_TICKS( @@ -3548,8 +3548,8 @@ static void sched_after_mstr_free_offset_get(uint16_t conn_interval, ticks_anchor)); } - if ((*win_offset_us & ((uint32_t)1 << 31)) == 0) { - uint32_t conn_interval_us = conn_interval * 1250; + if ((*win_offset_us & ((u32_t)1 << 31)) == 0) { + u32_t conn_interval_us = conn_interval * 1250; while (*win_offset_us > conn_interval_us) { *win_offset_us -= conn_interval_us; @@ -3561,14 +3561,14 @@ static void mayfly_sched_after_mstr_free_offset_get(void *params) { sched_after_mstr_free_offset_get(_radio.observer.conn_interval, _radio.observer.ticks_conn_slot, - (uint32_t)params, + (u32_t)params, &_radio.observer.win_offset_us); } static void mayfly_sched_win_offset_use(void *params) { struct connection *conn = (struct connection *)params; - uint16_t win_offset; + u16_t win_offset; sched_after_mstr_free_offset_get(conn->conn_interval, conn->hdr.ticks_slot, @@ -3577,37 +3577,37 @@ static void mayfly_sched_win_offset_use(void *params) win_offset = conn->llcp.connection_update.win_offset_us / 1250; memcpy(conn->llcp.connection_update.pdu_win_offset, &win_offset, - sizeof(uint16_t)); + sizeof(u16_t)); } static void sched_free_win_offset_calc(struct connection *conn_curr, - uint8_t is_select, - uint32_t *ticks_to_offset_next, - uint16_t conn_interval, - uint8_t *offset_max, - uint8_t *win_offset) + u8_t is_select, + u32_t *ticks_to_offset_next, + u16_t conn_interval, + u8_t *offset_max, + u8_t *win_offset) { - uint32_t ticks_prepare_reduced = 0; - uint32_t ticks_anchor; - uint32_t ticks_anchor_prev; - uint32_t ticks_to_expire_prev; - uint32_t ticks_to_expire; - uint32_t ticks_slot_prev_abs; - uint8_t ticker_id; - uint8_t ticker_id_prev; - uint8_t ticker_id_other; - uint8_t offset_index; - uint16_t _win_offset; + u32_t ticks_prepare_reduced = 0; + u32_t ticks_anchor; + u32_t ticks_anchor_prev; + u32_t ticks_to_expire_prev; + u32_t ticks_to_expire; + u32_t ticks_slot_prev_abs; + u8_t ticker_id; + u8_t ticker_id_prev; + u8_t ticker_id_other; + u8_t offset_index; + u16_t _win_offset; - if (conn_curr->hdr.ticks_xtal_to_start & ((uint32_t)1 << 31)) { - uint32_t ticks_prepare_to_start = + if (conn_curr->hdr.ticks_xtal_to_start & ((u32_t)1 << 31)) { + u32_t ticks_prepare_to_start = (conn_curr->hdr.ticks_active_to_start > conn_curr->hdr.ticks_preempt_to_start) ? conn_curr->hdr.ticks_active_to_start : conn_curr->hdr.ticks_preempt_to_start; ticks_prepare_reduced = ((conn_curr->hdr.ticks_xtal_to_start & - (~((uint32_t)1 << 31))) - + (~((u32_t)1 << 31))) - ticks_prepare_to_start); } @@ -3617,7 +3617,7 @@ static void sched_free_win_offset_calc(struct connection *conn_curr, ticks_slot_prev_abs = 0; do { struct connection *conn; - uint32_t ret; + u32_t ret; ret = ticker_next_slot_get(RADIO_TICKER_INSTANCE_ID_RADIO, RADIO_TICKER_USER_ID_JOB, @@ -3656,12 +3656,12 @@ static void sched_free_win_offset_calc(struct connection *conn_curr, if ((conn != conn_curr) && ((is_select) || (conn->role.master.role == 0))) { - uint32_t ticks_to_expire_normal = + u32_t ticks_to_expire_normal = ticks_to_expire + ticks_prepare_reduced; if (conn->hdr.ticks_xtal_to_start & - ((uint32_t)1 << 31)) { - uint32_t ticks_prepare_to_start = + ((u32_t)1 << 31)) { + u32_t ticks_prepare_to_start = (conn->hdr.ticks_active_to_start > conn->hdr.ticks_preempt_to_start) ? conn->hdr.ticks_active_to_start : @@ -3669,7 +3669,7 @@ static void sched_free_win_offset_calc(struct connection *conn_curr, ticks_to_expire_normal -= ((conn->hdr.ticks_xtal_to_start & - (~((uint32_t)1 << 31))) - + (~((u32_t)1 << 31))) - ticks_prepare_to_start); } @@ -3696,8 +3696,8 @@ static void sched_free_win_offset_calc(struct connection *conn_curr, } memcpy(win_offset + - (sizeof(uint16_t) * offset_index), - &_win_offset, sizeof(uint16_t)); + (sizeof(u16_t) * offset_index), + &_win_offset, sizeof(u16_t)); offset_index++; ticks_to_expire_prev += @@ -3736,8 +3736,8 @@ static void sched_free_win_offset_calc(struct connection *conn_curr, break; } - memcpy(win_offset + (sizeof(uint16_t) * offset_index), - &_win_offset, sizeof(uint16_t)); + memcpy(win_offset + (sizeof(u16_t) * offset_index), + &_win_offset, sizeof(u16_t)); offset_index++; ticks_to_expire_prev += TICKER_US_TO_TICKS(1250); @@ -3752,9 +3752,9 @@ static void sched_free_win_offset_calc(struct connection *conn_curr, static void mayfly_sched_free_win_offset_calc(void *params) { struct connection *conn = (struct connection *)params; - uint32_t ticks_to_offset_default = 0; - uint32_t *ticks_to_offset_next; - uint8_t offset_max = 6; + u32_t ticks_to_offset_default = 0; + u32_t *ticks_to_offset_next; + u8_t offset_max = 6; ticks_to_offset_next = &ticks_to_offset_default; @@ -3769,7 +3769,7 @@ static void mayfly_sched_free_win_offset_calc(void *params) sched_free_win_offset_calc(conn, 0, ticks_to_offset_next, conn->llcp.connection_update.interval, &offset_max, - (uint8_t *)conn->llcp.connection_update.pdu_win_offset); + (u8_t *)conn->llcp.connection_update.pdu_win_offset); } static void mayfly_sched_win_offset_select(void *params) @@ -3777,25 +3777,25 @@ static void mayfly_sched_win_offset_select(void *params) #define OFFSET_S_MAX 6 #define OFFSET_M_MAX 6 struct connection *conn = (struct connection *)params; - uint32_t ticks_to_offset; - uint16_t win_offset_m[OFFSET_M_MAX]; - uint8_t offset_m_max = OFFSET_M_MAX; - uint16_t win_offset_s; - uint8_t offset_index_s = 0; + u32_t ticks_to_offset; + u16_t win_offset_m[OFFSET_M_MAX]; + u8_t offset_m_max = OFFSET_M_MAX; + u16_t win_offset_s; + u8_t offset_index_s = 0; ticks_to_offset = TICKER_US_TO_TICKS(conn->llcp.connection_update.offset0 * 1250); sched_free_win_offset_calc(conn, 1, &ticks_to_offset, conn->llcp.connection_update.interval, - &offset_m_max, (uint8_t *)&win_offset_m[0]); + &offset_m_max, (u8_t *)&win_offset_m[0]); while (offset_index_s < OFFSET_S_MAX) { - uint8_t offset_index_m = 0; + u8_t offset_index_m = 0; - memcpy((uint8_t *)&win_offset_s, - ((uint8_t *)&conn->llcp.connection_update.offset0 + - (sizeof(uint16_t) * offset_index_s)), sizeof(uint16_t)); + memcpy((u8_t *)&win_offset_s, + ((u8_t *)&conn->llcp.connection_update.offset0 + + (sizeof(u16_t) * offset_index_s)), sizeof(u16_t)); while (offset_index_m < offset_m_max) { if ((win_offset_s != 0xffff) && @@ -3817,7 +3817,7 @@ static void mayfly_sched_win_offset_select(void *params) conn->llcp.connection_update.win_offset_us = win_offset_s * 1250; memcpy(conn->llcp.connection_update.pdu_win_offset, - &win_offset_s, sizeof(uint16_t)); + &win_offset_s, sizeof(u16_t)); } else { struct pdu_data *pdu_ctrl_tx; @@ -3829,7 +3829,7 @@ static void mayfly_sched_win_offset_select(void *params) /* send reject_ind_ext */ pdu_ctrl_tx = (struct pdu_data *) - ((uint8_t *)conn->llcp.connection_update.pdu_win_offset - + ((u8_t *)conn->llcp.connection_update.pdu_win_offset - offsetof(struct pdu_data, payload.llctrl.ctrldata.conn_update_ind.win_offset)); pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL; @@ -3848,8 +3848,8 @@ static void mayfly_sched_win_offset_select(void *params) static void mayfly_radio_stop(void *params) { - enum state state = (enum state)((uint32_t)params & 0xff); - uint32_t radio_used; + enum state state = (enum state)((u32_t)params & 0xff); + u32_t radio_used; LL_ASSERT((state == STATE_STOP) || (state == STATE_ABORT)); @@ -3866,13 +3866,13 @@ static void mayfly_radio_stop(void *params) } } -static void event_stop(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_stop(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { static void *s_link[2]; static struct mayfly s_mfy_radio_stop = {0, 0, s_link, NULL, mayfly_radio_stop}; - uint32_t retval; + u32_t retval; ARG_UNUSED(ticks_at_expire); ARG_UNUSED(remainder); @@ -3890,24 +3890,24 @@ static void event_stop(uint32_t ticks_at_expire, uint32_t remainder, LL_ASSERT(!retval); } -static void event_common_prepare(uint32_t ticks_at_expire, - uint32_t remainder, - uint32_t *ticks_xtal_to_start, - uint32_t *ticks_active_to_start, - uint32_t ticks_preempt_to_start, - uint8_t ticker_id, +static void event_common_prepare(u32_t ticks_at_expire, + u32_t remainder, + u32_t *ticks_xtal_to_start, + u32_t *ticks_active_to_start, + u32_t ticks_preempt_to_start, + u8_t ticker_id, ticker_timeout_func ticker_timeout_fp, void *context) { - uint32_t ticker_status; - uint32_t _ticks_xtal_to_start = *ticks_xtal_to_start; - uint32_t _ticks_active_to_start = *ticks_active_to_start; - uint32_t ticks_to_start; + u32_t ticker_status; + u32_t _ticks_xtal_to_start = *ticks_xtal_to_start; + u32_t _ticks_active_to_start = *ticks_active_to_start; + u32_t ticks_to_start; /* in case this event is short prepare, xtal to start duration will be * active to start duration. */ - if (_ticks_xtal_to_start & ((uint32_t)1 << 31)) { + if (_ticks_xtal_to_start & ((u32_t)1 << 31)) { _ticks_xtal_to_start = (_ticks_active_to_start > ticks_preempt_to_start) ? _ticks_active_to_start : @@ -3919,7 +3919,7 @@ static void event_common_prepare(uint32_t ticks_at_expire, * event (XTAL or active event). These are oneshot ticker. */ if (_ticks_active_to_start < _ticks_xtal_to_start) { - uint32_t ticks_to_active; + u32_t ticks_to_active; /* XTAL is before Active */ ticks_to_active = _ticks_xtal_to_start - _ticks_active_to_start; @@ -3938,7 +3938,7 @@ static void event_common_prepare(uint32_t ticks_at_expire, event_xtal(0, 0, 0, NULL); } else if (_ticks_active_to_start > _ticks_xtal_to_start) { - uint32_t ticks_to_xtal; + u32_t ticks_to_xtal; /* Active is before XTAL */ ticks_to_xtal = _ticks_active_to_start - _ticks_xtal_to_start; @@ -4004,16 +4004,16 @@ static void event_common_prepare(uint32_t ticks_at_expire, /** Handle change in _ticks_active_to_start */ if (_radio.ticks_active_to_start != _ticks_active_to_start) { - uint32_t ticks_to_start_new = + u32_t ticks_to_start_new = ((_radio.ticks_active_to_start < - (*ticks_xtal_to_start & ~(((uint32_t)1 << 31)))) ? - (*ticks_xtal_to_start & ~(((uint32_t)1 << 31))) : + (*ticks_xtal_to_start & ~(((u32_t)1 << 31)))) ? + (*ticks_xtal_to_start & ~(((u32_t)1 << 31))) : _radio.ticks_active_to_start); *ticks_active_to_start = _radio.ticks_active_to_start; - if ((*ticks_xtal_to_start) & ((uint32_t)1 << 31)) { - *ticks_xtal_to_start &= ~(((uint32_t)1 << 31)); + if ((*ticks_xtal_to_start) & ((u32_t)1 << 31)) { + *ticks_xtal_to_start &= ~(((u32_t)1 << 31)); } /* drift the primary as required due to active line change */ @@ -4036,9 +4036,9 @@ static void event_common_prepare(uint32_t ticks_at_expire, static void *s_link[2]; static struct mayfly s_mfy_xtal_stop_calc = {0, 0, s_link, NULL, mayfly_xtal_stop_calc}; - uint32_t retval; + u32_t retval; - s_mfy_xtal_stop_calc.param = (void *)(uint32_t)ticker_id; + s_mfy_xtal_stop_calc.param = (void *)(u32_t)ticker_id; retval = mayfly_enqueue(RADIO_TICKER_USER_ID_WORKER, RADIO_TICKER_USER_ID_JOB, 1, @@ -4048,16 +4048,16 @@ static void event_common_prepare(uint32_t ticks_at_expire, #endif /* CONFIG_BLUETOOTH_CONTROLLER_XTAL_ADVANCED */ } -static uint8_t chan_sel_remap(uint8_t *chan_map, uint8_t chan_index) +static u8_t chan_sel_remap(u8_t *chan_map, u8_t chan_index) { - uint8_t chan_next; - uint8_t byte_count; + u8_t chan_next; + u8_t byte_count; chan_next = 0; byte_count = 5; while (byte_count--) { - uint8_t bite; - uint8_t bit_count; + u8_t bite; + u8_t bit_count; bite = *chan_map; bit_count = 8; @@ -4082,17 +4082,17 @@ static uint8_t chan_sel_remap(uint8_t *chan_map, uint8_t chan_index) return chan_next; } -static uint8_t chan_sel_1(uint8_t *chan_use, uint8_t hop, - uint16_t latency, uint8_t *chan_map, - uint8_t chan_count) +static u8_t chan_sel_1(u8_t *chan_use, u8_t hop, + u16_t latency, u8_t *chan_map, + u8_t chan_count) { - uint8_t chan_next; + u8_t chan_next; chan_next = ((*chan_use) + (hop * (1 + latency))) % 37; *chan_use = chan_next; if ((chan_map[chan_next >> 3] & (1 << (chan_next % 8))) == 0) { - uint8_t chan_index; + u8_t chan_index; chan_index = chan_next % chan_count; chan_next = chan_sel_remap(chan_map, chan_index); @@ -4105,10 +4105,10 @@ static uint8_t chan_sel_1(uint8_t *chan_use, uint8_t hop, } #if defined(CONFIG_BLUETOOTH_CONTROLLER_CHAN_SEL_2) -static uint8_t chan_rev_8(uint8_t i) +static u8_t chan_rev_8(u8_t i) { - uint8_t iterate; - uint8_t o; + u8_t iterate; + u8_t o; o = 0; for (iterate = 0; iterate < 8; iterate++) { @@ -4120,20 +4120,20 @@ static uint8_t chan_rev_8(uint8_t i) return o; } -static uint16_t chan_perm(uint16_t i) +static u16_t chan_perm(u16_t i) { return (chan_rev_8((i >> 8) & 0xFF) << 8) | chan_rev_8(i & 0xFF); } -static uint16_t chan_mam(uint16_t a, uint16_t b) +static u16_t chan_mam(u16_t a, u16_t b) { - return ((uint32_t)a * 17 + b) & 0xFFFF; + return ((u32_t)a * 17 + b) & 0xFFFF; } -static uint16_t chan_prn(uint16_t counter, uint16_t chan_id) +static u16_t chan_prn(u16_t counter, u16_t chan_id) { - uint8_t iterate; - uint16_t prn_e; + u8_t iterate; + u16_t prn_e; prn_e = counter ^ chan_id; @@ -4147,19 +4147,19 @@ static uint16_t chan_prn(uint16_t counter, uint16_t chan_id) return prn_e; } -static uint8_t chan_sel_2(uint16_t counter, uint16_t chan_id, - uint8_t *chan_map, uint8_t chan_count) +static u8_t chan_sel_2(u16_t counter, u16_t chan_id, + u8_t *chan_map, u8_t chan_count) { - uint8_t chan_next; - uint16_t prn_e; + u8_t chan_next; + u16_t prn_e; prn_e = chan_prn(counter, chan_id); chan_next = prn_e % 37; if ((chan_map[chan_next >> 3] & (1 << (chan_next % 8))) == 0) { - uint8_t chan_index; + u8_t chan_index; - chan_index = ((uint32_t)chan_count * prn_e) >> 16; + chan_index = ((u32_t)chan_count * prn_e) >> 16; chan_next = chan_sel_remap(chan_map, chan_index); } else { @@ -4172,9 +4172,9 @@ static uint8_t chan_sel_2(uint16_t counter, uint16_t chan_id, #if defined(RADIO_UNIT_TEST) static void chan_sel_2_ut(void) { - uint8_t chan_map_1[] = {0xFF, 0xFF, 0xFF, 0xFF, 0x1F}; - uint8_t chan_map_2[] = {0x00, 0x06, 0xE0, 0x00, 0x1E}; - uint8_t m; + u8_t chan_map_1[] = {0xFF, 0xFF, 0xFF, 0xFF, 0x1F}; + u8_t chan_map_2[] = {0x00, 0x06, 0xE0, 0x00, 0x1E}; + u8_t m; m = chan_sel_2(1, 0x305F, chan_map_1, 37); LL_ASSERT(m == 20); @@ -4197,7 +4197,7 @@ static void chan_sel_2_ut(void) #endif /* RADIO_UNIT_TEST */ #endif /* CONFIG_BLUETOOTH_CONTROLLER_CHAN_SEL_2 */ -static void chan_set(uint32_t chan) +static void chan_set(u32_t chan) { switch (chan) { case 37: @@ -4237,22 +4237,22 @@ static void chan_set(uint32_t chan) * - It shall have a minimum of two transitions in the most significant six * bits. */ -static uint32_t access_addr_get(void) +static u32_t access_addr_get(void) { - uint32_t access_addr; - uint8_t bit_idx; - uint8_t transitions; - uint8_t consecutive_cnt; - uint8_t consecutive_bit; + u32_t access_addr; + u8_t bit_idx; + u8_t transitions; + u8_t consecutive_cnt; + u8_t consecutive_bit; - rand_get(sizeof(uint32_t), (uint8_t *)&access_addr); + rand_get(sizeof(u32_t), (u8_t *)&access_addr); bit_idx = 31; transitions = 0; consecutive_cnt = 1; consecutive_bit = (access_addr >> bit_idx) & 0x01; while (bit_idx--) { - uint8_t bit; + u8_t bit; bit = (access_addr >> bit_idx) & 0x01; if (bit == consecutive_bit) { @@ -4303,7 +4303,7 @@ static uint32_t access_addr_get(void) return access_addr; } -static void adv_obs_conn_configure(uint8_t phy) +static void adv_obs_conn_configure(u8_t phy) { radio_reset(); radio_phy_set(phy); @@ -4312,19 +4312,19 @@ static void adv_obs_conn_configure(uint8_t phy) radio_isr_set(isr); } -static void adv_obs_configure(uint8_t phy) +static void adv_obs_configure(u8_t phy) { - uint32_t aa = 0x8e89bed6; + u32_t aa = 0x8e89bed6; adv_obs_conn_configure(phy); - radio_aa_set((uint8_t *)&aa); + radio_aa_set((u8_t *)&aa); radio_pkt_configure(phy, 6, 37); radio_crc_configure(((0x5bUL) | ((0x06UL) << 8) | ((0x00UL) << 16)), 0x555555); } -void radio_event_adv_prepare(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +void radio_event_adv_prepare(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { ARG_UNUSED(lazy); ARG_UNUSED(context); @@ -4344,13 +4344,13 @@ void radio_event_adv_prepare(uint32_t ticks_at_expire, uint32_t remainder, static void adv_setup(void) { - uint8_t bitmap; - uint8_t chan; + u8_t bitmap; + u8_t chan; /* Use latest adv packet */ if (_radio.advertiser.adv_data.first != _radio.advertiser.adv_data.last) { - uint8_t first; + u8_t first; first = _radio.advertiser.adv_data.first + 1; if (first == DOUBLE_BUFFER_SIZE) { @@ -4375,8 +4375,8 @@ static void adv_setup(void) chan_set(37 + chan); } -static void event_adv(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_adv(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { ARG_UNUSED(remainder); ARG_UNUSED(lazy); @@ -4407,7 +4407,7 @@ static void event_adv(uint32_t ticks_at_expire, uint32_t remainder, if (_radio.advertiser.filter_policy) { radio_filter_configure(_radio.advertiser.filter_enable_bitmask, _radio.advertiser.filter_addr_type_bitmask, - (uint8_t *)_radio.advertiser.filter_bdaddr); + (u8_t *)_radio.advertiser.filter_bdaddr); } radio_tmr_start(1, @@ -4429,7 +4429,7 @@ static void event_adv(uint32_t ticks_at_expire, uint32_t remainder, { /* Ticker Job Silence */ #if (RADIO_TICKER_USER_ID_WORKER_PRIO == RADIO_TICKER_USER_ID_JOB_PRIO) - uint32_t ticker_status; + u32_t ticker_status; ticker_status = ticker_job_idle_get(RADIO_TICKER_INSTANCE_ID_RADIO, @@ -4443,10 +4443,10 @@ static void event_adv(uint32_t ticks_at_expire, uint32_t remainder, DEBUG_RADIO_START_A(0); } -void event_adv_stop(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +void event_adv_stop(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { - uint32_t ticker_status; + u32_t ticker_status; struct radio_pdu_node_rx *radio_pdu_node_rx; struct pdu_data *pdu_data_rx; struct radio_le_conn_cmplt *radio_le_conn_cmplt; @@ -4499,8 +4499,8 @@ void event_adv_stop(uint32_t ticks_at_expire, uint32_t remainder, packet_rx_enqueue(); } -static void event_obs_prepare(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_obs_prepare(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { ARG_UNUSED(lazy); ARG_UNUSED(context); @@ -4524,11 +4524,11 @@ static void event_obs_prepare(uint32_t ticks_at_expire, uint32_t remainder, static struct mayfly s_mfy_sched_after_mstr_free_offset_get = { 0, 0, s_link, NULL, mayfly_sched_after_mstr_free_offset_get}; - uint32_t ticks_at_expire_normal = ticks_at_expire; - uint32_t retval; + u32_t ticks_at_expire_normal = ticks_at_expire; + u32_t retval; - if (_radio.observer.hdr.ticks_xtal_to_start & ((uint32_t)1 << 31)) { - uint32_t ticks_prepare_to_start = + if (_radio.observer.hdr.ticks_xtal_to_start & ((u32_t)1 << 31)) { + u32_t ticks_prepare_to_start = (_radio.observer.hdr.ticks_active_to_start > _radio.observer.hdr.ticks_preempt_to_start) ? _radio.observer.hdr.ticks_active_to_start : @@ -4536,7 +4536,7 @@ static void event_obs_prepare(uint32_t ticks_at_expire, uint32_t remainder, ticks_at_expire_normal -= ((_radio.observer.hdr.ticks_xtal_to_start & - (~((uint32_t)1 << 31))) - + (~((u32_t)1 << 31))) - ticks_prepare_to_start); } @@ -4553,10 +4553,10 @@ static void event_obs_prepare(uint32_t ticks_at_expire, uint32_t remainder, DEBUG_RADIO_PREPARE_O(0); } -static void event_obs(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_obs(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { - uint32_t ticker_status; + u32_t ticker_status; ARG_UNUSED(remainder); ARG_UNUSED(lazy); @@ -4592,7 +4592,7 @@ static void event_obs(uint32_t ticks_at_expire, uint32_t remainder, if (_radio.observer.filter_policy) { radio_filter_configure(_radio.observer.filter_enable_bitmask, _radio.observer.filter_addr_type_bitmask, - (uint8_t *)_radio.observer.filter_bdaddr); + (u8_t *)_radio.observer.filter_bdaddr); if (_radio.nirk) { radio_ar_configure(_radio.nirk, _radio.irk); @@ -4633,7 +4633,7 @@ static void event_obs(uint32_t ticks_at_expire, uint32_t remainder, /* Ticker Job Silence */ #if (RADIO_TICKER_USER_ID_WORKER_PRIO == RADIO_TICKER_USER_ID_JOB_PRIO) { - uint32_t ticker_status; + u32_t ticker_status; ticker_status = ticker_job_idle_get(RADIO_TICKER_INSTANCE_ID_RADIO, @@ -4651,9 +4651,9 @@ static void event_obs(uint32_t ticks_at_expire, uint32_t remainder, static inline void event_conn_update_st_init(struct connection *conn, - uint16_t event_counter, + u16_t event_counter, struct pdu_data *pdu_ctrl_tx, - uint32_t ticks_at_expire, + u32_t ticks_at_expire, struct mayfly *mayfly_sched_offset, void (*fp_mayfly_select_or_use)(void *)) { @@ -4685,14 +4685,14 @@ event_conn_update_st_init(struct connection *conn, #if CONFIG_BLUETOOTH_CONTROLLER_SCHED_ADVANCED { - uint32_t retval; + u32_t retval; /* calculate window offset that places the connection in the * next available slot after existing masters. */ conn->llcp.connection_update.ticks_ref = ticks_at_expire; - if (conn->hdr.ticks_xtal_to_start & ((uint32_t)1 << 31)) { - uint32_t ticks_prepare_to_start = + if (conn->hdr.ticks_xtal_to_start & ((u32_t)1 << 31)) { + u32_t ticks_prepare_to_start = (conn->hdr.ticks_active_to_start > conn->hdr.ticks_preempt_to_start) ? conn->hdr.ticks_active_to_start : @@ -4700,11 +4700,11 @@ event_conn_update_st_init(struct connection *conn, conn->llcp.connection_update.ticks_ref -= ((conn->hdr.ticks_xtal_to_start & - (~((uint32_t)1 << 31))) - + (~((u32_t)1 << 31))) - ticks_prepare_to_start); } - conn->llcp.connection_update.pdu_win_offset = (uint16_t *) + conn->llcp.connection_update.pdu_win_offset = (u16_t *) &pdu_ctrl_tx->payload.llctrl.ctrldata.conn_update_ind.win_offset; mayfly_sched_offset->fp = fp_mayfly_select_or_use; @@ -4723,9 +4723,9 @@ event_conn_update_st_init(struct connection *conn, } static inline void event_conn_update_st_req(struct connection *conn, - uint16_t event_counter, + u16_t event_counter, struct pdu_data *pdu_ctrl_tx, - uint32_t ticks_at_expire, + u32_t ticks_at_expire, struct mayfly *mayfly_sched_offset) { /* move to wait for conn_update/rsp/rej */ @@ -4759,11 +4759,11 @@ static inline void event_conn_update_st_req(struct connection *conn, #if defined(CONFIG_BLUETOOTH_CONTROLLER_SCHED_ADVANCED) { - uint32_t retval; + u32_t retval; conn->llcp.connection_update.ticks_ref = ticks_at_expire; - if (conn->hdr.ticks_xtal_to_start & ((uint32_t)1 << 31)) { - uint32_t ticks_prepare_to_start = + if (conn->hdr.ticks_xtal_to_start & ((u32_t)1 << 31)) { + u32_t ticks_prepare_to_start = (conn->hdr.ticks_active_to_start > conn->hdr.ticks_preempt_to_start) ? conn->hdr.ticks_active_to_start : @@ -4771,11 +4771,11 @@ static inline void event_conn_update_st_req(struct connection *conn, conn->llcp.connection_update.ticks_ref -= ((conn->hdr.ticks_xtal_to_start & - (~((uint32_t)1 << 31))) - + (~((u32_t)1 << 31))) - ticks_prepare_to_start); } - conn->llcp.connection_update.pdu_win_offset = (uint16_t *) + conn->llcp.connection_update.pdu_win_offset = (u16_t *) &pdu_ctrl_tx->payload.llctrl.ctrldata.conn_param_req.offset0; mayfly_sched_offset->fp = mayfly_sched_free_win_offset_calc; @@ -4835,12 +4835,12 @@ static inline void event_conn_update_st_rsp(struct connection *conn, conn->llcp.connection_update.offset5; } -static inline uint32_t event_conn_update_prep(struct connection *conn, - uint16_t event_counter, - uint32_t ticks_at_expire) +static inline u32_t event_conn_update_prep(struct connection *conn, + u16_t event_counter, + u32_t ticks_at_expire) { struct connection *conn_upd; - uint16_t instant_latency; + u16_t instant_latency; conn_upd = _radio.conn_upd; @@ -4866,7 +4866,7 @@ static inline uint32_t event_conn_update_prep(struct connection *conn, #endif /* CONFIG_BLUETOOTH_CONTROLLER_SCHED_ADVANCED */ struct radio_pdu_node_tx *node_tx; struct pdu_data *pdu_ctrl_tx; - uint8_t state; + u8_t state; node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free); if (!node_tx) { @@ -4941,15 +4941,15 @@ static inline uint32_t event_conn_update_prep(struct connection *conn, struct radio_pdu_node_rx *radio_pdu_node_rx; struct pdu_data *pdu_data_rx; struct radio_le_conn_update_cmplt *radio_le_conn_update_cmplt; - uint32_t ticker_status; - uint32_t conn_interval_us; - uint32_t periodic_us; - uint32_t ticks_win_offset; - uint32_t ticks_slot_offset; - uint16_t conn_interval_old; - uint16_t conn_interval_new; - uint16_t latency; - uint32_t mayfly_was_enabled; + u32_t ticker_status; + u32_t conn_interval_us; + u32_t periodic_us; + u32_t ticks_win_offset; + u32_t ticks_slot_offset; + u16_t conn_interval_old; + u16_t conn_interval_new; + u16_t latency; + u32_t mayfly_was_enabled; /* procedure request acked */ conn->llcp_ack = conn->llcp_req; @@ -4997,14 +4997,14 @@ static inline uint32_t event_conn_update_prep(struct connection *conn, } /* restore to normal prepare */ - if (conn->hdr.ticks_xtal_to_start & ((uint32_t)1 << 31)) { - uint32_t ticks_prepare_to_start = + if (conn->hdr.ticks_xtal_to_start & ((u32_t)1 << 31)) { + u32_t ticks_prepare_to_start = (conn->hdr.ticks_active_to_start > conn->hdr.ticks_preempt_to_start) ? conn->hdr.ticks_active_to_start : conn->hdr.ticks_preempt_to_start; - conn->hdr.ticks_xtal_to_start &= ~((uint32_t)1 << 31); + conn->hdr.ticks_xtal_to_start &= ~((u32_t)1 << 31); ticks_at_expire -= (conn->hdr.ticks_xtal_to_start - ticks_prepare_to_start); } @@ -5147,7 +5147,7 @@ static inline uint32_t event_conn_update_prep(struct connection *conn, } static inline void event_ch_map_prep(struct connection *conn, - uint16_t event_counter) + u16_t event_counter) { if (conn->llcp.chan_map.initiate) { struct radio_pdu_node_tx *node_tx; @@ -5490,7 +5490,7 @@ static inline void event_len_prep(struct connection *conn) struct pdu_data_llctrl_length_req_rsp *lr; struct radio_pdu_node_tx *node_tx; struct pdu_data *pdu_ctrl_tx; - uint16_t free_count_rx; + u16_t free_count_rx; free_count_rx = packet_rx_acquired_count_get() + mem_free_count_get(_radio.pkt_rx_data_free); @@ -5540,9 +5540,9 @@ static inline void event_len_prep(struct connection *conn) struct pdu_data_llctrl_length_req_rsp *lr; struct radio_pdu_node_rx *node_rx; struct pdu_data *pdu_ctrl_rx; - uint16_t packet_rx_data_size; - uint16_t free_count_conn; - uint16_t free_count_rx; + u16_t packet_rx_data_size; + u16_t free_count_conn; + u16_t free_count_rx; /* Ensure the rx pool is not in use. * This is important to be able to re-size the pool @@ -5690,11 +5690,11 @@ static inline void event_len_prep(struct connection *conn) } #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ -static void event_connection_prepare(uint32_t ticks_at_expire, - uint32_t remainder, uint16_t lazy, +static void event_connection_prepare(u32_t ticks_at_expire, + u32_t remainder, u16_t lazy, struct connection *conn) { - uint16_t event_counter; + u16_t event_counter; _radio.ticker_id_prepare = RADIO_TICKER_ID_FIRST_CONNECTION + conn->handle; @@ -5822,19 +5822,19 @@ static void event_connection_prepare(uint32_t ticks_at_expire, static void connection_configure(struct connection *conn) { - uint8_t phy; + u8_t phy; phy = RADIO_PHY_CONN; adv_obs_conn_configure(phy); radio_aa_set(conn->access_addr); radio_crc_configure(((0x5bUL) | ((0x06UL) << 8) | ((0x00UL) << 16)), - (((uint32_t)conn->crc_init[2] << 16) | - ((uint32_t)conn->crc_init[1] << 8) | - ((uint32_t)conn->crc_init[0]))); + (((u32_t)conn->crc_init[2] << 16) | + ((u32_t)conn->crc_init[1] << 8) | + ((u32_t)conn->crc_init[0]))); } -static void event_slave_prepare(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_slave_prepare(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { DEBUG_RADIO_PREPARE_S(1); @@ -5843,12 +5843,12 @@ static void event_slave_prepare(uint32_t ticks_at_expire, uint32_t remainder, DEBUG_RADIO_PREPARE_S(0); } -static void event_slave(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_slave(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { - uint8_t data_chan_use = 0; + u8_t data_chan_use = 0; struct connection *conn; - uint32_t remainder_us; + u32_t remainder_us; ARG_UNUSED(remainder); ARG_UNUSED(lazy); @@ -5946,7 +5946,7 @@ static void event_slave(uint32_t ticks_at_expire, uint32_t remainder, { /* Ticker Job Silence */ #if (RADIO_TICKER_USER_ID_WORKER_PRIO == RADIO_TICKER_USER_ID_JOB_PRIO) - uint32_t ticker_status; + u32_t ticker_status; ticker_status = ticker_job_idle_get(RADIO_TICKER_INSTANCE_ID_RADIO, @@ -5963,8 +5963,8 @@ static void event_slave(uint32_t ticks_at_expire, uint32_t remainder, DEBUG_RADIO_START_S(0); } -static void event_master_prepare(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_master_prepare(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { DEBUG_RADIO_PREPARE_M(1); @@ -5973,10 +5973,10 @@ static void event_master_prepare(uint32_t ticks_at_expire, uint32_t remainder, DEBUG_RADIO_PREPARE_M(0); } -static void event_master(uint32_t ticks_at_expire, uint32_t remainder, - uint16_t lazy, void *context) +static void event_master(u32_t ticks_at_expire, u32_t remainder, + u16_t lazy, void *context) { - uint8_t data_chan_use = 0; + u8_t data_chan_use = 0; struct pdu_data *pdu_data_tx; struct connection *conn; @@ -6055,7 +6055,7 @@ static void event_master(uint32_t ticks_at_expire, uint32_t remainder, #if SILENT_CONNECTION /* silent connection! */ else { - uint32_t remainder_us; + u32_t remainder_us; /* start in RX state */ _radio.state = STATE_RX; @@ -6094,7 +6094,7 @@ static void event_master(uint32_t ticks_at_expire, uint32_t remainder, { /* Ticker Job Silence */ #if (RADIO_TICKER_USER_ID_WORKER_PRIO == RADIO_TICKER_USER_ID_JOB_PRIO) - uint32_t ticker_status; + u32_t ticker_status; ticker_status = ticker_job_idle_get(RADIO_TICKER_INSTANCE_ID_RADIO, @@ -6110,8 +6110,8 @@ static void event_master(uint32_t ticks_at_expire, uint32_t remainder, static void rx_packet_set(struct connection *conn, struct pdu_data *pdu_data_rx) { - uint8_t phy; - uint16_t max_rx_octets; + u8_t phy; + u16_t max_rx_octets; #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) max_rx_octets = conn->max_rx_octets; @@ -6135,8 +6135,8 @@ static void rx_packet_set(struct connection *conn, struct pdu_data *pdu_data_rx) static void tx_packet_set(struct connection *conn, struct pdu_data *pdu_data_tx) { - uint8_t phy; - uint16_t max_tx_octets; + u8_t phy; + u16_t max_tx_octets; #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) max_tx_octets = conn->max_tx_octets; @@ -6202,7 +6202,7 @@ static void prepare_pdu_data_tx(struct connection *conn, (_pdu_data_tx->payload.llctrl.opcode != PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND))))))) { _pdu_data_tx = empty_tx_enqueue(conn); } else { - uint16_t max_tx_octets; + u16_t max_tx_octets; _pdu_data_tx = (struct pdu_data *)(conn->pkt_tx_head->pdu_data + @@ -6242,9 +6242,9 @@ static void prepare_pdu_data_tx(struct connection *conn, *pdu_data_tx = _pdu_data_tx; } -static void packet_rx_allocate(uint8_t max) +static void packet_rx_allocate(u8_t max) { - uint8_t acquire; + u8_t acquire; if (max > _radio.link_rx_data_quota) { max = _radio.link_rx_data_quota; @@ -6285,7 +6285,7 @@ static void packet_rx_allocate(uint8_t max) } #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) -static uint8_t packet_rx_acquired_count_get(void) +static u8_t packet_rx_acquired_count_get(void) { if (_radio.packet_rx_acquire >= _radio.packet_rx_last) { @@ -6299,7 +6299,7 @@ static uint8_t packet_rx_acquired_count_get(void) } #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ -static struct radio_pdu_node_rx *packet_rx_reserve_get(uint8_t count) +static struct radio_pdu_node_rx *packet_rx_reserve_get(u8_t count) { struct radio_pdu_node_rx *radio_pdu_node_rx; @@ -6344,7 +6344,7 @@ static void packet_rx_enqueue(void) { void *link; struct radio_pdu_node_rx *radio_pdu_node_rx; - uint8_t last; + u8_t last; LL_ASSERT(_radio.packet_rx_last != _radio.packet_rx_acquire); @@ -6374,13 +6374,13 @@ static void packet_rx_enqueue(void) packet_rx_callback(); } -static void packet_tx_enqueue(uint8_t max) +static void packet_tx_enqueue(u8_t max) { while ((max--) && (_radio.packet_tx_first != _radio.packet_tx_last)) { struct pdu_data_q_tx *pdu_data_q_tx; struct radio_pdu_node_tx *node_tx_new; struct connection *conn; - uint8_t first; + u8_t first; pdu_data_q_tx = &_radio.pkt_tx[_radio.packet_tx_first]; node_tx_new = pdu_data_q_tx->node_tx; @@ -6506,10 +6506,10 @@ static void ctrl_tx_enqueue(struct connection *conn, } } -static void pdu_node_tx_release(uint16_t handle, +static void pdu_node_tx_release(u16_t handle, struct radio_pdu_node_tx *node_tx) { - uint8_t last; + u8_t last; last = _radio.packet_release_last + 1; if (last == _radio.packet_tx_count) { @@ -6529,7 +6529,7 @@ static void pdu_node_tx_release(uint16_t handle, static void connection_release(struct connection *conn) { - uint32_t ticker_status; + u32_t ticker_status; /* Enable Ticker Job, we are in a radio event which disabled it if * worker0 and job0 priority where same. @@ -6626,7 +6626,7 @@ static void connection_release(struct connection *conn) } } -static void terminate_ind_rx_enqueue(struct connection *conn, uint8_t reason) +static void terminate_ind_rx_enqueue(struct connection *conn, u8_t reason) { struct radio_pdu_node_rx *radio_pdu_node_rx; void *link; @@ -6638,7 +6638,7 @@ static void terminate_ind_rx_enqueue(struct connection *conn, uint8_t reason) radio_pdu_node_rx->hdr.handle = conn->handle; radio_pdu_node_rx->hdr.type = NODE_RX_TYPE_TERMINATE; - *((uint8_t *)radio_pdu_node_rx->pdu_data) = reason; + *((u8_t *)radio_pdu_node_rx->pdu_data) = reason; /* Get the link mem reserved in the connection context */ link = radio_pdu_node_rx->hdr.onion.link; @@ -6658,7 +6658,7 @@ static void terminate_ind_rx_enqueue(struct connection *conn, uint8_t reason) packet_rx_callback(); } -static uint32_t conn_update(struct connection *conn, +static u32_t conn_update(struct connection *conn, struct pdu_data *pdu_data_rx) { if (((pdu_data_rx->payload.llctrl.ctrldata.conn_update_ind.instant - @@ -6702,7 +6702,7 @@ static uint32_t conn_update(struct connection *conn, return 0; } -static uint32_t is_peer_compatible(struct connection *conn) +static u32_t is_peer_compatible(struct connection *conn) { return ((conn->llcp_version.rx) && (conn->llcp_version.version_number >= RADIO_BLE_VERSION_NUMBER) && @@ -6710,7 +6710,7 @@ static uint32_t is_peer_compatible(struct connection *conn) (conn->llcp_version.sub_version_number >= RADIO_BLE_SUB_VERSION_NUMBER)); } -static uint32_t conn_update_req(struct connection *conn) +static u32_t conn_update_req(struct connection *conn) { if (conn->llcp_req != conn->llcp_ack) { return 1; @@ -6739,7 +6739,7 @@ static uint32_t conn_update_req(struct connection *conn) return 2; } -static uint32_t chan_map_update(struct connection *conn, +static u32_t chan_map_update(struct connection *conn, struct pdu_data *pdu_data_rx) { if (((pdu_data_rx->payload.llctrl.ctrldata.chan_map_ind.instant - @@ -6840,7 +6840,7 @@ static void start_enc_rsp_send(struct connection *conn, } } -static void unknown_rsp_send(struct connection *conn, uint8_t type) +static void unknown_rsp_send(struct connection *conn, u8_t type) { struct radio_pdu_node_tx *node_tx; struct pdu_data *pdu_ctrl_tx; @@ -6951,7 +6951,7 @@ static void ping_resp_send(struct connection *conn) #endif /* CONFIG_BLUETOOTH_CONTROLLER_LE_PING */ static void reject_ind_ext_send(struct connection *conn, - uint8_t reject_opcode, uint8_t error_code) + u8_t reject_opcode, u8_t error_code) { struct radio_pdu_node_tx *node_tx; struct pdu_data *pdu_ctrl_tx; @@ -6975,8 +6975,8 @@ static void reject_ind_ext_send(struct connection *conn, } #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) -static void length_resp_send(struct connection *conn, uint16_t eff_rx_octets, - uint16_t eff_tx_octets) +static void length_resp_send(struct connection *conn, u16_t eff_rx_octets, + u16_t eff_tx_octets) { struct radio_pdu_node_tx *node_tx; struct pdu_data *pdu_ctrl_tx; @@ -7003,7 +7003,7 @@ static void length_resp_send(struct connection *conn, uint16_t eff_rx_octets, } #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ -void radio_ticks_active_to_start_set(uint32_t ticks_active_to_start) +void radio_ticks_active_to_start_set(u32_t ticks_active_to_start) { _radio.ticks_active_to_start = ticks_active_to_start; } @@ -7024,10 +7024,10 @@ void ll_filter_clear(void) _radio.filter_addr_type_bitmask = 0; } -uint32_t ll_filter_add(uint8_t addr_type, uint8_t *addr) +u32_t ll_filter_add(u8_t addr_type, u8_t *addr) { if (_radio.filter_enable_bitmask != 0xFF) { - uint8_t index; + u8_t index; for (index = 0; (_radio.filter_enable_bitmask & (1 << index)); @@ -7044,9 +7044,9 @@ uint32_t ll_filter_add(uint8_t addr_type, uint8_t *addr) return 1; } -uint32_t ll_filter_remove(uint8_t addr_type, uint8_t *addr) +u32_t ll_filter_remove(u8_t addr_type, u8_t *addr) { - uint8_t index; + u8_t index; if (!_radio.filter_enable_bitmask) { return 1; @@ -7073,7 +7073,7 @@ void ll_irk_clear(void) _radio.nirk = 0; } -uint32_t ll_irk_add(uint8_t *irk) +u32_t ll_irk_add(u8_t *irk) { if (_radio.nirk >= RADIO_IRK_COUNT_MAX) { return 1; @@ -7085,7 +7085,7 @@ uint32_t ll_irk_add(uint8_t *irk) return 0; } -static struct connection *connection_get(uint16_t handle) +static struct connection *connection_get(u16_t handle) { struct connection *conn; @@ -7099,15 +7099,15 @@ static struct connection *connection_get(uint16_t handle) return 0; } -static inline void role_active_disable(uint8_t ticker_id_stop, - uint32_t ticks_xtal_to_start, - uint32_t ticks_active_to_start) +static inline void role_active_disable(u8_t ticker_id_stop, + u32_t ticks_xtal_to_start, + u32_t ticks_active_to_start) { static void *s_link[2]; static struct mayfly s_mfy_radio_inactive = {0, 0, s_link, NULL, mayfly_radio_inactive}; - uint32_t volatile ret_cb = TICKER_STATUS_BUSY; - uint32_t ret; + u32_t volatile ret_cb = TICKER_STATUS_BUSY; + u32_t ret; /* Step 2: Is caller before Event? Stop Event */ ret = ticker_stop(RADIO_TICKER_INSTANCE_ID_RADIO, @@ -7125,8 +7125,8 @@ static inline void role_active_disable(uint8_t ticker_id_stop, static void *s_link[2]; static struct mayfly s_mfy_xtal_stop = {0, 0, s_link, NULL, mayfly_xtal_stop}; - uint32_t volatile ret_cb = TICKER_STATUS_BUSY; - uint32_t ret; + u32_t volatile ret_cb = TICKER_STATUS_BUSY; + u32_t ret; /* Step 2.1: Is caller between Primary and Marker0? * Stop the Marker0 event @@ -7148,7 +7148,7 @@ static inline void role_active_disable(uint8_t ticker_id_stop, * start */ if (ticks_active_to_start > ticks_xtal_to_start) { - uint32_t retval; + u32_t retval; /* radio active asserted, handle deasserting * here @@ -7159,7 +7159,7 @@ static inline void role_active_disable(uint8_t ticker_id_stop, &s_mfy_radio_inactive); LL_ASSERT(!retval); } else { - uint32_t retval; + u32_t retval; /* XTAL started, handle XTAL stop here */ retval = mayfly_enqueue( @@ -7169,7 +7169,7 @@ static inline void role_active_disable(uint8_t ticker_id_stop, LL_ASSERT(!retval); } } else if (ret_cb == TICKER_STATUS_FAILURE) { - uint32_t retval; + u32_t retval; /* Step 2.1.2: Deassert Radio Active and XTAL start */ @@ -7188,8 +7188,8 @@ static inline void role_active_disable(uint8_t ticker_id_stop, LL_ASSERT(0); } } else if (ret_cb == TICKER_STATUS_FAILURE) { - uint32_t volatile ret_cb = TICKER_STATUS_BUSY; - uint32_t ret; + u32_t volatile ret_cb = TICKER_STATUS_BUSY; + u32_t ret; /* Step 3: Caller inside Event, handle graceful stop of Event * (role dependent) @@ -7215,7 +7215,7 @@ static inline void role_active_disable(uint8_t ticker_id_stop, static void *s_link[2]; static struct mayfly s_mfy_radio_stop = {0, 0, s_link, NULL, mayfly_radio_stop}; - uint32_t retval; + u32_t retval; /* Radio state STOP is supplied in params */ s_mfy_radio_stop.param = (void *)STATE_STOP; @@ -7236,13 +7236,13 @@ static inline void role_active_disable(uint8_t ticker_id_stop, } } -static uint32_t role_disable(uint8_t ticker_id_primary, - uint8_t ticker_id_stop) +static u32_t role_disable(u8_t ticker_id_primary, + u8_t ticker_id_stop) { - uint32_t volatile ret_cb = TICKER_STATUS_BUSY; - uint32_t ticks_active_to_start = 0; - uint32_t ticks_xtal_to_start = 0; - uint32_t ret; + u32_t volatile ret_cb = TICKER_STATUS_BUSY; + u32_t ticks_active_to_start = 0; + u32_t ticks_xtal_to_start = 0; + u32_t ret; switch (ticker_id_primary) { case RADIO_TICKER_ID_ADV: @@ -7261,7 +7261,7 @@ static uint32_t role_disable(uint8_t ticker_id_primary, default: if (ticker_id_primary >= RADIO_TICKER_ID_FIRST_CONNECTION) { struct connection *conn; - uint16_t conn_handle; + u16_t conn_handle; conn_handle = ticker_id_primary - RADIO_TICKER_ID_FIRST_CONNECTION; @@ -7324,14 +7324,14 @@ role_disable_cleanup: return ret_cb; } -uint32_t radio_adv_enable(uint16_t interval, uint8_t chl_map, - uint8_t filter_policy) +u32_t radio_adv_enable(u16_t interval, u8_t chl_map, + u8_t filter_policy) { - uint32_t volatile ret_cb = TICKER_STATUS_BUSY; - uint32_t ticks_slot_offset; + u32_t volatile ret_cb = TICKER_STATUS_BUSY; + u32_t ticks_slot_offset; struct connection *conn; struct pdu_adv *pdu_adv; - uint32_t ret; + u32_t ret; pdu_adv = (struct pdu_adv *) &_radio.advertiser.adv_data.data[_radio.advertiser.adv_data.last][0]; @@ -7453,7 +7453,7 @@ uint32_t radio_adv_enable(uint16_t interval, uint8_t chl_map, _radio.advertiser.hdr.ticks_active_to_start; if (pdu_adv->type == PDU_ADV_TYPE_DIRECT_IND) { - uint32_t ticks_now = ticker_ticks_now_get(); + u32_t ticks_now = ticker_ticks_now_get(); ret = ticker_start(RADIO_TICKER_INSTANCE_ID_RADIO, RADIO_TICKER_USER_ID_APP, @@ -7480,7 +7480,7 @@ uint32_t radio_adv_enable(uint16_t interval, uint8_t chl_map, ticker_start(RADIO_TICKER_INSTANCE_ID_RADIO, RADIO_TICKER_USER_ID_APP, RADIO_TICKER_ID_ADV_STOP, ticks_now, - TICKER_US_TO_TICKS((uint64_t) (1280 * 1000) + + TICKER_US_TO_TICKS((u64_t) (1280 * 1000) + RADIO_TICKER_XTAL_OFFSET_US), TICKER_NULL_PERIOD, TICKER_NULL_REMAINDER, TICKER_NULL_LAZY, TICKER_NULL_SLOT, @@ -7492,7 +7492,7 @@ uint32_t radio_adv_enable(uint16_t interval, uint8_t chl_map, RADIO_TICKER_USER_ID_APP, RADIO_TICKER_ID_ADV, ticker_ticks_now_get(), 0, - TICKER_US_TO_TICKS((uint64_t) interval * 625), + TICKER_US_TO_TICKS((u64_t) interval * 625), TICKER_NULL_REMAINDER, TICKER_NULL_LAZY, (ticks_slot_offset + _radio.advertiser.hdr.ticks_slot), @@ -7521,9 +7521,9 @@ failure_cleanup: return 1; } -uint32_t radio_adv_disable(void) +u32_t radio_adv_disable(void) { - uint32_t status; + u32_t status; status = role_disable(RADIO_TICKER_ID_ADV, RADIO_TICKER_ID_ADV_STOP); @@ -7543,22 +7543,22 @@ uint32_t radio_adv_disable(void) return status; } -uint32_t radio_scan_enable(uint8_t scan_type, uint8_t init_addr_type, - uint8_t *init_addr, uint16_t interval, - uint16_t window, uint8_t filter_policy) +u32_t radio_scan_enable(u8_t scan_type, u8_t init_addr_type, + u8_t *init_addr, u16_t interval, + u16_t window, u8_t filter_policy) { - uint32_t volatile ret_cb = TICKER_STATUS_BUSY; - uint32_t ticks_slot_offset; - uint32_t ticks_interval; - uint32_t ticks_anchor; - uint32_t us_offset; - uint32_t ret; + u32_t volatile ret_cb = TICKER_STATUS_BUSY; + u32_t ticks_slot_offset; + u32_t ticks_interval; + u32_t ticks_anchor; + u32_t us_offset; + u32_t ret; _radio.observer.scan_type = scan_type; _radio.observer.init_addr_type = init_addr_type; memcpy(&_radio.observer.init_addr[0], init_addr, BDADDR_SIZE); _radio.observer.ticks_window = - TICKER_US_TO_TICKS((uint64_t) window * 625); + TICKER_US_TO_TICKS((u64_t) window * 625); _radio.observer.filter_policy = filter_policy; if (filter_policy) { _radio.observer.filter_addr_type_bitmask = @@ -7578,7 +7578,7 @@ uint32_t radio_scan_enable(uint8_t scan_type, uint8_t init_addr_type, TICKER_US_TO_TICKS(RADIO_TICKER_PREEMPT_PART_MIN_US); _radio.observer.hdr.ticks_slot = _radio.observer.ticks_window; - ticks_interval = TICKER_US_TO_TICKS((uint64_t) interval * 625); + ticks_interval = TICKER_US_TO_TICKS((u64_t) interval * 625); if (_radio.observer.hdr.ticks_slot > (ticks_interval - TICKER_US_TO_TICKS(RADIO_TICKER_XTAL_OFFSET_US))) { @@ -7612,7 +7612,7 @@ uint32_t radio_scan_enable(uint8_t scan_type, uint8_t init_addr_type, RADIO_TICKER_USER_ID_APP, RADIO_TICKER_ID_OBS, (ticks_anchor + TICKER_US_TO_TICKS(us_offset)), 0, ticks_interval, - TICKER_REMAINDER((uint64_t) interval * 625), + TICKER_REMAINDER((u64_t) interval * 625), TICKER_NULL_LAZY, (ticks_slot_offset + _radio.observer.hdr.ticks_slot), @@ -7629,9 +7629,9 @@ uint32_t radio_scan_enable(uint8_t scan_type, uint8_t init_addr_type, return ((ret_cb == TICKER_STATUS_SUCCESS) ? 0 : 1); } -uint32_t radio_scan_disable(void) +u32_t radio_scan_disable(void) { - uint32_t status; + u32_t status; status = role_disable(RADIO_TICKER_ID_OBS, RADIO_TICKER_ID_OBS_STOP); @@ -7652,14 +7652,14 @@ uint32_t radio_scan_disable(void) return status; } -uint32_t radio_connect_enable(uint8_t adv_addr_type, uint8_t *adv_addr, - uint16_t interval, uint16_t latency, - uint16_t timeout) +u32_t radio_connect_enable(u8_t adv_addr_type, u8_t *adv_addr, + u16_t interval, u16_t latency, + u16_t timeout) { void *link; struct connection *conn; - uint32_t access_addr; - uint32_t conn_interval_us; + u32_t access_addr; + u32_t conn_interval_us; if (_radio.observer.conn) { return 1; @@ -7714,7 +7714,7 @@ uint32_t radio_connect_enable(uint8_t adv_addr_type, uint8_t *adv_addr, conn->role.master.role = 0; conn->role.master.connect_expire = 6; conn_interval_us = - (uint32_t)_radio.observer.conn_interval * 1250; + (u32_t)_radio.observer.conn_interval * 1250; conn->supervision_reload = RADIO_CONN_EVENTS((_radio.observer.conn_timeout * 10 * 1000), conn_interval_us); @@ -7778,9 +7778,9 @@ uint32_t radio_connect_enable(uint8_t adv_addr_type, uint8_t *adv_addr, return 0; } -uint32_t ll_connect_disable(void) +u32_t ll_connect_disable(void) { - uint32_t status; + u32_t status; if (_radio.observer.conn == 0) { return 1; @@ -7791,9 +7791,9 @@ uint32_t ll_connect_disable(void) return status; } -uint32_t ll_conn_update(uint16_t handle, uint8_t cmd, uint8_t status, - uint16_t interval, uint16_t latency, - uint16_t timeout) +u32_t ll_conn_update(u16_t handle, u8_t cmd, u8_t status, + u16_t interval, u16_t latency, + u16_t timeout) { struct connection *conn; @@ -7828,9 +7828,9 @@ uint32_t ll_conn_update(uint16_t handle, uint8_t cmd, uint8_t status, return 0; } -uint32_t ll_chm_update(uint8_t *chm) +u32_t ll_chm_update(u8_t *chm) { - uint8_t instance; + u8_t instance; memcpy(&_radio.data_chan_map[0], chm, sizeof(_radio.data_chan_map)); @@ -7863,7 +7863,7 @@ uint32_t ll_chm_update(uint8_t *chm) return 0; } -uint32_t ll_chm_get(uint16_t handle, uint8_t *chm) +u32_t ll_chm_get(u16_t handle, u8_t *chm) { struct connection *conn; @@ -7878,8 +7878,8 @@ uint32_t ll_chm_get(uint16_t handle, uint8_t *chm) return 0; } -uint32_t ll_enc_req_send(uint16_t handle, uint8_t *rand, uint8_t *ediv, - uint8_t *ltk) +u32_t ll_enc_req_send(u16_t handle, u8_t *rand, u8_t *ediv, + u8_t *ltk) { struct connection *conn; struct radio_pdu_node_tx *node_tx; @@ -7953,8 +7953,8 @@ uint32_t ll_enc_req_send(uint16_t handle, uint8_t *rand, uint8_t *ediv, return 1; } -uint32_t ll_start_enc_req_send(uint16_t handle, uint8_t error_code, - uint8_t const *const ltk) +u32_t ll_start_enc_req_send(u16_t handle, u8_t error_code, + u8_t const *const ltk) { struct connection *conn; @@ -8000,7 +8000,7 @@ uint32_t ll_start_enc_req_send(uint16_t handle, uint8_t error_code, return 0; } -uint32_t ll_feature_req_send(uint16_t handle) +u32_t ll_feature_req_send(u16_t handle) { struct connection *conn; @@ -8015,7 +8015,7 @@ uint32_t ll_feature_req_send(uint16_t handle) return 0; } -uint32_t ll_version_ind_send(uint16_t handle) +u32_t ll_version_ind_send(u16_t handle) { struct connection *conn; @@ -8030,7 +8030,7 @@ uint32_t ll_version_ind_send(uint16_t handle) return 0; } -uint32_t ll_terminate_ind_send(uint16_t handle, uint8_t reason) +u32_t ll_terminate_ind_send(u16_t handle, u8_t reason) { struct connection *conn; @@ -8047,7 +8047,7 @@ uint32_t ll_terminate_ind_send(uint16_t handle, uint8_t reason) } #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) -uint32_t ll_length_req_send(uint16_t handle, uint16_t tx_octets) +u32_t ll_length_req_send(u16_t handle, u16_t tx_octets) { struct connection *conn; @@ -8066,13 +8066,13 @@ uint32_t ll_length_req_send(uint16_t handle, uint16_t tx_octets) return 0; } -void ll_length_default_get(uint16_t *max_tx_octets, uint16_t *max_tx_time) +void ll_length_default_get(u16_t *max_tx_octets, u16_t *max_tx_time) { *max_tx_octets = _radio.default_tx_octets; *max_tx_time = _radio.default_tx_time; } -uint32_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time) +u32_t ll_length_default_set(u16_t max_tx_octets, u16_t max_tx_time) { /* TODO: parameter check (for BT 5.0 compliance) */ @@ -8082,8 +8082,8 @@ uint32_t ll_length_default_set(uint16_t max_tx_octets, uint16_t max_tx_time) return 0; } -void ll_length_max_get(uint16_t *max_tx_octets, uint16_t *max_tx_time, - uint16_t *max_rx_octets, uint16_t *max_rx_time) +void ll_length_max_get(u16_t *max_tx_octets, u16_t *max_tx_time, + u16_t *max_rx_octets, u16_t *max_rx_time) { *max_tx_octets = RADIO_LL_LENGTH_OCTETS_RX_MAX; *max_tx_time = RADIO_LL_LENGTH_TIME_RX_MAX; @@ -8092,10 +8092,10 @@ void ll_length_max_get(uint16_t *max_tx_octets, uint16_t *max_tx_time, } #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ -static uint8_t tx_cmplt_get(uint16_t *handle, uint8_t *first, uint8_t last) +static u8_t tx_cmplt_get(u16_t *handle, u8_t *first, u8_t last) { - uint8_t _first; - uint8_t cmplt; + u8_t _first; + u8_t cmplt; _first = *first; if (_first == last) { @@ -8116,7 +8116,7 @@ static uint8_t tx_cmplt_get(uint16_t *handle, uint8_t *first, uint8_t last) /*@FIXME: assign before first 3 if conditions */ pdu_data_tx = (struct pdu_data *)node_tx->pdu_data; if ((!node_tx) || (node_tx == (struct radio_pdu_node_tx *)1) || - ((((uint32_t)node_tx & ~(0x00000003)) != 0) && + ((((u32_t)node_tx & ~(0x00000003)) != 0) && (pdu_data_tx) && (pdu_data_tx->len != 0) && ((pdu_data_tx->ll_id == PDU_DATA_LLID_DATA_START) || (pdu_data_tx->ll_id == PDU_DATA_LLID_DATA_CONTINUE)))) { @@ -8132,7 +8132,7 @@ static uint8_t tx_cmplt_get(uint16_t *handle, uint8_t *first, uint8_t last) (struct radio_pdu_node_tx *)2; } - if (((uint32_t)node_tx & ~(0x00000003)) != 0) { + if (((u32_t)node_tx & ~(0x00000003)) != 0) { mem_release(node_tx, &_radio.pkt_tx_data_free); } @@ -8148,10 +8148,10 @@ static uint8_t tx_cmplt_get(uint16_t *handle, uint8_t *first, uint8_t last) return cmplt; } -uint8_t radio_rx_get(struct radio_pdu_node_rx **radio_pdu_node_rx, - uint16_t *handle) +u8_t radio_rx_get(struct radio_pdu_node_rx **radio_pdu_node_rx, + u16_t *handle) { - uint8_t cmplt; + u8_t cmplt; cmplt = 0; if (_radio.link_rx_head != _radio.link_rx_tail) { @@ -8164,8 +8164,8 @@ uint8_t radio_rx_get(struct radio_pdu_node_rx **radio_pdu_node_rx, _radio_pdu_node_rx->hdr.onion. packet_release_last); if (!cmplt) { - uint16_t handle; - uint8_t first, cmplt_prev, cmplt_curr; + u16_t handle; + u8_t first, cmplt_prev, cmplt_curr; first = _radio.packet_release_first; cmplt_curr = 0; @@ -8302,10 +8302,10 @@ void radio_rx_mem_release(struct radio_pdu_node_rx **radio_pdu_node_rx) packet_rx_allocate(0xff); } -static void rx_fc_lock(uint16_t handle) +static void rx_fc_lock(u16_t handle) { if (_radio.fc_req == _radio.fc_ack) { - uint8_t req; + u8_t req; _radio.fc_handle[_radio.fc_req] = handle; req = _radio.fc_req + 1; @@ -8316,12 +8316,12 @@ static void rx_fc_lock(uint16_t handle) } } -uint8_t do_radio_rx_fc_set(uint16_t handle, uint8_t req, - uint8_t ack) +u8_t do_radio_rx_fc_set(u16_t handle, u8_t req, + u8_t ack) { if (req == ack) { if (_radio.link_rx_head == _radio.link_rx_tail) { - uint8_t ack1 = ack; + u8_t ack1 = ack; if (ack1 == 0) { ack1 = TRIPLE_BUFFER_SIZE; @@ -8347,11 +8347,11 @@ uint8_t do_radio_rx_fc_set(uint16_t handle, uint8_t req, return 0; } -uint8_t radio_rx_fc_set(uint16_t handle, uint8_t fc) +u8_t radio_rx_fc_set(u16_t handle, u8_t fc) { if (_radio.fc_ena) { - uint8_t req = _radio.fc_req; - uint8_t ack = _radio.fc_ack; + u8_t req = _radio.fc_req; + u8_t ack = _radio.fc_ack; if (fc) { if (handle != 0xffff) { @@ -8372,10 +8372,10 @@ uint8_t radio_rx_fc_set(uint16_t handle, uint8_t fc) return 0; } -uint8_t radio_rx_fc_get(uint16_t *handle) +u8_t radio_rx_fc_get(u16_t *handle) { - uint8_t req = _radio.fc_req; - uint8_t ack = _radio.fc_ack; + u8_t req = _radio.fc_req; + u8_t ack = _radio.fc_ack; if (req != ack) { if (handle) { @@ -8397,7 +8397,7 @@ void radio_tx_mem_release(struct radio_pdu_node_tx *node_tx) mem_release(node_tx, &_radio.pkt_tx_data_free); } -static void ticker_op_latency_cancelled(uint32_t ticker_status, +static void ticker_op_latency_cancelled(u32_t ticker_status, void *params) { struct connection *conn; @@ -8408,10 +8408,10 @@ static void ticker_op_latency_cancelled(uint32_t ticker_status, conn->role.slave.latency_cancel = 0; } -uint32_t radio_tx_mem_enqueue(uint16_t handle, +u32_t radio_tx_mem_enqueue(u16_t handle, struct radio_pdu_node_tx *node_tx) { - uint8_t last; + u8_t last; struct connection *conn; struct pdu_data *pdu_data; @@ -8438,7 +8438,7 @@ uint32_t radio_tx_mem_enqueue(uint16_t handle, /* break slave latency */ if ((conn->role.slave.role != 0) && (conn->latency_event != 0) && (conn->role.slave.latency_cancel == 0)) { - uint32_t ticker_status; + u32_t ticker_status; conn->role.slave.latency_cancel = 1; diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.h b/subsys/bluetooth/controller/ll_sw/ctrl.h index 181c3e95d96..c8080b3e0b0 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.h +++ b/subsys/bluetooth/controller/ll_sw/ctrl.h @@ -185,14 +185,14 @@ * Controller Interface Structures ****************************************************************************/ struct radio_adv_data { - uint8_t data[DOUBLE_BUFFER_SIZE][PDU_AC_SIZE_MAX]; - uint8_t first; - uint8_t last; + u8_t data[DOUBLE_BUFFER_SIZE][PDU_AC_SIZE_MAX]; + u8_t first; + u8_t last; }; struct radio_pdu_node_tx { void *next; - uint8_t pdu_data[1]; + u8_t pdu_data[1]; }; enum radio_pdu_node_rx_type { @@ -224,82 +224,82 @@ enum radio_pdu_node_rx_type { }; struct radio_le_conn_cmplt { - uint8_t status; - uint8_t role; - uint8_t peer_addr_type; - uint8_t peer_addr[BDADDR_SIZE]; - uint8_t own_addr_type; - uint8_t own_addr[BDADDR_SIZE]; - uint8_t peer_irk_index; - uint16_t interval; - uint16_t latency; - uint16_t timeout; - uint8_t mca; + u8_t status; + u8_t role; + u8_t peer_addr_type; + u8_t peer_addr[BDADDR_SIZE]; + u8_t own_addr_type; + u8_t own_addr[BDADDR_SIZE]; + u8_t peer_irk_index; + u16_t interval; + u16_t latency; + u16_t timeout; + u8_t mca; } __packed; struct radio_le_conn_update_cmplt { - uint8_t status; - uint16_t interval; - uint16_t latency; - uint16_t timeout; + u8_t status; + u16_t interval; + u16_t latency; + u16_t timeout; } __packed; struct radio_le_chan_sel_algo { - uint8_t chan_sel_algo; + u8_t chan_sel_algo; } __packed; struct radio_pdu_node_rx_hdr { union { void *next; /* used also by k_fifo once pulled */ void *link; - uint8_t packet_release_last; + u8_t packet_release_last; } onion; enum radio_pdu_node_rx_type type; - uint16_t handle; + u16_t handle; }; struct radio_pdu_node_rx { struct radio_pdu_node_rx_hdr hdr; - uint8_t pdu_data[1]; + u8_t pdu_data[1]; }; /***************************************************************************** * Controller Interface Functions ****************************************************************************/ /* Downstream */ -uint32_t radio_init(void *hf_clock, uint8_t sca, uint8_t connection_count_max, - uint8_t rx_count_max, uint8_t tx_count_max, - uint16_t packet_data_octets_max, - uint16_t packet_tx_data_size, uint8_t *mem_radio, - uint16_t mem_size); -void radio_ticks_active_to_start_set(uint32_t ticks_active_to_start); +u32_t radio_init(void *hf_clock, u8_t sca, u8_t connection_count_max, + u8_t rx_count_max, u8_t tx_count_max, + u16_t packet_data_octets_max, + u16_t packet_tx_data_size, u8_t *mem_radio, + u16_t mem_size); +void radio_ticks_active_to_start_set(u32_t ticks_active_to_start); struct radio_adv_data *radio_adv_data_get(void); struct radio_adv_data *radio_scan_data_get(void); -uint32_t radio_adv_enable(uint16_t interval, uint8_t chl_map, - uint8_t filter_policy); -uint32_t radio_adv_disable(void); -uint32_t radio_scan_enable(uint8_t scan_type, uint8_t init_addr_type, - uint8_t *init_addr, uint16_t interval, - uint16_t window, uint8_t filter_policy); -uint32_t radio_scan_disable(void); +u32_t radio_adv_enable(u16_t interval, u8_t chl_map, + u8_t filter_policy); +u32_t radio_adv_disable(void); +u32_t radio_scan_enable(u8_t scan_type, u8_t init_addr_type, + u8_t *init_addr, u16_t interval, + u16_t window, u8_t filter_policy); +u32_t radio_scan_disable(void); -uint32_t radio_connect_enable(uint8_t adv_addr_type, uint8_t *adv_addr, - uint16_t interval, uint16_t latency, - uint16_t timeout); +u32_t radio_connect_enable(u8_t adv_addr_type, u8_t *adv_addr, + u16_t interval, u16_t latency, + u16_t timeout); /* Upstream */ -uint8_t radio_rx_get(struct radio_pdu_node_rx **radio_pdu_node_rx, - uint16_t *handle); +u8_t radio_rx_get(struct radio_pdu_node_rx **radio_pdu_node_rx, + u16_t *handle); void radio_rx_dequeue(void); void radio_rx_mem_release(struct radio_pdu_node_rx **radio_pdu_node_rx); -uint8_t radio_rx_fc_set(uint16_t handle, uint8_t fc); -uint8_t radio_rx_fc_get(uint16_t *handle); +u8_t radio_rx_fc_set(u16_t handle, u8_t fc); +u8_t radio_rx_fc_get(u16_t *handle); struct radio_pdu_node_tx *radio_tx_mem_acquire(void); void radio_tx_mem_release(struct radio_pdu_node_tx *pdu_data_node_tx); -uint32_t radio_tx_mem_enqueue(uint16_t handle, +u32_t radio_tx_mem_enqueue(u16_t handle, struct radio_pdu_node_tx *pdu_data_node_tx); /* Callbacks */ -extern void radio_active_callback(uint8_t active); +extern void radio_active_callback(u8_t active); extern void radio_event_callback(void); #endif diff --git a/subsys/bluetooth/controller/ll_sw/ctrl_internal.h b/subsys/bluetooth/controller/ll_sw/ctrl_internal.h index 16176bb6575..613154d73ea 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ctrl_internal.h @@ -21,99 +21,99 @@ enum llcp { struct shdr { - uint32_t ticks_xtal_to_start; - uint32_t ticks_active_to_start; - uint32_t ticks_preempt_to_start; - uint32_t ticks_slot; + u32_t ticks_xtal_to_start; + u32_t ticks_active_to_start; + u32_t ticks_preempt_to_start; + u32_t ticks_slot; }; struct connection { struct shdr hdr; - uint8_t access_addr[4]; - uint8_t crc_init[3]; - uint8_t data_chan_map[5]; + u8_t access_addr[4]; + u8_t crc_init[3]; + u8_t data_chan_map[5]; - uint8_t data_chan_count:6; - uint8_t data_chan_sel:1; - uint8_t rfu:1; + u8_t data_chan_count:6; + u8_t data_chan_sel:1; + u8_t rfu:1; union { struct { - uint8_t data_chan_hop; - uint8_t data_chan_use; + u8_t data_chan_hop; + u8_t data_chan_use; }; - uint16_t data_chan_id; + u16_t data_chan_id; }; - uint16_t handle; - uint16_t event_counter; - uint16_t conn_interval; - uint16_t latency; - uint16_t latency_prepare; - uint16_t latency_event; + u16_t handle; + u16_t event_counter; + u16_t conn_interval; + u16_t latency; + u16_t latency_prepare; + u16_t latency_event; #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) - uint16_t default_tx_octets; - uint16_t max_tx_octets; - uint16_t max_rx_octets; + u16_t default_tx_octets; + u16_t max_tx_octets; + u16_t max_rx_octets; #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ - uint16_t supervision_reload; - uint16_t supervision_expire; - uint16_t procedure_reload; - uint16_t procedure_expire; + u16_t supervision_reload; + u16_t supervision_expire; + u16_t procedure_reload; + u16_t procedure_expire; #if defined(CONFIG_BLUETOOTH_CONTROLLER_LE_PING) - uint16_t appto_reload; - uint16_t appto_expire; - uint16_t apto_reload; - uint16_t apto_expire; + u16_t appto_reload; + u16_t appto_expire; + u16_t apto_reload; + u16_t apto_expire; #endif /* CONFIG_BLUETOOTH_CONTROLLER_LE_PING */ union { struct { - uint8_t role:1; - uint8_t connect_expire; + u8_t role:1; + u8_t connect_expire; } master; struct { - uint8_t role:1; - uint8_t sca:3; - uint8_t latency_cancel:1; - uint32_t window_widening_periodic_us; - uint32_t window_widening_max_us; - uint32_t window_widening_prepare_us; - uint32_t window_widening_event_us; - uint32_t window_size_prepare_us; - uint32_t window_size_event_us; - uint32_t force; - uint32_t ticks_to_offset; + u8_t role:1; + u8_t sca:3; + u8_t latency_cancel:1; + u32_t window_widening_periodic_us; + u32_t window_widening_max_us; + u32_t window_widening_prepare_us; + u32_t window_widening_event_us; + u32_t window_size_prepare_us; + u32_t window_size_event_us; + u32_t force; + u32_t ticks_to_offset; } slave; } role; - uint8_t llcp_req; - uint8_t llcp_ack; + u8_t llcp_req; + u8_t llcp_ack; enum llcp llcp_type; union { struct { - uint16_t interval; - uint16_t latency; - uint16_t timeout; - uint8_t preferred_periodicity; - uint16_t instant; - uint16_t offset0; - uint16_t offset1; - uint16_t offset2; - uint16_t offset3; - uint16_t offset4; - uint16_t offset5; - uint32_t ticks_ref; - uint32_t ticks_to_offset_next; - uint32_t win_offset_us; - uint16_t *pdu_win_offset; - uint8_t win_size; - uint8_t state:3; + u16_t interval; + u16_t latency; + u16_t timeout; + u8_t preferred_periodicity; + u16_t instant; + u16_t offset0; + u16_t offset1; + u16_t offset2; + u16_t offset3; + u16_t offset4; + u16_t offset5; + u32_t ticks_ref; + u32_t ticks_to_offset_next; + u32_t win_offset_us; + u16_t *pdu_win_offset; + u8_t win_size; + u8_t state:3; #define LLCP_CONN_STATE_INPROG 0 /* master + slave proc in progress * until instant */ @@ -124,65 +124,65 @@ struct connection { #define LLCP_CONN_STATE_RSP_WAIT 5 /* master rsp or slave conn_update * or rej */ - uint8_t is_internal:2; + u8_t is_internal:2; } connection_update; struct { - uint8_t initiate; - uint8_t chm[5]; - uint16_t instant; + u8_t initiate; + u8_t chm[5]; + u16_t instant; } chan_map; struct { - uint8_t error_code; - uint8_t rand[8]; - uint8_t ediv[2]; - uint8_t ltk[16]; - uint8_t skd[16]; + u8_t error_code; + u8_t rand[8]; + u8_t ediv[2]; + u8_t ltk[16]; + u8_t skd[16]; } encryption; } llcp; - uint32_t llcp_features; + u32_t llcp_features; struct { - uint8_t tx:1; - uint8_t rx:1; - uint8_t version_number; - uint16_t company_id; - uint16_t sub_version_number; + u8_t tx:1; + u8_t rx:1; + u8_t version_number; + u16_t company_id; + u16_t sub_version_number; } llcp_version; struct { - uint8_t req; - uint8_t ack; - uint8_t reason_own; - uint8_t reason_peer; + u8_t req; + u8_t ack; + u8_t reason_own; + u8_t reason_peer; struct { struct radio_pdu_node_rx_hdr hdr; - uint8_t reason; + u8_t reason; } radio_pdu_node_rx; } llcp_terminate; #if defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH) struct { - uint8_t req; - uint8_t ack; - uint8_t state:2; + u8_t req; + u8_t ack; + u8_t state:2; #define LLCP_LENGTH_STATE_REQ 0 #define LLCP_LENGTH_STATE_ACK_WAIT 1 #define LLCP_LENGTH_STATE_RSP_WAIT 2 #define LLCP_LENGTH_STATE_RESIZE 3 - uint16_t rx_octets; - uint16_t tx_octets; + u16_t rx_octets; + u16_t tx_octets; } llcp_length; #endif /* CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH */ - uint8_t sn:1; - uint8_t nesn:1; - uint8_t pause_rx:1; - uint8_t pause_tx:1; - uint8_t enc_rx:1; - uint8_t enc_tx:1; - uint8_t refresh:1; - uint8_t empty:1; + u8_t sn:1; + u8_t nesn:1; + u8_t pause_rx:1; + u8_t pause_tx:1; + u8_t enc_rx:1; + u8_t enc_tx:1; + u8_t refresh:1; + u8_t empty:1; struct ccm ccm_rx; struct ccm ccm_tx; @@ -191,19 +191,19 @@ struct connection { struct radio_pdu_node_tx *pkt_tx_ctrl; struct radio_pdu_node_tx *pkt_tx_data; struct radio_pdu_node_tx *pkt_tx_last; - uint8_t packet_tx_head_len; - uint8_t packet_tx_head_offset; + u8_t packet_tx_head_len; + u8_t packet_tx_head_offset; #if defined(CONFIG_BLUETOOTH_CONTROLLER_CONN_RSSI) - uint8_t rssi_latest; - uint8_t rssi_reported; - uint8_t rssi_sample_count; + u8_t rssi_latest; + u8_t rssi_reported; + u8_t rssi_sample_count; #endif /* CONFIG_BLUETOOTH_CONTROLLER_CONN_RSSI */ }; #define CONNECTION_T_SIZE MROUND(sizeof(struct connection)) struct pdu_data_q_tx { - uint16_t handle; + u16_t handle; struct radio_pdu_node_tx *node_tx; }; diff --git a/subsys/bluetooth/controller/ll_sw/ll.c b/subsys/bluetooth/controller/ll_sw/ll.c index 68ba14a1af1..a06bc947e37 100644 --- a/subsys/bluetooth/controller/ll_sw/ll.c +++ b/subsys/bluetooth/controller/ll_sw/ll.c @@ -37,41 +37,41 @@ #include "ll.h" /* Global singletons */ -static uint8_t MALIGN(4) _rand_context[3 + 4 + 1]; -static uint8_t MALIGN(4) _ticker_nodes[RADIO_TICKER_NODES][TICKER_NODE_T_SIZE]; -static uint8_t MALIGN(4) _ticker_users[MAYFLY_CALLER_COUNT] +static u8_t MALIGN(4) _rand_context[3 + 4 + 1]; +static u8_t MALIGN(4) _ticker_nodes[RADIO_TICKER_NODES][TICKER_NODE_T_SIZE]; +static u8_t MALIGN(4) _ticker_users[MAYFLY_CALLER_COUNT] [TICKER_USER_T_SIZE]; -static uint8_t MALIGN(4) _ticker_user_ops[RADIO_TICKER_USER_OPS] +static u8_t MALIGN(4) _ticker_user_ops[RADIO_TICKER_USER_OPS] [TICKER_USER_OP_T_SIZE]; -static uint8_t MALIGN(4) _radio[LL_MEM_TOTAL]; +static u8_t MALIGN(4) _radio[LL_MEM_TOTAL]; static struct k_sem *sem_recv; static struct { - uint8_t pub_addr[BDADDR_SIZE]; - uint8_t rnd_addr[BDADDR_SIZE]; + u8_t pub_addr[BDADDR_SIZE]; + u8_t rnd_addr[BDADDR_SIZE]; } _ll_context; static struct { - uint16_t interval; - uint8_t adv_type:4; - uint8_t tx_addr:1; - uint8_t rx_addr:1; - uint8_t filter_policy:2; - uint8_t chl_map:3; - uint8_t adv_addr[BDADDR_SIZE]; - uint8_t direct_addr[BDADDR_SIZE]; + u16_t interval; + u8_t adv_type:4; + u8_t tx_addr:1; + u8_t rx_addr:1; + u8_t filter_policy:2; + u8_t chl_map:3; + u8_t adv_addr[BDADDR_SIZE]; + u8_t direct_addr[BDADDR_SIZE]; } _ll_adv_params; static struct { - uint16_t interval; - uint16_t window; - uint8_t scan_type:1; - uint8_t tx_addr:1; - uint8_t filter_policy:1; + u16_t interval; + u16_t window; + u8_t scan_type:1; + u8_t tx_addr:1; + u8_t filter_policy:1; } _ll_scan_params; -void mayfly_enable_cb(uint8_t caller_id, uint8_t callee_id, uint8_t enable) +void mayfly_enable_cb(u8_t caller_id, u8_t callee_id, u8_t enable) { (void)caller_id; @@ -84,7 +84,7 @@ void mayfly_enable_cb(uint8_t caller_id, uint8_t callee_id, uint8_t enable) } } -uint32_t mayfly_is_enabled(uint8_t caller_id, uint8_t callee_id) +u32_t mayfly_is_enabled(u8_t caller_id, u8_t callee_id) { (void)caller_id; @@ -99,7 +99,7 @@ uint32_t mayfly_is_enabled(uint8_t caller_id, uint8_t callee_id) return 0; } -uint32_t mayfly_prio_is_equal(uint8_t caller_id, uint8_t callee_id) +u32_t mayfly_prio_is_equal(u8_t caller_id, u8_t callee_id) { return (caller_id == callee_id) || ((caller_id == MAYFLY_CALL_ID_0) && @@ -108,7 +108,7 @@ uint32_t mayfly_prio_is_equal(uint8_t caller_id, uint8_t callee_id) (callee_id == MAYFLY_CALL_ID_0)); } -void mayfly_pend(uint8_t caller_id, uint8_t callee_id) +void mayfly_pend(u8_t caller_id, u8_t callee_id) { (void)caller_id; @@ -128,7 +128,7 @@ void mayfly_pend(uint8_t caller_id, uint8_t callee_id) } } -void radio_active_callback(uint8_t active) +void radio_active_callback(u8_t active) { } @@ -147,7 +147,7 @@ ISR_DIRECT_DECLARE(radio_nrf5_isr) static void rtc0_nrf5_isr(void *arg) { - uint32_t compare0, compare1; + u32_t compare0, compare1; /* store interested events */ compare0 = NRF_RTC0->EVENTS_COMPARE[0]; @@ -184,7 +184,7 @@ int ll_init(struct k_sem *sem_rx) { struct device *clk_k32; struct device *clk_m16; - uint32_t err; + u32_t err; sem_recv = sem_rx; @@ -246,7 +246,7 @@ int ll_init(struct k_sem *sem_rx) return 0; } -void ll_address_get(uint8_t addr_type, uint8_t *bdaddr) +void ll_address_get(u8_t addr_type, u8_t *bdaddr) { if (addr_type) { memcpy(bdaddr, &_ll_context.rnd_addr[0], BDADDR_SIZE); @@ -255,7 +255,7 @@ void ll_address_get(uint8_t addr_type, uint8_t *bdaddr) } } -void ll_address_set(uint8_t addr_type, uint8_t const *const bdaddr) +void ll_address_set(u8_t addr_type, u8_t const *const bdaddr) { if (addr_type) { memcpy(&_ll_context.rnd_addr[0], bdaddr, BDADDR_SIZE); @@ -264,10 +264,10 @@ void ll_address_set(uint8_t addr_type, uint8_t const *const bdaddr) } } -void ll_adv_params_set(uint16_t interval, uint8_t adv_type, - uint8_t own_addr_type, uint8_t direct_addr_type, - uint8_t const *const direct_addr, uint8_t chl_map, - uint8_t filter_policy) +void ll_adv_params_set(u16_t interval, u8_t adv_type, + u8_t own_addr_type, u8_t direct_addr_type, + u8_t const *const direct_addr, u8_t chl_map, + u8_t filter_policy) { struct radio_adv_data *radio_adv_data; struct pdu_adv *pdu; @@ -330,11 +330,11 @@ void ll_adv_params_set(uint16_t interval, uint8_t adv_type, pdu->resv = 0; } -void ll_adv_data_set(uint8_t len, uint8_t const *const data) +void ll_adv_data_set(u8_t len, u8_t const *const data) { struct radio_adv_data *radio_adv_data; struct pdu_adv *pdu; - uint8_t last; + u8_t last; /** @todo dont update data if directed adv type. */ @@ -380,11 +380,11 @@ void ll_adv_data_set(uint8_t len, uint8_t const *const data) radio_adv_data->last = last; } -void ll_scan_data_set(uint8_t len, uint8_t const *const data) +void ll_scan_data_set(u8_t len, u8_t const *const data) { struct radio_adv_data *radio_scan_data; struct pdu_adv *pdu; - uint8_t last; + u8_t last; /* use the last index in double buffer, */ radio_scan_data = radio_scan_data_get(); @@ -414,9 +414,9 @@ void ll_scan_data_set(uint8_t len, uint8_t const *const data) radio_scan_data->last = last; } -uint32_t ll_adv_enable(uint8_t enable) +u32_t ll_adv_enable(u8_t enable) { - uint32_t status; + u32_t status; if (enable) { struct radio_adv_data *radio_adv_data; @@ -464,8 +464,8 @@ uint32_t ll_adv_enable(uint8_t enable) return status; } -void ll_scan_params_set(uint8_t scan_type, uint16_t interval, uint16_t window, - uint8_t own_addr_type, uint8_t filter_policy) +void ll_scan_params_set(u8_t scan_type, u16_t interval, u16_t window, + u8_t own_addr_type, u8_t filter_policy) { _ll_scan_params.scan_type = scan_type; _ll_scan_params.interval = interval; @@ -474,9 +474,9 @@ void ll_scan_params_set(uint8_t scan_type, uint16_t interval, uint16_t window, _ll_scan_params.filter_policy = filter_policy; } -uint32_t ll_scan_enable(uint8_t enable) +u32_t ll_scan_enable(u8_t enable) { - uint32_t status; + u32_t status; if (enable) { status = radio_scan_enable(_ll_scan_params.scan_type, @@ -494,13 +494,13 @@ uint32_t ll_scan_enable(uint8_t enable) return status; } -uint32_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window, - uint8_t filter_policy, uint8_t peer_addr_type, - uint8_t *peer_addr, uint8_t own_addr_type, - uint16_t interval, uint16_t latency, - uint16_t timeout) +u32_t ll_create_connection(u16_t scan_interval, u16_t scan_window, + u8_t filter_policy, u8_t peer_addr_type, + u8_t *peer_addr, u8_t own_addr_type, + u16_t interval, u16_t latency, + u16_t timeout) { - uint32_t status; + u32_t status; status = radio_connect_enable(peer_addr_type, peer_addr, interval, latency, timeout); diff --git a/subsys/bluetooth/controller/ll_sw/pdu.h b/subsys/bluetooth/controller/ll_sw/pdu.h index c552915ca7b..6fa51ed2e32 100644 --- a/subsys/bluetooth/controller/ll_sw/pdu.h +++ b/subsys/bluetooth/controller/ll_sw/pdu.h @@ -16,39 +16,39 @@ #define PDU_AC_SIZE_MAX (37 + PDU_AC_SIZE_OVERHEAD) struct pdu_adv_payload_adv_ind { - uint8_t addr[BDADDR_SIZE]; - uint8_t data[31]; + u8_t addr[BDADDR_SIZE]; + u8_t data[31]; } __packed; struct pdu_adv_payload_direct_ind { - uint8_t adv_addr[BDADDR_SIZE]; - uint8_t tgt_addr[BDADDR_SIZE]; + u8_t adv_addr[BDADDR_SIZE]; + u8_t tgt_addr[BDADDR_SIZE]; } __packed; struct pdu_adv_payload_scan_rsp { - uint8_t addr[BDADDR_SIZE]; - uint8_t data[31]; + u8_t addr[BDADDR_SIZE]; + u8_t data[31]; } __packed; struct pdu_adv_payload_scan_req { - uint8_t scan_addr[BDADDR_SIZE]; - uint8_t adv_addr[BDADDR_SIZE]; + u8_t scan_addr[BDADDR_SIZE]; + u8_t adv_addr[BDADDR_SIZE]; } __packed; struct pdu_adv_payload_connect_ind { - uint8_t init_addr[BDADDR_SIZE]; - uint8_t adv_addr[BDADDR_SIZE]; + u8_t init_addr[BDADDR_SIZE]; + u8_t adv_addr[BDADDR_SIZE]; struct { - uint8_t access_addr[4]; - uint8_t crc_init[3]; - uint8_t win_size; - uint16_t win_offset; - uint16_t interval; - uint16_t latency; - uint16_t timeout; - uint8_t chan_map[5]; - uint8_t hop:5; - uint8_t sca:3; + u8_t access_addr[4]; + u8_t crc_init[3]; + u8_t win_size; + u16_t win_offset; + u16_t interval; + u16_t latency; + u16_t timeout; + u8_t chan_map[5]; + u8_t hop:5; + u8_t sca:3; } __packed lldata; } __packed; @@ -71,15 +71,15 @@ enum pdu_adv_type { } __packed; struct pdu_adv { - uint8_t type:4; - uint8_t rfu:1; - uint8_t chan_sel:1; - uint8_t tx_addr:1; - uint8_t rx_addr:1; + u8_t type:4; + u8_t rfu:1; + u8_t chan_sel:1; + u8_t tx_addr:1; + u8_t rx_addr:1; - uint8_t len:8; + u8_t len:8; - uint8_t resv:8; /* TODO: remove nRF specific code */ + u8_t resv:8; /* TODO: remove nRF specific code */ union { struct pdu_adv_payload_adv_ind adv_ind; @@ -127,117 +127,117 @@ enum pdu_data_llctrl_type { }; struct pdu_data_llctrl_conn_update_ind { - uint8_t win_size; - uint16_t win_offset; - uint16_t interval; - uint16_t latency; - uint16_t timeout; - uint16_t instant; + u8_t win_size; + u16_t win_offset; + u16_t interval; + u16_t latency; + u16_t timeout; + u16_t instant; } __packed; struct pdu_data_llctrl_chan_map_ind { - uint8_t chm[5]; - uint16_t instant; + u8_t chm[5]; + u16_t instant; } __packed; struct pdu_data_llctrl_terminate_ind { - uint8_t error_code; + u8_t error_code; } __packed; struct pdu_data_llctrl_enc_req { - uint8_t rand[8]; - uint8_t ediv[2]; - uint8_t skdm[8]; - uint8_t ivm[4]; + u8_t rand[8]; + u8_t ediv[2]; + u8_t skdm[8]; + u8_t ivm[4]; } __packed; struct pdu_data_llctrl_enc_rsp { - uint8_t skds[8]; - uint8_t ivs[4]; + u8_t skds[8]; + u8_t ivs[4]; } __packed; struct pdu_data_llctrl_unknown_rsp { - uint8_t type; + u8_t type; } __packed; struct pdu_data_llctrl_feature_req { - uint8_t features[8]; + u8_t features[8]; } __packed; struct pdu_data_llctrl_feature_rsp { - uint8_t features[8]; + u8_t features[8]; } __packed; struct pdu_data_llctrl_version_ind { - uint8_t version_number; - uint16_t company_id; - uint16_t sub_version_number; + u8_t version_number; + u16_t company_id; + u16_t sub_version_number; } __packed; struct pdu_data_llctrl_reject_ind { - uint8_t error_code; + u8_t error_code; } __packed; struct pdu_data_llctrl_conn_param_req { - uint16_t interval_min; - uint16_t interval_max; - uint16_t latency; - uint16_t timeout; - uint8_t preferred_periodicity; - uint16_t reference_conn_event_count; - uint16_t offset0; - uint16_t offset1; - uint16_t offset2; - uint16_t offset3; - uint16_t offset4; - uint16_t offset5; + u16_t interval_min; + u16_t interval_max; + u16_t latency; + u16_t timeout; + u8_t preferred_periodicity; + u16_t reference_conn_event_count; + u16_t offset0; + u16_t offset1; + u16_t offset2; + u16_t offset3; + u16_t offset4; + u16_t offset5; } __packed; struct pdu_data_llctrl_conn_param_rsp { - uint16_t interval_min; - uint16_t interval_max; - uint16_t latency; - uint16_t timeout; - uint8_t preferred_periodicity; - uint16_t reference_conn_event_count; - uint16_t offset0; - uint16_t offset1; - uint16_t offset2; - uint16_t offset3; - uint16_t offset4; - uint16_t offset5; + u16_t interval_min; + u16_t interval_max; + u16_t latency; + u16_t timeout; + u8_t preferred_periodicity; + u16_t reference_conn_event_count; + u16_t offset0; + u16_t offset1; + u16_t offset2; + u16_t offset3; + u16_t offset4; + u16_t offset5; } __packed; struct pdu_data_llctrl_reject_ext_ind { - uint8_t reject_opcode; - uint8_t error_code; + u8_t reject_opcode; + u8_t error_code; } __packed; struct pdu_data_llctrl_length_req_rsp { - uint16_t max_rx_octets; - uint16_t max_rx_time; - uint16_t max_tx_octets; - uint16_t max_tx_time; + u16_t max_rx_octets; + u16_t max_rx_time; + u16_t max_tx_octets; + u16_t max_tx_time; } __packed; struct pdu_data_llctrl_phy_req_rsp { - uint8_t tx_phys; - uint8_t rx_phys; + u8_t tx_phys; + u8_t rx_phys; } __packed; struct pdu_data_llctrl_phy_update_ind { - uint8_t m_to_s_phy; - uint8_t s_to_m_phy; - uint16_t instant; + u8_t m_to_s_phy; + u8_t s_to_m_phy; + u16_t instant; } __packed; struct pdu_data_llctrl_min_used_chans_ind { - uint8_t phys; - uint8_t min_used_chans; + u8_t phys; + u8_t min_used_chans; } __packed; struct pdu_data_llctrl { - uint8_t opcode; + u8_t opcode; union { struct pdu_data_llctrl_conn_update_ind conn_update_ind; struct pdu_data_llctrl_chan_map_ind chan_map_ind; @@ -264,32 +264,32 @@ struct pdu_data_llctrl { #if defined(CONFIG_BLUETOOTH_CONTROLLER_PROFILE_ISR) struct profile { - uint8_t lcur; - uint8_t lmin; - uint8_t lmax; - uint8_t cur; - uint8_t min; - uint8_t max; + u8_t lcur; + u8_t lmin; + u8_t lmax; + u8_t cur; + u8_t min; + u8_t max; } __packed; #endif /* CONFIG_BLUETOOTH_CONTROLLER_PROFILE_ISR */ struct pdu_data { - uint8_t ll_id:2; - uint8_t nesn:1; - uint8_t sn:1; - uint8_t md:1; - uint8_t rfu:3; + u8_t ll_id:2; + u8_t nesn:1; + u8_t sn:1; + u8_t md:1; + u8_t rfu:3; - uint8_t len:8; + u8_t len:8; - uint8_t resv:8; /* TODO: remove nRF specific code */ + u8_t resv:8; /* TODO: remove nRF specific code */ union { - uint8_t lldata[1]; + u8_t lldata[1]; struct pdu_data_llctrl llctrl; #if defined(CONFIG_BLUETOOTH_CONTROLLER_CONN_RSSI) - uint8_t rssi; + u8_t rssi; #endif /* CONFIG_BLUETOOTH_CONTROLLER_CONN_RSSI */ #if defined(CONFIG_BLUETOOTH_CONTROLLER_PROFILE_ISR) diff --git a/subsys/bluetooth/controller/ticker/ticker.c b/subsys/bluetooth/controller/ticker/ticker.c index 6165a19189e..203be66f3ee 100644 --- a/subsys/bluetooth/controller/ticker/ticker.c +++ b/subsys/bluetooth/controller/ticker/ticker.c @@ -29,22 +29,22 @@ * Types ****************************************************************************/ struct ticker_node { - uint8_t next; + u8_t next; - uint8_t req; - uint8_t ack; - uint8_t force; - uint32_t ticks_periodic; - uint32_t ticks_to_expire; + u8_t req; + u8_t ack; + u8_t force; + u32_t ticks_periodic; + u32_t ticks_to_expire; ticker_timeout_func timeout_func; void *context; - uint16_t ticks_to_expire_minus; - uint16_t ticks_slot; - uint16_t lazy_periodic; - uint16_t lazy_current; - uint32_t remainder_periodic; - uint32_t remainder_current; + u16_t ticks_to_expire_minus; + u16_t ticks_slot; + u16_t lazy_periodic; + u16_t lazy_current; + u32_t remainder_periodic; + u32_t remainder_current; }; enum ticker_user_op_type { @@ -57,69 +57,69 @@ enum ticker_user_op_type { }; struct ticker_user_op_start { - uint32_t ticks_at_start; - uint32_t ticks_first; - uint32_t ticks_periodic; - uint32_t remainder_periodic; - uint16_t lazy; - uint16_t ticks_slot; + u32_t ticks_at_start; + u32_t ticks_first; + u32_t ticks_periodic; + u32_t remainder_periodic; + u16_t lazy; + u16_t ticks_slot; ticker_timeout_func fp_timeout_func; void *context; }; struct ticker_user_op_update { - uint16_t ticks_drift_plus; - uint16_t ticks_drift_minus; - uint16_t ticks_slot_plus; - uint16_t ticks_slot_minus; - uint16_t lazy; - uint8_t force; + u16_t ticks_drift_plus; + u16_t ticks_drift_minus; + u16_t ticks_slot_plus; + u16_t ticks_slot_minus; + u16_t lazy; + u8_t force; }; struct ticker_user_op_slot_get { - uint8_t *ticker_id; - uint32_t *ticks_current; - uint32_t *ticks_to_expire; + u8_t *ticker_id; + u32_t *ticks_current; + u32_t *ticks_to_expire; }; struct ticker_user_op { enum ticker_user_op_type op; - uint8_t id; + u8_t id; union { struct ticker_user_op_start start; struct ticker_user_op_update update; struct ticker_user_op_slot_get slot_get; } params; - uint32_t status; + u32_t status; ticker_op_func fp_op_func; void *op_context; }; struct ticker_user { - uint8_t count_user_op; - uint8_t first; - uint8_t middle; - uint8_t last; + u8_t count_user_op; + u8_t first; + u8_t middle; + u8_t last; struct ticker_user_op *user_op; }; struct ticker_instance { struct ticker_node *node; struct ticker_user *user; - uint8_t count_node; - uint8_t count_user; - uint8_t ticks_elapsed_first; - uint8_t ticks_elapsed_last; - uint32_t ticks_elapsed[DOUBLE_BUFFER_SIZE]; - uint32_t ticks_current; - uint8_t ticker_id_head; - uint8_t ticker_id_slot_previous; - uint16_t ticks_slot_previous; - uint8_t job_guard; - uint8_t worker_trigger; - uint8_t (*fp_caller_id_get)(uint8_t user_id); - void (*fp_sched)(uint8_t caller_id, uint8_t callee_id, uint8_t chain); - void (*fp_cmp_set)(uint32_t value); + u8_t count_node; + u8_t count_user; + u8_t ticks_elapsed_first; + u8_t ticks_elapsed_last; + u32_t ticks_elapsed[DOUBLE_BUFFER_SIZE]; + u32_t ticks_current; + u8_t ticker_id_head; + u8_t ticker_id_slot_previous; + u16_t ticks_slot_previous; + u8_t job_guard; + u8_t worker_trigger; + u8_t (*fp_caller_id_get)(u8_t user_id); + void (*fp_sched)(u8_t caller_id, u8_t callee_id, u8_t chain); + void (*fp_cmp_set)(u32_t value); }; /***************************************************************************** @@ -130,13 +130,13 @@ static struct ticker_instance _instance[2]; /***************************************************************************** * Static Functions ****************************************************************************/ -static uint8_t ticker_by_slot_get(struct ticker_node *node, - uint8_t ticker_id_head, - uint32_t ticks_slot) +static u8_t ticker_by_slot_get(struct ticker_node *node, + u8_t ticker_id_head, + u32_t ticks_slot) { while (ticker_id_head != TICKER_NULL) { struct ticker_node *ticker; - uint32_t ticks_to_expire; + u32_t ticks_to_expire; ticker = &node[ticker_id_head]; ticks_to_expire = ticker->ticks_to_expire; @@ -157,14 +157,14 @@ static uint8_t ticker_by_slot_get(struct ticker_node *node, } static void ticker_by_next_slot_get(struct ticker_instance *instance, - uint8_t *ticker_id_head, - uint32_t *ticks_current, - uint32_t *ticks_to_expire) + u8_t *ticker_id_head, + u32_t *ticks_current, + u32_t *ticks_to_expire) { struct ticker_node *node; - uint8_t _ticker_id_head; + u8_t _ticker_id_head; struct ticker_node *ticker; - uint32_t _ticks_to_expire; + u32_t _ticks_to_expire; node = instance->node; @@ -195,19 +195,19 @@ static void ticker_by_next_slot_get(struct ticker_instance *instance, *ticks_to_expire = _ticks_to_expire; } -static uint8_t ticker_enqueue(struct ticker_instance *instance, - uint8_t id) +static u8_t ticker_enqueue(struct ticker_instance *instance, + u8_t id) { struct ticker_node *node; struct ticker_node *ticker_new; struct ticker_node *ticker_current; - uint8_t previous; - uint8_t current; - uint8_t ticker_id_slot_previous; - uint8_t collide; - uint32_t ticks_to_expire; - uint32_t ticks_to_expire_current; - uint32_t ticks_slot_previous; + u8_t previous; + u8_t current; + u8_t ticker_id_slot_previous; + u8_t collide; + u32_t ticks_to_expire; + u32_t ticks_to_expire_current; + u32_t ticks_slot_previous; node = &instance->node[0]; ticker_new = &node[id]; @@ -269,15 +269,15 @@ static uint8_t ticker_enqueue(struct ticker_instance *instance, return id; } -static uint32_t ticker_dequeue(struct ticker_instance *instance, - uint8_t id) +static u32_t ticker_dequeue(struct ticker_instance *instance, + u8_t id) { struct ticker_node *ticker_current; struct ticker_node *node; - uint8_t previous; - uint8_t current; - uint32_t timeout; - uint32_t total; + u8_t previous; + u8_t current; + u32_t timeout; + u32_t total; /* find the ticker's position in ticker list */ node = &instance->node[0]; @@ -329,9 +329,9 @@ static uint32_t ticker_dequeue(struct ticker_instance *instance, static inline void ticker_worker(struct ticker_instance *instance) { struct ticker_node *node; - uint32_t ticks_elapsed; - uint32_t ticks_expired; - uint8_t ticker_id_head; + u32_t ticks_elapsed; + u32_t ticks_expired; + u8_t ticker_id_head; /* Defer worker if job running */ instance->worker_trigger = 1; @@ -360,7 +360,7 @@ static inline void ticker_worker(struct ticker_instance *instance) node = &instance->node[0]; while (ticker_id_head != TICKER_NULL) { struct ticker_node *ticker; - uint32_t ticks_to_expire; + u32_t ticks_to_expire; /* auto variable for current ticker node */ ticker = &node[ticker_id_head]; @@ -401,7 +401,7 @@ static inline void ticker_worker(struct ticker_instance *instance) /* queue the elapsed value */ if (instance->ticks_elapsed_first == instance->ticks_elapsed_last) { - uint8_t last; + u8_t last; last = instance->ticks_elapsed_last + 1; if (last == DOUBLE_BUFFER_SIZE) { @@ -418,18 +418,18 @@ static inline void ticker_worker(struct ticker_instance *instance) } static void prepare_ticks_to_expire(struct ticker_node *ticker, - uint32_t ticks_current, - uint32_t ticks_at_start) + u32_t ticks_current, + u32_t ticks_at_start) { - uint32_t ticks_to_expire = ticker->ticks_to_expire; - uint16_t ticks_to_expire_minus = ticker->ticks_to_expire_minus; + u32_t ticks_to_expire = ticker->ticks_to_expire; + u16_t ticks_to_expire_minus = ticker->ticks_to_expire_minus; /* Calculate ticks to expire for this new node */ if (((ticks_at_start - ticks_current) & 0x00800000) == 0) { ticks_to_expire += ticker_ticks_diff_get(ticks_at_start, ticks_current); } else { - uint32_t delta_current_start; + u32_t delta_current_start; delta_current_start = ticker_ticks_diff_get(ticks_current, ticks_at_start); @@ -455,7 +455,7 @@ static void prepare_ticks_to_expire(struct ticker_node *ticker, ticker->ticks_to_expire_minus = ticks_to_expire_minus; } -static uint8_t ticker_remainder_increment(struct ticker_node *ticker) +static u8_t ticker_remainder_increment(struct ticker_node *ticker) { ticker->remainder_current += ticker->remainder_periodic; if ((ticker->remainder_current < 0x80000000) @@ -466,9 +466,9 @@ static uint8_t ticker_remainder_increment(struct ticker_node *ticker) return 0; } -static uint8_t ticker_remainder_decrement(struct ticker_node *ticker) +static u8_t ticker_remainder_decrement(struct ticker_node *ticker) { - uint8_t decrement = 0; + u8_t decrement = 0; if ((ticker->remainder_current >= 0x80000000) || (ticker->remainder_current <= (30517578UL / 2))) { @@ -482,12 +482,12 @@ static uint8_t ticker_remainder_decrement(struct ticker_node *ticker) static inline void ticker_job_node_update(struct ticker_node *ticker, struct ticker_user_op *user_op, - uint32_t ticks_current, - uint32_t ticks_elapsed, - uint8_t *insert_head) + u32_t ticks_current, + u32_t ticks_elapsed, + u8_t *insert_head) { - uint32_t ticks_now; - uint32_t ticks_to_expire = ticker->ticks_to_expire; + u32_t ticks_now; + u32_t ticks_to_expire = ticker->ticks_to_expire; ticks_now = cntr_cnt_get(); ticks_elapsed += ticker_ticks_diff_get(ticks_now, ticks_current); @@ -545,15 +545,15 @@ static inline void ticker_job_node_update(struct ticker_node *ticker, *insert_head = user_op->id; } -static inline uint8_t ticker_job_list_manage( +static inline u8_t ticker_job_list_manage( struct ticker_instance *instance, - uint32_t ticks_elapsed, - uint8_t *insert_head) + u32_t ticks_elapsed, + u8_t *insert_head) { - uint8_t pending; + u8_t pending; struct ticker_node *node; struct ticker_user *users; - uint8_t count_user; + u8_t count_user; pending = 0; node = &instance->node[0]; @@ -568,9 +568,9 @@ static inline uint8_t ticker_job_list_manage( while (user->middle != user->last) { struct ticker_user_op *user_op; struct ticker_node *ticker; - uint8_t state; - uint8_t prev; - uint8_t middle; + u8_t state; + u8_t prev; + u8_t middle; user_op = &user_ops[user->middle]; @@ -696,19 +696,19 @@ static inline uint8_t ticker_job_list_manage( static inline void ticker_job_worker_bottom_half( struct ticker_instance *instance, - uint32_t ticks_previous, - uint32_t ticks_elapsed, - uint8_t *insert_head) + u32_t ticks_previous, + u32_t ticks_elapsed, + u8_t *insert_head) { struct ticker_node *node; - uint32_t ticks_expired; + u32_t ticks_expired; node = &instance->node[0]; ticks_expired = 0; while (instance->ticker_id_head != TICKER_NULL) { struct ticker_node *ticker; - uint8_t id_expired; - uint32_t ticks_to_expire; + u8_t id_expired; + u32_t ticks_to_expire; /* auto variable for current ticker node */ id_expired = instance->ticker_id_head; @@ -747,7 +747,7 @@ static inline void ticker_job_worker_bottom_half( /* ticker will be restarted if periodic */ if (ticker->ticks_periodic != 0) { - uint32_t count; + u32_t count; count = 1 + ticker->lazy_periodic; @@ -780,30 +780,30 @@ static inline void ticker_job_worker_bottom_half( static inline void ticker_job_list_insert( struct ticker_instance *instance, - uint8_t insert_head) + u8_t insert_head) { struct ticker_node *node; struct ticker_user *users; - uint8_t count_user; + u8_t count_user; node = &instance->node[0]; users = &instance->user[0]; count_user = instance->count_user; while (count_user--) { struct ticker_user *user; - uint8_t user_ops_first; + u8_t user_ops_first; user = &users[count_user]; user_ops_first = user->first; while ((insert_head != TICKER_NULL) || (user_ops_first != user->middle) ) { - uint8_t id_insert; - uint8_t id_collide; + u8_t id_insert; + u8_t id_collide; struct ticker_user_op *user_op; enum ticker_user_op_type _user_op; struct ticker_node *ticker; - uint32_t status; + u32_t status; if (insert_head != TICKER_NULL) { id_insert = insert_head; @@ -813,7 +813,7 @@ static inline void ticker_job_list_insert( user_op = 0; _user_op = TICKER_USER_OP_TYPE_START; } else { - uint8_t first; + u8_t first; user_op = &user->user_op[user_ops_first]; first = user_ops_first + 1; @@ -940,7 +940,7 @@ static inline void ticker_job_list_inquire( struct ticker_instance *instance) { struct ticker_user *users; - uint8_t count_user; + u8_t count_user; users = &instance->user[0]; count_user = instance->count_user; @@ -951,7 +951,7 @@ static inline void ticker_job_list_inquire( while (user->first != user->last) { struct ticker_user_op *user_op; ticker_op_func fp_op_func; - uint8_t first; + u8_t first; user_op = &user->user_op[user->first]; fp_op_func = 0; @@ -1004,15 +1004,15 @@ static inline void ticker_job_list_inquire( static inline void ticker_job_compare_update( struct ticker_instance *instance, - uint8_t ticker_id_old_head) + u8_t ticker_id_old_head) { struct ticker_node *ticker; struct ticker_node *node; - uint32_t ticks_to_expire; - uint32_t ctr_post; - uint32_t ctr; - uint32_t cc; - uint32_t i; + u32_t ticks_to_expire; + u32_t ctr_post; + u32_t ctr; + u32_t cc; + u32_t i; if (instance->ticker_id_head == TICKER_NULL) { if (cntr_stop() == 0) { @@ -1023,7 +1023,7 @@ static inline void ticker_job_compare_update( } if (ticker_id_old_head == TICKER_NULL) { - uint32_t ticks_current; + u32_t ticks_current; ticks_current = cntr_cnt_get(); @@ -1043,7 +1043,7 @@ static inline void ticker_job_compare_update( */ i = 10; do { - uint32_t ticks_elapsed; + u32_t ticks_elapsed; LL_ASSERT(i); i--; @@ -1065,13 +1065,13 @@ static inline void ticker_job_compare_update( static inline void ticker_job(struct ticker_instance *instance) { - uint8_t ticker_id_old_head; - uint8_t insert_head; - uint32_t ticks_elapsed; - uint32_t ticks_previous; - uint8_t flag_elapsed; - uint8_t pending; - uint8_t flag_compare_update; + u8_t ticker_id_old_head; + u8_t insert_head; + u32_t ticks_elapsed; + u32_t ticks_previous; + u8_t flag_elapsed; + u8_t pending; + u8_t flag_compare_update; DEBUG_TICKER_JOB(1); @@ -1088,7 +1088,7 @@ static inline void ticker_job(struct ticker_instance *instance) /* Update current tick with the elapsed value from queue, and dequeue */ if (instance->ticks_elapsed_first != instance->ticks_elapsed_last) { - uint8_t first; + u8_t first; first = instance->ticks_elapsed_first + 1; if (first == DOUBLE_BUFFER_SIZE) { @@ -1178,7 +1178,7 @@ static inline void ticker_job(struct ticker_instance *instance) ****************************************************************************/ #include "util/mayfly.h" -static uint8_t ticker_instance0_caller_id_get(uint8_t user_id) +static u8_t ticker_instance0_caller_id_get(u8_t user_id) { switch (user_id) { case MAYFLY_CALL_ID_0: @@ -1199,7 +1199,7 @@ static uint8_t ticker_instance0_caller_id_get(uint8_t user_id) return 0; } -static uint8_t ticker_instance1_caller_id_get(uint8_t user_id) +static u8_t ticker_instance1_caller_id_get(u8_t user_id) { switch (user_id) { case MAYFLY_CALL_ID_2: @@ -1218,8 +1218,8 @@ static uint8_t ticker_instance1_caller_id_get(uint8_t user_id) return 0; } -static void ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, - uint8_t chain) +static void ticker_instance0_sched(u8_t caller_id, u8_t callee_id, + u8_t chain) { /* return value not checked as we allow multiple calls to schedule * before being actually needing the work to complete before new @@ -1345,8 +1345,8 @@ static void ticker_instance0_sched(uint8_t caller_id, uint8_t callee_id, } } -static void ticker_instance1_sched(uint8_t caller_id, uint8_t callee_id, - uint8_t chain) +static void ticker_instance1_sched(u8_t caller_id, u8_t callee_id, + u8_t chain) { /* return value not checked as we allow multiple calls to schedule * before being actually needing the work to complete before new @@ -1472,12 +1472,12 @@ static void ticker_instance1_sched(uint8_t caller_id, uint8_t callee_id, } } -static void ticker_instance0_cmp_set(uint32_t value) +static void ticker_instance0_cmp_set(u32_t value) { cntr_cmp_set(0, value); } -static void ticker_instance1_cmp_set(uint32_t value) +static void ticker_instance1_cmp_set(u32_t value) { cntr_cmp_set(1, value); } @@ -1485,8 +1485,8 @@ static void ticker_instance1_cmp_set(uint32_t value) /***************************************************************************** * Public Interface ****************************************************************************/ -uint32_t ticker_init(uint8_t instance_index, uint8_t count_node, void *node, - uint8_t count_user, void *user, uint8_t count_op, +u32_t ticker_init(u8_t instance_index, u8_t count_node, void *node, + u8_t count_user, void *user, u8_t count_op, void *user_op) { struct ticker_instance *instance = &_instance[instance_index]; @@ -1547,7 +1547,7 @@ uint32_t ticker_init(uint8_t instance_index, uint8_t count_node, void *node, return TICKER_STATUS_SUCCESS; } -void ticker_trigger(uint8_t instance_index) +void ticker_trigger(u8_t instance_index) { DEBUG_TICKER_ISR(1); @@ -1559,15 +1559,15 @@ void ticker_trigger(uint8_t instance_index) DEBUG_TICKER_ISR(0); } -uint32_t ticker_start(uint8_t instance_index, uint8_t user_id, - uint8_t _ticker_id, uint32_t ticks_anchor, - uint32_t ticks_first, uint32_t ticks_periodic, - uint32_t remainder_periodic, uint16_t lazy, - uint16_t ticks_slot, +u32_t ticker_start(u8_t instance_index, u8_t user_id, + u8_t _ticker_id, u32_t ticks_anchor, + u32_t ticks_first, u32_t ticks_periodic, + u32_t remainder_periodic, u16_t lazy, + u16_t ticks_slot, ticker_timeout_func ticker_timeout_func, void *context, ticker_op_func fp_op_func, void *op_context) { - uint8_t last; + u8_t last; struct ticker_instance *instance = &_instance[instance_index]; struct ticker_user *user; struct ticker_user_op *user_op; @@ -1605,14 +1605,14 @@ uint32_t ticker_start(uint8_t instance_index, uint8_t user_id, return user_op->status; } -uint32_t ticker_update(uint8_t instance_index, uint8_t user_id, - uint8_t _ticker_id, uint16_t ticks_drift_plus, - uint16_t ticks_drift_minus, uint16_t ticks_slot_plus, - uint16_t ticks_slot_minus, uint16_t lazy, uint8_t force, +u32_t ticker_update(u8_t instance_index, u8_t user_id, + u8_t _ticker_id, u16_t ticks_drift_plus, + u16_t ticks_drift_minus, u16_t ticks_slot_plus, + u16_t ticks_slot_minus, u16_t lazy, u8_t force, ticker_op_func fp_op_func, void *op_context) { struct ticker_instance *instance = &_instance[instance_index]; - uint8_t last; + u8_t last; struct ticker_user *user; struct ticker_user_op *user_op; @@ -1647,12 +1647,12 @@ uint32_t ticker_update(uint8_t instance_index, uint8_t user_id, return user_op->status; } -uint32_t ticker_stop(uint8_t instance_index, uint8_t user_id, - uint8_t _ticker_id, ticker_op_func fp_op_func, +u32_t ticker_stop(u8_t instance_index, u8_t user_id, + u8_t _ticker_id, ticker_op_func fp_op_func, void *op_context) { struct ticker_instance *instance = &_instance[instance_index]; - uint8_t last; + u8_t last; struct ticker_user *user; struct ticker_user_op *user_op; @@ -1681,14 +1681,14 @@ uint32_t ticker_stop(uint8_t instance_index, uint8_t user_id, return user_op->status; } -uint32_t ticker_next_slot_get(uint8_t instance_index, uint8_t user_id, - uint8_t *_ticker_id, - uint32_t *ticks_current, - uint32_t *ticks_to_expire, +u32_t ticker_next_slot_get(u8_t instance_index, u8_t user_id, + u8_t *_ticker_id, + u32_t *ticks_current, + u32_t *ticks_to_expire, ticker_op_func fp_op_func, void *op_context) { struct ticker_instance *instance = &_instance[instance_index]; - uint8_t last; + u8_t last; struct ticker_user *user; struct ticker_user_op *user_op; @@ -1720,11 +1720,11 @@ uint32_t ticker_next_slot_get(uint8_t instance_index, uint8_t user_id, return user_op->status; } -uint32_t ticker_job_idle_get(uint8_t instance_index, uint8_t user_id, +u32_t ticker_job_idle_get(u8_t instance_index, u8_t user_id, ticker_op_func fp_op_func, void *op_context) { struct ticker_instance *instance = &_instance[instance_index]; - uint8_t last; + u8_t last; struct ticker_user *user; struct ticker_user_op *user_op; @@ -1753,19 +1753,19 @@ uint32_t ticker_job_idle_get(uint8_t instance_index, uint8_t user_id, return user_op->status; } -void ticker_job_sched(uint8_t instance_index, uint8_t user_id) +void ticker_job_sched(u8_t instance_index, u8_t user_id) { struct ticker_instance *instance = &_instance[instance_index]; instance->fp_sched(instance->fp_caller_id_get(user_id), CALL_ID_JOB, 0); } -uint32_t ticker_ticks_now_get(void) +u32_t ticker_ticks_now_get(void) { return cntr_cnt_get(); } -uint32_t ticker_ticks_diff_get(uint32_t ticks_now, uint32_t ticks_old) +u32_t ticker_ticks_diff_get(u32_t ticks_now, u32_t ticks_old) { return ((ticks_now - ticks_old) & 0x00FFFFFF); } diff --git a/subsys/bluetooth/controller/ticker/ticker.h b/subsys/bluetooth/controller/ticker/ticker.h index 18607123adb..299abe73f5f 100644 --- a/subsys/bluetooth/controller/ticker/ticker.h +++ b/subsys/bluetooth/controller/ticker/ticker.h @@ -14,7 +14,7 @@ */ #define TICKER_US_TO_TICKS(x) \ ( \ - ((uint32_t)(((uint64_t) (x) * 1000000000UL) / 30517578125UL)) \ + ((u32_t)(((u64_t) (x) * 1000000000UL) / 30517578125UL)) \ & 0x00FFFFFF \ ) @@ -23,8 +23,8 @@ #define TICKER_REMAINDER(x) \ ( \ ( \ - ((uint64_t) (x) * 1000000000UL) \ - - ((uint64_t) TICKER_US_TO_TICKS(x) * 30517578125UL) \ + ((u64_t) (x) * 1000000000UL) \ + - ((u64_t) TICKER_US_TO_TICKS(x) * 30517578125UL) \ ) \ / 1000UL \ ) @@ -32,7 +32,7 @@ /** \brief Macro to translate tick units to microseconds. */ #define TICKER_TICKS_TO_US(x) \ - ((uint32_t)(((uint64_t) (x) * 30517578125UL) / 1000000000UL)) + ((u32_t)(((u64_t) (x) * 30517578125UL) / 1000000000UL)) /** \defgroup Timer API return codes. * @@ -53,7 +53,7 @@ * * @{ */ -#define TICKER_NULL ((uint8_t)((uint8_t)0 - 1)) +#define TICKER_NULL ((u8_t)((u8_t)0 - 1)) #define TICKER_NULL_REMAINDER 0 #define TICKER_NULL_PERIOD 0 #define TICKER_NULL_SLOT 0 @@ -76,13 +76,13 @@ /** \brief Timer timeout function type. */ -typedef void (*ticker_timeout_func) (uint32_t ticks_at_expire, - uint32_t remainder, uint16_t lazy, +typedef void (*ticker_timeout_func) (u32_t ticks_at_expire, + u32_t remainder, u16_t lazy, void *context); /** \brief Timer operation complete function type. */ -typedef void (*ticker_op_func) (uint32_t status, void *op_context); +typedef void (*ticker_op_func) (u32_t status, void *op_context); /** \brief Timer module initialization. * @@ -95,34 +95,34 @@ typedef void (*ticker_op_func) (uint32_t status, void *op_context); * \param[in] count_op * \param[in] user_op */ -uint32_t ticker_init(uint8_t instance_index, uint8_t count_node, void *node, - uint8_t count_user, void *user, uint8_t count_op, +u32_t ticker_init(u8_t instance_index, u8_t count_node, void *node, + u8_t count_user, void *user, u8_t count_op, void *user_op); -void ticker_trigger(uint8_t instance_index); -uint32_t ticker_start(uint8_t instance_index, uint8_t user_id, - uint8_t ticker_id, uint32_t ticks_anchor, - uint32_t ticks_first, uint32_t ticks_periodic, - uint32_t remainder_periodic, uint16_t lazy, - uint16_t ticks_slot, +void ticker_trigger(u8_t instance_index); +u32_t ticker_start(u8_t instance_index, u8_t user_id, + u8_t ticker_id, u32_t ticks_anchor, + u32_t ticks_first, u32_t ticks_periodic, + u32_t remainder_periodic, u16_t lazy, + u16_t ticks_slot, ticker_timeout_func ticker_timeout_func, void *context, ticker_op_func fp_op_func, void *op_context); -uint32_t ticker_update(uint8_t instance_index, uint8_t user_id, - uint8_t ticker_id, uint16_t ticks_drift_plus, - uint16_t ticks_drift_minus, uint16_t ticks_slot_plus, - uint16_t ticks_slot_minus, uint16_t lazy, uint8_t force, +u32_t ticker_update(u8_t instance_index, u8_t user_id, + u8_t ticker_id, u16_t ticks_drift_plus, + u16_t ticks_drift_minus, u16_t ticks_slot_plus, + u16_t ticks_slot_minus, u16_t lazy, u8_t force, ticker_op_func fp_op_func, void *op_context); -uint32_t ticker_stop(uint8_t instance_index, uint8_t user_id, - uint8_t ticker_id, ticker_op_func fp_op_func, +u32_t ticker_stop(u8_t instance_index, u8_t user_id, + u8_t ticker_id, ticker_op_func fp_op_func, void *op_context); -uint32_t ticker_next_slot_get(uint8_t instance_index, uint8_t user_id, - uint8_t *ticker_id_head, - uint32_t *ticks_current, - uint32_t *ticks_to_expire, +u32_t ticker_next_slot_get(u8_t instance_index, u8_t user_id, + u8_t *ticker_id_head, + u32_t *ticks_current, + u32_t *ticks_to_expire, ticker_op_func fp_op_func, void *op_context); -uint32_t ticker_job_idle_get(uint8_t instance_index, uint8_t user_id, +u32_t ticker_job_idle_get(u8_t instance_index, u8_t user_id, ticker_op_func fp_op_func, void *op_context); -void ticker_job_sched(uint8_t instance_index, uint8_t user_id); -uint32_t ticker_ticks_now_get(void); -uint32_t ticker_ticks_diff_get(uint32_t ticks_now, uint32_t ticks_old); +void ticker_job_sched(u8_t instance_index, u8_t user_id); +u32_t ticker_ticks_now_get(void); +u32_t ticker_ticks_diff_get(u32_t ticks_now, u32_t ticks_old); #endif diff --git a/subsys/bluetooth/controller/util/mayfly.c b/subsys/bluetooth/controller/util/mayfly.c index 0fdf9f2dca8..cd403762a05 100644 --- a/subsys/bluetooth/controller/util/mayfly.c +++ b/subsys/bluetooth/controller/util/mayfly.c @@ -12,21 +12,21 @@ static struct { void *head; void *tail; - uint8_t enable_req; - uint8_t enable_ack; - uint8_t disable_req; - uint8_t disable_ack; + u8_t enable_req; + u8_t enable_ack; + u8_t disable_req; + u8_t disable_ack; } mft[MAYFLY_CALLEE_COUNT][MAYFLY_CALLER_COUNT]; static void *mfl[MAYFLY_CALLEE_COUNT][MAYFLY_CALLER_COUNT][2]; void mayfly_init(void) { - uint8_t callee_id; + u8_t callee_id; callee_id = MAYFLY_CALLEE_COUNT; while (callee_id--) { - uint8_t caller_id; + u8_t caller_id; caller_id = MAYFLY_CALLER_COUNT; while (caller_id--) { @@ -37,7 +37,7 @@ void mayfly_init(void) } } -void mayfly_enable(uint8_t caller_id, uint8_t callee_id, uint8_t enable) +void mayfly_enable(u8_t caller_id, u8_t callee_id, u8_t enable) { if (enable) { if (mft[callee_id][caller_id].enable_req == @@ -56,11 +56,11 @@ void mayfly_enable(uint8_t caller_id, uint8_t callee_id, uint8_t enable) } } -uint32_t mayfly_enqueue(uint8_t caller_id, uint8_t callee_id, uint8_t chain, +u32_t mayfly_enqueue(u8_t caller_id, u8_t callee_id, u8_t chain, struct mayfly *m) { - uint8_t state; - uint8_t ack; + u8_t state; + u8_t ack; chain = chain || !mayfly_prio_is_equal(caller_id, callee_id) || !mayfly_is_enabled(caller_id, callee_id) || @@ -110,11 +110,11 @@ uint32_t mayfly_enqueue(uint8_t caller_id, uint8_t callee_id, uint8_t chain, return 0; } -void mayfly_run(uint8_t callee_id) +void mayfly_run(u8_t callee_id) { - uint8_t disable = 0; - uint8_t enable = 0; - uint8_t caller_id; + u8_t disable = 0; + u8_t enable = 0; + u8_t caller_id; /* iterate through each caller queue to this callee_id */ caller_id = MAYFLY_CALLER_COUNT; @@ -127,8 +127,8 @@ void mayfly_run(uint8_t callee_id) mft[callee_id][caller_id].head, (void **)&m); while (link) { - uint8_t state; - uint8_t req; + u8_t state; + u8_t req; /* execute work if ready */ req = m->_req; diff --git a/subsys/bluetooth/controller/util/mayfly.h b/subsys/bluetooth/controller/util/mayfly.h index ea66153c620..301dee38379 100644 --- a/subsys/bluetooth/controller/util/mayfly.h +++ b/subsys/bluetooth/controller/util/mayfly.h @@ -16,23 +16,23 @@ #define MAYFLY_CALLEE_COUNT 4 struct mayfly { - uint8_t volatile _req; - uint8_t _ack; + u8_t volatile _req; + u8_t _ack; void *_link; void *param; void (*fp)(void *); }; void mayfly_init(void); -void mayfly_enable(uint8_t caller_id, uint8_t callee_id, uint8_t enable); -uint32_t mayfly_enqueue(uint8_t caller_id, uint8_t callee_id, uint8_t chain, +void mayfly_enable(u8_t caller_id, u8_t callee_id, u8_t enable); +u32_t mayfly_enqueue(u8_t caller_id, u8_t callee_id, u8_t chain, struct mayfly *m); -void mayfly_run(uint8_t callee_id); +void mayfly_run(u8_t callee_id); -extern void mayfly_enable_cb(uint8_t caller_id, uint8_t callee_id, - uint8_t enable); -extern uint32_t mayfly_is_enabled(uint8_t caller_id, uint8_t callee_id); -extern uint32_t mayfly_prio_is_equal(uint8_t caller_id, uint8_t callee_id); -extern void mayfly_pend(uint8_t caller_id, uint8_t callee_id); +extern void mayfly_enable_cb(u8_t caller_id, u8_t callee_id, + u8_t enable); +extern u32_t mayfly_is_enabled(u8_t caller_id, u8_t callee_id); +extern u32_t mayfly_prio_is_equal(u8_t caller_id, u8_t callee_id); +extern void mayfly_pend(u8_t caller_id, u8_t callee_id); #endif /* _MAYFLY_H_ */ diff --git a/subsys/bluetooth/controller/util/mem.c b/subsys/bluetooth/controller/util/mem.c index 759bb55a154..e62f67d41cf 100644 --- a/subsys/bluetooth/controller/util/mem.c +++ b/subsys/bluetooth/controller/util/mem.c @@ -12,7 +12,7 @@ #include "mem.h" -void mem_init(void *mem_pool, uint16_t mem_size, uint16_t mem_count, +void mem_init(void *mem_pool, u16_t mem_size, u16_t mem_count, void **mem_head) { *mem_head = mem_pool; @@ -20,20 +20,20 @@ void mem_init(void *mem_pool, uint16_t mem_size, uint16_t mem_count, /* Store free mem_count after the list's next pointer at an aligned * memory location to ensure atomic read/write (in ARM for now). */ - *((uint16_t *)MROUND((uint8_t *)mem_pool + sizeof(mem_pool))) = + *((u16_t *)MROUND((u8_t *)mem_pool + sizeof(mem_pool))) = mem_count; /* Initialize next pointers to form a free list, * next pointer is stored in the first 32-bit of each block */ - memset(((uint8_t *)mem_pool + (mem_size * (--mem_count))), 0, + memset(((u8_t *)mem_pool + (mem_size * (--mem_count))), 0, sizeof(mem_pool)); while (mem_count--) { - uint32_t next; + u32_t next; - next = (uint32_t)((uint8_t *) mem_pool + + next = (u32_t)((u8_t *) mem_pool + (mem_size * (mem_count + 1))); - memcpy(((uint8_t *)mem_pool + (mem_size * mem_count)), + memcpy(((u8_t *)mem_pool + (mem_size * mem_count)), (void *)&next, sizeof(next)); } } @@ -41,12 +41,12 @@ void mem_init(void *mem_pool, uint16_t mem_size, uint16_t mem_count, void *mem_acquire(void **mem_head) { if (*mem_head) { - uint16_t free_count; + u16_t free_count; void *head; void *mem; /* Get the free count from the list and decrement it */ - free_count = *((uint16_t *)MROUND((uint8_t *)*mem_head + + free_count = *((u16_t *)MROUND((u8_t *)*mem_head + sizeof(mem_head))); free_count--; @@ -55,7 +55,7 @@ void *mem_acquire(void **mem_head) /* Store free mem_count after the list's next pointer */ if (head) { - *((uint16_t *)MROUND((uint8_t *)head + sizeof(head))) = + *((u16_t *)MROUND((u8_t *)head + sizeof(head))) = free_count; } @@ -68,11 +68,11 @@ void *mem_acquire(void **mem_head) void mem_release(void *mem, void **mem_head) { - uint16_t free_count = 0; + u16_t free_count = 0; /* Get the free count from the list and increment it */ if (*mem_head) { - free_count = *((uint16_t *)MROUND((uint8_t *)*mem_head + + free_count = *((u16_t *)MROUND((u8_t *)*mem_head + sizeof(mem_head))); } free_count++; @@ -80,36 +80,36 @@ void mem_release(void *mem, void **mem_head) memcpy(mem, mem_head, sizeof(mem)); /* Store free mem_count after the list's next pointer */ - *((uint16_t *)MROUND((uint8_t *)mem + sizeof(mem))) = free_count; + *((u16_t *)MROUND((u8_t *)mem + sizeof(mem))) = free_count; *mem_head = mem; } -uint16_t mem_free_count_get(void *mem_head) +u16_t mem_free_count_get(void *mem_head) { - uint16_t free_count = 0; + u16_t free_count = 0; /* Get the free count from the list */ if (mem_head) { - free_count = *((uint16_t *)MROUND((uint8_t *)mem_head + + free_count = *((u16_t *)MROUND((u8_t *)mem_head + sizeof(mem_head))); } return free_count; } -void *mem_get(void *mem_pool, uint16_t mem_size, uint16_t index) +void *mem_get(void *mem_pool, u16_t mem_size, u16_t index) { - return ((void *)((uint8_t *)mem_pool + (mem_size * index))); + return ((void *)((u8_t *)mem_pool + (mem_size * index))); } -uint16_t mem_index_get(void *mem, void *mem_pool, uint16_t mem_size) +u16_t mem_index_get(void *mem, void *mem_pool, u16_t mem_size) { - return ((uint16_t)((uint8_t *)mem - (uint8_t *)mem_pool) / + return ((u16_t)((u8_t *)mem - (u8_t *)mem_pool) / mem_size); } -void mem_rcopy(uint8_t *dst, uint8_t const *src, uint16_t len) +void mem_rcopy(u8_t *dst, u8_t const *src, u16_t len) { src += len; while (len--) { @@ -117,7 +117,7 @@ void mem_rcopy(uint8_t *dst, uint8_t const *src, uint16_t len) } } -uint8_t mem_is_zero(uint8_t *src, uint16_t len) +u8_t mem_is_zero(u8_t *src, u16_t len) { while (len--) { if (*src++) { @@ -128,14 +128,14 @@ uint8_t mem_is_zero(uint8_t *src, uint16_t len) return 0; } -uint32_t mem_ut(void) +u32_t mem_ut(void) { #define BLOCK_SIZE MROUND(10) #define BLOCK_COUNT 10 - uint8_t MALIGN(4) pool[BLOCK_COUNT][BLOCK_SIZE]; + u8_t MALIGN(4) pool[BLOCK_COUNT][BLOCK_SIZE]; void *mem_free; void *mem_used; - uint16_t mem_free_count; + u16_t mem_free_count; void *mem; mem_init(pool, BLOCK_SIZE, BLOCK_COUNT, &mem_free); @@ -147,7 +147,7 @@ uint32_t mem_ut(void) mem_used = 0; while (mem_free_count--) { - uint16_t mem_free_count_current; + u16_t mem_free_count_current; mem = mem_acquire(&mem_free); mem_free_count_current = mem_free_count_get(mem_free); @@ -165,7 +165,7 @@ uint32_t mem_ut(void) } while (++mem_free_count < BLOCK_COUNT) { - uint16_t mem_free_count_current; + u16_t mem_free_count_current; mem = mem_used; memcpy(&mem_used, mem, sizeof(void *)); diff --git a/subsys/bluetooth/controller/util/mem.h b/subsys/bluetooth/controller/util/mem.h index c0770b6f241..443a26b1e62 100644 --- a/subsys/bluetooth/controller/util/mem.h +++ b/subsys/bluetooth/controller/util/mem.h @@ -13,21 +13,21 @@ #endif #ifndef MROUND -#define MROUND(x) (((uint32_t)(x)+3) & (~((uint32_t)3))) +#define MROUND(x) (((u32_t)(x)+3) & (~((u32_t)3))) #endif -void mem_init(void *mem_pool, uint16_t mem_size, uint16_t mem_count, +void mem_init(void *mem_pool, u16_t mem_size, u16_t mem_count, void **mem_head); void *mem_acquire(void **mem_head); void mem_release(void *mem, void **mem_head); -uint16_t mem_free_count_get(void *mem_head); -void *mem_get(void *mem_pool, uint16_t mem_size, uint16_t index); -uint16_t mem_index_get(void *mem, void *mem_pool, uint16_t mem_size); +u16_t mem_free_count_get(void *mem_head); +void *mem_get(void *mem_pool, u16_t mem_size, u16_t index); +u16_t mem_index_get(void *mem, void *mem_pool, u16_t mem_size); -void mem_rcopy(uint8_t *dst, uint8_t const *src, uint16_t len); -uint8_t mem_is_zero(uint8_t *src, uint16_t len); +void mem_rcopy(u8_t *dst, u8_t const *src, u16_t len); +u8_t mem_is_zero(u8_t *src, u16_t len); -uint32_t mem_ut(void); +u32_t mem_ut(void); #endif /* _MEM_H_ */ diff --git a/subsys/bluetooth/controller/util/memq.c b/subsys/bluetooth/controller/util/memq.c index 8cbd7b13c10..c1fd14d8067 100644 --- a/subsys/bluetooth/controller/util/memq.c +++ b/subsys/bluetooth/controller/util/memq.c @@ -65,7 +65,7 @@ void *memq_dequeue(void *tail, void **head, void **mem) return link; } -uint32_t memq_ut(void) +u32_t memq_ut(void) { void *head; void *tail; diff --git a/subsys/bluetooth/controller/util/util.c b/subsys/bluetooth/controller/util/util.c index 6f5f061e034..b414428fa93 100644 --- a/subsys/bluetooth/controller/util/util.c +++ b/subsys/bluetooth/controller/util/util.c @@ -8,12 +8,12 @@ #include #include "util.h" -uint8_t util_ones_count_get(uint8_t *octets, uint8_t octets_len) +u8_t util_ones_count_get(u8_t *octets, u8_t octets_len) { - uint8_t one_count = 0; + u8_t one_count = 0; while (octets_len--) { - uint8_t bite; + u8_t bite; bite = *octets; while (bite) { diff --git a/subsys/bluetooth/controller/util/util.h b/subsys/bluetooth/controller/util/util.h index 91b39ef07b3..591edc0e0cb 100644 --- a/subsys/bluetooth/controller/util/util.h +++ b/subsys/bluetooth/controller/util/util.h @@ -16,6 +16,6 @@ #define TRIPLE_BUFFER_SIZE 3 #endif -uint8_t util_ones_count_get(uint8_t *octets, uint8_t octets_len); +u8_t util_ones_count_get(u8_t *octets, u8_t octets_len); #endif diff --git a/subsys/bluetooth/host/a2dp.c b/subsys/bluetooth/host/a2dp.c index e1c1f127828..495ab9859f0 100644 --- a/subsys/bluetooth/host/a2dp.c +++ b/subsys/bluetooth/host/a2dp.c @@ -45,7 +45,7 @@ void a2d_reset(struct bt_a2dp *a2dp_conn) struct bt_a2dp *get_new_connection(struct bt_conn *conn) { - int8_t i, free; + s8_t i, free; free = A2DP_NO_SPACE; @@ -143,7 +143,7 @@ struct bt_a2dp *bt_a2dp_connect(struct bt_conn *conn) } int bt_a2dp_register_endpoint(struct bt_a2dp_endpoint *endpoint, - uint8_t media_type, uint8_t role) + u8_t media_type, u8_t role) { int err; diff --git a/subsys/bluetooth/host/at.c b/subsys/bluetooth/host/at.c index cfd5bd11587..b613d30eb9a 100644 --- a/subsys/bluetooth/host/at.c +++ b/subsys/bluetooth/host/at.c @@ -43,9 +43,9 @@ static void skip_space(struct at_client *at) } } -int at_get_number(struct at_client *at, uint32_t *val) +int at_get_number(struct at_client *at, u32_t *val) { - uint32_t i; + u32_t i; skip_space(at); @@ -91,7 +91,7 @@ static int get_cmd_value(struct at_client *at, struct net_buf *buf, char stop_byte, enum at_cmd_state cmd_state) { int cmd_len = 0; - uint8_t pos = at->pos; + u8_t pos = at->pos; const unsigned char *str = buf->data; while (cmd_len < buf->len && at->pos != at->buf_max_len) { @@ -121,7 +121,7 @@ static int get_response_string(struct at_client *at, struct net_buf *buf, char stop_byte, enum at_state state) { int cmd_len = 0; - uint8_t pos = at->pos; + u8_t pos = at->pos; const unsigned char *str = buf->data; while (cmd_len < buf->len && at->pos != at->buf_max_len) { @@ -267,7 +267,7 @@ static int at_state_process_result(struct at_client *at, struct net_buf *buf) int cme_handle(struct at_client *at) { enum at_cme cme_err; - uint32_t val; + u32_t val; if (!at_get_number(at, &val) && val <= CME_ERROR_NETWORK_NOT_ALLOWED) { cme_err = val; @@ -455,7 +455,7 @@ int at_close_list(struct at_client *at) return 0; } -int at_list_get_string(struct at_client *at, char *name, uint8_t len) +int at_list_get_string(struct at_client *at, char *name, u8_t len) { int i = 0; @@ -490,9 +490,9 @@ int at_list_get_string(struct at_client *at, char *name, uint8_t len) return 0; } -int at_list_get_range(struct at_client *at, uint32_t *min, uint32_t *max) +int at_list_get_range(struct at_client *at, u32_t *min, u32_t *max) { - uint32_t low, high; + u32_t low, high; int ret; ret = at_get_number(at, &low); diff --git a/subsys/bluetooth/host/at.h b/subsys/bluetooth/host/at.h index ea19319f33f..0545c848ff5 100644 --- a/subsys/bluetooth/host/at.h +++ b/subsys/bluetooth/host/at.h @@ -90,10 +90,10 @@ typedef int (*handle_cmd_input_t)(struct at_client *at, struct net_buf *buf, struct at_client { unsigned char *buf; - uint8_t pos; - uint8_t buf_max_len; - uint8_t state; - uint8_t cmd_state; + u8_t pos; + u8_t buf_max_len; + u8_t state; + u8_t cmd_state; at_resp_cb_t resp; at_resp_cb_t unsolicited; at_finish_cb_t finish; @@ -103,7 +103,7 @@ struct at_client { void at_register(struct at_client *at, at_resp_cb_t resp, at_finish_cb_t finish); void at_register_unsolicited(struct at_client *at, at_resp_cb_t unsolicited); -int at_get_number(struct at_client *at, uint32_t *val); +int at_get_number(struct at_client *at, u32_t *val); /* This parsing will only works for non-fragmented net_buf */ int at_parse_input(struct at_client *at, struct net_buf *buf); /* This command parsing will only works for non-fragmented net_buf */ @@ -111,8 +111,8 @@ int at_parse_cmd_input(struct at_client *at, struct net_buf *buf, const char *prefix, parse_val_t func, enum at_cmd_type type); int at_check_byte(struct net_buf *buf, char check_byte); -int at_list_get_range(struct at_client *at, uint32_t *min, uint32_t *max); -int at_list_get_string(struct at_client *at, char *name, uint8_t len); +int at_list_get_range(struct at_client *at, u32_t *min, u32_t *max); +int at_list_get_string(struct at_client *at, char *name, u8_t len); int at_close_list(struct at_client *at); int at_open_list(struct at_client *at); int at_has_next_list(struct at_client *at); diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index f45f9d20970..078f1d17eb1 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -55,12 +55,12 @@ typedef enum __packed { ATT_UNKNOWN, } att_type_t; -static att_type_t att_op_get_type(uint8_t op); +static att_type_t att_op_get_type(u8_t op); #if CONFIG_BLUETOOTH_ATT_PREPARE_COUNT > 0 struct bt_attr_data { - uint16_t handle; - uint16_t offset; + u16_t handle; + u16_t offset; }; /* Pool for incoming ATT packets */ @@ -178,8 +178,8 @@ static bt_conn_tx_cb_t att_cb(struct net_buf *buf) } } -static void send_err_rsp(struct bt_conn *conn, uint8_t req, uint16_t handle, - uint8_t err) +static void send_err_rsp(struct bt_conn *conn, u8_t req, u16_t handle, + u8_t err) { struct bt_att_error_rsp *rsp; struct net_buf *buf; @@ -202,13 +202,13 @@ static void send_err_rsp(struct bt_conn *conn, uint8_t req, uint16_t handle, bt_l2cap_send_cb(conn, BT_L2CAP_CID_ATT, buf, att_rsp_sent); } -static uint8_t att_mtu_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_mtu_req(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; struct bt_att_exchange_mtu_req *req; struct bt_att_exchange_mtu_rsp *rsp; struct net_buf *pdu; - uint16_t mtu_client, mtu_server; + u16_t mtu_client, mtu_server; req = (void *)buf->data; @@ -291,8 +291,8 @@ static void att_process(struct bt_att *att) att_send_req(att, ATT_REQ(node)); } -static uint8_t att_handle_rsp(struct bt_att *att, void *pdu, uint16_t len, - uint8_t err) +static u8_t att_handle_rsp(struct bt_att *att, void *pdu, u16_t len, + u8_t err) { bt_att_func_t func; @@ -329,10 +329,10 @@ process: return 0; } -static uint8_t att_mtu_rsp(struct bt_att *att, struct net_buf *buf) +static u8_t att_mtu_rsp(struct bt_att *att, struct net_buf *buf) { struct bt_att_exchange_mtu_rsp *rsp; - uint16_t mtu; + u16_t mtu; if (!att) { return 0; @@ -363,7 +363,7 @@ static uint8_t att_mtu_rsp(struct bt_att *att, struct net_buf *buf) return att_handle_rsp(att, rsp, buf->len, 0); } -static bool range_is_valid(uint16_t start, uint16_t end, uint16_t *err) +static bool range_is_valid(u16_t start, u16_t end, u16_t *err) { /* Handle 0 is invalid */ if (!start || !end) { @@ -394,7 +394,7 @@ struct find_info_data { }; }; -static uint8_t find_info_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t find_info_cb(const struct bt_gatt_attr *attr, void *user_data) { struct find_info_data *data = user_data; struct bt_att *att = data->att; @@ -445,8 +445,8 @@ static uint8_t find_info_cb(const struct bt_gatt_attr *attr, void *user_data) return BT_GATT_ITER_STOP; } -static uint8_t att_find_info_rsp(struct bt_att *att, uint16_t start_handle, - uint16_t end_handle) +static u8_t att_find_info_rsp(struct bt_att *att, u16_t start_handle, + u16_t end_handle) { struct bt_conn *conn = att->chan.chan.conn; struct find_info_data data; @@ -474,11 +474,11 @@ static uint8_t att_find_info_rsp(struct bt_att *att, uint16_t start_handle, return 0; } -static uint8_t att_find_info_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_find_info_req(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; struct bt_att_find_info_req *req; - uint16_t start_handle, end_handle, err_handle; + u16_t start_handle, end_handle, err_handle; req = (void *)buf->data; @@ -502,17 +502,17 @@ struct find_type_data { struct net_buf *buf; struct bt_att_handle_group *group; const void *value; - uint8_t value_len; - uint8_t err; + u8_t value_len; + u8_t err; }; -static uint8_t find_type_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t find_type_cb(const struct bt_gatt_attr *attr, void *user_data) { struct find_type_data *data = user_data; struct bt_att *att = data->att; struct bt_conn *conn = att->chan.chan.conn; int read; - uint8_t uuid[16]; + u8_t uuid[16]; /* Skip secondary services */ if (!bt_uuid_cmp(attr->uuid, BT_UUID_GATT_SECONDARY)) { @@ -564,9 +564,9 @@ static uint8_t find_type_cb(const struct bt_gatt_attr *attr, void *user_data) return BT_GATT_ITER_CONTINUE; } -static uint8_t att_find_type_rsp(struct bt_att *att, uint16_t start_handle, - uint16_t end_handle, const void *value, - uint8_t value_len) +static u8_t att_find_type_rsp(struct bt_att *att, u16_t start_handle, + u16_t end_handle, const void *value, + u8_t value_len) { struct bt_conn *conn = att->chan.chan.conn; struct find_type_data data; @@ -602,12 +602,12 @@ static uint8_t att_find_type_rsp(struct bt_att *att, uint16_t start_handle, return 0; } -static uint8_t att_find_type_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_find_type_req(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; struct bt_att_find_type_req *req; - uint16_t start_handle, end_handle, err_handle, type; - uint8_t *value; + u16_t start_handle, end_handle, err_handle, type; + u8_t *value; req = (void *)buf->data; @@ -656,8 +656,8 @@ static bool uuid_create(struct bt_uuid *uuid, struct net_buf *buf) return false; } -static uint8_t check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr, - uint8_t mask) +static u8_t check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr, + u8_t mask) { if ((mask & BT_GATT_PERM_READ) && (!(attr->perm & BT_GATT_PERM_READ_MASK) || !attr->read)) { @@ -693,7 +693,7 @@ static uint8_t check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr, return 0; } -static uint8_t err_to_att(int err) +static u8_t err_to_att(int err) { BT_DBG("%d", err); @@ -710,10 +710,10 @@ struct read_type_data { struct net_buf *buf; struct bt_att_read_type_rsp *rsp; struct bt_att_data *item; - uint8_t err; + u8_t err; }; -static uint8_t read_type_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t read_type_cb(const struct bt_gatt_attr *attr, void *user_data) { struct read_type_data *data = user_data; struct bt_att *att = data->att; @@ -779,8 +779,8 @@ static uint8_t read_type_cb(const struct bt_gatt_attr *attr, void *user_data) BT_GATT_ITER_CONTINUE : BT_GATT_ITER_STOP; } -static uint8_t att_read_type_rsp(struct bt_att *att, struct bt_uuid *uuid, - uint16_t start_handle, uint16_t end_handle) +static u8_t att_read_type_rsp(struct bt_att *att, struct bt_uuid *uuid, + u16_t start_handle, u16_t end_handle) { struct bt_conn *conn = att->chan.chan.conn; struct read_type_data data; @@ -816,11 +816,11 @@ static uint8_t att_read_type_rsp(struct bt_att *att, struct bt_uuid *uuid, return 0; } -static uint8_t att_read_type_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_read_type_req(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; struct bt_att_read_type_req *req; - uint16_t start_handle, end_handle, err_handle; + u16_t start_handle, end_handle, err_handle; union { struct bt_uuid uuid; struct bt_uuid_16 u16; @@ -856,13 +856,13 @@ static uint8_t att_read_type_req(struct bt_att *att, struct net_buf *buf) struct read_data { struct bt_att *att; - uint16_t offset; + u16_t offset; struct net_buf *buf; struct bt_att_read_rsp *rsp; - uint8_t err; + u8_t err; }; -static uint8_t read_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t read_cb(const struct bt_gatt_attr *attr, void *user_data) { struct read_data *data = user_data; struct bt_att *att = data->att; @@ -898,8 +898,8 @@ static uint8_t read_cb(const struct bt_gatt_attr *attr, void *user_data) return BT_GATT_ITER_CONTINUE; } -static uint8_t att_read_rsp(struct bt_att *att, uint8_t op, uint8_t rsp, - uint16_t handle, uint16_t offset) +static u8_t att_read_rsp(struct bt_att *att, u8_t op, u8_t rsp, + u16_t handle, u16_t offset) { struct bt_conn *conn = att->chan.chan.conn; struct read_data data; @@ -936,10 +936,10 @@ static uint8_t att_read_rsp(struct bt_att *att, uint8_t op, uint8_t rsp, return 0; } -static uint8_t att_read_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_read_req(struct bt_att *att, struct net_buf *buf) { struct bt_att_read_req *req; - uint16_t handle; + u16_t handle; req = (void *)buf->data; @@ -951,10 +951,10 @@ static uint8_t att_read_req(struct bt_att *att, struct net_buf *buf) handle, 0); } -static uint8_t att_read_blob_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_read_blob_req(struct bt_att *att, struct net_buf *buf) { struct bt_att_read_blob_req *req; - uint16_t handle, offset; + u16_t handle, offset; req = (void *)buf->data; @@ -967,11 +967,11 @@ static uint8_t att_read_blob_req(struct bt_att *att, struct net_buf *buf) BT_ATT_OP_READ_BLOB_RSP, handle, offset); } -static uint8_t att_read_mult_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_read_mult_req(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; struct read_data data; - uint16_t handle; + u16_t handle; memset(&data, 0, sizeof(data)); @@ -982,7 +982,7 @@ static uint8_t att_read_mult_req(struct bt_att *att, struct net_buf *buf) data.att = att; - while (buf->len >= sizeof(uint16_t)) { + while (buf->len >= sizeof(u16_t)) { handle = net_buf_pull_le16(buf); BT_DBG("handle 0x%04x ", handle); @@ -1021,7 +1021,7 @@ struct read_group_data { struct bt_att_group_data *group; }; -static uint8_t read_group_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t read_group_cb(const struct bt_gatt_attr *attr, void *user_data) { struct read_group_data *data = user_data; struct bt_att *att = data->att; @@ -1081,8 +1081,8 @@ static uint8_t read_group_cb(const struct bt_gatt_attr *attr, void *user_data) return BT_GATT_ITER_CONTINUE; } -static uint8_t att_read_group_rsp(struct bt_att *att, struct bt_uuid *uuid, - uint16_t start_handle, uint16_t end_handle) +static u8_t att_read_group_rsp(struct bt_att *att, struct bt_uuid *uuid, + u16_t start_handle, u16_t end_handle) { struct bt_conn *conn = att->chan.chan.conn; struct read_group_data data; @@ -1116,11 +1116,11 @@ static uint8_t att_read_group_rsp(struct bt_att *att, struct bt_uuid *uuid, return 0; } -static uint8_t att_read_group_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_read_group_req(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; struct bt_att_read_group_req *req; - uint16_t start_handle, end_handle, err_handle; + u16_t start_handle, end_handle, err_handle; union { struct bt_uuid uuid; struct bt_uuid_16 u16; @@ -1171,14 +1171,14 @@ static uint8_t att_read_group_req(struct bt_att *att, struct net_buf *buf) struct write_data { struct bt_conn *conn; struct net_buf *buf; - uint8_t op; + u8_t op; const void *value; - uint8_t len; - uint16_t offset; - uint8_t err; + u8_t len; + u16_t offset; + u8_t err; }; -static uint8_t write_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t write_cb(const struct bt_gatt_attr *attr, void *user_data) { struct write_data *data = user_data; int write; @@ -1204,9 +1204,9 @@ static uint8_t write_cb(const struct bt_gatt_attr *attr, void *user_data) return BT_GATT_ITER_CONTINUE; } -static uint8_t att_write_rsp(struct bt_conn *conn, uint8_t op, uint8_t rsp, - uint16_t handle, uint16_t offset, - const void *value, uint8_t len) +static u8_t att_write_rsp(struct bt_conn *conn, u8_t op, u8_t rsp, + u16_t handle, u16_t offset, + const void *value, u8_t len) { struct write_data data; @@ -1251,10 +1251,10 @@ static uint8_t att_write_rsp(struct bt_conn *conn, uint8_t op, uint8_t rsp, return 0; } -static uint8_t att_write_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_write_req(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; - uint16_t handle; + u16_t handle; handle = net_buf_pull_le16(buf); @@ -1269,12 +1269,12 @@ struct prep_data { struct bt_conn *conn; struct net_buf *buf; const void *value; - uint8_t len; - uint16_t offset; - uint8_t err; + u8_t len; + u16_t offset; + u8_t err; }; -static uint8_t prep_write_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t prep_write_cb(const struct bt_gatt_attr *attr, void *user_data) { struct prep_data *data = user_data; struct bt_attr_data *attr_data; @@ -1319,9 +1319,9 @@ static uint8_t prep_write_cb(const struct bt_gatt_attr *attr, void *user_data) return BT_GATT_ITER_CONTINUE; } -static uint8_t att_prep_write_rsp(struct bt_att *att, uint16_t handle, - uint16_t offset, const void *value, - uint8_t len) +static u8_t att_prep_write_rsp(struct bt_att *att, u16_t handle, + u16_t offset, const void *value, + u8_t len) { struct bt_conn *conn = att->chan.chan.conn; struct prep_data data; @@ -1371,13 +1371,13 @@ static uint8_t att_prep_write_rsp(struct bt_att *att, uint16_t handle, } #endif /* CONFIG_BLUETOOTH_ATT_PREPARE_COUNT */ -static uint8_t att_prepare_write_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_prepare_write_req(struct bt_att *att, struct net_buf *buf) { #if CONFIG_BLUETOOTH_ATT_PREPARE_COUNT == 0 return BT_ATT_ERR_NOT_SUPPORTED; #else struct bt_att_prepare_write_req *req; - uint16_t handle, offset; + u16_t handle, offset; req = (void *)buf->data; @@ -1392,11 +1392,11 @@ static uint8_t att_prepare_write_req(struct bt_att *att, struct net_buf *buf) } #if CONFIG_BLUETOOTH_ATT_PREPARE_COUNT > 0 -static uint8_t att_exec_write_rsp(struct bt_att *att, uint8_t flags) +static u8_t att_exec_write_rsp(struct bt_att *att, u8_t flags) { struct bt_conn *conn = att->chan.chan.conn; struct net_buf *buf; - uint8_t err = 0; + u8_t err = 0; while ((buf = net_buf_get(&att->prep_queue, K_NO_WAIT))) { struct bt_attr_data *data = net_buf_user_data(buf); @@ -1436,7 +1436,7 @@ static uint8_t att_exec_write_rsp(struct bt_att *att, uint8_t flags) #endif /* CONFIG_BLUETOOTH_ATT_PREPARE_COUNT */ -static uint8_t att_exec_write_req(struct bt_att *att, struct net_buf *buf) +static u8_t att_exec_write_req(struct bt_att *att, struct net_buf *buf) { #if CONFIG_BLUETOOTH_ATT_PREPARE_COUNT == 0 return BT_ATT_ERR_NOT_SUPPORTED; @@ -1451,10 +1451,10 @@ static uint8_t att_exec_write_req(struct bt_att *att, struct net_buf *buf) #endif /* CONFIG_BLUETOOTH_ATT_PREPARE_COUNT */ } -static uint8_t att_write_cmd(struct bt_att *att, struct net_buf *buf) +static u8_t att_write_cmd(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; - uint16_t handle; + u16_t handle; handle = net_buf_pull_le16(buf); @@ -1463,11 +1463,11 @@ static uint8_t att_write_cmd(struct bt_att *att, struct net_buf *buf) return att_write_rsp(conn, 0, 0, handle, 0, buf->data, buf->len); } -static uint8_t att_signed_write_cmd(struct bt_att *att, struct net_buf *buf) +static u8_t att_signed_write_cmd(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; struct bt_att_signed_write_cmd *req; - uint16_t handle; + u16_t handle; int err; req = (void *)buf->data; @@ -1493,7 +1493,7 @@ static uint8_t att_signed_write_cmd(struct bt_att *att, struct net_buf *buf) } #if defined(CONFIG_BLUETOOTH_SMP) -static int att_change_security(struct bt_conn *conn, uint8_t err) +static int att_change_security(struct bt_conn *conn, u8_t err) { bt_security_t sec; @@ -1554,10 +1554,10 @@ static int att_change_security(struct bt_conn *conn, uint8_t err) } #endif /* CONFIG_BLUETOOTH_SMP */ -static uint8_t att_error_rsp(struct bt_att *att, struct net_buf *buf) +static u8_t att_error_rsp(struct bt_att *att, struct net_buf *buf) { struct bt_att_error_rsp *rsp; - uint8_t err; + u8_t err; rsp = (void *)buf->data; @@ -1592,7 +1592,7 @@ done: return att_handle_rsp(att, NULL, 0, err); } -static uint8_t att_handle_find_info_rsp(struct bt_att *att, +static u8_t att_handle_find_info_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1600,7 +1600,7 @@ static uint8_t att_handle_find_info_rsp(struct bt_att *att, return att_handle_rsp(att, buf->data, buf->len, 0); } -static uint8_t att_handle_find_type_rsp(struct bt_att *att, +static u8_t att_handle_find_type_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1608,7 +1608,7 @@ static uint8_t att_handle_find_type_rsp(struct bt_att *att, return att_handle_rsp(att, buf->data, buf->len, 0); } -static uint8_t att_handle_read_type_rsp(struct bt_att *att, +static u8_t att_handle_read_type_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1616,7 +1616,7 @@ static uint8_t att_handle_read_type_rsp(struct bt_att *att, return att_handle_rsp(att, buf->data, buf->len, 0); } -static uint8_t att_handle_read_rsp(struct bt_att *att, +static u8_t att_handle_read_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1624,7 +1624,7 @@ static uint8_t att_handle_read_rsp(struct bt_att *att, return att_handle_rsp(att, buf->data, buf->len, 0); } -static uint8_t att_handle_read_blob_rsp(struct bt_att *att, +static u8_t att_handle_read_blob_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1632,7 +1632,7 @@ static uint8_t att_handle_read_blob_rsp(struct bt_att *att, return att_handle_rsp(att, buf->data, buf->len, 0); } -static uint8_t att_handle_read_mult_rsp(struct bt_att *att, +static u8_t att_handle_read_mult_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1640,7 +1640,7 @@ static uint8_t att_handle_read_mult_rsp(struct bt_att *att, return att_handle_rsp(att, buf->data, buf->len, 0); } -static uint8_t att_handle_write_rsp(struct bt_att *att, +static u8_t att_handle_write_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1648,7 +1648,7 @@ static uint8_t att_handle_write_rsp(struct bt_att *att, return att_handle_rsp(att, buf->data, buf->len, 0); } -static uint8_t att_handle_prepare_write_rsp(struct bt_att *att, +static u8_t att_handle_prepare_write_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1656,7 +1656,7 @@ static uint8_t att_handle_prepare_write_rsp(struct bt_att *att, return att_handle_rsp(att, buf->data, buf->len, 0); } -static uint8_t att_handle_exec_write_rsp(struct bt_att *att, +static u8_t att_handle_exec_write_rsp(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1664,10 +1664,10 @@ static uint8_t att_handle_exec_write_rsp(struct bt_att *att, return att_handle_rsp(att, buf->data, buf->len, 0); } -static uint8_t att_notify(struct bt_att *att, struct net_buf *buf) +static u8_t att_notify(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; - uint16_t handle; + u16_t handle; handle = net_buf_pull_le16(buf); @@ -1678,10 +1678,10 @@ static uint8_t att_notify(struct bt_att *att, struct net_buf *buf) return 0; } -static uint8_t att_indicate(struct bt_att *att, struct net_buf *buf) +static u8_t att_indicate(struct bt_att *att, struct net_buf *buf) { struct bt_conn *conn = att->chan.chan.conn; - uint16_t handle; + u16_t handle; handle = net_buf_pull_le16(buf); @@ -1699,7 +1699,7 @@ static uint8_t att_indicate(struct bt_att *att, struct net_buf *buf) return 0; } -static uint8_t att_confirm(struct bt_att *att, struct net_buf *buf) +static u8_t att_confirm(struct bt_att *att, struct net_buf *buf) { BT_DBG(""); @@ -1707,10 +1707,10 @@ static uint8_t att_confirm(struct bt_att *att, struct net_buf *buf) } static const struct att_handler { - uint8_t op; - uint8_t expect_len; + u8_t op; + u8_t expect_len; att_type_t type; - uint8_t (*func)(struct bt_att *att, struct net_buf *buf); + u8_t (*func)(struct bt_att *att, struct net_buf *buf); } handlers[] = { { BT_ATT_OP_ERROR_RSP, sizeof(struct bt_att_error_rsp), @@ -1823,7 +1823,7 @@ static const struct att_handler { att_signed_write_cmd }, }; -static att_type_t att_op_get_type(uint8_t op) +static att_type_t att_op_get_type(u8_t op) { const struct att_handler *handler; int i; @@ -1842,7 +1842,7 @@ static void bt_att_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) struct bt_att *att = ATT_CHAN(chan); struct bt_att_hdr *hdr = (void *)buf->data; const struct att_handler *handler; - uint8_t err; + u8_t err; size_t i; if (buf->len < sizeof(*hdr)) { @@ -1917,7 +1917,7 @@ static struct bt_att *att_chan_get(struct bt_conn *conn) return att; } -struct net_buf *bt_att_create_pdu(struct bt_conn *conn, uint8_t op, size_t len) +struct net_buf *bt_att_create_pdu(struct bt_conn *conn, u8_t op, size_t len) { struct bt_att_hdr *hdr; struct net_buf *buf; @@ -2039,7 +2039,7 @@ static void bt_att_disconnected(struct bt_l2cap_chan *chan) #if defined(CONFIG_BLUETOOTH_SMP) static void bt_att_encrypt_change(struct bt_l2cap_chan *chan, - uint8_t hci_status) + u8_t hci_status) { struct bt_att *att = ATT_CHAN(chan); struct bt_l2cap_le_chan *ch = BT_L2CAP_LE_CHAN(chan); @@ -2127,7 +2127,7 @@ void bt_att_init(void) bt_l2cap_le_fixed_chan_register(&chan); } -uint16_t bt_att_get_mtu(struct bt_conn *conn) +u16_t bt_att_get_mtu(struct bt_conn *conn) { struct bt_att *att; diff --git a/subsys/bluetooth/host/att_internal.h b/subsys/bluetooth/host/att_internal.h index 793aaa1aad2..7a8254762fb 100644 --- a/subsys/bluetooth/host/att_internal.h +++ b/subsys/bluetooth/host/att_internal.h @@ -15,31 +15,31 @@ #endif struct bt_att_hdr { - uint8_t code; + u8_t code; } __packed; #define BT_ATT_OP_ERROR_RSP 0x01 struct bt_att_error_rsp { - uint8_t request; - uint16_t handle; - uint8_t error; + u8_t request; + u16_t handle; + u8_t error; } __packed; #define BT_ATT_OP_MTU_REQ 0x02 struct bt_att_exchange_mtu_req { - uint16_t mtu; + u16_t mtu; } __packed; #define BT_ATT_OP_MTU_RSP 0x03 struct bt_att_exchange_mtu_rsp { - uint16_t mtu; + u16_t mtu; } __packed; /* Find Information Request */ #define BT_ATT_OP_FIND_INFO_REQ 0x04 struct bt_att_find_info_req { - uint16_t start_handle; - uint16_t end_handle; + u16_t start_handle; + u16_t end_handle; } __packed; /* Format field values for BT_ATT_OP_FIND_INFO_RSP */ @@ -47,34 +47,34 @@ struct bt_att_find_info_req { #define BT_ATT_INFO_128 0x02 struct bt_att_info_16 { - uint16_t handle; - uint16_t uuid; + u16_t handle; + u16_t uuid; } __packed; struct bt_att_info_128 { - uint16_t handle; - uint8_t uuid[16]; + u16_t handle; + u8_t uuid[16]; } __packed; /* Find Information Response */ #define BT_ATT_OP_FIND_INFO_RSP 0x05 struct bt_att_find_info_rsp { - uint8_t format; - uint8_t info[0]; + u8_t format; + u8_t info[0]; } __packed; /* Find By Type Value Request */ #define BT_ATT_OP_FIND_TYPE_REQ 0x06 struct bt_att_find_type_req { - uint16_t start_handle; - uint16_t end_handle; - uint16_t type; - uint8_t value[0]; + u16_t start_handle; + u16_t end_handle; + u16_t type; + u8_t value[0]; } __packed; struct bt_att_handle_group { - uint16_t start_handle; - uint16_t end_handle; + u16_t start_handle; + u16_t end_handle; } __packed; /* Find By Type Value Response */ @@ -86,46 +86,46 @@ struct bt_att_find_type_rsp { /* Read By Type Request */ #define BT_ATT_OP_READ_TYPE_REQ 0x08 struct bt_att_read_type_req { - uint16_t start_handle; - uint16_t end_handle; - uint8_t uuid[0]; + u16_t start_handle; + u16_t end_handle; + u8_t uuid[0]; } __packed; struct bt_att_data { - uint16_t handle; - uint8_t value[0]; + u16_t handle; + u8_t value[0]; } __packed; /* Read By Type Response */ #define BT_ATT_OP_READ_TYPE_RSP 0x09 struct bt_att_read_type_rsp { - uint8_t len; + u8_t len; struct bt_att_data data[0]; } __packed; /* Read Request */ #define BT_ATT_OP_READ_REQ 0x0a struct bt_att_read_req { - uint16_t handle; + u16_t handle; } __packed; /* Read Response */ #define BT_ATT_OP_READ_RSP 0x0b struct bt_att_read_rsp { - uint8_t value[0]; + u8_t value[0]; } __packed; /* Read Blob Request */ #define BT_ATT_OP_READ_BLOB_REQ 0x0c struct bt_att_read_blob_req { - uint16_t handle; - uint16_t offset; + u16_t handle; + u16_t offset; } __packed; /* Read Blob Response */ #define BT_ATT_OP_READ_BLOB_RSP 0x0d struct bt_att_read_blob_rsp { - uint8_t value[0]; + u8_t value[0]; } __packed; /* Read Multiple Request */ @@ -133,41 +133,41 @@ struct bt_att_read_blob_rsp { #define BT_ATT_OP_READ_MULT_REQ 0x0e struct bt_att_read_mult_req { - uint16_t handles[0]; + u16_t handles[0]; } __packed; /* Read Multiple Respose */ #define BT_ATT_OP_READ_MULT_RSP 0x0f struct bt_att_read_mult_rsp { - uint8_t value[0]; + u8_t value[0]; } __packed; /* Read by Group Type Request */ #define BT_ATT_OP_READ_GROUP_REQ 0x10 struct bt_att_read_group_req { - uint16_t start_handle; - uint16_t end_handle; - uint8_t uuid[0]; + u16_t start_handle; + u16_t end_handle; + u8_t uuid[0]; } __packed; struct bt_att_group_data { - uint16_t start_handle; - uint16_t end_handle; - uint8_t value[0]; + u16_t start_handle; + u16_t end_handle; + u8_t value[0]; } __packed; /* Read by Group Type Response */ #define BT_ATT_OP_READ_GROUP_RSP 0x11 struct bt_att_read_group_rsp { - uint8_t len; + u8_t len; struct bt_att_group_data data[0]; } __packed; /* Write Request */ #define BT_ATT_OP_WRITE_REQ 0x12 struct bt_att_write_req { - uint16_t handle; - uint8_t value[0]; + u16_t handle; + u8_t value[0]; } __packed; /* Write Response */ @@ -176,17 +176,17 @@ struct bt_att_write_req { /* Prepare Write Request */ #define BT_ATT_OP_PREPARE_WRITE_REQ 0x16 struct bt_att_prepare_write_req { - uint16_t handle; - uint16_t offset; - uint8_t value[0]; + u16_t handle; + u16_t offset; + u8_t value[0]; } __packed; /* Prepare Write Respond */ #define BT_ATT_OP_PREPARE_WRITE_RSP 0x17 struct bt_att_prepare_write_rsp { - uint16_t handle; - uint16_t offset; - uint8_t value[0]; + u16_t handle; + u16_t offset; + u8_t value[0]; } __packed; /* Execute Write Request */ @@ -195,7 +195,7 @@ struct bt_att_prepare_write_rsp { #define BT_ATT_OP_EXEC_WRITE_REQ 0x18 struct bt_att_exec_write_req { - uint8_t flags; + u8_t flags; } __packed; /* Execute Write Response */ @@ -204,41 +204,41 @@ struct bt_att_exec_write_req { /* Handle Value Notification */ #define BT_ATT_OP_NOTIFY 0x1b struct bt_att_notify { - uint16_t handle; - uint8_t value[0]; + u16_t handle; + u8_t value[0]; } __packed; /* Handle Value Indication */ #define BT_ATT_OP_INDICATE 0x1d struct bt_att_indicate { - uint16_t handle; - uint8_t value[0]; + u16_t handle; + u8_t value[0]; } __packed; /* Handle Value Confirm */ #define BT_ATT_OP_CONFIRM 0x1e struct bt_att_signature { - uint8_t value[12]; + u8_t value[12]; } __packed; /* Write Command */ #define BT_ATT_OP_WRITE_CMD 0x52 struct bt_att_write_cmd { - uint16_t handle; - uint8_t value[0]; + u16_t handle; + u8_t value[0]; } __packed; /* Signed Write Command */ #define BT_ATT_OP_SIGNED_WRITE_CMD 0xd2 struct bt_att_signed_write_cmd { - uint16_t handle; - uint8_t value[0]; + u16_t handle; + u8_t value[0]; } __packed; void bt_att_init(void); -uint16_t bt_att_get_mtu(struct bt_conn *conn); -struct net_buf *bt_att_create_pdu(struct bt_conn *conn, uint8_t op, +u16_t bt_att_get_mtu(struct bt_conn *conn); +struct net_buf *bt_att_create_pdu(struct bt_conn *conn, u8_t op, size_t len); /* Send ATT PDU over a connection */ diff --git a/subsys/bluetooth/host/avdtp.c b/subsys/bluetooth/host/avdtp.c index 6f389c77c9e..74bf00887cb 100644 --- a/subsys/bluetooth/host/avdtp.c +++ b/subsys/bluetooth/host/avdtp.c @@ -47,9 +47,9 @@ static struct bt_avdtp_seid_lsep *lseps; #define AVDTP_TIMEOUT K_SECONDS(6) static const struct { - uint8_t sig_id; + u8_t sig_id; void (*func)(struct bt_avdtp *session, struct net_buf *buf, - uint8_t msg_type); + u8_t msg_type); } handler[] = { }; @@ -78,12 +78,12 @@ static int avdtp_send(struct bt_avdtp *session, return result; } -static struct net_buf *avdtp_create_pdu(uint8_t msg_type, - uint8_t pkt_type, - uint8_t sig_id) +static struct net_buf *avdtp_create_pdu(u8_t msg_type, + u8_t pkt_type, + u8_t sig_id) { struct net_buf *buf; - static uint8_t tid; + static u8_t tid; struct bt_avdtp_single_sig_hdr *hdr; BT_DBG(""); @@ -136,7 +136,7 @@ void bt_avdtp_l2cap_disconnected(struct bt_l2cap_chan *chan) /* Clear the Pending req if set*/ } -void bt_avdtp_l2cap_encrypt_changed(struct bt_l2cap_chan *chan, uint8_t status) +void bt_avdtp_l2cap_encrypt_changed(struct bt_l2cap_chan *chan, u8_t status) { BT_DBG(""); } @@ -145,7 +145,7 @@ void bt_avdtp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) { struct bt_avdtp_single_sig_hdr *hdr = (void *)buf->data; struct bt_avdtp *session = AVDTP_CHAN(chan); - uint8_t i, msgtype, sigid, tid; + u8_t i, msgtype, sigid, tid; if (buf->len < sizeof(*hdr)) { BT_ERR("Recvd Wrong AVDTP Header"); @@ -256,12 +256,12 @@ int bt_avdtp_register(struct bt_avdtp_event_cb *cb) return 0; } -int bt_avdtp_register_sep(uint8_t media_type, uint8_t role, +int bt_avdtp_register_sep(u8_t media_type, u8_t role, struct bt_avdtp_seid_lsep *lsep) { BT_DBG(""); - static uint8_t bt_avdtp_seid = BT_AVDTP_MIN_SEID; + static u8_t bt_avdtp_seid = BT_AVDTP_MIN_SEID; if (!lsep) { return -EIO; diff --git a/subsys/bluetooth/host/avdtp_internal.h b/subsys/bluetooth/host/avdtp_internal.h index 92d424a8038..b382fab38c2 100644 --- a/subsys/bluetooth/host/avdtp_internal.h +++ b/subsys/bluetooth/host/avdtp_internal.h @@ -94,15 +94,15 @@ typedef int (*bt_avdtp_func_t)(struct bt_avdtp *session, struct bt_avdtp_req *req); struct bt_avdtp_req { - uint8_t sig; - uint8_t tid; + u8_t sig; + u8_t tid; bt_avdtp_func_t func; struct k_delayed_work timeout_work; }; struct bt_avdtp_single_sig_hdr { - uint8_t hdr; - uint8_t signal_id; + u8_t hdr; + u8_t signal_id; } __packed; #define BT_AVDTP_SIG_HDR_LEN sizeof(struct bt_avdtp_single_sig_hdr) @@ -120,20 +120,20 @@ struct bt_avdtp_ind_cb { }; struct bt_avdtp_cap { - uint8_t cat; - uint8_t len; - uint8_t data[0]; + u8_t cat; + u8_t len; + u8_t data[0]; }; struct bt_avdtp_sep { - uint8_t seid; - uint8_t len; + u8_t seid; + u8_t len; struct bt_avdtp_cap caps[0]; }; struct bt_avdtp_discover_params { struct bt_avdtp_req req; - uint8_t status; + u8_t status; struct bt_avdtp_sep *caps; }; @@ -162,7 +162,7 @@ int bt_avdtp_connect(struct bt_conn *conn, struct bt_avdtp *session); int bt_avdtp_disconnect(struct bt_avdtp *session); /* AVDTP SEP register function */ -int bt_avdtp_register_sep(uint8_t media_type, uint8_t role, +int bt_avdtp_register_sep(u8_t media_type, u8_t role, struct bt_avdtp_seid_lsep *sep); /* AVDTP Discover Request */ diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 1de434ade86..9aa766096cb 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -67,7 +67,7 @@ enum pairing_method { }; /* based on table 5.7, Core Spec 4.2, Vol.3 Part C, 5.2.2.6 */ -static const uint8_t ssp_method[4 /* remote */][4 /* local */] = { +static const u8_t ssp_method[4 /* remote */][4 /* local */] = { { JUST_WORKS, JUST_WORKS, PASSKEY_INPUT, JUST_WORKS }, { JUST_WORKS, PASSKEY_CONFIRM, PASSKEY_INPUT, JUST_WORKS }, { PASSKEY_DISPLAY, PASSKEY_DISPLAY, PASSKEY_INPUT, JUST_WORKS }, @@ -458,7 +458,7 @@ static int pin_code_neg_reply(const bt_addr_t *bdaddr) return bt_hci_cmd_send_sync(BT_HCI_OP_PIN_CODE_NEG_REPLY, buf, NULL); } -static int pin_code_reply(struct bt_conn *conn, const char *pin, uint8_t len) +static int pin_code_reply(struct bt_conn *conn, const char *pin, u8_t len) { struct bt_hci_cp_pin_code_reply *cp; struct net_buf *buf; @@ -531,7 +531,7 @@ void bt_conn_pin_code_req(struct bt_conn *conn) } } -uint8_t bt_conn_get_io_capa(void) +u8_t bt_conn_get_io_capa(void) { if (!bt_auth) { return BT_IO_NO_INPUT_OUTPUT; @@ -552,12 +552,12 @@ uint8_t bt_conn_get_io_capa(void) return BT_IO_NO_INPUT_OUTPUT; } -static uint8_t ssp_pair_method(const struct bt_conn *conn) +static u8_t ssp_pair_method(const struct bt_conn *conn) { return ssp_method[conn->br.remote_io_capa][bt_conn_get_io_capa()]; } -uint8_t bt_conn_ssp_get_auth(const struct bt_conn *conn) +u8_t bt_conn_ssp_get_auth(const struct bt_conn *conn) { /* Validate no bond auth request, and if valid use it. */ if ((conn->br.remote_auth == BT_HCI_NO_BONDING) || @@ -612,7 +612,7 @@ static int ssp_confirm_neg_reply(struct bt_conn *conn) NULL); } -void bt_conn_ssp_auth(struct bt_conn *conn, uint32_t passkey) +void bt_conn_ssp_auth(struct bt_conn *conn, u32_t passkey) { conn->br.pairing_method = ssp_pair_method(conn); @@ -767,8 +767,8 @@ void bt_conn_identity_resolved(struct bt_conn *conn) } } -int bt_conn_le_start_encryption(struct bt_conn *conn, uint64_t rand, - uint16_t ediv, const uint8_t *ltk, size_t len) +int bt_conn_le_start_encryption(struct bt_conn *conn, u64_t rand, + u16_t ediv, const u8_t *ltk, size_t len) { struct bt_hci_cp_le_start_encryption *cp; struct net_buf *buf; @@ -793,7 +793,7 @@ int bt_conn_le_start_encryption(struct bt_conn *conn, uint64_t rand, #endif /* CONFIG_BLUETOOTH_SMP */ #if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR) -uint8_t bt_conn_enc_key_size(struct bt_conn *conn) +u8_t bt_conn_enc_key_size(struct bt_conn *conn) { if (!conn->encrypt) { return 0; @@ -805,7 +805,7 @@ uint8_t bt_conn_enc_key_size(struct bt_conn *conn) struct bt_hci_rp_read_encryption_key_size *rp; struct net_buf *buf; struct net_buf *rsp; - uint8_t key_size; + u8_t key_size; buf = bt_hci_cmd_create(BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE, sizeof(*cp)); @@ -965,10 +965,10 @@ static void bt_conn_reset_rx_state(struct bt_conn *conn) conn->rx_len = 0; } -void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags) +void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, u8_t flags) { struct bt_l2cap_hdr *hdr; - uint16_t len; + u16_t len; BT_DBG("handle %u len %u flags %02x", conn->handle, buf->len, flags); @@ -1112,7 +1112,7 @@ static void add_pending_tx(struct bt_conn *conn, bt_conn_tx_cb_t cb) irq_unlock(key); } -static bool send_frag(struct bt_conn *conn, struct net_buf *buf, uint8_t flags, +static bool send_frag(struct bt_conn *conn, struct net_buf *buf, u8_t flags, bool always_consume) { struct bt_hci_acl_hdr *hdr; @@ -1157,7 +1157,7 @@ fail: return false; } -static inline uint16_t conn_mtu(struct bt_conn *conn) +static inline u16_t conn_mtu(struct bt_conn *conn) { #if defined(CONFIG_BLUETOOTH_BREDR) if (conn->type == BT_CONN_TYPE_BR || !bt_dev.le.mtu) { @@ -1171,7 +1171,7 @@ static inline uint16_t conn_mtu(struct bt_conn *conn) static struct net_buf *create_frag(struct bt_conn *conn, struct net_buf *buf) { struct net_buf *frag; - uint16_t frag_len; + u16_t frag_len; frag = bt_conn_create_pdu(NULL, 0); @@ -1472,7 +1472,7 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state) } } -struct bt_conn *bt_conn_lookup_handle(uint16_t handle) +struct bt_conn *bt_conn_lookup_handle(u16_t handle) { int i; @@ -1642,7 +1642,7 @@ int bt_conn_get_info(const struct bt_conn *conn, struct bt_conn_info *info) return -EINVAL; } -static int bt_hci_disconnect(struct bt_conn *conn, uint8_t reason) +static int bt_hci_disconnect(struct bt_conn *conn, u8_t reason) { struct net_buf *buf; struct bt_hci_cp_disconnect *disconn; @@ -1700,7 +1700,7 @@ int bt_conn_le_param_update(struct bt_conn *conn, return bt_l2cap_update_conn_param(conn, param); } -int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason) +int bt_conn_disconnect(struct bt_conn *conn, u8_t reason) { /* Disconnection is initiated by us, so auto connection shall * be disabled. Otherwise the passive scan would be enabled diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 07d98d5adac..de0c5accc1c 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -35,14 +35,14 @@ struct bt_conn_le { bt_addr_le_t init_addr; bt_addr_le_t resp_addr; - uint16_t interval; - uint16_t interval_min; - uint16_t interval_max; + u16_t interval; + u16_t interval_min; + u16_t interval_max; - uint16_t latency; - uint16_t timeout; + u16_t latency; + u16_t timeout; - uint8_t features[1][8]; + u8_t features[1][8]; struct bt_keys *keys; @@ -56,11 +56,11 @@ struct bt_conn_le { struct bt_conn_br { bt_addr_t dst; - uint8_t remote_io_capa; - uint8_t remote_auth; - uint8_t pairing_method; + u8_t remote_io_capa; + u8_t remote_auth; + u8_t pairing_method; /* remote LMP features pages per 8 bytes each */ - uint8_t features[LMP_MAX_PAGES][8]; + u8_t features[LMP_MAX_PAGES][8]; struct bt_keys_link_key *link_key; }; @@ -68,7 +68,7 @@ struct bt_conn_br { struct bt_conn_sco { /* Reference to ACL Connection */ struct bt_conn *acl; - uint16_t pkt_type; + u16_t pkt_type; }; #endif @@ -80,19 +80,19 @@ struct bt_conn_tx { }; struct bt_conn { - uint16_t handle; - uint8_t type; - uint8_t role; + u16_t handle; + u8_t type; + u8_t role; ATOMIC_DEFINE(flags, BT_CONN_NUM_FLAGS); #if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR) bt_security_t sec_level; bt_security_t required_sec_level; - uint8_t encrypt; + u8_t encrypt; #endif /* CONFIG_BLUETOOTH_SMP || CONFIG_BLUETOOTH_BREDR */ - uint16_t rx_len; + u16_t rx_len; struct net_buf *rx; /* Sent but not acknowledged TX packets */ @@ -109,7 +109,7 @@ struct bt_conn { atomic_t ref; /* Connection error or reason for disconnect */ - uint8_t err; + u8_t err; bt_conn_state_t state; @@ -123,7 +123,7 @@ struct bt_conn { }; /* Process incoming data for a connection */ -void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags); +void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, u8_t flags); /* Send data over a connection */ int bt_conn_send_cb(struct bt_conn *conn, struct net_buf *buf, @@ -153,14 +153,14 @@ struct bt_conn *bt_conn_lookup_addr_sco(const bt_addr_t *peer); struct bt_conn *bt_conn_lookup_addr_br(const bt_addr_t *peer); void bt_conn_pin_code_req(struct bt_conn *conn); -uint8_t bt_conn_get_io_capa(void); -uint8_t bt_conn_ssp_get_auth(const struct bt_conn *conn); -void bt_conn_ssp_auth(struct bt_conn *conn, uint32_t passkey); +u8_t bt_conn_get_io_capa(void); +u8_t bt_conn_ssp_get_auth(const struct bt_conn *conn); +void bt_conn_ssp_auth(struct bt_conn *conn, u32_t passkey); void bt_conn_disconnect_all(void); /* Look up an existing connection */ -struct bt_conn *bt_conn_lookup_handle(uint16_t handle); +struct bt_conn *bt_conn_lookup_handle(u16_t handle); /* Compare an address with bt_conn destination address */ int bt_conn_addr_le_cmp(const struct bt_conn *conn, const bt_addr_le_t *peer); @@ -183,8 +183,8 @@ bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param); #if defined(CONFIG_BLUETOOTH_SMP) /* rand and ediv should be in BT order */ -int bt_conn_le_start_encryption(struct bt_conn *conn, uint64_t rand, - uint16_t ediv, const uint8_t *ltk, size_t len); +int bt_conn_le_start_encryption(struct bt_conn *conn, u64_t rand, + u16_t ediv, const u8_t *ltk, size_t len); /* Notify higher layers that RPA was resolved */ void bt_conn_identity_resolved(struct bt_conn *conn); diff --git a/subsys/bluetooth/host/crypto.c b/subsys/bluetooth/host/crypto.c index a4686a74947..3f437bf3783 100644 --- a/subsys/bluetooth/host/crypto.c +++ b/subsys/bluetooth/host/crypto.c @@ -29,8 +29,8 @@ static struct tc_hmac_prng_struct prng; static int prng_reseed(struct tc_hmac_prng_struct *h) { - uint8_t seed[32]; - int64_t extra; + u8_t seed[32]; + s64_t extra; int ret, i; for (i = 0; i < (sizeof(seed) / 8); i++) { @@ -50,7 +50,7 @@ static int prng_reseed(struct tc_hmac_prng_struct *h) extra = k_uptime_get(); - ret = tc_hmac_prng_reseed(h, seed, sizeof(seed), (uint8_t *)&extra, + ret = tc_hmac_prng_reseed(h, seed, sizeof(seed), (u8_t *)&extra, sizeof(extra)); if (ret == TC_CRYPTO_FAIL) { BT_ERR("Failed to re-seed PRNG"); @@ -107,11 +107,11 @@ int bt_rand(void *buf, size_t len) return -EIO; } -int bt_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16], - uint8_t enc_data[16]) +int bt_encrypt_le(const u8_t key[16], const u8_t plaintext[16], + u8_t enc_data[16]) { struct tc_aes_key_sched_struct s; - uint8_t tmp[16]; + u8_t tmp[16]; BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16)); @@ -134,8 +134,8 @@ int bt_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16], return 0; } -int bt_encrypt_be(const uint8_t key[16], const uint8_t plaintext[16], - uint8_t enc_data[16]) +int bt_encrypt_be(const u8_t key[16], const u8_t plaintext[16], + u8_t enc_data[16]) { struct tc_aes_key_sched_struct s; diff --git a/subsys/bluetooth/host/ecc.h b/subsys/bluetooth/host/ecc.h index 418f0361b49..05538101537 100644 --- a/subsys/bluetooth/host/ecc.h +++ b/subsys/bluetooth/host/ecc.h @@ -16,7 +16,7 @@ struct bt_pub_key_cb { * * @param key The local public key, or NULL in case of no key. */ - void (*func)(const uint8_t key[64]); + void (*func)(const u8_t key[64]); struct bt_pub_key_cb *_next; }; @@ -40,7 +40,7 @@ int bt_pub_key_gen(struct bt_pub_key_cb *cb); * * @return Current key, or NULL if not available. */ -const uint8_t *bt_pub_key_get(void); +const u8_t *bt_pub_key_get(void); /* @typedef bt_dh_key_cb_t * @brief Callback type for DH Key calculation. @@ -49,7 +49,7 @@ const uint8_t *bt_pub_key_get(void); * * @param key The DH Key, or NULL in case of failure. */ -typedef void (*bt_dh_key_cb_t)(const uint8_t key[32]); +typedef void (*bt_dh_key_cb_t)(const u8_t key[32]); /* @brief Calculate a DH Key from a remote Public Key. * @@ -60,4 +60,4 @@ typedef void (*bt_dh_key_cb_t)(const uint8_t key[32]); * * @return Zero on success or negative error code otherwise */ -int bt_dh_key_gen(const uint8_t remote_pk[64], bt_dh_key_cb_t cb); +int bt_dh_key_gen(const u8_t remote_pk[64], bt_dh_key_cb_t cb); diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index e2ad88e3857..fc81c202d11 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -47,7 +47,7 @@ int bt_gatt_register(struct bt_gatt_attr *attrs, size_t count) sys_slist_t list; struct bt_gatt_attr *last; #endif /* CONFIG_BLUETOOTH_GATT_DYNAMIC_DB */ - uint16_t handle; + u16_t handle; __ASSERT(attrs, "invalid parameters\n"); __ASSERT(count, "invalid parameters\n"); @@ -102,10 +102,10 @@ populate: } ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr, - void *buf, uint16_t buf_len, uint16_t offset, - const void *value, uint16_t value_len) + void *buf, u16_t buf_len, u16_t offset, + const void *value, u16_t value_len) { - uint16_t len; + u16_t len; if (offset > value_len) { return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); @@ -123,12 +123,12 @@ ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr, ssize_t bt_gatt_attr_read_service(struct bt_conn *conn, const struct bt_gatt_attr *attr, - void *buf, uint16_t len, uint16_t offset) + void *buf, u16_t len, u16_t offset) { struct bt_uuid *uuid = attr->user_data; if (uuid->type == BT_UUID_TYPE_16) { - uint16_t uuid16 = sys_cpu_to_le16(BT_UUID_16(uuid)->val); + u16_t uuid16 = sys_cpu_to_le16(BT_UUID_16(uuid)->val); return bt_gatt_attr_read(conn, attr, buf, len, offset, &uuid16, 2); @@ -139,12 +139,12 @@ ssize_t bt_gatt_attr_read_service(struct bt_conn *conn, } struct gatt_incl { - uint16_t start_handle; - uint16_t end_handle; - uint16_t uuid16; + u16_t start_handle; + u16_t end_handle; + u16_t uuid16; } __packed; -static uint8_t get_service_handles(const struct bt_gatt_attr *attr, +static u8_t get_service_handles(const struct bt_gatt_attr *attr, void *user_data) { struct gatt_incl *include = user_data; @@ -162,12 +162,12 @@ static uint8_t get_service_handles(const struct bt_gatt_attr *attr, ssize_t bt_gatt_attr_read_included(struct bt_conn *conn, const struct bt_gatt_attr *attr, - void *buf, uint16_t len, uint16_t offset) + void *buf, u16_t len, u16_t offset) { struct bt_gatt_attr *incl = attr->user_data; struct bt_uuid *uuid = incl->user_data; struct gatt_incl pdu; - uint8_t value_len; + u8_t value_len; /* first attr points to the start handle */ pdu.start_handle = sys_cpu_to_le16(incl->handle); @@ -191,22 +191,22 @@ ssize_t bt_gatt_attr_read_included(struct bt_conn *conn, } struct gatt_chrc { - uint8_t properties; - uint16_t value_handle; + u8_t properties; + u16_t value_handle; union { - uint16_t uuid16; - uint8_t uuid[16]; + u16_t uuid16; + u8_t uuid[16]; }; } __packed; ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset) + u16_t len, u16_t offset) { struct bt_gatt_chrc *chrc = attr->user_data; struct gatt_chrc pdu; const struct bt_gatt_attr *next; - uint8_t value_len; + u8_t value_len; pdu.properties = chrc->properties; /* BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] page 534: @@ -236,7 +236,7 @@ ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn, return bt_gatt_attr_read(conn, attr, buf, len, offset, &pdu, value_len); } -void bt_gatt_foreach_attr(uint16_t start_handle, uint16_t end_handle, +void bt_gatt_foreach_attr(u16_t start_handle, u16_t end_handle, bt_gatt_attr_func_t func, void *user_data) { struct bt_gatt_attr *attr; @@ -270,10 +270,10 @@ struct bt_gatt_attr *bt_gatt_attr_next(const struct bt_gatt_attr *attr) ssize_t bt_gatt_attr_read_ccc(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset) + u16_t len, u16_t offset) { struct _bt_gatt_ccc *ccc = attr->user_data; - uint16_t value; + u16_t value; size_t i; for (i = 0; i < ccc->cfg_len; i++) { @@ -298,7 +298,7 @@ static void gatt_ccc_changed(const struct bt_gatt_attr *attr, struct _bt_gatt_ccc *ccc) { int i; - uint16_t value = 0x0000; + u16_t value = 0x0000; for (i = 0; i < ccc->cfg_len; i++) { if (ccc->cfg[i].value > value) { @@ -316,17 +316,17 @@ static void gatt_ccc_changed(const struct bt_gatt_attr *attr, ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, - uint16_t len, uint16_t offset, uint8_t flags) + u16_t len, u16_t offset, u8_t flags) { struct _bt_gatt_ccc *ccc = attr->user_data; - uint16_t value; + u16_t value; size_t i; - if (offset > sizeof(uint16_t)) { + if (offset > sizeof(u16_t)) { return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); } - if (offset + len > sizeof(uint16_t)) { + if (offset + len > sizeof(u16_t)) { return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); } @@ -378,10 +378,10 @@ ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn, ssize_t bt_gatt_attr_read_cep(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset) + u16_t len, u16_t offset) { struct bt_gatt_cep *value = attr->user_data; - uint16_t props = sys_cpu_to_le16(value->properties); + u16_t props = sys_cpu_to_le16(value->properties); return bt_gatt_attr_read(conn, attr, buf, len, offset, &props, sizeof(props)); @@ -389,7 +389,7 @@ ssize_t bt_gatt_attr_read_cep(struct bt_conn *conn, ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset) + u16_t len, u16_t offset) { char *value = attr->user_data; @@ -399,7 +399,7 @@ ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn, ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, - uint16_t len, uint16_t offset) + u16_t len, u16_t offset) { struct bt_gatt_cpf *value = attr->user_data; @@ -408,14 +408,14 @@ ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn, } struct notify_data { - uint16_t type; + u16_t type; const struct bt_gatt_attr *attr; const void *data; - uint16_t len; + u16_t len; struct bt_gatt_indicate_params *params; }; -static int gatt_notify(struct bt_conn *conn, uint16_t handle, const void *data, +static int gatt_notify(struct bt_conn *conn, u16_t handle, const void *data, size_t len) { struct net_buf *buf; @@ -440,8 +440,8 @@ static int gatt_notify(struct bt_conn *conn, uint16_t handle, const void *data, return 0; } -static void gatt_indicate_rsp(struct bt_conn *conn, uint8_t err, - const void *pdu, uint16_t length, void *user_data) +static void gatt_indicate_rsp(struct bt_conn *conn, u8_t err, + const void *pdu, u16_t length, void *user_data) { struct bt_gatt_indicate_params *params = user_data; @@ -498,7 +498,7 @@ static int gatt_indicate(struct bt_conn *conn, return gatt_send(conn, buf, gatt_indicate_rsp, params, NULL); } -static uint8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data) { struct notify_data *data = user_data; struct _bt_gatt_ccc *ccc; @@ -556,7 +556,7 @@ static uint8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data) } int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr, - const void *data, uint16_t len) + const void *data, u16_t len) { struct notify_data nfy; @@ -596,12 +596,12 @@ int bt_gatt_indicate(struct bt_conn *conn, return 0; } -uint16_t bt_gatt_get_mtu(struct bt_conn *conn) +u16_t bt_gatt_get_mtu(struct bt_conn *conn) { return bt_att_get_mtu(conn); } -static uint8_t connected_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t connected_cb(const struct bt_gatt_attr *attr, void *user_data) { struct bt_conn *conn = user_data; struct _bt_gatt_ccc *ccc; @@ -634,7 +634,7 @@ static uint8_t connected_cb(const struct bt_gatt_attr *attr, void *user_data) return BT_GATT_ITER_CONTINUE; } -static uint8_t disconnected_cb(const struct bt_gatt_attr *attr, void *user_data) +static u8_t disconnected_cb(const struct bt_gatt_attr *attr, void *user_data) { struct bt_conn *conn = user_data; struct _bt_gatt_ccc *ccc; @@ -697,8 +697,8 @@ static uint8_t disconnected_cb(const struct bt_gatt_attr *attr, void *user_data) } #if defined(CONFIG_BLUETOOTH_GATT_CLIENT) -void bt_gatt_notification(struct bt_conn *conn, uint16_t handle, - const void *data, uint16_t length) +void bt_gatt_notification(struct bt_conn *conn, u16_t handle, + const void *data, u16_t length) { struct bt_gatt_subscribe_params *params, *tmp; @@ -761,8 +761,8 @@ static void remove_subscriptions(struct bt_conn *conn) } } -static void gatt_mtu_rsp(struct bt_conn *conn, uint8_t err, const void *pdu, - uint16_t length, void *user_data) +static void gatt_mtu_rsp(struct bt_conn *conn, u8_t err, const void *pdu, + u16_t length, void *user_data) { struct bt_gatt_exchange_params *params = user_data; @@ -774,7 +774,7 @@ int bt_gatt_exchange_mtu(struct bt_conn *conn, { struct bt_att_exchange_mtu_req *req; struct net_buf *buf; - uint16_t mtu; + u16_t mtu; __ASSERT(conn, "invalid parameter\n"); __ASSERT(params && params->func, "invalid parameters\n"); @@ -798,7 +798,7 @@ int bt_gatt_exchange_mtu(struct bt_conn *conn, return gatt_send(conn, buf, gatt_mtu_rsp, params, NULL); } -static void gatt_discover_next(struct bt_conn *conn, uint16_t last_handle, +static void gatt_discover_next(struct bt_conn *conn, u16_t last_handle, struct bt_gatt_discover_params *params) { /* Skip if last_handle is not set */ @@ -826,14 +826,14 @@ done: params->func(conn, NULL, params); } -static void gatt_find_type_rsp(struct bt_conn *conn, uint8_t err, - const void *pdu, uint16_t length, +static void gatt_find_type_rsp(struct bt_conn *conn, u8_t err, + const void *pdu, u16_t length, void *user_data) { const struct bt_att_find_type_rsp *rsp = pdu; struct bt_gatt_discover_params *params = user_data; - uint8_t i; - uint16_t end_handle = 0, start_handle; + u8_t i; + u16_t end_handle = 0, start_handle; BT_DBG("err 0x%02x", err); @@ -923,8 +923,8 @@ static int gatt_find_type(struct bt_conn *conn, return gatt_send(conn, buf, gatt_find_type_rsp, params, NULL); } -static void read_included_uuid_cb(struct bt_conn *conn, uint8_t err, - const void *pdu, uint16_t length, +static void read_included_uuid_cb(struct bt_conn *conn, u8_t err, + const void *pdu, u16_t length, void *user_data) { struct bt_gatt_discover_params *params = user_data; @@ -989,12 +989,12 @@ static int read_included_uuid(struct bt_conn *conn, return gatt_send(conn, buf, read_included_uuid_cb, params, NULL); } -static uint16_t parse_include(struct bt_conn *conn, const void *pdu, +static u16_t parse_include(struct bt_conn *conn, const void *pdu, struct bt_gatt_discover_params *params, - uint16_t length) + u16_t length) { const struct bt_att_read_type_rsp *rsp = pdu; - uint16_t handle = 0; + u16_t handle = 0; struct bt_gatt_include value; union { struct bt_uuid uuid; @@ -1081,12 +1081,12 @@ done: return 0; } -static uint16_t parse_characteristic(struct bt_conn *conn, const void *pdu, +static u16_t parse_characteristic(struct bt_conn *conn, const void *pdu, struct bt_gatt_discover_params *params, - uint16_t length) + u16_t length) { const struct bt_att_read_type_rsp *rsp = pdu; - uint16_t handle = 0; + u16_t handle = 0; union { struct bt_uuid uuid; struct bt_uuid_16 u16; @@ -1155,12 +1155,12 @@ done: return 0; } -static void gatt_read_type_rsp(struct bt_conn *conn, uint8_t err, - const void *pdu, uint16_t length, +static void gatt_read_type_rsp(struct bt_conn *conn, u8_t err, + const void *pdu, u16_t length, void *user_data) { struct bt_gatt_discover_params *params = user_data; - uint16_t handle; + u16_t handle; BT_DBG("err 0x%02x", err); @@ -1209,14 +1209,14 @@ static int gatt_read_type(struct bt_conn *conn, return gatt_send(conn, buf, gatt_read_type_rsp, params, NULL); } -static void gatt_find_info_rsp(struct bt_conn *conn, uint8_t err, - const void *pdu, uint16_t length, +static void gatt_find_info_rsp(struct bt_conn *conn, u8_t err, + const void *pdu, u16_t length, void *user_data) { const struct bt_att_find_info_rsp *rsp = pdu; struct bt_gatt_discover_params *params = user_data; - uint16_t handle = 0; - uint8_t len; + u16_t handle = 0; + u8_t len; union { const struct bt_att_info_16 *i16; const struct bt_att_info_128 *i128; @@ -1345,8 +1345,8 @@ int bt_gatt_discover(struct bt_conn *conn, return -EINVAL; } -static void gatt_read_rsp(struct bt_conn *conn, uint8_t err, const void *pdu, - uint16_t length, void *user_data) +static void gatt_read_rsp(struct bt_conn *conn, u8_t err, const void *pdu, + u16_t length, void *user_data) { struct bt_gatt_read_params *params = user_data; @@ -1401,8 +1401,8 @@ static int gatt_read_blob(struct bt_conn *conn, return gatt_send(conn, buf, gatt_read_rsp, params, NULL); } -static void gatt_read_multiple_rsp(struct bt_conn *conn, uint8_t err, - const void *pdu, uint16_t length, +static void gatt_read_multiple_rsp(struct bt_conn *conn, u8_t err, + const void *pdu, u16_t length, void *user_data) { struct bt_gatt_read_params *params = user_data; @@ -1424,10 +1424,10 @@ static int gatt_read_multiple(struct bt_conn *conn, struct bt_gatt_read_params *params) { struct net_buf *buf; - uint8_t i; + u8_t i; buf = bt_att_create_pdu(conn, BT_ATT_OP_READ_MULT_REQ, - params->handle_count * sizeof(uint16_t)); + params->handle_count * sizeof(u16_t)); if (!buf) { return -ENOMEM; } @@ -1473,8 +1473,8 @@ int bt_gatt_read(struct bt_conn *conn, struct bt_gatt_read_params *params) return gatt_send(conn, buf, gatt_read_rsp, params, NULL); } -static void gatt_write_rsp(struct bt_conn *conn, uint8_t err, const void *pdu, - uint16_t length, void *user_data) +static void gatt_write_rsp(struct bt_conn *conn, u8_t err, const void *pdu, + u16_t length, void *user_data) { struct bt_gatt_write_params *params = user_data; @@ -1483,8 +1483,8 @@ static void gatt_write_rsp(struct bt_conn *conn, uint8_t err, const void *pdu, params->func(conn, err, params); } -int bt_gatt_write_without_response(struct bt_conn *conn, uint16_t handle, - const void *data, uint16_t length, bool sign) +int bt_gatt_write_without_response(struct bt_conn *conn, u16_t handle, + const void *data, u16_t length, bool sign) { struct net_buf *buf; struct bt_att_write_cmd *cmd; @@ -1543,8 +1543,8 @@ static int gatt_exec_write(struct bt_conn *conn, return gatt_send(conn, buf, gatt_write_rsp, params, NULL); } -static void gatt_prepare_write_rsp(struct bt_conn *conn, uint8_t err, - const void *pdu, uint16_t length, +static void gatt_prepare_write_rsp(struct bt_conn *conn, u8_t err, + const void *pdu, u16_t length, void *user_data) { struct bt_gatt_write_params *params = user_data; @@ -1573,7 +1573,7 @@ static int gatt_prepare_write(struct bt_conn *conn, { struct net_buf *buf; struct bt_att_prepare_write_req *req; - uint16_t len; + u16_t len; len = min(params->length, bt_att_get_mtu(conn) - sizeof(*req) - 1); @@ -1644,8 +1644,8 @@ static void gatt_subscription_add(struct bt_conn *conn, sys_slist_prepend(&subscriptions, ¶ms->node); } -static void gatt_write_ccc_rsp(struct bt_conn *conn, uint8_t err, - const void *pdu, uint16_t length, +static void gatt_write_ccc_rsp(struct bt_conn *conn, u8_t err, + const void *pdu, u16_t length, void *user_data) { struct bt_gatt_subscribe_params *params = user_data; @@ -1667,7 +1667,7 @@ static void gatt_write_ccc_rsp(struct bt_conn *conn, uint8_t err, } } -static int gatt_write_ccc(struct bt_conn *conn, uint16_t handle, uint16_t value, +static int gatt_write_ccc(struct bt_conn *conn, u16_t handle, u16_t value, bt_att_func_t func, struct bt_gatt_subscribe_params *params) { @@ -1675,7 +1675,7 @@ static int gatt_write_ccc(struct bt_conn *conn, uint16_t handle, uint16_t value, struct bt_att_write_req *req; buf = bt_att_create_pdu(conn, BT_ATT_OP_WRITE_REQ, - sizeof(*req) + sizeof(uint16_t)); + sizeof(*req) + sizeof(u16_t)); if (!buf) { return -ENOMEM; } diff --git a/subsys/bluetooth/host/gatt_internal.h b/subsys/bluetooth/host/gatt_internal.h index 9f97fca7e3d..14842fdc016 100644 --- a/subsys/bluetooth/host/gatt_internal.h +++ b/subsys/bluetooth/host/gatt_internal.h @@ -12,11 +12,11 @@ void bt_gatt_connected(struct bt_conn *conn); void bt_gatt_disconnected(struct bt_conn *conn); #if defined(CONFIG_BLUETOOTH_GATT_CLIENT) -void bt_gatt_notification(struct bt_conn *conn, uint16_t handle, - const void *data, uint16_t length); +void bt_gatt_notification(struct bt_conn *conn, u16_t handle, + const void *data, u16_t length); #else -static inline void bt_gatt_notification(struct bt_conn *conn, uint16_t handle, - const void *data, uint16_t length) +static inline void bt_gatt_notification(struct bt_conn *conn, u16_t handle, + const void *data, u16_t length) { } #endif /* CONFIG_BLUETOOTH_GATT_CLIENT */ diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 25b7d194e46..3a414bdaeeb 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -78,7 +78,7 @@ const struct bt_storage *bt_storage; static bt_le_scan_cb_t *scan_dev_found_cb; -static uint8_t pub_key[64]; +static u8_t pub_key[64]; static struct bt_pub_key_cb *pub_key_cb; static bt_dh_key_cb_t dh_key_cb; @@ -91,13 +91,13 @@ static size_t discovery_results_count; struct cmd_data { /** BT_BUF_CMD */ - uint8_t type; + u8_t type; /** HCI status of the command completion */ - uint8_t status; + u8_t status; /** The command OpCode that the buffer contains */ - uint16_t opcode; + u16_t opcode; /** Used by bt_hci_cmd_send_sync. */ struct k_sem *sync; @@ -105,10 +105,10 @@ struct cmd_data { struct acl_data { /** BT_BUF_ACL_IN */ - uint8_t type; + u8_t type; /** ACL connection handle */ - uint16_t handle; + u16_t handle; }; #define cmd(buf) ((struct cmd_data *)net_buf_user_data(buf)) @@ -128,7 +128,7 @@ NET_BUF_POOL_DEFINE(hci_rx_pool, CONFIG_BLUETOOTH_RX_BUF_COUNT, const char *bt_addr_str(const bt_addr_t *addr) { static char bufs[2][18]; - static uint8_t cur; + static u8_t cur; char *str; str = bufs[cur++]; @@ -141,7 +141,7 @@ const char *bt_addr_str(const bt_addr_t *addr) const char *bt_addr_le_str(const bt_addr_le_t *addr) { static char bufs[2][27]; - static uint8_t cur; + static u8_t cur; char *str; str = bufs[cur++]; @@ -152,7 +152,7 @@ const char *bt_addr_le_str(const bt_addr_le_t *addr) } #endif /* CONFIG_BLUETOOTH_DEBUG */ -struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) +struct net_buf *bt_hci_cmd_create(u16_t opcode, u8_t param_len) { struct bt_hci_cmd_hdr *hdr; struct net_buf *buf; @@ -177,7 +177,7 @@ struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len) return buf; } -int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf) +int bt_hci_cmd_send(u16_t opcode, struct net_buf *buf) { if (!buf) { buf = bt_hci_cmd_create(opcode, 0); @@ -208,7 +208,7 @@ int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf) return 0; } -int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf, +int bt_hci_cmd_send_sync(u16_t opcode, struct net_buf *buf, struct net_buf **rsp) { struct k_sem sync_sem; @@ -435,9 +435,9 @@ static int le_set_private_addr(void) static void hci_acl(struct net_buf *buf) { struct bt_hci_acl_hdr *hdr = (void *)buf->data; - uint16_t handle, len = sys_le16_to_cpu(hdr->len); + u16_t handle, len = sys_le16_to_cpu(hdr->len); struct bt_conn *conn; - uint8_t flags; + u8_t flags; BT_DBG("buf %p", buf); @@ -470,12 +470,12 @@ static void hci_acl(struct net_buf *buf) static void hci_num_completed_packets(struct net_buf *buf) { struct bt_hci_evt_num_completed_packets *evt = (void *)buf->data; - uint16_t i, num_handles = sys_le16_to_cpu(evt->num_handles); + u16_t i, num_handles = sys_le16_to_cpu(evt->num_handles); BT_DBG("num_handles %u", num_handles); for (i = 0; i < num_handles; i++) { - uint16_t handle, count; + u16_t handle, count; struct bt_conn *conn; unsigned int key; @@ -545,7 +545,7 @@ static int hci_le_create_conn(const struct bt_conn *conn) static void hci_disconn_complete(struct net_buf *buf) { struct bt_hci_evt_disconn_complete *evt = (void *)buf->data; - uint16_t handle = sys_le16_to_cpu(evt->handle); + u16_t handle = sys_le16_to_cpu(evt->handle); struct bt_conn *conn; BT_DBG("status %u handle %u reason %u", evt->status, handle, @@ -643,7 +643,7 @@ static void update_conn_param(struct bt_conn *conn) static void le_conn_complete(struct net_buf *buf) { struct bt_hci_evt_le_conn_complete *evt = (void *)buf->data; - uint16_t handle = sys_le16_to_cpu(evt->handle); + u16_t handle = sys_le16_to_cpu(evt->handle); const bt_addr_le_t *id_addr; struct bt_conn *conn; int err; @@ -775,7 +775,7 @@ done: static void le_remote_feat_complete(struct net_buf *buf) { struct bt_hci_ev_le_remote_feat_complete *evt = (void *)buf->data; - uint16_t handle = sys_le16_to_cpu(evt->handle); + u16_t handle = sys_le16_to_cpu(evt->handle); struct bt_conn *conn; conn = bt_conn_lookup_handle(handle); @@ -816,7 +816,7 @@ bool bt_le_conn_params_valid(const struct bt_le_conn_param *param) return true; } -static int le_conn_param_neg_reply(uint16_t handle, uint8_t reason) +static int le_conn_param_neg_reply(u16_t handle, u8_t reason) { struct bt_hci_cp_le_conn_param_req_neg_reply *cp; struct net_buf *buf; @@ -834,7 +834,7 @@ static int le_conn_param_neg_reply(uint16_t handle, uint8_t reason) return bt_hci_cmd_send(BT_HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY, buf); } -static int le_conn_param_req_reply(uint16_t handle, +static int le_conn_param_req_reply(u16_t handle, const struct bt_le_conn_param *param) { struct bt_hci_cp_le_conn_param_req_reply *cp; @@ -862,7 +862,7 @@ static int le_conn_param_req(struct net_buf *buf) struct bt_hci_evt_le_conn_param_req *evt = (void *)buf->data; struct bt_le_conn_param param; struct bt_conn *conn; - uint16_t handle; + u16_t handle; int err; handle = sys_le16_to_cpu(evt->handle); @@ -893,7 +893,7 @@ static void le_conn_update_complete(struct net_buf *buf) { struct bt_hci_evt_le_conn_update_complete *evt = (void *)buf->data; struct bt_conn *conn; - uint16_t handle; + u16_t handle; handle = sys_le16_to_cpu(evt->handle); @@ -916,7 +916,7 @@ static void le_conn_update_complete(struct net_buf *buf) } static void check_pending_conn(const bt_addr_le_t *id_addr, - const bt_addr_le_t *addr, uint8_t evtype) + const bt_addr_le_t *addr, u8_t evtype) { struct bt_conn *conn; @@ -986,7 +986,7 @@ static void reset_pairing(struct bt_conn *conn) conn->required_sec_level = conn->sec_level; } -static int reject_conn(const bt_addr_t *bdaddr, uint8_t reason) +static int reject_conn(const bt_addr_t *bdaddr, u8_t reason) { struct bt_hci_cp_reject_conn_req *cp; struct net_buf *buf; @@ -1141,7 +1141,7 @@ static void synchronous_conn_complete(struct net_buf *buf) { struct bt_hci_evt_sync_conn_complete *evt = (void *)buf->data; struct bt_conn *sco_conn; - uint16_t handle = sys_le16_to_cpu(evt->handle); + u16_t handle = sys_le16_to_cpu(evt->handle); BT_DBG("status 0x%02x, handle %u, type 0x%02x", evt->status, handle, evt->link_type); @@ -1169,7 +1169,7 @@ static void conn_complete(struct net_buf *buf) struct bt_hci_evt_conn_complete *evt = (void *)buf->data; struct bt_conn *conn; struct bt_hci_cp_read_remote_features *cp; - uint16_t handle = sys_le16_to_cpu(evt->handle); + u16_t handle = sys_le16_to_cpu(evt->handle); BT_DBG("status 0x%02x, handle %u, type 0x%02x", evt->status, handle, evt->link_type); @@ -1313,7 +1313,7 @@ static void link_key_neg_reply(const bt_addr_t *bdaddr) bt_hci_cmd_send_sync(BT_HCI_OP_LINK_KEY_NEG_REPLY, buf, NULL); } -static void link_key_reply(const bt_addr_t *bdaddr, const uint8_t *lk) +static void link_key_reply(const bt_addr_t *bdaddr, const u8_t *lk) { struct bt_hci_cp_link_key_reply *cp; struct net_buf *buf; @@ -1372,7 +1372,7 @@ static void link_key_req(struct net_buf *buf) bt_conn_unref(conn); } -static void io_capa_neg_reply(const bt_addr_t *bdaddr, const uint8_t reason) +static void io_capa_neg_reply(const bt_addr_t *bdaddr, const u8_t reason) { struct bt_hci_cp_io_capability_neg_reply *cp; struct net_buf *resp_buf; @@ -1430,7 +1430,7 @@ static void io_capa_req(struct net_buf *buf) struct net_buf *resp_buf; struct bt_conn *conn; struct bt_hci_cp_io_capability_reply *cp; - uint8_t auth; + u8_t auth; BT_DBG(""); @@ -1541,12 +1541,12 @@ static void user_passkey_req(struct net_buf *buf) } struct discovery_priv { - uint16_t clock_offset; - uint8_t pscan_rep_mode; - uint8_t resolving; + u16_t clock_offset; + u8_t pscan_rep_mode; + u8_t resolving; } __packed; -static int request_name(const bt_addr_t *addr, uint8_t pscan, uint16_t offset) +static int request_name(const bt_addr_t *addr, u8_t pscan, u16_t offset) { struct bt_hci_cp_remote_name_request *cp; struct net_buf *buf; @@ -1569,7 +1569,7 @@ static int request_name(const bt_addr_t *addr, uint8_t pscan, uint16_t offset) #define EIR_SHORT_NAME 0x08 #define EIR_COMPLETE_NAME 0x09 -static bool eir_has_name(const uint8_t *eir) +static bool eir_has_name(const u8_t *eir) { int len = 240; @@ -1656,7 +1656,7 @@ static void inquiry_complete(struct net_buf *buf) } static struct bt_br_discovery_result *get_result_slot(const bt_addr_t *addr, - int8_t rssi) + s8_t rssi) { struct bt_br_discovery_result *result = NULL; size_t i; @@ -1707,7 +1707,7 @@ static struct bt_br_discovery_result *get_result_slot(const bt_addr_t *addr, static void inquiry_result_with_rssi(struct net_buf *buf) { struct bt_hci_evt_inquiry_result_with_rssi *evt; - uint8_t num_reports = net_buf_pull_u8(buf); + u8_t num_reports = net_buf_pull_u8(buf); if (!atomic_test_bit(bt_dev.flags, BT_DEV_INQUIRY)) { return; @@ -1777,7 +1777,7 @@ static void remote_name_request_complete(struct net_buf *buf) struct bt_br_discovery_result *result; struct discovery_priv *priv; int eir_len = 240; - uint8_t *eir; + u8_t *eir; int i; result = get_result_slot(&evt->bdaddr, 0xff); @@ -1854,7 +1854,7 @@ check_names: discovery_results_count = 0; } -static void link_encr(const uint16_t handle) +static void link_encr(const u16_t handle) { struct bt_hci_cp_set_conn_encrypt *encr; struct net_buf *buf; @@ -1878,7 +1878,7 @@ static void auth_complete(struct net_buf *buf) { struct bt_hci_evt_auth_complete *evt = (void *)buf->data; struct bt_conn *conn; - uint16_t handle = sys_le16_to_cpu(evt->handle); + u16_t handle = sys_le16_to_cpu(evt->handle); BT_DBG("status %u, handle %u", evt->status, handle); @@ -1907,7 +1907,7 @@ static void auth_complete(struct net_buf *buf) static void read_remote_features_complete(struct net_buf *buf) { struct bt_hci_evt_remote_features *evt = (void *)buf->data; - uint16_t handle = sys_le16_to_cpu(evt->handle); + u16_t handle = sys_le16_to_cpu(evt->handle); struct bt_hci_cp_read_remote_ext_features *cp; struct bt_conn *conn; @@ -1949,7 +1949,7 @@ done: static void read_remote_ext_features_complete(struct net_buf *buf) { struct bt_hci_evt_remote_ext_features *evt = (void *)buf->data; - uint16_t handle = sys_le16_to_cpu(evt->handle); + u16_t handle = sys_le16_to_cpu(evt->handle); struct bt_conn *conn; BT_DBG("status %u handle %u", evt->status, handle); @@ -2026,7 +2026,7 @@ static void update_sec_level(struct bt_conn *conn) static void hci_encrypt_change(struct net_buf *buf) { struct bt_hci_evt_encrypt_change *evt = (void *)buf->data; - uint16_t handle = sys_le16_to_cpu(evt->handle); + u16_t handle = sys_le16_to_cpu(evt->handle); struct bt_conn *conn; BT_DBG("status %u handle %u encrypt 0x%02x", evt->status, handle, @@ -2100,7 +2100,7 @@ static void hci_encrypt_key_refresh_complete(struct net_buf *buf) { struct bt_hci_evt_encrypt_key_refresh_complete *evt = (void *)buf->data; struct bt_conn *conn; - uint16_t handle; + u16_t handle; handle = sys_le16_to_cpu(evt->handle); @@ -2147,8 +2147,8 @@ static void le_ltk_request(struct net_buf *buf) struct bt_hci_evt_le_ltk_request *evt = (void *)buf->data; struct bt_hci_cp_le_ltk_req_neg_reply *cp; struct bt_conn *conn; - uint16_t handle; - uint8_t tk[16]; + u16_t handle; + u8_t tk[16]; handle = sys_le16_to_cpu(evt->handle); @@ -2297,7 +2297,7 @@ static void le_dhkey_complete(struct net_buf *buf) static void hci_reset_complete(struct net_buf *buf) { - uint8_t status = buf->data[0]; + u8_t status = buf->data[0]; BT_DBG("status %u", status); @@ -2317,7 +2317,7 @@ static void hci_reset_complete(struct net_buf *buf) atomic_set(bt_dev.flags, BIT(BT_DEV_ENABLE)); } -static void hci_cmd_done(uint16_t opcode, uint8_t status, struct net_buf *buf) +static void hci_cmd_done(u16_t opcode, u8_t status, struct net_buf *buf) { BT_DBG("opcode 0x%04x status 0x%02x buf %p", opcode, status, buf); @@ -2340,8 +2340,8 @@ static void hci_cmd_done(uint16_t opcode, uint8_t status, struct net_buf *buf) static void hci_cmd_complete(struct net_buf *buf) { struct bt_hci_evt_cmd_complete *evt = (void *)buf->data; - uint16_t opcode = sys_le16_to_cpu(evt->opcode); - uint8_t status, ncmd = evt->ncmd; + u16_t opcode = sys_le16_to_cpu(evt->opcode); + u8_t status, ncmd = evt->ncmd; BT_DBG("opcode 0x%04x", opcode); @@ -2363,8 +2363,8 @@ static void hci_cmd_complete(struct net_buf *buf) static void hci_cmd_status(struct net_buf *buf) { struct bt_hci_evt_cmd_status *evt = (void *)buf->data; - uint16_t opcode = sys_le16_to_cpu(evt->opcode); - uint8_t ncmd = evt->ncmd; + u16_t opcode = sys_le16_to_cpu(evt->opcode); + u8_t ncmd = evt->ncmd; BT_DBG("opcode 0x%04x", opcode); @@ -2378,8 +2378,8 @@ static void hci_cmd_status(struct net_buf *buf) } } -static int start_le_scan(uint8_t scan_type, uint16_t interval, uint16_t window, - uint8_t filter_dup) +static int start_le_scan(u8_t scan_type, u16_t interval, u16_t window, + u8_t filter_dup) { struct net_buf *buf, *rsp; struct bt_hci_cp_le_set_scan_param *set_param; @@ -2474,7 +2474,7 @@ int bt_le_scan_update(bool fast_scan) } if (IS_ENABLED(CONFIG_BLUETOOTH_CENTRAL)) { - uint16_t interval, window; + u16_t interval, window; struct bt_conn *conn; conn = bt_conn_lookup_state_le(NULL, BT_CONN_CONNECT_SCAN); @@ -2501,14 +2501,14 @@ int bt_le_scan_update(bool fast_scan) static void le_adv_report(struct net_buf *buf) { - uint8_t num_reports = net_buf_pull_u8(buf); + u8_t num_reports = net_buf_pull_u8(buf); struct bt_hci_ev_le_advertising_info *info; BT_DBG("Adv number of reports %u", num_reports); while (num_reports--) { const bt_addr_le_t *addr; - int8_t rssi; + s8_t rssi; info = (void *)buf->data; net_buf_pull(buf, sizeof(*info)); @@ -2840,7 +2840,7 @@ static void read_le_features_complete(struct net_buf *buf) static void read_buffer_size_complete(struct net_buf *buf) { struct bt_hci_rp_read_buffer_size *rp = (void *)buf->data; - uint16_t pkts; + u16_t pkts; BT_DBG("status %u", rp->status); @@ -2855,7 +2855,7 @@ static void read_buffer_size_complete(struct net_buf *buf) static void read_buffer_size_complete(struct net_buf *buf) { struct bt_hci_rp_read_buffer_size *rp = (void *)buf->data; - uint16_t pkts; + u16_t pkts; BT_DBG("status %u", rp->status); @@ -2879,7 +2879,7 @@ static void read_buffer_size_complete(struct net_buf *buf) static void le_read_buffer_size_complete(struct net_buf *buf) { struct bt_hci_rp_le_read_buffer_size *rp = (void *)buf->data; - uint8_t le_max_num; + u8_t le_max_num; BT_DBG("status %u", rp->status); @@ -2999,7 +2999,7 @@ static int le_init(void) struct bt_hci_cp_le_set_event_mask *cp_mask; struct net_buf *buf; struct net_buf *rsp; - uint64_t mask = 0; + u64_t mask = 0; int err; /* For now we only support LE capable controllers */ @@ -3248,7 +3248,7 @@ static int br_init(void) } /* Set page timeout*/ - buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_PAGE_TIMEOUT, sizeof(uint16_t)); + buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_PAGE_TIMEOUT, sizeof(u16_t)); if (!buf) { return -ENOBUFS; } @@ -3311,7 +3311,7 @@ static int set_event_mask(void) { struct bt_hci_cp_set_event_mask *ev; struct net_buf *buf; - uint64_t mask = 0; + u64_t mask = 0; buf = bt_hci_cmd_create(BT_HCI_OP_SET_EVENT_MASK, sizeof(*ev)); if (!buf) { @@ -3471,7 +3471,7 @@ set_addr: } #if defined(CONFIG_BLUETOOTH_DEBUG) -static const char *ver_str(uint8_t ver) +static const char *ver_str(u8_t ver) { const char * const str[] = { "1.0b", "1.1", "1.2", "2.0", "2.1", "3.0", "4.0", "4.1", "4.2", @@ -3846,7 +3846,7 @@ static bool valid_adv_param(const struct bt_le_adv_param *param) return true; } -static int set_ad(uint16_t hci_op, const struct bt_data *ad, size_t ad_len) +static int set_ad(u16_t hci_op, const struct bt_data *ad, size_t ad_len) { struct bt_hci_cp_le_set_adv_data *set_data; struct net_buf *buf; @@ -4101,7 +4101,7 @@ int bt_le_scan_stop(void) return bt_le_scan_update(false); } -struct net_buf *bt_buf_get_rx(int32_t timeout) +struct net_buf *bt_buf_get_rx(s32_t timeout) { struct net_buf *buf; @@ -4113,7 +4113,7 @@ struct net_buf *bt_buf_get_rx(int32_t timeout) return buf; } -struct net_buf *bt_buf_get_cmd_complete(int32_t timeout) +struct net_buf *bt_buf_get_cmd_complete(s32_t timeout) { struct net_buf *buf; unsigned int key; @@ -4144,7 +4144,7 @@ struct net_buf *bt_buf_get_cmd_complete(int32_t timeout) #if defined(CONFIG_BLUETOOTH_BREDR) static int br_start_inquiry(const struct bt_br_discovery_param *param) { - const uint8_t iac[3] = { 0x33, 0x8b, 0x9e }; + const u8_t iac[3] = { 0x33, 0x8b, 0x9e }; struct bt_hci_op_inquiry *cp; struct net_buf *buf; @@ -4262,7 +4262,7 @@ int bt_br_discovery_stop(void) return 0; } -static int write_scan_enable(uint8_t scan) +static int write_scan_enable(u8_t scan) { struct net_buf *buf; int err; @@ -4397,7 +4397,7 @@ int bt_storage_clear(const bt_addr_le_t *addr) return 0; } -uint16_t bt_hci_get_cmd_opcode(struct net_buf *buf) +u16_t bt_hci_get_cmd_opcode(struct net_buf *buf) { return cmd(buf)->opcode; } @@ -4445,7 +4445,7 @@ int bt_pub_key_gen(struct bt_pub_key_cb *new_cb) return 0; } -const uint8_t *bt_pub_key_get(void) +const u8_t *bt_pub_key_get(void) { if (atomic_test_bit(bt_dev.flags, BT_DEV_HAS_PUB_KEY)) { return pub_key; @@ -4454,7 +4454,7 @@ const uint8_t *bt_pub_key_get(void) return NULL; } -int bt_dh_key_gen(const uint8_t remote_pk[64], bt_dh_key_cb_t cb) +int bt_dh_key_gen(const u8_t remote_pk[64], bt_dh_key_cb_t cb) { struct bt_hci_cp_le_generate_dhkey *cp; struct net_buf *buf; diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index dc232b9d181..e8b33c3a7df 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -54,25 +54,25 @@ enum { struct bt_dev_le { /* LE features */ - uint8_t features[1][8]; + u8_t features[1][8]; /* LE states */ - uint64_t states; + u64_t states; #if defined(CONFIG_BLUETOOTH_CONN) /* Controller buffer information */ - uint16_t mtu; + u16_t mtu; struct k_sem pkts; #endif /* CONFIG_BLUETOOTH_CONN */ }; #if defined(CONFIG_BLUETOOTH_BREDR) struct bt_dev_esco { - uint16_t pkt_type; + u16_t pkt_type; }; struct bt_dev_br { /* Max controller's acceptable ACL packet length */ - uint16_t mtu; + u16_t mtu; struct k_sem pkts; }; #endif @@ -86,17 +86,17 @@ struct bt_dev { bt_addr_le_t random_addr; /* Controller version & manufacturer information */ - uint8_t hci_version; - uint8_t lmp_version; - uint16_t hci_revision; - uint16_t lmp_subversion; - uint16_t manufacturer; + u8_t hci_version; + u8_t lmp_version; + u16_t hci_revision; + u16_t lmp_subversion; + u16_t manufacturer; /* LMP features (pages 0, 1, 2) */ - uint8_t features[LMP_FEAT_PAGES_COUNT][8]; + u8_t features[LMP_FEAT_PAGES_COUNT][8]; /* Supported commands */ - uint8_t supported_commands[64]; + u8_t supported_commands[64]; struct k_work init; @@ -136,7 +136,7 @@ struct bt_dev { #if defined(CONFIG_BLUETOOTH_PRIVACY) /* Local Identity Resolving Key */ - uint8_t irk[16]; + u8_t irk[16]; /* Work used for RPA rotation */ struct k_delayed_work rpa_update; @@ -151,9 +151,9 @@ extern const struct bt_conn_auth_cb *bt_auth; bool bt_le_conn_params_valid(const struct bt_le_conn_param *param); -struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len); -int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf); -int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf, +struct net_buf *bt_hci_cmd_create(u16_t opcode, u8_t param_len); +int bt_hci_cmd_send(u16_t opcode, struct net_buf *buf); +int bt_hci_cmd_send_sync(u16_t opcode, struct net_buf *buf, struct net_buf **rsp); /* The helper is only safe to be called from internal threads as it's @@ -168,4 +168,4 @@ bool bt_addr_le_is_bonded(const bt_addr_le_t *addr); int bt_send(struct net_buf *buf); -uint16_t bt_hci_get_cmd_opcode(struct net_buf *buf); +u16_t bt_hci_get_cmd_opcode(struct net_buf *buf); diff --git a/subsys/bluetooth/host/hci_ecc.c b/subsys/bluetooth/host/hci_ecc.c index feda122a15d..bdff65f7642 100644 --- a/subsys/bluetooth/host/hci_ecc.c +++ b/subsys/bluetooth/host/hci_ecc.c @@ -36,13 +36,13 @@ static BT_STACK_NOINIT(ecc_thread_stack, 1060); /* based on Core Specification 4.2 Vol 3. Part H 2.3.5.6.1 */ -static const uint32_t debug_private_key[8] = { +static const u32_t debug_private_key[8] = { 0xcd3c1abd, 0x5899b8a6, 0xeb40b799, 0x4aff607b, 0xd2103f50, 0x74c9b3e3, 0xa3c55f38, 0x3f49f6d4 }; #if defined(CONFIG_BLUETOOTH_USE_DEBUG_KEYS) -static const uint8_t debug_public_key[64] = { +static const u8_t debug_public_key[64] = { 0xe6, 0x9d, 0x35, 0x0e, 0x48, 0x01, 0x03, 0xcc, 0xdb, 0xfd, 0xf4, 0xac, 0x11, 0x91, 0xf4, 0xef, 0xb9, 0xa5, 0xf9, 0xe9, 0xa7, 0x83, 0x2c, 0x5e, 0x2c, 0xbe, 0x97, 0xf2, 0xd2, 0x03, 0xb0, 0x20, 0x8b, 0xd2, 0x89, 0x15, @@ -66,17 +66,17 @@ static struct { * for the private_key and random to occupy the same memory area. */ union { - uint32_t private_key[NUM_ECC_DIGITS]; - uint32_t random[NUM_ECC_DIGITS * 2]; + u32_t private_key[NUM_ECC_DIGITS]; + u32_t random[NUM_ECC_DIGITS * 2]; }; union { EccPoint pk; - uint32_t dhkey[NUM_ECC_DIGITS]; + u32_t dhkey[NUM_ECC_DIGITS]; }; } ecc; -static void send_cmd_status(uint16_t opcode, uint8_t status) +static void send_cmd_status(u16_t opcode, u8_t status) { struct bt_hci_evt_cmd_status *evt; struct bt_hci_evt_hdr *hdr; @@ -99,13 +99,13 @@ static void send_cmd_status(uint16_t opcode, uint8_t status) bt_recv_prio(buf); } -static uint8_t generate_keys(void) +static u8_t generate_keys(void) { #if !defined(CONFIG_BLUETOOTH_USE_DEBUG_KEYS) do { int rc; - if (bt_rand((uint8_t *)ecc.random, sizeof(ecc.random))) { + if (bt_rand((u8_t *)ecc.random, sizeof(ecc.random))) { BT_ERR("Failed to get random bytes for ECC keys"); return BT_HCI_ERR_UNSPECIFIED; } @@ -131,7 +131,7 @@ static void emulate_le_p256_public_key_cmd(void) struct bt_hci_evt_le_meta_event *meta; struct bt_hci_evt_hdr *hdr; struct net_buf *buf; - uint8_t status; + u8_t status; BT_DBG(""); @@ -168,7 +168,7 @@ static void emulate_le_generate_dhkey(void) struct bt_hci_evt_le_meta_event *meta; struct bt_hci_evt_hdr *hdr; struct net_buf *buf; - int32_t ret; + s32_t ret; if (ecc_valid_public_key(&ecc.pk) < 0) { ret = TC_CRYPTO_FAIL; @@ -236,7 +236,7 @@ static void clear_ecc_events(struct net_buf *buf) static void le_gen_dhkey(struct net_buf *buf) { struct bt_hci_cp_le_generate_dhkey *cmd; - uint8_t status; + u8_t status; if (atomic_test_bit(&flags, PENDING_PUB_KEY)) { status = BT_HCI_ERR_CMD_DISALLOWED; @@ -266,7 +266,7 @@ send_status: static void le_p256_pub_key(struct net_buf *buf) { - uint8_t status; + u8_t status; net_buf_unref(buf); diff --git a/subsys/bluetooth/host/hci_raw.c b/subsys/bluetooth/host/hci_raw.c index 1b73416da52..2d9257caceb 100644 --- a/subsys/bluetooth/host/hci_raw.c +++ b/subsys/bluetooth/host/hci_raw.c @@ -45,12 +45,12 @@ int bt_hci_driver_register(const struct bt_hci_driver *drv) return 0; } -struct net_buf *bt_buf_get_rx(int32_t timeout) +struct net_buf *bt_buf_get_rx(s32_t timeout) { return net_buf_alloc(&hci_rx_pool, timeout); } -struct net_buf *bt_buf_get_cmd_complete(int32_t timeout) +struct net_buf *bt_buf_get_cmd_complete(s32_t timeout) { struct net_buf *buf; @@ -62,7 +62,7 @@ struct net_buf *bt_buf_get_cmd_complete(int32_t timeout) return buf; } -struct net_buf *bt_buf_get_evt(uint8_t opcode, int timeout) +struct net_buf *bt_buf_get_evt(u8_t opcode, int timeout) { struct net_buf *buf; @@ -74,7 +74,7 @@ struct net_buf *bt_buf_get_evt(uint8_t opcode, int timeout) return buf; } -struct net_buf *bt_buf_get_acl(int32_t timeout) +struct net_buf *bt_buf_get_acl(s32_t timeout) { struct net_buf *buf; diff --git a/subsys/bluetooth/host/hfp_hf.c b/subsys/bluetooth/host/hfp_hf.c index dd4764c2e3a..c888c7aba47 100644 --- a/subsys/bluetooth/host/hfp_hf.c +++ b/subsys/bluetooth/host/hfp_hf.c @@ -38,8 +38,8 @@ static struct bt_hfp_hf bt_hfp_hf_pool[CONFIG_BLUETOOTH_MAX_CONN]; /* The order should follow the enum hfp_hf_ag_indicators */ static const struct { char *name; - uint32_t min; - uint32_t max; + u32_t min; + u32_t max; } ag_ind[] = { {"service", 0, 1}, /* HF_SERVICE_IND */ {"call", 0, 1}, /* HF_CALL_IND */ @@ -101,7 +101,7 @@ int hfp_hf_send_cmd(struct bt_hfp_hf *hf, at_resp_cb_t resp, int brsf_handle(struct at_client *hf_at) { struct bt_hfp_hf *hf = CONTAINER_OF(hf_at, struct bt_hfp_hf, at); - uint32_t val; + u32_t val; int ret; ret = at_get_number(hf_at, &val); @@ -134,8 +134,8 @@ int brsf_resp(struct at_client *hf_at, struct net_buf *buf) return 0; } -static void cind_handle_values(struct at_client *hf_at, uint32_t index, - char *name, uint32_t min, uint32_t max) +static void cind_handle_values(struct at_client *hf_at, u32_t index, + char *name, u32_t min, u32_t max) { struct bt_hfp_hf *hf = CONTAINER_OF(hf_at, struct bt_hfp_hf, at); int i; @@ -157,12 +157,12 @@ static void cind_handle_values(struct at_client *hf_at, uint32_t index, int cind_handle(struct at_client *hf_at) { - uint32_t index = 0; + u32_t index = 0; /* Parsing Example: CIND: ("call",(0,1)) etc.. */ while (at_has_next_list(hf_at)) { char name[MAX_IND_STR_LEN]; - uint32_t min, max; + u32_t min, max; if (at_open_list(hf_at) < 0) { BT_ERR("Could not get open list"); @@ -219,8 +219,8 @@ int cind_resp(struct at_client *hf_at, struct net_buf *buf) return 0; } -void ag_indicator_handle_values(struct at_client *hf_at, uint32_t index, - uint32_t value) +void ag_indicator_handle_values(struct at_client *hf_at, u32_t index, + u32_t value) { struct bt_hfp_hf *hf = CONTAINER_OF(hf_at, struct bt_hfp_hf, at); struct bt_conn *conn = hf->rfcomm_dlc.session->br_chan.chan.conn; @@ -283,10 +283,10 @@ void ag_indicator_handle_values(struct at_client *hf_at, uint32_t index, int cind_status_handle(struct at_client *hf_at) { - uint32_t index = 0; + u32_t index = 0; while (at_has_next_list(hf_at)) { - uint32_t value; + u32_t value; int ret; ret = at_get_number(hf_at, &value); @@ -319,7 +319,7 @@ int cind_status_resp(struct at_client *hf_at, struct net_buf *buf) int ciev_handle(struct at_client *hf_at) { - uint32_t index, value; + u32_t index, value; int ret; ret = at_get_number(hf_at, &index); diff --git a/subsys/bluetooth/host/hfp_internal.h b/subsys/bluetooth/host/hfp_internal.h index e0f22177635..98d684ea98e 100644 --- a/subsys/bluetooth/host/hfp_internal.h +++ b/subsys/bluetooth/host/hfp_internal.h @@ -48,9 +48,9 @@ struct bt_hfp_hf { struct bt_rfcomm_dlc rfcomm_dlc; char hf_buffer[HF_MAX_BUF_LEN]; struct at_client at; - uint32_t hf_features; - uint32_t ag_features; - int8_t ind_table[HF_MAX_AG_INDICATORS]; + u32_t hf_features; + u32_t ag_features; + s8_t ind_table[HF_MAX_AG_INDICATORS]; }; enum hfp_hf_ag_indicators { diff --git a/subsys/bluetooth/host/keys.h b/subsys/bluetooth/host/keys.h index 6a7e72df1a5..9c5b205cdea 100644 --- a/subsys/bluetooth/host/keys.h +++ b/subsys/bluetooth/host/keys.h @@ -28,26 +28,26 @@ enum { }; struct bt_ltk { - uint64_t rand; - uint16_t ediv; - uint8_t val[16]; + u64_t rand; + u16_t ediv; + u8_t val[16]; }; struct bt_irk { - uint8_t val[16]; + u8_t val[16]; bt_addr_t rpa; }; struct bt_csrk { - uint8_t val[16]; - uint32_t cnt; + u8_t val[16]; + u32_t cnt; }; struct bt_keys { bt_addr_le_t addr; - uint8_t enc_size; + u8_t enc_size; ATOMIC_DEFINE(flags, BT_KEYS_NUM_FLAGS); - uint16_t keys; + u16_t keys; struct bt_ltk ltk; struct bt_irk irk; #if defined(CONFIG_BLUETOOTH_SIGNING) @@ -81,7 +81,7 @@ enum { struct bt_keys_link_key { bt_addr_t addr; ATOMIC_DEFINE(flags, BT_LINK_KEY_NUM_FLAGS); - uint8_t val[16]; + u8_t val[16]; }; struct bt_keys_link_key *bt_keys_get_link_key(const bt_addr_t *addr); diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 060a54cca29..8cacac5a835 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -73,9 +73,9 @@ struct bt_l2cap { static struct bt_l2cap bt_l2cap_pool[CONFIG_BLUETOOTH_MAX_CONN]; -static uint8_t get_ident(void) +static u8_t get_ident(void) { - static uint8_t ident; + static u8_t ident; ident++; /* handle integer overflow (0 is not valid) */ @@ -98,7 +98,7 @@ static struct bt_l2cap_le_chan *l2cap_chan_alloc_cid(struct bt_conn *conn, struct bt_l2cap_chan *chan) { struct bt_l2cap_le_chan *ch = BT_L2CAP_LE_CHAN(chan); - uint16_t cid; + u16_t cid; /* * No action needed if there's already a CID allocated, e.g. in @@ -119,7 +119,7 @@ static struct bt_l2cap_le_chan *l2cap_chan_alloc_cid(struct bt_conn *conn, } static struct bt_l2cap_le_chan * -__l2cap_lookup_ident(struct bt_conn *conn, uint16_t ident, bool remove) +__l2cap_lookup_ident(struct bt_conn *conn, u16_t ident, bool remove) { struct bt_l2cap_chan *chan; sys_snode_t *prev = NULL; @@ -347,8 +347,8 @@ void bt_l2cap_disconnected(struct bt_conn *conn) } static struct net_buf *l2cap_create_le_sig_pdu(struct net_buf *buf, - uint8_t code, uint8_t ident, - uint16_t len) + u8_t code, u8_t ident, + u16_t len) { struct bt_l2cap_sig_hdr *hdr; @@ -364,7 +364,7 @@ static struct net_buf *l2cap_create_le_sig_pdu(struct net_buf *buf, #if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) static void l2cap_chan_send_req(struct bt_l2cap_le_chan *chan, - struct net_buf *buf, int32_t timeout) + struct net_buf *buf, s32_t timeout) { /* BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part A] page 126: * @@ -406,7 +406,7 @@ static int l2cap_le_conn_req(struct bt_l2cap_le_chan *ch) return 0; } -static void l2cap_le_encrypt_change(struct bt_l2cap_chan *chan, uint8_t status) +static void l2cap_le_encrypt_change(struct bt_l2cap_chan *chan, u8_t status) { /* Skip channels already connected or with a pending request */ if (chan->state != BT_L2CAP_CONNECT || chan->ident) { @@ -424,7 +424,7 @@ static void l2cap_le_encrypt_change(struct bt_l2cap_chan *chan, uint8_t status) } #endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */ -void bt_l2cap_encrypt_change(struct bt_conn *conn, uint8_t hci_status) +void bt_l2cap_encrypt_change(struct bt_conn *conn, u8_t hci_status) { struct bt_l2cap_chan *chan; @@ -464,7 +464,7 @@ struct net_buf *bt_l2cap_create_pdu(struct net_buf_pool *pool, size_t reserve) return bt_conn_create_pdu(pool, sizeof(struct bt_l2cap_hdr) + reserve); } -void bt_l2cap_send_cb(struct bt_conn *conn, uint16_t cid, struct net_buf *buf, +void bt_l2cap_send_cb(struct bt_conn *conn, u16_t cid, struct net_buf *buf, bt_conn_tx_cb_t cb) { struct bt_l2cap_hdr *hdr; @@ -478,8 +478,8 @@ void bt_l2cap_send_cb(struct bt_conn *conn, uint16_t cid, struct net_buf *buf, bt_conn_send_cb(conn, buf, cb); } -static void l2cap_send_reject(struct bt_conn *conn, uint8_t ident, - uint16_t reason, void *data, uint8_t data_len) +static void l2cap_send_reject(struct bt_conn *conn, u8_t ident, + u16_t reason, void *data, u8_t data_len) { struct bt_l2cap_cmd_reject *rej; struct net_buf *buf; @@ -510,7 +510,7 @@ static void le_conn_param_rsp(struct bt_l2cap *l2cap, struct net_buf *buf) } #if defined(CONFIG_BLUETOOTH_CENTRAL) -static void le_conn_param_update_req(struct bt_l2cap *l2cap, uint8_t ident, +static void le_conn_param_update_req(struct bt_l2cap *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; @@ -560,7 +560,7 @@ static void le_conn_param_update_req(struct bt_l2cap *l2cap, uint8_t ident, #endif /* CONFIG_BLUETOOTH_CENTRAL */ struct bt_l2cap_chan *bt_l2cap_le_lookup_tx_cid(struct bt_conn *conn, - uint16_t cid) + u16_t cid) { struct bt_l2cap_chan *chan; @@ -574,7 +574,7 @@ struct bt_l2cap_chan *bt_l2cap_le_lookup_tx_cid(struct bt_conn *conn, } struct bt_l2cap_chan *bt_l2cap_le_lookup_rx_cid(struct bt_conn *conn, - uint16_t cid) + u16_t cid) { struct bt_l2cap_chan *chan; @@ -588,7 +588,7 @@ struct bt_l2cap_chan *bt_l2cap_le_lookup_rx_cid(struct bt_conn *conn, } #if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) -static struct bt_l2cap_server *l2cap_server_lookup_psm(uint16_t psm) +static struct bt_l2cap_server *l2cap_server_lookup_psm(u16_t psm) { struct bt_l2cap_server *server; @@ -662,7 +662,7 @@ static void l2cap_chan_tx_init(struct bt_l2cap_le_chan *chan) } static void l2cap_chan_tx_give_credits(struct bt_l2cap_le_chan *chan, - uint16_t credits) + u16_t credits) { BT_DBG("chan %p credits %u", chan, credits); @@ -672,7 +672,7 @@ static void l2cap_chan_tx_give_credits(struct bt_l2cap_le_chan *chan, } static void l2cap_chan_rx_give_credits(struct bt_l2cap_le_chan *chan, - uint16_t credits) + u16_t credits) { BT_DBG("chan %p credits %u", chan, credits); @@ -704,7 +704,7 @@ static void l2cap_chan_destroy(struct bt_l2cap_chan *chan) } } -static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident, +static void le_conn_req(struct bt_l2cap *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; @@ -712,7 +712,7 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident, struct bt_l2cap_server *server; struct bt_l2cap_le_conn_req *req = (void *)buf->data; struct bt_l2cap_le_conn_rsp *rsp; - uint16_t psm, scid, mtu, mps, credits; + u16_t psm, scid, mtu, mps, credits; if (buf->len < sizeof(*req)) { BT_ERR("Too small LE conn req packet size"); @@ -814,7 +814,7 @@ rsp: } static struct bt_l2cap_le_chan *l2cap_remove_tx_cid(struct bt_conn *conn, - uint16_t cid) + u16_t cid) { struct bt_l2cap_chan *chan; sys_snode_t *prev = NULL; @@ -836,14 +836,14 @@ static struct bt_l2cap_le_chan *l2cap_remove_tx_cid(struct bt_conn *conn, return NULL; } -static void le_disconn_req(struct bt_l2cap *l2cap, uint8_t ident, +static void le_disconn_req(struct bt_l2cap *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_le_chan *chan; struct bt_l2cap_disconn_req *req = (void *)buf->data; struct bt_l2cap_disconn_rsp *rsp; - uint16_t scid; + u16_t scid; if (buf->len < sizeof(*req)) { BT_ERR("Too small LE conn req packet size"); @@ -878,7 +878,7 @@ static void le_disconn_req(struct bt_l2cap *l2cap, uint8_t ident, bt_l2cap_send(conn, BT_L2CAP_CID_LE_SIG, buf); } -static int l2cap_change_security(struct bt_l2cap_le_chan *chan, uint16_t err) +static int l2cap_change_security(struct bt_l2cap_le_chan *chan, u16_t err) { switch (err) { case BT_L2CAP_ERR_ENCRYPTION: @@ -905,13 +905,13 @@ static int l2cap_change_security(struct bt_l2cap_le_chan *chan, uint16_t err) return bt_conn_security(chan->chan.conn, chan->chan.required_sec_level); } -static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, +static void le_conn_rsp(struct bt_l2cap *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_le_chan *chan; struct bt_l2cap_le_conn_rsp *rsp = (void *)buf->data; - uint16_t dcid, mtu, mps, credits, result; + u16_t dcid, mtu, mps, credits, result; if (buf->len < sizeof(*rsp)) { BT_ERR("Too small LE conn rsp packet size"); @@ -977,13 +977,13 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident, } } -static void le_disconn_rsp(struct bt_l2cap *l2cap, uint8_t ident, +static void le_disconn_rsp(struct bt_l2cap *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_le_chan *chan; struct bt_l2cap_disconn_rsp *rsp = (void *)buf->data; - uint16_t dcid; + u16_t dcid; if (buf->len < sizeof(*rsp)) { BT_ERR("Too small LE disconn rsp packet size"); @@ -1024,8 +1024,8 @@ static struct net_buf *l2cap_chan_create_seg(struct bt_l2cap_le_chan *ch, size_t sdu_hdr_len) { struct net_buf *seg; - uint16_t headroom; - uint16_t len; + u16_t headroom; + u16_t len; /* Segment if data (+ data headroom) is bigger than MPS */ if (buf->len + sdu_hdr_len > ch->tx.mps) { @@ -1072,7 +1072,7 @@ segment: } static int l2cap_chan_le_send(struct bt_l2cap_le_chan *ch, struct net_buf *buf, - uint16_t sdu_hdr_len) + u16_t sdu_hdr_len) { int len; @@ -1194,14 +1194,14 @@ static void l2cap_chan_le_send_resume(struct bt_l2cap_le_chan *ch) } } -static void le_credits(struct bt_l2cap *l2cap, uint8_t ident, +static void le_credits(struct bt_l2cap *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_chan *chan; struct bt_l2cap_le_credits *ev = (void *)buf->data; struct bt_l2cap_le_chan *ch; - uint16_t credits, cid; + u16_t credits, cid; if (buf->len < sizeof(*ev)) { BT_ERR("Too small LE Credits packet size"); @@ -1235,7 +1235,7 @@ static void le_credits(struct bt_l2cap *l2cap, uint8_t ident, l2cap_chan_le_send_resume(ch); } -static void reject_cmd(struct bt_l2cap *l2cap, uint8_t ident, +static void reject_cmd(struct bt_l2cap *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; @@ -1255,7 +1255,7 @@ static void l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) { struct bt_l2cap *l2cap = CONTAINER_OF(chan, struct bt_l2cap, chan); struct bt_l2cap_sig_hdr *hdr = (void *)buf->data; - uint16_t len; + u16_t len; if (buf->len < sizeof(*hdr)) { BT_ERR("Too small L2CAP signaling PDU"); @@ -1324,7 +1324,7 @@ static void l2cap_chan_update_credits(struct bt_l2cap_le_chan *chan, struct net_buf *buf) { struct bt_l2cap_le_credits *ev; - uint16_t credits; + u16_t credits; /* Only give more credits if it went bellow the defined threshold */ if (k_sem_count_get(&chan->rx.credits) > @@ -1369,7 +1369,7 @@ static void l2cap_chan_le_recv_sdu(struct bt_l2cap_le_chan *chan, struct net_buf *buf) { struct net_buf *frag; - uint16_t len; + u16_t len; BT_DBG("chan %p len %u sdu %zu", chan, buf->len, net_buf_frags_len(chan->_sdu)); @@ -1415,7 +1415,7 @@ static void l2cap_chan_le_recv_sdu(struct bt_l2cap_le_chan *chan, static void l2cap_chan_le_recv(struct bt_l2cap_le_chan *chan, struct net_buf *buf) { - uint16_t sdu_len; + u16_t sdu_len; if (k_sem_take(&chan->rx.credits, K_NO_WAIT)) { BT_ERR("No credits to receive packet"); @@ -1478,7 +1478,7 @@ void bt_l2cap_recv(struct bt_conn *conn, struct net_buf *buf) { struct bt_l2cap_hdr *hdr = (void *)buf->data; struct bt_l2cap_chan *chan; - uint16_t cid; + u16_t cid; if (IS_ENABLED(CONFIG_BLUETOOTH_BREDR) && conn->type == BT_CONN_TYPE_BR) { @@ -1585,7 +1585,7 @@ void bt_l2cap_init(void) #if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) static int l2cap_le_connect(struct bt_conn *conn, struct bt_l2cap_le_chan *ch, - uint16_t psm) + u16_t psm) { if (psm < L2CAP_LE_PSM_START || psm > L2CAP_LE_PSM_END) { return -EINVAL; @@ -1604,7 +1604,7 @@ static int l2cap_le_connect(struct bt_conn *conn, struct bt_l2cap_le_chan *ch, } int bt_l2cap_chan_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan, - uint16_t psm) + u16_t psm) { BT_DBG("conn %p chan %p psm 0x%04x", conn, chan, psm); diff --git a/subsys/bluetooth/host/l2cap_br.c b/subsys/bluetooth/host/l2cap_br.c index fc35adcae36..0f89d17d45b 100644 --- a/subsys/bluetooth/host/l2cap_br.c +++ b/subsys/bluetooth/host/l2cap_br.c @@ -87,15 +87,15 @@ NET_BUF_POOL_DEFINE(br_sig_pool, CONFIG_BLUETOOTH_MAX_CONN, struct bt_l2cap_br { /* The channel this context is associated with */ struct bt_l2cap_br_chan chan; - uint8_t info_ident; - uint8_t info_fixed_chan; - uint32_t info_feat_mask; + u8_t info_ident; + u8_t info_fixed_chan; + u32_t info_feat_mask; }; static struct bt_l2cap_br bt_l2cap_br_pool[CONFIG_BLUETOOTH_MAX_CONN]; struct bt_l2cap_chan *bt_l2cap_br_lookup_rx_cid(struct bt_conn *conn, - uint16_t cid) + u16_t cid) { struct bt_l2cap_chan *chan; @@ -109,7 +109,7 @@ struct bt_l2cap_chan *bt_l2cap_br_lookup_rx_cid(struct bt_conn *conn, } struct bt_l2cap_chan *bt_l2cap_br_lookup_tx_cid(struct bt_conn *conn, - uint16_t cid) + u16_t cid) { struct bt_l2cap_chan *chan; @@ -126,7 +126,7 @@ static struct bt_l2cap_br_chan* l2cap_br_chan_alloc_cid(struct bt_conn *conn, struct bt_l2cap_chan *chan) { struct bt_l2cap_br_chan *ch = BR_CHAN(chan); - uint16_t cid; + u16_t cid; /* * No action needed if there's already a CID allocated, e.g. in @@ -138,7 +138,7 @@ l2cap_br_chan_alloc_cid(struct bt_conn *conn, struct bt_l2cap_chan *chan) /* * L2CAP_BR_CID_DYN_END is 0xffff so we don't check against it since - * cid is uint16_t, just check against uint16_t overflow + * cid is u16_t, just check against u16_t overflow */ for (cid = L2CAP_BR_CID_DYN_START; cid; cid++) { if (!bt_l2cap_br_lookup_rx_cid(conn, cid)) { @@ -211,9 +211,9 @@ static bool l2cap_br_chan_add(struct bt_conn *conn, struct bt_l2cap_chan *chan, return true; } -static uint8_t l2cap_br_get_ident(void) +static u8_t l2cap_br_get_ident(void) { - static uint8_t ident; + static u8_t ident; ident++; /* handle integer overflow (0 is not valid) */ @@ -225,7 +225,7 @@ static uint8_t l2cap_br_get_ident(void) } static void l2cap_br_chan_send_req(struct bt_l2cap_br_chan *chan, - struct net_buf *buf, int32_t timeout) + struct net_buf *buf, s32_t timeout) { /* BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part A] page 126: * @@ -245,7 +245,7 @@ static void l2cap_br_chan_send_req(struct bt_l2cap_br_chan *chan, bt_l2cap_send(chan->chan.conn, BT_L2CAP_CID_BR_SIG, buf); } -static void l2cap_br_get_info(struct bt_l2cap_br *l2cap, uint16_t info_type) +static void l2cap_br_get_info(struct bt_l2cap_br *l2cap, u16_t info_type) { struct bt_l2cap_info_req *info; struct net_buf *buf; @@ -307,11 +307,11 @@ static void connect_optional_fixed_channels(struct bt_l2cap_br *l2cap) } } -static int l2cap_br_info_rsp(struct bt_l2cap_br *l2cap, uint8_t ident, +static int l2cap_br_info_rsp(struct bt_l2cap_br *l2cap, u8_t ident, struct net_buf *buf) { struct bt_l2cap_info_rsp *rsp = (void *)buf->data; - uint16_t type, result; + u16_t type, result; int err = 0; if (atomic_test_bit(l2cap->chan.flags, L2CAP_FLAG_SIG_INFO_DONE)) { @@ -379,10 +379,10 @@ done: return err; } -static uint8_t get_fixed_channels_mask(void) +static u8_t get_fixed_channels_mask(void) { struct bt_l2cap_fixed_chan *fchan; - uint8_t mask = 0; + u8_t mask = 0; /* this needs to be enhanced if AMP Test Manager support is added */ SYS_SLIST_FOR_EACH_CONTAINER(&br_fixed_channels, fchan, node) { @@ -392,7 +392,7 @@ static uint8_t get_fixed_channels_mask(void) return mask; } -static int l2cap_br_info_req(struct bt_l2cap_br *l2cap, uint8_t ident, +static int l2cap_br_info_req(struct bt_l2cap_br *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; @@ -400,7 +400,7 @@ static int l2cap_br_info_req(struct bt_l2cap_br *l2cap, uint8_t ident, struct bt_l2cap_info_rsp *rsp; struct net_buf *rsp_buf; struct bt_l2cap_sig_hdr *hdr_info; - uint16_t type; + u16_t type; if (buf->len < sizeof(*req)) { BT_ERR("Too small info req packet size"); @@ -423,7 +423,7 @@ static int l2cap_br_info_req(struct bt_l2cap_br *l2cap, uint8_t ident, rsp->type = sys_cpu_to_le16(BT_L2CAP_INFO_FEAT_MASK); rsp->result = sys_cpu_to_le16(BT_L2CAP_INFO_SUCCESS); net_buf_add_le32(rsp_buf, L2CAP_FEAT_FIXED_CHAN_MASK); - hdr_info->len = sys_cpu_to_le16(sizeof(*rsp) + sizeof(uint32_t)); + hdr_info->len = sys_cpu_to_le16(sizeof(*rsp) + sizeof(u32_t)); break; case BT_L2CAP_INFO_FIXED_CHAN: rsp->type = sys_cpu_to_le16(BT_L2CAP_INFO_FIXED_CHAN); @@ -486,7 +486,7 @@ void bt_l2cap_br_connected(struct bt_conn *conn) } } -static struct bt_l2cap_server *l2cap_br_server_lookup_psm(uint16_t psm) +static struct bt_l2cap_server *l2cap_br_server_lookup_psm(u16_t psm) { struct bt_l2cap_server *server; @@ -499,7 +499,7 @@ static struct bt_l2cap_server *l2cap_br_server_lookup_psm(uint16_t psm) return NULL; } -static void l2cap_br_conf_add_mtu(struct net_buf *buf, const uint16_t mtu) +static void l2cap_br_conf_add_mtu(struct net_buf *buf, const u16_t mtu) { net_buf_add_u8(buf, BT_L2CAP_CONF_OPT_MTU); net_buf_add_u8(buf, sizeof(mtu)); @@ -559,7 +559,7 @@ enum l2cap_br_conn_security_result { */ static enum l2cap_br_conn_security_result -l2cap_br_conn_security(struct bt_l2cap_chan *chan, const uint16_t psm) +l2cap_br_conn_security(struct bt_l2cap_chan *chan, const u16_t psm) { int check; @@ -625,8 +625,8 @@ l2cap_br_conn_security(struct bt_l2cap_chan *chan, const uint16_t psm) return L2CAP_CONN_SECURITY_REJECT; } -static void l2cap_br_send_conn_rsp(struct bt_conn *conn, uint16_t scid, - uint16_t dcid, uint8_t ident, uint16_t result) +static void l2cap_br_send_conn_rsp(struct bt_conn *conn, u16_t scid, + u16_t dcid, u8_t ident, u16_t result) { struct net_buf *buf; struct bt_l2cap_conn_rsp *rsp; @@ -653,7 +653,7 @@ static void l2cap_br_send_conn_rsp(struct bt_conn *conn, uint16_t scid, bt_l2cap_send(conn, BT_L2CAP_CID_BR_SIG, buf); } -static int l2cap_br_conn_req_reply(struct bt_l2cap_chan *chan, uint16_t result) +static int l2cap_br_conn_req_reply(struct bt_l2cap_chan *chan, u16_t result) { /* Send response to connection request only when in acceptor role */ if (!atomic_test_bit(BR_CHAN(chan)->flags, L2CAP_FLAG_CONN_ACCEPTOR)) { @@ -667,14 +667,14 @@ static int l2cap_br_conn_req_reply(struct bt_l2cap_chan *chan, uint16_t result) return 0; } -static void l2cap_br_conn_req(struct bt_l2cap_br *l2cap, uint8_t ident, +static void l2cap_br_conn_req(struct bt_l2cap_br *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_chan *chan; struct bt_l2cap_server *server; struct bt_l2cap_conn_req *req = (void *)buf->data; - uint16_t psm, scid, result; + u16_t psm, scid, result; if (buf->len < sizeof(*req)) { BT_ERR("Too small L2CAP conn req packet size"); @@ -774,13 +774,13 @@ no_chan: l2cap_br_send_conn_rsp(conn, scid, 0, ident, result); } -static void l2cap_br_conf_rsp(struct bt_l2cap_br *l2cap, uint8_t ident, - uint16_t len, struct net_buf *buf) +static void l2cap_br_conf_rsp(struct bt_l2cap_br *l2cap, u8_t ident, + u16_t len, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_chan *chan; struct bt_l2cap_conf_rsp *rsp = (void *)buf->data; - uint16_t flags, scid, result, opt_len; + u16_t flags, scid, result, opt_len; if (buf->len < sizeof(*rsp)) { BT_ERR("Too small L2CAP conf rsp packet size"); @@ -863,8 +863,8 @@ int bt_l2cap_br_server_register(struct bt_l2cap_server *server) return 0; } -static void l2cap_br_send_reject(struct bt_conn *conn, uint8_t ident, - uint16_t reason, void *data, uint8_t data_len) +static void l2cap_br_send_reject(struct bt_conn *conn, u8_t ident, + u16_t reason, void *data, u8_t data_len) { struct bt_l2cap_cmd_reject *rej; struct bt_l2cap_sig_hdr *hdr; @@ -892,10 +892,10 @@ static void l2cap_br_send_reject(struct bt_conn *conn, uint8_t ident, bt_l2cap_send(conn, BT_L2CAP_CID_BR_SIG, buf); } -static uint16_t l2cap_br_conf_opt_mtu(struct bt_l2cap_chan *chan, +static u16_t l2cap_br_conf_opt_mtu(struct bt_l2cap_chan *chan, struct net_buf *buf, size_t len) { - uint16_t mtu, result = BT_L2CAP_CONF_SUCCESS; + u16_t mtu, result = BT_L2CAP_CONF_SUCCESS; /* Core 4.2 [Vol 3, Part A, 5.1] MTU payload length */ if (len != 2) { @@ -919,8 +919,8 @@ done: return result; } -static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, uint8_t ident, - uint16_t len, struct net_buf *buf) +static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, u8_t ident, + u16_t len, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_chan *chan; @@ -928,7 +928,7 @@ static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, uint8_t ident, struct bt_l2cap_sig_hdr *hdr; struct bt_l2cap_conf_rsp *rsp; struct bt_l2cap_conf_opt *opt; - uint16_t flags, dcid, opt_len, hint, result = BT_L2CAP_CONF_SUCCESS; + u16_t flags, dcid, opt_len, hint, result = BT_L2CAP_CONF_SUCCESS; if (buf->len < sizeof(*req)) { BT_ERR("Too small L2CAP conf req packet size"); @@ -1046,7 +1046,7 @@ send_rsp: } static struct bt_l2cap_br_chan *l2cap_br_remove_tx_cid(struct bt_conn *conn, - uint16_t cid) + u16_t cid) { struct bt_l2cap_chan *chan; sys_snode_t *prev = NULL; @@ -1068,7 +1068,7 @@ static struct bt_l2cap_br_chan *l2cap_br_remove_tx_cid(struct bt_conn *conn, return NULL; } -static void l2cap_br_disconn_req(struct bt_l2cap_br *l2cap, uint8_t ident, +static void l2cap_br_disconn_req(struct bt_l2cap_br *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; @@ -1076,7 +1076,7 @@ static void l2cap_br_disconn_req(struct bt_l2cap_br *l2cap, uint8_t ident, struct bt_l2cap_disconn_req *req = (void *)buf->data; struct bt_l2cap_disconn_rsp *rsp; struct bt_l2cap_sig_hdr *hdr; - uint16_t scid, dcid; + u16_t scid, dcid; if (buf->len < sizeof(*req)) { BT_ERR("Too small disconn req packet size"); @@ -1169,13 +1169,13 @@ int bt_l2cap_br_chan_disconnect(struct bt_l2cap_chan *chan) return 0; } -static void l2cap_br_disconn_rsp(struct bt_l2cap_br *l2cap, uint8_t ident, +static void l2cap_br_disconn_rsp(struct bt_l2cap_br *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_br_chan *chan; struct bt_l2cap_disconn_rsp *rsp = (void *)buf->data; - uint16_t dcid, scid; + u16_t dcid, scid; if (buf->len < sizeof(*rsp)) { BT_ERR("Too small disconn rsp packet size"); @@ -1197,7 +1197,7 @@ static void l2cap_br_disconn_rsp(struct bt_l2cap_br *l2cap, uint8_t ident, } int bt_l2cap_br_chan_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan, - uint16_t psm) + u16_t psm) { struct net_buf *buf; struct bt_l2cap_sig_hdr *hdr; @@ -1276,13 +1276,13 @@ int bt_l2cap_br_chan_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan, return 0; } -static void l2cap_br_conn_rsp(struct bt_l2cap_br *l2cap, uint8_t ident, +static void l2cap_br_conn_rsp(struct bt_l2cap_br *l2cap, u8_t ident, struct net_buf *buf) { struct bt_conn *conn = l2cap->chan.chan.conn; struct bt_l2cap_chan *chan; struct bt_l2cap_conn_rsp *rsp = (void *)buf->data; - uint16_t dcid, scid, result, status; + u16_t dcid, scid, result, status; if (buf->len < sizeof(*rsp)) { BT_ERR("Too small L2CAP conn rsp packet size"); @@ -1346,7 +1346,7 @@ static void l2cap_br_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) { struct bt_l2cap_br *l2cap = CONTAINER_OF(chan, struct bt_l2cap_br, chan); struct bt_l2cap_sig_hdr *hdr = (void *)buf->data; - uint16_t len; + u16_t len; if (buf->len < sizeof(*hdr)) { BT_ERR("Too small L2CAP signaling PDU"); @@ -1402,7 +1402,7 @@ static void l2cap_br_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) } } -static void l2cap_br_conn_pend(struct bt_l2cap_chan *chan, uint8_t status) +static void l2cap_br_conn_pend(struct bt_l2cap_chan *chan, u8_t status) { struct net_buf *buf; struct bt_l2cap_sig_hdr *hdr; @@ -1464,7 +1464,7 @@ static void l2cap_br_conn_pend(struct bt_l2cap_chan *chan, uint8_t status) } } -void l2cap_br_encrypt_change(struct bt_conn *conn, uint8_t hci_status) +void l2cap_br_encrypt_change(struct bt_conn *conn, u8_t hci_status) { struct bt_l2cap_chan *chan; @@ -1490,7 +1490,7 @@ void bt_l2cap_br_recv(struct bt_conn *conn, struct net_buf *buf) { struct bt_l2cap_hdr *hdr = (void *)buf->data; struct bt_l2cap_chan *chan; - uint16_t cid; + u16_t cid; if (buf->len < sizeof(*hdr)) { BT_ERR("Too small L2CAP PDU received"); diff --git a/subsys/bluetooth/host/l2cap_internal.h b/subsys/bluetooth/host/l2cap_internal.h index 69c770636f3..24c6ae03329 100644 --- a/subsys/bluetooth/host/l2cap_internal.h +++ b/subsys/bluetooth/host/l2cap_internal.h @@ -24,14 +24,14 @@ enum l2cap_conn_list_action { #define BT_L2CAP_PSM_RFCOMM 0x0003 struct bt_l2cap_hdr { - uint16_t len; - uint16_t cid; + u16_t len; + u16_t cid; } __packed; struct bt_l2cap_sig_hdr { - uint8_t code; - uint8_t ident; - uint16_t len; + u8_t code; + u8_t ident; + u16_t len; } __packed; #define BT_L2CAP_REJ_NOT_UNDERSTOOD 0x0000 @@ -40,19 +40,19 @@ struct bt_l2cap_sig_hdr { #define BT_L2CAP_CMD_REJECT 0x01 struct bt_l2cap_cmd_reject { - uint16_t reason; - uint8_t data[0]; + u16_t reason; + u8_t data[0]; } __packed; struct bt_l2cap_cmd_reject_cid_data { - uint16_t scid; - uint16_t dcid; + u16_t scid; + u16_t dcid; } __packed; #define BT_L2CAP_CONN_REQ 0x02 struct bt_l2cap_conn_req { - uint16_t psm; - uint16_t scid; + u16_t psm; + u16_t scid; } __packed; /* command statuses in reposnse */ @@ -70,10 +70,10 @@ struct bt_l2cap_conn_req { #define BT_L2CAP_CONN_RSP 0x03 struct bt_l2cap_conn_rsp { - uint16_t dcid; - uint16_t scid; - uint16_t result; - uint16_t status; + u16_t dcid; + u16_t scid; + u16_t result; + u16_t status; } __packed; #define BT_L2CAP_CONF_SUCCESS 0x0000 @@ -82,17 +82,17 @@ struct bt_l2cap_conn_rsp { #define BT_L2CAP_CONF_REQ 0x04 struct bt_l2cap_conf_req { - uint16_t dcid; - uint16_t flags; - uint8_t data[0]; + u16_t dcid; + u16_t flags; + u8_t data[0]; } __packed; #define BT_L2CAP_CONF_RSP 0x05 struct bt_l2cap_conf_rsp { - uint16_t scid; - uint16_t flags; - uint16_t result; - uint8_t data[0]; + u16_t scid; + u16_t flags; + u16_t result; + u8_t data[0]; } __packed; /* Option type used by MTU config request data */ @@ -102,21 +102,21 @@ struct bt_l2cap_conf_rsp { #define BT_L2CAP_CONF_MASK 0x7f struct bt_l2cap_conf_opt { - uint8_t type; - uint8_t len; - uint8_t data[0]; + u8_t type; + u8_t len; + u8_t data[0]; } __packed; #define BT_L2CAP_DISCONN_REQ 0x06 struct bt_l2cap_disconn_req { - uint16_t dcid; - uint16_t scid; + u16_t dcid; + u16_t scid; } __packed; #define BT_L2CAP_DISCONN_RSP 0x07 struct bt_l2cap_disconn_rsp { - uint16_t dcid; - uint16_t scid; + u16_t dcid; + u16_t scid; } __packed; #define BT_L2CAP_INFO_FEAT_MASK 0x0002 @@ -124,7 +124,7 @@ struct bt_l2cap_disconn_rsp { #define BT_L2CAP_INFO_REQ 0x0a struct bt_l2cap_info_req { - uint16_t type; + u16_t type; } __packed; /* info result */ @@ -133,17 +133,17 @@ struct bt_l2cap_info_req { #define BT_L2CAP_INFO_RSP 0x0b struct bt_l2cap_info_rsp { - uint16_t type; - uint16_t result; - uint8_t data[0]; + u16_t type; + u16_t result; + u8_t data[0]; } __packed; #define BT_L2CAP_CONN_PARAM_REQ 0x12 struct bt_l2cap_conn_param_req { - uint16_t min_interval; - uint16_t max_interval; - uint16_t latency; - uint16_t timeout; + u16_t min_interval; + u16_t max_interval; + u16_t latency; + u16_t timeout; } __packed; #define BT_L2CAP_CONN_PARAM_ACCEPTED 0x0000 @@ -151,16 +151,16 @@ struct bt_l2cap_conn_param_req { #define BT_L2CAP_CONN_PARAM_RSP 0x13 struct bt_l2cap_conn_param_rsp { - uint16_t result; + u16_t result; } __packed; #define BT_L2CAP_LE_CONN_REQ 0x14 struct bt_l2cap_le_conn_req { - uint16_t psm; - uint16_t scid; - uint16_t mtu; - uint16_t mps; - uint16_t credits; + u16_t psm; + u16_t scid; + u16_t mtu; + u16_t mps; + u16_t credits; } __packed; #define BT_L2CAP_SUCCESS 0x0000 @@ -177,17 +177,17 @@ struct bt_l2cap_le_conn_req { #define BT_L2CAP_LE_CONN_RSP 0x15 struct bt_l2cap_le_conn_rsp { - uint16_t dcid; - uint16_t mtu; - uint16_t mps; - uint16_t credits; - uint16_t result; + u16_t dcid; + u16_t mtu; + u16_t mps; + u16_t credits; + u16_t result; }; #define BT_L2CAP_LE_CREDITS 0x16 struct bt_l2cap_le_credits { - uint16_t cid; - uint16_t credits; + u16_t cid; + u16_t credits; } __packed; #define BT_L2CAP_SDU_HDR_LEN 2 @@ -196,7 +196,7 @@ struct bt_l2cap_le_credits { BT_HCI_ACL_HDR_SIZE - BT_L2CAP_HDR_SIZE) struct bt_l2cap_fixed_chan { - uint16_t cid; + u16_t cid; int (*accept)(struct bt_conn *conn, struct bt_l2cap_chan **chan); sys_snode_t node; @@ -238,7 +238,7 @@ void bt_l2cap_chan_set_state(struct bt_l2cap_chan *chan, * Notify L2CAP channels of a change in encryption state passing additionally * HCI status of performed security procedure. */ -void bt_l2cap_encrypt_change(struct bt_conn *conn, uint8_t hci_status); +void bt_l2cap_encrypt_change(struct bt_conn *conn, u8_t hci_status); /* Prepare an L2CAP PDU to be sent over a connection */ struct net_buf *bt_l2cap_create_pdu(struct net_buf_pool *pool, size_t reserve); @@ -247,10 +247,10 @@ struct net_buf *bt_l2cap_create_pdu(struct net_buf_pool *pool, size_t reserve); struct net_buf *bt_l2cap_create_rsp(struct net_buf *buf, size_t reserve); /* Send L2CAP PDU over a connection */ -void bt_l2cap_send_cb(struct bt_conn *conn, uint16_t cid, struct net_buf *buf, +void bt_l2cap_send_cb(struct bt_conn *conn, u16_t cid, struct net_buf *buf, bt_conn_tx_cb_t cb); -static inline void bt_l2cap_send(struct bt_conn *conn, uint16_t cid, +static inline void bt_l2cap_send(struct bt_conn *conn, u16_t cid, struct net_buf *buf) { bt_l2cap_send_cb(conn, cid, buf, NULL); @@ -268,11 +268,11 @@ void bt_l2cap_init(void); /* Lookup channel by Transmission CID */ struct bt_l2cap_chan *bt_l2cap_le_lookup_tx_cid(struct bt_conn *conn, - uint16_t cid); + u16_t cid); /* Lookup channel by Receiver CID */ struct bt_l2cap_chan *bt_l2cap_le_lookup_rx_cid(struct bt_conn *conn, - uint16_t cid); + u16_t cid); /* Initialize BR/EDR L2CAP signal layer */ void bt_l2cap_br_init(void); @@ -285,14 +285,14 @@ void bt_l2cap_br_connected(struct bt_conn *conn); /* Lookup BR/EDR L2CAP channel by Receiver CID */ struct bt_l2cap_chan *bt_l2cap_br_lookup_rx_cid(struct bt_conn *conn, - uint16_t cid); + u16_t cid); /* Disconnects dynamic channel */ int bt_l2cap_br_chan_disconnect(struct bt_l2cap_chan *chan); /* Make connection to peer psm server */ int bt_l2cap_br_chan_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan, - uint16_t psm); + u16_t psm); /* Send packet data to connected peer */ int bt_l2cap_br_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf); @@ -301,7 +301,7 @@ int bt_l2cap_br_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf); * Handle security level changed on link passing HCI status of performed * security procedure. */ -void l2cap_br_encrypt_change(struct bt_conn *conn, uint8_t hci_status); +void l2cap_br_encrypt_change(struct bt_conn *conn, u8_t hci_status); /* Handle received data */ void bt_l2cap_br_recv(struct bt_conn *conn, struct net_buf *buf); diff --git a/subsys/bluetooth/host/log.c b/subsys/bluetooth/host/log.c index d20928f7cf8..eaa5a5604da 100644 --- a/subsys/bluetooth/host/log.c +++ b/subsys/bluetooth/host/log.c @@ -20,8 +20,8 @@ const char *bt_hex(const void *buf, size_t len) { static const char hex[] = "0123456789abcdef"; static char hexbufs[4][129]; - static uint8_t curbuf; - const uint8_t *b = buf; + static u8_t curbuf; + const u8_t *b = buf; unsigned int mask; char *str; int i; diff --git a/subsys/bluetooth/host/monitor.c b/subsys/bluetooth/host/monitor.c index 014b4bc42c3..6ea68b6417c 100644 --- a/subsys/bluetooth/host/monitor.c +++ b/subsys/bluetooth/host/monitor.c @@ -54,14 +54,14 @@ extern int _prf(int (*func)(), void *dest, static void monitor_send(const void *data, size_t len) { - const uint8_t *buf = data; + const u8_t *buf = data; while (len--) { uart_poll_out(monitor_dev, *buf++); } } -static void encode_drops(struct bt_monitor_hdr *hdr, uint8_t type, +static void encode_drops(struct bt_monitor_hdr *hdr, u8_t type, atomic_t *val) { atomic_val_t count; @@ -73,8 +73,8 @@ static void encode_drops(struct bt_monitor_hdr *hdr, uint8_t type, } } -static inline void encode_hdr(struct bt_monitor_hdr *hdr, uint16_t opcode, - uint16_t len) +static inline void encode_hdr(struct bt_monitor_hdr *hdr, u16_t opcode, + u16_t len) { struct bt_monitor_ts32 *ts; @@ -105,7 +105,7 @@ static int log_out(int c, void *unused) return 0; } -static void drop_add(uint16_t opcode) +static void drop_add(u16_t opcode) { switch (opcode) { case BT_MONITOR_COMMAND_PKT: @@ -175,7 +175,7 @@ void bt_log(int prio, const char *fmt, ...) atomic_clear_bit(&flags, BT_LOG_BUSY); } -void bt_monitor_send(uint16_t opcode, const void *data, size_t len) +void bt_monitor_send(u16_t opcode, const void *data, size_t len) { struct bt_monitor_hdr hdr; @@ -192,7 +192,7 @@ void bt_monitor_send(uint16_t opcode, const void *data, size_t len) atomic_clear_bit(&flags, BT_LOG_BUSY); } -void bt_monitor_new_index(uint8_t type, uint8_t bus, bt_addr_t *addr, +void bt_monitor_new_index(u8_t type, u8_t bus, bt_addr_t *addr, const char *name) { struct bt_monitor_new_index pkt; diff --git a/subsys/bluetooth/host/monitor.h b/subsys/bluetooth/host/monitor.h index a52aa915a19..1fcb998cc26 100644 --- a/subsys/bluetooth/host/monitor.h +++ b/subsys/bluetooth/host/monitor.h @@ -48,32 +48,32 @@ #endif struct bt_monitor_hdr { - uint16_t data_len; - uint16_t opcode; - uint8_t flags; - uint8_t hdr_len; + u16_t data_len; + u16_t opcode; + u8_t flags; + u8_t hdr_len; - uint8_t ext[BT_MONITOR_EXT_HDR_MAX]; + u8_t ext[BT_MONITOR_EXT_HDR_MAX]; } __packed; struct bt_monitor_ts32 { - uint8_t type; - uint32_t ts32; + u8_t type; + u32_t ts32; } __packed; struct bt_monitor_new_index { - uint8_t type; - uint8_t bus; - uint8_t bdaddr[6]; + u8_t type; + u8_t bus; + u8_t bdaddr[6]; char name[8]; } __packed; struct bt_monitor_user_logging { - uint8_t priority; - uint8_t ident_len; + u8_t priority; + u8_t ident_len; } __packed; -static inline uint8_t bt_monitor_opcode(struct net_buf *buf) +static inline u8_t bt_monitor_opcode(struct net_buf *buf) { switch (bt_buf_get_type(buf)) { case BT_BUF_CMD: @@ -89,9 +89,9 @@ static inline uint8_t bt_monitor_opcode(struct net_buf *buf) } } -void bt_monitor_send(uint16_t opcode, const void *data, size_t len); +void bt_monitor_send(u16_t opcode, const void *data, size_t len); -void bt_monitor_new_index(uint8_t type, uint8_t bus, bt_addr_t *addr, +void bt_monitor_new_index(u8_t type, u8_t bus, bt_addr_t *addr, const char *name); #else /* !CONFIG_BLUETOOTH_DEBUG_MONITOR */ diff --git a/subsys/bluetooth/host/rfcomm.c b/subsys/bluetooth/host/rfcomm.c index 663faa0f922..250ca433195 100644 --- a/subsys/bluetooth/host/rfcomm.c +++ b/subsys/bluetooth/host/rfcomm.c @@ -57,7 +57,7 @@ NET_BUF_POOL_DEFINE(dummy_pool, CONFIG_BLUETOOTH_MAX_CONN, 0, 0, NULL); static struct bt_rfcomm_session bt_rfcomm_pool[CONFIG_BLUETOOTH_MAX_CONN]; /* reversed, 8-bit, poly=0x07 */ -static const uint8_t rfcomm_crc_table[256] = { +static const u8_t rfcomm_crc_table[256] = { 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b, 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69, @@ -99,9 +99,9 @@ static const uint8_t rfcomm_crc_table[256] = { 0xba, 0x2b, 0x59, 0xc8, 0xbd, 0x2c, 0x5e, 0xcf }; -static uint8_t rfcomm_calc_fcs(uint16_t len, const uint8_t *data) +static u8_t rfcomm_calc_fcs(u16_t len, const u8_t *data) { - uint8_t fcs = 0xff; + u8_t fcs = 0xff; while (len--) { fcs = rfcomm_crc_table[fcs ^ *data++]; @@ -111,10 +111,10 @@ static uint8_t rfcomm_calc_fcs(uint16_t len, const uint8_t *data) return (0xff - fcs); } -static bool rfcomm_check_fcs(uint16_t len, const uint8_t *data, - uint8_t recvd_fcs) +static bool rfcomm_check_fcs(u16_t len, const u8_t *data, + u8_t recvd_fcs) { - uint8_t fcs = 0xff; + u8_t fcs = 0xff; while (len--) { fcs = rfcomm_crc_table[fcs ^ *data++]; @@ -128,7 +128,7 @@ static bool rfcomm_check_fcs(uint16_t len, const uint8_t *data, } static struct bt_rfcomm_dlc *rfcomm_dlcs_lookup_dlci(struct bt_rfcomm_dlc *dlcs, - uint8_t dlci) + u8_t dlci) { for (; dlcs; dlcs = dlcs->_next) { if (dlcs->dlci == dlci) { @@ -140,7 +140,7 @@ static struct bt_rfcomm_dlc *rfcomm_dlcs_lookup_dlci(struct bt_rfcomm_dlc *dlcs, } static struct bt_rfcomm_dlc *rfcomm_dlcs_remove_dlci(struct bt_rfcomm_dlc *dlcs, - uint8_t dlci) + u8_t dlci) { struct bt_rfcomm_dlc *tmp; @@ -165,7 +165,7 @@ static struct bt_rfcomm_dlc *rfcomm_dlcs_remove_dlci(struct bt_rfcomm_dlc *dlcs, return NULL; } -static struct bt_rfcomm_server *rfcomm_server_lookup_channel(uint8_t channel) +static struct bt_rfcomm_server *rfcomm_server_lookup_channel(u8_t channel) { struct bt_rfcomm_server *server; @@ -216,7 +216,7 @@ int bt_rfcomm_server_register(struct bt_rfcomm_server *server) } static void rfcomm_dlc_tx_give_credits(struct bt_rfcomm_dlc *dlc, - uint8_t credits) + u8_t credits) { BT_DBG("dlc %p credits %u", dlc, credits); @@ -245,7 +245,7 @@ static void rfcomm_dlc_destroy(struct bt_rfcomm_dlc *dlc) static void rfcomm_dlc_disconnect(struct bt_rfcomm_dlc *dlc) { - uint8_t old_state = dlc->state; + u8_t old_state = dlc->state; BT_DBG("dlc %p", dlc); @@ -311,11 +311,11 @@ struct net_buf *bt_rfcomm_create_pdu(struct net_buf_pool *pool) sizeof(struct bt_rfcomm_hdr) + 1); } -static int rfcomm_send_sabm(struct bt_rfcomm_session *session, uint8_t dlci) +static int rfcomm_send_sabm(struct bt_rfcomm_session *session, u8_t dlci) { struct bt_rfcomm_hdr *hdr; struct net_buf *buf; - uint8_t cr, fcs; + u8_t cr, fcs; buf = bt_l2cap_create_pdu(NULL, 0); @@ -331,11 +331,11 @@ static int rfcomm_send_sabm(struct bt_rfcomm_session *session, uint8_t dlci) return bt_l2cap_chan_send(&session->br_chan.chan, buf); } -static int rfcomm_send_disc(struct bt_rfcomm_session *session, uint8_t dlci) +static int rfcomm_send_disc(struct bt_rfcomm_session *session, u8_t dlci) { struct bt_rfcomm_hdr *hdr; struct net_buf *buf; - uint8_t fcs, cr; + u8_t fcs, cr; BT_DBG("dlci %d", dlci); @@ -364,13 +364,13 @@ static void rfcomm_session_disconnect(struct bt_rfcomm_session *session) } static struct net_buf *rfcomm_make_uih_msg(struct bt_rfcomm_session *session, - uint8_t cr, uint8_t type, - uint8_t len) + u8_t cr, u8_t type, + u8_t len) { struct bt_rfcomm_hdr *hdr; struct bt_rfcomm_msg_hdr *msg_hdr; struct net_buf *buf; - uint8_t hdr_cr; + u8_t hdr_cr; buf = bt_l2cap_create_pdu(NULL, 0); @@ -428,7 +428,7 @@ static void rfcomm_dlc_rtx_timeout(struct k_work *work) static void rfcomm_dlc_init(struct bt_rfcomm_dlc *dlc, struct bt_rfcomm_session *session, - uint8_t dlci, + u8_t dlci, bt_rfcomm_role_t role) { BT_DBG("dlc %p", dlc); @@ -448,11 +448,11 @@ static void rfcomm_dlc_init(struct bt_rfcomm_dlc *dlc, } static struct bt_rfcomm_dlc *rfcomm_dlc_accept(struct bt_rfcomm_session *session, - uint8_t dlci) + u8_t dlci) { struct bt_rfcomm_server *server; struct bt_rfcomm_dlc *dlc; - uint8_t channel; + u8_t channel; channel = BT_RFCOMM_GET_CHANNEL(dlci); server = rfcomm_server_lookup_channel(channel); @@ -477,11 +477,11 @@ static struct bt_rfcomm_dlc *rfcomm_dlc_accept(struct bt_rfcomm_session *session return dlc; } -static int rfcomm_send_dm(struct bt_rfcomm_session *session, uint8_t dlci) +static int rfcomm_send_dm(struct bt_rfcomm_session *session, u8_t dlci) { struct bt_rfcomm_hdr *hdr; struct net_buf *buf; - uint8_t fcs, cr; + u8_t fcs, cr; BT_DBG("dlci %d", dlci); @@ -525,7 +525,7 @@ static void rfcomm_check_fc(struct bt_rfcomm_dlc *dlc) static void rfcomm_dlc_tx_thread(void *p1, void *p2, void *p3) { struct bt_rfcomm_dlc *dlc = p1; - int32_t timeout = K_FOREVER; + s32_t timeout = K_FOREVER; struct net_buf *buf; BT_DBG("Started for dlc %p", dlc); @@ -585,11 +585,11 @@ static void rfcomm_dlc_tx_thread(void *p1, void *p2, void *p3) BT_DBG("dlc %p exiting", dlc); } -static int rfcomm_send_ua(struct bt_rfcomm_session *session, uint8_t dlci) +static int rfcomm_send_ua(struct bt_rfcomm_session *session, u8_t dlci) { struct bt_rfcomm_hdr *hdr; struct net_buf *buf; - uint8_t cr, fcs; + u8_t cr, fcs; buf = bt_l2cap_create_pdu(NULL, 0); @@ -605,12 +605,12 @@ static int rfcomm_send_ua(struct bt_rfcomm_session *session, uint8_t dlci) return bt_l2cap_chan_send(&session->br_chan.chan, buf); } -static int rfcomm_send_msc(struct bt_rfcomm_dlc *dlc, uint8_t cr, - uint8_t v24_signal) +static int rfcomm_send_msc(struct bt_rfcomm_dlc *dlc, u8_t cr, + u8_t v24_signal) { struct bt_rfcomm_msc *msc; struct net_buf *buf; - uint8_t fcs; + u8_t fcs; buf = rfcomm_make_uih_msg(dlc->session, cr, BT_RFCOMM_MSC, sizeof(*msc)); @@ -626,12 +626,12 @@ static int rfcomm_send_msc(struct bt_rfcomm_dlc *dlc, uint8_t cr, return bt_l2cap_chan_send(&dlc->session->br_chan.chan, buf); } -static int rfcomm_send_rls(struct bt_rfcomm_dlc *dlc, uint8_t cr, - uint8_t line_status) +static int rfcomm_send_rls(struct bt_rfcomm_dlc *dlc, u8_t cr, + u8_t line_status) { struct bt_rfcomm_rls *rls; struct net_buf *buf; - uint8_t fcs; + u8_t fcs; buf = rfcomm_make_uih_msg(dlc->session, cr, BT_RFCOMM_RLS, sizeof(*rls)); @@ -647,11 +647,11 @@ static int rfcomm_send_rls(struct bt_rfcomm_dlc *dlc, uint8_t cr, return bt_l2cap_chan_send(&dlc->session->br_chan.chan, buf); } -static int rfcomm_send_rpn(struct bt_rfcomm_session *session, uint8_t cr, +static int rfcomm_send_rpn(struct bt_rfcomm_session *session, u8_t cr, struct bt_rfcomm_rpn *rpn) { struct net_buf *buf; - uint8_t fcs; + u8_t fcs; buf = rfcomm_make_uih_msg(session, cr, BT_RFCOMM_RPN, sizeof(*rpn)); @@ -663,11 +663,11 @@ static int rfcomm_send_rpn(struct bt_rfcomm_session *session, uint8_t cr, return bt_l2cap_chan_send(&session->br_chan.chan, buf); } -static int rfcomm_send_test(struct bt_rfcomm_session *session, uint8_t cr, - uint8_t *pattern, uint8_t len) +static int rfcomm_send_test(struct bt_rfcomm_session *session, u8_t cr, + u8_t *pattern, u8_t len) { struct net_buf *buf; - uint8_t fcs; + u8_t fcs; buf = rfcomm_make_uih_msg(session, cr, BT_RFCOMM_TEST, len); @@ -679,10 +679,10 @@ static int rfcomm_send_test(struct bt_rfcomm_session *session, uint8_t cr, return bt_l2cap_chan_send(&session->br_chan.chan, buf); } -static int rfcomm_send_nsc(struct bt_rfcomm_session *session, uint8_t cmd_type) +static int rfcomm_send_nsc(struct bt_rfcomm_session *session, u8_t cmd_type) { struct net_buf *buf; - uint8_t fcs; + u8_t fcs; buf = rfcomm_make_uih_msg(session, BT_RFCOMM_MSG_RESP_CR, BT_RFCOMM_NSC, sizeof(cmd_type)); @@ -695,10 +695,10 @@ static int rfcomm_send_nsc(struct bt_rfcomm_session *session, uint8_t cmd_type) return bt_l2cap_chan_send(&session->br_chan.chan, buf); } -static int rfcomm_send_fcon(struct bt_rfcomm_session *session, uint8_t cr) +static int rfcomm_send_fcon(struct bt_rfcomm_session *session, u8_t cr) { struct net_buf *buf; - uint8_t fcs; + u8_t fcs; buf = rfcomm_make_uih_msg(session, cr, BT_RFCOMM_FCON, 0); @@ -708,10 +708,10 @@ static int rfcomm_send_fcon(struct bt_rfcomm_session *session, uint8_t cr) return bt_l2cap_chan_send(&session->br_chan.chan, buf); } -static int rfcomm_send_fcoff(struct bt_rfcomm_session *session, uint8_t cr) +static int rfcomm_send_fcoff(struct bt_rfcomm_session *session, u8_t cr) { struct net_buf *buf; - uint8_t fcs; + u8_t fcs; buf = rfcomm_make_uih_msg(session, cr, BT_RFCOMM_FCOFF, 0); @@ -835,7 +835,7 @@ static int rfcomm_dlc_close(struct bt_rfcomm_dlc *dlc) return 0; } -static void rfcomm_handle_sabm(struct bt_rfcomm_session *session, uint8_t dlci) +static void rfcomm_handle_sabm(struct bt_rfcomm_session *session, u8_t dlci) { if (!dlci) { if (rfcomm_send_ua(session, dlci) < 0) { @@ -881,11 +881,11 @@ static void rfcomm_handle_sabm(struct bt_rfcomm_session *session, uint8_t dlci) } } -static int rfcomm_send_pn(struct bt_rfcomm_dlc *dlc, uint8_t cr) +static int rfcomm_send_pn(struct bt_rfcomm_dlc *dlc, u8_t cr) { struct bt_rfcomm_pn *pn; struct net_buf *buf; - uint8_t fcs; + u8_t fcs; buf = rfcomm_make_uih_msg(dlc->session, cr, BT_RFCOMM_PN, sizeof(*pn)); @@ -920,11 +920,11 @@ static int rfcomm_send_pn(struct bt_rfcomm_dlc *dlc, uint8_t cr) return bt_l2cap_chan_send(&dlc->session->br_chan.chan, buf); } -static int rfcomm_send_credit(struct bt_rfcomm_dlc *dlc, uint8_t credits) +static int rfcomm_send_credit(struct bt_rfcomm_dlc *dlc, u8_t credits) { struct bt_rfcomm_hdr *hdr; struct net_buf *buf; - uint8_t fcs, cr; + u8_t fcs, cr; BT_DBG("Dlc %p credits %d", dlc, credits); @@ -967,7 +967,7 @@ static int rfcomm_dlc_start(struct bt_rfcomm_dlc *dlc) return 0; } -static void rfcomm_handle_ua(struct bt_rfcomm_session *session, uint8_t dlci) +static void rfcomm_handle_ua(struct bt_rfcomm_session *session, u8_t dlci) { struct bt_rfcomm_dlc *dlc, *next; int err; @@ -1020,7 +1020,7 @@ static void rfcomm_handle_ua(struct bt_rfcomm_session *session, uint8_t dlci) } } -static void rfcomm_handle_dm(struct bt_rfcomm_session *session, uint8_t dlci) +static void rfcomm_handle_dm(struct bt_rfcomm_session *session, u8_t dlci) { struct bt_rfcomm_dlc *dlc; @@ -1036,11 +1036,11 @@ static void rfcomm_handle_dm(struct bt_rfcomm_session *session, uint8_t dlci) } static void rfcomm_handle_msc(struct bt_rfcomm_session *session, - struct net_buf *buf, uint8_t cr) + struct net_buf *buf, u8_t cr) { struct bt_rfcomm_msc *msc = (void *)buf->data; struct bt_rfcomm_dlc *dlc; - uint8_t dlci = BT_RFCOMM_GET_DLCI(msc->dlci); + u8_t dlci = BT_RFCOMM_GET_DLCI(msc->dlci); BT_DBG("dlci %d", dlci); @@ -1076,10 +1076,10 @@ static void rfcomm_handle_msc(struct bt_rfcomm_session *session, } static void rfcomm_handle_rls(struct bt_rfcomm_session *session, - struct net_buf *buf, uint8_t cr) + struct net_buf *buf, u8_t cr) { struct bt_rfcomm_rls *rls = (void *)buf->data; - uint8_t dlci = BT_RFCOMM_GET_DLCI(rls->dlci); + u8_t dlci = BT_RFCOMM_GET_DLCI(rls->dlci); struct bt_rfcomm_dlc *dlc; BT_DBG("dlci %d", dlci); @@ -1099,13 +1099,13 @@ static void rfcomm_handle_rls(struct bt_rfcomm_session *session, } static void rfcomm_handle_rpn(struct bt_rfcomm_session *session, - struct net_buf *buf, uint8_t cr) + struct net_buf *buf, u8_t cr) { struct bt_rfcomm_rpn default_rpn, *rpn = (void *)buf->data; - uint8_t dlci = BT_RFCOMM_GET_DLCI(rpn->dlci); - uint8_t data_bits, stop_bits, parity_bits; + u8_t dlci = BT_RFCOMM_GET_DLCI(rpn->dlci); + u8_t data_bits, stop_bits, parity_bits; /* Exclude fcs to get number of value bytes */ - uint8_t value_len = buf->len - 1; + u8_t value_len = buf->len - 1; BT_DBG("dlci %d", dlci); @@ -1145,7 +1145,7 @@ static void rfcomm_handle_rpn(struct bt_rfcomm_session *session, } static void rfcomm_handle_pn(struct bt_rfcomm_session *session, - struct net_buf *buf, uint8_t cr) + struct net_buf *buf, u8_t cr) { struct bt_rfcomm_pn *pn = (void *)buf->data; struct bt_rfcomm_dlc *dlc; @@ -1219,7 +1219,7 @@ static void rfcomm_handle_pn(struct bt_rfcomm_session *session, } } -static void rfcomm_handle_disc(struct bt_rfcomm_session *session, uint8_t dlci) +static void rfcomm_handle_disc(struct bt_rfcomm_session *session, u8_t dlci) { struct bt_rfcomm_dlc *dlc; @@ -1252,7 +1252,7 @@ static void rfcomm_handle_msg(struct bt_rfcomm_session *session, struct net_buf *buf) { struct bt_rfcomm_msg_hdr *hdr = (void *)buf->data; - uint8_t msg_type, len, cr; + u8_t msg_type, len, cr; msg_type = BT_RFCOMM_GET_MSG_TYPE(hdr->type); cr = BT_RFCOMM_GET_MSG_CR(hdr->type); @@ -1326,7 +1326,7 @@ static void rfcomm_handle_msg(struct bt_rfcomm_session *session, static void rfcomm_dlc_update_credits(struct bt_rfcomm_dlc *dlc) { - uint8_t credits; + u8_t credits; if (dlc->session->cfc == BT_RFCOMM_CFC_NOT_SUPPORTED) { return; @@ -1347,7 +1347,7 @@ static void rfcomm_dlc_update_credits(struct bt_rfcomm_dlc *dlc) } static void rfcomm_handle_data(struct bt_rfcomm_session *session, - struct net_buf *buf, uint8_t dlci, uint8_t pf) + struct net_buf *buf, u8_t dlci, u8_t pf) { struct bt_rfcomm_dlc *dlc; @@ -1393,7 +1393,7 @@ static void rfcomm_handle_data(struct bt_rfcomm_session *session, int bt_rfcomm_dlc_send(struct bt_rfcomm_dlc *dlc, struct net_buf *buf) { struct bt_rfcomm_hdr *hdr; - uint8_t fcs, cr; + u8_t fcs, cr; if (!buf) { return -EINVAL; @@ -1410,11 +1410,11 @@ int bt_rfcomm_dlc_send(struct bt_rfcomm_dlc *dlc, struct net_buf *buf) } if (buf->len > BT_RFCOMM_MAX_LEN_8) { - uint16_t *len; + u16_t *len; /* Length is 2 byte */ hdr = net_buf_push(buf, sizeof(*hdr) + 1); - len = (uint16_t *)&hdr->length; + len = (u16_t *)&hdr->length; *len = BT_RFCOMM_SET_LEN_16(sys_cpu_to_le16(buf->len - sizeof(*hdr) + 1)); } else { @@ -1439,7 +1439,7 @@ static void rfcomm_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) { struct bt_rfcomm_session *session = RFCOMM_SESSION(chan); struct bt_rfcomm_hdr *hdr = (void *)buf->data; - uint8_t dlci, frame_type, fcs, fcs_len; + u8_t dlci, frame_type, fcs, fcs_len; /* Need to consider FCS also*/ if (buf->len < (sizeof(*hdr) + 1)) { @@ -1495,7 +1495,7 @@ static void rfcomm_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) } static void rfcomm_encrypt_change(struct bt_l2cap_chan *chan, - uint8_t hci_status) + u8_t hci_status) { struct bt_rfcomm_session *session = RFCOMM_SESSION(chan); struct bt_conn *conn = chan->conn; @@ -1582,11 +1582,11 @@ static struct bt_rfcomm_session *rfcomm_session_new(bt_rfcomm_role_t role) } int bt_rfcomm_dlc_connect(struct bt_conn *conn, struct bt_rfcomm_dlc *dlc, - uint8_t channel) + u8_t channel) { struct bt_rfcomm_session *session; struct bt_l2cap_chan *chan; - uint8_t dlci; + u8_t dlci; int ret; BT_DBG("conn %p dlc %p channel %d", conn, dlc, channel); diff --git a/subsys/bluetooth/host/rfcomm_internal.h b/subsys/bluetooth/host/rfcomm_internal.h index 73c1dcc6437..524d57ef9b4 100644 --- a/subsys/bluetooth/host/rfcomm_internal.h +++ b/subsys/bluetooth/host/rfcomm_internal.h @@ -25,8 +25,8 @@ struct bt_rfcomm_session { /* Binary sem for aggregate fc */ struct k_sem fc; struct bt_rfcomm_dlc *dlcs; - uint16_t mtu; - uint8_t state; + u16_t mtu; + u8_t state; bt_rfcomm_role_t role; bt_rfcomm_cfc_t cfc; }; @@ -44,9 +44,9 @@ enum { }; struct bt_rfcomm_hdr { - uint8_t address; - uint8_t control; - uint8_t length; + u8_t address; + u8_t control; + u8_t length; } __packed; #define BT_RFCOMM_SABM 0x2f @@ -54,25 +54,25 @@ struct bt_rfcomm_hdr { #define BT_RFCOMM_UIH 0xef struct bt_rfcomm_msg_hdr { - uint8_t type; - uint8_t len; + u8_t type; + u8_t len; } __packed; #define BT_RFCOMM_PN 0x20 struct bt_rfcomm_pn { - uint8_t dlci; - uint8_t flow_ctrl; - uint8_t priority; - uint8_t ack_timer; - uint16_t mtu; - uint8_t max_retrans; - uint8_t credits; + u8_t dlci; + u8_t flow_ctrl; + u8_t priority; + u8_t ack_timer; + u16_t mtu; + u8_t max_retrans; + u8_t credits; } __packed; #define BT_RFCOMM_MSC 0x38 struct bt_rfcomm_msc { - uint8_t dlci; - uint8_t v24_signal; + u8_t dlci; + u8_t v24_signal; } __packed; #define BT_RFCOMM_DISC 0x43 @@ -80,19 +80,19 @@ struct bt_rfcomm_msc { #define BT_RFCOMM_RLS 0x14 struct bt_rfcomm_rls { - uint8_t dlci; - uint8_t line_status; + u8_t dlci; + u8_t line_status; } __packed; #define BT_RFCOMM_RPN 0x24 struct bt_rfcomm_rpn { - uint8_t dlci; - uint8_t baud_rate; - uint8_t line_settings; - uint8_t flow_control; - uint8_t xon_char; - uint8_t xoff_char; - uint16_t param_mask; + u8_t dlci; + u8_t baud_rate; + u8_t line_settings; + u8_t flow_control; + u8_t xon_char; + u8_t xoff_char; + u16_t param_mask; } __packed; #define BT_RFCOMM_TEST 0x08 diff --git a/subsys/bluetooth/host/sdp.c b/subsys/bluetooth/host/sdp.c index e2a521b2ab7..e9d19476bb5 100644 --- a/subsys/bluetooth/host/sdp.c +++ b/subsys/bluetooth/host/sdp.c @@ -58,7 +58,7 @@ struct bt_sdp { }; static struct bt_sdp_record *db; -static uint8_t num_services; +static u8_t num_services; static struct bt_sdp bt_sdp_pool[CONFIG_BLUETOOTH_MAX_CONN]; @@ -75,7 +75,7 @@ struct bt_sdp_client { /* list of waiting to be resolved UUID params */ sys_slist_t reqs; /* required SDP transaction ID */ - uint16_t tid; + u16_t tid; /* UUID params holder being now resolved */ const struct bt_sdp_discover_params *param; /* PDU continuation state object */ @@ -92,9 +92,9 @@ enum { }; struct search_state { - uint16_t att_list_size; - uint8_t current_svc; - uint8_t last_att; + u16_t att_list_size; + u8_t current_svc; + u8_t last_att; bool pkt_full; }; @@ -104,11 +104,11 @@ struct select_attrs_data { struct bt_sdp *sdp; struct bt_sdp_data_elem_seq *seq; struct search_state *state; - uint32_t *filter; - uint16_t max_att_len; - uint16_t att_list_len; - uint8_t cont_state_size; - uint8_t num_filters; + u32_t *filter; + u16_t max_att_len; + u16_t att_list_len; + u8_t cont_state_size; + u8_t num_filters; bool new_service; }; @@ -122,8 +122,8 @@ struct select_attrs_data { * @return BT_SDP_ITER_CONTINUE if should continue to the next attribute * or BT_SDP_ITER_STOP to stop. */ -typedef uint8_t (*bt_sdp_attr_func_t)(struct bt_sdp_attribute *attr, - uint8_t att_idx, void *user_data); +typedef u8_t (*bt_sdp_attr_func_t)(struct bt_sdp_attribute *attr, + u8_t att_idx, void *user_data); /* @typedef bt_sdp_svc_func_t * @brief SDP service record iterator callback. @@ -134,7 +134,7 @@ typedef uint8_t (*bt_sdp_attr_func_t)(struct bt_sdp_attribute *attr, * @return BT_SDP_ITER_CONTINUE if should continue to the next service record * or BT_SDP_ITER_STOP to stop. */ -typedef uint8_t (*bt_sdp_svc_func_t)(struct bt_sdp_record *rec, +typedef u8_t (*bt_sdp_svc_func_t)(struct bt_sdp_record *rec, void *user_data); /* @brief Callback for SDP connection @@ -204,10 +204,10 @@ static struct net_buf *bt_sdp_create_pdu(void) * @return None */ static void bt_sdp_send(struct bt_l2cap_chan *chan, struct net_buf *buf, - uint8_t op, uint16_t tid) + u8_t op, u16_t tid) { struct bt_sdp_hdr *hdr; - uint16_t param_len = buf->len; + u16_t param_len = buf->len; hdr = net_buf_push(buf, sizeof(struct bt_sdp_hdr)); hdr->op_code = op; @@ -227,8 +227,8 @@ static void bt_sdp_send(struct bt_l2cap_chan *chan, struct net_buf *buf, * * @return None */ -static void send_err_rsp(struct bt_l2cap_chan *chan, uint16_t err, - uint16_t tid) +static void send_err_rsp(struct bt_l2cap_chan *chan, u16_t err, + u16_t tid) { struct net_buf *buf; @@ -252,10 +252,10 @@ static void send_err_rsp(struct bt_l2cap_chan *chan, uint16_t err, * * @return 0 for success, or relevant error code */ -static uint16_t parse_data_elem(struct net_buf *buf, +static u16_t parse_data_elem(struct net_buf *buf, struct bt_sdp_data_elem *data_elem) { - uint8_t size_field_len = 0; /* Space used to accommodate the size */ + u8_t size_field_len = 0; /* Space used to accommodate the size */ if (buf->len < 1) { BT_WARN("Malformed packet"); @@ -328,11 +328,11 @@ static uint16_t parse_data_elem(struct net_buf *buf, * @return Size of the last data element that has been searched * (used in recursion) */ -static uint32_t search_uuid(struct bt_sdp_data_elem *elem, struct bt_uuid *uuid, - bool *found, uint8_t nest_level) +static u32_t search_uuid(struct bt_sdp_data_elem *elem, struct bt_uuid *uuid, + bool *found, u8_t nest_level) { - const uint8_t *cur_elem; - uint32_t seq_size, size; + const u8_t *cur_elem; + u32_t seq_size, size; union { struct bt_uuid uuid; struct bt_uuid_16 u16; @@ -355,13 +355,13 @@ static uint32_t search_uuid(struct bt_sdp_data_elem *elem, struct bt_uuid *uuid, if ((elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_UUID_UNSPEC) { if (seq_size == 2) { u.uuid.type = BT_UUID_TYPE_16; - u.u16.val = *((uint16_t *)cur_elem); + u.u16.val = *((u16_t *)cur_elem); if (!bt_uuid_cmp(&u.uuid, uuid)) { *found = true; } } else if (seq_size == 4) { u.uuid.type = BT_UUID_TYPE_32; - u.u32.val = *((uint32_t *)cur_elem); + u.u32.val = *((u32_t *)cur_elem); if (!bt_uuid_cmp(&u.uuid, uuid)) { *found = true; } @@ -428,7 +428,7 @@ static struct bt_sdp_record *bt_sdp_foreach_svc(bt_sdp_svc_func_t func, * * @return BT_SDP_ITER_CONTINUE to move on to the next record. */ -static uint8_t insert_record(struct bt_sdp_record *rec, void *user_data) +static u8_t insert_record(struct bt_sdp_record *rec, void *user_data) { struct bt_sdp_record **rec_list = user_data; @@ -450,14 +450,14 @@ static uint8_t insert_record(struct bt_sdp_record *rec, void *user_data) * * @return 0 for success, or relevant error code */ -static uint16_t find_services(struct net_buf *buf, +static u16_t find_services(struct net_buf *buf, struct bt_sdp_record **matching_recs) { struct bt_sdp_data_elem data_elem; struct bt_sdp_record *record; - uint32_t uuid_list_size; - uint16_t res; - uint8_t att_idx, rec_idx = 0; + u32_t uuid_list_size; + u16_t res; + u8_t att_idx, rec_idx = 0; bool found; union { struct bt_uuid uuid; @@ -564,15 +564,15 @@ static uint16_t find_services(struct net_buf *buf, * * @return 0 for success, or relevant error code */ -static uint16_t sdp_svc_search_req(struct bt_sdp *sdp, struct net_buf *buf, - uint16_t tid) +static u16_t sdp_svc_search_req(struct bt_sdp *sdp, struct net_buf *buf, + u16_t tid) { struct bt_sdp_svc_rsp *rsp; struct net_buf *resp_buf; struct bt_sdp_record *record; struct bt_sdp_record *matching_recs[BT_SDP_MAX_SERVICES]; - uint16_t max_rec_count, total_recs = 0, current_recs = 0, res; - uint8_t cont_state_size, cont_state = 0, idx = 0, count = 0; + u16_t max_rec_count, total_recs = 0, current_recs = 0, res; + u8_t cont_state_size, cont_state = 0, idx = 0, count = 0; bool pkt_full = false; res = find_services(buf, matching_recs); @@ -700,11 +700,11 @@ static uint16_t sdp_svc_search_req(struct bt_sdp *sdp, struct net_buf *buf, * @return Size of the last data element that has been searched * (used in recursion) */ -static uint32_t copy_attribute(struct bt_sdp_data_elem *elem, - struct net_buf *buf, uint8_t nest_level) +static u32_t copy_attribute(struct bt_sdp_data_elem *elem, + struct net_buf *buf, u8_t nest_level) { - const uint8_t *cur_elem; - uint32_t size, seq_size, total_size; + const u8_t *cur_elem; + u32_t size, seq_size, total_size; /* Limit recursion depth to avoid stack overflows */ if (nest_level == SDP_DATA_ELEM_NEST_LEVEL_MAX) { @@ -745,11 +745,11 @@ static uint32_t copy_attribute(struct bt_sdp_data_elem *elem, (elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_INT8 || (elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_UUID_UNSPEC) { if (seq_size == 1) { - net_buf_add_u8(buf, *((uint8_t *)elem->data)); + net_buf_add_u8(buf, *((u8_t *)elem->data)); } else if (seq_size == 2) { - net_buf_add_be16(buf, *((uint16_t *)elem->data)); + net_buf_add_be16(buf, *((u16_t *)elem->data)); } else if (seq_size == 4) { - net_buf_add_be32(buf, *((uint32_t *)elem->data)); + net_buf_add_be32(buf, *((u32_t *)elem->data)); } else { /* TODO: Convert 32bit and 128bit values to big-endian*/ net_buf_add_mem(buf, elem->data, seq_size); @@ -772,7 +772,7 @@ static uint32_t copy_attribute(struct bt_sdp_data_elem *elem, * * @return Index of the attribute where the iterator stopped */ -static uint8_t bt_sdp_foreach_attr(struct bt_sdp_record *record, uint8_t idx, +static u8_t bt_sdp_foreach_attr(struct bt_sdp_record *record, u8_t idx, bt_sdp_attr_func_t func, void *user_data) { for (; idx < record->attr_count; idx++) { @@ -798,13 +798,13 @@ static uint8_t bt_sdp_foreach_attr(struct bt_sdp_record *record, uint8_t idx, * @return BT_SDP_ITER_CONTINUE if should continue to the next attribute * or BT_SDP_ITER_STOP to stop. */ -static uint8_t select_attrs(struct bt_sdp_attribute *attr, uint8_t att_idx, +static u8_t select_attrs(struct bt_sdp_attribute *attr, u8_t att_idx, void *user_data) { struct select_attrs_data *sad = user_data; - uint16_t att_id_lower, att_id_upper, att_id_cur, space; - uint32_t attr_size, seq_size; - uint8_t idx_filter; + u16_t att_id_lower, att_id_upper, att_id_cur, space; + u32_t attr_size, seq_size; + u8_t idx_filter; for (idx_filter = 0; idx_filter < sad->num_filters; idx_filter++) { @@ -928,15 +928,15 @@ static uint8_t select_attrs(struct bt_sdp_attribute *attr, uint8_t att_idx, * * @return len Length of the attribute list created */ -static uint16_t create_attr_list(struct bt_sdp *sdp, +static u16_t create_attr_list(struct bt_sdp *sdp, struct bt_sdp_record *record, - uint32_t *filter, uint8_t num_filters, - uint16_t max_att_len, uint8_t cont_state_size, - uint8_t next_att, struct search_state *state, + u32_t *filter, u8_t num_filters, + u16_t max_att_len, u8_t cont_state_size, + u8_t next_att, struct search_state *state, struct net_buf *rsp_buf) { struct select_attrs_data sad; - uint8_t idx_att; + u8_t idx_att; sad.num_filters = num_filters; sad.rec = record; @@ -973,12 +973,12 @@ static uint16_t create_attr_list(struct bt_sdp *sdp, * * @return 0 for success, or relevant error code */ -static uint16_t get_att_search_list(struct net_buf *buf, uint32_t *filter, - uint8_t *num_filters) +static u16_t get_att_search_list(struct net_buf *buf, u32_t *filter, + u8_t *num_filters) { struct bt_sdp_data_elem data_elem; - uint16_t res; - uint32_t size; + u16_t res; + u32_t size; *num_filters = 0; res = parse_data_elem(buf, &data_elem); @@ -1032,9 +1032,9 @@ static uint16_t get_att_search_list(struct net_buf *buf, uint32_t *filter, * @return BT_SDP_ITER_CONTINUE if should continue to the next record * or BT_SDP_ITER_STOP to stop. */ -static uint8_t find_handle(struct bt_sdp_record *rec, void *user_data) +static u8_t find_handle(struct bt_sdp_record *rec, void *user_data) { - uint32_t *svc_rec_hdl = user_data; + u32_t *svc_rec_hdl = user_data; if (rec->handle == *svc_rec_hdl) { return BT_SDP_ITER_STOP; @@ -1053,10 +1053,10 @@ static uint8_t find_handle(struct bt_sdp_record *rec, void *user_data) * * @return 0 for success, or relevant error code */ -static uint16_t sdp_svc_att_req(struct bt_sdp *sdp, struct net_buf *buf, - uint16_t tid) +static u16_t sdp_svc_att_req(struct bt_sdp *sdp, struct net_buf *buf, + u16_t tid) { - uint32_t filter[MAX_NUM_ATT_ID_FILTER]; + u32_t filter[MAX_NUM_ATT_ID_FILTER]; struct search_state state = { .current_svc = SDP_INVALID, .last_att = SDP_INVALID, @@ -1065,9 +1065,9 @@ static uint16_t sdp_svc_att_req(struct bt_sdp *sdp, struct net_buf *buf, struct bt_sdp_record *record; struct bt_sdp_att_rsp *rsp; struct net_buf *rsp_buf; - uint32_t svc_rec_hdl; - uint16_t max_att_len, res, att_list_len; - uint8_t num_filters, cont_state_size, next_att = 0; + u32_t svc_rec_hdl; + u16_t max_att_len, res, att_list_len; + u8_t num_filters, cont_state_size, next_att = 0; if (buf->len < 6) { BT_WARN("Malformed packet"); @@ -1167,10 +1167,10 @@ static uint16_t sdp_svc_att_req(struct bt_sdp *sdp, struct net_buf *buf, * * @return 0 for success, or relevant error code */ -static uint16_t sdp_svc_search_att_req(struct bt_sdp *sdp, struct net_buf *buf, - uint16_t tid) +static u16_t sdp_svc_search_att_req(struct bt_sdp *sdp, struct net_buf *buf, + u16_t tid) { - uint32_t filter[MAX_NUM_ATT_ID_FILTER]; + u32_t filter[MAX_NUM_ATT_ID_FILTER]; struct bt_sdp_record *matching_recs[BT_SDP_MAX_SERVICES]; struct search_state state = { .att_list_size = 0, @@ -1182,8 +1182,8 @@ static uint16_t sdp_svc_search_att_req(struct bt_sdp *sdp, struct net_buf *buf, struct bt_sdp_record *record; struct bt_sdp_att_rsp *rsp; struct bt_sdp_data_elem_seq *seq = NULL; - uint16_t max_att_len, res, att_list_len = 0; - uint8_t num_filters, cont_state_size, next_svc = 0, next_att = 0; + u16_t max_att_len, res, att_list_len = 0; + u8_t num_filters, cont_state_size, next_svc = 0, next_att = 0; bool dry_run = false; res = find_services(buf, matching_recs); @@ -1312,9 +1312,9 @@ static uint16_t sdp_svc_search_att_req(struct bt_sdp *sdp, struct net_buf *buf, } static const struct { - uint8_t op_code; - uint16_t (*func)(struct bt_sdp *sdp, struct net_buf *buf, - uint16_t tid); + u8_t op_code; + u16_t (*func)(struct bt_sdp *sdp, struct net_buf *buf, + u16_t tid); } handlers[] = { { BT_SDP_SVC_SEARCH_REQ, sdp_svc_search_req }, { BT_SDP_SVC_ATTR_REQ, sdp_svc_att_req }, @@ -1337,7 +1337,7 @@ static void bt_sdp_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) struct bt_l2cap_br_chan, chan); struct bt_sdp *sdp = CONTAINER_OF(ch, struct bt_sdp, chan); struct bt_sdp_hdr *hdr = (struct bt_sdp_hdr *)buf->data; - uint16_t err = BT_SDP_INVALID_SYNTAX; + u16_t err = BT_SDP_INVALID_SYNTAX; size_t i; BT_DBG("chan %p, ch %p, cid 0x%04x", chan, ch, ch->tx.cid); @@ -1430,7 +1430,7 @@ void bt_sdp_init(void) int bt_sdp_register_service(struct bt_sdp_record *service) { - uint32_t handle = SDP_SERVICE_HANDLE_BASE; + u32_t handle = SDP_SERVICE_HANDLE_BASE; if (!service) { BT_ERR("No service record specified"); @@ -1449,7 +1449,7 @@ int bt_sdp_register_service(struct bt_sdp_record *service) service->next = db; service->index = num_services++; service->handle = handle; - *((uint32_t *)(service->attrs[0].val.data)) = handle; + *((u32_t *)(service->attrs[0].val.data)) = handle; db = service; BT_DBG("Service registered at %u", handle); @@ -1587,11 +1587,11 @@ static void sdp_client_params_iterator(struct bt_sdp_client *session) } } -static uint16_t sdp_client_get_total(struct bt_sdp_client *session, - struct net_buf *buf, uint16_t *total) +static u16_t sdp_client_get_total(struct bt_sdp_client *session, + struct net_buf *buf, u16_t *total) { - uint16_t pulled; - uint8_t seq; + u16_t pulled; + u8_t seq; /* * Pull value of total octets of all attributes available to be @@ -1627,10 +1627,10 @@ static uint16_t sdp_client_get_total(struct bt_sdp_client *session, return pulled; } -static uint16_t get_record_len(struct net_buf *buf) +static u16_t get_record_len(struct net_buf *buf) { - uint16_t len; - uint8_t seq; + u16_t len; + u8_t seq; seq = net_buf_pull_u8(buf); @@ -1662,8 +1662,8 @@ static void sdp_client_notify_result(struct bt_sdp_client *session, { struct bt_conn *conn = session->chan.chan.conn; struct bt_sdp_client_result result; - uint16_t rec_len; - uint8_t user_ret; + u16_t rec_len; + u8_t user_ret; result.uuid = session->param->uuid; @@ -1716,8 +1716,8 @@ static void sdp_client_receive(struct bt_l2cap_chan *chan, struct net_buf *buf) struct bt_sdp_client *session = SDP_CLIENT_CHAN(chan); struct bt_sdp_hdr *hdr = (void *)buf->data; struct bt_sdp_pdu_cstate *cstate; - uint16_t len, tid, frame_len; - uint16_t total; + u16_t len, tid, frame_len; + u16_t total; BT_DBG("session %p buf %p", session, buf); @@ -1953,7 +1953,7 @@ int bt_sdp_discover(struct bt_conn *conn, } /* Helper getting length of data determined by DTD for integers */ -static inline ssize_t sdp_get_int_len(const uint8_t *data, size_t len) +static inline ssize_t sdp_get_int_len(const u8_t *data, size_t len) { BT_ASSERT(data); @@ -2001,7 +2001,7 @@ static inline ssize_t sdp_get_int_len(const uint8_t *data, size_t len) } /* Helper getting length of data determined by DTD for UUID */ -static inline ssize_t sdp_get_uuid_len(const uint8_t *data, size_t len) +static inline ssize_t sdp_get_uuid_len(const u8_t *data, size_t len) { BT_ASSERT(data); @@ -2029,9 +2029,9 @@ static inline ssize_t sdp_get_uuid_len(const uint8_t *data, size_t len) } /* Helper getting length of data determined by DTD for strings */ -static inline ssize_t sdp_get_str_len(const uint8_t *data, size_t len) +static inline ssize_t sdp_get_str_len(const u8_t *data, size_t len) { - const uint8_t *pnext; + const u8_t *pnext; BT_ASSERT(data); @@ -2040,7 +2040,7 @@ static inline ssize_t sdp_get_str_len(const uint8_t *data, size_t len) goto err; } - pnext = data + sizeof(uint8_t); + pnext = data + sizeof(u8_t); switch (data[0]) { case BT_SDP_TEXT_STR8: @@ -2074,9 +2074,9 @@ err: } /* Helper getting length of data determined by DTD for sequences */ -static inline ssize_t sdp_get_seq_len(const uint8_t *data, size_t len) +static inline ssize_t sdp_get_seq_len(const u8_t *data, size_t len) { - const uint8_t *pnext; + const u8_t *pnext; BT_ASSERT(data); @@ -2085,7 +2085,7 @@ static inline ssize_t sdp_get_seq_len(const uint8_t *data, size_t len) goto err; } - pnext = data + sizeof(uint8_t); + pnext = data + sizeof(u8_t); switch (data[0]) { case BT_SDP_SEQ8: @@ -2119,7 +2119,7 @@ err: } /* Helper getting length of attribute value data */ -static ssize_t sdp_get_attr_value_len(const uint8_t *data, size_t len) +static ssize_t sdp_get_attr_value_len(const u8_t *data, size_t len) { BT_ASSERT(data); @@ -2170,28 +2170,28 @@ struct bt_sdp_uuid_desc { struct bt_uuid_16 uuid16; struct bt_uuid_32 uuid32; }; - uint16_t attr_id; - uint8_t *params; - uint16_t params_len; + u16_t attr_id; + u8_t *params; + u16_t params_len; }; /* Generic attribute item collector. */ struct bt_sdp_attr_item { /* Attribute identifier. */ - uint16_t attr_id; + u16_t attr_id; /* Address of beginning attribute value taken from original buffer * holding response from server. */ - uint8_t *val; + u8_t *val; /* Says about the length of attribute value. */ - uint16_t len; + u16_t len; }; static int bt_sdp_get_attr(const struct net_buf *buf, - struct bt_sdp_attr_item *attr, uint16_t attr_id) + struct bt_sdp_attr_item *attr, u16_t attr_id) { - uint8_t *data; - uint16_t id; + u8_t *data; + u16_t id; data = buf->data; while (data - buf->data < buf->len) { @@ -2203,10 +2203,10 @@ static int bt_sdp_get_attr(const struct net_buf *buf, return -EINVAL; } - data += sizeof(uint8_t); + data += sizeof(u8_t); id = sys_get_be16(data); BT_DBG("Attribute ID 0x%04x", id); - data += sizeof(uint16_t); + data += sizeof(u16_t); dlen = sdp_get_attr_value_len(data, buf->len - (data - buf->data)); @@ -2234,9 +2234,9 @@ static int bt_sdp_get_attr(const struct net_buf *buf, } /* reads SEQ item length, moves input buffer data reader forward */ -static ssize_t sdp_get_seq_len_item(uint8_t **data, size_t len) +static ssize_t sdp_get_seq_len_item(u8_t **data, size_t len) { - const uint8_t *pnext; + const u8_t *pnext; BT_ASSERT(data); BT_ASSERT(*data); @@ -2246,7 +2246,7 @@ static ssize_t sdp_get_seq_len_item(uint8_t **data, size_t len) goto err; } - pnext = *data + sizeof(uint8_t); + pnext = *data + sizeof(u8_t); switch (*data[0]) { case BT_SDP_SEQ8: @@ -2291,10 +2291,10 @@ err: static int sdp_get_uuid_data(const struct bt_sdp_attr_item *attr, struct bt_sdp_uuid_desc *pd, - uint16_t proto_profile) + u16_t proto_profile) { /* get start address of attribute value */ - uint8_t *p = attr->val; + u8_t *p = attr->val; ssize_t slen; BT_ASSERT(p); @@ -2331,8 +2331,8 @@ static int sdp_get_uuid_data(const struct bt_sdp_attr_item *attr, memcpy(&pd->uuid16, BT_UUID_DECLARE_16(sys_get_be16(++p)), sizeof(struct bt_uuid_16)); - p += sizeof(uint16_t); - left -= sizeof(uint16_t); + p += sizeof(u16_t); + left -= sizeof(u16_t); break; case BT_SDP_UUID32: /* check if valid UUID32 can be read safely */ @@ -2343,8 +2343,8 @@ static int sdp_get_uuid_data(const struct bt_sdp_attr_item *attr, memcpy(&pd->uuid32, BT_UUID_DECLARE_32(sys_get_be32(++p)), sizeof(struct bt_uuid_32)); - p += sizeof(uint32_t); - left -= sizeof(uint32_t); + p += sizeof(u32_t); + left -= sizeof(u32_t); break; default: BT_ERR("Invalid/unhandled DTD 0x%02x\n", p[0]); @@ -2379,9 +2379,9 @@ static int sdp_get_uuid_data(const struct bt_sdp_attr_item *attr, * Helper extracting specific parameters associated with UUID node given in * protocol descriptor list or profile descriptor list. */ -static int sdp_get_param_item(struct bt_sdp_uuid_desc *pd_item, uint16_t *param) +static int sdp_get_param_item(struct bt_sdp_uuid_desc *pd_item, u16_t *param) { - const uint8_t *p = pd_item->params; + const u8_t *p = pd_item->params; bool len_err = false; BT_ASSERT(p); @@ -2396,7 +2396,7 @@ static int sdp_get_param_item(struct bt_sdp_uuid_desc *pd_item, uint16_t *param) break; } *param = (++p)[0]; - p += sizeof(uint8_t); + p += sizeof(u8_t); break; case BT_SDP_UINT16: /* check if 16bits value can be read safely */ @@ -2405,7 +2405,7 @@ static int sdp_get_param_item(struct bt_sdp_uuid_desc *pd_item, uint16_t *param) break; } *param = sys_get_be16(++p); - p += sizeof(uint16_t); + p += sizeof(u16_t); break; case BT_SDP_UINT32: /* check if 32bits value can be read safely */ @@ -2414,7 +2414,7 @@ static int sdp_get_param_item(struct bt_sdp_uuid_desc *pd_item, uint16_t *param) break; } *param = sys_get_be32(++p); - p += sizeof(uint32_t); + p += sizeof(u32_t); break; default: BT_ERR("Invalid/unhandled DTD 0x%02x\n", p[0]); @@ -2433,7 +2433,7 @@ static int sdp_get_param_item(struct bt_sdp_uuid_desc *pd_item, uint16_t *param) } int bt_sdp_get_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto, - uint16_t *param) + u16_t *param) { struct bt_sdp_attr_item attr; struct bt_sdp_uuid_desc pd; @@ -2461,8 +2461,8 @@ int bt_sdp_get_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto, return sdp_get_param_item(&pd, param); } -int bt_sdp_get_profile_version(const struct net_buf *buf, uint16_t profile, - uint16_t *version) +int bt_sdp_get_profile_version(const struct net_buf *buf, u16_t profile, + u16_t *version) { struct bt_sdp_attr_item attr; struct bt_sdp_uuid_desc pd; @@ -2484,10 +2484,10 @@ int bt_sdp_get_profile_version(const struct net_buf *buf, uint16_t profile, return sdp_get_param_item(&pd, version); } -int bt_sdp_get_features(const struct net_buf *buf, uint16_t *features) +int bt_sdp_get_features(const struct net_buf *buf, u16_t *features) { struct bt_sdp_attr_item attr; - const uint8_t *p; + const u8_t *p; int res; res = bt_sdp_get_attr(buf, &attr, BT_SDP_ATTR_SUPPORTED_FEATURES); @@ -2512,7 +2512,7 @@ int bt_sdp_get_features(const struct net_buf *buf, uint16_t *features) } *features = sys_get_be16(++p); - p += sizeof(uint16_t); + p += sizeof(u16_t); if (p - attr.val != attr.len) { BT_ERR("Invalid data length %u", attr.len); diff --git a/subsys/bluetooth/host/sdp_internal.h b/subsys/bluetooth/host/sdp_internal.h index 1524318c4a1..fe4b6cb66a5 100644 --- a/subsys/bluetooth/host/sdp_internal.h +++ b/subsys/bluetooth/host/sdp_internal.h @@ -40,23 +40,23 @@ #define BT_SDP_MAX_SERVICES 10 struct bt_sdp_data_elem_seq { - uint8_t type; /* Type: Will be data element sequence */ - uint16_t size; /* We only support 2 byte sizes for now */ + u8_t type; /* Type: Will be data element sequence */ + u16_t size; /* We only support 2 byte sizes for now */ } __packed; struct bt_sdp_hdr { - uint8_t op_code; - uint16_t tid; - uint16_t param_len; + u8_t op_code; + u16_t tid; + u16_t param_len; } __packed; struct bt_sdp_svc_rsp { - uint16_t total_recs; - uint16_t current_recs; + u16_t total_recs; + u16_t current_recs; } __packed; struct bt_sdp_att_rsp { - uint16_t att_list_len; + u16_t att_list_len; } __packed; /* Allowed attributes length in SSA Request PDU to be taken from server */ @@ -67,8 +67,8 @@ struct bt_sdp_att_rsp { /* Type mapping SDP PDU Continuation State */ struct bt_sdp_pdu_cstate { - uint8_t length; - uint8_t data[BT_SDP_MAX_PDU_CSTATE_LEN]; + u8_t length; + u8_t data[BT_SDP_MAX_PDU_CSTATE_LEN]; } __packed; void bt_sdp_init(void); diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 477b040b034..61c3db47117 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -124,49 +124,49 @@ struct bt_smp { ATOMIC_DEFINE(flags, SMP_NUM_FLAGS); /* Type of method used for pairing */ - uint8_t method; + u8_t method; /* Pairing Request PDU */ - uint8_t preq[7]; + u8_t preq[7]; /* Pairing Response PDU */ - uint8_t prsp[7]; + u8_t prsp[7]; /* Pairing Confirm PDU */ - uint8_t pcnf[16]; + u8_t pcnf[16]; /* Local random number */ - uint8_t prnd[16]; + u8_t prnd[16]; /* Remote random number */ - uint8_t rrnd[16]; + u8_t rrnd[16]; /* Temporary key */ - uint8_t tk[16]; + u8_t tk[16]; /* Remote Public Key for LE SC */ - uint8_t pkey[64]; + u8_t pkey[64]; /* DHKey */ - uint8_t dhkey[32]; + u8_t dhkey[32]; /* Remote DHKey check */ - uint8_t e[16]; + u8_t e[16]; /* MacKey */ - uint8_t mackey[16]; + u8_t mackey[16]; /* LE SC passkey */ - uint32_t passkey; + u32_t passkey; /* LE SC passkey round */ - uint8_t passkey_round; + u8_t passkey_round; /* Local key distribution */ - uint8_t local_dist; + u8_t local_dist; /* Remote key distribution */ - uint8_t remote_dist; + u8_t remote_dist; /* Delayed work for timeout handling */ struct k_delayed_work work; @@ -174,7 +174,7 @@ struct bt_smp { #if !defined(CONFIG_BLUETOOTH_SMP_SC_ONLY) /* based on table 2.8 Core Spec 2.3.5.1 Vol. 3 Part H */ -static const uint8_t gen_method_legacy[5 /* remote */][5 /* local */] = { +static const u8_t gen_method_legacy[5 /* remote */][5 /* local */] = { { JUST_WORKS, JUST_WORKS, PASSKEY_INPUT, JUST_WORKS, PASSKEY_INPUT }, { JUST_WORKS, JUST_WORKS, PASSKEY_INPUT, JUST_WORKS, PASSKEY_INPUT }, { PASSKEY_DISPLAY, PASSKEY_DISPLAY, PASSKEY_INPUT, JUST_WORKS, @@ -186,7 +186,7 @@ static const uint8_t gen_method_legacy[5 /* remote */][5 /* local */] = { #endif /* CONFIG_BLUETOOTH_SMP_SC_ONLY */ /* based on table 2.8 Core Spec 2.3.5.1 Vol. 3 Part H */ -static const uint8_t gen_method_sc[5 /* remote */][5 /* local */] = { +static const u8_t gen_method_sc[5 /* remote */][5 /* local */] = { { JUST_WORKS, JUST_WORKS, PASSKEY_INPUT, JUST_WORKS, PASSKEY_INPUT }, { JUST_WORKS, PASSKEY_CONFIRM, PASSKEY_INPUT, JUST_WORKS, PASSKEY_CONFIRM }, @@ -197,7 +197,7 @@ static const uint8_t gen_method_sc[5 /* remote */][5 /* local */] = { PASSKEY_CONFIRM }, }; -static const uint8_t sc_debug_public_key[64] = { +static const u8_t sc_debug_public_key[64] = { 0xe6, 0x9d, 0x35, 0x0e, 0x48, 0x01, 0x03, 0xcc, 0xdb, 0xfd, 0xf4, 0xac, 0x11, 0x91, 0xf4, 0xef, 0xb9, 0xa5, 0xf9, 0xe9, 0xa7, 0x83, 0x2c, 0x5e, 0x2c, 0xbe, 0x97, 0xf2, 0xd2, 0x03, 0xb0, 0x20, 0x8b, 0xd2, 0x89, 0x15, @@ -219,13 +219,13 @@ struct bt_smp_br { ATOMIC_DEFINE(flags, SMP_NUM_FLAGS); /* Local key distribution */ - uint8_t local_dist; + u8_t local_dist; /* Remote key distribution */ - uint8_t remote_dist; + u8_t remote_dist; /* Encryption Key Size used for connection */ - uint8_t enc_key_size; + u8_t enc_key_size; /* Delayed work for timeout handling */ struct k_delayed_work work; @@ -237,9 +237,9 @@ static struct bt_smp_br bt_smp_br_pool[CONFIG_BLUETOOTH_MAX_CONN]; static struct bt_smp bt_smp_pool[CONFIG_BLUETOOTH_MAX_CONN]; static bool sc_supported; static bool sc_local_pkey_valid; -static uint8_t sc_public_key[64]; +static u8_t sc_public_key[64]; -static uint8_t get_io_capa(void) +static u8_t get_io_capa(void) { if (!bt_auth) { return BT_SMP_IO_NO_INPUT_OUTPUT; @@ -268,7 +268,7 @@ static uint8_t get_io_capa(void) return BT_SMP_IO_NO_INPUT_OUTPUT; } -static uint8_t get_pair_method(struct bt_smp *smp, uint8_t remote_io) +static u8_t get_pair_method(struct bt_smp *smp, u8_t remote_io) { struct bt_smp_pairing *req, *rsp; @@ -286,7 +286,7 @@ static uint8_t get_pair_method(struct bt_smp *smp, uint8_t remote_io) return gen_method_sc[remote_io][get_io_capa()]; } -static struct net_buf *smp_create_pdu(struct bt_conn *conn, uint8_t op, +static struct net_buf *smp_create_pdu(struct bt_conn *conn, u8_t op, size_t len) { struct bt_smp_hdr *hdr; @@ -301,9 +301,9 @@ static struct net_buf *smp_create_pdu(struct bt_conn *conn, uint8_t op, return buf; } -static int smp_ah(const uint8_t irk[16], const uint8_t r[3], uint8_t out[3]) +static int smp_ah(const u8_t irk[16], const u8_t r[3], u8_t out[3]) { - uint8_t res[16]; + u8_t res[16]; int err; BT_DBG("irk %s, r %s", bt_hex(irk, 16), bt_hex(r, 3)); @@ -335,8 +335,8 @@ static int smp_ah(const uint8_t irk[16], const uint8_t r[3], uint8_t out[3]) * : len ( length of the message in octets ) * Output : out ( message authentication code ) */ -static int bt_smp_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, - uint8_t *out) +static int bt_smp_aes_cmac(const u8_t *key, const u8_t *in, size_t len, + u8_t *out) { struct tc_aes_key_sched_struct sched; struct tc_cmac_struct state; @@ -356,11 +356,11 @@ static int bt_smp_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, return 0; } -static int smp_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x, - uint8_t z, uint8_t res[16]) +static int smp_f4(const u8_t *u, const u8_t *v, const u8_t *x, + u8_t z, u8_t res[16]) { - uint8_t xs[16]; - uint8_t m[65]; + u8_t xs[16]; + u8_t m[65]; int err; BT_DBG("u %s", bt_hex(u, 32)); @@ -394,14 +394,14 @@ static int smp_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x, return err; } -static int smp_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, - const bt_addr_le_t *a1, const bt_addr_le_t *a2, uint8_t *mackey, - uint8_t *ltk) +static int smp_f5(const u8_t *w, const u8_t *n1, const u8_t *n2, + const bt_addr_le_t *a1, const bt_addr_le_t *a2, u8_t *mackey, + u8_t *ltk) { - static const uint8_t salt[16] = { 0x6c, 0x88, 0x83, 0x91, 0xaa, 0xf5, + static const u8_t salt[16] = { 0x6c, 0x88, 0x83, 0x91, 0xaa, 0xf5, 0xa5, 0x38, 0x60, 0x37, 0x0b, 0xdb, 0x5a, 0x60, 0x83, 0xbe }; - uint8_t m[53] = { 0x00, /* counter */ + u8_t m[53] = { 0x00, /* counter */ 0x62, 0x74, 0x6c, 0x65, /* keyID */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*n1*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -410,7 +410,7 @@ static int smp_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a2 */ 0x01, 0x00 /* length */ }; - uint8_t t[16], ws[32]; + u8_t t[16], ws[32]; int err; BT_DBG("w %s", bt_hex(w, 32)); @@ -456,12 +456,12 @@ static int smp_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, return 0; } -static int smp_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, - const uint8_t *r, const uint8_t *iocap, const bt_addr_le_t *a1, - const bt_addr_le_t *a2, uint8_t *check) +static int smp_f6(const u8_t *w, const u8_t *n1, const u8_t *n2, + const u8_t *r, const u8_t *iocap, const bt_addr_le_t *a1, + const bt_addr_le_t *a2, u8_t *check) { - uint8_t ws[16]; - uint8_t m[65]; + u8_t ws[16]; + u8_t m[65]; int err; BT_DBG("w %s", bt_hex(w, 16)); @@ -496,10 +496,10 @@ static int smp_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, return 0; } -static int smp_g2(const uint8_t u[32], const uint8_t v[32], - const uint8_t x[16], const uint8_t y[16], uint32_t *passkey) +static int smp_g2(const u8_t u[32], const u8_t v[32], + const u8_t x[16], const u8_t y[16], u32_t *passkey) { - uint8_t m[80], xs[16]; + u8_t m[80], xs[16]; int err; BT_DBG("u %s", bt_hex(u, 32)); @@ -527,7 +527,7 @@ static int smp_g2(const uint8_t u[32], const uint8_t v[32], return 0; } -static uint8_t get_encryption_key_size(struct bt_smp *smp) +static u8_t get_encryption_key_size(struct bt_smp *smp) { struct bt_smp_pairing *req, *rsp; @@ -545,12 +545,12 @@ static uint8_t get_encryption_key_size(struct bt_smp *smp) #if defined(CONFIG_BLUETOOTH_PRIVACY) || defined(CONFIG_BLUETOOTH_SIGNING) || \ !defined(CONFIG_BLUETOOTH_SMP_SC_ONLY) /* For TX callbacks */ -static void smp_pairing_complete(struct bt_smp *smp, uint8_t status); +static void smp_pairing_complete(struct bt_smp *smp, u8_t status); #if defined(CONFIG_BLUETOOTH_BREDR) -static void smp_pairing_br_complete(struct bt_smp_br *smp, uint8_t status); +static void smp_pairing_br_complete(struct bt_smp_br *smp, u8_t status); #endif -static void smp_check_complete(struct bt_conn *conn, uint8_t dist_complete) +static void smp_check_complete(struct bt_conn *conn, u8_t dist_complete) { struct bt_l2cap_chan *chan; @@ -605,10 +605,10 @@ static void sign_info_sent(struct bt_conn *conn) #endif /* CONFIG_BLUETOOTH_SIGNING */ #if defined(CONFIG_BLUETOOTH_BREDR) -static int smp_h6(const uint8_t w[16], const uint8_t key_id[4], uint8_t res[16]) +static int smp_h6(const u8_t w[16], const u8_t key_id[4], u8_t res[16]) { - uint8_t ws[16]; - uint8_t key_id_s[4]; + u8_t ws[16]; + u8_t key_id_s[4]; int err; BT_DBG("w %s", bt_hex(w, 16)); @@ -629,10 +629,10 @@ static int smp_h6(const uint8_t w[16], const uint8_t key_id[4], uint8_t res[16]) return 0; } -static int smp_h7(const uint8_t salt[16], const uint8_t w[16], uint8_t res[16]) +static int smp_h7(const u8_t salt[16], const u8_t w[16], u8_t res[16]) { - uint8_t ws[16]; - uint8_t salt_s[16]; + u8_t ws[16]; + u8_t salt_s[16]; int err; BT_DBG("w %s", bt_hex(w, 16)); @@ -656,10 +656,10 @@ static int smp_h7(const uint8_t salt[16], const uint8_t w[16], uint8_t res[16]) static void sc_derive_link_key(struct bt_smp *smp) { /* constants as specified in Core Spec Vol.3 Part H 2.4.2.4 */ - static const uint8_t lebr[4] = { 0x72, 0x62, 0x65, 0x6c }; + static const u8_t lebr[4] = { 0x72, 0x62, 0x65, 0x6c }; struct bt_conn *conn = smp->chan.chan.conn; struct bt_keys_link_key *link_key; - uint8_t ilk[16]; + u8_t ilk[16]; BT_DBG(""); @@ -676,7 +676,7 @@ static void sc_derive_link_key(struct bt_smp *smp) if (atomic_test_bit(smp->flags, SMP_FLAG_CT2)) { /* constants as specified in Core Spec Vol.3 Part H 2.4.2.4 */ - static const uint8_t salt[16] = { 0x31, 0x70, 0x6d, 0x74, + static const u8_t salt[16] = { 0x31, 0x70, 0x6d, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -687,7 +687,7 @@ static void sc_derive_link_key(struct bt_smp *smp) } } else { /* constants as specified in Core Spec Vol.3 Part H 2.4.2.4 */ - static const uint8_t tmp1[4] = { 0x31, 0x70, 0x6d, 0x74 }; + static const u8_t tmp1[4] = { 0x31, 0x70, 0x6d, 0x74 }; if (smp_h6(conn->le.keys->ltk.val, tmp1, ilk)) { bt_keys_link_key_clear(link_key); @@ -718,7 +718,7 @@ static void smp_br_reset(struct bt_smp_br *smp) atomic_set_bit(&smp->allowed_cmds, BT_SMP_CMD_PAIRING_REQ); } -static void smp_pairing_br_complete(struct bt_smp_br *smp, uint8_t status) +static void smp_pairing_br_complete(struct bt_smp_br *smp, u8_t status) { BT_DBG("status 0x%x", status); @@ -793,7 +793,7 @@ static void bt_smp_br_disconnected(struct bt_l2cap_chan *chan) static void smp_br_init(struct bt_smp_br *smp) { /* Initialize SMP context without clearing L2CAP channel context */ - memset((uint8_t *)smp + sizeof(smp->chan), 0, + memset((u8_t *)smp + sizeof(smp->chan), 0, sizeof(*smp) - (sizeof(smp->chan) + sizeof(smp->work))); atomic_set_bit(&smp->allowed_cmds, BT_SMP_CMD_PAIRING_FAIL); @@ -802,12 +802,12 @@ static void smp_br_init(struct bt_smp_br *smp) static void smp_br_derive_ltk(struct bt_smp_br *smp) { /* constants as specified in Core Spec Vol.3 Part H 2.4.2.5 */ - static const uint8_t brle[4] = { 0x65, 0x6c, 0x72, 0x62 }; + static const u8_t brle[4] = { 0x65, 0x6c, 0x72, 0x62 }; struct bt_conn *conn = smp->chan.chan.conn; struct bt_keys_link_key *link_key = conn->br.link_key; struct bt_keys *keys; bt_addr_le_t addr; - uint8_t ilk[16]; + u8_t ilk[16]; BT_DBG(""); @@ -835,7 +835,7 @@ static void smp_br_derive_ltk(struct bt_smp_br *smp) if (atomic_test_bit(smp->flags, SMP_FLAG_CT2)) { /* constants as specified in Core Spec Vol.3 Part H 2.4.2.5 */ - static const uint8_t salt[16] = { 0x32, 0x70, 0x6d, 0x74, + static const u8_t salt[16] = { 0x32, 0x70, 0x6d, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -846,7 +846,7 @@ static void smp_br_derive_ltk(struct bt_smp_br *smp) } } else { /* constants as specified in Core Spec Vol.3 Part H 2.4.2.5 */ - static const uint8_t tmp2[4] = { 0x32, 0x70, 0x6d, 0x74 }; + static const u8_t tmp2[4] = { 0x32, 0x70, 0x6d, 0x74 }; if (smp_h6(link_key->val, tmp2, ilk)) { bt_keys_clear(keys); @@ -969,13 +969,13 @@ static bool smp_br_pairing_allowed(struct bt_smp_br *smp) return false; } -static uint8_t smp_br_pairing_req(struct bt_smp_br *smp, struct net_buf *buf) +static u8_t smp_br_pairing_req(struct bt_smp_br *smp, struct net_buf *buf) { struct bt_smp_pairing *req = (void *)buf->data; struct bt_conn *conn = smp->chan.chan.conn; struct bt_smp_pairing *rsp; struct net_buf *rsp_buf; - uint8_t max_key_size; + u8_t max_key_size; BT_DBG(""); @@ -1054,11 +1054,11 @@ static uint8_t smp_br_pairing_req(struct bt_smp_br *smp, struct net_buf *buf) return 0; } -static uint8_t smp_br_pairing_rsp(struct bt_smp_br *smp, struct net_buf *buf) +static u8_t smp_br_pairing_rsp(struct bt_smp_br *smp, struct net_buf *buf) { struct bt_smp_pairing *rsp = (void *)buf->data; struct bt_conn *conn = smp->chan.chan.conn; - uint8_t max_key_size; + u8_t max_key_size; BT_DBG(""); @@ -1108,7 +1108,7 @@ static uint8_t smp_br_pairing_rsp(struct bt_smp_br *smp, struct net_buf *buf) return 0; } -static uint8_t smp_br_pairing_failed(struct bt_smp_br *smp, struct net_buf *buf) +static u8_t smp_br_pairing_failed(struct bt_smp_br *smp, struct net_buf *buf) { struct bt_smp_pairing_fail *req = (void *)buf->data; @@ -1121,7 +1121,7 @@ static uint8_t smp_br_pairing_failed(struct bt_smp_br *smp, struct net_buf *buf) return 0; } -static uint8_t smp_br_ident_info(struct bt_smp_br *smp, struct net_buf *buf) +static u8_t smp_br_ident_info(struct bt_smp_br *smp, struct net_buf *buf) { struct bt_smp_ident_info *req = (void *)buf->data; struct bt_conn *conn = smp->chan.chan.conn; @@ -1152,7 +1152,7 @@ static uint8_t smp_br_ident_info(struct bt_smp_br *smp, struct net_buf *buf) return 0; } -static uint8_t smp_br_ident_addr_info(struct bt_smp_br *smp, +static u8_t smp_br_ident_addr_info(struct bt_smp_br *smp, struct net_buf *buf) { struct bt_conn *conn = smp->chan.chan.conn; @@ -1193,7 +1193,7 @@ static uint8_t smp_br_ident_addr_info(struct bt_smp_br *smp, } #if defined(CONFIG_BLUETOOTH_SIGNING) -static uint8_t smp_br_signing_info(struct bt_smp_br *smp, struct net_buf *buf) +static u8_t smp_br_signing_info(struct bt_smp_br *smp, struct net_buf *buf) { struct bt_smp_signing_info *req = (void *)buf->data; struct bt_conn *conn = smp->chan.chan.conn; @@ -1231,15 +1231,15 @@ static uint8_t smp_br_signing_info(struct bt_smp_br *smp, struct net_buf *buf) return 0; } #else -static uint8_t smp_br_signing_info(struct bt_smp_br *smp, struct net_buf *buf) +static u8_t smp_br_signing_info(struct bt_smp_br *smp, struct net_buf *buf) { return BT_SMP_ERR_CMD_NOTSUPP; } #endif /* CONFIG_BLUETOOTH_SIGNING */ static const struct { - uint8_t (*func)(struct bt_smp_br *smp, struct net_buf *buf); - uint8_t expect_len; + u8_t (*func)(struct bt_smp_br *smp, struct net_buf *buf); + u8_t expect_len; } br_handlers[] = { { }, /* No op-code defined for 0x00 */ { smp_br_pairing_req, sizeof(struct bt_smp_pairing) }, @@ -1257,7 +1257,7 @@ static const struct { /* DHKey check not used over BR/EDR */ }; -static int smp_br_error(struct bt_smp_br *smp, uint8_t reason) +static int smp_br_error(struct bt_smp_br *smp, u8_t reason) { struct bt_smp_pairing_fail *rsp; struct net_buf *buf; @@ -1287,7 +1287,7 @@ static void bt_smp_br_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) { struct bt_smp_br *smp = CONTAINER_OF(chan, struct bt_smp_br, chan); struct bt_smp_hdr *hdr = (void *)buf->data; - uint8_t err; + u8_t err; if (buf->len < sizeof(*hdr)) { BT_ERR("Too small SMP PDU received"); @@ -1384,7 +1384,7 @@ int bt_smp_br_send_pairing_req(struct bt_conn *conn) { struct bt_smp_pairing *req; struct net_buf *req_buf; - uint8_t max_key_size; + u8_t max_key_size; struct bt_smp_br *smp; smp = smp_br_chan_get(conn); @@ -1492,7 +1492,7 @@ static void smp_reset(struct bt_smp *smp) } } -static void smp_pairing_complete(struct bt_smp *smp, uint8_t status) +static void smp_pairing_complete(struct bt_smp *smp, u8_t status) { BT_DBG("status 0x%x", status); @@ -1539,7 +1539,7 @@ static void smp_send(struct bt_smp *smp, struct net_buf *buf, k_delayed_work_submit(&smp->work, SMP_TIMEOUT); } -static int smp_error(struct bt_smp *smp, uint8_t reason) +static int smp_error(struct bt_smp *smp, u8_t reason) { struct bt_smp_pairing_fail *rsp; struct net_buf *buf; @@ -1562,7 +1562,7 @@ static int smp_error(struct bt_smp *smp, uint8_t reason) return 0; } -static uint8_t smp_send_pairing_random(struct bt_smp *smp) +static u8_t smp_send_pairing_random(struct bt_smp *smp) { struct bt_conn *conn = smp->chan.chan.conn; struct bt_smp_pairing_random *req; @@ -1582,7 +1582,7 @@ static uint8_t smp_send_pairing_random(struct bt_smp *smp) } #if !defined(CONFIG_BLUETOOTH_SMP_SC_ONLY) -static void xor_128(const uint8_t p[16], const uint8_t q[16], uint8_t r[16]) +static void xor_128(const u8_t p[16], const u8_t q[16], u8_t r[16]) { size_t len = 16; @@ -1591,12 +1591,12 @@ static void xor_128(const uint8_t p[16], const uint8_t q[16], uint8_t r[16]) } } -static int smp_c1(const uint8_t k[16], const uint8_t r[16], - const uint8_t preq[7], const uint8_t pres[7], +static int smp_c1(const u8_t k[16], const u8_t r[16], + const u8_t preq[7], const u8_t pres[7], const bt_addr_le_t *ia, const bt_addr_le_t *ra, - uint8_t enc_data[16]) + u8_t enc_data[16]) { - uint8_t p1[16], p2[16]; + u8_t p1[16], p2[16]; int err; BT_DBG("k %s r %s", bt_hex(k, 16), bt_hex(r, 16)); @@ -1634,12 +1634,12 @@ static int smp_c1(const uint8_t k[16], const uint8_t r[16], } #endif /* !CONFIG_BLUETOOTH_SMP_SC_ONLY */ -static uint8_t smp_send_pairing_confirm(struct bt_smp *smp) +static u8_t smp_send_pairing_confirm(struct bt_smp *smp) { struct bt_conn *conn = smp->chan.chan.conn; struct bt_smp_pairing_confirm *req; struct net_buf *buf; - uint8_t r; + u8_t r; switch (smp->method) { case PASSKEY_CONFIRM: @@ -1696,9 +1696,9 @@ static void legacy_distribute_keys(struct bt_smp *smp) struct bt_smp_encrypt_info *info; struct bt_smp_master_ident *ident; struct net_buf *buf; - uint8_t key[16]; - uint64_t rand; - uint16_t ediv; + u8_t key[16]; + u64_t rand; + u16_t ediv; bt_rand(key, sizeof(key)); bt_rand(&rand, sizeof(rand)); @@ -1824,7 +1824,7 @@ static void bt_smp_distribute_keys(struct bt_smp *smp) } #if defined(CONFIG_BLUETOOTH_PERIPHERAL) -static uint8_t send_pairing_rsp(struct bt_smp *smp) +static u8_t send_pairing_rsp(struct bt_smp *smp) { struct bt_conn *conn = smp->chan.chan.conn; struct bt_smp_pairing *rsp; @@ -1845,8 +1845,8 @@ static uint8_t send_pairing_rsp(struct bt_smp *smp) #endif /* CONFIG_BLUETOOTH_PERIPHERAL */ #if !defined(CONFIG_BLUETOOTH_SMP_SC_ONLY) -static int smp_s1(const uint8_t k[16], const uint8_t r1[16], - const uint8_t r2[16], uint8_t out[16]) +static int smp_s1(const u8_t k[16], const u8_t r1[16], + const u8_t r2[16], u8_t out[16]) { /* The most significant 64-bits of r1 are discarded to generate * r1' and the most significant 64-bits of r2 are discarded to @@ -1863,10 +1863,10 @@ static int smp_s1(const uint8_t k[16], const uint8_t r1[16], return bt_encrypt_le(k, out, out); } -static uint8_t legacy_get_pair_method(struct bt_smp *smp, uint8_t remote_io) +static u8_t legacy_get_pair_method(struct bt_smp *smp, u8_t remote_io) { struct bt_smp_pairing *req, *rsp; - uint8_t method; + u8_t method; if (remote_io > BT_SMP_IO_KEYBOARD_DISPLAY) return JUST_WORKS; @@ -1895,11 +1895,11 @@ static uint8_t legacy_get_pair_method(struct bt_smp *smp, uint8_t remote_io) return method; } -static uint8_t legacy_request_tk(struct bt_smp *smp) +static u8_t legacy_request_tk(struct bt_smp *smp) { struct bt_conn *conn = smp->chan.chan.conn; struct bt_keys *keys; - uint32_t passkey; + u32_t passkey; /* * Fail if we have keys that are stronger than keys that will be @@ -1941,7 +1941,7 @@ static uint8_t legacy_request_tk(struct bt_smp *smp) return 0; } -static uint8_t legacy_send_pairing_confirm(struct bt_smp *smp) +static u8_t legacy_send_pairing_confirm(struct bt_smp *smp) { struct bt_conn *conn = smp->chan.chan.conn; struct bt_smp_pairing_confirm *req; @@ -1968,9 +1968,9 @@ static uint8_t legacy_send_pairing_confirm(struct bt_smp *smp) } #if defined(CONFIG_BLUETOOTH_PERIPHERAL) -static uint8_t legacy_pairing_req(struct bt_smp *smp, uint8_t remote_io) +static u8_t legacy_pairing_req(struct bt_smp *smp, u8_t remote_io) { - uint8_t ret; + u8_t ret; BT_DBG(""); @@ -1996,10 +1996,10 @@ static uint8_t legacy_pairing_req(struct bt_smp *smp, uint8_t remote_io) } #endif /* CONFIG_BLUETOOTH_PERIPHERAL */ -static uint8_t legacy_pairing_random(struct bt_smp *smp) +static u8_t legacy_pairing_random(struct bt_smp *smp) { struct bt_conn *conn = smp->chan.chan.conn; - uint8_t tmp[16]; + u8_t tmp[16]; int err; BT_DBG(""); @@ -2054,7 +2054,7 @@ static uint8_t legacy_pairing_random(struct bt_smp *smp) return 0; } -static uint8_t legacy_pairing_confirm(struct bt_smp *smp) +static u8_t legacy_pairing_confirm(struct bt_smp *smp) { BT_DBG(""); @@ -2103,7 +2103,7 @@ static void legacy_passkey_entry(struct bt_smp *smp, unsigned int passkey) } } -static uint8_t smp_encrypt_info(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_encrypt_info(struct bt_smp *smp, struct net_buf *buf) { BT_DBG(""); @@ -2127,7 +2127,7 @@ static uint8_t smp_encrypt_info(struct bt_smp *smp, struct net_buf *buf) return 0; } -static uint8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf) { struct bt_conn *conn = smp->chan.chan.conn; @@ -2170,9 +2170,9 @@ static uint8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf) } #if defined(CONFIG_BLUETOOTH_CENTRAL) -static uint8_t legacy_pairing_rsp(struct bt_smp *smp, uint8_t remote_io) +static u8_t legacy_pairing_rsp(struct bt_smp *smp, u8_t remote_io) { - uint8_t ret; + u8_t ret; BT_DBG(""); @@ -2203,12 +2203,12 @@ static uint8_t legacy_pairing_rsp(struct bt_smp *smp, uint8_t remote_io) } #endif /* CONFIG_BLUETOOTH_CENTRAL */ #else -static uint8_t smp_encrypt_info(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_encrypt_info(struct bt_smp *smp, struct net_buf *buf) { return BT_SMP_ERR_CMD_NOTSUPP; } -static uint8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf) { return BT_SMP_ERR_CMD_NOTSUPP; } @@ -2217,7 +2217,7 @@ static uint8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf) static int smp_init(struct bt_smp *smp) { /* Initialize SMP context without clearing L2CAP channel context */ - memset((uint8_t *)smp + sizeof(smp->chan), 0, + memset((u8_t *)smp + sizeof(smp->chan), 0, sizeof(*smp) - (sizeof(smp->chan) + sizeof(smp->work))); /* Generate local random number */ @@ -2232,7 +2232,7 @@ static int smp_init(struct bt_smp *smp) return 0; } -static uint8_t get_auth(uint8_t auth) +static u8_t get_auth(u8_t auth) { if (sc_supported) { auth &= BT_SMP_AUTH_MASK_SC; @@ -2323,7 +2323,7 @@ int bt_smp_send_security_req(struct bt_conn *conn) return 0; } -static uint8_t smp_pairing_req(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_pairing_req(struct bt_smp *smp, struct net_buf *buf) { struct bt_smp_pairing *req = (void *)buf->data; struct bt_smp_pairing *rsp; @@ -2412,13 +2412,13 @@ static uint8_t smp_pairing_req(struct bt_smp *smp, struct net_buf *buf) return send_pairing_rsp(smp); } #else -static uint8_t smp_pairing_req(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_pairing_req(struct bt_smp *smp, struct net_buf *buf) { return BT_SMP_ERR_CMD_NOTSUPP; } #endif /* CONFIG_BLUETOOTH_PERIPHERAL */ -static uint8_t sc_send_public_key(struct bt_smp *smp) +static u8_t sc_send_public_key(struct bt_smp *smp) { struct bt_smp_public_key *req; struct net_buf *req_buf; @@ -2505,7 +2505,7 @@ int bt_smp_send_pairing_req(struct bt_conn *conn) return 0; } -static uint8_t smp_pairing_rsp(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_pairing_rsp(struct bt_smp *smp, struct net_buf *buf) { struct bt_smp_pairing *rsp = (void *)buf->data; struct bt_smp_pairing *req = (struct bt_smp_pairing *)&smp->preq[1]; @@ -2575,13 +2575,13 @@ static uint8_t smp_pairing_rsp(struct bt_smp *smp, struct net_buf *buf) return sc_send_public_key(smp); } #else -static uint8_t smp_pairing_rsp(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_pairing_rsp(struct bt_smp *smp, struct net_buf *buf) { return BT_SMP_ERR_CMD_NOTSUPP; } #endif /* CONFIG_BLUETOOTH_CENTRAL */ -static uint8_t smp_pairing_confirm(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_pairing_confirm(struct bt_smp *smp, struct net_buf *buf) { struct bt_smp_pairing_confirm *req = (void *)buf->data; @@ -2624,7 +2624,7 @@ static uint8_t smp_pairing_confirm(struct bt_smp *smp, struct net_buf *buf) } } -static uint8_t sc_smp_send_dhkey_check(struct bt_smp *smp, const uint8_t *e) +static u8_t sc_smp_send_dhkey_check(struct bt_smp *smp, const u8_t *e) { struct bt_smp_dhkey_check *req; struct net_buf *buf; @@ -2646,9 +2646,9 @@ static uint8_t sc_smp_send_dhkey_check(struct bt_smp *smp, const uint8_t *e) } #if defined(CONFIG_BLUETOOTH_CENTRAL) -static uint8_t compute_and_send_master_dhcheck(struct bt_smp *smp) +static u8_t compute_and_send_master_dhcheck(struct bt_smp *smp) { - uint8_t e[16], r[16]; + u8_t e[16], r[16]; memset(r, 0, sizeof(r)); @@ -2685,9 +2685,9 @@ static uint8_t compute_and_send_master_dhcheck(struct bt_smp *smp) #endif /* CONFIG_BLUETOOTH_CENTRAL */ #if defined(CONFIG_BLUETOOTH_PERIPHERAL) -static uint8_t compute_and_check_and_send_slave_dhcheck(struct bt_smp *smp) +static u8_t compute_and_check_and_send_slave_dhcheck(struct bt_smp *smp) { - uint8_t re[16], e[16], r[16]; + u8_t re[16], e[16], r[16]; memset(r, 0, sizeof(r)); @@ -2738,7 +2738,7 @@ static uint8_t compute_and_check_and_send_slave_dhcheck(struct bt_smp *smp) } #endif /* CONFIG_BLUETOOTH_PERIPHERAL */ -static void bt_smp_dhkey_ready(const uint8_t *dhkey) +static void bt_smp_dhkey_ready(const u8_t *dhkey) { struct bt_smp *smp = NULL; int i; @@ -2777,7 +2777,7 @@ static void bt_smp_dhkey_ready(const uint8_t *dhkey) } if (atomic_test_bit(smp->flags, SMP_FLAG_DHKEY_SEND)) { - uint8_t err; + u8_t err; #if defined(CONFIG_BLUETOOTH_CENTRAL) if (smp->chan.chan.conn->role == BT_HCI_ROLE_MASTER) { @@ -2799,10 +2799,10 @@ static void bt_smp_dhkey_ready(const uint8_t *dhkey) } } -static uint8_t sc_smp_check_confirm(struct bt_smp *smp) +static u8_t sc_smp_check_confirm(struct bt_smp *smp) { - uint8_t cfm[16]; - uint8_t r; + u8_t cfm[16]; + u8_t r; switch (smp->method) { case PASSKEY_CONFIRM: @@ -2838,11 +2838,11 @@ static uint8_t sc_smp_check_confirm(struct bt_smp *smp) return 0; } -static uint8_t smp_pairing_random(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_pairing_random(struct bt_smp *smp, struct net_buf *buf) { struct bt_smp_pairing_random *req = (void *)buf->data; - uint32_t passkey; - uint8_t err; + u32_t passkey; + u8_t err; BT_DBG(""); @@ -2952,7 +2952,7 @@ static uint8_t smp_pairing_random(struct bt_smp *smp, struct net_buf *buf) return 0; } -static uint8_t smp_pairing_failed(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_pairing_failed(struct bt_smp *smp, struct net_buf *buf) { struct bt_conn *conn = smp->chan.chan.conn; struct bt_smp_pairing_fail *req = (void *)buf->data; @@ -2990,7 +2990,7 @@ static uint8_t smp_pairing_failed(struct bt_smp *smp, struct net_buf *buf) return 0; } -static uint8_t smp_ident_info(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_ident_info(struct bt_smp *smp, struct net_buf *buf) { BT_DBG(""); @@ -3014,7 +3014,7 @@ static uint8_t smp_ident_info(struct bt_smp *smp, struct net_buf *buf) return 0; } -static uint8_t smp_ident_addr_info(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_ident_addr_info(struct bt_smp *smp, struct net_buf *buf) { struct bt_conn *conn = smp->chan.chan.conn; struct bt_smp_ident_addr_info *req = (void *)buf->data; @@ -3089,7 +3089,7 @@ static uint8_t smp_ident_addr_info(struct bt_smp *smp, struct net_buf *buf) } #if defined(CONFIG_BLUETOOTH_SIGNING) -static uint8_t smp_signing_info(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_signing_info(struct bt_smp *smp, struct net_buf *buf) { struct bt_conn *conn = smp->chan.chan.conn; @@ -3125,18 +3125,18 @@ static uint8_t smp_signing_info(struct bt_smp *smp, struct net_buf *buf) return 0; } #else -static uint8_t smp_signing_info(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_signing_info(struct bt_smp *smp, struct net_buf *buf) { return BT_SMP_ERR_CMD_NOTSUPP; } #endif /* CONFIG_BLUETOOTH_SIGNING */ #if defined(CONFIG_BLUETOOTH_CENTRAL) -static uint8_t smp_security_request(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_security_request(struct bt_smp *smp, struct net_buf *buf) { struct bt_conn *conn = smp->chan.chan.conn; struct bt_smp_security_request *req = (void *)buf->data; - uint8_t auth; + u8_t auth; BT_DBG(""); @@ -3199,13 +3199,13 @@ pair: return 0; } #else -static uint8_t smp_security_request(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_security_request(struct bt_smp *smp, struct net_buf *buf) { return BT_SMP_ERR_CMD_NOTSUPP; } #endif /* CONFIG_BLUETOOTH_CENTRAL */ -static uint8_t generate_dhkey(struct bt_smp *smp) +static u8_t generate_dhkey(struct bt_smp *smp) { if (bt_dh_key_gen(smp->pkey, bt_smp_dhkey_ready)) { return BT_SMP_ERR_UNSPECIFIED; @@ -3215,7 +3215,7 @@ static uint8_t generate_dhkey(struct bt_smp *smp) return 0; } -static uint8_t display_passkey(struct bt_smp *smp) +static u8_t display_passkey(struct bt_smp *smp) { if (bt_rand(&smp->passkey, sizeof(smp->passkey))) { return BT_SMP_ERR_UNSPECIFIED; @@ -3231,9 +3231,9 @@ static uint8_t display_passkey(struct bt_smp *smp) } #if defined(CONFIG_BLUETOOTH_PERIPHERAL) -static uint8_t smp_public_key_slave(struct bt_smp *smp) +static u8_t smp_public_key_slave(struct bt_smp *smp) { - uint8_t err; + u8_t err; err = sc_send_public_key(smp); if (err) { @@ -3271,10 +3271,10 @@ static uint8_t smp_public_key_slave(struct bt_smp *smp) } #endif /* CONFIG_BLUETOOTH_PERIPHERAL */ -static uint8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf) { struct bt_smp_public_key *req = (void *)buf->data; - uint8_t err; + u8_t err; BT_DBG(""); @@ -3335,7 +3335,7 @@ static uint8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf) return 0; } -static uint8_t smp_dhkey_check(struct bt_smp *smp, struct net_buf *buf) +static u8_t smp_dhkey_check(struct bt_smp *smp, struct net_buf *buf) { struct bt_smp_dhkey_check *req = (void *)buf->data; @@ -3343,7 +3343,7 @@ static uint8_t smp_dhkey_check(struct bt_smp *smp, struct net_buf *buf) if (IS_ENABLED(CONFIG_BLUETOOTH_CENTRAL) && smp->chan.chan.conn->role == BT_HCI_ROLE_MASTER) { - uint8_t e[16], r[16], enc_size; + u8_t e[16], r[16], enc_size; memset(r, 0, sizeof(r)); @@ -3406,8 +3406,8 @@ static uint8_t smp_dhkey_check(struct bt_smp *smp, struct net_buf *buf) } static const struct { - uint8_t (*func)(struct bt_smp *smp, struct net_buf *buf); - uint8_t expect_len; + u8_t (*func)(struct bt_smp *smp, struct net_buf *buf); + u8_t expect_len; } handlers[] = { { }, /* No op-code defined for 0x00 */ { smp_pairing_req, sizeof(struct bt_smp_pairing) }, @@ -3429,7 +3429,7 @@ static void bt_smp_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) { struct bt_smp *smp = CONTAINER_OF(chan, struct bt_smp, chan); struct bt_smp_hdr *hdr = (void *)buf->data; - uint8_t err; + u8_t err; if (buf->len < sizeof(*hdr)) { BT_ERR("Too small SMP PDU received"); @@ -3475,7 +3475,7 @@ static void bt_smp_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) } } -static void bt_smp_pkey_ready(const uint8_t *pkey) +static void bt_smp_pkey_ready(const u8_t *pkey) { int i; @@ -3492,7 +3492,7 @@ static void bt_smp_pkey_ready(const uint8_t *pkey) for (i = 0; i < ARRAY_SIZE(bt_smp_pool); i++) { struct bt_smp *smp = &bt_smp_pool[i]; - uint8_t err; + u8_t err; if (!atomic_test_bit(smp->flags, SMP_FLAG_PKEY_SEND)) { continue; @@ -3555,7 +3555,7 @@ static void bt_smp_disconnected(struct bt_l2cap_chan *chan) } static void bt_smp_encrypt_change(struct bt_l2cap_chan *chan, - uint8_t hci_status) + u8_t hci_status) { struct bt_smp *smp = CONTAINER_OF(chan, struct bt_smp, chan); struct bt_conn *conn = chan->conn; @@ -3629,9 +3629,9 @@ static void bt_smp_encrypt_change(struct bt_l2cap_chan *chan, } } -bool bt_smp_irk_matches(const uint8_t irk[16], const bt_addr_t *addr) +bool bt_smp_irk_matches(const u8_t irk[16], const bt_addr_t *addr) { - uint8_t hash[3]; + u8_t hash[3]; int err; BT_DBG("IRK %s bdaddr %s", bt_hex(irk, 16), bt_addr_str(addr)); @@ -3645,7 +3645,7 @@ bool bt_smp_irk_matches(const uint8_t irk[16], const bt_addr_t *addr) } #if defined(CONFIG_BLUETOOTH_PRIVACY) -int bt_smp_create_rpa(const uint8_t irk[16], bt_addr_t *rpa) +int bt_smp_create_rpa(const u8_t irk[16], bt_addr_t *rpa) { int err; @@ -3666,7 +3666,7 @@ int bt_smp_create_rpa(const uint8_t irk[16], bt_addr_t *rpa) return 0; } #else -int bt_smp_create_rpa(const uint8_t irk[16], bt_addr_t *rpa) +int bt_smp_create_rpa(const u8_t irk[16], bt_addr_t *rpa) { return -ENOTSUP; } @@ -3679,12 +3679,12 @@ int bt_smp_create_rpa(const uint8_t irk[16], bt_addr_t *rpa) * so total buffer size is len + 4 + 8 octets. * API is Little Endian to make it suitable for Bluetooth. */ -static int smp_sign_buf(const uint8_t *key, uint8_t *msg, uint16_t len) +static int smp_sign_buf(const u8_t *key, u8_t *msg, u16_t len) { - uint8_t *m = msg; - uint32_t cnt = UNALIGNED_GET((uint32_t *)&msg[len]); - uint8_t *sig = msg + len; - uint8_t key_s[16], tmp[16]; + u8_t *m = msg; + u32_t cnt = UNALIGNED_GET((u32_t *)&msg[len]); + u8_t *sig = msg + len; + u8_t key_s[16], tmp[16]; int err; BT_DBG("Signing msg %s len %u key %s", bt_hex(msg, len), len, @@ -3715,8 +3715,8 @@ static int smp_sign_buf(const uint8_t *key, uint8_t *msg, uint16_t len) int bt_smp_sign_verify(struct bt_conn *conn, struct net_buf *buf) { struct bt_keys *keys; - uint8_t sig[12]; - uint32_t cnt; + u8_t sig[12]; + u32_t cnt; int err; /* Store signature incl. count */ @@ -3758,7 +3758,7 @@ int bt_smp_sign_verify(struct bt_conn *conn, struct net_buf *buf) int bt_smp_sign(struct bt_conn *conn, struct net_buf *buf) { struct bt_keys *keys; - uint32_t cnt; + u32_t cnt; int err; keys = bt_keys_find(BT_KEYS_LOCAL_CSRK, &conn->le.dst); @@ -3806,12 +3806,12 @@ int bt_smp_sign(struct bt_conn *conn, struct net_buf *buf) * https://tools.ietf.org/html/rfc4493 * Same mentioned in the Bluetooth Spec. */ -static const uint8_t key[] = { +static const u8_t key[] = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; -static const uint8_t M[] = { +static const u8_t M[] = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, @@ -3822,10 +3822,10 @@ static const uint8_t M[] = { 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }; -static int aes_test(const char *prefix, const uint8_t *key, const uint8_t *m, - uint16_t len, const uint8_t *mac) +static int aes_test(const char *prefix, const u8_t *key, const u8_t *m, + u16_t len, const u8_t *mac) { - uint8_t out[16]; + u8_t out[16]; BT_DBG("%s: AES CMAC of message with len %u", prefix, len); @@ -3842,19 +3842,19 @@ static int aes_test(const char *prefix, const uint8_t *key, const uint8_t *m, static int smp_aes_cmac_test(void) { - uint8_t mac1[] = { + u8_t mac1[] = { 0xbb, 0x1d, 0x69, 0x29, 0xe9, 0x59, 0x37, 0x28, 0x7f, 0xa3, 0x7d, 0x12, 0x9b, 0x75, 0x67, 0x46 }; - uint8_t mac2[] = { + u8_t mac2[] = { 0x07, 0x0a, 0x16, 0xb4, 0x6b, 0x4d, 0x41, 0x44, 0xf7, 0x9b, 0xdd, 0x9d, 0xd0, 0x4a, 0x28, 0x7c }; - uint8_t mac3[] = { + u8_t mac3[] = { 0xdf, 0xa6, 0x67, 0x47, 0xde, 0x9a, 0xe6, 0x30, 0x30, 0xca, 0x32, 0x61, 0x14, 0x97, 0xc8, 0x27 }; - uint8_t mac4[] = { + u8_t mac4[] = { 0x51, 0xf0, 0xbe, 0xbf, 0x7e, 0x3b, 0x9d, 0x92, 0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe }; @@ -3883,19 +3883,19 @@ static int smp_aes_cmac_test(void) return 0; } -static int sign_test(const char *prefix, const uint8_t *key, const uint8_t *m, - uint16_t len, const uint8_t *sig) +static int sign_test(const char *prefix, const u8_t *key, const u8_t *m, + u16_t len, const u8_t *sig) { - uint8_t msg[len + sizeof(uint32_t) + 8]; - uint8_t orig[len + sizeof(uint32_t) + 8]; - uint8_t *out = msg + len; + u8_t msg[len + sizeof(u32_t) + 8]; + u8_t orig[len + sizeof(u32_t) + 8]; + u8_t *out = msg + len; int err; BT_DBG("%s: Sign message with len %u", prefix, len); memset(msg, 0, sizeof(msg)); memcpy(msg, m, len); - memset(msg + len, 0, sizeof(uint32_t)); + memset(msg + len, 0, sizeof(u32_t)); memcpy(orig, msg, sizeof(msg)); @@ -3905,7 +3905,7 @@ static int sign_test(const char *prefix, const uint8_t *key, const uint8_t *m, } /* Check original message */ - if (!memcmp(msg, orig, len + sizeof(uint32_t))) { + if (!memcmp(msg, orig, len + sizeof(u32_t))) { BT_DBG("%s: Original message intact", prefix); } else { BT_ERR("%s: Original message modified", prefix); @@ -3926,23 +3926,23 @@ static int sign_test(const char *prefix, const uint8_t *key, const uint8_t *m, static int smp_sign_test(void) { - const uint8_t sig1[] = { + const u8_t sig1[] = { 0x00, 0x00, 0x00, 0x00, 0xb3, 0xa8, 0x59, 0x41, 0x27, 0xeb, 0xc2, 0xc0 }; - const uint8_t sig2[] = { + const u8_t sig2[] = { 0x00, 0x00, 0x00, 0x00, 0x27, 0x39, 0x74, 0xf4, 0x39, 0x2a, 0x23, 0x2a }; - const uint8_t sig3[] = { + const u8_t sig3[] = { 0x00, 0x00, 0x00, 0x00, 0xb7, 0xca, 0x94, 0xab, 0x87, 0xc7, 0x82, 0x18 }; - const uint8_t sig4[] = { + const u8_t sig4[] = { 0x00, 0x00, 0x00, 0x00, 0x44, 0xe1, 0xe6, 0xce, 0x1d, 0xf5, 0x13, 0x68 }; - uint8_t key_s[16]; + u8_t key_s[16]; int err; /* Use the same key as aes-cmac but swap bytes */ @@ -3973,20 +3973,20 @@ static int smp_sign_test(void) static int smp_f4_test(void) { - uint8_t u[32] = { 0xe6, 0x9d, 0x35, 0x0e, 0x48, 0x01, 0x03, 0xcc, + u8_t u[32] = { 0xe6, 0x9d, 0x35, 0x0e, 0x48, 0x01, 0x03, 0xcc, 0xdb, 0xfd, 0xf4, 0xac, 0x11, 0x91, 0xf4, 0xef, 0xb9, 0xa5, 0xf9, 0xe9, 0xa7, 0x83, 0x2c, 0x5e, 0x2c, 0xbe, 0x97, 0xf2, 0xd2, 0x03, 0xb0, 0x20 }; - uint8_t v[32] = { 0xfd, 0xc5, 0x7f, 0xf4, 0x49, 0xdd, 0x4f, 0x6b, + u8_t v[32] = { 0xfd, 0xc5, 0x7f, 0xf4, 0x49, 0xdd, 0x4f, 0x6b, 0xfb, 0x7c, 0x9d, 0xf1, 0xc2, 0x9a, 0xcb, 0x59, 0x2a, 0xe7, 0xd4, 0xee, 0xfb, 0xfc, 0x0a, 0x90, 0x9a, 0xbb, 0xf6, 0x32, 0x3d, 0x8b, 0x18, 0x55 }; - uint8_t x[16] = { 0xab, 0xae, 0x2b, 0x71, 0xec, 0xb2, 0xff, 0xff, + u8_t x[16] = { 0xab, 0xae, 0x2b, 0x71, 0xec, 0xb2, 0xff, 0xff, 0x3e, 0x73, 0x77, 0xd1, 0x54, 0x84, 0xcb, 0xd5 }; - uint8_t z = 0x00; - uint8_t exp[16] = { 0x2d, 0x87, 0x74, 0xa9, 0xbe, 0xa1, 0xed, 0xf1, + u8_t z = 0x00; + u8_t exp[16] = { 0x2d, 0x87, 0x74, 0xa9, 0xbe, 0xa1, 0xed, 0xf1, 0x1c, 0xbd, 0xa9, 0x07, 0xf1, 0x16, 0xc9, 0xf2 }; - uint8_t res[16]; + u8_t res[16]; int err; err = smp_f4(u, v, x, z, res); @@ -4003,25 +4003,25 @@ static int smp_f4_test(void) static int smp_f5_test(void) { - uint8_t w[32] = { 0x98, 0xa6, 0xbf, 0x73, 0xf3, 0x34, 0x8d, 0x86, + u8_t w[32] = { 0x98, 0xa6, 0xbf, 0x73, 0xf3, 0x34, 0x8d, 0x86, 0xf1, 0x66, 0xf8, 0xb4, 0x13, 0x6b, 0x79, 0x99, 0x9b, 0x7d, 0x39, 0x0a, 0xa6, 0x10, 0x10, 0x34, 0x05, 0xad, 0xc8, 0x57, 0xa3, 0x34, 0x02, 0xec }; - uint8_t n1[16] = { 0xab, 0xae, 0x2b, 0x71, 0xec, 0xb2, 0xff, 0xff, + u8_t n1[16] = { 0xab, 0xae, 0x2b, 0x71, 0xec, 0xb2, 0xff, 0xff, 0x3e, 0x73, 0x77, 0xd1, 0x54, 0x84, 0xcb, 0xd5 }; - uint8_t n2[16] = { 0xcf, 0xc4, 0x3d, 0xff, 0xf7, 0x83, 0x65, 0x21, + u8_t n2[16] = { 0xcf, 0xc4, 0x3d, 0xff, 0xf7, 0x83, 0x65, 0x21, 0x6e, 0x5f, 0xa7, 0x25, 0xcc, 0xe7, 0xe8, 0xa6 }; bt_addr_le_t a1 = { .type = 0x00, .a.val = { 0xce, 0xbf, 0x37, 0x37, 0x12, 0x56 } }; bt_addr_le_t a2 = { .type = 0x00, .a.val = {0xc1, 0xcf, 0x2d, 0x70, 0x13, 0xa7 } }; - uint8_t exp_ltk[16] = { 0x38, 0x0a, 0x75, 0x94, 0xb5, 0x22, 0x05, + u8_t exp_ltk[16] = { 0x38, 0x0a, 0x75, 0x94, 0xb5, 0x22, 0x05, 0x98, 0x23, 0xcd, 0xd7, 0x69, 0x11, 0x79, 0x86, 0x69 }; - uint8_t exp_mackey[16] = { 0x20, 0x6e, 0x63, 0xce, 0x20, 0x6a, 0x3f, + u8_t exp_mackey[16] = { 0x20, 0x6e, 0x63, 0xce, 0x20, 0x6a, 0x3f, 0xfd, 0x02, 0x4a, 0x08, 0xa1, 0x76, 0xf1, 0x65, 0x29 }; - uint8_t mackey[16], ltk[16]; + u8_t mackey[16], ltk[16]; int err; err = smp_f5(w, n1, n2, &a1, &a2, mackey, ltk); @@ -4038,22 +4038,22 @@ static int smp_f5_test(void) static int smp_f6_test(void) { - uint8_t w[16] = { 0x20, 0x6e, 0x63, 0xce, 0x20, 0x6a, 0x3f, 0xfd, + u8_t w[16] = { 0x20, 0x6e, 0x63, 0xce, 0x20, 0x6a, 0x3f, 0xfd, 0x02, 0x4a, 0x08, 0xa1, 0x76, 0xf1, 0x65, 0x29 }; - uint8_t n1[16] = { 0xab, 0xae, 0x2b, 0x71, 0xec, 0xb2, 0xff, 0xff, + u8_t n1[16] = { 0xab, 0xae, 0x2b, 0x71, 0xec, 0xb2, 0xff, 0xff, 0x3e, 0x73, 0x77, 0xd1, 0x54, 0x84, 0xcb, 0xd5 }; - uint8_t n2[16] = { 0xcf, 0xc4, 0x3d, 0xff, 0xf7, 0x83, 0x65, 0x21, + u8_t n2[16] = { 0xcf, 0xc4, 0x3d, 0xff, 0xf7, 0x83, 0x65, 0x21, 0x6e, 0x5f, 0xa7, 0x25, 0xcc, 0xe7, 0xe8, 0xa6 }; - uint8_t r[16] = { 0xc8, 0x0f, 0x2d, 0x0c, 0xd2, 0x42, 0xda, 0x08, + u8_t r[16] = { 0xc8, 0x0f, 0x2d, 0x0c, 0xd2, 0x42, 0xda, 0x08, 0x54, 0xbb, 0x53, 0xb4, 0x3b, 0x34, 0xa3, 0x12 }; - uint8_t io_cap[3] = { 0x02, 0x01, 0x01 }; + u8_t io_cap[3] = { 0x02, 0x01, 0x01 }; bt_addr_le_t a1 = { .type = 0x00, .a.val = { 0xce, 0xbf, 0x37, 0x37, 0x12, 0x56 } }; bt_addr_le_t a2 = { .type = 0x00, .a.val = {0xc1, 0xcf, 0x2d, 0x70, 0x13, 0xa7 } }; - uint8_t exp[16] = { 0x61, 0x8f, 0x95, 0xda, 0x09, 0x0b, 0x6c, 0xd2, + u8_t exp[16] = { 0x61, 0x8f, 0x95, 0xda, 0x09, 0x0b, 0x6c, 0xd2, 0xc5, 0xe8, 0xd0, 0x9c, 0x98, 0x73, 0xc4, 0xe3 }; - uint8_t res[16]; + u8_t res[16]; int err; err = smp_f6(w, n1, n2, r, io_cap, &a1, &a2, res); @@ -4068,20 +4068,20 @@ static int smp_f6_test(void) static int smp_g2_test(void) { - uint8_t u[32] = { 0xe6, 0x9d, 0x35, 0x0e, 0x48, 0x01, 0x03, 0xcc, + u8_t u[32] = { 0xe6, 0x9d, 0x35, 0x0e, 0x48, 0x01, 0x03, 0xcc, 0xdb, 0xfd, 0xf4, 0xac, 0x11, 0x91, 0xf4, 0xef, 0xb9, 0xa5, 0xf9, 0xe9, 0xa7, 0x83, 0x2c, 0x5e, 0x2c, 0xbe, 0x97, 0xf2, 0xd2, 0x03, 0xb0, 0x20 }; - uint8_t v[32] = { 0xfd, 0xc5, 0x7f, 0xf4, 0x49, 0xdd, 0x4f, 0x6b, + u8_t v[32] = { 0xfd, 0xc5, 0x7f, 0xf4, 0x49, 0xdd, 0x4f, 0x6b, 0xfb, 0x7c, 0x9d, 0xf1, 0xc2, 0x9a, 0xcb, 0x59, 0x2a, 0xe7, 0xd4, 0xee, 0xfb, 0xfc, 0x0a, 0x90, 0x9a, 0xbb, 0xf6, 0x32, 0x3d, 0x8b, 0x18, 0x55 }; - uint8_t x[16] = { 0xab, 0xae, 0x2b, 0x71, 0xec, 0xb2, 0xff, 0xff, + u8_t x[16] = { 0xab, 0xae, 0x2b, 0x71, 0xec, 0xb2, 0xff, 0xff, 0x3e, 0x73, 0x77, 0xd1, 0x54, 0x84, 0xcb, 0xd5 }; - uint8_t y[16] = { 0xcf, 0xc4, 0x3d, 0xff, 0xf7, 0x83, 0x65, 0x21, + u8_t y[16] = { 0xcf, 0xc4, 0x3d, 0xff, 0xf7, 0x83, 0x65, 0x21, 0x6e, 0x5f, 0xa7, 0x25, 0xcc, 0xe7, 0xe8, 0xa6 }; - uint32_t exp_val = 0x2f9ed5ba % 1000000; - uint32_t val; + u32_t exp_val = 0x2f9ed5ba % 1000000; + u32_t val; int err; err = smp_g2(u, v, x, y, &val); @@ -4099,12 +4099,12 @@ static int smp_g2_test(void) #if defined(CONFIG_BLUETOOTH_BREDR) static int smp_h6_test(void) { - uint8_t w[16] = { 0x9b, 0x7d, 0x39, 0x0a, 0xa6, 0x10, 0x10, 0x34, + u8_t w[16] = { 0x9b, 0x7d, 0x39, 0x0a, 0xa6, 0x10, 0x10, 0x34, 0x05, 0xad, 0xc8, 0x57, 0xa3, 0x34, 0x02, 0xec }; - uint8_t key_id[4] = { 0x72, 0x62, 0x65, 0x6c }; - uint8_t exp_res[16] = { 0x99, 0x63, 0xb1, 0x80, 0xe2, 0xa9, 0xd3, 0xe8, + u8_t key_id[4] = { 0x72, 0x62, 0x65, 0x6c }; + u8_t exp_res[16] = { 0x99, 0x63, 0xb1, 0x80, 0xe2, 0xa9, 0xd3, 0xe8, 0x1c, 0xc9, 0x6d, 0xe7, 0x02, 0xe1, 0x9a, 0x2d}; - uint8_t res[16]; + u8_t res[16]; int err; err = smp_h6(w, key_id, res); @@ -4121,13 +4121,13 @@ static int smp_h6_test(void) static int smp_h7_test(void) { - uint8_t salt[16] = { 0x31, 0x70, 0x6d, 0x74, 0x00, 0x00, 0x00, 0x00, + u8_t salt[16] = { 0x31, 0x70, 0x6d, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - uint8_t w[16] = { 0x9b, 0x7d, 0x39, 0x0a, 0xa6, 0x10, 0x10, 0x34, + u8_t w[16] = { 0x9b, 0x7d, 0x39, 0x0a, 0xa6, 0x10, 0x10, 0x34, 0x05, 0xad, 0xc8, 0x57, 0xa3, 0x34, 0x02, 0xec }; - uint8_t exp_res[16] = { 0x11, 0x70, 0xa5, 0x75, 0x2a, 0x8c, 0x99, 0xd2, + u8_t exp_res[16] = { 0x11, 0x70, 0xa5, 0x75, 0x2a, 0x8c, 0x99, 0xd2, 0xec, 0xc0, 0xa3, 0xc6, 0x97, 0x35, 0x17, 0xfb}; - uint8_t res[16]; + u8_t res[16]; int err; err = smp_h7(salt, w, res); @@ -4276,7 +4276,7 @@ int bt_smp_auth_passkey_confirm(struct bt_conn *conn) } if (atomic_test_bit(smp->flags, SMP_FLAG_DHKEY_SEND)) { - uint8_t err; + u8_t err; #if defined(CONFIG_BLUETOOTH_CENTRAL) if (smp->chan.chan.conn->role == BT_HCI_ROLE_MASTER) { @@ -4447,10 +4447,10 @@ void bt_smp_update_keys(struct bt_conn *conn) } } -bool bt_smp_get_tk(struct bt_conn *conn, uint8_t *tk) +bool bt_smp_get_tk(struct bt_conn *conn, u8_t *tk) { struct bt_smp *smp; - uint8_t enc_size; + u8_t enc_size; smp = smp_chan_get(conn); if (!smp) { diff --git a/subsys/bluetooth/host/smp.h b/subsys/bluetooth/host/smp.h index a4fe98f98fb..7d564214787 100644 --- a/subsys/bluetooth/host/smp.h +++ b/subsys/bluetooth/host/smp.h @@ -10,7 +10,7 @@ */ struct bt_smp_hdr { - uint8_t code; + u8_t code; } __packed; #define BT_SMP_ERR_PASSKEY_ENTRY_FAILED 0x01 @@ -57,43 +57,43 @@ struct bt_smp_hdr { #define BT_SMP_CMD_PAIRING_REQ 0x01 #define BT_SMP_CMD_PAIRING_RSP 0x02 struct bt_smp_pairing { - uint8_t io_capability; - uint8_t oob_flag; - uint8_t auth_req; - uint8_t max_key_size; - uint8_t init_key_dist; - uint8_t resp_key_dist; + u8_t io_capability; + u8_t oob_flag; + u8_t auth_req; + u8_t max_key_size; + u8_t init_key_dist; + u8_t resp_key_dist; } __packed; #define BT_SMP_CMD_PAIRING_CONFIRM 0x03 struct bt_smp_pairing_confirm { - uint8_t val[16]; + u8_t val[16]; } __packed; #define BT_SMP_CMD_PAIRING_RANDOM 0x04 struct bt_smp_pairing_random { - uint8_t val[16]; + u8_t val[16]; } __packed; #define BT_SMP_CMD_PAIRING_FAIL 0x05 struct bt_smp_pairing_fail { - uint8_t reason; + u8_t reason; } __packed; #define BT_SMP_CMD_ENCRYPT_INFO 0x06 struct bt_smp_encrypt_info { - uint8_t ltk[16]; + u8_t ltk[16]; } __packed; #define BT_SMP_CMD_MASTER_IDENT 0x07 struct bt_smp_master_ident { - uint16_t ediv; - uint64_t rand; + u16_t ediv; + u64_t rand; } __packed; #define BT_SMP_CMD_IDENT_INFO 0x08 struct bt_smp_ident_info { - uint8_t irk[16]; + u8_t irk[16]; } __packed; #define BT_SMP_CMD_IDENT_ADDR_INFO 0x09 @@ -103,31 +103,31 @@ struct bt_smp_ident_addr_info { #define BT_SMP_CMD_SIGNING_INFO 0x0a struct bt_smp_signing_info { - uint8_t csrk[16]; + u8_t csrk[16]; } __packed; #define BT_SMP_CMD_SECURITY_REQUEST 0x0b struct bt_smp_security_request { - uint8_t auth_req; + u8_t auth_req; } __packed; #define BT_SMP_CMD_PUBLIC_KEY 0x0c struct bt_smp_public_key { - uint8_t x[32]; - uint8_t y[32]; + u8_t x[32]; + u8_t y[32]; } __packed; #define BT_SMP_DHKEY_CHECK 0x0d struct bt_smp_dhkey_check { - uint8_t e[16]; + u8_t e[16]; } __packed; -bool bt_smp_irk_matches(const uint8_t irk[16], const bt_addr_t *addr); -int bt_smp_create_rpa(const uint8_t irk[16], bt_addr_t *rpa); +bool bt_smp_irk_matches(const u8_t irk[16], const bt_addr_t *addr); +int bt_smp_create_rpa(const u8_t irk[16], bt_addr_t *rpa); int bt_smp_send_pairing_req(struct bt_conn *conn); int bt_smp_send_security_req(struct bt_conn *conn); void bt_smp_update_keys(struct bt_conn *conn); -bool bt_smp_get_tk(struct bt_conn *conn, uint8_t *tk); +bool bt_smp_get_tk(struct bt_conn *conn, u8_t *tk); int bt_smp_br_send_pairing_req(struct bt_conn *conn); diff --git a/subsys/bluetooth/host/storage.c b/subsys/bluetooth/host/storage.c index 89224cab9e0..ac071d56d0c 100644 --- a/subsys/bluetooth/host/storage.c +++ b/subsys/bluetooth/host/storage.c @@ -38,7 +38,7 @@ enum storage_access { STORAGE_WRITE }; -static int storage_open(const bt_addr_le_t *addr, uint16_t key, +static int storage_open(const bt_addr_le_t *addr, u16_t key, enum storage_access access, fs_file_t *file) { char path[STORAGE_PATH_MAX]; @@ -78,7 +78,7 @@ static int storage_open(const bt_addr_le_t *addr, uint16_t key, return fs_open(file, path); } -static ssize_t storage_read(const bt_addr_le_t *addr, uint16_t key, void *data, +static ssize_t storage_read(const bt_addr_le_t *addr, u16_t key, void *data, size_t length) { fs_file_t file; @@ -95,7 +95,7 @@ static ssize_t storage_read(const bt_addr_le_t *addr, uint16_t key, void *data, return ret; } -static ssize_t storage_write(const bt_addr_le_t *addr, uint16_t key, +static ssize_t storage_write(const bt_addr_le_t *addr, u16_t key, const void *data, size_t length) { fs_file_t file; diff --git a/subsys/bluetooth/host/uuid.c b/subsys/bluetooth/host/uuid.c index 52e12b987d2..f93403f6f78 100644 --- a/subsys/bluetooth/host/uuid.c +++ b/subsys/bluetooth/host/uuid.c @@ -82,8 +82,8 @@ int bt_uuid_cmp(const struct bt_uuid *u1, const struct bt_uuid *u2) #if defined(CONFIG_BLUETOOTH_DEBUG) void bt_uuid_to_str(const struct bt_uuid *uuid, char *str, size_t len) { - uint32_t tmp1, tmp5; - uint16_t tmp0, tmp2, tmp3, tmp4; + u32_t tmp1, tmp5; + u16_t tmp0, tmp2, tmp3, tmp4; switch (uuid->type) { case BT_UUID_TYPE_16: