mirror of
https://github.com/openharmony/drivers_framework.git
synced 2026-08-26 18:17:07 -04:00
!909 optimize cs keeping logic for spi transfer
Merge pull request !909 from NickYang/master
This commit is contained in:
@@ -123,7 +123,7 @@ struct SpiDevInfo {
|
||||
* @brief Defines the custom SPI transfer message.
|
||||
*
|
||||
* @attention The specific SPI controller determines whether <b>speed</b>, <b>delayUs</b>,
|
||||
* and <b>csChange</b> are supported.
|
||||
* and <b>keepCs</b> are supported.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
@@ -137,8 +137,8 @@ struct SpiMsg {
|
||||
uint16_t delayUs; /**< Delay (in microseconds) before starting the next transfer.
|
||||
* The value <b>0</b> indicates there is no delay between transfers.
|
||||
*/
|
||||
uint8_t csChange; /**< Whether to switch off the CS before the next transfer when the current transfer has been
|
||||
* completed. <b>1</b> indicates to switch off the CS; <b>0</b> indicates to switch on the CS.
|
||||
uint8_t keepCs; /**< Whether to keep CS active after current transfer has been
|
||||
* completed. <b>1</b> indicates to keeps CS; <b>0</b> indicates to switch off the CS.
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ static int32_t SpiTransferTest(struct SpiTester *tester)
|
||||
msg.rbuf = tester->config.rbuf;
|
||||
msg.wbuf = tester->config.wbuf;
|
||||
msg.len = tester->config.len;
|
||||
msg.csChange = 1; // switch off the CS after transfer
|
||||
msg.keepCs = 0; // switch off the CS after transfer
|
||||
msg.delayUs = 0;
|
||||
msg.speed = 0; // use default speed
|
||||
|
||||
@@ -291,7 +291,7 @@ static int32_t SpiMultiTransferTest(struct SpiTester *tester)
|
||||
msgs[SPI_TEST_MSG_2].rbuf = tester->config.rbuf;
|
||||
msgs[SPI_TEST_MSG_2].len = tester->config.len;
|
||||
msgs[SPI_TEST_MSG_2].speed = 0;
|
||||
msgs[SPI_TEST_MSG_2].csChange = 1; // switch off the CS after transfer
|
||||
msgs[SPI_TEST_MSG_2].keepCs = 0; // switch off the CS after transfer
|
||||
|
||||
ret = SpiSetCfg(tester->handle, &g_spiCfg);
|
||||
if (ret != HDF_SUCCESS) {
|
||||
@@ -339,8 +339,8 @@ static int32_t SpiSetDmaIntMsg(struct SpiMsg *msg, uint32_t len)
|
||||
msg->wbuf = wbuf;
|
||||
msg->rbuf = rbuf;
|
||||
msg->len = len;
|
||||
msg->csChange = 1;
|
||||
msg->delayUs = 0, // switch off the CS after transfer
|
||||
msg->keepCs= 0, // switch off the CS after transfer
|
||||
msg->delayUs = 0;
|
||||
msg->speed = 0; // using default speed
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user