hci: add hci_set_num_iso_packets_to_queue

This commit is contained in:
Matthias Ringwald 2022-08-23 16:27:48 +02:00
parent d4e5d4fa6b
commit 01d4f05fe7
2 changed files with 17 additions and 1 deletions

View File

@ -4384,6 +4384,10 @@ void hci_init(const hci_transport_t *transport, const void *config){
hci_stack->le_connection_parameter_range.le_supervision_timeout_min = 10; hci_stack->le_connection_parameter_range.le_supervision_timeout_min = 10;
hci_stack->le_connection_parameter_range.le_supervision_timeout_max = 3200; hci_stack->le_connection_parameter_range.le_supervision_timeout_max = 3200;
#ifdef ENABLE_LE_ISOCHRONOUS_STREAMS
hci_stack->iso_packets_to_queue = 1;
#endif
hci_state_reset(); hci_state_reset();
} }
@ -9096,6 +9100,10 @@ static le_audio_big_sync_t * hci_big_sync_for_handle(uint8_t big_handle){
return NULL; return NULL;
} }
void hci_set_num_iso_packets_to_queue(uint8_t num_packets){
hci_stack->iso_packets_to_queue = num_packets;
}
static void hci_iso_notify_can_send_now(void){ static void hci_iso_notify_can_send_now(void){
btstack_linked_list_iterator_t it; btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &hci_stack->le_audio_bigs); btstack_linked_list_iterator_init(&it, &hci_stack->le_audio_bigs);
@ -9107,7 +9115,7 @@ static void hci_iso_notify_can_send_now(void){
bool can_send = true; bool can_send = true;
for (i=0;i<big->num_bis;i++){ for (i=0;i<big->num_bis;i++){
hci_iso_stream_t * iso_stream = hci_iso_stream_for_con_handle(big->bis_con_handles[i]); hci_iso_stream_t * iso_stream = hci_iso_stream_for_con_handle(big->bis_con_handles[i]);
if ((iso_stream == NULL) || (iso_stream->num_packets_sent > 0) || (iso_stream->emit_ready_to_send)){ if ((iso_stream == NULL) || (iso_stream->num_packets_sent >= hci_stack->iso_packets_to_queue) || (iso_stream->emit_ready_to_send)){
can_send = false; can_send = false;
break; break;
} }

View File

@ -950,6 +950,8 @@ typedef struct {
uint16_t iso_fragmentation_total_size; uint16_t iso_fragmentation_total_size;
bool iso_fragmentation_tx_active; bool iso_fragmentation_tx_active;
uint8_t iso_packets_to_queue;
// list of iso streams // list of iso streams
btstack_linked_list_t iso_streams; btstack_linked_list_t iso_streams;
@ -1271,6 +1273,12 @@ void hci_set_sco_voice_setting(uint16_t voice_setting);
*/ */
uint16_t hci_get_sco_voice_setting(void); uint16_t hci_get_sco_voice_setting(void);
/**
* @brief Set number of ISO packets to buffer for BIS/CIS
* @param num_packets (default = 1)
*/
void hci_set_num_iso_packets_to_queue(uint8_t num_packets);
/** /**
* @brief Set inquiry mode: standard, with RSSI, with RSSI + Extended Inquiry Results. Has to be called before power on. * @brief Set inquiry mode: standard, with RSSI, with RSSI + Extended Inquiry Results. Has to be called before power on.
* @param inquriy_mode see bluetooth_defines.h * @param inquriy_mode see bluetooth_defines.h