summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorBernardXiong <[email protected]>2019-06-27 07:36:25 +0000
committerBernardXiong <[email protected]>2019-06-27 07:36:25 +0000
commit0c07c2005d8c1c3613a76b843f8fc29cc7a636bc (patch)
treec5f42434a69f6682378439c1b6cd7cfe954c41b7 /components/drivers/include
parent31b6533baa1d52f070ce43fecaf0183af9ef7299 (diff)
[DeviceDrivers] Remove backup mtd code
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/drivers/mtd.h105
-rw-r--r--components/drivers/include/drivers/mtdnand.h101
-rw-r--r--components/drivers/include/drivers/mtdnor.h35
3 files changed, 0 insertions, 241 deletions
diff --git a/components/drivers/include/drivers/mtd.h b/components/drivers/include/drivers/mtd.h
deleted file mode 100644
index fb7ea4389d..0000000000
--- a/components/drivers/include/drivers/mtd.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- 2018-09-10 heyuanjie87 first version
-
- */
-
-#ifndef __MTD_H__
-#define __MTD_H__
-
-#include <rtthread.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define MTD_TYPE_NOR 1
-#define MTD_TYPE_NAND 2
-
- /**
- * MTD operation modes
- *
- * @MTD_OPM_PLACE_OOB: OOB data are placed at the given offset (default)
- * @MTD_OPM_AUTO_OOB: OOB data are automatically placed at the free areas
- * @MTD_OPM_RAW: data are transferred as-is, with no error correction;
- */
-enum mtd_opm
-{
- MTD_OPM_PLACE_OOB = 0,
- MTD_OPM_AUTO_OOB = 1,
- MTD_OPM_RAW = 2,
-};
-
-#ifndef loff_t
-typedef long loff_t;
-#endif
-
-struct mtd_oob_region
-{
- uint8_t offset;
- uint8_t length;
-};
-
-typedef struct mtd_info
-{
- struct rt_device parent;
-
- const struct mtd_ops *ops;
-
- uint16_t oob_size;
- uint16_t sector_size; /* Minimal writable flash unit size */
- uint32_t block_size:28; /* Erase size for the device */
- uint32_t type:4;
-
- size_t size; /* Total size of the MTD */
- loff_t offset; /* At which this MTD starts, from the beginning of the MEMORY */
- struct mtd_info *master;
-
- void *priv;
-}rt_mtd_t;
-
-struct mtd_io_desc
-{
- uint8_t mode; /* operation mode(enum mtd_opm) */
- uint8_t ooblen; /* number of oob bytes to write/read */
- uint8_t oobretlen; /* number of oob bytes written/read */
- uint8_t ooboffs; /* offset in the oob area */
- uint8_t *oobbuf;
-
- size_t datlen; /* number of data bytes to write/read */
- size_t datretlen; /* number of data bytes written/read */
- uint8_t *datbuf; /* if NULL only oob are read/written */
-};
-
-struct mtd_ops
-{
- int(*erase)(rt_mtd_t *mtd, loff_t addr, size_t len); /* return 0 if success */
- int(*read) (rt_mtd_t *mtd, loff_t from, struct mtd_io_desc *ops); /* return 0 if success */
- int(*write) (rt_mtd_t *mtd, loff_t to, struct mtd_io_desc *ops); /* return 0 if success */
- int(*isbad) (rt_mtd_t *mtd, uint32_t block); /* return 1 if bad, 0 not bad */
- int(*markbad) (rt_mtd_t *mtd, uint32_t block); /* return 0 if success */
-};
-
-struct mtd_part
-{
- const char *name; /* name of the MTD partion */
- loff_t offset; /* start addr of partion */
- size_t size; /* size of partion */
-};
-
-int rt_mtd_erase(rt_mtd_t *mtd, loff_t addr, size_t size);
-int rt_mtd_block_erase(rt_mtd_t *mtd, uint32_t block);
-int rt_mtd_read_oob(rt_mtd_t *mtd, loff_t from, struct mtd_io_desc *desc);
-int rt_mtd_write_oob(rt_mtd_t *mtd, loff_t to, struct mtd_io_desc *desc);
-int rt_mtd_read(rt_mtd_t *mtd, loff_t from, uint8_t *buf, size_t len);
-int rt_mtd_write(rt_mtd_t *mtd, loff_t to, const uint8_t *buf, size_t len);
-int rt_mtd_block_markbad(rt_mtd_t *mtd, uint32_t block);
-int rt_mtd_block_isbad(rt_mtd_t *mtd, uint32_t block);
-
-rt_mtd_t* rt_mtd_get(const char *name);
-int rt_mtd_register(rt_mtd_t *master, const struct mtd_part *parts, int np);
-
-#endif
diff --git a/components/drivers/include/drivers/mtdnand.h b/components/drivers/include/drivers/mtdnand.h
deleted file mode 100644
index 2e836cb2fb..0000000000
--- a/components/drivers/include/drivers/mtdnand.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- 2018-09-10 heyuanjie87 first version
-
- */
-
-#ifndef _MTDNAND_H_
-#define _MTDNAND_H_
-
-#include "mtd.h"
-
- /* Status bits */
-#define NAND_STATUS_FAIL 0x01
-#define NAND_STATUS_FAIL_N1 0x02
-#define NAND_STATUS_WP 0x80
-
-typedef enum
-{
- NAND_CMD_PAGE_RD, /* read data to chip's page buffer,do WaitBusy after this cmd in low driver */
- NAND_CMD_PAGE_WR0, /* write data to chip's page buffer */
- NAND_CMD_PAGE_WR1, /* do flash programe */
- NAND_CMD_BLK_ERASE, /* erase block */
- NAND_CMD_ECC_EN, /* enable gen HWECC */
- NAND_CMD_ECC_DIS /* disable gen HWECC */
-} nand_cmd_t;
-
-typedef enum
-{
- NAND_ECCM_NONE,
- NAND_ECCM_HW,
-} nand_eccmode_t;
-
-struct nand_chip;
-struct nand_ops;
-
-/**
-* struct nand_buffers - buffer structure for read/write
-* @ecccalc: buffer pointer for calculated ECC, size is oobsize.
-* @ecccode: buffer pointer for ECC read from flash, size is oobsize.
-*
-*/
-struct nand_buffers
-{
- uint8_t *ecccalc;
- uint8_t *ecccode;
-};
-
-struct nand_ecc
-{
- uint8_t mode; /* nand_eccmode_t */
- uint8_t bytes; /* gen ecc bytes per ecc step(usually 3) */
- uint16_t stepsize:12; /* min 256 */
- uint16_t _step:4; /* */
-
- /* driver must set the two interface if HWECC */
- void (*calculate)(struct nand_chip *chip, const uint8_t *dat, uint8_t *ecc_code);
- /* return max bit flips if can't correct,return -1 ECC is error(0 success) */
- int(*correct)(struct nand_chip *chip, uint8_t *dat, uint8_t *read_ecc, uint8_t *calc_ecc);
- /* ignore if NONECC */
- const struct mtd_oob_region *layout;
-};
-
-typedef struct nand_chip
-{
- rt_mtd_t parent;
-
- /* driver must init these */
- const struct nand_ops *ops;
- struct nand_ecc ecc;
- const struct mtd_oob_region *freelayout;
-
- /* driver do not touch */
- struct nand_buffers buffers;
- uint8_t *oob_poi;
- uint8_t *pagebuf;
- uint32_t size;
- uint16_t oobsize;
- uint8_t pages_pb;
- uint16_t page_size;
- int(*read_page)(struct nand_chip *chip, uint8_t *buf, int oob_required, int page);
- int(*write_page)(struct nand_chip *chip, const uint8_t *buf, int oob_required, int page);
-}rt_nand_t;
-
-struct nand_ops
-{
- int(*cmdfunc)(rt_nand_t *nand, int cmd, int page, int offset); /* send nand operation cmd, return Status bits(0 success),
- if nand is busy please wait in low driver */
- int(*read_buf)(rt_nand_t *nand, uint8_t *buf, int len); /* read data from nand chip's page buffer */
- int(*write_buf)(rt_nand_t *nand, const uint8_t *buf, int len);/* write data to nand chip's page buffer */
- int(*isbad)(rt_nand_t *nand, uint32_t blk); /* if NULL OOB[0] used as bad mark(not 0xff is bad) */
- int(*markbad)(rt_nand_t *nand, uint32_t blk); /* if NULL OOB[0] used as bad mark(set to 0x00) */
-};
-
-int rt_mtd_nand_init(rt_nand_t *nand, int blk_size, int page_size, int oob_size);
-
-#endif /* MTD_NAND_H_ */
diff --git a/components/drivers/include/drivers/mtdnor.h b/components/drivers/include/drivers/mtdnor.h
deleted file mode 100644
index ccb7466b4b..0000000000
--- a/components/drivers/include/drivers/mtdnor.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- 2018-09-10 heyuanjie87 first version
-
- */
-
-#ifndef __MTDNOR_H__
-#define __MTDNOR_H__
-
-#include <drivers/mtd.h>
-
-struct nor_ops;
-
-typedef struct
-{
- rt_mtd_t parent;
-
- const struct nor_ops *ops; /* operations interface */
-}rt_nor_t;
-
-struct nor_ops
-{
- int (*erase)(rt_nor_t *nor, loff_t addr, size_t len); /* return success erased len or error code */
- int (*read)(rt_nor_t *nor, loff_t addr, uint8_t *buf, size_t len); /* return success data size or error code */
- int (*write)(rt_nor_t *nor, loff_t addr, const uint8_t *buf, size_t len); /* return success data size or error code */
-};
-
-int rt_mtd_nor_init(rt_nor_t *nor, int blksize);
-
-#endif