当前位置:首页 > 单片机 > 单片机
[导读]usb_core.c这个c文件是个庞大的文件,主要是定义了usb2.0的标注协议处理函数。下面是这个文件的所有函数:/******************************************************************************** Function Name : Sta

usb_core.c这个c文件是个庞大的文件,主要是定义了usb2.0的标注协议处理函数。

下面是这个文件的所有函数:

/*******************************************************************************

* Function Name : Standard_GetConfiguration.

* Description : 返回当前配置变量的地址

* Input : Length -需要的字节 How many bytes are needed.

* Output : None.

* Return : 如果'Length'值为0时,请求无效,返回1。长度不为0时,返回配置变量的地址

* Readme : 当配置值与摸个配置描述符中的配置编号一致时,表示选中该配置

*******************************************************************************/

uint8_t *Standard_GetConfiguration(uint16_t Length);






/*******************************************************************************

* Function Name : Standard_SetConfiguration.

* Description : 该函数用于设置配置值,主机发送该请求后,usb设备要配置自己的设备值

* Input : None.

* Output : None.

* Return : 当该请求被执行了,返回USB_SUCCESS

* 当请求无效时,然会USB_UNSUPPORT

*******************************************************************************/

RESULT Standard_SetConfiguration(void);






/*******************************************************************************

* Function Name : Standard_GetInterface.

* Description : 返回当前接口的备用接口

* Input : Length -需要的字节数

* Output : None.

* Return : 当'Length'的值为0,请求无效,返回0,当长度不为0,返回备用接口的地址

*******************************************************************************/

uint8_t *Standard_GetInterface(uint16_t Length);






/*******************************************************************************

* Function Name : Standard_GetStatus.

* Description : 拷贝设备请求数据到"StatusInfo buffer".

* Input : - Length -需要的字节数

* Output : None.

* Return : 如果请求在数据块的末端,或则当'Length'为0是,请求无效,则返回0

*******************************************************************************/

uint8_t *Standard_GetStatus(uint16_t Length);






/*******************************************************************************

* Function Name : Standard_ClearFeature.

* Description : 清除或禁止某个指定的特性

* Input : None.

* Output : None.

* Return : 当请求被执行,返回Return USB_SUCCESS,如果请求无效,返回USB_UNSUPPORT

*******************************************************************************/

RESULT Standard_ClearFeature(void);




/*******************************************************************************

* Function Name : Standard_SetEndPointFeature

* Description : 设置或使能端点的指定的特性

* Input : None.

* Output : None.

* Return : 如果请求被执行,返回USB_SUCCESS,如果请求无效,则返回USB_UNSUPPORT

*******************************************************************************/

RESULT Standard_SetEndPointFeature(void);






/*******************************************************************************

* Function Name : Standard_SetDeviceFeature.

* Description : 设置或使能设备指定的特性

* Input : None.

* Output : None.

* Return : 如果请求被执行,返回USB_SUCCESS,如果请求无效,则返回USB_UNSUPPORT

*******************************************************************************/

RESULT Standard_SetDeviceFeature(void);






/*******************************************************************************

* Function Name : Standard_GetDescriptorData.

* Description : Standard_GetDescriptorData用于描述符的传输.

* : 这个函数用于驻留在flash或RAM里的描述符pDesc可以自相Flash或RAM

* 这个函数的目的是具有不同的方式去响应描述符请求。

* 它允许用户通过软件生成的某些描述符或则读取外部存储设备的描述符部分.

* Input : Length - 这次传输的的数据长度

* pDesc - 指向描述符结构体的指针

* Output : None.

* Return : 返回usb_wOffset指向的描述符部分的地址。这个地址指向的缓冲包含最起码Length个字节

*******************************************************************************/

uint8_t *Standard_GetDescriptorData(uint16_t Length, ONE_DESCRIPTOR *pDesc);




/*******************************************************************************

* Function Name : DataStageOut.

* Description : 数据阶段的控制写传输

* Input : None.

* Output : None.

* Return : None.

*******************************************************************************/

void DataStageOut(void);






/*******************************************************************************

* Function Name : DataStageIn.

* Description : 数据阶段的控制读传输

* Input : None.

* Output : None.

* Return : None.

*******************************************************************************/

void DataStageIn(void);






/*******************************************************************************

* Function Name : NoData_Setup0.

* Description : 处理没有数据阶段的建立请求

* Input : None.

* Output : None.

* Return : None.

*******************************************************************************/

void NoData_Setup0(void);






/*******************************************************************************

* Function Name : Data_Setup0.

* Description : 处理有数据阶段的建立请求

* Input : None.

* Output : None.

* Return : None.

*******************************************************************************/

void Data_Setup0(void);






/*******************************************************************************

* Function Name : Setup0_Process

* Description : 建立阶段的数据处理Get the device request data and dispatch to individual process.

* Input : None.

* Output : None.

* Return : Post0_Process.

*******************************************************************************/

uint8_t Setup0_Process(void);






/*******************************************************************************

* Function Name : In0_Process

* Description : 处理默认端点的所有IN令牌包

* Input : None.

* Output : None.

* Return : Post0_Process.

*******************************************************************************/

uint8_t In0_Process(void);




/*******************************************************************************

* Function Name : Out0_Process

* Description : 处理默认端点上的所有OUT令牌包

* Input : None.

* Output : None.

* Return : Post0_Process.

*******************************************************************************/

uint8_t Out0_Process(void);






/*******************************************************************************

* Function Name : Post0_Process

* Description : 为防止错误,停止端点0Stall the Endpoint 0 in case of error.

* Input : None.

* Output : None.

* Return : 如果控制状态是PAUSE,返回0;如果不是返回1

*******************************************************************************/

uint8_t Post0_Process(void);






/*******************************************************************************

* Function Name : SetDeviceAddress.

* Description : 设置设备和所有使用过的端点地址

* Input : Val:设备地址

* Output : None.

* Return : None.

*******************************************************************************/

void SetDeviceAddress(uint8_t Val);






/*******************************************************************************

* Function Name : NOP_Process

* Description : 没有处理函数

* Input : None.

* Output : None.

* Return : None.

*******************************************************************************/

void NOP_Process(void);


这里简单地介绍几类函数。

首先要将的是关于USB特性(Feature)和状态的函数,这些函数包括:St

本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除( 邮箱:macysun@21ic.com )。
换一批
延伸阅读
关闭