mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
sdio_example: fix meaningless print in host, make shared reg access more readable in slave
This commit is contained in:
parent
e704f72356
commit
f2d144166a
@ -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
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user