⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmc.h

📁 基于s3c2410的SD驱动
💻 H
📖 第 1 页 / 共 2 页
字号:
#define TIME_MAN_13	3	/* 1.3 */#define TIME_MAN_15	4	/* 1.5 */#define TIME_MAN_20	5	/* 2.0 */#define TIME_MAN_25	6	/* 2.5 */#define TIME_MAN_30	7	/* 3.0 */#define TIME_MAN_35	8	/* 3.5 */#define TIME_MAN_40	9	/* 4.0 */#define TIME_MAN_45	A	/* 4.5 */#define TIME_MAN_50	B	/* 5.0 */#define TIME_MAN_55	C	/* 5.5 */#define TIME_MAN_60	D	/* 6.0 */#define TIME_MAN_70	E	/* 7.0 */#define TIME_MAN_80	F	/* 8.0 */#define TRAN_EXP_100K	0	/* 100kbit/s */#define TRAN_EXP_1M	1	/* 1Mbit/s */#define TRAN_EXP_10M	2	/* 10Mbit/s */#define TRAN_EXP_100M	3	/* 100Mbit/s */#define CCC_CLASS_0	0x001	/* Card Command Class 0 */#define CCC_CLASS_1	0x002	/* Card Command Class 1 */#define CCC_CLASS_2	0x004	/* Card Command Class 2 */#define CCC_CLASS_3	0x008	/* Card Command Class 3 */#define CCC_CLASS_4	0x010	/* Card Command Class 4 */#define CCC_CLASS_5	0x020	/* Card Command Class 5 */#define CCC_CLASS_6	0x040	/* Card Command Class 6 */#define CCC_CLASS_7	0x080	/* Card Command Class 7 */#define CCC_CLASS_8	0x100	/* Card Command Class 8 */#define CCC_CLASS_9	0x200	/* Card Command Class 9 */#define CCC_CLASS_10	0x400	/* Card Command Class 10 */#define CCC_CLASS_11	0x800	/* Card Command Class 11 */#define BLK_LEN_1	0	/* 2^0 = 1 byte */#define BLK_LEN_2	1	/* 2^1 = 2 bytes */#define BLK_LEN_4	2	/* 2^2 = 4 bytes */#define BLK_LEN_8	3	/* 2^3 = 8 bytes */#define BLK_LEN_16	4	/* 2^4 = 16 bytes */#define BLK_LEN_32	5	/* 2^5 = 32 bytes */#define BLK_LEN_64	6	/* 2^6 = 64 bytes */#define BLK_LEN_128	7	/* 2^7 = 128 bytes */#define BLK_LEN_256	8	/* 2^8 = 256 bytes */#define BLK_LEN_512	9	/* 2^9 = 512 bytes */#define BLK_LEN_1024	10	/* 2^10 = 1024 bytes */#define BLK_LEN_2048	11	/* 2^11 = 2048 bytes */#define MAX_MMC_BLK_LEN	2048/*	Memory Capacity = BLOCKNR * BLOCK_LEN	where	BLOCKNR = (C_SIZE + 1) * MULT	MULT = 2^(c_size_mult+2) ( c_size_mult < 8)	BLOCK_LEN = 2^read_len	( read_len < 12) */#define VCC_MIN_05	0	/* 0.5mA */#define VCC_MIN_1	1	/* 1mA */#define VCC_MIN_5	2	/* 5mA */#define VCC_MIN_10	3	/* 10mA */#define VCC_MIN_25	4	/* 25mA */#define VCC_MIN_35	5	/* 35mA */#define VCC_MIN_60	6	/* 60mA */#define VCC_MIN_100	7	/* 100mA */#define VCC_MAX_1	0	/* 1mA */#define VCC_MAX_5	1	/* 5mA */#define VCC_MAX_10	2	/* 10mA */#define VCC_MAX_25	3	/* 25mA */#define VCC_MAX_35	4	/* 35mA */#define VCC_MAX_45	5	/* 45mA */#define VCC_MAX_80	6	/* 80mA */#define VCC_MAX_200	7	/* 200mA */				/* the typical block program time is */#define R2W_FACTOR_1	0	/*   1 Multiples of Read Access Time */#define R2W_FACTOR_2	1	/*   2 Multiples of Read Access Time */#define R2W_FACTOR_4	2	/*   4 Multiples of Read Access Time */#define R2W_FACTOR_8	3	/*   8 Multiples of Read Access Time */#define R2W_FACTOR_16	4	/*  16 Multiples of Read Access Time */#define R2W_FACTOR_32	5	/*  32 Multiples of Read Access Time */#define ECC_NONE	0	/* none. Max.No.ofCorrectable bit/block=0 */#define ECC_BCH		1	/* 542,512. Max.No.ofCorrectable bit/block=3 *//* * R1 status: card status * Type *	e : error bit *	s : status bit *	r : detected and set for the actual command response *	x : detected and set during command execution. the host must poll *	    the card by sending status command in order to read these bits. * Clear condition *	a : according to the card state *	b : always related to the previous command. Reception of *	    a valid command will clear it (with a delay of one command) *	c : clear by read */typedef __u32 R1_status;#define R1_out_of_range		0x80000000	/* er, c */#define R1_address_err		0x40000000	/* erx, c */#define R1_block_len_err	0x20000000	/* er, c */#define R1_erase_seq_err	0x10000000	/* er, c */#define R1_erase_param		0x08000000	/* ex, c */#define R1_wp_violation		0x04000000	/* erx, c */#define R1_card_is_locked	0x02000000	/* sx, a */#define R1_lock_unlock_fail	0x01000000	/* erx, c */#define R1_com_crc_err		0x00800000	/* er, b */#define R1_illegal_command	0x00400000	/* er, b */#define R1_ecc_fail		0x00200000	/* ex, c */#define R1_cc_err		0x00100000	/* erx, c */#define R1_err			0x00080000	/* erx, c */#define R1_underrun		0x00040000	/* ex, c */#define R1_overrun		0x00020000	/* ex, c */#define R1_overwrite		0x00010000	/* erx, c, CID/CSD overwrite */#define R1_wp_erase_skip	0x00008000	/* sx, c */#define R1_ecc_disable		0x00004000	/* sx, a */#define R1_erase_reset		0x00002000	/* sr, c */#define R1_state		0x00001E00	/* sx, b */#define R1_buf_empty		0x00000100	/* sx, a */#define R1_app_cmd		0x00000020	/* sr, c */#define R1_ERR			0xFDFF0000	/* R1 error mask *//* KAILAS added next line */#define SD_CARD                 0x00000111      /* SD Card Identification */                                                                                /* card state flags of R1 */#define STATE_IDLE	0x00000000	/* 0 */#define STATE_READY	0x00000200	/* 1 */#define STATE_IDENT	0x00000400	/* 2 */#define STATE_STBY	0x00000600	/* 3 */#define STATE_TRAN	0x00000800	/* 4 */#define STATE_DATA	0x00000A00	/* 5 */#define STATE_RCV	0x00000C00	/* 6 */#define STATE_PRG	0x00000E00	/* 7 */#define STATE_DIS	0x00001000	/* 8 *//* flags for stat field of the mmc_slot structure */#define MMC_WP_GRP_EN		0x00000010#define MMC_PERM_WP		0x00000020#define MMC_TMP_WP		0x00000040#define MMC_READ_PART		0x00000100#define MMC_WRITE_PART		0x00000200/* * MMC */#define MMC_MMC_CLOCK_HIGH		20000000#define MMC_MMC_CLOCK_LOW		400000/* * MMC command/response structure *//* MMC Response type */enum {	MMC_RES_TYPE_NONE = 0,	MMC_RES_TYPE_R1,	MMC_RES_TYPE_R1B,	MMC_RES_TYPE_R2,	MMC_RES_TYPE_R3,	MMC_RES_TYPE_R4,	MMC_RES_TYPE_R5,	MMC_RES_TYPE_R6,};/* MMC Response length */#define MMC_RES_LEN_SHORT		6#define MMC_RES_LEN_LONG		17/* MMC Response flag */#define MMC_RES_FLAG_DATALINE		0x01 /* transferred on dataline */#define MMC_RES_FLAG_NOCRC		0x02 /* no crc check */#define MMC_RES_FLAG_RDATA		0x04 /* data read */#define MMC_RES_FLAG_WDATA		0x08 /* data write *//* MMC Command request type */struct mmc_cmd {	__u8 cmd; /* command */	__u32 arg; /* command argument */	__u8 res_type; /* response type */	__u8 res_flag; /* response flag */	__u8 res[MMC_RES_LEN_LONG]; /* response buffer */	__u8 *data; /* pointer to data buffer */	__u32 data_len; /* data length */	__u32 t_res; /* timing between command and response */	__u32 t_fin; /* timing after response */};/* * MMC slot interface */#define MAX_MMC_SLOTS		2struct mmc_slot {	/* power up */	void (*power_up)(struct mmc_slot *slot);	/* power down */	void (*power_down)(struct mmc_slot *slot);	/* wait for reset */	void (*wait_for_reset)(struct mmc_slot *slot);	/* set clock rate */	void (*set_clock)(struct mmc_slot *slot, int rate);	/* send command and receive response */	int (*send_cmd)(struct mmc_slot *slot, struct mmc_cmd *cmd);	/* transfer 1 block for Memory Card */	int (*transfer1b)(struct mmc_slot *slot, int rd, u_long from, 			  u_char *buf);	struct semaphore mutex; /* for exclusive I/O */	__u8 id;	/* slot id(begins at 0) assigned by slot driver */	__u8 narrow_bus; /* if true, support only narrow bus */	/* MMC card information */	unsigned int read_len;	/* read block length */	unsigned int write_len;	/* write block length */	u_long size;	/* total size of card in bytes */	u_long stat;	/* card status */	__u8 readonly;	/* If true, it's readonly */	/* Temporary registers */	RCA_regs rca;	CID_regs cid;	OCR_regs ocr;	CSD_regs csd;	R1_status r1;	void *priv;};/* * MMC device notifier structure */struct mmc_notifier{	void (*add)(struct mmc_slot *slot);        void (*remove)(struct mmc_slot *slot);        struct mmc_notifier *next;};/* * Function prototypes *//* Data Conversion functions */static inline void mmc_str2r1(R1_status *r1, __u8 *buff){	*r1 = (buff[0] << 24) | (buff[1] << 16) | (buff[2] << 8) | buff[3];}static inline void mmc_str2ocr(OCR_regs *regs, __u8 *buff){	*regs = (buff[0] << 24) | (buff[1] << 16) | (buff[2] << 8) | buff[3];}static inline void mmc_str2rca(RCA_regs *regs, __u8 *buff){	*regs = (buff[0] << 8) | buff[1];}extern void mmc_str2cid(CID_regs *regs, __u8 *buff);extern void mmc_str2csd(CSD_regs *regs, __u8 *buff);/* Information Collecting functions */extern void mmc_get_CSD_info(struct mmc_slot *slot, CSD_regs *csd);extern const int mmc_res_len[];static inline int mmc_get_res_len(int res_type){	return mmc_res_len[res_type];}/* Slot and User functions */extern int add_mmc_device(struct mmc_slot *slot);extern int del_mmc_device(struct mmc_slot *slot);extern int reidentify_mmc_device(struct mmc_slot *slot);extern void register_mmc_user(struct mmc_notifier *new);extern int unregister_mmc_user(struct mmc_notifier *old);#undef CONFIG_MMC_DEBUG//#define CONFIG_MMC_DEBUG#define CONFIG_MMC_DEBUG_VERBOSE	5#ifdef CONFIG_MMC_DEBUG#define DEBUG2(n, args...)	\	if (n <= CONFIG_MMC_DEBUG_VERBOSE) {	\		printk(args);	\	}#else#define DEBUG2(n, args...)#endif#endif /* ! MMC_MMC_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -