RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
mtd_nor.h
浏览该文件的文档.
1/*
2 * COPYRIGHT (C) 2011-2023, Real-Thread Information Technology Ltd
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 * 2012-5-30 Bernard the first version
9 */
10
11#ifndef __MTD_NOR_H__
12#define __MTD_NOR_H__
13
14#include <rtthread.h>
15
17#define RT_MTD_NOR_DEVICE(device) ((struct rt_mtd_nor_device*)(device))
18
20{
22
23 rt_uint32_t block_size; /* The Block size in the flash */
24 rt_uint32_t block_start; /* The start of available block*/
25 rt_uint32_t block_end; /* The end of available block */
26
27 /* operations interface */
29};
30
32{
33 rt_err_t (*read_id) (struct rt_mtd_nor_device* device);
34
35 rt_ssize_t (*read) (struct rt_mtd_nor_device* device, rt_off_t offset, rt_uint8_t* data, rt_size_t length);
36 rt_ssize_t (*write) (struct rt_mtd_nor_device* device, rt_off_t offset, const rt_uint8_t* data, rt_size_t length);
37
38 rt_err_t (*erase_block)(struct rt_mtd_nor_device* device, rt_off_t offset, rt_size_t length);
39};
40
41rt_err_t rt_mtd_nor_register_device(const char* name, struct rt_mtd_nor_device* device);
44 rt_off_t offset, rt_uint8_t* data, rt_size_t length);
46 rt_off_t offset, const rt_uint8_t* data, rt_size_t length);
48 rt_off_t offset, rt_size_t length);
49
50#endif
rt_uint32_t rt_mtd_nor_read_id(struct rt_mtd_nor_device *device)
rt_ssize_t rt_mtd_nor_read(struct rt_mtd_nor_device *device, rt_off_t offset, rt_uint8_t *data, rt_size_t length)
rt_err_t rt_mtd_nor_register_device(const char *name, struct rt_mtd_nor_device *device)
rt_err_t rt_mtd_nor_erase_block(struct rt_mtd_nor_device *device, rt_off_t offset, rt_size_t length)
rt_ssize_t rt_mtd_nor_write(struct rt_mtd_nor_device *device, rt_off_t offset, const rt_uint8_t *data, rt_size_t length)
rt_base_t rt_ssize_t
rt_base_t rt_off_t
rt_base_t rt_err_t
unsigned char rt_uint8_t
rt_ubase_t rt_size_t
unsigned int rt_uint32_t
rt_uint32_t block_end
rt_uint32_t block_start
const struct rt_mtd_nor_driver_ops * ops
struct rt_device parent
rt_uint32_t block_size
rt_err_t(* erase_block)(struct rt_mtd_nor_device *device, rt_off_t offset, rt_size_t length)
rt_err_t(* read_id)(struct rt_mtd_nor_device *device)
rt_ssize_t(* write)(struct rt_mtd_nor_device *device, rt_off_t offset, const rt_uint8_t *data, rt_size_t length)
rt_ssize_t(* read)(struct rt_mtd_nor_device *device, rt_off_t offset, rt_uint8_t *data, rt_size_t length)