📄 usb_host_enum.h
字号:
usb_request.wValue = DEVICE_DESCRIPTOR << 8,\
usb_request.wIndex = 0,\
usb_request.wLength = 18,\
usb_request.uncomplete_read = FALSE,\
host_send_control(data_stage))
/**
* host_get_configuration_descriptor
*
* @brief this function send a get device configuration request.
* The configuration descriptor table received is stored in data_stage array.
*
*
* @param none
*
*
* @return status
*/
#define host_get_configuration_descriptor() (usb_request.bmRequestType = 0x80,\
usb_request.bRequest = GET_DESCRIPTOR,\
usb_request.wValue = CONFIGURATION_DESCRIPTOR << 8,\
usb_request.wIndex = 0,\
usb_request.wLength = 255,\
usb_request.uncomplete_read = FALSE,\
host_send_control(data_stage))
#define host_get_descriptor_uncomplete() (usb_request.bmRequestType = 0x80,\
usb_request.bRequest = GET_DESCRIPTOR,\
usb_request.wValue = 0,\
usb_request.wIndex = 0,\
usb_request.wLength = 64,\
usb_request.uncomplete_read = FALSE,\
host_send_control(data_stage))
/**
* host_set_address
*
* @brief this function send a set address request.
*
*
* @param U8 address (the addr attributed to the device)
*
*
* @return status
*/
#define host_set_address(addr) (usb_request.bmRequestType = 0x00,\
usb_request.bRequest = SET_ADDRESS,\
usb_request.wValue = (U16)addr,\
usb_request.wIndex = 0,\
usb_request.wLength = 0,\
usb_request.uncomplete_read = FALSE,\
host_send_control(data_stage))
/**
* host_set_feature_remote_wakeup
*
* @brief this function send a set feature device remote wakeup
*
* @param none
*
* @return status
*/
#define host_set_feature_remote_wakeup() (usb_request.bmRequestType = 0x00,\
usb_request.bRequest = SET_FEATURE,\
usb_request.wValue = 1,\
usb_request.wIndex = 1,\
usb_request.wLength = 0,\
usb_request.uncomplete_read = FALSE,\
host_send_control(data_stage))
/**
* host_ms_get_max_lun
*
* @brief this function send the mass storage specific request "get max lun"
*
*
* @param none
*
*
* @return status
*/
#define host_ms_get_max_lun() (usb_request.bmRequestType = 0xA1,\
usb_request.bRequest = MS_GET_MAX_LUN,\
usb_request.wValue = 0,\
usb_request.wIndex = 0,\
usb_request.wLength = 1,\
usb_request.uncomplete_read = FALSE,\
host_send_control(data_stage))
/**
* Get_VID
*
* @brief this function returns the VID of the device connected
*
* @param none
*
*
* @return U16 (VID value)
*/
#define Get_VID() (device_VID)
/**
* Get_PID
*
* @brief this function returns the PID of the device connected
*
* @param none
*
*
* @return U16 (PID value)
*/
#define Get_PID() (device_PID)
/**
* Get_maxpower
*
* @brief this function returns the maximum power consumption ot the connected device (unit is 2mA)
*
* @param none
*
*
* @return U8 (maxpower value)
*/
#define Get_maxpower() (maxpower)
/**
* @brief this function returns the USB class associated to the specified interface
*
* @param U8 s_interface: the supported interface number
*
* @return U16 (CLASS code)
*/
#define Get_class(s_interface) (interface_supported[s_interface].class)
/**
* @brief this function returns the USB subclass associated to the specified interface
*
* @param U8 s_interface: the supported interface number
*
* @return U16 (SUBCLASS code)
*/
#define Get_subclass(s_interface) (interface_supported[s_interface].subclass)
/**
* @brief this function returns the USB protocol associated to the specified interface
*
* @param U8 s_interface: the supported interface number
*
* @return U16 (protocol code)
*/
#define Get_protocol(s_interface) (interface_supported[s_interface].protocol)
/**
* @brief this function returns endpoint address associated to the specified interface and
* endpoint number in this interface.
*
* @param U8 s_interface: the supported interface number
* @param U8 n_ep: the endpoint number in this interface
*
* @return U8 (endpoint address)
*/
#define Get_ep_addr(s_interface,n_ep) (interface_supported[s_interface].ep_addr[n_ep])
/**
* @brief this function returns number of endpoints associated to
* a supported interface.
*
* @param U8 s_interface: the supported interface number
*
* @return U8 (number of enpoints)
*/
#define Get_nb_ep(s_interface) (interface_supported[s_interface].nb_ep)
/**
* @brief this function returns number of the alternate setting field associated to
* a supported interface.
*
* @param U8 s_interface: the supported interface number
*
* @return U8 (number of alt setting value)
*/
#define Get_alts_s(s_interface) (interface_supported[s_interface].altset_nb)
/**
* @brief this function returns number of the interface number associated to
* a supported interface.
*
* @param U8 s_interface: the supported interface number
*
* @return U8 (number of the interface)
*/
#define Get_interface_number(s_interface) (interface_supported[s_interface].interface_nb)
/**
* @brief this function returns the number of interface supported in the device connected
*
* @param none
*
* @return U8 : The number of interface
*/
#define Get_nb_supported_interface() (nb_interface_supported)
/**
* @brief this function returns true if the device connected is self powered
*
* @param none
*
* @return U8 : The number of interface
*/
#define Is_device_self_powered() ((bmattributes & (1<<BIT_SELF_POWERED)) ? TRUE : FALSE)
/**
* @brief this function returns true if the device supports remote wake_up
*
* @param none
*
* @return U8 : The number of interface
*/
#define Is_device_supports_remote_wakeup() ((bmattributes & (1<<BIT_REMOTE_WAKEUP)) ? TRUE : FALSE)
extern U8 nb_interface_supported;
extern S_interface interface_supported[MAX_INTERFACE_SUPPORTED];
extern U16 device_PID;
extern U16 device_VID;
extern U8 bmattributes;
extern U8 maxpower;
U8 host_check_VID_PID(void);
U8 host_check_class (void);
U8 host_auto_configure_endpoint();
T_DESC_OFFSET get_interface_descriptor_offset(U8 interface, U8 alt);
U8 host_get_hwd_pipe_nb(U8 ep_addr);
//! @}
#endif // _USB_HOST_ENUM_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -