![]() |
CI130X SDK API手册
2.2.0
本手册用于描述CI130X SDK各个组件和驱动API
|
CI130X芯片SPIFLASH驱动 更多...
宏定义 | |
#define | SPI0FIFO_BASE 0x60000000 |
#define | FLASH_MSF (0) |
函数 | |
int32_t | flash_init (spic_base_t spic) |
FLASH普通模式初始化 更多... | |
int32_t | spic_read_unique_id (spic_base_t spic, uint8_t *unique) |
读取Unique ID 更多... | |
int32_t | spic_read_jedec_id (spic_base_t spic, uint8_t *jedec) |
读取Jedec ID 更多... | |
int32_t | spic_erase_security_reg (spic_base_t spic, spic_security_reg_t reg) |
擦除FLASH安全寄存器 更多... | |
int32_t | spic_write_security_reg (spic_base_t spic, spic_security_reg_t reg, uint32_t buf, uint32_t addr, uint32_t size) |
写FLASH的安全寄存器 更多... | |
int32_t | spic_read_security_reg (spic_base_t spic, spic_security_reg_t reg, uint32_t buf, uint32_t addr, uint32_t size) |
读FLASH的安全寄存器 更多... | |
int32_t | spic_security_reg_lock (spic_base_t spic, spic_security_reg_t reg) |
FLASH的安全寄存器上锁,慎用:上锁之后将导致该安全寄存器不可再次编程 更多... | |
int32_t | flash_erase (spic_base_t spic, uint32_t addr, uint32_t size) |
FLASH擦除,兼容32M以上Flash 更多... | |
int32_t | flash_write (spic_base_t spic, uint32_t addr, uint32_t buf, uint32_t size) |
写FLASH,兼容32M以上Flash 更多... | |
int32_t | flash_read (spic_base_t spic, uint32_t buf, uint32_t addr, uint32_t size) |
读FLASH,兼容32M以上Flash 更多... | |
int32_t | spic_protect (spic_base_t spic, FunctionalState cmd) |
FLASH保护设置 更多... | |
int32_t | spic_xipconfig (spic_base_t spic) |
FLASH的XIP模式初始化 更多... | |
int32_t | flash_clk_div_init (spic_base_t spic) |
FLASH时钟初始化 更多... | |
CI130X芯片SPIFLASH驱动
#define FLASH_MSF (0) |
当Flash容量大于16M byte时,应该定义为 1
#define SPI0FIFO_BASE 0x60000000 |
SPI0FIFO 基地址定义
FLASH命令定义
int32_t flash_clk_div_init | ( | spic_base_t | spic | ) |
FLASH时钟初始化
spic | spiflash控制器 |
int32_t flash_erase | ( | spic_base_t | spic, |
uint32_t | addr, | ||
uint32_t | size | ||
) |
FLASH擦除,兼容32M以上Flash
spic | spiflash控制器 |
addr | 地址 |
size | 大小 |
RETURN_OK | |
RETURN_ERR |
int32_t flash_init | ( | spic_base_t | spic | ) |
FLASH普通模式初始化
spic | spiflash控制器 |
RETURN_OK | |
RETURN_ERR |
int32_t flash_read | ( | spic_base_t | spic, |
uint32_t | buf, | ||
uint32_t | addr, | ||
uint32_t | size | ||
) |
读FLASH,兼容32M以上Flash
spic | spiflash控制器 |
buf | mem地址 |
addr | FLASH地址 |
size | 大小 |
RETURN_OK | |
RETURN_ERR |
int32_t flash_write | ( | spic_base_t | spic, |
uint32_t | addr, | ||
uint32_t | buf, | ||
uint32_t | size | ||
) |
写FLASH,兼容32M以上Flash
spic | spiflash控制器 |
addr | FLASH地址 |
buf | mem地址 |
size | 大小 |
RETURN_OK | |
RETURN_ERR |
int32_t spic_erase_security_reg | ( | spic_base_t | spic, |
spic_security_reg_t | reg | ||
) |
擦除FLASH安全寄存器
spic | spiflash控制器 |
reg | 安全寄存器选择 |
RETURN_OK | |
RETURN_ERR |
int32_t spic_protect | ( | spic_base_t | spic, |
FunctionalState | cmd | ||
) |
FLASH保护设置
spic | spiflash控制器 |
cmd | 保护开关,ENABLE,保护;DISABLE,不保护 |
RETURN_OK | |
RETURN_ERR |
int32_t spic_read_jedec_id | ( | spic_base_t | spic, |
uint8_t * | jedec | ||
) |
读取Jedec ID
spic | spiflash控制器 |
jedec | mem地址,能够缓存3个字节的空间 |
RETURN_OK | |
RETURN_ERR |
int32_t spic_read_security_reg | ( | spic_base_t | spic, |
spic_security_reg_t | reg, | ||
uint32_t | buf, | ||
uint32_t | addr, | ||
uint32_t | size | ||
) |
读FLASH的安全寄存器
spic | spiflash控制器 |
reg | 安全寄存器选择 |
buf | mem地址 |
addr | 读FLASH安全寄存器地址:通常为(0 - 255)或(0 - 1023),具体的可以查看flash芯片手册 |
size | 读FLASH安全寄存器字节数:通常为(1 - 256)或(1 - 1024),具体的可以查看flash芯片手册 |
RETURN_OK | |
RETURN_ERR |
int32_t spic_read_unique_id | ( | spic_base_t | spic, |
uint8_t * | unique | ||
) |
读取Unique ID
spic | spiflash控制器组 |
unique | mem地址,能够缓存16个字节的空间 |
RETURN_OK | |
RETURN_ERR |
int32_t spic_security_reg_lock | ( | spic_base_t | spic, |
spic_security_reg_t | reg | ||
) |
FLASH的安全寄存器上锁,慎用:上锁之后将导致该安全寄存器不可再次编程
spic | spiflash控制器 |
reg | 安全寄存器选择 |
RETURN_OK | |
RETURN_ERR |
int32_t spic_write_security_reg | ( | spic_base_t | spic, |
spic_security_reg_t | reg, | ||
uint32_t | buf, | ||
uint32_t | addr, | ||
uint32_t | size | ||
) |
写FLASH的安全寄存器
spic | spiflash控制器 |
reg | 安全寄存器选择 |
buf | mem地址 |
addr | 写FLASH安全寄存器地址:通常为(0 - 255)或(0 - 1023),具体的可以查看flash芯片手册 |
size | 写FLASH安全寄存器字节数:通常为(1 - 256)或(1 - 1024),具体的可以查看flash芯片手册 |
RETURN_OK | |
RETURN_ERR |
int32_t spic_xipconfig | ( | spic_base_t | spic | ) |
FLASH的XIP模式初始化
spic | spiflash控制器 |