mtdnor.h 852 B

1234567891011121314151617181920212223242526272829303132333435
  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. #ifndef __MTDNOR_H__
  11. #define __MTDNOR_H__
  12. #include <drivers/mtd.h>
  13. struct nor_ops;
  14. typedef struct
  15. {
  16. rt_mtd_t parent;
  17. const struct nor_ops *ops; /* operations interface */
  18. }rt_nor_t;
  19. struct nor_ops
  20. {
  21. int (*erase)(rt_nor_t *nor, loff_t addr, size_t len); /* return success erased len or error code */
  22. int (*read)(rt_nor_t *nor, loff_t addr, uint8_t *buf, size_t len); /* return success data size or error code */
  23. int (*write)(rt_nor_t *nor, loff_t addr, const uint8_t *buf, size_t len); /* return success data size or error code */
  24. };
  25. int rt_mtd_nor_init(rt_nor_t *nor, int blksize);
  26. #endif