Skip to content

Commit 1082724

Browse files
author
Melinda Weed
committed
formatting changes
1 parent db8f369 commit 1082724

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

features/FEATURE_BLE/targets/TARGET_CORDIO/doc/PortingGuide.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Porting guide
1+
## Porting guide
22

33
There are two main steps to enable the Mbed BLE Cordio port:
44

55
1. Configure your target to include Cordio BLE port and Cordio libraries during the build process.
66

77
1. Implement the `CordioHCIDriver` class targeting the Bluetooth controller.
88

9-
## Configure the target
9+
### Configure the target
1010

1111
1. Define all Mbed OS targets in the `targets/target.json` file:
1212

@@ -33,17 +33,17 @@ Compile the BLE Cordio port sources:
3333
}
3434
```
3535

36-
## Implement CordioHCIDriver:
36+
### Implement CordioHCIDriver:
3737

3838
Include an HCI driver for the BLE module used by the target, and a factory function that creates the BLE instance you use.
3939

40-
### Create source folder
40+
#### Create source folder
4141

4242
1. Navigate to the folder of the BLE API that hosts the target port `features/FEATURE_BLE/targets`.
4343

4444
1. Create a folder containing the port code to isolate it from other code. Begin this folder's name with `TARGET_` and the rest of the name in capital letters.
4545

46-
### Create the HCI driver
46+
#### Create the HCI driver
4747

4848
The HCI driver is split in two entities. One handles HCI communication with the Bluetooth module. The other handles initialization, reset sequence, and memory dedicated to the Bluetooth controller.
4949

@@ -182,31 +182,38 @@ Three functions handle the reset sequence process:
182182

183183
* `handle_reset_sequence`: Entry point to the state machine handling the reset process. Every time an HCI packet is received during the reset sequence, this function is called with the HCI packet received. Its purpose is to prepare the Bluetooth controller and set the parameters the stack needs to operate properly. You can override this function if necessary.
184184

185-
* `signal_reset_sequence_done`: Once the reset sequence is finished, you can call this function. You cannot override it.
185+
* `signal_reset_sequence_done`: Once the reset sequence is completed, you can call this function. You cannot override it.
186186

187187
###### Controller parameters to set
188188

189189
This step tells the controller which events are relevant to the stack.
190190

191-
The following parameters should be set in the controller (if supported):
191+
You should set the following parameters in the controller (if supported):
192192

193-
* Event mask: Call `HciSetEventMaskCmd((uint8_t *) hciEventMask)`.
193+
* **Event mask:** Call `HciSetEventMaskCmd((uint8_t *) hciEventMask)`.
194194

195-
* LE event mask: Call `HciLeSetEventMaskCmd((uint8_t *) hciLeEventMask)`.
195+
* **LE event mask:** Call `HciLeSetEventMaskCmd((uint8_t *) hciLeEventMask)`.
196196

197-
* 2nd page of events mask: Call `HciSetEventMaskPage2Cmd((uint8_t *) hciEventMaskPage2)`.
197+
* **2nd page of events mask:** Call `HciSetEventMaskPage2Cmd((uint8_t *) hciEventMaskPage2)`.
198198

199199
###### Stack runtime parameters
200200

201201
At runtime, you can get stack parameters from the controller:
202202

203-
* Bluetooth address: Query this with `HciReadBdAddrCmd`. Copy the response into `hciCoreCb.bdAddr` with `BdaCpy`.
204-
* Buffer size of the controller: Query this with `HciLeReadBufSizeCmd`. The return parameter `HC_ACL_Data_Packet_Length` is copied to `hciCoreCb.bufSize`. Copy the response parameter `HC_Synchronous_Data_Packet_Length` into `hciCoreCb.numBufs`. The value of `hciCoreCb.availBufs` shall be initialized with `hciCoreCb.numBufs`.
205-
* Supported state: Query this with `HciLeReadSupStatesCmd`, and copy the response into `hciCoreCb.leStates`.
206-
* Whitelist size: Query this with `HciLeReadWhiteListSizeCmd`, and copy the response into `hciCoreCb.whiteListSize`.
207-
* LE features supported: Query this with `HciLeReadLocalSupFeatCmd`, and copy the response into `hciCoreCb.leSupFeat`.
208-
* Resolving list size: Query this with `hciCoreReadResolvingListSize`, and copy the response into `hciCoreCb.resListSize`.
209-
* Max data length: Query this with `hciCoreReadMaxDataLen`, and pass the response parameters `supportedMaxTxOctets` and `supportedMaxTxTime` to the function `HciLeWriteDefDataLen`.
203+
* **Bluetooth address:** Query this with `HciReadBdAddrCmd`. Copy the response into `hciCoreCb.bdAddr` with `BdaCpy`.
204+
205+
* **Buffer size of the controller:** Query this with `HciLeReadBufSizeCmd`.
206+
* The return parameter `HC_ACL_Data_Packet_Length` is copied to `hciCoreCb.bufSize`. Copy the response parameter `HC_Synchronous_Data_Packet_Length` into `hciCoreCb.numBufs`. `hciCoreCb.numBufs` initializes the value of `hciCoreCb.availBufs`.
207+
208+
* **Supported state:** Query this with `HciLeReadSupStatesCmd`, and copy the response into `hciCoreCb.leStates`.
209+
210+
* **Whitelist size:** Query this with `HciLeReadWhiteListSizeCmd`, and copy the response into `hciCoreCb.whiteListSize`.
211+
212+
* **LE features supported:** Query this with `HciLeReadLocalSupFeatCmd`, and copy the response into `hciCoreCb.leSupFeat`.
213+
214+
* **Resolving list size:** Query this with `hciCoreReadResolvingListSize`, and copy the response into `hciCoreCb.resListSize`.
215+
216+
* **Max data length:** Query this with `hciCoreReadMaxDataLen`, and pass the response parameters `supportedMaxTxOctets` and `supportedMaxTxTime` to the function `HciLeWriteDefDataLen`.
210217

211218
**Example:**
212219

@@ -457,6 +464,6 @@ mbed test -t <toolchain> -m <target> -n mbed-os-features-feature_ble-targets-tar
457464

458465
You can use the application [mbed-os-cordio-hci-passthrough](https://github.com/ARMmbed/mbed-os-cordio-hci-passthrough) to proxify a Bluetooth controller connected to an Mbed board.
459466

460-
The host sent bytes over the board serial, which the `HCITransport Driver` then forwards. Bytes sent by the controller go back to the host through the board serial.
467+
The host sent bytes over the board serial, which the `HCITransport Driver` forwards. Bytes sent by the controller go back to the host through the board serial.
461468

462-
This application can be used to validate the transport driver and debug the initialization process.
469+
You can use this application to validate the transport driver and debug the initialization process.

0 commit comments

Comments
 (0)