]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/io/usb/slave/v2_0/host/bulk-boundaries.tcl
Initial revision
[karo-tx-redboot.git] / packages / io / usb / slave / v2_0 / host / bulk-boundaries.tcl
1 #===============================================================================
2 #
3 #    bulk-boundaries.tcl
4 #
5 #    Support for USB testing
6 #
7 #===============================================================================
8 #####ECOSGPLCOPYRIGHTBEGIN####
9 ## -------------------------------------------
10 ## This file is part of eCos, the Embedded Configurable Operating System.
11 ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 ##
13 ## eCos is free software; you can redistribute it and/or modify it under
14 ## the terms of the GNU General Public License as published by the Free
15 ## Software Foundation; either version 2 or (at your option) any later version.
16 ##
17 ## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 ## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20 ## for more details.
21 ##
22 ## You should have received a copy of the GNU General Public License along
23 ## with eCos; if not, write to the Free Software Foundation, Inc.,
24 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 ##
26 ## As a special exception, if other files instantiate templates or use macros
27 ## or inline functions from this file, or you compile this file and link it
28 ## with other works to produce a work based on this file, this file does not
29 ## by itself cause the resulting work to be covered by the GNU General Public
30 ## License. However the source code for this file must still be made available
31 ## in accordance with section (3) of the GNU General Public License.
32 ##
33 ## This exception does not invalidate any other reasons why a work based on
34 ## this file might be covered by the GNU General Public License.
35 ## -------------------------------------------
36 #####ECOSGPLCOPYRIGHTEND####
37 #===============================================================================
38 ######DESCRIPTIONBEGIN####
39 #
40 # Author(s):    asl
41 # Date:         2006-04-21
42 # Purpose:      Test the bulk endpoints with different sizes of packets
43 #               at the important boundaries.
44 #
45 #####DESCRIPTIONEND####
46 #===============================================================================
47
48 set pktsizes { 1 2 3 4 5 7 8 9 15 16 17 31 32 33 63 64 65 127 128 129 \
49                255 256 257 511 512 513 1023 1024 1025 2047 2048 2049 \
50                4095 4096 4097 }
51
52  if { 0 != [llength $usbtest::bulk_in_endpoints] } {
53      puts "Bulk IN endpoints: $usbtest::bulk_in_endpoints"
54      foreach ep $usbtest::bulk_in_endpoints {
55         puts [format "  %2d: packet sizes %d to %d, padding %d" $ep \
56                    $usbtest::bulk_in($ep,min_size) \
57                    $usbtest::bulk_in($ep,max_size) \
58                    $usbtest::bulk_in($ep,max_in_padding)]
59          foreach pktsize $pktsizes {
60              if { $pktsize <=  $usbtest::bulk_in($ep,max_size) } {
61                  puts [format "Testing IN endpoint %d with packet size %4d" \
62                            $ep $pktsize]
63                  usbtest::reset
64                  usbtest::bulktest $ep in 5 txsize1=$pktsize format=byteseq \
65                      data1=42 data* $usbtest::MULTIPLIER \
66                      data+ $usbtest::INCREMENT
67                  if { [usbtest::start 10] } {
68                      puts "Passed"
69                  } else {
70                      puts "Failed"
71                      foreach result $usbtest::results {
72                          puts $result
73                      }
74                  }
75              }
76          }
77      }
78  }
79
80 if { 0 != [llength $usbtest::bulk_out_endpoints] } {
81     puts "Bulk OUT endpoints: $usbtest::bulk_out_endpoints"
82     foreach ep $usbtest::bulk_out_endpoints {
83         puts [format "  %2d: packet sizes %d to %d" $ep \
84                   $usbtest::bulk_out($ep,min_size) \
85                   $usbtest::bulk_out($ep,max_size)]
86         foreach pktsize $pktsizes {
87             if { $pktsize <=  $usbtest::bulk_out($ep,max_size) } {
88                 puts [format "Testing OUT endpoint %d with packet size %4d" \
89                           $ep $pktsize]
90                 usbtest::reset
91                 usbtest::bulktest $ep out 5 txsize1=$pktsize format=byteseq \
92                     data1=42 data* $usbtest::MULTIPLIER \
93                     data+ $usbtest::INCREMENT rxsize1=4096 
94                 if { [usbtest::start 10] } {
95                     puts "Passed"
96                 } else {
97                     puts "Failed"
98                     foreach result $usbtest::results {
99                         puts $result
100                     }
101                 }
102             }
103         }
104     }
105 }