准备驱动移植适配Rust
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : bsp_w25qxx.h
|
||||
* @brief : BSP layer for W25QXX flash memory
|
||||
* @brief : W25QXX 闪存芯片的 BSP 层头文件
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
@ -15,71 +15,71 @@
|
||||
#include "hal_gpio.h"
|
||||
|
||||
/**
|
||||
* @brief W25QXX chip select pin configuration
|
||||
* @brief W25QXX 芯片选择引脚配置
|
||||
*/
|
||||
#define W25QXX_CS_PORT HAL_GPIO_PORT_B
|
||||
#define W25QXX_CS_PIN HAL_GPIO_PIN_0
|
||||
|
||||
/**
|
||||
* @brief W25QXX SPI instance
|
||||
* @brief W25QXX SPI 实例
|
||||
*/
|
||||
#define W25QXX_SPI_INSTANCE HAL_SPI_INSTANCE_1
|
||||
|
||||
/**
|
||||
* @brief Initialize W25QXX flash memory
|
||||
* @retval true if initialization is successful, false otherwise
|
||||
* @brief 初始化 W25QXX 闪存芯片
|
||||
* @retval 初始化成功返回 true,失败返回 false
|
||||
*/
|
||||
bool bsp_w25qxx_init(void);
|
||||
|
||||
/**
|
||||
* @brief Get W25QXX device information
|
||||
* @param info Pointer to device information structure to fill
|
||||
* @retval true if successful, false otherwise
|
||||
* @brief 获取 W25QXX 设备信息
|
||||
* @param info 指向设备信息结构体的指针
|
||||
* @retval 成功返回 true,失败返回 false
|
||||
*/
|
||||
bool bsp_w25qxx_get_device_info(w25qxx_device_info_t *info);
|
||||
|
||||
/**
|
||||
* @brief Read data from W25QXX flash memory
|
||||
* @param address Starting address to read from
|
||||
* @param data Pointer to data buffer to store read data
|
||||
* @param size Size of data to read
|
||||
* @retval true if read is successful, false otherwise
|
||||
* @brief 从 W25QXX 闪存芯片读取数据
|
||||
* @param address 起始读取地址
|
||||
* @param data 存储读取数据的缓冲区指针
|
||||
* @param size 要读取的数据大小
|
||||
* @retval 读取成功返回 true,失败返回 false
|
||||
*/
|
||||
bool bsp_w25qxx_read(uint32_t address, uint8_t *data, uint32_t size);
|
||||
|
||||
/**
|
||||
* @brief Write data to W25QXX flash memory
|
||||
* @param address Starting address to write to
|
||||
* @param data Pointer to data buffer to write
|
||||
* @param size Size of data to write
|
||||
* @retval true if write is successful, false otherwise
|
||||
* @brief 向 W25QXX 闪存芯片写入数据
|
||||
* @param address 起始写入地址
|
||||
* @param data 要写入的数据缓冲区指针
|
||||
* @param size 要写入的数据大小
|
||||
* @retval 写入成功返回 true,失败返回 false
|
||||
*/
|
||||
bool bsp_w25qxx_write(uint32_t address, const uint8_t *data, uint32_t size);
|
||||
|
||||
/**
|
||||
* @brief Erase 4KB block
|
||||
* @param address Address within the block to erase
|
||||
* @retval true if erase is successful, false otherwise
|
||||
* @brief 擦除 4KB 块
|
||||
* @param address 块内的地址
|
||||
* @retval 擦除成功返回 true,失败返回 false
|
||||
*/
|
||||
bool bsp_w25qxx_erase_block_4kb(uint32_t address);
|
||||
|
||||
/**
|
||||
* @brief Erase 32KB block
|
||||
* @param address Address within the block to erase
|
||||
* @retval true if erase is successful, false otherwise
|
||||
* @brief 擦除 32KB 块
|
||||
* @param address 块内的地址
|
||||
* @retval 擦除成功返回 true,失败返回 false
|
||||
*/
|
||||
bool bsp_w25qxx_erase_block_32kb(uint32_t address);
|
||||
|
||||
/**
|
||||
* @brief Erase 64KB block
|
||||
* @param address Address within the block to erase
|
||||
* @retval true if erase is successful, false otherwise
|
||||
* @brief 擦除 64KB 块
|
||||
* @param address 块内的地址
|
||||
* @retval 擦除成功返回 true,失败返回 false
|
||||
*/
|
||||
bool bsp_w25qxx_erase_block_64kb(uint32_t address);
|
||||
|
||||
/**
|
||||
* @brief Erase entire chip
|
||||
* @retval true if erase is successful, false otherwise
|
||||
* @brief 擦除整个芯片
|
||||
* @retval 擦除成功返回 true,失败返回 false
|
||||
*/
|
||||
bool bsp_w25qxx_erase_chip(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user