1 /* 2 * Copyright (c) 2006-2018, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 2018-09-10 heyuanjie87 first version 9 10 */ 11 12 #ifndef __MTDNOR_H__ 13 #define __MTDNOR_H__ 14 15 #include <drivers/mtd.h> 16 17 struct nor_ops; 18 19 typedef struct 20 { 21 rt_mtd_t parent; 22 23 const struct nor_ops *ops; /* operations interface */ 24 }rt_nor_t; 25 26 struct nor_ops 27 { 28 int (*erase)(rt_nor_t *nor, loff_t addr, size_t len); /* return success erased len or error code */ 29 int (*read)(rt_nor_t *nor, loff_t addr, uint8_t *buf, size_t len); /* return success data size or error code */ 30 int (*write)(rt_nor_t *nor, loff_t addr, const uint8_t *buf, size_t len); /* return success data size or error code */ 31 }; 32 33 int rt_mtd_nor_init(rt_nor_t *nor, int blksize); 34 35 #endif 36