您好,欢迎来电子发烧友网! ,新用户?[免费注册]

您的位置:电子发烧友网 > 源码下载 > 驱动程序 >

usb驱动程序源代码免费下载

大小:5456 人气: 2010-03-05 需要积分:0
$北方$的空间

用户级别:注册会员

贡献文章:

贡献资料:

usb驱动程序源代码免费下载

#ifndef _USBD12_H_
#define _USBD12_H_

#define Usb_Data_Address 0x00000000
#define Usb_Command_Address 0x00000001


//
// USB.H - Defines for the USB specificaTIon and the Philips PDIUSBD12 USB
//         controller.
//**********************************

//****************************************
//
// The following defines are specific the USB standard version 1.1.
//
//**********************************

//
// DefiniTIons of the bit fields in the bmRequestType field of a setup packet.
//
#define USB_RT_DEVICE_TO_HOST                   0x80
#define USB_RT_TYPE_MASK                        0x60
#define USB_RT_TYPE_STANDARD                    0x00
#define USB_RT_TYPE_CLASS                       0x20
#define USB_RT_TYPE_VENDOR                      0x40
#define USB_RT_RECIPIENT_MASK                   0x1F
#define USB_RT_RECIPIENT_DEVICE                 0x00
#define USB_RT_RECIPIENT_INTERFACE              0x01
#define USB_RT_RECIPIENT_ENDPOINT               0x02

//
// DefiniTIons of the bit fields in the wIndex field of setup packets where the
// wIndex field is used to specify a endpoint (i.e. Clear_Feature, Get_Status,
// and Set_Feature).
//
#define USB_ENDPOINT_DIRECTION_MASK             0x0080
#define USB_ENDPOINT_ADDRESS_MASK               0x000F

//
// Definitions of the features that can be specified in the wValue field of a
// Clear_Feature or Set_Feature setup packet.
//
#define USB_FEATURE_ENDPOINT_STALL              0x0000
#define USB_FEATURE_REMOTE_WAKEUP               0x0001
#define USB_FEATURE_POWER_D0                    0x0002
#define USB_FEATURE_POWER_D1                    0x0003
#define USB_FEATURE_POWER_D2                    0x0004
#define USB_FEATURE_POWER_D3                    0x0005

//
// Definitions of the wValue field for a Get_Descriptor setup packet.
//
#define USB_DESCRIPTOR_TYPE_MASK                0xFF00
#define USB_DESCRIPTOR_DEVICE                   0x0100
#define USB_DESCRIPTOR_CONFIGURATION            0x0200
#define USB_DESCRIPTOR_STRING                   0x0300
#define USB_DESCRIPTOR_INTERFACE                0x0400
#define USB_DESCRIPTOR_ENDPOINT                 0x0500
#define USB_DESCRIPTOR_INDEX_MASK               0x00FF

//
// Definitions of the device status returned for a Get_Status setup packet.
//
#define USB_DEVICE_STATUS_SELF_POWERED          0x01
#define USB_DEVICE_STATUS_REMOTE_WAKEUP         0x02

//
// Definitions of the endpoint status returned for a Get_Status setup packet.
//
#define USB_ENDPOINT_STATUS_STALLED             0x01

//*****************************************
//
// The following defines are specific the the Philips PDIUSBD12 USB
// controller.
//
//*********************************************

//
// The offsets to the individual registers in the PDIUSBD12 USB controller.
//
#define HwUSBData                               0x00000000
#define HwUSBCommand                            0x00000001

//
// Definitions of the supported endpoints.
//
#define USB_ENDPOINT_CONTROL_OUT                0x00
#define USB_ENDPOINT_CONTROL_IN                 0x01
#define USB_ENDPOINT_COMMAND_OUT          0x02
#define USB_ENDPOINT_ACK_IN                     0x03
#define USB_ENDPOINT_BULK_OUT                   0x04
#define USB_ENDPOINT_BULK_IN                    0x05

//
// Definitions of the commands that can be sent to the PDIUSBD12.
//
#define USB_COMMAND_SELECT_ENDPOINT             0x00
#define USB_COMMAND_READ_LAST_XACTION_STATUS    0x40
#define USB_COMMAND_SET_ENDPOINT_STATUS         0x40
#define USB_COMMAND_SET_ADDRESS_ENABLE          0xD0
#define USB_COMMAND_SET_ENDPOINT_ENABLE         0xD8
#define USB_COMMAND_READ_BUFFER                 0xF0
#define USB_COMMAND_WRITE_BUFFER                0xF0
#define USB_COMMAND_ACKNOWLEDGE_ENDPOINT        0xF1
#define USB_COMMAND_CLEAR_BUFFER                0xF2
#define USB_COMMAND_SET_MODE                    0xF3
#define USB_COMMAND_READ_INTERRUPT              0xF4
#define USB_COMMAND_VALIDATE_BUFFER             0xFA
#define USB_COMMAND_SET_DMA                     0xFB

#define USB_COMMAND_SEND_RESUME                 0xF6
//
// Definitions of the bit fields in the first byte of the configuration
// register.
//
#define USB_CONFIG1_NO_LAZY_CLOCK               0x02
#define USB_CONFIG1_CLOCK_RUNNING               0x04
#define USB_CONFIG1_INTERRUPT_MODE              0x08
#define USB_CONFIG1_SOFT_CONNECT                0x10
#define USB_CONFIG1_NONISO_MODE                 0x00
#define USB_CONFIG1_ISOOUT_MODE                 0x40
#define USB_CONFIG1_ISOIN_MODE                  0x80
#define USB_CONFIG1_ISOIO_MODE                  0xC0

//
// Definitions of the bit fields in the second byte of the configuration
// register.
//
#define USB_CONFIG2_CLOCK_12M                   0x03
#define USB_CONFIG2_CLOCK_4M                    0x0B
#define USB_CONFIG2_SET_TO_ONE                  0x40
#define USB_CONFIG2_SOF_ONLY                    0x80

//
// Definitions of the bit fields in the DMA configuration register.
//
#define USB_DMA_SINGLE                          0x00
#define USB_DMA_BURST_4                         0x01
#define USB_DMA_BURST_8                         0x02
#define USB_DMA_BURST_16                        0x03
#define USB_DMA_ENABLE                          0x04
#define USB_DMA_DIRECTION                       0x08
#define USB_DMA_AUTO_RELOAD                     0x10
#define USB_DMA_INTPINMODE                      0x20
#define USB_DMA_ENDP4_INT_ENABLE                0x40
#define USB_DMA_ENDP5_INT_ENABLE                0x80

//
// Definitions of the bit fields in the first byte of the interrupt register.
//
#define USB_INT1_CONTROL_OUT                    0x01
#define USB_INT1_CONTROL_IN                     0x02
#define USB_INT1_ENDPOINT1_OUT                  0x04
#define USB_INT1_ENDPOINT1_IN                   0x08
#define USB_INT1_ENDPOINT2_OUT                  0x10
#define USB_INT1_ENDPOINT2_IN                   0x20
#define USB_INT1_BUS_RESET                      0x40
#define USB_INT1_SUSPEND_CHANGE                 0x80

//
// Definitions of the bit fields in the second byte of the interrupt register.
//
#define USB_INT2_EOT                            0x01

//
// Definitions of the bit fields in the last transaction status register.
//
#define USB_XACTION_STATUS_DATA_RX_TX_SUCCESS   0x01
#define USB_XACTION_STATUS_SETUP_PACKET         0x20
#define USB_XACTION_STATUS_PREPACKET      0X80

//
// Definitions of the bit fields in the endpoint status register.
//
#define USB_ENDPOINT_STATUS_FULL_EMPTY          0x01
#define USB_ENDPOINT_STALL                      0x02

#define SIZE_USBCOMM_HISR                  4000
#define SIZE_USBCOMM_TASK                   40000

#define USB_EVENT_LOADLIST                  0x00000001
#define USB_EVENT_DELFILE                  0x00000002
#define USB_EVENT_RECEFILE                  0x00000004
#define USB_EVENT_FORMAT                  0x00000008
#define USB_EVENT   (USB_EVENT_LOADLIST|USB_EVENT_DELFILE|USB_

EVENT_RECEFILE|USB_EVENT_FORMAT)

struct ev44b0ii_usb_priv {
 volatile unsigned int          head, tail;
 volatile unsigned int          usage_count;
 volatile unsigned int          total;
 volatile unsigned int          dropped;
 unsigned char         *buf;
};

static  void USBWriteCommand(unsigned char commandvalue);
static  void USBWriteData(unsigned char datavalue);
static  void USBWriteEndpoint(unsigned long , const unsigned char **,unsigned long *);
static  void USBStallEndpoint(unsigned long , unsigned long );
static  void USBReserved(void);
static  void USBClearFeature(void);
static  void USBGetStatus(void);
static  unsigned long USBSendControl(const unsigned char *, unsigned long);
static  void USBSetFeature(void);
static  void USBSetAddress(void);
static  void USBGetDescriptor(void);
static  void USBGetConfiguration(void);
static  void USBSetConfiguration(void);
static  void USBSetInterface(void);
static  void USBGetInterface(void);

#endif //_USBD12_H_

非常好我支持^.^

(7) 100%

不好我反对

(0) 0%

      发表评论

      用户评论
      评价:好评中评差评

      发表评论,获取积分! 请遵守相关规定!

      

      页面底部区域 foot.htm