annotate usb.h @ 23:845934a4e7fe

Add code to talk to a Phillips PDIUSBB12.
author darius
date Mon, 12 Dec 2005 23:32:59 +1030
parents
children 4e417d84365e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
1 /*
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
2 * Copyright (c) 2003 Bernd Walter
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
3 * All rights reserved.
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
4 */
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
5
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
6 /* Example Source Code for USB Enumeration using a PDIUSBD11 connected to a PIC16F87x
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
7 * Copyright 2001 Craig Peacock, Craig.Peacock@beyondlogic.org
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
8 * 31th December 2001 http://www.beyondlogic.org
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
9 */
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
10
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
11 typedef struct {
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
12 uint8_t bmRequestType;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
13 uint8_t bRequest;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
14 uint16_t wValue;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
15 uint16_t wIndex;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
16 uint16_t wLength;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
17 } USB_SETUP_REQUEST;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
18
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
19 typedef struct {
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
20 uint8_t bLength;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
21 uint8_t bDescriptorType;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
22 uint16_t bcdUSB;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
23 uint8_t bDeviceClass;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
24 uint8_t bDeviceSubClass;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
25 uint8_t bDeviceProtocol;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
26 uint8_t bMaxPacketSize0;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
27 uint16_t idVendor;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
28 uint16_t idProduct;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
29 uint16_t bcdDevice;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
30 uint8_t iManufacturer;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
31 uint8_t iProduct;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
32 uint8_t iSerialNumber;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
33 uint8_t bNumConfigurations;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
34 } USB_DEVICE_DESCRIPTOR;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
35
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
36 typedef struct {
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
37 uint8_t bLength;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
38 uint8_t bDescriptorType;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
39 uint8_t bEndpointAddress;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
40 uint8_t bmAttributes;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
41 uint16_t wMaxPacketSize;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
42 uint8_t bInterval;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
43 } USB_ENDPOINT_DESCRIPTOR;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
44
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
45 typedef struct {
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
46 uint8_t bLength;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
47 uint8_t bDescriptorType;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
48 uint16_t wTotalLength;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
49 uint8_t bNumInterfaces;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
50 uint8_t bConfigurationValue;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
51 uint8_t iConfiguration;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
52 uint8_t bmAttributes;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
53 uint8_t MaxPower;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
54 } USB_CONFIGURATION_DESCRIPTOR;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
55
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
56 typedef struct {
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
57 uint8_t bLength;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
58 uint8_t bDescriptorType;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
59 uint8_t bInterfaceNumber;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
60 uint8_t bAlternateSetting;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
61 uint8_t bNumEndpoints;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
62 uint8_t bInterfaceClass;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
63 uint8_t bInterfaceSubClass;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
64 uint8_t bInterfaceProtocol;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
65 uint8_t iInterface;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
66 } USB_INTERFACE_DESCRIPTOR;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
67
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
68 typedef struct {
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
69 uint8_t bLength;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
70 uint8_t bDescriptorType;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
71 uint16_t wHIDClassSpecComp;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
72 uint8_t bCountry;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
73 uint8_t bNumDescriptors;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
74 uint8_t b1stDescType;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
75 uint16_t w1stDescLength;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
76 } USB_HID_DESCRIPTOR;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
77
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
78 typedef struct {
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
79 USB_CONFIGURATION_DESCRIPTOR ConfigDescriptor;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
80 USB_INTERFACE_DESCRIPTOR InterfaceDescriptor0;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
81 USB_ENDPOINT_DESCRIPTOR EndpointDescriptor00;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
82 USB_ENDPOINT_DESCRIPTOR EndpointDescriptor01;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
83 USB_INTERFACE_DESCRIPTOR InterfaceDescriptor1;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
84 USB_ENDPOINT_DESCRIPTOR EndpointDescriptor10;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
85 USB_ENDPOINT_DESCRIPTOR EndpointDescriptor11;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
86 } USB_CONFIG_DATA;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
87
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
88 typedef struct {
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
89 uint8_t bLength;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
90 uint8_t bDescriptorType;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
91 char bString[];
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
92 } STRING_DESCRIPTOR;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
93
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
94 typedef struct {
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
95 uint8_t bLength;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
96 uint8_t bDescriptorType;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
97 uint16_t wLANGID0;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
98 } LANGID_DESCRIPTOR;
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
99
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
100 #define D12_SET_ADDRESS_ENABLE 0xD0
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
101 #define D12_SET_ENDPOINT_ENABLE 0xD8
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
102 #define D12_SET_MODE 0xF3
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
103 #define D12_SET_DMA 0xFB
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
104 #define D12_READ_INTERRUPT_REGISTER 0xF4
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
105 #define D12_READ_BUFFER 0xF0
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
106 #define D12_WRITE_BUFFER 0xF0
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
107 #define D12_ACK_SETUP 0xF1
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
108 #define D12_CLEAR_BUFFER 0xF2
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
109 #define D12_VALIDATE_BUFFER 0xFA
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
110 #define D12_READ_LAST_TRANSACTION 0x40
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
111 #define D12_SET_ENDPOINT_STATUS 0x40
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
112 #define D12_READ_ENDPOINT_STATUS 0x80
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
113
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
114 #define D12_ENDPOINT_EP0_OUT 0x00
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
115 #define D12_ENDPOINT_EP0_IN 0x01
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
116 #define D12_ENDPOINT_EP1_OUT 0x02
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
117 #define D12_ENDPOINT_EP1_IN 0x03
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
118 #define D12_ENDPOINT_EP2_OUT 0x04
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
119 #define D12_ENDPOINT_EP2_IN 0x05
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
120
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
121 #define D12_INT_EP0_OUT 0x01
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
122 #define D12_INT_EP0_IN 0x02
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
123 #define D12_INT_EP1_OUT 0x04
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
124 #define D12_INT_EP1_IN 0x08
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
125 #define D12_INT_EP2_OUT 0x10
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
126 #define D12_INT_EP2_IN 0x20
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
127 #define D12_INT_BUS_RESET 0x40
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
128 #define D12_INT_SUSPEND 0x80
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
129
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
130 #define D12_LAST_TRAN_SETUP 0x20
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
131
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
132 #define STANDARD_DEVICE_REQUEST 0x00
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
133 #define STANDARD_INTERFACE_REQUEST 0x01
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
134 #define STANDARD_ENDPOINT_REQUEST 0x02
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
135 #define VENDOR_DEVICE_REQUEST 0x40
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
136 #define VENDOR_INTERFACE_REQUEST 0x41
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
137 #define VENDOR_ENDPOINT_REQUEST 0x42
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
138
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
139 #define GET_STATUS 0
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
140 #define CLEAR_FEATURE 1
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
141 #define SET_FEATURE 3
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
142 #define SET_ADDRESS 5
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
143 #define GET_DESCRIPTOR 6
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
144 #define SET_DESCRIPTOR 7
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
145 #define GET_CONFIGURATION 8
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
146 #define SET_CONFIGURATION 9
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
147 #define GET_INTERFACE 10
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
148 #define SET_INTERFACE 11
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
149 #define SYNCH_FRAME 12
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
150
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
151 #define VENDOR_UPDATE 126
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
152 #define VENDOR_RESET 127
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
153
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
154 #define ENDPOINT_HALT 0
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
155
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
156 #define TYPE_DEVICE_DESCRIPTOR 1
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
157 #define TYPE_CONFIGURATION_DESCRIPTOR 2
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
158 #define TYPE_STRING_DESCRIPTOR 3
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
159 #define TYPE_INTERFACE_DESCRIPTOR 4
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
160 #define TYPE_ENDPOINT_DESCRIPTOR 5
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
161 #define TYPE_HID_DESCRIPTOR 0x21
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
162
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
163 #define USB_ENDPOINT_TYPE_CONTROL 0x00
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
164 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
165 #define USB_ENDPOINT_TYPE_BULK 0x02
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
166 #define USB_ENDPOINT_TYPE_INTERRUPT 0x03
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
167
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
168 /* Function prototypes */
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
169 uint8_t d12_get_data(void);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
170 void d12_set_data(uint8_t data);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
171 void d12_set_cmd(uint8_t cmd);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
172 void d12_write_cmd(uint8_t command, const uint8_t *buffer, uint8_t count);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
173 void d12_read_cmd(uint8_t command, uint8_t *buffer, uint8_t count);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
174 uint8_t d12_read_endpt(uint8_t endpt, uint8_t *buffer);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
175
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
176 void d12_ep0_irq(void);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
177 void d12_getdescriptor(USB_SETUP_REQUEST *SetupPacket);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
178 void d12_stallctrlendpt(void);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
179 uint8_t d12_read_endpt(uint8_t endpt, uint8_t *buffer);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
180 void d12_write_endpt(uint8_t endpt, const uint8_t *buffer, uint8_t bytes);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
181 void d12_write_buffer_ep0(void);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
182 void d12_send_data_ep2(void);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
183 void d12_receive_data_ep2(void);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
184
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
185 static void reset(void);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
186
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
187 void usb_init(void);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
188 void usb_intr(void);
845934a4e7fe Add code to talk to a Phillips PDIUSBB12.
darius
parents:
diff changeset
189 void usb_gendata(void);