当前位置:网站首页>Ble HCI flow control mechanism

Ble HCI flow control mechanism

2022-07-04 17:18:00 Millennium fate

HCI There are two flow control mechanisms

  • packet-based - Control the sending and receiving based on the number of packets
  • data-block-based - Control the sending and receiving based on the data length

BR/EDR By default packet-based, You can use HCI_Write_Flow_Control_Mode command Set up , and BLE Only support packet-based
 Insert picture description here

One 、Host to Controller data flow control

At the beginning ,Host adopt HCI_LE_Read_Buffer_Size Command acquisition Controller Each of them ACL buffer Size , as well as ACL buffer The number of , This number is allowed Host towards Controller Continuous transmission ACL Number of bags
 Insert picture description here When Host towards Controller Send a ACL After package , The number of contract awarding is allowed to be reduced 1, When the number of contracts allowed is 0 when , Can't go to Controller send out
When Controller Deal with one ACL After package , If the data has been sent to the peer device ,Controller Release ACL buffer Space , And to Host send out HCI_Number_Of_Completed_Packets event, At this time, it is allowed to add 1,Host You can continue to Controller Sent
If Controller Handle multiple at the same time ACL package ,Controller Release multiple ACL buffer Space ,HCI_Number_Of_Completed_Packets event There will be multiple connections released in ACL buffer Number , At this time, the increment of the number of contracts is allowed to be released for all connections ACL buffer The sum of the numbers
 Insert picture description here

Two 、Controller to Host data flow control

Controller towards Host The flow control of the direction is off by default , Can pass HCI_Set_Controller_To_Host_Flow_Control cmd Turn on or off
 Insert picture description here
Mechanism and Host to Controller be similar , At the beginning ,Host adopt HCI_Host_Buffer_Size cmd inform Controller Own each ACL buffer Size , as well as ACL buffer The number of , This number is allowed Controller towards Host Continuous transmission ACL Number of bags

 Insert picture description here
When Controller towards Host Send a ACL After package , The number of contract awarding is allowed to be reduced 1, When the number of contracts allowed is 0 when , Can't go to Host send out
When Host Deal with one ACL After package , If the data has been sent to the upper layer for processing ,Host Release ACL buffer Space , And to Controller send out HCI_Host_Number_Of_Completed_Packets command, At this time, it is allowed to add 1,Controller You can continue to Host Sent
If Host Handle multiple at the same time ACL package ,Host Release multiple ACL buffer Space ,HCI_Host_Number_Of_Completed_Packets command There will be multiple connections released in ACL buffer Number , At this time, the increment of the number of contracts is allowed to be released for all connections ACL buffer The sum of the numbers
HCI_Host_Number_Of_Completed_Packets cmd It's a special one cmd, It is not controlled by flow control ,Host Can at any time to Controller send out , And there is no corresponding event Generate
 Insert picture description here

3、 ... and 、command flow control

When Host towards Controller send out command after ,Controller Will send to Host return HCI_Command_Complete event or HCI_Command_Status event, these two items. event There are parameters in num_of_allowed_command_packet, This parameter is Host Can be directed to Controller Continuous transmission command The number of
At the beginning or at any subsequent time ,Controller Can be directed to Host send out Command Opcode=0x0000 Of HCI_Command_Status event or HCI_Command_Status event, To inform Host Continuous transmission is allowed at this time command The number of
 Insert picture description here  Insert picture description here

原网站

版权声明
本文为[Millennium fate]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/185/202207041523579277.html