udcbus.c

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

C
70
字号
/********************** 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 *             * ******************************************************************************* */#include "udcbus.h"#include "function.h"//mem manger using DrvMngMem.c#define malloc    alloc#define free      deAllocPUDC_BUS curDevice = 0;PUDC_BUS CreateDevice(PFN_BusNotify busNotify){	if(curDevice == 0)	{		curDevice = (PUDC_BUS)malloc(sizeof(UDC_BUS));		InitUDC(curDevice);		//curDevice->DeviceName = (unsigned int)'UDC:';		curDevice->DeviceName = ('U' << 24) | ('D' << 16) | ('C' << 8) | ':';	}	curDevice->BusNotify = busNotify;		return curDevice;}void CloseDevice(){	if(curDevice)		free(curDevice);	curDevice = 0;}PUDC_BUS SwichDevice(PFN_BusNotify busNotify){	if(curDevice)		curDevice->BusNotify = busNotify;	return curDevice;	}unsigned int BusNotify(unsigned int handle,unsigned int stat,unsigned char *bufaddr,unsigned int len){	if(handle != (unsigned int)curDevice)		return 0;    curDevice->BusNotify(handle,stat,bufaddr,len);	return 1;	}

⌨️ 快捷键说明

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