diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 8 | ||||
-rw-r--r-- | firmware/export/config-gigabeat-s.h | 1 | ||||
-rw-r--r-- | firmware/export/config-iaudio7.h | 3 | ||||
-rw-r--r-- | firmware/export/config.h | 43 | ||||
-rw-r--r-- | firmware/export/usb_core.h | 10 | ||||
-rw-r--r-- | firmware/logf.c | 2 | ||||
-rw-r--r-- | firmware/usb.c | 22 | ||||
-rw-r--r-- | firmware/usbstack/usb_charging_only.c | 4 | ||||
-rw-r--r-- | firmware/usbstack/usb_core.c | 16 | ||||
-rw-r--r-- | firmware/usbstack/usb_hid.c | 4 | ||||
-rw-r--r-- | firmware/usbstack/usb_serial.c | 4 | ||||
-rw-r--r-- | firmware/usbstack/usb_storage.c | 4 |
12 files changed, 74 insertions, 47 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 7a00bb903a..a3bc4f2a1f 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -257,10 +257,18 @@ drivers/audio/mas35xx.c | |||
257 | #if !defined(SIMULATOR) | 257 | #if !defined(SIMULATOR) |
258 | #ifdef HAVE_USBSTACK | 258 | #ifdef HAVE_USBSTACK |
259 | usbstack/usb_core.c | 259 | usbstack/usb_core.c |
260 | #ifdef USB_ENABLE_STORAGE | ||
260 | usbstack/usb_storage.c | 261 | usbstack/usb_storage.c |
262 | #endif | ||
263 | #ifdef USB_ENABLE_SERIAL | ||
261 | usbstack/usb_serial.c | 264 | usbstack/usb_serial.c |
265 | #endif | ||
266 | #ifdef USB_ENABLE_CHARGING_ONLY | ||
262 | usbstack/usb_charging_only.c | 267 | usbstack/usb_charging_only.c |
268 | #endif | ||
269 | #ifdef USB_ENABLE_HID | ||
263 | usbstack/usb_hid.c | 270 | usbstack/usb_hid.c |
271 | #endif | ||
264 | #if CONFIG_USBOTG == USBOTG_ARC | 272 | #if CONFIG_USBOTG == USBOTG_ARC |
265 | target/arm/usb-drv-arc.c | 273 | target/arm/usb-drv-arc.c |
266 | #elif CONFIG_USBOTG == USBOTG_ISP1583 | 274 | #elif CONFIG_USBOTG == USBOTG_ISP1583 |
diff --git a/firmware/export/config-gigabeat-s.h b/firmware/export/config-gigabeat-s.h index d122edbf74..015e863fc9 100644 --- a/firmware/export/config-gigabeat-s.h +++ b/firmware/export/config-gigabeat-s.h | |||
@@ -183,7 +183,6 @@ | |||
183 | /* enable these for the usb stack */ | 183 | /* enable these for the usb stack */ |
184 | #define USE_ROCKBOX_USB | 184 | #define USE_ROCKBOX_USB |
185 | #define HAVE_USBSTACK | 185 | #define HAVE_USBSTACK |
186 | #define USB_STORAGE | ||
187 | /* usb stack and driver settings */ | 186 | /* usb stack and driver settings */ |
188 | #define USB_PORTSCX_PHY_TYPE PORTSCX_PTS_ULPI | 187 | #define USB_PORTSCX_PHY_TYPE PORTSCX_PTS_ULPI |
189 | #define USB_VENDOR_ID 0x0930 | 188 | #define USB_VENDOR_ID 0x0930 |
diff --git a/firmware/export/config-iaudio7.h b/firmware/export/config-iaudio7.h index 8886b18633..1e7c42258c 100644 --- a/firmware/export/config-iaudio7.h +++ b/firmware/export/config-iaudio7.h | |||
@@ -66,9 +66,6 @@ | |||
66 | #define HAVE_USBSTACK | 66 | #define HAVE_USBSTACK |
67 | #define USB_VENDOR_ID 0x0e21 | 67 | #define USB_VENDOR_ID 0x0e21 |
68 | #define USB_PRODUCT_ID 0x0750 | 68 | #define USB_PRODUCT_ID 0x0750 |
69 | |||
70 | #define USB_STORAGE | ||
71 | #define USB_SERIAL | ||
72 | #endif | 69 | #endif |
73 | 70 | ||
74 | /* define this if you have a flash memory storage */ | 71 | /* define this if you have a flash memory storage */ |
diff --git a/firmware/export/config.h b/firmware/export/config.h index efaf326384..abc159e13c 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -540,6 +540,7 @@ Lyre prototype 1*/ | |||
540 | #endif | 540 | #endif |
541 | #endif /* HAVE_USBSTACK */ | 541 | #endif /* HAVE_USBSTACK */ |
542 | 542 | ||
543 | |||
543 | #endif /* BOOTLOADER */ | 544 | #endif /* BOOTLOADER */ |
544 | 545 | ||
545 | #if defined(HAVE_USBSTACK) || (CONFIG_CPU == JZ4732) \ | 546 | #if defined(HAVE_USBSTACK) || (CONFIG_CPU == JZ4732) \ |
@@ -756,4 +757,46 @@ Lyre prototype 1*/ | |||
756 | #include <stdbool.h> /* MIPS GCC fix? */ | 757 | #include <stdbool.h> /* MIPS GCC fix? */ |
757 | #endif | 758 | #endif |
758 | 759 | ||
760 | #if defined(HAVE_USBSTACK) | ||
761 | /* Define the implemented USB transport classes */ | ||
762 | #if CONFIG_USBOTG == USBOTG_ISP1583 | ||
763 | #define USB_HAS_BULK | ||
764 | #elif CONFIG_USBOTG == USBOTG_ARC | ||
765 | #define USB_HAS_BULK | ||
766 | #define USB_HAS_INTERRUPT | ||
767 | #elif CONFIG_USBOTG == USBOTG_JZ4740 | ||
768 | #define USB_HAS_BULK | ||
769 | #define USB_HAS_INTERRUPT | ||
770 | #elif defined(CPU_TCC780X) || defined(define CPU_TCC77X) | ||
771 | #define USB_HAS_BULK | ||
772 | #endif /* CONFIG_USBOTG */ | ||
773 | |||
774 | /* define the class drivers to enable */ | ||
775 | #ifndef BOOTLOADER | ||
776 | |||
777 | //#define USB_ENABLE_SERIAL | ||
778 | #define USB_ENABLE_STORAGE | ||
779 | |||
780 | #ifdef USB_HAS_INTERRUPT | ||
781 | #define USB_ENABLE_HID | ||
782 | #else | ||
783 | #define USB_ENABLE_CHARGING_ONLY | ||
784 | #endif | ||
785 | |||
786 | #else /* BOOTLOADER */ | ||
787 | |||
788 | /* enable usb storage for targets that do bootloader usb */ | ||
789 | #if (defined(TOSHIBA_GIGABEAT_S) && defined(USE_ROCKBOX_USB) && defined(USB_STORAGE)) || \ | ||
790 | (defined(HAVE_USBSTACK) && (defined(CREATIVE_ZVx) || \ | ||
791 | defined(CPU_TCC77X) || defined(CPU_TCC780X))) || \ | ||
792 | (CONFIG_USBOTG == USBOTG_JZ4740) | ||
793 | #define USB_ENABLE_STORAGE | ||
794 | #endif | ||
795 | |||
796 | #endif /* BOOTLOADER */ | ||
797 | |||
798 | #endif /* HAVE_USBSTACK */ | ||
799 | |||
800 | |||
801 | |||
759 | #endif /* __CONFIG_H__ */ | 802 | #endif /* __CONFIG_H__ */ |
diff --git a/firmware/export/usb_core.h b/firmware/export/usb_core.h index 9c105fbc7c..c65be5fa3c 100644 --- a/firmware/export/usb_core.h +++ b/firmware/export/usb_core.h | |||
@@ -21,16 +21,6 @@ | |||
21 | #ifndef USB_CORE_H | 21 | #ifndef USB_CORE_H |
22 | #define USB_CORE_H | 22 | #define USB_CORE_H |
23 | 23 | ||
24 | #ifndef BOOTLOADER | ||
25 | |||
26 | //#define USB_SERIAL | ||
27 | #define USB_STORAGE | ||
28 | #define USB_CHARGING_ONLY | ||
29 | //#define USB_HID | ||
30 | #else /* BOOTLOADER */ | ||
31 | #define USB_CHARGING_ONLY | ||
32 | #endif /* BOOTLOADER */ | ||
33 | |||
34 | #include "usb_ch9.h" | 24 | #include "usb_ch9.h" |
35 | #include "usb.h" | 25 | #include "usb.h" |
36 | 26 | ||
diff --git a/firmware/logf.c b/firmware/logf.c index 75aaf31e64..a704ad2d67 100644 --- a/firmware/logf.c +++ b/firmware/logf.c | |||
@@ -135,7 +135,7 @@ void _logf(const char *format, ...) | |||
135 | serial_tx(buf); | 135 | serial_tx(buf); |
136 | serial_tx("\r\n"); | 136 | serial_tx("\r\n"); |
137 | #endif | 137 | #endif |
138 | #ifdef USB_SERIAL | 138 | #ifdef USB_ENABLE_SERIAL |
139 | usb_serial_send(buf, len); | 139 | usb_serial_send(buf, len); |
140 | usb_serial_send("\r\n", 2); | 140 | usb_serial_send("\r\n", 2); |
141 | #endif | 141 | #endif |
diff --git a/firmware/usb.c b/firmware/usb.c index f115a92407..f918f19bc4 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | /* Conditions under which we want the entire driver */ | 48 | /* Conditions under which we want the entire driver */ |
49 | #if !defined(BOOTLOADER) || (CONFIG_CPU == SH7034) || \ | 49 | #if !defined(BOOTLOADER) || (CONFIG_CPU == SH7034) || \ |
50 | (defined(TOSHIBA_GIGABEAT_S) && defined(USE_ROCKBOX_USB) && defined(USB_STORAGE)) || \ | 50 | (defined(TOSHIBA_GIGABEAT_S) && defined(USE_ROCKBOX_USB) && defined(USB_ENABLE_STORAGE)) || \ |
51 | (defined(HAVE_USBSTACK) && (defined(CREATIVE_ZVx) || \ | 51 | (defined(HAVE_USBSTACK) && (defined(CREATIVE_ZVx) || \ |
52 | defined(CPU_TCC77X) || defined(CPU_TCC780X))) || \ | 52 | defined(CPU_TCC77X) || defined(CPU_TCC780X))) || \ |
53 | (CONFIG_USBOTG == USBOTG_JZ4740) | 53 | (CONFIG_USBOTG == USBOTG_JZ4740) |
@@ -270,13 +270,19 @@ static void usb_thread(void) | |||
270 | /* Only charging is desired */ | 270 | /* Only charging is desired */ |
271 | usb_state = USB_POWERED; | 271 | usb_state = USB_POWERED; |
272 | #ifdef HAVE_USBSTACK | 272 | #ifdef HAVE_USBSTACK |
273 | #ifdef USB_STORAGE | 273 | #ifdef USB_ENABLE_STORAGE |
274 | usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, false); | 274 | usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, false); |
275 | #endif | 275 | #endif |
276 | #ifdef USB_HID | 276 | |
277 | #ifdef USB_ENABLE_HID | ||
278 | #ifdef USB_ENABLE_CHARGING_ONLY | ||
277 | usb_core_enable_driver(USB_DRIVER_HID, false); | 279 | usb_core_enable_driver(USB_DRIVER_HID, false); |
278 | #endif | 280 | #else |
279 | #ifdef USB_CHARGING_ONLY | 281 | usb_core_enable_driver(USB_DRIVER_HID, true); |
282 | #endif /* USB_ENABLE_CHARGING_ONLY */ | ||
283 | #endif /* USB_ENABLE_HID */ | ||
284 | |||
285 | #ifdef USB_ENABLE_CHARGING_ONLY | ||
280 | usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, true); | 286 | usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, true); |
281 | #endif | 287 | #endif |
282 | usb_attach(); | 288 | usb_attach(); |
@@ -291,13 +297,13 @@ static void usb_thread(void) | |||
291 | * USB_CONNECTED. */ | 297 | * USB_CONNECTED. */ |
292 | usb_state = USB_POWERED; | 298 | usb_state = USB_POWERED; |
293 | #endif | 299 | #endif |
294 | #ifdef USB_STORAGE | 300 | #ifdef USB_ENABLE_STORAGE |
295 | usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, true); | 301 | usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, true); |
296 | #endif | 302 | #endif |
297 | #ifdef USB_HID | 303 | #ifdef USB_ENABLE_HID |
298 | usb_core_enable_driver(USB_DRIVER_HID, true); | 304 | usb_core_enable_driver(USB_DRIVER_HID, true); |
299 | #endif | 305 | #endif |
300 | #ifdef USB_CHARGING_ONLY | 306 | #ifdef USB_ENABLE_CHARGING_ONLY |
301 | usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, false); | 307 | usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, false); |
302 | #endif | 308 | #endif |
303 | 309 | ||
diff --git a/firmware/usbstack/usb_charging_only.c b/firmware/usbstack/usb_charging_only.c index fc6139c1ae..8dd9fdf742 100644 --- a/firmware/usbstack/usb_charging_only.c +++ b/firmware/usbstack/usb_charging_only.c | |||
@@ -29,8 +29,6 @@ | |||
29 | //#define LOGF_ENABLE | 29 | //#define LOGF_ENABLE |
30 | #include "logf.h" | 30 | #include "logf.h" |
31 | 31 | ||
32 | #ifdef USB_CHARGING_ONLY | ||
33 | |||
34 | /* charging_only interface */ | 32 | /* charging_only interface */ |
35 | static struct usb_interface_descriptor __attribute__((aligned(2))) | 33 | static struct usb_interface_descriptor __attribute__((aligned(2))) |
36 | interface_descriptor = | 34 | interface_descriptor = |
@@ -70,5 +68,3 @@ int usb_charging_only_get_config_descriptor(unsigned char *dest,int max_packet_s | |||
70 | 68 | ||
71 | return (dest-orig_dest); | 69 | return (dest-orig_dest); |
72 | } | 70 | } |
73 | |||
74 | #endif /*USB_CHARGING_ONLY*/ | ||
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index 81333fe0d2..c4450af964 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c | |||
@@ -31,19 +31,19 @@ | |||
31 | #include "usb_core.h" | 31 | #include "usb_core.h" |
32 | #include "usb_class_driver.h" | 32 | #include "usb_class_driver.h" |
33 | 33 | ||
34 | #if defined(USB_STORAGE) | 34 | #if defined(USB_ENABLE_STORAGE) |
35 | #include "usb_storage.h" | 35 | #include "usb_storage.h" |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #if defined(USB_SERIAL) | 38 | #if defined(USB_ENABLE_SERIAL) |
39 | #include "usb_serial.h" | 39 | #include "usb_serial.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #if defined(USB_CHARGING_ONLY) | 42 | #if defined(USB_ENABLE_CHARGING_ONLY) |
43 | #include "usb_charging_only.h" | 43 | #include "usb_charging_only.h" |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #if defined(USB_HID) | 46 | #if defined(USB_ENABLE_HID) |
47 | #include "usb_hid.h" | 47 | #include "usb_hid.h" |
48 | #endif | 48 | #endif |
49 | 49 | ||
@@ -182,7 +182,7 @@ static struct | |||
182 | 182 | ||
183 | static struct usb_class_driver drivers[USB_NUM_DRIVERS] = | 183 | static struct usb_class_driver drivers[USB_NUM_DRIVERS] = |
184 | { | 184 | { |
185 | #ifdef USB_STORAGE | 185 | #ifdef USB_ENABLE_STORAGE |
186 | [USB_DRIVER_MASS_STORAGE] = { | 186 | [USB_DRIVER_MASS_STORAGE] = { |
187 | .enabled = false, | 187 | .enabled = false, |
188 | .needs_exclusive_storage = true, | 188 | .needs_exclusive_storage = true, |
@@ -201,7 +201,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] = | |||
201 | #endif | 201 | #endif |
202 | }, | 202 | }, |
203 | #endif | 203 | #endif |
204 | #ifdef USB_SERIAL | 204 | #ifdef USB_ENABLE_SERIAL |
205 | [USB_DRIVER_SERIAL] = { | 205 | [USB_DRIVER_SERIAL] = { |
206 | .enabled = false, | 206 | .enabled = false, |
207 | .needs_exclusive_storage = false, | 207 | .needs_exclusive_storage = false, |
@@ -220,7 +220,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] = | |||
220 | #endif | 220 | #endif |
221 | }, | 221 | }, |
222 | #endif | 222 | #endif |
223 | #ifdef USB_CHARGING_ONLY | 223 | #ifdef USB_ENABLE_CHARGING_ONLY |
224 | [USB_DRIVER_CHARGING_ONLY] = { | 224 | [USB_DRIVER_CHARGING_ONLY] = { |
225 | .enabled = false, | 225 | .enabled = false, |
226 | .needs_exclusive_storage = false, | 226 | .needs_exclusive_storage = false, |
@@ -239,7 +239,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] = | |||
239 | #endif | 239 | #endif |
240 | }, | 240 | }, |
241 | #endif | 241 | #endif |
242 | #ifdef USB_HID | 242 | #ifdef USB_ENABLE_HID |
243 | [USB_DRIVER_HID] = { | 243 | [USB_DRIVER_HID] = { |
244 | .enabled = false, | 244 | .enabled = false, |
245 | .needs_exclusive_storage = false, | 245 | .needs_exclusive_storage = false, |
diff --git a/firmware/usbstack/usb_hid.c b/firmware/usbstack/usb_hid.c index 0c35da2acb..31554eed48 100644 --- a/firmware/usbstack/usb_hid.c +++ b/firmware/usbstack/usb_hid.c | |||
@@ -28,8 +28,6 @@ | |||
28 | //#define LOGF_ENABLE | 28 | //#define LOGF_ENABLE |
29 | #include "logf.h" | 29 | #include "logf.h" |
30 | 30 | ||
31 | #ifdef USB_HID | ||
32 | |||
33 | #define CONCAT(low, high) ((high << 8) | low) | 31 | #define CONCAT(low, high) ((high << 8) | low) |
34 | #define PACK_VAL1(dest, val) *(dest)++ = (val) & 0xff | 32 | #define PACK_VAL1(dest, val) *(dest)++ = (val) & 0xff |
35 | #define PACK_VAL2(dest, val) PACK_VAL1((dest), (val)); \ | 33 | #define PACK_VAL2(dest, val) PACK_VAL1((dest), (val)); \ |
@@ -392,5 +390,3 @@ void usb_hid_send_consumer_usage(consumer_usage_page_t id) | |||
392 | 390 | ||
393 | usb_hid_try_send_drv(); | 391 | usb_hid_try_send_drv(); |
394 | } | 392 | } |
395 | |||
396 | #endif /*USB_HID*/ | ||
diff --git a/firmware/usbstack/usb_serial.c b/firmware/usbstack/usb_serial.c index 246938a1ef..6c654ad898 100644 --- a/firmware/usbstack/usb_serial.c +++ b/firmware/usbstack/usb_serial.c | |||
@@ -28,8 +28,6 @@ | |||
28 | //#define LOGF_ENABLE | 28 | //#define LOGF_ENABLE |
29 | #include "logf.h" | 29 | #include "logf.h" |
30 | 30 | ||
31 | #ifdef USB_SERIAL | ||
32 | |||
33 | /* serial interface */ | 31 | /* serial interface */ |
34 | static struct usb_interface_descriptor __attribute__((aligned(2))) | 32 | static struct usb_interface_descriptor __attribute__((aligned(2))) |
35 | interface_descriptor = | 33 | interface_descriptor = |
@@ -240,5 +238,3 @@ void usb_serial_transfer_complete(int ep,int dir, int status, int length) | |||
240 | break; | 238 | break; |
241 | } | 239 | } |
242 | } | 240 | } |
243 | |||
244 | #endif /*USB_SERIAL*/ | ||
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index b498311014..63ff4f059b 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c | |||
@@ -33,8 +33,6 @@ | |||
33 | #include "usb_storage.h" | 33 | #include "usb_storage.h" |
34 | 34 | ||
35 | 35 | ||
36 | #ifdef USB_STORAGE | ||
37 | |||
38 | /* Enable the following define to export only the SD card slot. This | 36 | /* Enable the following define to export only the SD card slot. This |
39 | * is useful for USBCV MSC tests, as those are destructive. | 37 | * is useful for USBCV MSC tests, as those are destructive. |
40 | * This won't work right if the device doesn't have a card slot. | 38 | * This won't work right if the device doesn't have a card slot. |
@@ -1158,5 +1156,3 @@ static void fill_inquiry(IF_MV_NONVOID(int lun)) | |||
1158 | tb.inquiry->DeviceTypeModifier = DEVICE_REMOVABLE; | 1156 | tb.inquiry->DeviceTypeModifier = DEVICE_REMOVABLE; |
1159 | #endif | 1157 | #endif |
1160 | } | 1158 | } |
1161 | |||
1162 | #endif /* USB_STORAGE */ | ||