mass_storage_dev_mmc.c

来自「君正早期ucos系统(只有早期的才不没有打包成库),MPLAYER,文件系统,图」· C语言 代码 · 共 108 行

C
108
字号
/********************** BEGIN LICENSE BLOCK ************************************ * * JZ4740  mobile_tv  Project  V1.0.0 * INGENIC CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM * Copyright (c) Ingenic Semiconductor Co. Ltd 2005. All rights reserved. *  * This file, and the files included with this file, is distributed and made  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.  *  * http://www.ingenic.cn  * ********************** END LICENSE BLOCK ************************************** * *  Author:  <dsqiu@ingenic.cn>  <jgao@ingenic.cn>  * *  Create:   2008-06-26, by dsqiu *             *  Maintain: 2008-06-26, by jgao *             * ******************************************************************************* */#if SD_UDC_DISK#include <fs_api.h>#include "function.h"#include <mass_storage.h>#include "mmc_api.h"#include "jz4740.h"#define UCFS_MMC_NAME "mmc:"static UDC_LUN udcLun;static int isinited = 0;#define u8 unsigned char#define u16 unsigned short#define u32 unsigned intunsigned int init_dev(unsigned int handle){//	printf("mmc init \n");	FS_IoCtl("mmc:",FS_CMD_UNMOUNT,0,0);}unsigned int read_dev_sector(unsigned int handle,unsigned char *buf,unsigned int startsect,unsigned int sectcount){	if (!MMC_DetectStatus())		MMC_ReadMultiBlock( startsect , sectcount , buf);}unsigned int write_dev_sector(unsigned int handle,unsigned char *buf,unsigned int startsect,unsigned int sectcount){	if (!MMC_DetectStatus())		MMC_WriteMultiBlock( startsect , sectcount , buf);}unsigned int check_dev_state(unsigned int handle){	if ( MMC_DetectStatus() ) return 0;	else return 1;}unsigned int get_dev_info(unsigned int handle,PDEVINFO pinfo){	pinfo->hiddennum = 0;	pinfo->headnum = 2;	pinfo->sectnum = 4;	if (MMC_DetectStatus() == 0)		pinfo->partsize = MMC_GetSize();	else		pinfo->partsize = 1;	pinfo->sectorsize = 512;}unsigned int deinit_dev(unsigned handle){	FS_IoCtl("mmc:",FS_CMD_MOUNT,0,0);	return 1;}void  init_udc_mmc(){		Init_Mass_Storage();	udcLun.InitDev = init_dev;	udcLun.ReadDevSector = read_dev_sector;	udcLun.WriteDevSector = write_dev_sector;	udcLun.CheckDevState = check_dev_state;	udcLun.GetDevInfo = get_dev_info;	udcLun.DeinitDev = deinit_dev;	udcLun.FlushDev = 0;	//udcLun.DevName = (unsigned int)'MMC1';	udcLun.DevName = ('M' << 24) | ('M' << 16) | ('C' << 8) | '1';	if(RegisterDev(&udcLun))		printf("UDC Register Fail!!!\r\n");	}#endif

⌨️ 快捷键说明

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