Skip to content

Commit 9fa88b8

Browse files
committed
QSPI: add API and how to enable it
- use device_has to enable it - add API to be ported
1 parent 9477f66 commit 9fa88b8

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

docs/reference/contributing/target/QuadSPI.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ QSPI HAL defines API for targets that contain QSPI capable peripheral. The QSPI
77
##### Defined behavior
88

99
- a target implementaion should cover the most of QSPI frame format (some targets might not provide the flexibility for setting all frame parameters)
10-
- command transfer - a target might provide additional API for sending device specific commands. In case it does not, it can be implemented via read/write functions
10+
- command transfer - a target might provide additional API for sending device specific commands. In case it does not, it can be implemented via read/write functions (this is target/driver dependent)
1111

1212
##### Undefined behavior
1313

@@ -19,9 +19,29 @@ QSPI peripheral
1919

2020
#### Implementing QuadSPI
2121

22-
The target needs to define `qspi_s` structure - target specific QSPI object, enable QSPI in targets.json file `device_has` and implement QSPI HAL functions defined in `hal/qspi_api.h` header file.
22+
The target needs to define `qspi_s` structure - target specific QSPI object.
2323

24-
`qspi_write` and `qspi_read` are used for data transfers. For communicating with device, `qspi_command_transfer` should be used.
24+
Functions to implement:
25+
26+
```
27+
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);
28+
qspi_status_t qspi_free(qspi_t *obj);
29+
qspi_status_t qspi_frequency(qspi_t *obj, int hz);
30+
qspi_status_t qspi_write(qspi_t *obj, const qspi_command_t *command, const void *data, size_t *length);
31+
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);
32+
qspi_status_t qspi_read(qspi_t *obj, const qspi_command_t *command, void *data, size_t *length);
33+
34+
```
35+
36+
`qspi_write` and `qspi_read` are used for data transfers. For communicating with a device, `qspi_command_transfer` should be used.
37+
38+
To enable QSPI HAL, define `QSPI` in targets.json file inside `device_has`:
39+
40+
```
41+
"TARGET_NAME": {
42+
"device_has": ["QSPI"]
43+
}
44+
```
2545

2646
#### Testing
2747

0 commit comments

Comments
 (0)