l2cap.c (6574158ae6e99fa908421351f812c54ad85ae86f) | l2cap.c (6bd7c69d565ea381e3a37d6c7794a5e5cc7d5a0e) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 776 unchanged lines hidden (view full) --- 785} 786 787void l2cap_request_can_send_fix_channel_now_event(hci_con_handle_t con_handle, uint16_t channel_id){ 788 UNUSED(con_handle); // ok: there is no channel 789 790 int index = l2cap_fixed_channel_table_index_for_channel_id(channel_id); 791 if (index < 0) return; 792 | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 776 unchanged lines hidden (view full) --- 785} 786 787void l2cap_request_can_send_fix_channel_now_event(hci_con_handle_t con_handle, uint16_t channel_id){ 788 UNUSED(con_handle); // ok: there is no channel 789 790 int index = l2cap_fixed_channel_table_index_for_channel_id(channel_id); 791 if (index < 0) return; 792 |
793 // check if already registered 794 if (fixed_channels[index].waiting_for_can_send_now) return; 795 |
|
793 // insert into queue 794 if (fixed_channel_tail_index == FIXED_CHANNEL_FIFO_INVALID_INDEX){ 795 fixed_channel_head_index = index; 796 } else { 797 fixed_channels[fixed_channel_tail_index].next_request = index; 798 } 799 fixed_channel_tail_index = index; 800 fixed_channels[index].next_request = FIXED_CHANNEL_FIFO_INVALID_INDEX; --- 1057 unchanged lines hidden (view full) --- 1858 channel->waiting_for_can_send_now = 0; 1859 l2cap_emit_can_send_now(channel->packet_handler, channel->local_cid); 1860 } 1861#endif 1862 1863#if 1 1864 if (fixed_channel_head_index != FIXED_CHANNEL_FIFO_INVALID_INDEX){ 1865 int can_send = 0; | 796 // insert into queue 797 if (fixed_channel_tail_index == FIXED_CHANNEL_FIFO_INVALID_INDEX){ 798 fixed_channel_head_index = index; 799 } else { 800 fixed_channels[fixed_channel_tail_index].next_request = index; 801 } 802 fixed_channel_tail_index = index; 803 fixed_channels[index].next_request = FIXED_CHANNEL_FIFO_INVALID_INDEX; --- 1057 unchanged lines hidden (view full) --- 1861 channel->waiting_for_can_send_now = 0; 1862 l2cap_emit_can_send_now(channel->packet_handler, channel->local_cid); 1863 } 1864#endif 1865 1866#if 1 1867 if (fixed_channel_head_index != FIXED_CHANNEL_FIFO_INVALID_INDEX){ 1868 int can_send = 0; |
1869 int remove_entry = 1; |
|
1866 uint8_t i = fixed_channel_head_index; 1867 if (fixed_channels[i].callback && fixed_channels[i].waiting_for_can_send_now){ 1868 if (l2cap_fixed_channel_table_index_is_le(i)){ 1869#ifdef ENABLE_BLE 1870 can_send = hci_can_send_acl_le_packet_now(); | 1870 uint8_t i = fixed_channel_head_index; 1871 if (fixed_channels[i].callback && fixed_channels[i].waiting_for_can_send_now){ 1872 if (l2cap_fixed_channel_table_index_is_le(i)){ 1873#ifdef ENABLE_BLE 1874 can_send = hci_can_send_acl_le_packet_now(); |
1875 remove_entry = can_send; |
|
1871#endif 1872 } else { 1873#ifdef ENABLE_CLASSIC 1874 can_send = hci_can_send_acl_classic_packet_now(); | 1876#endif 1877 } else { 1878#ifdef ENABLE_CLASSIC 1879 can_send = hci_can_send_acl_classic_packet_now(); |
1880 remove_entry = can_send; |
|
1875#endif | 1881#endif |
1876 } | 1882 } |
1877 } | 1883 } |
1878 fixed_channels[i].waiting_for_can_send_now = 0; 1879 fixed_channel_head_index = fixed_channels[i].next_request; 1880 fixed_channels[i].next_request = FIXED_CHANNEL_FIFO_INVALID_INDEX; 1881 if (fixed_channel_head_index == FIXED_CHANNEL_FIFO_INVALID_INDEX){ 1882 fixed_channel_tail_index = FIXED_CHANNEL_FIFO_INVALID_INDEX; | 1884 // remove entry 1885 if (remove_entry){ 1886 fixed_channels[i].waiting_for_can_send_now = 0; 1887 fixed_channel_head_index = fixed_channels[i].next_request; 1888 fixed_channels[i].next_request = FIXED_CHANNEL_FIFO_INVALID_INDEX; 1889 if (fixed_channel_head_index == FIXED_CHANNEL_FIFO_INVALID_INDEX){ 1890 fixed_channel_tail_index = FIXED_CHANNEL_FIFO_INVALID_INDEX; 1891 } |
1883 } | 1892 } |
1893 // notify |
|
1884 if (can_send) { 1885 l2cap_emit_can_send_now(fixed_channels[i].callback, l2cap_fixed_channel_table_channel_id_for_index(i)); 1886 } 1887 } 1888#else 1889 int i; 1890 for (i=0;i<L2CAP_FIXED_CHANNEL_TABLE_SIZE;i++){ 1891 if (!fixed_channels[i].callback) continue; --- 1804 unchanged lines hidden --- | 1894 if (can_send) { 1895 l2cap_emit_can_send_now(fixed_channels[i].callback, l2cap_fixed_channel_table_channel_id_for_index(i)); 1896 } 1897 } 1898#else 1899 int i; 1900 for (i=0;i<L2CAP_FIXED_CHANNEL_TABLE_SIZE;i++){ 1901 if (!fixed_channels[i].callback) continue; --- 1804 unchanged lines hidden --- |