diff options
-rw-r--r-- | firmware/SOURCES | 1 | ||||
-rw-r--r-- | firmware/export/usb.h | 3 | ||||
-rw-r--r-- | firmware/export/usb_core.h | 9 | ||||
-rw-r--r-- | firmware/usbstack/usb_benchmark.c | 128 | ||||
-rw-r--r-- | firmware/usbstack/usb_benchmark.h | 26 | ||||
-rw-r--r-- | firmware/usbstack/usb_core.c | 81 |
6 files changed, 2 insertions, 246 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 08ba9b6785..1ede7e2d66 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -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 diff --git a/firmware/export/usb.h b/firmware/export/usb.h index 833d2ab35e..67793729c6 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h @@ -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 diff --git a/firmware/export/usb_core.h b/firmware/export/usb_core.h index 6af3545b30..bb4ce6cedd 100644 --- a/firmware/export/usb_core.h +++ b/firmware/export/usb_core.h @@ -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, @@ -49,9 +43,6 @@ enum { #ifdef USB_CHARGING_ONLY EP_CHARGING_ONLY, #endif -#ifdef USB_BENCHMARK - EP_BENCHMARK, -#endif NUM_ENDPOINTS }; diff --git a/firmware/usbstack/usb_benchmark.c b/firmware/usbstack/usb_benchmark.c deleted file mode 100644 index 7cd5a3e987..0000000000 --- a/firmware/usbstack/usb_benchmark.c +++ /dev/null @@ -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*/ diff --git a/firmware/usbstack/usb_benchmark.h b/firmware/usbstack/usb_benchmark.h deleted file mode 100644 index 12c32a724f..0000000000 --- a/firmware/usbstack/usb_benchmark.h +++ /dev/null @@ -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 diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index 64690a1d32..a46310b4cb 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c @@ -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; |