mmc_s3c2440.c

来自「mmc 方式通讯的在CPU PXA270下的WINCE 5驱动」· C语言 代码 · 共 80 行

C
80
字号
/*  * 2002 (C) Copyrigt SAMSUMNG ELECTRONICS  *           SW.LEE <hitchcar@sec.samsung.com> *  * 	    Low-level MMC functions for the S3CXX * * Copyright 2002 Hewlett-Packard Company * * Use consistent with the GNU GPL is permitted, * provided that this copyright notice is * preserved in its entirety in all copies and derived works. * * HEWLETT-PACKARD COMPANY MAKES NO WARRANTIES, EXPRESSED OR IMPLIED, * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS * FITNESS FOR ANY PARTICULAR PURPOSE. * * Many thanks to Alessandro Rubini and Jonathan Corbet! * * Author:  Andrew Christian *          6 May 2002 */#include <linux/module.h>#include <linux/version.h>#include <linux/init.h>#include <linux/sched.h>#include <linux/interrupt.h>#include <linux/proc_fs.h>#include <linux/delay.h>#include <asm/irq.h>       #include <asm/io.h>       #include <asm/unaligned.h>#include <asm/arch/hardware.h>#include <linux/mmc/mmc_ll.h>#include "s3c_mmc.h"#define SD_GPIO_CD		GPIO_nCD_SD	#define SD_IRQ_CD		IRQ_nCD_SDstatic __inline__ void mmc_delay(void) {mdelay(100);}/******* * Prototype  *  static int  mmc_s3c_slot_is_empty (int slot) * Purpose:  * Entry * Exit *        1  : slot is empty *        0  : occupied * Exceptions: *****************************************************/static int  mmc_s3c2440_slot_is_empty (struct s3c_mmc_lowlevel *lowlevel){	int retval;	set_gpio_ctrl(SD_GPIO_CD | GPIO_PULLUP_DIS | GPIO_MODE_IN);	mmc_delay();		/* I amn' sure of how long time to*/    	retval = read_gpio_bit(SD_GPIO_CD);    	set_gpio_ctrl(SD_GPIO_CD | GPIO_PULLUP_DIS | GPIO_MODE_EINT);	return retval;}struct s3c_mmc_lowlevel s3c2440_mmc_lowlevel = {	.name = "s3c2440_mmc",	.sdi_irq = IRQ_SDI,	.detect_irq = SD_IRQ_CD,	.detect_irq_edge = EXT_BOTH_EDGES,	.detect_irq_pullup = GPIO_PULLUP_DIS,	.sdi_gpio_cd = SD_GPIO_CD,	.sdi_clock = CLKCON_SDI,	.slot_is_empty = mmc_s3c2440_slot_is_empty};

⌨️ 快捷键说明

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