⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbdisk_main.h

📁 一个USB的驱动驱动
💻 H
字号:
#ifndef __USB_RX_H
#define __USB_RX_H

/*==========================================
 			include head files 
 ==========================================*/
#include "types.h"

/*==========================================
	PLL registers Memory Map of Melody
 ==========================================*/
#define PLL_BASE					0x0021B000

//general PLL configuration
#define _reg_PLL_GPCR				(*((volatile UINT32  *)(PLL_BASE+0x80C))) 
#define _reg_PLL_CSCR				(*((volatile UINT32  *)(PLL_BASE+0x000)))  
#define _reg_PLL_PCDR				(*((volatile UINT32  *)(PLL_BASE+0x020))) 
#define _reg_PLL_PCTL				(*((volatile UINT32  *)(PLL_BASE+0x004)))
  
//USB clock configuration 
#define _reg_PLL_GCCR				(*((volatile UINT32  *)(USBD_BASE+0x810)))  
 
/*==========================================
	GPIO registers Memory Map of Melody
 ==========================================*/
#define GPIO_BASE					0x0021C400

//USB GPIO configuration 
#define _reg_GPIO_USB_GIUS				(*((volatile UINT32  *)(GPIO_BASE+0x20)))
#define _reg_GPIO_USB_DDIR				(*((volatile UINT32  *)(GPIO_BASE+0x00))) 
#define _reg_GPIO_USB_SSR				(*((volatile UINT32  *)(GPIO_BASE+0x24))) 
 
/*==========================================
	USBD registers Memory Map of Melody
 ==========================================*/
#define USBD_BASE					0x00225000

//used for interrupt set and enable
#define _reg_USBD_IntrUSB			(*((volatile UINT8  *)(USBD_BASE+0x0A)))
#define _reg_USBD_IntrUSBE			(*((volatile UINT8  *)(USBD_BASE+0x0B)))
#define _reg_USBD_IntrTx			(*((volatile UINT16 *)(USBD_BASE+0x02))) 
#define _reg_USBD_IntrTxE			(*((volatile UINT16 *)(USBD_BASE+0x06)))
#define _reg_USBD_IntrRx			(*((volatile UINT16 *)(USBD_BASE+0x04)))
#define _reg_USBD_IntrRxE			(*((volatile UINT16 *)(USBD_BASE+0x08)))


//used for USBD basic config
#define _reg_USBD_DevCtl			(*((volatile UINT8  *)(USBD_BASE+0x60)))
#define _reg_USBD_Frame				(*((volatile UINT16 *)(USBD_BASE+0x0C)))
#define _reg_USBD_Power				(*((volatile UINT8  *)(USBD_BASE+0x01)))
#define _reg_USBD_FAddr				(*((volatile UINT8  *)(USBD_BASE+0x00)))

//used for USBD EndPoint config
#define _reg_USBD_Index				(*((volatile UINT8  *)(USBD_BASE+0x0E)))

#define _reg_USBD_CSR0				(*((volatile UINT16 *)(USBD_BASE+0x12)))
#define _reg_USBD_Count0			(*((volatile UINT8  *)(USBD_BASE+0x18)))

#define _reg_USBD_TxMaxP			(*((volatile UINT16 *)(USBD_BASE+0x10)))
#define _reg_USBD_TxCSR				(*((volatile UINT16 *)(USBD_BASE+0x12)))

#define _reg_USBD_RxMaxP			(*((volatile UINT16 *)(USBD_BASE+0x14)))
#define _reg_USBD_RxCSR				(*((volatile UINT16 *)(USBD_BASE+0x16)))
#define _reg_USBD_RxCount			(*((volatile UINT16 *)(USBD_BASE+0x18)))

#define _reg_USBD_FIFO0_word		(*((volatile UINT32 *)(USBD_BASE+0x20)))
#define _reg_USBD_FIFO1_word		(*((volatile UINT32 *)(USBD_BASE+0x24)))
#define _reg_USBD_FIFO2_word		(*((volatile UINT32 *)(USBD_BASE+0x28)))
#define _reg_USBD_FIFO3_word		(*((volatile UINT32 *)(USBD_BASE+0x2C)))
#define _reg_USBD_FIFO4_word		(*((volatile UINT32 *)(USBD_BASE+0x30)))
#define _reg_USBD_FIFO5_word		(*((volatile UINT32 *)(USBD_BASE+0x34)))
#define _reg_USBD_FIFO6_word		(*((volatile UINT32 *)(USBD_BASE+0x38)))

#define _reg_USBD_FIFO0_hword		(*((volatile UINT16 *)(USBD_BASE+0x20)))
#define _reg_USBD_FIFO1_hword		(*((volatile UINT16 *)(USBD_BASE+0x24)))
#define _reg_USBD_FIFO2_hword		(*((volatile UINT16 *)(USBD_BASE+0x28)))
#define _reg_USBD_FIFO3_hword		(*((volatile UINT16 *)(USBD_BASE+0x2C)))
#define _reg_USBD_FIFO4_hword		(*((volatile UINT16 *)(USBD_BASE+0x30)))
#define _reg_USBD_FIFO5_hword		(*((volatile UINT16 *)(USBD_BASE+0x34)))
#define _reg_USBD_FIFO6_hword		(*((volatile UINT16 *)(USBD_BASE+0x38)))

#define _reg_USBD_FIFO0_byte		(*((volatile UINT8  *)(USBD_BASE+0x20)))
#define _reg_USBD_FIFO1_byte		(*((volatile UINT8  *)(USBD_BASE+0x24)))
#define _reg_USBD_FIFO2_byte		(*((volatile UINT8  *)(USBD_BASE+0x28)))
#define _reg_USBD_FIFO3_byte		(*((volatile UINT8  *)(USBD_BASE+0x2C)))
#define _reg_USBD_FIFO4_byte		(*((volatile UINT8  *)(USBD_BASE+0x30)))
#define _reg_USBD_FIFO5_byte		(*((volatile UINT8  *)(USBD_BASE+0x34)))
#define _reg_USBD_FIFO6_byte		(*((volatile UINT8  *)(USBD_BASE+0x38)))

//only used for USB host function
#define _reg_USBD_NAKLimit0			(*((volatile UINT8  *)(USBD_BASE+0x1B)))
#define _reg_USBD_TxType			(*((volatile UINT8  *)(USBD_BASE+0x1A)))
#define _reg_USBD_TxInterval		(*((volatile UINT8  *)(USBD_BASE+0x1B)))
#define _reg_USBD_RxType			(*((volatile UINT8  *)(USBD_BASE+0x1C)))
#define _reg_USBD_RxInterval		(*((volatile UINT8  *)(USBD_BASE+0x1D)))

//used for IP core testing and checking 
#define _reg_USBD_TestMode			(*((volatile UINT8  *)(USBD_BASE+0x0F)))
#define _reg_USBD_ConfigData		(*((volatile UINT8  *)(USBD_BASE+0x1F)))		//_reg_USBD_Index value can not be 1-15 
#define _reg_USBD_FIFOsize			(*((volatile UINT8  *)(USBD_BASE+0x1F)))		//_reg_USBD_Index has been set 1-15 and Dynamic sizing is not selected

void USBInit(void);
void USBSoftConnect(void);
void usbrx(void);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -