usbhw_lpc.h

00001 
00010 /* Common LPC2148 definitions, related to USB */
00011 #define PCONP                   *(volatile unsigned int *)0xE01FC0C4
00012 #define PLL1CON                 *(volatile unsigned int *)0xE01FC0A0
00013 #define PLL1CFG                 *(volatile unsigned int *)0xE01FC0A4
00014 #define PLL1STAT                *(volatile unsigned int *)0xE01FC0A8
00015 #define PLL1FEED                *(volatile unsigned int *)0xE01FC0AC
00016 
00017 #define PINSEL0                 *(volatile unsigned int *)0xE002C000
00018 #define PINSEL1                 *(volatile unsigned int *)0xE002C004
00019 #define IOPIN0                  *(volatile unsigned int *)0xE0028000
00020 #define IOSET0                  *(volatile unsigned int *)0xE0028004
00021 #define IODIR0                  *(volatile unsigned int *)0xE0028008
00022 #define IOCLR0                  *(volatile unsigned int *)0xE002800C
00023 
00024 /* USB register definitions */
00025 #define USBIntSt                *(volatile unsigned int *)0xE01FC1C0
00026 
00027 #define USBDevIntSt             *(volatile unsigned int *)0xE0090000
00028 #define USBDevIntEn             *(volatile unsigned int *)0xE0090004
00029 #define USBDevIntClr    *(volatile unsigned int *)0xE0090008
00030 #define USBDevIntSet    *(volatile unsigned int *)0xE009000C
00031 #define USBDevIntPri    *(volatile unsigned int *)0xE009002C
00032 
00033 #define USBEpIntSt              *(volatile unsigned int *)0xE0090030
00034 #define USBEpIntEn              *(volatile unsigned int *)0xE0090034
00035 #define USBEpIntClr             *(volatile unsigned int *)0xE0090038
00036 #define USBEpIntSet             *(volatile unsigned int *)0xE009003C
00037 #define USBEpIntPri             *(volatile unsigned int *)0xE0090040
00038 
00039 #define USBReEP                 *(volatile unsigned int *)0xE0090044
00040 #define USBEpInd                *(volatile unsigned int *)0xE0090048
00041 #define USBMaxPSize             *(volatile unsigned int *)0xE009004C
00042 
00043 #define USBRxData               *(volatile unsigned int *)0xE0090018
00044 #define USBRxPLen               *(volatile unsigned int *)0xE0090020
00045 #define USBTxData               *(volatile unsigned int *)0xE009001C
00046 #define USBTxPLen               *(volatile unsigned int *)0xE0090024
00047 #define USBCtrl                 *(volatile unsigned int *)0xE0090028
00048 
00049 #define USBCmdCode              *(volatile unsigned int *)0xE0090010
00050 #define USBCmdData              *(volatile unsigned int *)0xE0090014
00051 
00052 /* USBIntSt bits */
00053 #define USB_INT_REQ_LP                          (1<<0)
00054 #define USB_INT_REQ_HP                          (1<<1)
00055 #define USB_INT_REQ_DMA                         (1<<2)
00056 #define USB_need_clock                          (1<<8)
00057 #define EN_USB_BITS                                     (1<<31)
00058 
00059 /* USBDevInt... bits */
00060 #define FRAME                                           (1<<0)
00061 #define EP_FAST                                         (1<<1)
00062 #define EP_SLOW                                         (1<<2)
00063 #define DEV_STAT                                        (1<<3)
00064 #define CCEMTY                                          (1<<4)
00065 #define CDFULL                                          (1<<5)
00066 #define RxENDPKT                                        (1<<6)
00067 #define TxENDPKT                                        (1<<7)
00068 #define EP_RLZED                                        (1<<8)
00069 #define ERR_INT                                         (1<<9)
00070 
00071 /* USBRxPLen bits */
00072 #define PKT_LNGTH                                       (1<<0)
00073 #define PKT_LNGTH_MASK                          0x3FF
00074 #define DV                                                      (1<<10)
00075 #define PKT_RDY                                         (1<<11)
00076 
00077 /* USBCtrl bits */
00078 #define RD_EN                                           (1<<0)
00079 #define WR_EN                                           (1<<1)
00080 #define LOG_ENDPOINT                            (1<<2)
00081 
00082 /* protocol engine command codes */
00083         /* device commands */
00084 #define CMD_DEV_SET_ADDRESS                     0xD0
00085 #define CMD_DEV_CONFIG                          0xD8
00086 #define CMD_DEV_SET_MODE                        0xF3
00087 #define CMD_DEV_READ_CUR_FRAME_NR       0xF5
00088 #define CMD_DEV_READ_TEST_REG           0xFD
00089 #define CMD_DEV_STATUS                          0xFE            /* read/write */
00090 #define CMD_DEV_GET_ERROR_CODE          0xFF
00091 #define CMD_DEV_READ_ERROR_STATUS       0xFB
00092         /* endpoint commands */
00093 #define CMD_EP_SELECT                           0x00
00094 #define CMD_EP_SELECT_CLEAR                     0x40
00095 #define CMD_EP_SET_STATUS                       0x40
00096 #define CMD_EP_CLEAR_BUFFER                     0xF2
00097 #define CMD_EP_VALIDATE_BUFFER          0xFA
00098 
00099 /* set address command */
00100 #define DEV_ADDR                                        (1<<0)
00101 #define DEV_EN                                          (1<<7)
00102 
00103 /* configure device command */
00104 #define CONF_DEVICE                                     (1<<0)
00105 
00106 /* set mode command */
00107 #define AP_CLK                                          (1<<0)
00108 #define INAK_CI                                         (1<<1)
00109 #define INAK_CO                                         (1<<2)
00110 #define INAK_II                                         (1<<3)
00111 #define INAK_IO                                         (1<<4)
00112 #define INAK_BI                                         (1<<5)
00113 #define INAK_BO                                         (1<<6)
00114 
00115 /* set get device status command */
00116 #define CON                                                     (1<<0)
00117 #define CON_CH                                          (1<<1)
00118 #define SUS                                                     (1<<2)
00119 #define SUS_CH                                          (1<<3)
00120 #define RST                                                     (1<<4)
00121 
00122 /* get error code command */
00123 // ...
00124 
00125 /* Select Endpoint command read bits */
00126 #define EPSTAT_FE                                       (1<<0)
00127 #define EPSTAT_ST                                       (1<<1)
00128 #define EPSTAT_STP                                      (1<<2)
00129 #define EPSTAT_PO                                       (1<<3)
00130 #define EPSTAT_EPN                                      (1<<4)
00131 #define EPSTAT_B1FULL                           (1<<5)
00132 #define EPSTAT_B2FULL                           (1<<6)
00133 
00134 /* CMD_EP_SET_STATUS command */
00135 #define EP_ST                                           (1<<0)
00136 #define EP_DA                                           (1<<5)
00137 #define EP_RF_MO                                        (1<<6)
00138 #define EP_CND_ST                                       (1<<7)
00139 
00140 /* read error status command */
00141 #define PID_ERR                                         (1<<0)
00142 #define UEPKT                                           (1<<1)
00143 #define DCRC                                            (1<<2)
00144 #define TIMEOUT                                         (1<<3)
00145 #define EOP                                                     (1<<4)
00146 #define B_OVRN                                          (1<<5)
00147 #define BTSTF                                           (1<<6)
00148 #define TGL_ERR                                         (1<<7)
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 

Generated on Sun Sep 3 23:15:09 2006 for LPCUSB by  doxygen 1.4.6