13.07.2015 Views

HCI Extensions bcore-sp-009P

HCI Extensions bcore-sp-009P

HCI Extensions bcore-sp-009P

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Introduction1 IntroductionThe Host Computer Interface <strong>sp</strong>ecification [<strong>HCI</strong>] defines a set of common commands and events that passbetween a Bluetooth host and Bluetooth module. Although these handle the majority of functionality required tocontrol a Bluetooth module, the <strong>sp</strong>ecification’s authors foresaw the need to include (module)manufacturer-<strong>sp</strong>ecific extensions.This document describes the use of these <strong>HCI</strong> manufacturer-<strong>sp</strong>ecific extensions on CSR’s Bluetooth chips.<strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 3 of 13


Context2 ContextThe <strong>HCI</strong> interface, defined in [<strong>HCI</strong>], <strong>sp</strong>ecifies a functional interface between the Bluetooth host and the Bluetoothhost controller (the Bluetooth module).The <strong>sp</strong>ecification defines a set of “commands” that flow from the host to the module, and a set of “events” thatflow in the reverse direction. Each of the commands and events has an identifying number.The <strong>sp</strong>ecification provides a set of command identity numbers for “manufacturer-<strong>sp</strong>ecific” commands to alloweach module manufacturer to extend its implementation of <strong>HCI</strong> to permit access to module-<strong>sp</strong>ecific functionality.For example, a module manufacturer may provide commands to test its radio. The <strong>HCI</strong> <strong>sp</strong>ecification alsoprovides a single “manufacturer-<strong>sp</strong>ecific” event identifier.Standard<strong>HCI</strong>CommandsManufacturer-<strong>sp</strong>ecific<strong>HCI</strong>Commands<strong>HCI</strong><strong>HCI</strong>Commands<strong>HCI</strong>EventsStandard<strong>HCI</strong>EventsHostBluetooth ModuleManufacturer-<strong>sp</strong>ecific<strong>HCI</strong>EventFigure 2.1: Manufacturer-<strong>sp</strong>ecific <strong>HCI</strong> <strong>Extensions</strong> for BlueCoreThis document describes the use of these two manufacturer-<strong>sp</strong>ecific <strong>HCI</strong> extensions for a BlueCore chip.BlueCore <strong>HCI</strong> <strong>Extensions</strong><strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 4 of 13


Manufacturer-Specific <strong>HCI</strong> Commands and Events3 Manufacturer-Specific <strong>HCI</strong> Commands and EventsThe Bluetooth <strong>HCI</strong> <strong>sp</strong>ecification effectively multiplexes a set of parallel protocol streams over a single physicalconnection: ACL (asynchronous connection-less), SCO (synchronous connection-oriented) and Command/Event.The BlueCore firmware uses a single manufacturer-<strong>sp</strong>ecific <strong>HCI</strong> command and the single manufacturer-<strong>sp</strong>ecific<strong>HCI</strong> event to form a reliable bi-directional datagram service. Upon this datagram service it runs the <strong>HCI</strong>_EXTNprotocol, described in this document.The <strong>HCI</strong>_EXTN protocol tunnels through this single reliable manufacturer-<strong>sp</strong>ecific <strong>HCI</strong> command/event service toprovide 64 parallel bi-directional reliable datagram streams. The protocol supports datagram fragmentation andreassembly on the 64 streams.The full set of <strong>HCI</strong> streams may be viewed as shown in Figure 3.1.SCOStreamsACLStreamsStandard<strong>HCI</strong>Cmd/EvtTunnelledProtocolsSCOvariablenumberACLvariablenumber<strong>HCI</strong>Figure 3.1: <strong>HCI</strong> Streams3.1 Data From the Host: <strong>HCI</strong> Command<strong>HCI</strong> Cmd/Evtup to64<strong>HCI</strong>_EXTNThe structure of <strong>HCI</strong>_EXTN data packets from the host fits the standard <strong>HCI</strong> command pattern as shown inFigure 3.2.Bytes0x000xfcParameterTotal LengthPayloadDescriptor0 1 2 3 4 ...PacketPay................loadParameter Total LengthBlueCore <strong>HCI</strong> <strong>Extensions</strong>Figure 3.2: Structure of <strong>HCI</strong>_EXTN Data Packets from HostAs with a normal <strong>HCI</strong> command, the packet is an integer number of bytes in length. The packet can be between4 and 258 bytes long.The first two bytes, {0x00, 0xfc} are identical to <strong>HCI</strong> command:{OGF = 0x3f, OCF = 0x00}The opcode group field (OGF) of 0x3f implies a manufacturer-<strong>sp</strong>ecific <strong>HCI</strong> command.The “Parameter Total Length” byte is as for a normal <strong>HCI</strong> command packet. Its value is always 3 less than thetotal number of bytes in the packet.The “Payload Descriptor” byte defines the Payload’s logical channel through <strong>HCI</strong> and includes fragmentationinformation. This is described below.<strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 5 of 13


Manufacturer-Specific <strong>HCI</strong> Commands and EventsThe Payload field carries the packet or packet fragment being tunnelled through <strong>HCI</strong>. This can be between 0 and254 bytes long.3.2 Data to the Host: <strong>HCI</strong> EventThe structure of <strong>HCI</strong>_EXTN data packets to the host fits the standard <strong>HCI</strong> event pattern as shown in Figure 3.3.0xffParameterTotal LengthPayloadDescriptorPay................loadParameter Total LengthBytes0 1 2 3 ...PacketFigure 3.3: Structure of <strong>HCI</strong>_EXTN Data Packets to HostAs with a normal <strong>HCI</strong> event, the packet is an integer number of bytes in length. The packet can be between 3 and257 bytes long.The first byte, 0xff, implies the manufacturer-<strong>sp</strong>ecific <strong>HCI</strong> event.The “Parameter Total Length” byte is as for a normal <strong>HCI</strong> event packet. Its value will always be 2 less than thetotal number of bytes in the packet.The “Payload Descriptor” byte defines the Payload’s logical channel through <strong>HCI</strong> and includes fragmentationinformation. This is described in section 3.3.The Payload field carries the packet being tunnelled through <strong>HCI</strong>. This can be between 0 and 254 bytes long.3.3 Payload DescriptorThe two types of <strong>HCI</strong>_EXTN packet each include a “Payload Descriptor” byte. These have the following structure:BitsLastFragmentFirstFragment(msb)7 6 5Channel ID4 321 0Figure 3.4: Payload Descriptor Byte(lsb)BlueCore <strong>HCI</strong> <strong>Extensions</strong>The six bit Channel ID field describes the logical data channel being tunnelled through <strong>HCI</strong>.If the First Fragment bit is 1, then the Payload field carries the first fragment of a packet being passed throughthe channel, else it is a continuation fragment.If the Last Fragment bit is 1, then the Payload field carries the last fragment of a packet being passed throughthe channel, else it is not the last fragment.If the Payload field holds a complete (unfragmented) packet, then both fragmentation bits are set to 1.<strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 6 of 13


Fragmentation4 FragmentationEach <strong>HCI</strong>_EXTN packet has a maximum payload of 254 bytes. This is too small for some tunnelled protocols, so<strong>HCI</strong>_EXTN supports fragmentation.Any packet trying to pass through the hci_extn channel may be fragmented and sent as an ordered sequence offragments, each sized to fit <strong>HCI</strong>_EXTN Payload fields.The Payload Descriptor field provides two Fragment bits:• The first fragment of the ordered sequence must have its Start Fragment bit set to 1.• The last fragment of the ordered sequence must have its End Fragment bit set to 1.• If the original packet is passed through hci_extn as three or more fragments, then fragments betweenthe first and last must have both Fragment bits set to 0.• If the original packet is passed through hci_extn as a single fragment, then both Fragment bits are setto 1.For each hci_extn direction (host-to-chip and chip-to-host), once the first fragment of a packet has been passedinto hci_extn all of the remaining fragments of that packet must be passed before fragments of any other packet.(i.e., fragments from different tunnelled channels must not interleave.)Fragmentation may be used for packets that are smaller than 254 bytes.BlueCore <strong>HCI</strong> <strong>Extensions</strong><strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 7 of 13


Flow Control5 Flow ControlUnder normal circumstances <strong>HCI</strong>_EXTN is not concerned with flow control: <strong>HCI</strong>_EXTN provides a set of parallelreliable bi-directional datagram channels, and assumes each of these channels will handle its own flow control.This is the default case.Under unfortunate circumstances, manufacturer-<strong>sp</strong>ecific <strong>HCI</strong> commands may be subject to conventional <strong>HCI</strong>command flow control. In this case, for each <strong>HCI</strong>_EXTN packet that flows from the host to the chip (<strong>HCI</strong>command packet) a corre<strong>sp</strong>onding <strong>HCI</strong> Command Complete event with the following structure must be sent inthe reverse direction:Num_<strong>HCI</strong>_Command_PacketsAs for normal <strong>HCI</strong> Command Complete messagesCommand_Opcode {OGF = 0x3f, OCF = 0x00}Return_ParametersNoneTable 5.1: Flow Control Command Complete EventUse of this flow control mechanism will be enabled by local configuration.BlueCore <strong>HCI</strong> <strong>Extensions</strong><strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 8 of 13


Tunnelled Channels6 Tunnelled ChannelsThe <strong>HCI</strong> commands and events defined in section 3 provide up to 64 reliable bi-directional datagram channelsthrough the extended <strong>HCI</strong>.Each channel has an identifier. The same identifier is used in <strong>HCI</strong> commands and events for a given channel.Some of the channel identifiers have been allocated as shown in Table 6.1.Channel ID Allocation Notes(a)(b)(c)0, 1 Not available2 BCCMD Defined in [BCCMD]3 HQ Defined in [HQ]4 Device Mgr Lib5, 6, 7 Not available8 L2CAP Lib9 RFCOMM Lib10 SDP Lib11 Not available12 DFU Defined in [DFUPROT]13 VM14 → 19 Unallocated20 LM debug21 → 63 UnallocatedTable 6.1: Channel IdentifiersSome BlueCore firmware builds provide a resource-limited Bluetooth stack on the chip including L2CAP,RFCOMM and SDP. Communication to the tops of these stack elements can pass through this protocol.CCL define these channels’ protocols in [BSTK] and [BCCODE]. The Device Manager channel is CCLproprietary(effectively it is CCL’s “private channel”).Currently used to carry debugging information from the chip. This is for CSR development only, anddetails of this channel will not be published.Channel for communication to/from application code in the VM. Protocol currently undocumented. Thiswill carry application and debug information using multiplexing.(a)(a)(a)(a)(b)(c)(b)BlueCore <strong>HCI</strong> <strong>Extensions</strong><strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 9 of 13


Notes7 NotesThis section provides some observations on the protocol described above. This section does not form part of the<strong>sp</strong>ecification.Most of the standard <strong>HCI</strong> commands are associated with a Command Complete event, and optionally a set ofCommand Status events. By default, the protocol described above does not follow this convention: an <strong>HCI</strong>_EXTN<strong>HCI</strong> Command has no implied related Command Complete event. This means the tunnelled protocols mustprovide their own flow control.The section on Flow Control describes the use of a Command Complete event packet. The description ofCommand Complete event packets in section 5.2.14 of [<strong>HCI</strong>] does not describe its use with manufacturer-<strong>sp</strong>ecific<strong>HCI</strong> commands. It is neither allowed nor prohibited.The section on Flow Control above describes an <strong>HCI</strong> Command Complete flow control mechanism. This i<strong>sp</strong>rovided for systems where the host applies conventional <strong>HCI</strong> Command flow control to all <strong>HCI</strong> traffic (includinghci_extn traffic). This is likely to give poor performance,as it effectively imposes a window size of 1 for host tochip traffic (assuming the default maximum Num_<strong>HCI</strong>_Command_Packets). In BlueCore firmware, this iscurrently controlled by PS Key PSKEY_HOSTIO_USE_<strong>HCI</strong>_EXTN_CCFC.The protocol allows a maximum packet payload of 254 bytes, but implementations may need to limit packets tosmaller maximum sizes, e.g., to allow low latency on <strong>HCI</strong> SCO packets.The channel identifiers mirror those used in BCSP, described in [BCSPCHAN].If a BlueCore chip uses a BCSP host interface, the protocol described in this document effectively provides asecond route for the non-standard HostModule channels. It will normally make sense to use only one of theseroutes in a given application, and it may be better to use the BCSP channels. This configuration isapplication-<strong>sp</strong>ecific. In BlueCore firmware this is currently controlled by PS KeyPSKEY_HOSTIO_USE_<strong>HCI</strong>_EXTN.Section 5.2.12 of [<strong>HCI</strong>] suggests (but does not imply) that the first <strong>HCI</strong> message is a Command Status event,used to indicate that the module is ready to receive <strong>HCI</strong> commands. The protocol described in this documentmay violate this notion. This will be important if module initialisation is performed over BCCMD, which shouldoccur before standard <strong>HCI</strong> traffic.Ericsson’s manufacturer-<strong>sp</strong>ecific <strong>HCI</strong> extensions continue the standard <strong>HCI</strong> theme of <strong>HCI</strong> commands provokingactions on the module and returning <strong>HCI</strong> events. <strong>HCI</strong>_EXTN clearly follows a different model. Thecommand/re<strong>sp</strong>onse model does not suit tunnelled protocols that carry bulk data, e.g., to the on-chipimplementation of RFCOMM.BlueCore <strong>HCI</strong> <strong>Extensions</strong><strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 10 of 13


Document References8 Document ReferencesReferenceDocument[BCCMD][DFUPROT][BCSPCHAN][<strong>HCI</strong>][HQ][BCCODE]BCCMD Protocol; CSR document <strong>bcore</strong>-<strong>sp</strong>-002PBlue Core Device Firmware Upgrade Protocol Specification; CSR document bc01-an-095BCSP Channel Allocation; CSR document <strong>bcore</strong>-<strong>sp</strong>-007PHost Computer Interface <strong>sp</strong>ecification; Section H:1 of [BT]HQ Protocol; CSR document <strong>bcore</strong>-<strong>sp</strong>-011PPacket coding procedure on CCL-defined BCSP channels; CCL document AN-002 "Usingthe BlueStack API over BCSP”[BSTK] BlueStack User Manual; CCL document C6066-UM-001 v1.6[BT] Specification of the Bluetooth System, Volume 1, Core, v1.1, 22 February 2001Further ReferencesCSR’s Implementation of <strong>HCI</strong> on BlueCore; CSR document <strong>bcore</strong>-me-007PBCCMD Test Commands; CSR document <strong>bcore</strong>-<strong>sp</strong>-001PBlueCore <strong>HCI</strong> <strong>Extensions</strong><strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 11 of 13


Acronyms and DefinitionsAcronyms and DefinitionsBlueCoreBlueLabBlueStackBluetoothACLBCCMDBCSPCCLCSRDFU<strong>HCI</strong><strong>HCI</strong>_EXTNHQL2CAPLSBMSBOCFOGFRFCOMMSCOVMGroup term for CSR’s range of Bluetooth chipsCSR’s software development kit for applications running in BlueCore’s VMCCL’s implementation of the “higher layers” of a Bluetooth stack: L2CAP, SDP andRFCOMMA set of technologies providing audio and data transfer over short-range radioconnectionsAsynchronous Connection-Less. Bluetooth-defined reliable datagram serviceBlueCore Command Protocol, described in [BCCMD].BlueCore Serial ProtocolCambridge Consultants LtdCambridge Silicon Radio LtdDevice Firmware UpgradeHost Controller Interface; part of the Bluetooth <strong>sp</strong>ecification [BT]The protocol described in this document, providing a set of reliable datagram streamstunnelled through <strong>HCI</strong> manufacturer-<strong>sp</strong>ecific extensionsHost Query Protocol; a “private channel” protocol allowing the BlueCore firmware toaccess services on its hostBluetooth-defined reliable datagram serviceLeast Significant BitMost Significant BitOpcode Command FieldOpcode Group FieldBluetooth-defined serial port emulation serviceSynchronous Connection-Oriented. Bluetooth-defined unreliable audio sample streamserviceVirtual Machine; environment in BlueCore firmware for running application-<strong>sp</strong>ecific codeBlueCore <strong>HCI</strong> <strong>Extensions</strong><strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 12 of 13


Record of ChangesRecord of ChangesDate Revision Comment08 JAN 03 aDocument originally published as CSR reference bc01-an-067 (revisions athrough c, versions through <strong>HCI</strong>Stack1.1v15.x builds).New revision control number allocated to align with <strong>HCI</strong>Stack1.1v16.x builds.<strong>HCI</strong> <strong>Extensions</strong><strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>aJanuary 2003BlueCore <strong>HCI</strong> <strong>Extensions</strong>Bluetooth and the Bluetooth logos are trademarks owned by Bluetooth SIG Inc, USA and licensed to CSR.BlueCore is a trademark of CSR.All other product, service and company names are trademarks, registered trademarks or service marks of theirre<strong>sp</strong>ective owners.CSR’s products are not authorised for use in life-support or safety-critical applications.<strong>bcore</strong>-<strong>sp</strong>-<strong>009P</strong>a© Copyright CSR 2001-2003This material is subject to CSR’s non-disclosure agreement.Page 13 of 13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!