Reorganise USB stack defines. Now config.h decides which class drivers get enabled instead of usb_core.h
Also enable HID, and use that as the dummy class instead of charging-only for controllers that have working interrupt transfers. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21053 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
bca3d3dca4
commit
c61a75173b
|
@ -114,7 +114,7 @@
|
|||
|
||||
#ifdef HAVE_USBSTACK
|
||||
#include "usb_core.h"
|
||||
#ifdef USB_HID
|
||||
#ifdef USB_ENABLE_HID
|
||||
#include "usbstack/usb_hid.h"
|
||||
#endif
|
||||
#endif
|
||||
|
@ -2588,7 +2588,7 @@ static bool dbg_scrollwheel(void)
|
|||
|
||||
#if defined (HAVE_USBSTACK)
|
||||
|
||||
#if defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL)
|
||||
#if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
|
||||
static bool toggle_usb_core_driver(int driver, char *msg)
|
||||
{
|
||||
bool enabled = !usb_core_driver_enabled(driver);
|
||||
|
@ -2605,7 +2605,7 @@ static bool toggle_usb_serial(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef USB_HID
|
||||
#ifdef USB_ENABLE_HID
|
||||
static bool hid_send_cmd(consumer_usage_page_t cmd, char *msg)
|
||||
{
|
||||
(void)msg;
|
||||
|
@ -2786,10 +2786,10 @@ static const struct the_menu_item menuitems[] = {
|
|||
{"logfdump", logfdump },
|
||||
#endif
|
||||
#if defined(HAVE_USBSTACK)
|
||||
#if defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL)
|
||||
#if defined(ROCKBOX_HAS_LOGF) && defined(USB_ENABLE_SERIAL)
|
||||
{"USB Serial driver (logf)", toggle_usb_serial },
|
||||
#endif
|
||||
#if defined(USB_HID)
|
||||
#if defined(USB_ENABLE_HID)
|
||||
{"USB HID play/pause", usb_hid_send_play_pause },
|
||||
{"USB HID stop", usb_hid_send_stop },
|
||||
{"USB HID prev track", usb_hid_send_scan_previous_track },
|
||||
|
|
|
@ -257,10 +257,18 @@ drivers/audio/mas35xx.c
|
|||
#if !defined(SIMULATOR)
|
||||
#ifdef HAVE_USBSTACK
|
||||
usbstack/usb_core.c
|
||||
#ifdef USB_ENABLE_STORAGE
|
||||
usbstack/usb_storage.c
|
||||
#endif
|
||||
#ifdef USB_ENABLE_SERIAL
|
||||
usbstack/usb_serial.c
|
||||
#endif
|
||||
#ifdef USB_ENABLE_CHARGING_ONLY
|
||||
usbstack/usb_charging_only.c
|
||||
#endif
|
||||
#ifdef USB_ENABLE_HID
|
||||
usbstack/usb_hid.c
|
||||
#endif
|
||||
#if CONFIG_USBOTG == USBOTG_ARC
|
||||
target/arm/usb-drv-arc.c
|
||||
#elif CONFIG_USBOTG == USBOTG_ISP1583
|
||||
|
|
|
@ -183,7 +183,6 @@
|
|||
/* enable these for the usb stack */
|
||||
#define USE_ROCKBOX_USB
|
||||
#define HAVE_USBSTACK
|
||||
#define USB_STORAGE
|
||||
/* usb stack and driver settings */
|
||||
#define USB_PORTSCX_PHY_TYPE PORTSCX_PTS_ULPI
|
||||
#define USB_VENDOR_ID 0x0930
|
||||
|
|
|
@ -66,9 +66,6 @@
|
|||
#define HAVE_USBSTACK
|
||||
#define USB_VENDOR_ID 0x0e21
|
||||
#define USB_PRODUCT_ID 0x0750
|
||||
|
||||
#define USB_STORAGE
|
||||
#define USB_SERIAL
|
||||
#endif
|
||||
|
||||
/* define this if you have a flash memory storage */
|
||||
|
|
|
@ -540,6 +540,7 @@ Lyre prototype 1*/
|
|||
#endif
|
||||
#endif /* HAVE_USBSTACK */
|
||||
|
||||
|
||||
#endif /* BOOTLOADER */
|
||||
|
||||
#if defined(HAVE_USBSTACK) || (CONFIG_CPU == JZ4732) \
|
||||
|
@ -756,4 +757,46 @@ Lyre prototype 1*/
|
|||
#include <stdbool.h> /* MIPS GCC fix? */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_USBSTACK)
|
||||
/* Define the implemented USB transport classes */
|
||||
#if CONFIG_USBOTG == USBOTG_ISP1583
|
||||
#define USB_HAS_BULK
|
||||
#elif CONFIG_USBOTG == USBOTG_ARC
|
||||
#define USB_HAS_BULK
|
||||
#define USB_HAS_INTERRUPT
|
||||
#elif CONFIG_USBOTG == USBOTG_JZ4740
|
||||
#define USB_HAS_BULK
|
||||
#define USB_HAS_INTERRUPT
|
||||
#elif defined(CPU_TCC780X) || defined(define CPU_TCC77X)
|
||||
#define USB_HAS_BULK
|
||||
#endif /* CONFIG_USBOTG */
|
||||
|
||||
/* define the class drivers to enable */
|
||||
#ifndef BOOTLOADER
|
||||
|
||||
//#define USB_ENABLE_SERIAL
|
||||
#define USB_ENABLE_STORAGE
|
||||
|
||||
#ifdef USB_HAS_INTERRUPT
|
||||
#define USB_ENABLE_HID
|
||||
#else
|
||||
#define USB_ENABLE_CHARGING_ONLY
|
||||
#endif
|
||||
|
||||
#else /* BOOTLOADER */
|
||||
|
||||
/* enable usb storage for targets that do bootloader usb */
|
||||
#if (defined(TOSHIBA_GIGABEAT_S) && defined(USE_ROCKBOX_USB) && defined(USB_STORAGE)) || \
|
||||
(defined(HAVE_USBSTACK) && (defined(CREATIVE_ZVx) || \
|
||||
defined(CPU_TCC77X) || defined(CPU_TCC780X))) || \
|
||||
(CONFIG_USBOTG == USBOTG_JZ4740)
|
||||
#define USB_ENABLE_STORAGE
|
||||
#endif
|
||||
|
||||
#endif /* BOOTLOADER */
|
||||
|
||||
#endif /* HAVE_USBSTACK */
|
||||
|
||||
|
||||
|
||||
#endif /* __CONFIG_H__ */
|
||||
|
|
|
@ -21,16 +21,6 @@
|
|||
#ifndef USB_CORE_H
|
||||
#define USB_CORE_H
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
|
||||
//#define USB_SERIAL
|
||||
#define USB_STORAGE
|
||||
#define USB_CHARGING_ONLY
|
||||
//#define USB_HID
|
||||
#else /* BOOTLOADER */
|
||||
#define USB_CHARGING_ONLY
|
||||
#endif /* BOOTLOADER */
|
||||
|
||||
#include "usb_ch9.h"
|
||||
#include "usb.h"
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ void _logf(const char *format, ...)
|
|||
serial_tx(buf);
|
||||
serial_tx("\r\n");
|
||||
#endif
|
||||
#ifdef USB_SERIAL
|
||||
#ifdef USB_ENABLE_SERIAL
|
||||
usb_serial_send(buf, len);
|
||||
usb_serial_send("\r\n", 2);
|
||||
#endif
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
/* Conditions under which we want the entire driver */
|
||||
#if !defined(BOOTLOADER) || (CONFIG_CPU == SH7034) || \
|
||||
(defined(TOSHIBA_GIGABEAT_S) && defined(USE_ROCKBOX_USB) && defined(USB_STORAGE)) || \
|
||||
(defined(TOSHIBA_GIGABEAT_S) && defined(USE_ROCKBOX_USB) && defined(USB_ENABLE_STORAGE)) || \
|
||||
(defined(HAVE_USBSTACK) && (defined(CREATIVE_ZVx) || \
|
||||
defined(CPU_TCC77X) || defined(CPU_TCC780X))) || \
|
||||
(CONFIG_USBOTG == USBOTG_JZ4740)
|
||||
|
@ -270,13 +270,19 @@ static void usb_thread(void)
|
|||
/* Only charging is desired */
|
||||
usb_state = USB_POWERED;
|
||||
#ifdef HAVE_USBSTACK
|
||||
#ifdef USB_STORAGE
|
||||
#ifdef USB_ENABLE_STORAGE
|
||||
usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, false);
|
||||
#endif
|
||||
#ifdef USB_HID
|
||||
|
||||
#ifdef USB_ENABLE_HID
|
||||
#ifdef USB_ENABLE_CHARGING_ONLY
|
||||
usb_core_enable_driver(USB_DRIVER_HID, false);
|
||||
#endif
|
||||
#ifdef USB_CHARGING_ONLY
|
||||
#else
|
||||
usb_core_enable_driver(USB_DRIVER_HID, true);
|
||||
#endif /* USB_ENABLE_CHARGING_ONLY */
|
||||
#endif /* USB_ENABLE_HID */
|
||||
|
||||
#ifdef USB_ENABLE_CHARGING_ONLY
|
||||
usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, true);
|
||||
#endif
|
||||
usb_attach();
|
||||
|
@ -291,13 +297,13 @@ static void usb_thread(void)
|
|||
* USB_CONNECTED. */
|
||||
usb_state = USB_POWERED;
|
||||
#endif
|
||||
#ifdef USB_STORAGE
|
||||
#ifdef USB_ENABLE_STORAGE
|
||||
usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, true);
|
||||
#endif
|
||||
#ifdef USB_HID
|
||||
#ifdef USB_ENABLE_HID
|
||||
usb_core_enable_driver(USB_DRIVER_HID, true);
|
||||
#endif
|
||||
#ifdef USB_CHARGING_ONLY
|
||||
#ifdef USB_ENABLE_CHARGING_ONLY
|
||||
usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, false);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
//#define LOGF_ENABLE
|
||||
#include "logf.h"
|
||||
|
||||
#ifdef USB_CHARGING_ONLY
|
||||
|
||||
/* charging_only interface */
|
||||
static struct usb_interface_descriptor __attribute__((aligned(2)))
|
||||
interface_descriptor =
|
||||
|
@ -70,5 +68,3 @@ int usb_charging_only_get_config_descriptor(unsigned char *dest,int max_packet_s
|
|||
|
||||
return (dest-orig_dest);
|
||||
}
|
||||
|
||||
#endif /*USB_CHARGING_ONLY*/
|
||||
|
|
|
@ -31,19 +31,19 @@
|
|||
#include "usb_core.h"
|
||||
#include "usb_class_driver.h"
|
||||
|
||||
#if defined(USB_STORAGE)
|
||||
#if defined(USB_ENABLE_STORAGE)
|
||||
#include "usb_storage.h"
|
||||
#endif
|
||||
|
||||
#if defined(USB_SERIAL)
|
||||
#if defined(USB_ENABLE_SERIAL)
|
||||
#include "usb_serial.h"
|
||||
#endif
|
||||
|
||||
#if defined(USB_CHARGING_ONLY)
|
||||
#if defined(USB_ENABLE_CHARGING_ONLY)
|
||||
#include "usb_charging_only.h"
|
||||
#endif
|
||||
|
||||
#if defined(USB_HID)
|
||||
#if defined(USB_ENABLE_HID)
|
||||
#include "usb_hid.h"
|
||||
#endif
|
||||
|
||||
|
@ -182,7 +182,7 @@ static struct
|
|||
|
||||
static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
||||
{
|
||||
#ifdef USB_STORAGE
|
||||
#ifdef USB_ENABLE_STORAGE
|
||||
[USB_DRIVER_MASS_STORAGE] = {
|
||||
.enabled = false,
|
||||
.needs_exclusive_storage = true,
|
||||
|
@ -201,7 +201,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
|||
#endif
|
||||
},
|
||||
#endif
|
||||
#ifdef USB_SERIAL
|
||||
#ifdef USB_ENABLE_SERIAL
|
||||
[USB_DRIVER_SERIAL] = {
|
||||
.enabled = false,
|
||||
.needs_exclusive_storage = false,
|
||||
|
@ -220,7 +220,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
|||
#endif
|
||||
},
|
||||
#endif
|
||||
#ifdef USB_CHARGING_ONLY
|
||||
#ifdef USB_ENABLE_CHARGING_ONLY
|
||||
[USB_DRIVER_CHARGING_ONLY] = {
|
||||
.enabled = false,
|
||||
.needs_exclusive_storage = false,
|
||||
|
@ -239,7 +239,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
|||
#endif
|
||||
},
|
||||
#endif
|
||||
#ifdef USB_HID
|
||||
#ifdef USB_ENABLE_HID
|
||||
[USB_DRIVER_HID] = {
|
||||
.enabled = false,
|
||||
.needs_exclusive_storage = false,
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
//#define LOGF_ENABLE
|
||||
#include "logf.h"
|
||||
|
||||
#ifdef USB_HID
|
||||
|
||||
#define CONCAT(low, high) ((high << 8) | low)
|
||||
#define PACK_VAL1(dest, val) *(dest)++ = (val) & 0xff
|
||||
#define PACK_VAL2(dest, val) PACK_VAL1((dest), (val)); \
|
||||
|
@ -392,5 +390,3 @@ void usb_hid_send_consumer_usage(consumer_usage_page_t id)
|
|||
|
||||
usb_hid_try_send_drv();
|
||||
}
|
||||
|
||||
#endif /*USB_HID*/
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
//#define LOGF_ENABLE
|
||||
#include "logf.h"
|
||||
|
||||
#ifdef USB_SERIAL
|
||||
|
||||
/* serial interface */
|
||||
static struct usb_interface_descriptor __attribute__((aligned(2)))
|
||||
interface_descriptor =
|
||||
|
@ -240,5 +238,3 @@ void usb_serial_transfer_complete(int ep,int dir, int status, int length)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*USB_SERIAL*/
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
#include "usb_storage.h"
|
||||
|
||||
|
||||
#ifdef USB_STORAGE
|
||||
|
||||
/* Enable the following define to export only the SD card slot. This
|
||||
* is useful for USBCV MSC tests, as those are destructive.
|
||||
* 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))
|
|||
tb.inquiry->DeviceTypeModifier = DEVICE_REMOVABLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* USB_STORAGE */
|
||||
|
|
Loading…
Reference in New Issue