pure sdk for main
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
/*****************************************************************************
|
||||
* Module : usb
|
||||
* File : usb_dev_wifi.h
|
||||
* Author :
|
||||
* Function : USB WIFIÇý¶¯µÄһЩ¶¨Òå
|
||||
*****************************************************************************/
|
||||
#ifndef USB_DEV_AUDIO_H
|
||||
#define USB_DEV_AUDIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const struct usb_device_cfg usb_dev_audio_cfg;
|
||||
|
||||
extern int32 usb_device_audio_auto_tx_null_pkt_disable(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_audio_auto_tx_null_pkt_enable(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_audio_write(struct usb_device *p_usb_d, int8 *buff, uint32 len);
|
||||
extern int32 usb_device_audio_read(struct usb_device *p_usb_d, int8 *buff, uint32 len);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,115 @@
|
||||
/*****************************************************************************
|
||||
* Module : usb
|
||||
* File : usb_dev_cdc_ncm.h
|
||||
* Author :
|
||||
* Function : USB CDC NCM驱动的一些定义
|
||||
*****************************************************************************/
|
||||
#ifndef USB_DEV_CDC_NCM_H
|
||||
#define USB_DEV_CDC_NCM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* CDC NCM transfer headers, CDC NCM subclass 3.2
|
||||
*/
|
||||
|
||||
#define USB_CDC_NCM_NTH16_SIGN 0x484D434E /* NCMH */
|
||||
#define USB_CDC_NCM_NTH32_SIGN 0x686D636E /* ncmh */
|
||||
|
||||
struct usb_cdc_ncm_nth16 {
|
||||
uint32 sign;
|
||||
uint16 hdr_len;
|
||||
uint16 seq;
|
||||
uint16 total_len;
|
||||
uint16 ndp_index;
|
||||
} __packed;
|
||||
|
||||
struct usb_cdc_ncm_nth32 {
|
||||
uint32 sign;
|
||||
uint16 hdr_len;
|
||||
uint16 seq;
|
||||
uint32 total_len;
|
||||
uint32 ndp_index;
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* CDC NCM datagram pointers, CDC NCM subclass 3.3
|
||||
*/
|
||||
|
||||
#define USB_CDC_NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */
|
||||
#define USB_CDC_NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */
|
||||
#define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */
|
||||
#define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */
|
||||
|
||||
/* 16-bit NCM Datagram Pointer Entry */
|
||||
struct usb_cdc_ncm_dpe16 {
|
||||
uint16 datagram_index;
|
||||
uint16 datagram_len;
|
||||
} __packed;
|
||||
|
||||
/* 16-bit NCM Datagram Pointer Table */
|
||||
struct usb_cdc_ncm_ndp16 {
|
||||
uint32 sign;
|
||||
uint16 hdr_len;
|
||||
uint16 next_ndp_index;
|
||||
struct usb_cdc_ncm_dpe16 dpe16[0];
|
||||
} __packed;
|
||||
|
||||
/* 32-bit NCM Datagram Pointer Entry */
|
||||
struct usb_cdc_ncm_dpe32 {
|
||||
uint32 datagram_index;
|
||||
uint32 datagram_len;
|
||||
} __packed;
|
||||
|
||||
/* 32-bit NCM Datagram Pointer Table */
|
||||
struct usb_cdc_ncm_ndp32 {
|
||||
uint32 sign;
|
||||
uint16 hdr_len;
|
||||
uint16 resv_0;
|
||||
uint32 next_ndp_index;
|
||||
uint32 resv_1;
|
||||
struct usb_cdc_ncm_dpe32 dpe32[0];
|
||||
} __packed;
|
||||
|
||||
/* CDC NCM subclass 3.2.1 and 3.2.2 */
|
||||
#define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C
|
||||
#define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010
|
||||
|
||||
/* CDC NCM subclass 3.3.3 Datagram Formatting */
|
||||
#define USB_CDC_NCM_DATAGRAM_FORMAT_CRC 0x30
|
||||
#define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC 0X31
|
||||
|
||||
struct usb_cdc_ncm_ntb_params {
|
||||
uint16 Length;
|
||||
uint16 NtbFormatsSupported;
|
||||
uint32 NtbInMaxSize;
|
||||
uint16 NdpInDivisor;
|
||||
uint16 NdpInPayloadRemainder;
|
||||
uint16 NdpInAlignment;
|
||||
uint16 Reserved;
|
||||
uint32 NtbOutMaxSize;
|
||||
uint16 NdpOutDivisor;
|
||||
uint16 NdpOutPayloadRemainder;
|
||||
uint16 NdpOutAlignment;
|
||||
uint16 NtbOutMaxDatagrams;
|
||||
} __packed;
|
||||
|
||||
extern int32 usb_device_cdc_ncm_open(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_cdc_ncm_close(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_cdc_ncm_auto_tx_null_pkt_disable(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_cdc_ncm_auto_tx_null_pkt_enable(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_cdc_ncm_write(struct usb_device *p_usb_d, uint8 *buff, uint32 len);
|
||||
extern int32 usb_device_cdc_ncm_write_scatter(struct usb_device *p_usb_d, scatter_data *data, int count);
|
||||
extern int32 usb_device_cdc_ncm_read(struct usb_device *p_usb_d, uint8 *buff, uint32 len);
|
||||
extern int32 usb_device_cdc_ncm_notify_network_connection(struct usb_device *p_usb_d, uint8 link_up);
|
||||
extern int32 usb_device_cdc_ncm_notify_connection_speed_change(struct usb_device *p_usb_d, uint32 down_speed, uint32 up_speed);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,242 @@
|
||||
/*****************************************************************************
|
||||
* Module : usb
|
||||
* File : usb_dev_mass.h
|
||||
* Author :
|
||||
* Function : USB mass������һЩ����
|
||||
*****************************************************************************/
|
||||
#ifndef USB_DEV_mass_H
|
||||
#define USB_DEV_mass_H
|
||||
|
||||
#include "usbd_mass_speed_optimize.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define USB_DISK_BUF_COUNT 1
|
||||
#define USB_DISK_BUF_SIZE 512
|
||||
|
||||
|
||||
|
||||
|
||||
#define AUTO_EXPOSURE_MODE 2
|
||||
#define AUTO_EXPOSURE_PRIORITY 3
|
||||
#define EXPOSURE_TIME_ABS 4
|
||||
#define ZOOM_ABS 11
|
||||
#define PAN_ABS 13
|
||||
|
||||
|
||||
#define BACKLIGHT_CONTROL 1
|
||||
#define BRIGHTNESS_CONTROL 2
|
||||
#define CONTRAST_CONTROL 3
|
||||
#define GAIN_CONTROL 4
|
||||
#define POWER_LINE_FREQUENCY_CONTROL 5
|
||||
#define HUE_CONTROL 6
|
||||
#define SATURATION_CONTROL 7
|
||||
#define SHARPNESS_CONTROL 8
|
||||
#define GAMMA_CONTROL 9
|
||||
#define WHITE_BALANCE_CONTROL 10
|
||||
|
||||
#define EXTENSION_C10 10
|
||||
#define EXTENSION_C11 11
|
||||
|
||||
|
||||
#define EXTENSION_UINT3_C1 1
|
||||
#define EXTENSION_UINT3_C2 2
|
||||
#define EXTENSION_UINT3_C3 3
|
||||
#define EXTENSION_UINT3_C4 4
|
||||
|
||||
|
||||
#define EXTENSION_UINT4_C1 1
|
||||
#define EXTENSION_UINT4_C2 2
|
||||
#define EXTENSION_UINT4_C3 3
|
||||
#define EXTENSION_UINT4_C4 4
|
||||
#define EXTENSION_UINT4_C5 5
|
||||
#define EXTENSION_UINT4_C6 6
|
||||
#define EXTENSION_UINT4_C7 7
|
||||
#define EXTENSION_UINT4_C8 8
|
||||
#define EXTENSION_UINT4_C9 9
|
||||
#define EXTENSION_UINT4_C10 10
|
||||
#define EXTENSION_UINT4_C11 11
|
||||
#define EXTENSION_UINT4_C12 12
|
||||
#define EXTENSION_UINT4_C13 13
|
||||
#define EXTENSION_UINT4_C14 14
|
||||
#define EXTENSION_UINT4_C15 15
|
||||
#define EXTENSION_UINT4_C16 16
|
||||
#define EXTENSION_UINT4_C17 17
|
||||
#define EXTENSION_UINT4_C21 21
|
||||
#define EXTENSION_UINT4_C22 22
|
||||
#define EXTENSION_UINT4_C23 23
|
||||
|
||||
|
||||
#define VS_PROBE_CONTROL 1
|
||||
#define VS_COMMIT_CONTROL 2
|
||||
|
||||
//USB_DEV Audio音量调节
|
||||
#define USB_DEV_AUDIO_STOP 0x80
|
||||
#define USB_DEV_AUDIO_PREFILE 0x20
|
||||
#define USB_DEV_AUDIO_NEXTFILE 0x10
|
||||
#define USB_DEV_AUDIO_PLAYPAUSE 0x08
|
||||
#define USB_DEV_AUDIO_MUTE 0x04
|
||||
#define USB_DEV_AUDIO_VOLDOWN 0x02
|
||||
#define USB_DEV_AUDIO_VOLUP 0x01
|
||||
#define USB_DEV_AUDIO_NONE 0x00
|
||||
// Video Class-Specific Request Codes
|
||||
// (USB_Video_Class_1.1.pdf, A.8 Video Class-Specific Request Codes)
|
||||
#define RC_UNDEFINED 0x00
|
||||
#define SET_CUR 0x01
|
||||
#define GET_CUR 0x81
|
||||
#define GET_MIN 0x82
|
||||
#define GET_MAX 0x83
|
||||
#define GET_RES 0x84
|
||||
#define GET_LEN 0x85
|
||||
#define GET_INFO 0x86
|
||||
#define GET_DEF 0x87
|
||||
|
||||
|
||||
#define CAM_IT_ID 0x01 //Input Terminal
|
||||
#define CAM_PU_ID 0x02 //Processing Unit
|
||||
#define CAM_OT_ID 0x03 //Output Terminal
|
||||
#define CAM_EU_ID 0x04 //extension unit
|
||||
#define CAM_EU6_ID 0x06 //extension unit
|
||||
|
||||
#define CAM_VS_ID 0x01 //VS ID
|
||||
|
||||
|
||||
// (USB_Video_Class_1.1.pdf, A.1 Video Interface Class Code)
|
||||
#define CC_VIDEO 0x0E
|
||||
// Video Interface Subclass Codes
|
||||
// (USB_Video_Class_1.1.pdf, A.2 Video Interface Subclass Code)
|
||||
#define SC_UNDEFINED 0x00
|
||||
#define SC_VIDEOCONTROL 0x01
|
||||
#define SC_VIDEOSTREAMING 0x02
|
||||
#define SC_VIDEO_INTERFACE_COLLECTION 0x03
|
||||
|
||||
|
||||
|
||||
#define UVC_VC_INTERFACE_HEADER_DESC_SIZE(n) (char)(12+n)
|
||||
#define UVC_CAMERA_TERMINAL_DESC_SIZE(n) (char)(15+n)
|
||||
#define UVC_OUTPUT_TERMINAL_DESC_SIZE(n) (char)(9+n)
|
||||
#define USB_ENDPOINT_DESC_SIZE (char)7
|
||||
#define VS_FORMAT_UNCOMPRESSED_DESC_SIZE (char)(27)
|
||||
#define VC_EXTENSION_UNIT_LEN (char)(27)
|
||||
|
||||
#define UVC_VS_INTERFACE_INPUT_HEADER_DESC_SIZE(a,b) (char) (13+a*b)
|
||||
#define UVC_VC_PROCESSING_UNIT_SIZE 0x0b
|
||||
#define VS_COLOR_MATCHING_DESC_SIZE (char)(6)
|
||||
|
||||
|
||||
#define CS_INTERFACE 0x24
|
||||
#define VC_HEADER 0x01
|
||||
#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
|
||||
#define VC_INPUT_TERMINAL 0x02
|
||||
#define VC_OUTPUT_TERMINAL 0x03
|
||||
#define VC_PROCESSING_UNIT 0x05
|
||||
#define VC_EXTENSION_UNIT 0x06
|
||||
|
||||
|
||||
#define USB_ENDPOINT_IN(addr) ((addr) | 0x80)
|
||||
#define ITT_CAMERA 0x0201
|
||||
#define TT_STREAMING 0x0101
|
||||
|
||||
/* bmAttributes in Endpoint Descriptor */
|
||||
#define USB_ENDPOINT_TYPE_MASK 0x03
|
||||
#define USB_ENDPOINT_TYPE_CONTROL 0x00
|
||||
#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
|
||||
#define USB_ENDPOINT_TYPE_BULK 0x02
|
||||
#define USB_ENDPOINT_TYPE_INTERRUPT 0x03
|
||||
#define USB_ENDPOINT_SYNC_MASK 0x0C
|
||||
#define USB_ENDPOINT_SYNC_NO_SYNCHRONIZATION 0x00
|
||||
#define USB_ENDPOINT_SYNC_ASYNCHRONOUS 0x04
|
||||
//#define USB_ENDPOINT_SYNC_ADAPTIVE 0x08
|
||||
#define USB_ENDPOINT_SYNC_SYNCHRONOUS 0x0C
|
||||
#define USB_ENDPOINT_USAGE_MASK 0x30
|
||||
#define USB_ENDPOINT_USAGE_DATA 0x00
|
||||
#define USB_ENDPOINT_USAGE_FEEDBACK 0x10
|
||||
#define USB_ENDPOINT_USAGE_IMPLICIT_FEEDBACK 0x20
|
||||
#define USB_ENDPOINT_USAGE_RESERVED 0x30
|
||||
|
||||
//#define UVC_WIDTH (unsigned int)640
|
||||
//#define UVC_HEIGHT (unsigned int)480
|
||||
//#define VIDEO_PACKET_SIZE (unsigned int)(UVC_WIDTH*3/2+2)//FOR YUY2 1216//
|
||||
#define VIDEO_PACKET_SIZE 1024
|
||||
|
||||
|
||||
#define UVC_720P_W (unsigned int)1280
|
||||
#define UVC_720P_H (unsigned int)720
|
||||
#define VS_FRAME_UNCOMPRESSED_DESC_SIZE (char)(30)
|
||||
|
||||
|
||||
#define UVC_960H_W (unsigned int)960
|
||||
#define UVC_960H_H (unsigned int)720
|
||||
|
||||
#define UVC_VGA_W (unsigned int)640
|
||||
#define UVC_VGA_H (unsigned int)480
|
||||
|
||||
#define UVC_360P_W (unsigned int)640
|
||||
#define UVC_360P_H (unsigned int)360
|
||||
|
||||
|
||||
|
||||
#define MJPEG_FRAME_RATE (char)(30)
|
||||
#define YUV_FRAME_RATE (char)(10)
|
||||
|
||||
#define WBVAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF)
|
||||
#define DBVAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF),(((x) >> 16) & 0xFF),(((x) >> 24) & 0xFF)
|
||||
|
||||
#define UVC_VERSION 0x0100 // UVC 1.0
|
||||
#define VC_TERMINAL_SIZ (unsigned int)(UVC_VC_INTERFACE_HEADER_DESC_SIZE(1) +\
|
||||
UVC_CAMERA_TERMINAL_DESC_SIZE(3) +\
|
||||
UVC_VC_PROCESSING_UNIT_SIZE +\
|
||||
UVC_OUTPUT_TERMINAL_DESC_SIZE(0)+\
|
||||
VC_EXTENSION_UNIT_LEN)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
uint32_t bufSize; //不变,USB_DISK_BUF_SIZE,这个暂时规定为扇区大小吧
|
||||
uint32_t count; //写入扇区的数量
|
||||
uint32_t lba; //扇区偏移
|
||||
uint16_t isFree; //是否空闲
|
||||
uint16_t type; //1:是写 2:是读
|
||||
//uint8_t usbbuf[USB_DISK_BUF_SIZE];//改呀
|
||||
uint8_t *usbbuf;//改呀
|
||||
uint8_t *usb_pingpang_buf;
|
||||
struct os_semaphore sem;
|
||||
#if PINGPANG_BUF_EN
|
||||
struct usbd_mass_speed_info udisk_speed_info;
|
||||
#endif
|
||||
}usb_disk_buf;
|
||||
|
||||
int32 usb_device_mass_uvc_open(struct usb_device *p_usb_d);
|
||||
int32 usb_device_mass_uvc_close(struct usb_device *p_usb_d);
|
||||
int32 usb_device_mass_auto_tx_null_pkt_disable(struct usb_device *p_usb_d);
|
||||
int32 usb_device_mass_auto_tx_null_pkt_enable(struct usb_device *p_usb_d);
|
||||
int32 usb_device_mass_write(struct usb_device *p_usb_d, int8 *buff, uint32 len);
|
||||
int32 usb_device_mass_read(struct usb_device *p_usb_d, int8 *buff, uint32 len);
|
||||
uint32 usb_device_mass_uvc_ep0_setup_irq(struct usb_device *p_usb_d, uint32 len);
|
||||
void mass_ep_init(struct usb_device *p_usb_d);
|
||||
int8_t get_cbw(void);
|
||||
int32_t scsi_cmd_analysis(void);
|
||||
void usb_bulk_init(void);
|
||||
void clr_usb_disk();
|
||||
void usb_disk_write_thread(void *d);
|
||||
void init_usb_disk_buf();
|
||||
int32_t scsi_cmd_analysis_flash(void);
|
||||
void deinit_usb_disk_buf();
|
||||
int32_t usb_uvc_tx(uint8_t epx, uint32_t adr, uint32_t len);
|
||||
//int8_t init_usb_disk_buf(usb_disk_buf **disk);
|
||||
//void clr_usb_disk(usb_disk_buf **disk);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,388 @@
|
||||
/*****************************************************************************
|
||||
* Module : usb
|
||||
* File : usb_dev_rndis.h
|
||||
* Author :
|
||||
* Function : USB RNDIS驱动的一些定义
|
||||
*****************************************************************************/
|
||||
#ifndef USB_DEV_RNDIS_H
|
||||
#define USB_DEV_RNDIS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* CDC_RNDIS definitions */
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
/** Implemented CDC_RNDIS Version Major */
|
||||
#define CDC_RNDIS_VERSION_MAJOR 0x01U
|
||||
|
||||
/* Implemented CDC_RNDIS Version Minor */
|
||||
#define CDC_RNDIS_VERSION_MINOR 0x00U
|
||||
|
||||
/* Maximum size in bytes of a CDC_RNDIS control message
|
||||
which can be sent or received */
|
||||
#define CDC_RNDIS_MESSAGE_BUFFER_SIZE 128U
|
||||
|
||||
/* Maximum size in bytes of an Ethernet frame
|
||||
according to the Ethernet standard */
|
||||
#define CDC_RNDIS_ETH_FRAME_SIZE_MAX 1536U
|
||||
|
||||
/* Maximum size allocated for buffer
|
||||
inside Query messages structures */
|
||||
#define CDC_RNDIS_MAX_INFO_BUFF_SZ 200U
|
||||
#define CDC_RNDIS_MAX_DATA_SZE 2000U
|
||||
|
||||
/* Notification request value for a CDC_RNDIS
|
||||
Response Available notification */
|
||||
#define CDC_RNDIS_NOTIFICATION_RESP_AVAILABLE 0x00000001UL
|
||||
|
||||
|
||||
#define CDC_RNDIS_PACKET_MSG_ID 0x00000001UL
|
||||
#define CDC_RNDIS_INITIALIZE_MSG_ID 0x00000002UL
|
||||
#define CDC_RNDIS_HALT_MSG_ID 0x00000003UL
|
||||
#define CDC_RNDIS_QUERY_MSG_ID 0x00000004UL
|
||||
#define CDC_RNDIS_SET_MSG_ID 0x00000005UL
|
||||
#define CDC_RNDIS_RESET_MSG_ID 0x00000006UL
|
||||
#define CDC_RNDIS_INDICATE_STATUS_MSG_ID 0x00000007UL
|
||||
#define CDC_RNDIS_KEEPALIVE_MSG_ID 0x00000008UL
|
||||
|
||||
#define CDC_RNDIS_INITIALIZE_CMPLT_ID 0x80000002UL
|
||||
#define CDC_RNDIS_QUERY_CMPLT_ID 0x80000004UL
|
||||
#define CDC_RNDIS_SET_CMPLT_ID 0x80000005UL
|
||||
#define CDC_RNDIS_RESET_CMPLT_ID 0x80000006UL
|
||||
#define CDC_RNDIS_KEEPALIVE_CMPLT_ID 0x80000008UL
|
||||
|
||||
#define CDC_RNDIS_STATUS_SUCCESS 0x00000000UL
|
||||
#define CDC_RNDIS_STATUS_FAILURE 0xC0000001UL
|
||||
#define CDC_RNDIS_STATUS_INVALID_DATA 0xC0010015UL
|
||||
#define CDC_RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBUL
|
||||
#define CDC_RNDIS_STATUS_MEDIA_CONNECT 0x4001000BUL
|
||||
#define CDC_RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CUL
|
||||
/** Media state */
|
||||
#define CDC_RNDIS_MEDIA_STATE_CONNECTED 0x00000000UL
|
||||
#define CDC_RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL
|
||||
|
||||
/** Media types */
|
||||
#define CDC_RNDIS_MEDIUM_802_3 0x00000000UL
|
||||
|
||||
#define CDC_RNDIS_DF_CONNECTIONLESS 0x00000001UL
|
||||
#define CDC_RNDIS_DF_CONNECTION_ORIENTED 0x00000002UL
|
||||
|
||||
/** Hardware status of the underlying NIC */
|
||||
#define CDC_RNDIS_HW_STS_READY 0x00000000UL
|
||||
#define CDC_RNDIS_HW_STS_INITIALIZING 0x00000001UL
|
||||
#define CDC_RNDIS_HW_STS_RESET 0x00000002UL
|
||||
#define CDC_RNDIS_HW_STS_CLOSING 0x00000003UL
|
||||
#define CDC_RNDIS_HW_STS_NOT_READY 0x00000004UL
|
||||
|
||||
/** Packet filter */
|
||||
#define CDC_RNDIS_PACKET_DIRECTED 0x00000001UL
|
||||
#define CDC_RNDIS_PACKET_MULTICAST 0x00000002UL
|
||||
#define CDC_RNDIS_PACKET_ALL_MULTICAST 0x00000004UL
|
||||
#define CDC_RNDIS_PACKET_BROADCAST 0x00000008UL
|
||||
#define CDC_RNDIS_PACKET_SOURCE_ROUTING 0x00000010UL
|
||||
#define CDC_RNDIS_PACKET_PROMISCUOUS 0x00000020UL
|
||||
#define CDC_RNDIS_PACKET_SMT 0x00000040UL
|
||||
#define CDC_RNDIS_PACKET_ALL_LOCAL 0x00000080UL
|
||||
#define CDC_RNDIS_PACKET_GROUP 0x00001000UL
|
||||
#define CDC_RNDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL
|
||||
#define CDC_RNDIS_PACKET_FUNCTIONAL 0x00004000UL
|
||||
#define CDC_RNDIS_PACKET_MAC_FRAME 0x00008000UL
|
||||
|
||||
#define OID_GEN_SUPPORTED_LIST 0x00010101UL
|
||||
#define OID_GEN_HARDWARE_STATUS 0x00010102UL
|
||||
#define OID_GEN_MEDIA_SUPPORTED 0x00010103UL
|
||||
#define OID_GEN_MEDIA_IN_USE 0x00010104UL
|
||||
#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106UL
|
||||
#define OID_GEN_LINK_SPEED 0x00010107UL
|
||||
#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010AUL
|
||||
#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010BUL
|
||||
#define OID_GEN_VENDOR_ID 0x0001010CUL
|
||||
#define OID_GEN_VENDOR_DESCRIPTION 0x0001010DUL
|
||||
#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010EUL
|
||||
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL
|
||||
#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114UL
|
||||
#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115UL
|
||||
#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116UL
|
||||
#define OID_GEN_PHYSICAL_MEDIUM 0x00010202UL
|
||||
#define OID_GEN_XMIT_OK 0x00020101UL
|
||||
#define OID_GEN_RCV_OK 0x00020102UL
|
||||
#define OID_GEN_XMIT_ERROR 0x00020103UL
|
||||
#define OID_GEN_RCV_ERROR 0x00020104UL
|
||||
#define OID_GEN_RCV_NO_BUFFER 0x00020105UL
|
||||
#define OID_GEN_CDC_RNDIS_CONFIG_PARAMETER 0x0001021BUL
|
||||
#define OID_802_3_PERMANENT_ADDRESS 0x01010101UL
|
||||
#define OID_802_3_CURRENT_ADDRESS 0x01010102UL
|
||||
#define OID_802_3_MULTICAST_LIST 0x01010103UL
|
||||
#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104UL
|
||||
#define OID_802_3_MAC_OPTIONS 0x01010105UL // deprecated ndis6
|
||||
#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101UL
|
||||
#define OID_802_3_XMIT_ONE_COLLISION 0x01020102UL
|
||||
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
|
||||
|
||||
|
||||
#define CDC_RNDIS_SEND_ENCAPSULATED_COMMAND 0x00U
|
||||
#define CDC_RNDIS_GET_ENCAPSULATED_RESPONSE 0x01U
|
||||
|
||||
#define CDC_RNDIS_NET_DISCONNECTED 0x00U
|
||||
#define CDC_RNDIS_NET_CONNECTED 0x01U
|
||||
|
||||
#define CDC_RNDIS_BMREQUEST_TYPE_RNDIS 0xA1U
|
||||
#define CDC_RNDIS_PCKTMSG_DATAOFFSET_OFFSET 8U
|
||||
|
||||
/* CDC_RNDIS State values */
|
||||
typedef enum
|
||||
{
|
||||
CDC_RNDIS_STATE_UNINITIALIZED = 0,
|
||||
CDC_RNDIS_STATE_BUS_INITIALIZED = 1,
|
||||
CDC_RNDIS_STATE_INITIALIZED = 2,
|
||||
CDC_RNDIS_STATE_DATA_INITIALIZED = 3
|
||||
} USBD_CDC_RNDIS_StateTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bmRequest;
|
||||
uint8_t bRequest;
|
||||
uint16_t wValue;
|
||||
uint16_t wIndex;
|
||||
uint16_t wLength;
|
||||
uint8_t data[8];
|
||||
} USBD_CDC_RNDIS_NotifTypeDef;
|
||||
|
||||
/* Messages Sent by the Host ---------------------*/
|
||||
|
||||
/* Type define for a CDC_RNDIS Initialize command message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t ReqId;
|
||||
uint32_t MajorVersion;
|
||||
uint32_t MinorVersion;
|
||||
uint32_t MaxTransferSize;
|
||||
} USBD_CDC_RNDIS_InitMsgTypeDef;
|
||||
|
||||
/* Type define for a CDC_RNDIS Halt Message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t ReqId;
|
||||
} USBD_CDC_RNDIS_HaltMsgTypeDef;
|
||||
|
||||
/* Type define for a CDC_RNDIS Query command message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t RequestId;
|
||||
uint32_t Oid;
|
||||
uint32_t InfoBufLength;
|
||||
uint32_t InfoBufOffset;
|
||||
uint32_t DeviceVcHandle;
|
||||
uint32_t InfoBuf[0];
|
||||
} USBD_CDC_RNDIS_QueryMsgTypeDef;
|
||||
|
||||
/* Type define for a CDC_RNDIS Set command message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t ReqId;
|
||||
uint32_t Oid;
|
||||
uint32_t InfoBufLength;
|
||||
uint32_t InfoBufOffset;
|
||||
uint32_t DeviceVcHandle;
|
||||
uint32_t InfoBuf[0];
|
||||
} USBD_CDC_RNDIS_SetMsgTypeDef;
|
||||
|
||||
/* Type define for a CDC_RNDIS Reset message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t Reserved;
|
||||
} USBD_CDC_RNDIS_ResetMsgTypeDef;
|
||||
|
||||
/* Type define for a CDC_RNDIS Keepalive command message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t ReqId;
|
||||
} USBD_CDC_RNDIS_KpAliveMsgTypeDef;
|
||||
|
||||
|
||||
/* Messages Sent by the Device ---------------------*/
|
||||
|
||||
/* Type define for a CDC_RNDIS Initialize complete response message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t ReqId;
|
||||
uint32_t Status;
|
||||
uint32_t MajorVersion;
|
||||
uint32_t MinorVersion;
|
||||
uint32_t DeviceFlags;
|
||||
uint32_t Medium;
|
||||
uint32_t MaxPacketsPerTransfer;
|
||||
uint32_t MaxTransferSize;
|
||||
uint32_t PacketAlignmentFactor;
|
||||
uint32_t AFListOffset;
|
||||
uint32_t AFListSize;
|
||||
} USBD_CDC_RNDIS_InitCpltMsgTypeDef;
|
||||
|
||||
/* Type define for a CDC_RNDIS Query complete response message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t ReqId;
|
||||
uint32_t Status;
|
||||
uint32_t InfoBufLength;
|
||||
uint32_t InfoBufOffset;
|
||||
uint32_t InfoBuf[0];
|
||||
} USBD_CDC_RNDIS_QueryCpltMsgTypeDef;
|
||||
|
||||
/* Type define for a CDC_RNDIS Set complete response message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t ReqId;
|
||||
uint32_t Status;
|
||||
} USBD_CDC_RNDIS_SetCpltMsgTypeDef;
|
||||
|
||||
/* Type define for a CDC_RNDIS Reset complete message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t Status;
|
||||
uint32_t AddrReset;
|
||||
} USBD_CDC_RNDIS_ResetCpltMsgTypeDef;
|
||||
|
||||
/* Type define for CDC_RNDIS struct to indicate a change
|
||||
in the status of the device */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t Status;
|
||||
uint32_t StsBufLength;
|
||||
uint32_t StsBufOffset;
|
||||
} USBD_CDC_RNDIS_StsChangeMsgTypeDef;
|
||||
|
||||
/* Type define for a CDC_RNDIS Keepalive complete message */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t ReqId;
|
||||
uint32_t Status;
|
||||
} USBD_CDC_RNDIS_KpAliveCpltMsgTypeDef;
|
||||
|
||||
|
||||
/* Messages Sent by both Host and Device ---------------------*/
|
||||
|
||||
/* Type define for a CDC_RNDIS packet message, used to encapsulate
|
||||
Ethernet packets sent to and from the adapter */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t DataOffset;
|
||||
uint32_t DataLength;
|
||||
uint32_t OOBDataOffset;
|
||||
uint32_t OOBDataLength;
|
||||
uint32_t NumOOBDataElements;
|
||||
uint32_t PerPacketInfoOffset;
|
||||
uint32_t PerPacketInfoLength;
|
||||
uint32_t VcHandle;
|
||||
uint32_t Reserved;
|
||||
} USBD_CDC_RNDIS_PacketMsgTypeDef;
|
||||
|
||||
/* Miscellaneous types used for parsing ---------------------*/
|
||||
|
||||
/* The common part for all CDC_RNDIS messages Complete response */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
uint32_t ReqId;
|
||||
uint32_t Status;
|
||||
} USBD_CDC_RNDIS_CommonCpltMsgTypeDef;
|
||||
|
||||
/* Type define for a single parameter structure */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t ParamNameOffset;
|
||||
uint32_t ParamNameLength;
|
||||
uint32_t ParamType;
|
||||
uint32_t ParamValueOffset;
|
||||
uint32_t ParamValueLength;
|
||||
} USBD_CDC_RNDIS_ParamStructTypeDef;
|
||||
|
||||
|
||||
/* Type define of a single CDC_RNDIS OOB data record */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Size;
|
||||
uint32_t Type;
|
||||
uint32_t ClassInfoType;
|
||||
uint32_t OOBData[sizeof(uint32_t)];
|
||||
} USBD_CDC_RNDIS_OOBPacketTypeDef;
|
||||
|
||||
/* Type define for notification structure */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t notification;
|
||||
uint32_t reserved;
|
||||
} USBD_CDC_RNDIS_NotifStructTypeDef;
|
||||
|
||||
/* This structure will be used to store the type, the size and ID for any
|
||||
received message from the control endpoint */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t MsgType;
|
||||
uint32_t MsgLength;
|
||||
} USBD_CDC_RNDIS_CtrlMsgTypeDef;
|
||||
|
||||
typedef union
|
||||
{
|
||||
USBD_CDC_RNDIS_PacketMsgTypeDef Packet;
|
||||
USBD_CDC_RNDIS_InitMsgTypeDef Init;
|
||||
USBD_CDC_RNDIS_InitCpltMsgTypeDef InitCplt;
|
||||
USBD_CDC_RNDIS_HaltMsgTypeDef Halt;
|
||||
USBD_CDC_RNDIS_QueryMsgTypeDef Query;
|
||||
USBD_CDC_RNDIS_QueryCpltMsgTypeDef QueryCplt;
|
||||
USBD_CDC_RNDIS_SetMsgTypeDef Set;
|
||||
USBD_CDC_RNDIS_SetCpltMsgTypeDef SetCplt;
|
||||
USBD_CDC_RNDIS_ResetMsgTypeDef Reset;
|
||||
USBD_CDC_RNDIS_ResetCpltMsgTypeDef ResetCplt;
|
||||
USBD_CDC_RNDIS_StsChangeMsgTypeDef Indicate;
|
||||
USBD_CDC_RNDIS_KpAliveMsgTypeDef KpAlive;
|
||||
USBD_CDC_RNDIS_KpAliveCpltMsgTypeDef KpAliveCplt;
|
||||
USBD_CDC_RNDIS_CtrlMsgTypeDef Ctrl;
|
||||
} USBD_CDC_RNDIS_MsgTypeDef;
|
||||
|
||||
|
||||
extern int32 usb_device_rndis_open(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_rndis_close(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_rndis_auto_tx_null_pkt_disable(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_rndis_auto_tx_null_pkt_enable(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_rndis_write(struct usb_device *p_usb_d, uint8 *buff, uint32 len);
|
||||
extern int32 usb_device_rndis_write_scatter(struct usb_device *p_usb_d, scatter_data *data, int count);
|
||||
extern int32 usb_device_rndis_read(struct usb_device *p_usb_d, uint8 *buff, uint32 len);
|
||||
extern int32 usb_device_rndis_notify_network_connection(struct usb_device *p_usb_d, uint8 link_up);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
/*****************************************************************************
|
||||
* Module : usb
|
||||
* File : usb_dev_wifi.h
|
||||
* Author :
|
||||
* Function : USB WIFIÇý¶¯µÄһЩ¶¨Òå
|
||||
*****************************************************************************/
|
||||
#ifndef USB_DEV_WIFI_H
|
||||
#define USB_DEV_WIFI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int32 usb_device_wifi_open(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_wifi_close(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_wifi_auto_tx_null_pkt_disable(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_wifi_auto_tx_null_pkt_enable(struct usb_device *p_usb_d);
|
||||
extern int32 usb_device_wifi_write(struct usb_device *p_usb_d, uint8 *buff, uint32 len);
|
||||
extern int32 usb_device_wifi_read(struct usb_device *p_usb_d, uint8 *buff, uint32 len);
|
||||
extern int32 usb_device_wifi_write_scatter(struct usb_device *p_usb_d, scatter_data *data, int count);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user