Skip to content

Commit 739bd66

Browse files
author
Melinda Weed
committed
grammatical and stylistic fixes, more passive -> active
1 parent f2c6d59 commit 739bd66

File tree

2 files changed

+68
-64
lines changed

2 files changed

+68
-64
lines changed
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
# HCI abstraction architecture
22

33
The HCI driver is split into two interfaces:
4-
* `CordioHCIDriver`: It is the driver for a BLE controller. It contains
5-
the primitive necessary to start and initialize the controller.
6-
* `CordioHCITransport`: It is the transport interface which is used by the HCI
4+
* `CordioHCIDriver`: It is the driver for a BLE controller. It contains
5+
the primitive necessary to start and initialize the controller.
6+
* `CordioHCITransport`: It is the transport interface which is used by the HCI
77
driver to communicate with the controller.
88

9-
A `CordioHCITransport` is injected into a `CordioHCIDriver` at construction
9+
A `CordioHCITransport` is injected into a `CordioHCIDriver` at construction
1010
time. A `CordioHCIDriver` is also injected at construction time of a `BLECordio`
11-
instance.
11+
instance.
1212

13-
This can be summarized in the following diagram:
13+
This can be summarized in the following diagram:
1414

1515
![](resources/architecture.png)
1616

1717
## CordioHCITransportDriver
1818

19-
The single responsabilities of this a driver is to handle the communication with
20-
the Bluetooth module. Basically, sending and reading bytes.
19+
The single responsibility of this driver is to handle the communication with
20+
the Bluetooth module. Basically, sending and reading bytes.
2121

22-
Given that the Bluetooth specification define standard transport interface, an
23-
implementation of the H4 interface is bundled in this port. It might be extended
24-
in the future with an implementation of the H5 interface. However there is no
22+
Given that the Bluetooth specification defines standard transport interface, an
23+
implementation of the H4 interface is bundled in this port. It might be extended
24+
in the future with an implementation of the H5 interface. However, there is no
2525
plan to provide the SDIO implementation at the moment.
2626

27-
This interface is defined in the header file
27+
This interface is defined in the header file
2828
[CordioHCITransportDriver.h](../driver/CordioHCITransportDriver.h)
2929

3030
## CordioHCIDriver
3131

32-
The responsibilities of this driver are:
33-
* Provide the memory which will used by the Bluetooth stack.
34-
* Initialize the bluetooth controller.
35-
* Handle the reset/startup sequence of the bluetooth controller.
32+
The responsibilities of this driver are:
33+
* Provide the memory which will used by the Bluetooth stack.
34+
* Initialize the Bluetooth controller.
35+
* Handle the reset/startup sequence of the Bluetooth controller.
3636

37-
This interface is defined in the header file
37+
This interface is defined in the header file
3838
[CordioHCIDriver.h](../driver/CordioHCIDriver.h)
3939

40-
A partial implementation is present in the file
41-
[CordioHCIDriver.cpp](../driver/CordioHCIDriver.cpp). It defines the function
42-
delivering memory to the stack and a complete reset sequence. However it does
43-
not define any initialization for the Bluetooth controller, this part being
44-
specific to the controller used.
40+
A partial implementation is present in the file
41+
[CordioHCIDriver.cpp](../driver/CordioHCIDriver.cpp). It defines the function
42+
delivering memory to the stack and a complete reset sequence. However, it does
43+
not define any initialization for the Bluetooth controller, this part being
44+
specific to the controller used.

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

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ There are two main steps to enable the Mbed BLE Cordio port:
88

99
## Configure the target
1010

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

13-
* Add BLE support to the target:
13+
1. Add BLE support to the target:
1414

15-
* Add the string `BLE` to the target's list of `features`. This adds the BLE API sources to the list of sources compiled for the target.
15+
* Add the string `BLE` to the target's list of `features`. This adds the BLE API sources to the list of sources compiled for the target:
1616

1717
```
1818
"TARGET_NAME": {
@@ -24,7 +24,7 @@ Define all Mbed OS targets in the `targets/target.json` file:
2424

2525
Compile the BLE Cordio port sources:
2626

27-
* Add the string `CORDIO` to the `extra_labels` property of the JSON file.
27+
* Add the string `CORDIO` to the `extra_labels` property of the JSON file:
2828

2929
```
3030
"TARGET_NAME": {
@@ -39,15 +39,15 @@ Include an HCI driver for the BLE module used by the target, and a factory funct
3939

4040
### Create source folder
4141

42-
1. Navigate to the folder of the BLE API that hosts target port `features/FEATURE_BLE/targets`.
42+
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

4646
### Create the HCI driver
4747

4848
The HCI driver is split in two entities: one which handle HCI communication with the Bluetooth module and the other handling the initialization, reset sequence and memory dedicated for the Bluetooth controller.
4949

50-
More information about the architecture can be found in the [HCI abstraction architecture](HCIAbstraction.md) document.
50+
More information about the architecture can be found in [HCI abstraction architecture](HCIAbstraction.md).
5151

5252
#### HCITransport
5353

@@ -89,7 +89,9 @@ It inherits publicly from the base class `CordioHCITransportDriver`.
8989

9090
* **Sending data**: The function `write` sends data in input to the Bluetooth controller and return the number of bytes in the `data` buffer sent. Depending on the type of transport you implement, you may need to send the packet `type` to the controller before the packet data.
9191

92-
* **Receiving data**: Inject HCI data from the Bluetooth controller to the system by invoking the function `on_data_received`. This function is a static one and is provided by the base class:
92+
* **Receiving data**: Inject HCI data from the Bluetooth controller to the system by invoking the function `on_data_received`. This function is a static one and is provided by the base class.
93+
94+
**Example:**
9395

9496
```
9597
void on_data_received(uint8_t* data_received, uint16_t length_of_data_received);
@@ -137,11 +139,11 @@ private:
137139

138140
The functions `do_initialize` and `do_terminate` handle initialization and termination processes. These functions manage the state of the Bluetooth controller.
139141

140-
<span class="notes">**Note:** It is unnecessary to initialize or terminate the HCI transport in those function because it is handled by the base class. The HCI transport is initialized right before the call to `do_initialize` and is terminated right after the call to `do_terminate`.</span>
142+
<span class="notes">**Note:** It is unnecessary to initialize or terminate the HCI transport in these functions, because that is handled by the base class. The HCI transport is initialized right before the call to `do_initialize` and is terminated right after the call to `do_terminate`.</span>
141143

142144
##### Memory pool
143145

144-
The function `get_buffer_pool_description` in the base class returns a buffer of 1040 bytes divided in different memory pools:
146+
The function `get_buffer_pool_description` in the base class returns a buffer of 1040 bytes divided into different memory pools:
145147

146148
| Chunk size (bytes) | Number of chunks |
147149
|--------------------|------------------|
@@ -153,6 +155,8 @@ The function `get_buffer_pool_description` in the base class returns a buffer of
153155

154156
Porting overrides this function if the memory provided by the base class doesn't match what is required by the Bluetooth controller driver.
155157

158+
**Example:**
159+
156160
```
157161
buf_pool_desc_t CordioHCIDriver::get_buffer_pool_description() {
158162
static uint8_t buffer[/* buffer size */];
@@ -194,17 +198,17 @@ The following parameters should be set in the controller (if supported):
194198

195199
###### Stack runtime parameters
196200

197-
At runtime, you can get some stack parameters from the controller:
201+
At runtime, you can get stack parameters from the controller:
198202

199203
* Bluetooth address: Query this with `HciReadBdAddrCmd`. Copy the response into `hciCoreCb.bdAddr` with `BdaCpy`.
200-
201-
* Buffer size of the controller: Can be obtained by `HciLeReadBufSizeCmd`. The return parameter `HC_ACL_Data_Packet_Length` is copied to `hciCoreCb.bufSize`, and the response parameter `HC_Synchronous_Data_Packet_Length` shall be copied into `hciCoreCb.numBufs`. The value of `hciCoreCb.availBufs` shall be initialized with `hciCoreCb.numBufs`.
202-
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`.
203205
* Supported state: Query this with `HciLeReadSupStatesCmd`, and copy the response into `hciCoreCb.leStates`.
204206
* Whitelist size: Query this with `HciLeReadWhiteListSizeCmd`, and copy the response into `hciCoreCb.whiteListSize`.
205207
* LE features supported: Query this with `HciLeReadLocalSupFeatCmd`, and copy the response into `hciCoreCb.leSupFeat`.
206208
* Resolving list size: Query this with `hciCoreReadResolvingListSize`, and copy the response into `hciCoreCb.resListSize`.
207-
* Max data length: Query this with `hciCoreReadMaxDataLen`, and pass the response parameters `supportedMaxTxOctets` and `supportedMaxTxTime` to the function `HciLeWriteDefDataLen`:
209+
* Max data length: Query this with `hciCoreReadMaxDataLen`, and pass the response parameters `supportedMaxTxOctets` and `supportedMaxTxTime` to the function `HciLeWriteDefDataLen`.
210+
211+
**Example:**
208212

209213
```
210214
void HCIDriver::handle_reset_sequence(uint8_t *pMsg) {
@@ -228,90 +232,90 @@ void HCIDriver::handle_reset_sequence(uint8_t *pMsg) {
228232
case HCI_OPCODE_RESET:
229233
/* initialize rand command count */
230234
randCnt = 0;
231-
// set the event mask to control which events are generated by the
232-
// controller for the host
235+
// Set the event mask to control which events are generated by the
236+
// controller for the host.
233237
HciSetEventMaskCmd((uint8_t *) hciEventMask);
234238
break;
235239
236240
case HCI_OPCODE_SET_EVENT_MASK:
237-
// set the event mask to control which LE events are generated by
238-
// the controller for the host
241+
// Set the event mask to control which LE events are generated by
242+
// the controller for the host.
239243
HciLeSetEventMaskCmd((uint8_t *) hciLeEventMask);
240244
break;
241245
242246
case HCI_OPCODE_LE_SET_EVENT_MASK:
243-
// set the event mask to control which events are generated by the
244-
// controller for the host (2nd page of flags )
247+
// Set the event mask to control which events are generated by the
248+
// controller for the host (2nd page of flags).
245249
HciSetEventMaskPage2Cmd((uint8_t *) hciEventMaskPage2);
246250
break;
247251
248252
case HCI_OPCODE_SET_EVENT_MASK_PAGE2:
249-
// Ask the Bluetooth address of the controller
253+
// Ask the Bluetooth address of the controller.
250254
HciReadBdAddrCmd();
251255
break;
252256
253257
case HCI_OPCODE_READ_BD_ADDR:
254-
// Store the Bluetooth address in the stack runtime parameter
258+
// Store the Bluetooth address in the stack runtime parameter.
255259
BdaCpy(hciCoreCb.bdAddr, pMsg);
256260
257-
// Read the size of the buffer of the controller
261+
// Read the size of the buffer of the controller.
258262
HciLeReadBufSizeCmd();
259263
break;
260264
261265
case HCI_OPCODE_LE_READ_BUF_SIZE:
262-
// Store the buffer parameters in the stack runtime parameters
266+
// Store the buffer parameters in the stack runtime parameters.
263267
BSTREAM_TO_UINT16(hciCoreCb.bufSize, pMsg);
264268
BSTREAM_TO_UINT8(hciCoreCb.numBufs, pMsg);
265269
266270
/* initialize ACL buffer accounting */
267271
hciCoreCb.availBufs = hciCoreCb.numBufs;
268272
269-
// read the states and state combinations supported by the link
270-
// layer of the controller
273+
// Read the states and state combinations supported by the link
274+
// layer of the controller.
271275
HciLeReadSupStatesCmd();
272276
break;
273277
274278
case HCI_OPCODE_LE_READ_SUP_STATES:
275-
// store supported state and combination in the runtime parameters
276-
// of the stack
279+
// Store supported state and combination in the runtime parameters
280+
// of the stack.
277281
memcpy(hciCoreCb.leStates, pMsg, HCI_LE_STATES_LEN);
278282
279-
// read the total of whitelist entries that can be stored in the
283+
// Read the total of whitelist entries that can be stored in the
280284
// controller.
281285
HciLeReadWhiteListSizeCmd();
282286
break;
283287
284288
case HCI_OPCODE_LE_READ_WHITE_LIST_SIZE:
285-
// store the number of whitelist entries in the stack runtime
286-
// parameters
289+
// Store the number of whitelist entries in the stack runtime
290+
// parameters.
287291
BSTREAM_TO_UINT8(hciCoreCb.whiteListSize, pMsg);
288292
289-
// Read the LE features supported by the controller
293+
// Read the LE features supported by the controller.
290294
HciLeReadLocalSupFeatCmd();
291295
break;
292296
293297
case HCI_OPCODE_LE_READ_LOCAL_SUP_FEAT:
294-
// Store the set of LE features supported by the controller
298+
// Store the set of LE features supported by the controller.
295299
BSTREAM_TO_UINT16(hciCoreCb.leSupFeat, pMsg);
296300
297-
// read the total number of address translation entries which can be
301+
// Read the total number of address translation entries which can be
298302
// stored in the controller resolving list.
299303
hciCoreReadResolvingListSize();
300304
break;
301305
302306
case HCI_OPCODE_LE_READ_RES_LIST_SIZE:
303-
// store the number of address translation entries in the stack
304-
// runtime parameter
307+
// Store the number of address translation entries in the stack
308+
// runtime parameter.
305309
BSTREAM_TO_UINT8(hciCoreCb.resListSize, pMsg);
306310
307-
// read the Controller’s maximum supported payload octets and packet
308-
// duration times for transmission and reception
311+
// Read the Controller’s maximum supported payload octets and packet
312+
// duration times for transmission and reception.
309313
hciCoreReadMaxDataLen();
310314
break;
311315
312316
case HCI_OPCODE_LE_READ_MAX_DATA_LEN:
313317
{
314-
// store payload definition in the runtime stack parameters.
318+
// Store payload definition in the runtime stack parameters.
315319
uint16_t maxTxOctets;
316320
uint16_t maxTxTime;
317321
@@ -413,7 +417,7 @@ static void hciCoreReadResolvingListSize(void)
413417

414418
The HCI driver is injected to the `CordioBLE` class at manufacture.
415419

416-
Given that the CordioBLE class doesn't know what class constructs the driver nor how to construct it, the port provides a function returning a reference to the HCI driver.
420+
Given that the `CordioBLE` class doesn't know which class constructs the driver nor how to construct it, the port provides a function returning a reference to the HCI driver.
417421

418422
This function is in the global namespace, and you can call it with:
419423

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

454458
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.
455459

456-
Bytes sent by the host over the board serial are forwarded to the controller with the help of the `HCITransportDriver`, while bytes sent by the controller are sent back to the host through the board serial.
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.
457461

458-
This application can be used to validate the transport driver and debug the initialization process on a PC host.
462+
This application can be used to validate the transport driver and debug the initialization process.

0 commit comments

Comments
 (0)