summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-03-03 17:59:58 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-03-03 17:59:58 +0000
commitf8a5a403013e23ef209184d06eac0146933e52b1 (patch)
tree61dc618e09723b54c8beaf70f3f5d7bbcb94facb /firmware
parentc270b7a28983bd2b39c7449473a52725009c668c (diff)
downloadrockbox-f8a5a403013e23ef209184d06eac0146933e52b1.tar.gz
rockbox-f8a5a403013e23ef209184d06eac0146933e52b1.zip
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
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES1
-rw-r--r--firmware/export/usb.h3
-rw-r--r--firmware/export/usb_core.h9
-rw-r--r--firmware/usbstack/usb_benchmark.c128
-rw-r--r--firmware/usbstack/usb_benchmark.h26
-rw-r--r--firmware/usbstack/usb_core.c81
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
234usbstack/usb_core.c 234usbstack/usb_core.c
235usbstack/usb_storage.c 235usbstack/usb_storage.c
236usbstack/usb_serial.c 236usbstack/usb_serial.c
237usbstack/usb_benchmark.c
238#ifdef CPU_PP502x 237#ifdef CPU_PP502x
239target/arm/usb-drv-pp502x.c 238target/arm/usb-drv-pp502x.c
240#endif 239#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 {
69enum { 69enum {
70 USB_DRIVER_MASS_STORAGE, 70 USB_DRIVER_MASS_STORAGE,
71 USB_DRIVER_SERIAL, 71 USB_DRIVER_SERIAL,
72 USB_DRIVER_CHARGING_ONLY, 72 USB_DRIVER_CHARGING_ONLY
73 USB_DRIVER_COUNT
74}; 73};
75#endif 74#endif
76#ifdef HAVE_USBSTACK 75#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 @@
22#ifndef BOOTLOADER 22#ifndef BOOTLOADER
23 23
24//#define USB_SERIAL 24//#define USB_SERIAL
25//#define USB_BENCHMARK
26#define USB_STORAGE 25#define USB_STORAGE
27#define USB_CHARGING_ONLY 26#define USB_CHARGING_ONLY
28#else /* BOOTLOADER */ 27#else /* BOOTLOADER */
@@ -32,11 +31,6 @@
32#include "usb_ch9.h" 31#include "usb_ch9.h"
33#include "usb.h" 32#include "usb.h"
34 33
35#if defined(CPU_PP)
36#define USB_IRAM_ORIGIN ((unsigned char *)0x4000c000)
37#define USB_IRAM_SIZE ((size_t)0xc000)
38#endif
39
40/* endpoints */ 34/* endpoints */
41enum { 35enum {
42 EP_CONTROL = 0, 36 EP_CONTROL = 0,
@@ -49,9 +43,6 @@ enum {
49#ifdef USB_CHARGING_ONLY 43#ifdef USB_CHARGING_ONLY
50 EP_CHARGING_ONLY, 44 EP_CHARGING_ONLY,
51#endif 45#endif
52#ifdef USB_BENCHMARK
53 EP_BENCHMARK,
54#endif
55 NUM_ENDPOINTS 46 NUM_ENDPOINTS
56}; 47};
57 48
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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: $
9 *
10 * Copyright (C) 2007 by Björn Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "system.h"
20#include "usb_core.h"
21#include "usb_drv.h"
22//#define LOGF_ENABLE
23#include "logf.h"
24
25#ifdef USB_BENCHMARK
26
27static int current_length;
28
29static unsigned char _input_buffer[16384];
30static unsigned char* input_buffer = USB_IRAM_ORIGIN + 1024;
31
32static void ack_control(struct usb_ctrlrequest* req);
33
34static enum {
35 IDLE,
36 SENDING,
37 RECEIVING
38} state = IDLE;
39
40
41void usb_benchmark_init(void)
42{
43 int i;
44 for (i=0; i<128; i++)
45 input_buffer[i] = i;
46}
47
48void usb_benchmark_control_request(struct usb_ctrlrequest* req)
49{
50 int todo;
51 //usb_max_pkt_size = sizeof _input_buffer;
52 usb_max_pkt_size = 64;
53
54 switch (req->bRequest) {
55 case 1: /* read */
56 ack_control(req);
57 current_length = req->wValue * req->wIndex;
58 logf("bench: read %d", current_length);
59 todo = MIN(usb_max_pkt_size, current_length);
60 state = SENDING;
61 usb_drv_reset_endpoint(EP_BENCHMARK, true);
62 usb_drv_send(EP_BENCHMARK, &input_buffer, todo);
63 current_length -= todo;
64 break;
65
66 case 2: /* write */
67 ack_control(req);
68 current_length = req->wValue * req->wIndex;
69 logf("bench: write %d", current_length);
70 state = RECEIVING;
71 usb_drv_reset_endpoint(EP_BENCHMARK, false);
72 usb_drv_recv(EP_BENCHMARK, &input_buffer, sizeof _input_buffer);
73 break;
74 }
75}
76
77void usb_benchmark_transfer_complete(bool in)
78{
79 (void)in;
80
81 /* see what remains to transfer */
82 if (current_length == 0) {
83 logf("we're done");
84 state = IDLE;
85 return; /* we're done */
86 }
87
88 switch (state)
89 {
90 case SENDING: {
91 int todo = MIN(usb_max_pkt_size, current_length);
92 if (in == false) {
93 logf("unexpected ep_rx");
94 break;
95 }
96
97 logf("bench: %d more tx", current_length);
98 usb_drv_send(EP_BENCHMARK, &input_buffer, todo);
99 current_length -= todo;
100 input_buffer[0]++;
101 break;
102 }
103
104 case RECEIVING:
105 if (in == true) {
106 logf("unexpected ep_tx");
107 break;
108 }
109
110 /* re-prime endpoint */
111 usb_drv_recv(EP_BENCHMARK, &input_buffer, sizeof _input_buffer);
112 input_buffer[0]++;
113 break;
114
115 default:
116 break;
117
118 }
119}
120
121static void ack_control(struct usb_ctrlrequest* req)
122{
123 if (req->bRequestType & 0x80)
124 usb_drv_recv(EP_CONTROL, NULL, 0);
125 else
126 usb_drv_send(EP_CONTROL, NULL, 0);
127}
128#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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: $
9 *
10 * Copyright (C) 2007 by Björn Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef USB_BENCHMARK_H
20#define USB_BENCHMARK_H
21
22void usb_benchmark_init(void);
23void usb_benchmark_control_request(struct usb_ctrlrequest* req);
24void usb_benchmark_transfer_complete(bool in);
25
26#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 @@
36#include "usb_serial.h" 36#include "usb_serial.h"
37#endif 37#endif
38 38
39#if defined(USB_BENCHMARK)
40#include "usb_benchmark.h"
41#endif
42
43/* TODO: Move this target-specific stuff somewhere else (serial number reading) */ 39/* TODO: Move this target-specific stuff somewhere else (serial number reading) */
44 40
45#ifdef HAVE_AS3514 41#ifdef HAVE_AS3514
@@ -103,7 +99,7 @@ struct usb_interface_descriptor __attribute__((aligned(2))) charging_interface_d
103 .bInterfaceClass = USB_CLASS_VENDOR_SPEC, 99 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
104 .bInterfaceSubClass = 0, 100 .bInterfaceSubClass = 0,
105 .bInterfaceProtocol = 0, 101 .bInterfaceProtocol = 0,
106 .iInterface = 5 102 .iInterface = 4
107}; 103};
108#endif 104#endif
109 105
@@ -177,41 +173,6 @@ struct usb_endpoint_descriptor __attribute__((aligned(2))) serial_ep_out_descrip
177}; 173};
178#endif 174#endif
179 175
180#ifdef USB_BENCHMARK
181/* bulk test interface */
182struct usb_interface_descriptor __attribute__((aligned(2))) benchmark_interface_descriptor =
183{
184 .bLength = sizeof(struct usb_interface_descriptor),
185 .bDescriptorType = USB_DT_INTERFACE,
186 .bInterfaceNumber = 0,
187 .bAlternateSetting = 0,
188 .bNumEndpoints = 2,
189 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
190 .bInterfaceSubClass = 255,
191 .bInterfaceProtocol = 255,
192 .iInterface = 4
193};
194
195struct usb_endpoint_descriptor __attribute__((aligned(2))) benchmark_ep_in_descriptor =
196{
197 .bLength = sizeof(struct usb_endpoint_descriptor),
198 .bDescriptorType = USB_DT_ENDPOINT,
199 .bEndpointAddress = EP_BENCHMARK | USB_DIR_OUT,
200 .bmAttributes = USB_ENDPOINT_XFER_BULK,
201 .wMaxPacketSize = 16,
202 .bInterval = 0
203};
204struct usb_endpoint_descriptor benchmark_ep_out_descriptor =
205{
206 .bLength = sizeof(struct usb_endpoint_descriptor),
207 .bDescriptorType = USB_DT_ENDPOINT,
208 .bEndpointAddress = EP_BENCHMARK | USB_DIR_IN,
209 .bmAttributes = USB_ENDPOINT_XFER_BULK,
210 .wMaxPacketSize = 16,
211 .bInterval = 0
212};
213#endif
214
215static const struct usb_qualifier_descriptor __attribute__((aligned(2))) qualifier_descriptor = 176static const struct usb_qualifier_descriptor __attribute__((aligned(2))) qualifier_descriptor =
216{ 177{
217 .bLength = sizeof(struct usb_qualifier_descriptor), 178 .bLength = sizeof(struct usb_qualifier_descriptor),
@@ -257,13 +218,6 @@ static struct usb_string_descriptor __attribute__((aligned(2))) lang_descriptor
257 {0x0409} /* LANGID US English */ 218 {0x0409} /* LANGID US English */
258}; 219};
259 220
260static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_usb_benchmark =
261{
262 40,
263 USB_DT_STRING,
264 {'B','u','l','k',' ','t','e','s','t',' ','i','n','t','e','r','f','a','c','e'}
265};
266
267static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_charging_only = 221static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_charging_only =
268{ 222{
269 28, 223 28,
@@ -277,7 +231,6 @@ static struct usb_string_descriptor* usb_strings[] =
277 &usb_string_iManufacturer, 231 &usb_string_iManufacturer,
278 &usb_string_iProduct, 232 &usb_string_iProduct,
279 &usb_string_iSerial, 233 &usb_string_iSerial,
280 &usb_string_usb_benchmark,
281 &usb_string_charging_only 234 &usb_string_charging_only
282}; 235};
283 236
@@ -293,9 +246,6 @@ bool usb_core_serial_enabled = false;
293#ifdef USB_CHARGING_ONLY 246#ifdef USB_CHARGING_ONLY
294static bool usb_core_charging_enabled = false; 247static bool usb_core_charging_enabled = false;
295#endif 248#endif
296#if defined(USB_BENCHMARK)
297static bool usb_core_benchmark_enabled = false;
298#endif
299 249
300static void usb_core_control_request_handler(struct usb_ctrlrequest* req); 250static void usb_core_control_request_handler(struct usb_ctrlrequest* req);
301static int ack_control(struct usb_ctrlrequest* req); 251static int ack_control(struct usb_ctrlrequest* req);
@@ -399,10 +349,6 @@ void usb_core_init(void)
399 usb_serial_init(); 349 usb_serial_init();
400#endif 350#endif
401 351
402#ifdef USB_BENCHMARK
403 if(usb_core_benchmark_enabled)
404 usb_benchmark_init();
405#endif
406 initialized = true; 352 initialized = true;
407 usb_state = DEFAULT; 353 usb_state = DEFAULT;
408 logf("usb_core_init() finished"); 354 logf("usb_core_init() finished");
@@ -439,11 +385,6 @@ void usb_core_handle_transfer_completion(struct usb_transfer_completion_event_da
439 usb_serial_transfer_complete(event->in,event->status,event->length); 385 usb_serial_transfer_complete(event->in,event->status,event->length);
440 break; 386 break;
441#endif 387#endif
442#ifdef USB_BENCHMARK
443 case EP_BENCHMARK:
444 usb_benchmark_transfer_complete(event->in);
445 break;
446#endif
447#ifdef USB_CHARGING_ONLY 388#ifdef USB_CHARGING_ONLY
448 case EP_CHARGING_ONLY: 389 case EP_CHARGING_ONLY:
449 break; 390 break;
@@ -482,13 +423,6 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req)
482#endif 423#endif
483 } 424 }
484 425
485#ifdef USB_BENCHMARK
486 if ((req->bRequestType & 0x60) == USB_TYPE_VENDOR) {
487 usb_benchmark_control_request(req);
488 return;
489 }
490#endif
491
492 switch (req->bRequest) { 426 switch (req->bRequest) {
493 case USB_REQ_SET_CONFIGURATION: 427 case USB_REQ_SET_CONFIGURATION:
494 logf("usb_core: SET_CONFIG"); 428 logf("usb_core: SET_CONFIG");
@@ -661,19 +595,6 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req)
661 size += sizeof(struct usb_endpoint_descriptor); 595 size += sizeof(struct usb_endpoint_descriptor);
662 } 596 }
663#endif 597#endif
664#ifdef USB_BENCHMARK
665 if(usb_core_benchmark_enabled){
666 benchmark_ep_in_descriptor.wMaxPacketSize=max_packet_size;
667 benchmark_ep_out_descriptor.wMaxPacketSize=max_packet_size;
668
669 memcpy(&response_data[size],&benchmark_interface_descriptor,sizeof(struct usb_interface_descriptor));
670 size += sizeof(struct usb_interface_descriptor);
671 memcpy(&response_data[size],&benchmark_ep_in_descriptor,sizeof(struct usb_endpoint_descriptor));
672 size += sizeof(struct usb_endpoint_descriptor);
673 memcpy(&response_data[size],&benchmark_ep_out_descriptor,sizeof(struct usb_endpoint_descriptor));
674 size += sizeof(struct usb_endpoint_descriptor);
675 }
676#endif
677#ifdef USB_CHARGING_ONLY 598#ifdef USB_CHARGING_ONLY
678 if(usb_core_charging_enabled && interface_number == 0){ 599 if(usb_core_charging_enabled && interface_number == 0){
679 charging_interface_descriptor.bInterfaceNumber=interface_number; 600 charging_interface_descriptor.bInterfaceNumber=interface_number;