RTEMS 6.1-rc5
Loading...
Searching...
No Matches
mtd.h
1#ifndef __LINUX_MTD_MTD_H__
2#define __LINUX_MTD_MTD_H__
3
4#include <linux/slab.h>
5#include <errno.h>
6
7#define MTD_FAIL_ADDR_UNKNOWN -1LL
8
9struct mtd_info {
10 uint32_t oobavail;
11 uint32_t oobsize;
12 uint32_t size;
13 uint32_t erasesize;
14 uint32_t writesize;
15};
16
17static inline int do_mtd_point(size_t *retlen, void **ebuf)
18{
19 *retlen = 0;
20 *ebuf = NULL;
21
22 return -EOPNOTSUPP;
23}
24
25#define mtd_point(a, b, c, d, e, f) do_mtd_point(d, e)
26
27#define mtd_unpoint(a, b, c) do { } while (0)
28
29#define mtd_kmalloc_up_to(a, b) kmalloc(*(b), GFP_KERNEL)
30
32 uint32_t mode;
33 size_t len;
34 size_t retlen;
35 size_t ooblen;
36 size_t oobretlen;
37 uint32_t ooboffs;
38 uint8_t *datbuf;
39 uint8_t *oobbuf;
40};
41
42#define EUCLEAN EAGAIN
43static inline int mtd_is_bitflip(int err) { return (err == -EUCLEAN); }
44
45#define mtd_block_isbad(mtd_sp, offset) ({ \
46 bool bad; \
47 int sc = jffs2_flash_block_is_bad(RTEMS_CONTAINER_OF(&(mtd_sp), struct jffs2_sb_info, mtd), offset, &bad); \
48 if (sc) { \
49 return sc; \
50 } \
51 bad; \
52})
53#define mtd_block_markbad(mtd_sp, offset) \
54 jffs2_flash_block_mark_bad(RTEMS_CONTAINER_OF(&(mtd_sp), struct jffs2_sb_info, mtd), offset)
55#define mtd_write(mtd_sp, ofs, len, retlen, buf) \
56 jffs2_flash_direct_write(RTEMS_CONTAINER_OF(&(mtd_sp), struct jffs2_sb_info, mtd), ofs, len, retlen, buf)
57#define mtd_read(mtd_sp, ofs, len, retlen, buf) \
58 jffs2_flash_direct_read(RTEMS_CONTAINER_OF(&(mtd_sp), struct jffs2_sb_info, mtd), ofs, len, retlen, buf)
59
60#endif /* __LINUX_MTD_MTD_H__ */
Definition: mtd.h:9
Definition: mtd.h:31