summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/usb_ch9.h2
-rw-r--r--firmware/export/usb_core.h43
-rw-r--r--firmware/export/usb_drv.h7
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
46enum {
47 USB_CORE_QUIT,
48 USB_CORE_TRANSFER_COMPLETION
49};
50
29/* endpoints */ 51/* endpoints */
30enum { 52enum {
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;
48void usb_core_init(void); 81void usb_core_init(void);
49void usb_core_exit(void); 82void usb_core_exit(void);
50void usb_core_control_request(struct usb_ctrlrequest* req); 83void usb_core_control_request(struct usb_ctrlrequest* req);
51void usb_core_transfer_complete(int endpoint, bool in); 84void usb_core_transfer_complete(int endpoint, bool in, int status, int length);
52void usb_core_bus_reset(void); 85void usb_core_bus_reset(void);
53bool usb_core_data_connection(void); 86bool 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 @@
24void usb_drv_init(void); 24void usb_drv_init(void);
25void usb_drv_exit(void); 25void usb_drv_exit(void);
26void usb_drv_int(void); 26void usb_drv_int(void);
27void usb_drv_stall(int endpoint, bool stall); 27void usb_drv_stall(int endpoint, bool stall,bool in);
28bool usb_drv_stalled(int endpoint,bool in);
28int usb_drv_send(int endpoint, void* ptr, int length); 29int usb_drv_send(int endpoint, void* ptr, int length);
30int usb_drv_send_nonblocking(int endpoint, void* ptr, int length);
29int usb_drv_recv(int endpoint, void* ptr, int length); 31int usb_drv_recv(int endpoint, void* ptr, int length);
30void usb_drv_ack(struct usb_ctrlrequest* req); 32void usb_drv_ack(struct usb_ctrlrequest* req);
31void usb_drv_set_address(int address); 33void usb_drv_set_address(int address);
32void usb_drv_reset_endpoint(int endpoint, bool send); 34void usb_drv_reset_endpoint(int endpoint, bool send);
33void usb_drv_wait(int endpoint, bool send); 35void usb_drv_wait(int endpoint, bool send);
34bool usb_drv_powered(void); 36bool usb_drv_powered(void);
35int usb_drv_get_last_transfer_status(void);
36int usb_drv_get_last_transfer_length(void);
37int usb_drv_port_speed(void); 37int usb_drv_port_speed(void);
38void usb_drv_cancel_all_transfers(void);
38 39
39#endif 40#endif