I am trying to understand the communication flow from Bluetooth stack to Bluetooth Chip for Android. I found documentation regarding Bluetooth for Android here. However, it does not describe communication in detail, especially from Bluetooth stack to Chip. Here are my questions:
What are the System modules involved in communication to BT chip and its flow?
What is the role of HCI in the above flow?
I appreciate if someone can provide a clear explanation or links regarding my queries.
Thanks in advance.
What are the System modules involved in communication to BT chip and its flow?
Generally the Bluetooth stack(not only Bluedroid) will talk to the chip via uart(embedded device such as phone or carkit) or USB(most used on PC), then at one thread used for read from chip(use H4 protocol or BCSP), and we can take the write thread as one thread(also the same protocol). The flow just like in the initialize procedure, the Bluetooth chip would be power on(use rfkill e.g. on Linux or Android), and the stack would open the hardware interface e.g. UART, write some configuration files(e.g. local Bluetooth address) and patch files, then warm rest the chip. After that the chip and stack can work :normally:.
What is the role of HCI in the above flow?
I am not sure what did you mean about the term "HCI in the above flow", I assume you mean the data flow or other things? the stack will judge the packet type which sent from chip, divide the into HCI event, user data(L2CAP), or other kind of packet format, then transfer them(call back) into upper layer, e.g. RFCOMM or AVDTP. In other side, the upper layer protocol and profiles will collect the data then send it to Bluetooth chip.
Does HCI perform the actual communication (command and data transfer) to the Bluetooth chip? Or does it perform only logging the communication (HCISnoop log).
HCI was just an interface between host and controller actually, so first yes their was some part code will generate btsnoop log somewhere, regarding to the actual communication, you can say it belongs to the HCI part(from code perspective) but you also can say it does not belongs to the HCI part(from logic perspective).