diff options
| author | Daniel Bevenius <[email protected]> | 2022-08-25 05:43:38 +0200 |
|---|---|---|
| committer | Daniel Bevenius <[email protected]> | 2022-08-25 09:13:26 +0200 |
| commit | 3826b4f7130366c92015f61566b4bb0783e0fee3 (patch) | |
| tree | 418798cf9c5a60c5e4bb8a69a20b0dc26372dc98 | |
| parent | 9218aff498aa4f9fca5d0aa3134fda6462801a2e (diff) | |
Rename REG_BUS_FEEDBEAD to REG_BUS_TEST_RO
This commit renames the REG_BUS_FEEDBEAD to REG_BUS_TEST_RO
(Read-Only) which is the name used in the specification, section 4.2.3
Table 6.
It also adds a constant named REG_BUS_TEST_RW (Read-Write) to represent
the dummy register which the host can use to write data and read back
to check that the gSPI interface is working properly.
| -rw-r--r-- | src/lib.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs index 1c49771b9..e287ca12a 100644 --- a/src/lib.rs +++ b/src/lib.rs | |||
| @@ -50,8 +50,8 @@ const REG_BUS_CTRL: u32 = 0x0; | |||
| 50 | const REG_BUS_INTERRUPT: u32 = 0x04; // 16 bits - Interrupt status | 50 | const REG_BUS_INTERRUPT: u32 = 0x04; // 16 bits - Interrupt status |
| 51 | const REG_BUS_INTERRUPT_ENABLE: u32 = 0x06; // 16 bits - Interrupt mask | 51 | const REG_BUS_INTERRUPT_ENABLE: u32 = 0x06; // 16 bits - Interrupt mask |
| 52 | const REG_BUS_STATUS: u32 = 0x8; | 52 | const REG_BUS_STATUS: u32 = 0x8; |
| 53 | const REG_BUS_FEEDBEAD: u32 = 0x14; | 53 | const REG_BUS_TEST_RO: u32 = 0x14; |
| 54 | const REG_BUS_TEST: u32 = 0x18; | 54 | const REG_BUS_TEST_RW: u32 = 0x18; |
| 55 | const REG_BUS_RESP_DELAY: u32 = 0x1c; | 55 | const REG_BUS_RESP_DELAY: u32 = 0x1c; |
| 56 | 56 | ||
| 57 | // SPI_STATUS_REGISTER bits | 57 | // SPI_STATUS_REGISTER bits |
| @@ -563,19 +563,19 @@ where | |||
| 563 | Timer::after(Duration::from_millis(250)).await; | 563 | Timer::after(Duration::from_millis(250)).await; |
| 564 | 564 | ||
| 565 | info!("waiting for ping..."); | 565 | info!("waiting for ping..."); |
| 566 | while self.read32_swapped(REG_BUS_FEEDBEAD).await != FEEDBEAD {} | 566 | while self.read32_swapped(REG_BUS_TEST_RO).await != FEEDBEAD {} |
| 567 | info!("ping ok"); | 567 | info!("ping ok"); |
| 568 | 568 | ||
| 569 | self.write32_swapped(0x18, TEST_PATTERN).await; | 569 | self.write32_swapped(REG_BUS_TEST_RW, TEST_PATTERN).await; |
| 570 | let val = self.read32_swapped(REG_BUS_TEST).await; | 570 | let val = self.read32_swapped(REG_BUS_TEST_RW).await; |
| 571 | assert_eq!(val, TEST_PATTERN); | 571 | assert_eq!(val, TEST_PATTERN); |
| 572 | 572 | ||
| 573 | // 32bit, little endian. | 573 | // 32bit, little endian. |
| 574 | self.write32_swapped(REG_BUS_CTRL, 0x00010031).await; | 574 | self.write32_swapped(REG_BUS_CTRL, 0x00010031).await; |
| 575 | 575 | ||
| 576 | let val = self.read32(FUNC_BUS, REG_BUS_FEEDBEAD).await; | 576 | let val = self.read32(FUNC_BUS, REG_BUS_TEST_RO).await; |
| 577 | assert_eq!(val, FEEDBEAD); | 577 | assert_eq!(val, FEEDBEAD); |
| 578 | let val = self.read32(FUNC_BUS, REG_BUS_TEST).await; | 578 | let val = self.read32(FUNC_BUS, REG_BUS_TEST_RW).await; |
| 579 | assert_eq!(val, TEST_PATTERN); | 579 | assert_eq!(val, TEST_PATTERN); |
| 580 | 580 | ||
| 581 | // No response delay in any of the funcs. | 581 | // No response delay in any of the funcs. |
