diff options
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/usb_ch9.h | 2 | ||||
-rw-r--r-- | firmware/export/usb_core.h | 43 | ||||
-rw-r--r-- | firmware/export/usb_drv.h | 7 |
3 files changed, 43 insertions, 9 deletions
diff --git a/firmware/export/usb_ch9.h b/firmware/export/usb_ch9.h index 1bfc152a8a..d5885ac9b8 100644 --- a/firmware/export/usb_ch9.h +++ b/firmware/export/usb_ch9.h | |||
@@ -245,7 +245,7 @@ struct usb_string_descriptor { | |||
245 | uint8_t bDescriptorType; | 245 | uint8_t bDescriptorType; |
246 | 246 | ||
247 | uint16_t wString[]; /* UTF-16LE encoded */ | 247 | uint16_t wString[]; /* UTF-16LE encoded */ |
248 | } __attribute__ ((packed)); | 248 | } __attribute__ ((packed,aligned(2))); |
249 | 249 | ||
250 | /* note that "string" zero is special, it holds language codes that | 250 | /* note that "string" zero is special, it holds language codes that |
251 | * the device supports, not Unicode characters. | 251 | * the device supports, not Unicode characters. |
diff --git a/firmware/export/usb_core.h b/firmware/export/usb_core.h index 2027cca5e8..73cf5c0127 100644 --- a/firmware/export/usb_core.h +++ b/firmware/export/usb_core.h | |||
@@ -19,6 +19,22 @@ | |||
19 | #ifndef USB_CORE_H | 19 | #ifndef USB_CORE_H |
20 | #define USB_CORE_H | 20 | #define USB_CORE_H |
21 | 21 | ||
22 | #ifndef BOOTLOADER | ||
23 | #define USB_THREAD | ||
24 | |||
25 | #ifdef USE_ROCKBOX_USB | ||
26 | //#define USB_SERIAL | ||
27 | //#define USB_BENCHMARK | ||
28 | #define USB_STORAGE | ||
29 | |||
30 | #else | ||
31 | #define USB_CHARGING_ONLY | ||
32 | |||
33 | #endif /* USE_ROCKBOX_USB */ | ||
34 | #else | ||
35 | #define USB_CHARGING_ONLY | ||
36 | #endif /* BOOTLOADER */ | ||
37 | |||
22 | #include "usb_ch9.h" | 38 | #include "usb_ch9.h" |
23 | 39 | ||
24 | #if defined(CPU_PP) | 40 | #if defined(CPU_PP) |
@@ -26,14 +42,31 @@ | |||
26 | #define USB_IRAM_SIZE ((size_t)0xc000) | 42 | #define USB_IRAM_SIZE ((size_t)0xc000) |
27 | #endif | 43 | #endif |
28 | 44 | ||
45 | |||
46 | enum { | ||
47 | USB_CORE_QUIT, | ||
48 | USB_CORE_TRANSFER_COMPLETION | ||
49 | }; | ||
50 | |||
29 | /* endpoints */ | 51 | /* endpoints */ |
30 | enum { | 52 | enum { |
31 | EP_CONTROL = 0, | 53 | EP_CONTROL = 0, |
32 | EP_RX, | 54 | #ifdef USB_STORAGE |
33 | EP_TX, | 55 | EP_MASS_STORAGE, |
34 | NUM_ENDPOINTS | 56 | #endif |
57 | #ifdef USB_SERIAL | ||
58 | EP_SERIAL, | ||
59 | #endif | ||
60 | #ifdef USB_CHARGING_ONLY | ||
61 | EP_CHARGING_ONLY, | ||
62 | #endif | ||
63 | #ifdef USB_BENCHMARK | ||
64 | EP_BENCHMARK, | ||
65 | #endif | ||
66 | NUM_ENDPOINTS | ||
35 | }; | 67 | }; |
36 | 68 | ||
69 | |||
37 | /* queue events */ | 70 | /* queue events */ |
38 | #define USB_TRANSFER_COMPLETE 1 | 71 | #define USB_TRANSFER_COMPLETE 1 |
39 | 72 | ||
@@ -48,7 +81,7 @@ extern int usb_max_pkt_size; | |||
48 | void usb_core_init(void); | 81 | void usb_core_init(void); |
49 | void usb_core_exit(void); | 82 | void usb_core_exit(void); |
50 | void usb_core_control_request(struct usb_ctrlrequest* req); | 83 | void usb_core_control_request(struct usb_ctrlrequest* req); |
51 | void usb_core_transfer_complete(int endpoint, bool in); | 84 | void usb_core_transfer_complete(int endpoint, bool in, int status, int length); |
52 | void usb_core_bus_reset(void); | 85 | void usb_core_bus_reset(void); |
53 | bool usb_core_data_connection(void); | 86 | bool usb_core_data_connection(void); |
54 | 87 | ||
diff --git a/firmware/export/usb_drv.h b/firmware/export/usb_drv.h index 6a37144c1a..430f03bdc7 100644 --- a/firmware/export/usb_drv.h +++ b/firmware/export/usb_drv.h | |||
@@ -24,16 +24,17 @@ | |||
24 | void usb_drv_init(void); | 24 | void usb_drv_init(void); |
25 | void usb_drv_exit(void); | 25 | void usb_drv_exit(void); |
26 | void usb_drv_int(void); | 26 | void usb_drv_int(void); |
27 | void usb_drv_stall(int endpoint, bool stall); | 27 | void usb_drv_stall(int endpoint, bool stall,bool in); |
28 | bool usb_drv_stalled(int endpoint,bool in); | ||
28 | int usb_drv_send(int endpoint, void* ptr, int length); | 29 | int usb_drv_send(int endpoint, void* ptr, int length); |
30 | int usb_drv_send_nonblocking(int endpoint, void* ptr, int length); | ||
29 | int usb_drv_recv(int endpoint, void* ptr, int length); | 31 | int usb_drv_recv(int endpoint, void* ptr, int length); |
30 | void usb_drv_ack(struct usb_ctrlrequest* req); | 32 | void usb_drv_ack(struct usb_ctrlrequest* req); |
31 | void usb_drv_set_address(int address); | 33 | void usb_drv_set_address(int address); |
32 | void usb_drv_reset_endpoint(int endpoint, bool send); | 34 | void usb_drv_reset_endpoint(int endpoint, bool send); |
33 | void usb_drv_wait(int endpoint, bool send); | 35 | void usb_drv_wait(int endpoint, bool send); |
34 | bool usb_drv_powered(void); | 36 | bool usb_drv_powered(void); |
35 | int usb_drv_get_last_transfer_status(void); | ||
36 | int usb_drv_get_last_transfer_length(void); | ||
37 | int usb_drv_port_speed(void); | 37 | int usb_drv_port_speed(void); |
38 | void usb_drv_cancel_all_transfers(void); | ||
38 | 39 | ||
39 | #endif | 40 | #endif |