?? usbd.h
字號:
** input parameters: ucTranType 傳輸類型
** output parameters: None
** Returned value: TRUE : 成功 FALSE : 失敗
*********************************************************************************************************/
USB_BOOL usbPipeOpen (USB_INT8U ucTranType);
/*********************************************************************************************************
** Function name: usbPipeClose
** Descriptions: 關閉傳輸管道
** input parameters: ucTranType 傳輸類型
** output parameters: None
** Returned value: TRUE : 成功 FALSE : 失敗
*********************************************************************************************************/
USB_BOOL usbPipeClose (USB_INT8U ucTranType);
/*********************************************************************************************************
** Function name: usbGetStatus
** Descriptions: 讀取狀態請求
** input parameters: ucType 要讀取的狀態的對象類型,指設備(0),接口(1),或端點(2)
** wIndex 索引,設備號(固定為0),或接口號,或端點號
** output parameters: pucData 接收數據緩沖區,用于存放讀取到的狀態值
** Returned value: 傳輸錯誤碼 成功 : USB_ERR_SUCESS, 其余為錯誤
*********************************************************************************************************/
USB_INT8U usbGetStatus (USB_INT8U ucType , USB_INT16U wIndex, USB_INT8U *pucData);
#define usbGetDeviceStatus(pucData) usbGetStatus(0, 0, pucData)
#define usbGetInterfaceStatus(wIndex, pucData) usbGetStatus(0x01, wIndex, pucData)
#define usbGetEndPointStatus(wIndex, pucData) usbGetStatus(0x02, wIndex, pucData)
/*********************************************************************************************************
** Function name: usbClearFeature
** Descriptions: 清除特性
** input parameters: ucType 要讀取的狀態的對象類型,指設備(0),接口(1),或端點(2)
** wValue 特性選擇符
** wIndex 索引,設備號(固定為0),或接口號,或端點號
** output parameters: None
** Returned value: 傳輸錯誤碼 成功 : USB_ERR_SUCESS, 其余為錯誤
*********************************************************************************************************/
USB_INT8U usbClearFeature (USB_INT8U ucType, USB_INT16U wValue, USB_INT16U wIndex);
#define usbClearFeature_EP(wIndex) usbClearFeature (__USB_RECIPIENT_ENDPOINT, 0, wIndex)
/*********************************************************************************************************
** Function name: usbSetFeature
** Descriptions: 設置特性
** input parameters: ucType 要讀取的狀態的對象類型,指設備(0),接口(1),或端點(2)
** wValue 特性選擇符
** wIndex 索引,設備號(固定為0),或接口號,或端點號
** output parameters: None
** Returned value: 傳輸錯誤碼 成功 : USB_ERR_SUCESS, 其余為錯誤
*********************************************************************************************************/
USB_BOOL usbSetFeature (USB_INT8U ucType, USB_INT16U wValue, USB_INT16U wIndex);
/*********************************************************************************************************
OTG 增加的特性
*********************************************************************************************************/
#define usbSetFeature_b_hnp_enable() usbSetFeature(0, __OTG_B_HNP_ENABLE, 0)
#define usbSetFeature_a_hnp_support() usbSetFeature(0, __OTG_A_HNP_SUPPORT, 0)
#define usbSetFeature_a_alt_hnp_support() usbSetFeature(0, __OTG_A_ALT_HNP_SUPPORT, 0)
/*********************************************************************************************************
** Function name: usbSetAddress
** Descriptions: 設置地址
** input parameters: wValue 地址值
** output parameters: None
** Returned value: 傳輸錯誤碼 成功 : USB_ERR_SUCESS, 其余為錯誤
*********************************************************************************************************/
USB_INT8U usbSetAddress (USB_INT16U wValue);
/*********************************************************************************************************
** Function name: usbGetDescription
** Descriptions: 獲取描述符
** input parameters: wValue 類型和索引
** wIndex 0 或語言 ID
** wLength 描述符長度
** output parameters: pucData 接收描述符的緩沖區
** Returned value: 傳輸錯誤碼 成功 : USB_ERR_SUCESS, 其余為錯誤
*********************************************************************************************************/
USB_INT8U usbGetDescription (USB_INT16U wValue, USB_INT16U wIndex, USB_INT16U wLength, USB_INT8U *pucData);
#define usbGetDeviceDescription(wLength, pucData) \
usbGetDescription((USB_INT16U)(0x01 << 8), 0, wLength, pucData)
#define usbGetConfigDescription(wValue, wIndex, wLength, pucData) \
usbGetDescription((USB_INT16U)(0x02 << 8) | wValue, wIndex, wLength, pucData)
#define usbGetStringDescription(wValue, wIndex, wLength, pucData) \
usbGetDescription((USB_INT16U)((USB_INT16U)(0x03 << 8) | wValue), wIndex, wLength, pucData)
/*********************************************************************************************************
** Function name: usbSetDescription
** Descriptions: 設置描述符
** input parameters: wValue 類型和索引
** wIndex 0 或語言ID
** wLength 描述符長度
** output parameters: pucData 接收描述符的緩沖區
** Returned value: 傳輸錯誤碼 成功 : USB_ERR_SUCESS, 其余為錯誤
*********************************************************************************************************/
USB_INT8U usbSetDescription (USB_INT16U wValue, USB_INT16U wIndex, USB_INT16U wLength, USB_INT8U *pucData);
/*********************************************************************************************************
** Function name: usbGetConfiguratiton
** Descriptions: 讀取配置值請求
** input parameters: None
** output parameters: pucData 配置值
** Returned value: 傳輸錯誤碼 成功 : USB_ERR_SUCESS, 其余為錯誤
*********************************************************************************************************/
USB_INT8U usbGetConfiguratiton (USB_INT8U *pucData);
/*********************************************************************************************************
** Function name: usbSetConfiguratiton
** Descriptions: 設置配置值請求
** input parameters: None
** output parameters: None
** Returned value: 傳輸錯誤碼 成功 : USB_ERR_SUCESS, 其余為錯誤
*********************************************************************************************************/
USB_INT8U usbSetConfiguratiton (void);
/*********************************************************************************************************
** Function name: usbGetInterface
** Descriptions: 讀取指定接口的設置值,即接口描述符中的bAlternateSetting字段值
** input parameters: wIndex 接口號
** output parameters: pucData 返回的bAlternateSetting字段值
** Returned value: 傳輸錯誤碼 成功 : USB_ERR_SUCESS, 其余為錯誤
*********************************************************************************************************/
USB_INT8U usbGetInterface (USB_INT16U wIndex, USB_INT8U *pucData);
/*********************************************************************************************************
** Function name: usbSetInterface
** Descriptions: 設置接口請求,與usbGetInterface相對應
** input parameters: wValue 可替換的設置值
** wIndex 接口號
** output parameters: None
** Returned value: 傳輸錯誤碼 成功 : USB_ERR_SUCESS, 其余為錯誤
*********************************************************************************************************/
USB_INT8U usbSetInterface (USB_INT16U wValue, USB_INT16U wIndex);
/*********************************************************************************************************
** Function name: usbSunchFrame
** Descriptions: 同步幀請求,用于設置并報告端點的同步幀號
** input parameters: wIndex 端點號
** output parameters: pucData 返回的幀號
** Returned value: TRUE : 成功 FALSE : 失敗
*********************************************************************************************************/
USB_INT8U usbSunchFrame (USB_INT16U wIndex, USB_INT8U *pucData);
/*********************************************************************************************************
** Function name: usbInterfaceEpConfig
** Descriptions: 根據獲取到的配置描述符數據找出接口描述符及其端點描述符,
** 并將其填充到相應的描述符結構體中
** input parameters: pucBuf 獲取到的配置描述符數據緩沖區
** usConfigDescLen 配置描述符總長度
** output parameters: None
** Returned value: TRUE : 成功 FALSE : 失敗
*********************************************************************************************************/
USB_BOOL usbInterfaceEpConfig (USB_INT8U *pucBuf, USB_INT16U usConfigDescLen);
/*********************************************************************************************************
** Function name: usbGetEpMaxPktSize
** Descriptions: 獲取端點的最大包大小
** input parameters: ucInterfaceIndex 接口索引
** ucEpNum 端點號
** output parameters: None
** Returned value: > 0 : 所要端點的最大包大小, 0 : 失敗,表示端點ucEpNum不存在
*********************************************************************************************************/
USB_INT16U usbGetEpMaxPktSize (USB_INT8U ucInterfaceIndex, USB_INT8U ucEpNum);
/*********************************************************************************************************
** Function name: usbIsDeviceReady
** Descriptions: 判斷設備是否準備好
** input parameters: None
** output parameters: None
** Returned value: TRUE : 設備準備好 FALSE : 設備未準備好
*********************************************************************************************************/
USB_BOOL usbIsDeviceReady (void);
/*********************************************************************************************************
** Function name: usbIsDeviceAttach
** Descriptions: 判斷設備是否插入
** input parameters: None
** output parameters: None
** Returned value: TRUE : 設備已插入 FALSE : 設備未準備插入
*********************************************************************************************************/
USB_BOOL usbIsDeviceAttach (void);
/*********************************************************************************************************
** Function name: usbGetDeviceType
** Descriptions: 獲取設備類型信息,包括設備類型,所支持協議等
** input parameters: ucInterfaceIndex 接口號
** output parameters: pusbDeviceType 設備類型
** Returned value: TRUE : 成功 FALSE : 失敗
*********************************************************************************************************/
USB_BOOL usbGetDeviceType (USB_INT8U ucInterfaceIndex, PUSB_DEVICE_TYPE pusbDeviceType);
/*********************************************************************************************************
** Function name: usbGetEp
** Descriptions: 獲取非控制端點的端點號
** input parameters: ucInterface 接口號
** ucTranType 傳輸類型
** output parameters: None
** Returned value: > 0 : 端點號, = 0 : 獲取失敗,可能是設備不存在該類型端點
*********************************************************************************************************/
USB_INT8U usbGetEp (USB_INT8U ucInterface, USB_INT8U ucTranType);
/*********************************************************************************************************
** Function name: usbGetVer
** Descriptions: 取得USB主機協議棧的版本號
** input parameters: None
** output parameters: None
** Returned value: 32位版本號
*********************************************************************************************************/
INT32U usbGetVer (void);
extern volatile __USB_HOST_FLAGS GusbHostFlags;
extern __USB_HOST_EVENT_CNT __GusbHostEvtCnt;
extern USB_INT16U __GusEpMaxPktSize[__USB_MAX_INTERFACE][32];
extern USB_DEVICE_DESCRIPTOR GusbDeviceDescr; /* 設備描述符 */
extern USB_CONFIGURATION_DESCRIPTOR GusbConfigDescr; /* 配置描述符 */
extern USB_OTG_DESCRIPTOR GusbOtgDescr;
extern __USB_INTERFACE_EP_DESCR GusbInterEpDescr[__USB_MAX_INTERFACE];
extern void (*__GpEnumSucessCallBack)(void); /* 枚舉成功時回調函數 */
extern void (*__GpDevDisconCallBack)(void); /* 設備撥出時回調函數 */
#endif
/*********************************************************************************************************
END FILE
*********************************************************************************************************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -