|
1 | 1 | <h2 id="quadspi-port">QuadSPI</h2>
|
2 | 2 |
|
3 |
| -[Include a brief description here.] |
| 3 | +Implementing QSPI enables Mbed OS to communicate with external memories much faster than via SPI because the communication can be up to four lines between the host and a device. |
| 4 | + |
| 5 | +The most common use case is an external memory to use as additional data storage. |
| 6 | + |
| 7 | +<span class="warnings">**Warning:** We are changing the QSPI HAL API in an upcoming release of Mbed OS. You can find details on how it may affect you in the [Implementing QuadSPI](#implementing-quadspi) section.</span> |
4 | 8 |
|
5 | 9 | ### Assumptions
|
6 | 10 |
|
7 | 11 | #### Defined behavior
|
8 | 12 |
|
9 |
| -[Include any defined behavior in bullet format here.] |
| 13 | +- A target implementation covers most of the QSPI frame format (some targets might not provide the flexibility for setting all frame parameters). |
| 14 | +- Command transfer - A target might provide additional functions for sending device-specific commands. If it does not, you can implement it using read and write functions. (This is target or driver dependent.) |
10 | 15 |
|
11 | 16 | #### Undefined behavior
|
12 | 17 |
|
13 |
| -[Include any undefined behavior in bullet format here.] |
| 18 | +- Calling any function other than `qspi_init` before the initialization of the QSPI. |
14 | 19 |
|
15 |
| -#### Potential bugs |
| 20 | +#### Dependency |
16 | 21 |
|
17 |
| -[Include any potential bugs in bullet format here.] |
| 22 | +QSPI peripheral |
18 | 23 |
|
19 | 24 | ### Implementing QuadSPI
|
20 | 25 |
|
21 |
| -[Include implementation information here.] |
| 26 | +To make sure your platform is ready for the upcoming changes, you need to implement the future API and submit it in a separate pull request. You can find the API and specification for the new QuadSPI API in the following header file: |
| 27 | + |
| 28 | +[](https://os.mbed.com/docs/v5.8/feature-hal-spec-qspi-doxy/classmbed_1_1_q_s_p_i.html) |
| 29 | + |
| 30 | +The target needs to define the `qspi_s` structure - target specific QSPI object. |
| 31 | + |
| 32 | +Functions to implement: |
| 33 | + |
| 34 | +``` |
| 35 | +qspi_status_t qspi_init(qspi_t *obj, PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, PinName ssel, uint32_t hz, uint8_t mode); |
| 36 | +qspi_status_t qspi_free(qspi_t *obj); |
| 37 | +qspi_status_t qspi_frequency(qspi_t *obj, int hz); |
| 38 | +qspi_status_t qspi_write(qspi_t *obj, const qspi_command_t *command, const void *data, size_t *length); |
| 39 | +qspi_status_t qspi_command_transfer(qspi_t *obj, const qspi_command_t *command, const void *tx_data, size_t tx_size, void *rx_data, size_t rx_size); |
| 40 | +qspi_status_t qspi_read(qspi_t *obj, const qspi_command_t *command, void *data, size_t *length); |
| 41 | +
|
| 42 | +``` |
| 43 | + |
| 44 | +Use `qspi_write` and `qspi_read` for data transfers. For communicating with a device, use `qspi_command_transfer`. |
| 45 | + |
| 46 | +To enable the QSPI HAL, define `QSPI` in the targets.json file inside `device_has`: |
| 47 | + |
| 48 | +``` |
| 49 | +"TARGET_NAME": { |
| 50 | + "device_has": ["QSPI"] |
| 51 | +} |
| 52 | +``` |
22 | 53 |
|
23 | 54 | ### Testing
|
24 | 55 |
|
25 |
| -[Include testing information here.] |
| 56 | +To be implemented |
0 commit comments