sdio_example: fix meaningless print in host, make shared reg access more readable in slave

This commit is contained in:
Xiao Xufeng 2023-04-07 15:27:05 +08:00 committed by Fu Hanxi
parent e704f72356
commit f2d144166a
2 changed files with 10 additions and 11 deletions

View File

@ -416,7 +416,7 @@ void job_write_reg(essl_handle_t handle, int value)
} }
ESP_LOGI(TAG, "read registers:"); ESP_LOGI(TAG, "read registers:");
ESP_LOG_BUFFER_HEXDUMP(TAG, reg_read, 64, ESP_LOG_INFO); ESP_LOG_BUFFER_HEXDUMP(TAG, reg_read, 60, ESP_LOG_INFO);
} }
//the slave only load 16 buffers a time //the slave only load 16 buffers a time

View File

@ -62,6 +62,9 @@
#define EV_STR(s) "================ "s" ================" #define EV_STR(s) "================ "s" ================"
//skip interrupt regs.
#define SLAVE_ADDR(i) ((i) >= 28? (i) + 4: (i))
typedef enum { typedef enum {
JOB_IDLE = 0, JOB_IDLE = 0,
JOB_RESET = 1, JOB_RESET = 1,
@ -123,19 +126,15 @@ static esp_err_t task_write_reg(void)
{ {
//the host write REG1, the slave should write its registers according to value of REG1 //the host write REG1, the slave should write its registers according to value of REG1
uint8_t read = sdio_slave_read_reg(1); uint8_t read = sdio_slave_read_reg(1);
for (int i = 0; i < 64; i++) { for (int i = 0; i < 60; i++) {
//skip interrupt regs. sdio_slave_write_reg(SLAVE_ADDR(i), read + 3*i);
if (i >= 28 && i <= 31) continue;
sdio_slave_write_reg(i, read+3*i);
} }
uint8_t reg[64] = {0}; uint8_t reg[60] = {0};
for (int i = 0; i < 64; i++) { for (int i = 0; i < 60; i++) {
//skip interrupt regs. reg[i] = sdio_slave_read_reg(SLAVE_ADDR(i));
if (i >= 28 && i <= 31) continue;
reg[i] = sdio_slave_read_reg(i);
} }
ESP_LOGI(TAG, "write regs:"); ESP_LOGI(TAG, "write regs:");
ESP_LOG_BUFFER_HEXDUMP(TAG, reg, 64, ESP_LOG_INFO); ESP_LOG_BUFFER_HEXDUMP(TAG, reg, 60, ESP_LOG_INFO);
return ESP_OK; return ESP_OK;
} }