|
|
|
@ -1,10 +1,5 @@ |
|
|
|
|
#pragma once |
|
|
|
|
|
|
|
|
|
/* Human-readable sizes */ |
|
|
|
|
#define KIB 1024 |
|
|
|
|
#define MIB (1024 * KIB) |
|
|
|
|
#define GIB (1024 * GIB) |
|
|
|
|
|
|
|
|
|
/* Read commands */ |
|
|
|
|
#define CMD_READ_ARRAY_SLOW 0x03 |
|
|
|
|
#define CMD_READ_ID 0x9f |
|
|
|
@ -20,11 +15,6 @@ |
|
|
|
|
#define CMD_ERASE_64K 0xD8 |
|
|
|
|
#define CMD_ERASE_CHIP 0x60 |
|
|
|
|
|
|
|
|
|
/* Rounding */ |
|
|
|
|
#define IS_ROUND(x, k) (!((x) & ((k) - 1))) |
|
|
|
|
#define ROUND_DOWN(x, k) ((x) & ~((k) - 1)) |
|
|
|
|
#define ROUND_UP(x, k) (((x) + (k) - 1) & ~((k) - 1)) |
|
|
|
|
|
|
|
|
|
void init_spi(void); |
|
|
|
|
void spi_send_cmd(uint32_t dev, const char *cmd, size_t cmd_len, |
|
|
|
|
char *data, size_t data_len); |
|
|
|
|