在学习flash过程中看到这几行代码(拷贝 SFUD demo)
enum {
SFUD_SST25_DEVICE_INDEX = 0,
};
#define SFUD_FLASH_DEVICE_TABLE \
{ \
[SFUD_SST25_DEVICE_INDEX] = {.name = "SST25VF016B", .spi.name = "SPI1"}, \
}
typedef struct {
char *name; /**< serial flash name */
size_t index; /**< index of flash device information table @see flash_table */
sfud_flash_chip chip; /**< flash chip information */
sfud_spi spi; /**< SPI device */
bool init_ok; /**< initialize OK flag */
bool addr_in_4_byte; /**< flash is in 4-Byte addressing */
struct {
void (*delay)(void); /**< every retry's delay */
size_t times; /**< default times for error retry */
} retry;
void *user_data; /**< some user data */
#ifdef SFUD_USING_QSPI
sfud_qspi_read_cmd_format read_cmd_format; /**< fast read cmd format */
#endif
#ifdef SFUD_USING_SFDP
sfud_sfdp sfdp; /**< serial flash discoverable parameters by JEDEC standard */
#endif
} sfud_flash, *sfud_flash_t;
static sfud_flash flash_table[] = SFUD_FLASH_DEVICE_TABLE;
我不明白上述代码中的宏定义,和静态数组,有哪位大神可以帮忙解释一下 |