initial usb
[rapper.git] / new_cmsis / usb / usbreg.h
1 /*----------------------------------------------------------------------------\r
2  *      U S B  -  K e r n e l\r
3  *----------------------------------------------------------------------------\r
4  * Name:    usbreg.h\r
5  * Purpose: USB Hardware Layer Definitions for NXP LPC Family MCUs\r
6  * Version: V1.20\r
7  *----------------------------------------------------------------------------\r
8  *      This software is supplied "AS IS" without any warranties, express,\r
9  *      implied or statutory, including but not limited to the implied\r
10  *      warranties of fitness for purpose, satisfactory quality and\r
11  *      noninfringement. Keil extends you a royalty-free right to reproduce\r
12  *      and distribute executable files created using this software for use\r
13  *      on NXP Semiconductors LPC family microcontroller devices only. Nothing \r
14  *      else gives you the right to use this software.\r
15  *\r
16  * Copyright (c) 2009 Keil - An ARM Company. All rights reserved.\r
17  *---------------------------------------------------------------------------*/\r
18 \r
19 #ifndef __USBREG_H\r
20 #define __USBREG_H\r
21 \r
22 /* Device Interrupt Bit Definitions */\r
23 #define FRAME_INT           0x00000001\r
24 #define EP_FAST_INT         0x00000002\r
25 #define EP_SLOW_INT         0x00000004\r
26 #define DEV_STAT_INT        0x00000008\r
27 #define CCEMTY_INT          0x00000010\r
28 #define CDFULL_INT          0x00000020\r
29 #define RxENDPKT_INT        0x00000040\r
30 #define TxENDPKT_INT        0x00000080\r
31 #define EP_RLZED_INT        0x00000100\r
32 #define ERR_INT             0x00000200\r
33 \r
34 /* Rx & Tx Packet Length Definitions */\r
35 #define PKT_LNGTH_MASK      0x000003FF\r
36 #define PKT_DV              0x00000400\r
37 #define PKT_RDY             0x00000800\r
38 \r
39 /* USB Control Definitions */\r
40 #define CTRL_RD_EN          0x00000001\r
41 #define CTRL_WR_EN          0x00000002\r
42 \r
43 /* Command Codes */\r
44 #define CMD_SET_ADDR        0x00D00500\r
45 #define CMD_CFG_DEV         0x00D80500\r
46 #define CMD_SET_MODE        0x00F30500\r
47 #define CMD_RD_FRAME        0x00F50500\r
48 #define DAT_RD_FRAME        0x00F50200\r
49 #define CMD_RD_TEST         0x00FD0500\r
50 #define DAT_RD_TEST         0x00FD0200\r
51 #define CMD_SET_DEV_STAT    0x00FE0500\r
52 #define CMD_GET_DEV_STAT    0x00FE0500\r
53 #define DAT_GET_DEV_STAT    0x00FE0200\r
54 #define CMD_GET_ERR_CODE    0x00FF0500\r
55 #define DAT_GET_ERR_CODE    0x00FF0200\r
56 #define CMD_RD_ERR_STAT     0x00FB0500\r
57 #define DAT_RD_ERR_STAT     0x00FB0200\r
58 #define DAT_WR_BYTE(x)     (0x00000100 | ((x) << 16))\r
59 #define CMD_SEL_EP(x)      (0x00000500 | ((x) << 16))\r
60 #define DAT_SEL_EP(x)      (0x00000200 | ((x) << 16))\r
61 #define CMD_SEL_EP_CLRI(x) (0x00400500 | ((x) << 16))\r
62 #define DAT_SEL_EP_CLRI(x) (0x00400200 | ((x) << 16))\r
63 #define CMD_SET_EP_STAT(x) (0x00400500 | ((x) << 16))\r
64 #define CMD_CLR_BUF         0x00F20500\r
65 #define DAT_CLR_BUF         0x00F20200\r
66 #define CMD_VALID_BUF       0x00FA0500\r
67 \r
68 /* Device Address Register Definitions */\r
69 #define DEV_ADDR_MASK       0x7F\r
70 #define DEV_EN              0x80\r
71 \r
72 /* Device Configure Register Definitions */\r
73 #define CONF_DVICE          0x01\r
74 \r
75 /* Device Mode Register Definitions */\r
76 #define AP_CLK              0x01\r
77 #define INAK_CI             0x02\r
78 #define INAK_CO             0x04\r
79 #define INAK_II             0x08\r
80 #define INAK_IO             0x10\r
81 #define INAK_BI             0x20\r
82 #define INAK_BO             0x40\r
83 \r
84 /* Device Status Register Definitions */\r
85 #define DEV_CON             0x01\r
86 #define DEV_CON_CH          0x02\r
87 #define DEV_SUS             0x04\r
88 #define DEV_SUS_CH          0x08\r
89 #define DEV_RST             0x10\r
90 \r
91 /* Error Code Register Definitions */\r
92 #define ERR_EC_MASK         0x0F\r
93 #define ERR_EA              0x10\r
94 \r
95 /* Error Status Register Definitions */\r
96 #define ERR_PID             0x01\r
97 #define ERR_UEPKT           0x02\r
98 #define ERR_DCRC            0x04\r
99 #define ERR_TIMOUT          0x08\r
100 #define ERR_EOP             0x10\r
101 #define ERR_B_OVRN          0x20\r
102 #define ERR_BTSTF           0x40\r
103 #define ERR_TGL             0x80\r
104 \r
105 /* Endpoint Select Register Definitions */\r
106 #define EP_SEL_F            0x01\r
107 #define EP_SEL_ST           0x02\r
108 #define EP_SEL_STP          0x04\r
109 #define EP_SEL_PO           0x08\r
110 #define EP_SEL_EPN          0x10\r
111 #define EP_SEL_B_1_FULL     0x20\r
112 #define EP_SEL_B_2_FULL     0x40\r
113 \r
114 /* Endpoint Status Register Definitions */\r
115 #define EP_STAT_ST          0x01\r
116 #define EP_STAT_DA          0x20\r
117 #define EP_STAT_RF_MO       0x40\r
118 #define EP_STAT_CND_ST      0x80\r
119 \r
120 /* Clear Buffer Register Definitions */\r
121 #define CLR_BUF_PO          0x01\r
122 \r
123 \r
124 /* DMA Interrupt Bit Definitions */\r
125 #define EOT_INT             0x01\r
126 #define NDD_REQ_INT         0x02\r
127 #define SYS_ERR_INT         0x04\r
128 \r
129 \r
130 #endif  /* __USBREG_H */\r