Mercurial > ~darius > hgwebdir.cgi > tempctrl
comparison usb.h @ 35:fed32b382de2
Tidy up, hide details behind macros to make it more obvious what we
talk to do do things.
Convert constants to my preferred format.
author | darius |
---|---|
date | Tue, 23 Oct 2007 10:54:01 +0930 |
parents | 4e417d84365e |
children |
comparison
equal
deleted
inserted
replaced
34:2b8278ec5adb | 35:fed32b382de2 |
---|---|
95 uint8_t bLength; | 95 uint8_t bLength; |
96 uint8_t bDescriptorType; | 96 uint8_t bDescriptorType; |
97 uint16_t wLANGID0; | 97 uint16_t wLANGID0; |
98 } __attribute__ ((packed)) LANGID_DESCRIPTOR; | 98 } __attribute__ ((packed)) LANGID_DESCRIPTOR; |
99 | 99 |
100 #define D12_SET_ADDRESS_ENABLE 0xD0 | 100 #define D12_SET_ADDRESS_ENABLE 0xd0 |
101 #define D12_SET_ENDPOINT_ENABLE 0xD8 | 101 #define D12_SET_ENDPOINT_ENABLE 0xd8 |
102 #define D12_SET_MODE 0xF3 | 102 #define D12_SET_MODE 0xf3 |
103 #define D12_SET_DMA 0xFB | 103 #define D12_SET_DMA 0xfb |
104 #define D12_READ_INTERRUPT_REGISTER 0xF4 | 104 #define D12_READ_INTERRUPT_REGISTER 0xf4 |
105 #define D12_READ_BUFFER 0xF0 | 105 #define D12_READ_BUFFER 0xf0 |
106 #define D12_WRITE_BUFFER 0xF0 | 106 #define D12_WRITE_BUFFER 0xf0 |
107 #define D12_ACK_SETUP 0xF1 | 107 #define D12_ACK_SETUP 0xf2 |
108 #define D12_CLEAR_BUFFER 0xF2 | 108 #define D12_CLEAR_BUFFER 0xf2 |
109 #define D12_VALIDATE_BUFFER 0xFA | 109 #define D12_VALIDATE_BUFFER 0xfa |
110 #define D12_READ_LAST_TRANSACTION 0x40 | 110 #define D12_READ_LAST_TRANSACTION 0x40 |
111 #define D12_SET_ENDPOINT_STATUS 0x40 | 111 #define D12_SET_ENDPOINT_STATUS 0x40 |
112 #define D12_READ_ENDPOINT_STATUS 0x80 | 112 #define D12_READ_ENDPOINT_STATUS 0x80 |
113 #define D12_READ_CHIP_ID 0xfd | |
113 | 114 |
114 #define D12_ENDPOINT_EP0_OUT 0x00 | 115 #define D12_ENDPOINT_EP0_OUT 0x00 |
115 #define D12_ENDPOINT_EP0_IN 0x01 | 116 #define D12_ENDPOINT_EP0_IN 0x01 |
116 #define D12_ENDPOINT_EP1_OUT 0x02 | 117 #define D12_ENDPOINT_EP1_OUT 0x02 |
117 #define D12_ENDPOINT_EP1_IN 0x03 | 118 #define D12_ENDPOINT_EP1_IN 0x03 |
187 void d12_send_data_ep0(void); | 188 void d12_send_data_ep0(void); |
188 void d12_receive_data_ep1(void); | 189 void d12_receive_data_ep1(void); |
189 void d12_send_data_ep2(void); | 190 void d12_send_data_ep2(void); |
190 void d12_receive_data_ep2(void); | 191 void d12_receive_data_ep2(void); |
191 | 192 |
192 static void reset(void); | 193 void reset(void); |
193 | 194 |
194 void usb_init(void); | 195 void usb_init(void); |
195 void usb_intr(void); | 196 void usb_intr(void); |
196 void usb_gendata(void); | 197 void usb_gendata(void); |
198 | |
199 /* | |
200 * The PDIUSBD12 is wired up like so | |
201 * | |
202 * PDI AVR | |
203 * ====================== | |
204 * D7:0 <=> PA7:0 | |
205 * RD_N <= PB0 | |
206 * INT_N => PB1 | |
207 * WR_N <= PB2 | |
208 * A0 <= PB3 (0 = data, 1 = cmd) | |
209 * SUSPEND <=> PB4 | |
210 */ | |
211 | |
212 #define PDIPORT PORTA | |
213 #define PDIDDR PORTA | |
214 #define PDICTL PORTB | |
215 #define PDIRD PB0 | |
216 #define PDIINT PB1 | |
217 #define PDIWR PB2 | |
218 #define PDIA0 PB3 | |
219 #define PDISUSP PB4 | |
220 |