mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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
13 changed files with 79 additions and 52 deletions
|
@ -114,7 +114,7 @@
|
||||||
|
|
||||||
#ifdef HAVE_USBSTACK
|
#ifdef HAVE_USBSTACK
|
||||||
#include "usb_core.h"
|
#include "usb_core.h"
|
||||||
#ifdef USB_HID
|
#ifdef USB_ENABLE_HID
|
||||||
#include "usbstack/usb_hid.h"
|
#include "usbstack/usb_hid.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -2588,7 +2588,7 @@ static bool dbg_scrollwheel(void)
|
||||||
|
|
||||||
#if defined (HAVE_USBSTACK)
|
#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)
|
static bool toggle_usb_core_driver(int driver, char *msg)
|
||||||
{
|
{
|
||||||
bool enabled = !usb_core_driver_enabled(driver);
|
bool enabled = !usb_core_driver_enabled(driver);
|
||||||
|
@ -2605,7 +2605,7 @@ static bool toggle_usb_serial(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USB_HID
|
#ifdef USB_ENABLE_HID
|
||||||
static bool hid_send_cmd(consumer_usage_page_t cmd, char *msg)
|
static bool hid_send_cmd(consumer_usage_page_t cmd, char *msg)
|
||||||
{
|
{
|
||||||
(void)msg;
|
(void)msg;
|
||||||
|
@ -2786,10 +2786,10 @@ static const struct the_menu_item menuitems[] = {
|
||||||
{"logfdump", logfdump },
|
{"logfdump", logfdump },
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_USBSTACK)
|
#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 },
|
{"USB Serial driver (logf)", toggle_usb_serial },
|
||||||
#endif
|
#endif
|
||||||
#if defined(USB_HID)
|
#if defined(USB_ENABLE_HID)
|
||||||
{"USB HID play/pause", usb_hid_send_play_pause },
|
{"USB HID play/pause", usb_hid_send_play_pause },
|
||||||
{"USB HID stop", usb_hid_send_stop },
|
{"USB HID stop", usb_hid_send_stop },
|
||||||
{"USB HID prev track", usb_hid_send_scan_previous_track },
|
{"USB HID prev track", usb_hid_send_scan_previous_track },
|
||||||
|
|
|
@ -257,10 +257,18 @@ drivers/audio/mas35xx.c
|
||||||
#if !defined(SIMULATOR)
|
#if !defined(SIMULATOR)
|
||||||
#ifdef HAVE_USBSTACK
|
#ifdef HAVE_USBSTACK
|
||||||
usbstack/usb_core.c
|
usbstack/usb_core.c
|
||||||
|
#ifdef USB_ENABLE_STORAGE
|
||||||
usbstack/usb_storage.c
|
usbstack/usb_storage.c
|
||||||
|
#endif
|
||||||
|
#ifdef USB_ENABLE_SERIAL
|
||||||
usbstack/usb_serial.c
|
usbstack/usb_serial.c
|
||||||
|
#endif
|
||||||
|
#ifdef USB_ENABLE_CHARGING_ONLY
|
||||||
usbstack/usb_charging_only.c
|
usbstack/usb_charging_only.c
|
||||||
|
#endif
|
||||||
|
#ifdef USB_ENABLE_HID
|
||||||
usbstack/usb_hid.c
|
usbstack/usb_hid.c
|
||||||
|
#endif
|
||||||
#if CONFIG_USBOTG == USBOTG_ARC
|
#if CONFIG_USBOTG == USBOTG_ARC
|
||||||
target/arm/usb-drv-arc.c
|
target/arm/usb-drv-arc.c
|
||||||
#elif CONFIG_USBOTG == USBOTG_ISP1583
|
#elif CONFIG_USBOTG == USBOTG_ISP1583
|
||||||
|
|
|
@ -183,7 +183,6 @@
|
||||||
/* enable these for the usb stack */
|
/* enable these for the usb stack */
|
||||||
#define USE_ROCKBOX_USB
|
#define USE_ROCKBOX_USB
|
||||||
#define HAVE_USBSTACK
|
#define HAVE_USBSTACK
|
||||||
#define USB_STORAGE
|
|
||||||
/* usb stack and driver settings */
|
/* usb stack and driver settings */
|
||||||
#define USB_PORTSCX_PHY_TYPE PORTSCX_PTS_ULPI
|
#define USB_PORTSCX_PHY_TYPE PORTSCX_PTS_ULPI
|
||||||
#define USB_VENDOR_ID 0x0930
|
#define USB_VENDOR_ID 0x0930
|
||||||
|
|
|
@ -66,9 +66,6 @@
|
||||||
#define HAVE_USBSTACK
|
#define HAVE_USBSTACK
|
||||||
#define USB_VENDOR_ID 0x0e21
|
#define USB_VENDOR_ID 0x0e21
|
||||||
#define USB_PRODUCT_ID 0x0750
|
#define USB_PRODUCT_ID 0x0750
|
||||||
|
|
||||||
#define USB_STORAGE
|
|
||||||
#define USB_SERIAL
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* define this if you have a flash memory storage */
|
/* define this if you have a flash memory storage */
|
||||||
|
|
|
@ -540,6 +540,7 @@ Lyre prototype 1*/
|
||||||
#endif
|
#endif
|
||||||
#endif /* HAVE_USBSTACK */
|
#endif /* HAVE_USBSTACK */
|
||||||
|
|
||||||
|
|
||||||
#endif /* BOOTLOADER */
|
#endif /* BOOTLOADER */
|
||||||
|
|
||||||
#if defined(HAVE_USBSTACK) || (CONFIG_CPU == JZ4732) \
|
#if defined(HAVE_USBSTACK) || (CONFIG_CPU == JZ4732) \
|
||||||
|
@ -756,4 +757,46 @@ Lyre prototype 1*/
|
||||||
#include <stdbool.h> /* MIPS GCC fix? */
|
#include <stdbool.h> /* MIPS GCC fix? */
|
||||||
#endif
|
#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__ */
|
#endif /* __CONFIG_H__ */
|
||||||
|
|
|
@ -21,16 +21,6 @@
|
||||||
#ifndef USB_CORE_H
|
#ifndef USB_CORE_H
|
||||||
#define 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_ch9.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ void _logf(const char *format, ...)
|
||||||
serial_tx(buf);
|
serial_tx(buf);
|
||||||
serial_tx("\r\n");
|
serial_tx("\r\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_SERIAL
|
#ifdef USB_ENABLE_SERIAL
|
||||||
usb_serial_send(buf, len);
|
usb_serial_send(buf, len);
|
||||||
usb_serial_send("\r\n", 2);
|
usb_serial_send("\r\n", 2);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
/* Conditions under which we want the entire driver */
|
/* Conditions under which we want the entire driver */
|
||||||
#if !defined(BOOTLOADER) || (CONFIG_CPU == SH7034) || \
|
#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(HAVE_USBSTACK) && (defined(CREATIVE_ZVx) || \
|
||||||
defined(CPU_TCC77X) || defined(CPU_TCC780X))) || \
|
defined(CPU_TCC77X) || defined(CPU_TCC780X))) || \
|
||||||
(CONFIG_USBOTG == USBOTG_JZ4740)
|
(CONFIG_USBOTG == USBOTG_JZ4740)
|
||||||
|
@ -270,13 +270,19 @@ static void usb_thread(void)
|
||||||
/* Only charging is desired */
|
/* Only charging is desired */
|
||||||
usb_state = USB_POWERED;
|
usb_state = USB_POWERED;
|
||||||
#ifdef HAVE_USBSTACK
|
#ifdef HAVE_USBSTACK
|
||||||
#ifdef USB_STORAGE
|
#ifdef USB_ENABLE_STORAGE
|
||||||
usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, false);
|
usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, false);
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_HID
|
|
||||||
|
#ifdef USB_ENABLE_HID
|
||||||
|
#ifdef USB_ENABLE_CHARGING_ONLY
|
||||||
usb_core_enable_driver(USB_DRIVER_HID, false);
|
usb_core_enable_driver(USB_DRIVER_HID, false);
|
||||||
#endif
|
#else
|
||||||
#ifdef USB_CHARGING_ONLY
|
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);
|
usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, true);
|
||||||
#endif
|
#endif
|
||||||
usb_attach();
|
usb_attach();
|
||||||
|
@ -291,13 +297,13 @@ static void usb_thread(void)
|
||||||
* USB_CONNECTED. */
|
* USB_CONNECTED. */
|
||||||
usb_state = USB_POWERED;
|
usb_state = USB_POWERED;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_STORAGE
|
#ifdef USB_ENABLE_STORAGE
|
||||||
usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, true);
|
usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, true);
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_HID
|
#ifdef USB_ENABLE_HID
|
||||||
usb_core_enable_driver(USB_DRIVER_HID, true);
|
usb_core_enable_driver(USB_DRIVER_HID, true);
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_CHARGING_ONLY
|
#ifdef USB_ENABLE_CHARGING_ONLY
|
||||||
usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, false);
|
usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
//#define LOGF_ENABLE
|
//#define LOGF_ENABLE
|
||||||
#include "logf.h"
|
#include "logf.h"
|
||||||
|
|
||||||
#ifdef USB_CHARGING_ONLY
|
|
||||||
|
|
||||||
/* charging_only interface */
|
/* charging_only interface */
|
||||||
static struct usb_interface_descriptor __attribute__((aligned(2)))
|
static struct usb_interface_descriptor __attribute__((aligned(2)))
|
||||||
interface_descriptor =
|
interface_descriptor =
|
||||||
|
@ -70,5 +68,3 @@ int usb_charging_only_get_config_descriptor(unsigned char *dest,int max_packet_s
|
||||||
|
|
||||||
return (dest-orig_dest);
|
return (dest-orig_dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /*USB_CHARGING_ONLY*/
|
|
||||||
|
|
|
@ -31,19 +31,19 @@
|
||||||
#include "usb_core.h"
|
#include "usb_core.h"
|
||||||
#include "usb_class_driver.h"
|
#include "usb_class_driver.h"
|
||||||
|
|
||||||
#if defined(USB_STORAGE)
|
#if defined(USB_ENABLE_STORAGE)
|
||||||
#include "usb_storage.h"
|
#include "usb_storage.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USB_SERIAL)
|
#if defined(USB_ENABLE_SERIAL)
|
||||||
#include "usb_serial.h"
|
#include "usb_serial.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USB_CHARGING_ONLY)
|
#if defined(USB_ENABLE_CHARGING_ONLY)
|
||||||
#include "usb_charging_only.h"
|
#include "usb_charging_only.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USB_HID)
|
#if defined(USB_ENABLE_HID)
|
||||||
#include "usb_hid.h"
|
#include "usb_hid.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ static struct
|
||||||
|
|
||||||
static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
||||||
{
|
{
|
||||||
#ifdef USB_STORAGE
|
#ifdef USB_ENABLE_STORAGE
|
||||||
[USB_DRIVER_MASS_STORAGE] = {
|
[USB_DRIVER_MASS_STORAGE] = {
|
||||||
.enabled = false,
|
.enabled = false,
|
||||||
.needs_exclusive_storage = true,
|
.needs_exclusive_storage = true,
|
||||||
|
@ -201,7 +201,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_SERIAL
|
#ifdef USB_ENABLE_SERIAL
|
||||||
[USB_DRIVER_SERIAL] = {
|
[USB_DRIVER_SERIAL] = {
|
||||||
.enabled = false,
|
.enabled = false,
|
||||||
.needs_exclusive_storage = false,
|
.needs_exclusive_storage = false,
|
||||||
|
@ -220,7 +220,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_CHARGING_ONLY
|
#ifdef USB_ENABLE_CHARGING_ONLY
|
||||||
[USB_DRIVER_CHARGING_ONLY] = {
|
[USB_DRIVER_CHARGING_ONLY] = {
|
||||||
.enabled = false,
|
.enabled = false,
|
||||||
.needs_exclusive_storage = false,
|
.needs_exclusive_storage = false,
|
||||||
|
@ -239,7 +239,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef USB_HID
|
#ifdef USB_ENABLE_HID
|
||||||
[USB_DRIVER_HID] = {
|
[USB_DRIVER_HID] = {
|
||||||
.enabled = false,
|
.enabled = false,
|
||||||
.needs_exclusive_storage = false,
|
.needs_exclusive_storage = false,
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
//#define LOGF_ENABLE
|
//#define LOGF_ENABLE
|
||||||
#include "logf.h"
|
#include "logf.h"
|
||||||
|
|
||||||
#ifdef USB_HID
|
|
||||||
|
|
||||||
#define CONCAT(low, high) ((high << 8) | low)
|
#define CONCAT(low, high) ((high << 8) | low)
|
||||||
#define PACK_VAL1(dest, val) *(dest)++ = (val) & 0xff
|
#define PACK_VAL1(dest, val) *(dest)++ = (val) & 0xff
|
||||||
#define PACK_VAL2(dest, val) PACK_VAL1((dest), (val)); \
|
#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();
|
usb_hid_try_send_drv();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /*USB_HID*/
|
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
//#define LOGF_ENABLE
|
//#define LOGF_ENABLE
|
||||||
#include "logf.h"
|
#include "logf.h"
|
||||||
|
|
||||||
#ifdef USB_SERIAL
|
|
||||||
|
|
||||||
/* serial interface */
|
/* serial interface */
|
||||||
static struct usb_interface_descriptor __attribute__((aligned(2)))
|
static struct usb_interface_descriptor __attribute__((aligned(2)))
|
||||||
interface_descriptor =
|
interface_descriptor =
|
||||||
|
@ -240,5 +238,3 @@ void usb_serial_transfer_complete(int ep,int dir, int status, int length)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /*USB_SERIAL*/
|
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
#include "usb_storage.h"
|
#include "usb_storage.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef USB_STORAGE
|
|
||||||
|
|
||||||
/* Enable the following define to export only the SD card slot. This
|
/* Enable the following define to export only the SD card slot. This
|
||||||
* is useful for USBCV MSC tests, as those are destructive.
|
* is useful for USBCV MSC tests, as those are destructive.
|
||||||
* This won't work right if the device doesn't have a card slot.
|
* 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;
|
tb.inquiry->DeviceTypeModifier = DEVICE_REMOVABLE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* USB_STORAGE */
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue