remove usb_benchmark. Its usefulness is extremely limited, and the usb stack around it is moving fast, so it's likely to suffer from bit rot very soon.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16500 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Frank Gevaerts 2008-03-03 17:59:58 +00:00
parent c270b7a289
commit f8a5a40301
6 changed files with 2 additions and 246 deletions

View file

@ -234,7 +234,6 @@ drivers/audio/mas35xx.c
usbstack/usb_core.c
usbstack/usb_storage.c
usbstack/usb_serial.c
usbstack/usb_benchmark.c
#ifdef CPU_PP502x
target/arm/usb-drv-pp502x.c
#endif

View file

@ -69,8 +69,7 @@ enum {
enum {
USB_DRIVER_MASS_STORAGE,
USB_DRIVER_SERIAL,
USB_DRIVER_CHARGING_ONLY,
USB_DRIVER_COUNT
USB_DRIVER_CHARGING_ONLY
};
#endif
#ifdef HAVE_USBSTACK

View file

@ -22,7 +22,6 @@
#ifndef BOOTLOADER
//#define USB_SERIAL
//#define USB_BENCHMARK
#define USB_STORAGE
#define USB_CHARGING_ONLY
#else /* BOOTLOADER */
@ -32,11 +31,6 @@
#include "usb_ch9.h"
#include "usb.h"
#if defined(CPU_PP)
#define USB_IRAM_ORIGIN ((unsigned char *)0x4000c000)
#define USB_IRAM_SIZE ((size_t)0xc000)
#endif
/* endpoints */
enum {
EP_CONTROL = 0,
@ -48,9 +42,6 @@ enum {
#endif
#ifdef USB_CHARGING_ONLY
EP_CHARGING_ONLY,
#endif
#ifdef USB_BENCHMARK
EP_BENCHMARK,
#endif
NUM_ENDPOINTS
};

View file

@ -1,128 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: $
*
* Copyright (C) 2007 by Björn Stenberg
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "system.h"
#include "usb_core.h"
#include "usb_drv.h"
//#define LOGF_ENABLE
#include "logf.h"
#ifdef USB_BENCHMARK
static int current_length;
static unsigned char _input_buffer[16384];
static unsigned char* input_buffer = USB_IRAM_ORIGIN + 1024;
static void ack_control(struct usb_ctrlrequest* req);
static enum {
IDLE,
SENDING,
RECEIVING
} state = IDLE;
void usb_benchmark_init(void)
{
int i;
for (i=0; i<128; i++)
input_buffer[i] = i;
}
void usb_benchmark_control_request(struct usb_ctrlrequest* req)
{
int todo;
//usb_max_pkt_size = sizeof _input_buffer;
usb_max_pkt_size = 64;
switch (req->bRequest) {
case 1: /* read */
ack_control(req);
current_length = req->wValue * req->wIndex;
logf("bench: read %d", current_length);
todo = MIN(usb_max_pkt_size, current_length);
state = SENDING;
usb_drv_reset_endpoint(EP_BENCHMARK, true);
usb_drv_send(EP_BENCHMARK, &input_buffer, todo);
current_length -= todo;
break;
case 2: /* write */
ack_control(req);
current_length = req->wValue * req->wIndex;
logf("bench: write %d", current_length);
state = RECEIVING;
usb_drv_reset_endpoint(EP_BENCHMARK, false);
usb_drv_recv(EP_BENCHMARK, &input_buffer, sizeof _input_buffer);
break;
}
}
void usb_benchmark_transfer_complete(bool in)
{
(void)in;
/* see what remains to transfer */
if (current_length == 0) {
logf("we're done");
state = IDLE;
return; /* we're done */
}
switch (state)
{
case SENDING: {
int todo = MIN(usb_max_pkt_size, current_length);
if (in == false) {
logf("unexpected ep_rx");
break;
}
logf("bench: %d more tx", current_length);
usb_drv_send(EP_BENCHMARK, &input_buffer, todo);
current_length -= todo;
input_buffer[0]++;
break;
}
case RECEIVING:
if (in == true) {
logf("unexpected ep_tx");
break;
}
/* re-prime endpoint */
usb_drv_recv(EP_BENCHMARK, &input_buffer, sizeof _input_buffer);
input_buffer[0]++;
break;
default:
break;
}
}
static void ack_control(struct usb_ctrlrequest* req)
{
if (req->bRequestType & 0x80)
usb_drv_recv(EP_CONTROL, NULL, 0);
else
usb_drv_send(EP_CONTROL, NULL, 0);
}
#endif /*USB_BENCHMARK*/

View file

@ -1,26 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: $
*
* Copyright (C) 2007 by Björn Stenberg
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef USB_BENCHMARK_H
#define USB_BENCHMARK_H
void usb_benchmark_init(void);
void usb_benchmark_control_request(struct usb_ctrlrequest* req);
void usb_benchmark_transfer_complete(bool in);
#endif

View file

@ -36,10 +36,6 @@
#include "usb_serial.h"
#endif
#if defined(USB_BENCHMARK)
#include "usb_benchmark.h"
#endif
/* TODO: Move this target-specific stuff somewhere else (serial number reading) */
#ifdef HAVE_AS3514
@ -103,7 +99,7 @@ struct usb_interface_descriptor __attribute__((aligned(2))) charging_interface_d
.bInterfaceClass = USB_CLASS_VENDOR_SPEC,
.bInterfaceSubClass = 0,
.bInterfaceProtocol = 0,
.iInterface = 5
.iInterface = 4
};
#endif
@ -177,41 +173,6 @@ struct usb_endpoint_descriptor __attribute__((aligned(2))) serial_ep_out_descrip
};
#endif
#ifdef USB_BENCHMARK
/* bulk test interface */
struct usb_interface_descriptor __attribute__((aligned(2))) benchmark_interface_descriptor =
{
.bLength = sizeof(struct usb_interface_descriptor),
.bDescriptorType = USB_DT_INTERFACE,
.bInterfaceNumber = 0,
.bAlternateSetting = 0,
.bNumEndpoints = 2,
.bInterfaceClass = USB_CLASS_VENDOR_SPEC,
.bInterfaceSubClass = 255,
.bInterfaceProtocol = 255,
.iInterface = 4
};
struct usb_endpoint_descriptor __attribute__((aligned(2))) benchmark_ep_in_descriptor =
{
.bLength = sizeof(struct usb_endpoint_descriptor),
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = EP_BENCHMARK | USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = 16,
.bInterval = 0
};
struct usb_endpoint_descriptor benchmark_ep_out_descriptor =
{
.bLength = sizeof(struct usb_endpoint_descriptor),
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = EP_BENCHMARK | USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = 16,
.bInterval = 0
};
#endif
static const struct usb_qualifier_descriptor __attribute__((aligned(2))) qualifier_descriptor =
{
.bLength = sizeof(struct usb_qualifier_descriptor),
@ -257,13 +218,6 @@ static struct usb_string_descriptor __attribute__((aligned(2))) lang_descriptor
{0x0409} /* LANGID US English */
};
static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_usb_benchmark =
{
40,
USB_DT_STRING,
{'B','u','l','k',' ','t','e','s','t',' ','i','n','t','e','r','f','a','c','e'}
};
static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_charging_only =
{
28,
@ -277,7 +231,6 @@ static struct usb_string_descriptor* usb_strings[] =
&usb_string_iManufacturer,
&usb_string_iProduct,
&usb_string_iSerial,
&usb_string_usb_benchmark,
&usb_string_charging_only
};
@ -293,9 +246,6 @@ bool usb_core_serial_enabled = false;
#ifdef USB_CHARGING_ONLY
static bool usb_core_charging_enabled = false;
#endif
#if defined(USB_BENCHMARK)
static bool usb_core_benchmark_enabled = false;
#endif
static void usb_core_control_request_handler(struct usb_ctrlrequest* req);
static int ack_control(struct usb_ctrlrequest* req);
@ -399,10 +349,6 @@ void usb_core_init(void)
usb_serial_init();
#endif
#ifdef USB_BENCHMARK
if(usb_core_benchmark_enabled)
usb_benchmark_init();
#endif
initialized = true;
usb_state = DEFAULT;
logf("usb_core_init() finished");
@ -439,11 +385,6 @@ void usb_core_handle_transfer_completion(struct usb_transfer_completion_event_da
usb_serial_transfer_complete(event->in,event->status,event->length);
break;
#endif
#ifdef USB_BENCHMARK
case EP_BENCHMARK:
usb_benchmark_transfer_complete(event->in);
break;
#endif
#ifdef USB_CHARGING_ONLY
case EP_CHARGING_ONLY:
break;
@ -482,13 +423,6 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req)
#endif
}
#ifdef USB_BENCHMARK
if ((req->bRequestType & 0x60) == USB_TYPE_VENDOR) {
usb_benchmark_control_request(req);
return;
}
#endif
switch (req->bRequest) {
case USB_REQ_SET_CONFIGURATION:
logf("usb_core: SET_CONFIG");
@ -661,19 +595,6 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req)
size += sizeof(struct usb_endpoint_descriptor);
}
#endif
#ifdef USB_BENCHMARK
if(usb_core_benchmark_enabled){
benchmark_ep_in_descriptor.wMaxPacketSize=max_packet_size;
benchmark_ep_out_descriptor.wMaxPacketSize=max_packet_size;
memcpy(&response_data[size],&benchmark_interface_descriptor,sizeof(struct usb_interface_descriptor));
size += sizeof(struct usb_interface_descriptor);
memcpy(&response_data[size],&benchmark_ep_in_descriptor,sizeof(struct usb_endpoint_descriptor));
size += sizeof(struct usb_endpoint_descriptor);
memcpy(&response_data[size],&benchmark_ep_out_descriptor,sizeof(struct usb_endpoint_descriptor));
size += sizeof(struct usb_endpoint_descriptor);
}
#endif
#ifdef USB_CHARGING_ONLY
if(usb_core_charging_enabled && interface_number == 0){
charging_interface_descriptor.bInterfaceNumber=interface_number;