Skip to content

Commit f3f8d26

Browse files
committed
QSPI: add address to command transfer
1 parent e54e122 commit f3f8d26

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

drivers/QSPI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,14 @@ qspi_status_t QSPI::write(unsigned int instruction, unsigned int alt, unsigned i
194194
return ret_status;
195195
}
196196

197-
qspi_status_t QSPI::command_transfer(unsigned int instruction, const char *tx_buffer, size_t tx_length, const char *rx_buffer, size_t rx_length)
197+
qspi_status_t QSPI::command_transfer(unsigned int instruction, int address, const char *tx_buffer, size_t tx_length, const char *rx_buffer, size_t rx_length)
198198
{
199199
qspi_status_t ret_status = QSPI_STATUS_ERROR;
200200

201201
if (_initialized) {
202202
lock();
203203
if (true == _acquire()) {
204-
_build_qspi_command(instruction, -1, -1); //We just need the command
204+
_build_qspi_command(instruction, address, -1); //We just need the command
205205
if (QSPI_STATUS_OK == qspi_command_transfer(&_qspi, &_qspi_command, (const void *)tx_buffer, tx_length, (void *)rx_buffer, rx_length)) {
206206
ret_status = QSPI_STATUS_OK;
207207
}

drivers/QSPI.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class QSPI : private NonCopyable<QSPI> {
159159
/** Perform a transaction to write to an address(a control register) and get the status results
160160
*
161161
* @param instruction Instruction value to be used in instruction phase
162+
* @param address Some instruction might require address. Use -1 for ignoring the address value
162163
* @param tx_buffer Buffer containing data to be sent to peripheral
163164
* @param tx_length Pointer to a variable containing the length of data to be transmitted, and on return this variable will be updated with the actual number of bytes written
164165
* @param rx_buffer Buffer for data to be read from the peripheral
@@ -167,7 +168,7 @@ class QSPI : private NonCopyable<QSPI> {
167168
* @returns
168169
* Returns QSPI_STATUS_SUCCESS on successful reads and QSPI_STATUS_ERROR on failed reads.
169170
*/
170-
qspi_status_t command_transfer(unsigned int instruction, const char *tx_buffer, size_t tx_length, const char *rx_buffer, size_t rx_length);
171+
qspi_status_t command_transfer(unsigned int instruction, int address, const char *tx_buffer, size_t tx_length, const char *rx_buffer, size_t rx_length);
171172

172173
/** Acquire exclusive access to this SPI bus
173174
*/

0 commit comments

Comments
 (0)