usb_host_drv.h
资源名称:8202s.rar [点击查看]
上传用户:poi891205
上传日期:2013-07-15
资源大小:9745k
文件大小:4k
源码类别:
DVD
开发平台:
C/C++
- #ifndef _USB_HOST_DRV_H_
- #define _USB_HOST_DRV_H_
- #include "types.h"
- #if defined(SUPPORT_USB)&&defined(USB_HOST_DRV)
- //-------------------------------------------------------------------------------------------------
- // Memory space define
- //-------------------------------------------------------------------------------------------------
- #define USB_SCSI_CMD_BUF_POINTER (SDRAM_BASE_UNCACHED + USB_YA*1024)
- #define USB_SCSI_CMD_BUF_SIZE 0x00000020
- #define USB_CSW_BUF_POINTER (USB_SCSI_CMD_BUF_POINTER + USB_SCSI_CMD_BUF_SIZE)
- #define USB_CSW_BUF_SIZE 0x00000010
- //-------------------------------------------------------------------------------------------------
- // Global variables declaration
- //-------------------------------------------------------------------------------------------------
- #define USB_DEVICE_MODE 0
- #define USB_HOST_MODE 1
- #define PID_SETUP 0x0d // Setup token: 1101b.
- #define PID_OUT 0x01 // Out token : 0001b.
- #define PID_IN 0x09 // IN token : 1001b.
- #define USB_TURNAROUND_TIMEOUT_ERR 1000
- #define USB_CRC16_ERR 1001
- #define USB_PID_ERR 1002
- #define USB_BIT_STUFFING_ERR 1003
- #define USB_STALL_ERR 1004
- #define USB_SHORT_PACKET_ERR 1005
- #define sizeOfCBW 31
- #define sizeOfCSW 13
- //-------------------------------------------------------------------------------------------------
- // USB SIMPLY HOST REGISTER
- //-------------------------------------------------------------------------------------------------
- #define USB_HOST_DRV_REG_BASE_ADR 0xbc020000
- #define USB_CTL_REG 20
- #define USB_HOST_DMA_TX_ADDR 24
- #define USB_HOST_DMA_TX_LEN 25
- #define USB_HOST_DMA_RX_ADDR 26
- #define USB_HOST_DMA_RX_LEN 27
- #define USB_HOST_DMA_CSR 28
- #define USB_HOST_VERSION 0xC00
- #define USB_HOST_CTL 0xC01
- #define USB_HOST_TRANS_PARA 0xC02
- #define USB_HOST_TRANS_LENGTH 0xC03
- #define USB_HOST_PORT_CTL 0xC04
- #define USB_HOST_SOF_CTL 0xC05
- #define USB_HOST_INTERRUPT_STATUS 0xC08
- #define USB_HOST_INTERRUPT_ENABLE 0xC09
- #define USB_HOST_TRANS_STATUS 0xC0A
- #define USB_HOST_DRV_DATA_PORT 0x400
- #define reset_usb_host_hw() usb_host_drv_reg_wr(USB_HOST_CTL,0x04)
- #define usb_host_transaction_go() usb_host_drv_reg_wr(USB_HOST_CTL,0x01)
- #define get_usb_host_version() usb_host_drv_reg_rd(USB_HOST_VERSION)
- //-------------------------------------------------------------------------------------------------
- // Local function declaration
- //-------------------------------------------------------------------------------------------------
- extern void usb_host_drv_reg_wr( UINT32 ,UINT32 );
- extern UINT32 usb_host_drv_reg_rd( UINT32 );
- extern void set_usb_mode_select(UINT32 );
- extern void set_usb_host_trans_para(UINT32 ,UINT32 ,UINT32 ,UINT32 );
- extern void set_usb_host_trans_len(UINT32 );
- extern UINT32 set_usb_host_bus_reset();
- extern void set_usb_dma_Tx_addr_and_len(UINT32 ,UINT32 );
- extern void set_usb_dma_Rx_addr_and_len(UINT32 ,UINT32 );
- extern UINT32 usb_Tx_dma_start();
- extern UINT32 usb_Rx_dma_start();
- extern void read_usb_fifo_data_port(UINT8 *,UINT32 );
- extern void write_usb_fifo_data_port(UINT8 *,UINT32 );
- extern void usb_host_drv_hw_Init();
- extern UINT32 usb_host_drv_bulkXfer(BYTE , BYTE , BYTE , BYTE , BYTE * , BYTE * , BYTE * );
- extern UINT32 usbXfer (BYTE , BYTE , BYTE , BYTE , BYTE , WORD , BYTE * );
- extern UINT32 usb_host_drv_PlugInOutDetect(void);
- extern void usb_host_init();
- extern void usb_host_drv_ErrorProcess(void);
- #endif //#if defined(SUPPORT_USB)&&defined(USB_HOST_DRV)
- extern void usb_host_drv_USBISR (void);
- #endif //_USB_HOST_DRV_H_