全部博文(92)
分类: 嵌入式
2009-09-18 19:45:06
In the side of Host: application, SDP, L2cap software, and other protocols are made in the form of software(Bluez is based on the kernel layer process). In the side of Module: Link Manager, BB, and other protocol are provided in hardware, in firmware.
The HCI was rather special, part of it is implemented in software, protocols and procedures used to provide access to the upper interface (Bluez in, hci.c hci_usb.c, hci_sock.c, etc.). The other part is implemented in the Firmware which is used to pass the instruction such to the underlying protocol.
The communication between the upper PC procedures and the lower modules is through HCI. There are four different forms of transmission :
Commands, Event, ACL Data, SCO / eSCO Data.
1.1. HCI Command:
HCI Command is the Host to send commands to Modules way. HCI Command Packet is structured as follows:
HCI Event 3 types: Command complete Event, Command States Event, Command Subsequently Completend.
Command complete Event: If the Host sends a Command results can immediately, it will send such Event. In other words, if the Command sent only to the local Modules related and not deal with the remote device, use the Command complete Event. For example: HCI_Read_Buffer_Size.
Command States Event: If the Host sends the Command can not immediately know the results, then the sending of such Event. Host send Command carried out in order to deal with the Remote device, you must not immediately know the results, they will send Command States Event. For example:
HCI Connect.
Command Subsequently Completend: Command delayed the completion of Event. For example: Connection has been established.
The following figure is a Command-Event examples:
From this figure you can see, if the Host sends the Command relevant to the Remote device, it will first send Command States Event. When movements are actually completed, and then send the Command Subsequently Completend.
The following diagram shows l2cap data how pass to the underlying protocol step by step.
Obviously, a l2cap packet will follow the rules and cut into several HCI packets. HCI data packets is passed to the USB device through the HCI-usb layer. Each package also sent to the bottom through the USB driver.