2024-06-25 14:55:14 +08:00
|
|
|
#ifndef __BLOCK_DEV_DRV_IF_H__
|
|
|
|
|
#define __BLOCK_DEV_DRV_IF_H__
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
2024-04-10 07:57:44 +08:00
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
#define BLOCK_DEV_SUCCESS (0)
|
|
|
|
|
#define BLOCK_DEV_ERROR (-1)
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int (*init)(void);
|
|
|
|
|
int (*reset)(void);
|
|
|
|
|
int (*sect_erase)(uint32_t addr, uint32_t sect_cnt);
|
|
|
|
|
int (*block_erase)(uint32_t addr, uint32_t block_cnt);
|
2024-05-16 14:16:35 +08:00
|
|
|
int (*read_data)(uint8_t *p_dest, uint32_t addr, uint32_t size);
|
|
|
|
|
int (*page_prog)(uint8_t *p_src, uint32_t addr, uint32_t page_cnt);
|
2024-04-10 07:57:44 +08:00
|
|
|
const uint32_t page_size;
|
|
|
|
|
const uint32_t sect_size;
|
|
|
|
|
const uint32_t sect_count;
|
|
|
|
|
const uint32_t block_size;
|
|
|
|
|
const uint32_t block_count;
|
|
|
|
|
const uint32_t page_per_sect;
|
|
|
|
|
} block_dev_drv_if_t;
|
|
|
|
|
|
2024-06-25 14:55:14 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* ! __BLOCK_DEV_DRV_IF_H__ */
|