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

📄 usbdriver.h

📁 M20xx-FNU20编程工程模板
💻 H
字号:
/****************************************Copyright (c)**************************************************
**                               Guangzou ZLG-MCU Development Co.,LTD.
**                                      graduate school
**                                 http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name:			USBDriver.h
** Last modified Date:	2005-8-6
** Last Version:		V1.0
** Descriptions:		LPC214x USB 应用层
**						LPC214x USB Application Layer
**------------------------------------------------------------------------------------------------------
** Created by:			郑明远 		MingYuan Zheng
** Created date:		2005-8-6
** Version:				V1.0
** Descriptions:		初始版本	The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by:			
** Modified date:
** Version:				
** Descriptions:
**
**------------------------------------------------------------------------------------------------------
** Modified by: 
** Modified date:
** Version:	
** Descriptions: 
**
********************************************************************************************************/

#ifndef __USBDRIVER_H__
#define __USBDRIVER_H__


/**************** 定义 USB 收发错误码 ***************************/
#define USB_NO_ERR				0x00		/* 正确 */
#define USB_ERR_NO_CONFIG		0x01		/* USB总线未配置完成错误 */
#define USB_ERR_BUFF_INVALID	0x02		/* 接收或发送缓冲区错误 */
#define USB_ERR_WR_TIMEOUT		0x03		/* 接收或发送超时错误 */

#define USB_ERR_READ_CHIPID     0x10		/* 读芯片ID号错误 */		
	


/*************************************************************
*   
*               下面为向用户开放的 API 函数
*
**************************************************************/

/***********************************************************************************************************************
** 函数名称 : USB_Initialize()									Name	 : USB_Initialize()
** 功能描述 : 初始化 USB 设备控制器		  			   			Function : Initialize the USB device controller 
** 输	 入 : 无							 					Input	 : NULL
** 输	 出 : 0: 初始化成功  >0: 初始化失败(错误码)				Output	 : 0: Initialize sucessfully    >0: Initialize fail(error code)
***********************************************************************************************************************/
extern INT8U USB_Initialize(void);


/*******************************************************************************************************************************
** 函数名称: INT8U ReadPort1()									Name:		 INT8U ReadPort1()	
** 功能描述: 从端口 1 接收len个字节								Function:	 receive len Bytes from Port1
** 输   入: INT32U  len: 要接收的字节数						Input:		 INT32U  len:   	numbers will be receive
						 (取值范围为0x00000001 ~ 0xFFFFFFFF)			    			    	(range: 0x00000001 ~ 0xFFFFFFFF)	
			 INT8U   recbuff:   接收缓冲区指针								 INT8U   recbuff:   receive buffer
			 INT16U  timeout:   超时等待时间, 等于0表示无限等待 			 INT16U  timeout:   timeout	of receiving,0 indicates limitless waiting		 
** 输   出: 0: 接收成功	 > 0: 接收失败(错误码)				Output:		 0:	sucessfully		>0 fail (error code)
*******************************************************************************************************************************/
extern INT8U USB_ReadPort1(INT32U len, INT8U *recbuff, INT16U timeout);


/*******************************************************************************************************************************
** 函数名称: INT8U ReadPort2()									Name:		 INT8U ReadPort2()	
** 功能描述: 从端口 2 接收len个字节								Function:	 receive len Bytes from Port2
** 输   入: INT32U  len: 要接收的字节数						Input:		 INT32U  len:   	numbers will be receive
						 (取值范围为0x00000001 ~ 0xFFFFFFFF)			    			    	(range: 0x00000001 ~ 0xFFFFFFFF)	
			 INT8U   recbuff:   接收缓冲区指针								 INT8U   sendbuff:  receive buffer
			 INT16U  timeout:   超时等待时间, 等于0表示无限等待 			 INT16U  timeout:   timeout	of receiving,0 indicates limitless waiting		 
** 输   出: 0: 接收成功	 > 0: 接收失败(错误码)				Output:		 0:	sucessfully		>0 fail (error code)
*******************************************************************************************************************************/
extern INT8U USB_ReadPort2(INT32U len, INT8U *recbuff, INT16U timeout);


/*******************************************************************************************************************************
** 函数名称: INT8U ReadPort3()									Name:		 INT8U ReadPort3()	
** 功能描述: 从端口 3 接收len个字节								Function:	 receive len Bytes from Port3
** 输   入: INT32U  len: 要接收的字节数						Input:		 INT32U  len:   	numbers will be receive
						 (取值范围为0x00000001 ~ 0xFFFFFFFF)			    			    	(range: 0x00000001 ~ 0xFFFFFFFF)	
			 INT8U   recbuff:   接收缓冲区指针								 INT8U   sendbuff:  receive buffer
			 INT16U  timeout:   超时等待时间, 等于0表示无限等待 			 INT16U  timeout:   timeout	of receiving,0 indicates limitless waiting		 
** 输   出: 0: 接收成功	 > 0: 接收失败(错误码)				Output:		 0:	sucessfully		>0 fail (error code)
*******************************************************************************************************************************/
extern INT8U USB_ReadPort3(INT32U len, INT8U *recbuff, INT16U timeout);


/*******************************************************************************************************************************
** 函数名称: INT8U WritePort1()									Name:		 INT8U WritePort1()	
** 功能描述: 用端口 1 发送len个字节								Function:	 Send len Bytes via Port1
** 输   入: INT32U  len: 发送的字节数							Input:		 INT32U  len:   	numbers will be send
						  (取值范围为0x00000001 ~ 0xFFFFFFFF)			    			    	(range: 0x00000001 ~ 0xFFFFFFFF)	
			 INT8U   sendbuff:  发送缓冲区指针								 INT8U   sendbuff:  send buffer
			 INT16U  timeout:   超时等待时间, 等于0表示无限等待 			 INT16U  timeout:   timeout	of transmitting,0 indicates limitless waiting		 
** 输   出: 0: 发送成功	 > 0: 发送失败(错误码)				Output:		 0:	sucessfully		>0 fail (error code)
*******************************************************************************************************************************/
extern INT8U USB_WritePort1(INT32U len, INT8U *sendbuff, INT16U timeout);


/*******************************************************************************************************************************
** 函数名称: INT8U WritePort2()									Name:		 INT8U WritePort2()	
** 功能描述: 用端口 2 发送len个字节								Function:	 Send len Bytes via Port2
** 输   入: INT32U  len: 发送的字节数							Input:		 INT32U  len:   	numbers will be send
						  (取值范围为0x00000001 ~ 0xFFFFFFFF)			    			    	(range: 0x00000001 ~ 0xFFFFFFFF)	
			 INT8U   sendbuff:  发送缓冲区指针								 INT8U   sendbuff:  send buffer
			 INT16U  timeout:   超时等待时间, 等于0表示无限等待 			 INT16U  timeout:   timeout	of transmitting,0 indicates limitless waiting		 
** 输   出: 0: 发送成功	 > 0: 发送失败(错误码)				Output:		 0:	sucessfully		>0 fail (error code)
*******************************************************************************************************************************/
extern INT8U USB_WritePort2(INT32U len,INT8U *sendbuff,INT16U timeout);


/*******************************************************************************************************************************
** 函数名称: INT8U WritePort3()									Name:		 INT8U WritePort3()	
** 功能描述: 用端口 3 发送len个字节								Function:	 Send len Bytes via Port3
** 输   入: INT32U  len: 发送的字节数							Input:		 INT32U  len:   	numbers will be send
						  (取值范围为0x00000001 ~ 0xFFFFFFFF)			    			    	(range: 0x00000001 ~ 0xFFFFFFFF)	
			 INT8U   sendbuff:  发送缓冲区指针								 INT8U   sendbuff:  send buffer
			 INT16U  timeout:   超时等待时间, 等于0表示无限等待 			 INT16U  timeout:   timeout	of transmitting,0 indicates limitless waiting		 
** 输   出: 0: 发送成功	 > 0: 发送失败(错误码)				Output:		 0:	sucessfully		>0 fail (error code)
*******************************************************************************************************************************/
extern INT8U USB_WritePort3(INT32U len,INT8U *sendbuff,INT16U timeout);



/**************************************************************************************************************
** 函数名称:  Get_ZLG_USBD13Ver
** 功能描述:  得到 ZLG/USBD13 软件包版本号
** 输   入:  无
** 输   出:  ZLG/USBD13 软件包版本号
***************************************************************************************************************/
extern INT16U Get_ZLG_USBD13Ver(void);

#endif


/*******************************************************************************************************
**                            End Of File
********************************************************************************************************/





⌨️ 快捷键说明

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