📄 config.h
字号:
/****************************************Copyright (c)**************************************************** Guangzhou ZHIYUAN electronics Co.,LTD.** ** http://www.zyinside.com****--------------File Info-------------------------------------------------------------------------------** File Name: sdconfig.h** Last modified Date: 2006.01.09** Last Version: V1.0 ** Description: User Configurable File****------------------------------------------------------------------------------------------------------** Created By: Ming Yuan Zheng 郑明远** Created date: 2006.01.09** Version: V1.0** Descriptions: The original version 初始版本****------------------------------------------------------------------------------------------------------** Modified by:** Modified date:** Version:** Description:**********************************************************************************************************/#ifndef __CONFIG_H#define __CONFIG_H//This segment should not be modified#ifndef TRUE#define TRUE 1#endif#ifndef FALSE#define FALSE 0#endif#ifndef __KERNEL__ #define __KERNEL__#endif#ifndef MODULE #define MODULE#endif#include <linux/config.h>#include <linux/module.h>#include <linux/kernel.h> /* printk() *///#include <linux/malloc.h> /* kmalloc() */#include <linux/slab.h> /* kmalloc() */#include <linux/fs.h> /* everything... */#include <linux/errno.h> /* error codes */#include <linux/proc_fs.h>#include <linux/fcntl.h> /* O_ACCMODE */#include <asm/irq.h>#include <asm/system.h> /* cli(), *_flags */#include <linux/init.h>#include <asm/uaccess.h>typedef u8 uint8; /* defined for unsigned 8-bits integer variable 无符号8位整型变量 */typedef s8 int8; /* defined for signed 8-bits integer variable 有符号8位整型变量 */typedef u16 uint16; /* defined for unsigned 16-bits integer variable 无符号16位整型变量 */typedef s16 int16; /* defined for signed 16-bits integer variable 有符号16位整型变量 */typedef u32 uint32; /* defined for unsigned 32-bits integer variable 无符号32位整型变量 */typedef s32 int32; /* defined for signed 32-bits integer variable 有符号32位整型变量 */typedef float fp32; /* single precision floating point variable (32bits) 单精度浮点数(32位长度) */typedef double fp64; /* double precision floating point variable (64bits) 双精度浮点数(64位长度) *//********************************//*Application Program Configurations*//* 应用程序配置 *//********************************///This segment could be modified as needed.//以下根据需要改动#include <asm/hardware.h>#include <asm/arch-s3c2410/cpu_s3c2410.h>#include <linux/delay.h> /* mdelay() */#include "sdmmc/sdconfig.h"#include "sdmmc/sdhal.h"#include "sdmmc/sdcmd.h"#include "sdmmc/sddriver.h"#include "zlg_fs/zlg_fs.h"#include "zlg_fs/fat.h"#define DEVICE_NAME "zlg/fs-sd" /* name for messaging */#define MAX_DISK_DRIVES 1#define DEVICE_BYTES_PER_SEC 512#define DEVICE_SEC_PER_DISK (1024 * 32)#define COMMAND_FUNCTION SDCammand//#define DISK_INFO zlg_fs_disk#ifdef IN_ZLG_FS_DRIVERextern uint16 SDCammand(uint8 Cammand, void *Parameter);/*********************************************************************************************************** Function name: drive_init** Descriptions: the initialization of SD/MMC card driver ** SD/MMC 卡驱动初始化 ** Input: NULL ** Output: NULL** Created by: MingYuan Zheng 郑明远 ** Created Date: 2006-01-09 **-------------------------------------------------------------------------------------------------------** Modified by:** Modified Date: **------------------------------------------------------------------------------------------------------********************************************************************************************************/ static void drive_init(void){ int ret; INT8U rec,buff[512]; INT32U i,j; set_gpio_ctrl(SD_GPIO_CD); /* 注册IRQ处理函数 Register IRQ handlers */ set_external_irq(SD_IRQ_CD, EXT_BOTH_EDGES, GPIO_PULLUP_DIS); ret = request_irq(SD_IRQ_CD, card_detect_interrupt, SA_INTERRUPT, "my" DEVICE_NAME, NULL); if (ret) { printk("SD/MMC Slot: request_irq(SD CD) failed\n"); return; } #if SD_INTERRUPT_EN ret = request_irq(IRQ_SDI, sdmmc_interrupt, SA_INTERRUPT, "my" DEVICE_NAME, NULL); if (ret) { printk("SD/MMC Slot: request_irq(SDI) failed\n"); free_irq(SD_IRQ_CD, NULL); return; }#endif card_insert = 0; printk("SD/MMC/SDI slot initialized\n"); card_detect_interrupt(SD_IRQ_CD, NULL, NULL); /* 进行第一次测卡 */}/*********************************************************************************************************** Function name: drive_clean** Descriptions: the uninstall of SD/MMC card driver ** SD/MMC 卡驱动卸载 ** Input: NULL ** Output: NULL** Created by: MingYuan Zheng 郑明远 ** Created Date: 2006-01-09 **-------------------------------------------------------------------------------------------------------** Modified by:** Modified Date: **------------------------------------------------------------------------------------------------------********************************************************************************************************/ static void drive_clean(void){#if SD_INTERRUPT_EN free_irq(IRQ_SDI, NULL);#endif free_irq(SD_IRQ_CD, NULL); if (card_insert) { card_insert = 0; } }#endif#define malloc(a) kmalloc(a, GFP_KERNEL)#define free(a) kfree(a)#define OS_ENTER_CRITICAL() #define OS_EXIT_CRITICAL()#endif/*********************************************************************************************************** End Of File********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -