@@ -44,10 +44,10 @@ static int
44
44
ble_hs_flow_tx_num_comp_pkts (void )
45
45
{
46
46
uint8_t buf [
47
- BLE_HCI_HOST_NUM_COMP_PKTS_HDR_LEN +
48
- BLE_HCI_HOST_NUM_COMP_PKTS_ENT_LEN
47
+ sizeof ( struct ble_hci_cb_host_num_comp_pkts_cp ) +
48
+ sizeof ( struct ble_hci_cb_host_num_comp_pkts_entry )
49
49
];
50
- struct hci_host_num_comp_pkts_entry entry ;
50
+ struct ble_hci_cb_host_num_comp_pkts_cp * cmd = ( void * ) buf ;
51
51
struct ble_hs_conn * conn ;
52
52
int rc ;
53
53
@@ -62,16 +62,12 @@ ble_hs_flow_tx_num_comp_pkts(void)
62
62
63
63
if (conn -> bhc_completed_pkts > 0 ) {
64
64
/* Only specify one connection per command. */
65
- buf [0 ] = 1 ;
65
+ /* TODO could combine this in single HCI command */
66
+ cmd -> handles = 1 ;
66
67
67
68
/* Append entry for this connection. */
68
- entry .conn_handle = conn -> bhc_handle ;
69
- entry .num_pkts = conn -> bhc_completed_pkts ;
70
- rc = ble_hs_hci_cmd_build_host_num_comp_pkts_entry (
71
- & entry ,
72
- buf + BLE_HCI_HOST_NUM_COMP_PKTS_HDR_LEN ,
73
- sizeof buf - BLE_HCI_HOST_NUM_COMP_PKTS_HDR_LEN );
74
- BLE_HS_DBG_ASSERT (rc == 0 );
69
+ cmd -> h [0 ].handle = htole16 (conn -> bhc_handle );
70
+ cmd -> h [0 ].count = htole16 (conn -> bhc_completed_pkts );
75
71
76
72
conn -> bhc_completed_pkts = 0 ;
77
73
224
220
ble_hs_flow_startup (void )
225
221
{
226
222
#if MYNEWT_VAL (BLE_HS_FLOW_CTRL )
227
- struct hci_host_buf_size buf_size_cmd ;
223
+ struct ble_hci_cb_ctlr_to_host_fc_cp enable_cmd ;
224
+ struct ble_hci_cb_host_buf_size_cp buf_size_cmd = {
225
+ .acl_data_len = htole16 (MYNEWT_VAL (BLE_ACL_BUF_SIZE )),
226
+ .acl_num = htole16 (MYNEWT_VAL (BLE_ACL_BUF_COUNT )),
227
+ };
228
228
int rc ;
229
229
230
230
ble_npl_event_init (& ble_hs_flow_ev , ble_hs_flow_event_cb , NULL );
@@ -233,18 +233,23 @@ ble_hs_flow_startup(void)
233
233
ble_hci_trans_set_acl_free_cb (NULL , NULL );
234
234
ble_npl_callout_stop (& ble_hs_flow_timer );
235
235
236
- rc = ble_hs_hci_cmd_tx_set_ctlr_to_host_fc (BLE_HCI_CTLR_TO_HOST_FC_ACL );
236
+ enable_cmd .enable = BLE_HCI_CTLR_TO_HOST_FC_ACL ;
237
+
238
+ rc = ble_hs_hci_cmd_tx (BLE_HCI_OP (BLE_HCI_OGF_CTLR_BASEBAND ,
239
+ BLE_HCI_OCF_CB_SET_CTLR_TO_HOST_FC ),
240
+ & enable_cmd , sizeof (enable_cmd ), NULL , 0 );
237
241
if (rc != 0 ) {
238
242
return rc ;
239
243
}
240
244
241
- buf_size_cmd = (struct hci_host_buf_size ) {
242
- .acl_pkt_len = MYNEWT_VAL (BLE_ACL_BUF_SIZE ),
243
- .num_acl_pkts = MYNEWT_VAL (BLE_ACL_BUF_COUNT ),
244
- };
245
- rc = ble_hs_hci_cmd_tx_host_buf_size (& buf_size_cmd );
245
+ rc = ble_hs_hci_cmd_tx (BLE_HCI_OP (BLE_HCI_OGF_CTLR_BASEBAND ,
246
+ BLE_HCI_OCF_CB_HOST_BUF_SIZE ),
247
+ & buf_size_cmd , sizeof (buf_size_cmd ), NULL , 0 );
246
248
if (rc != 0 ) {
247
- ble_hs_hci_cmd_tx_set_ctlr_to_host_fc (BLE_HCI_CTLR_TO_HOST_FC_OFF );
249
+ enable_cmd .enable = BLE_HCI_CTLR_TO_HOST_FC_OFF ;
250
+ ble_hs_hci_cmd_tx (BLE_HCI_OP (BLE_HCI_OGF_CTLR_BASEBAND ,
251
+ BLE_HCI_OCF_CB_SET_CTLR_TO_HOST_FC ),
252
+ & enable_cmd , sizeof (enable_cmd ), NULL , 0 );
248
253
return rc ;
249
254
}
250
255
0 commit comments