The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/cxgb/bin2h.pl

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 #!/usr/bin/perl -w 
    2 
    3 #$FreeBSD: releng/11.0/sys/dev/cxgb/bin2h.pl 189643 2009-03-10 19:22:45Z gnn $
    4 
    5 if ($#ARGV != 1) {
    6   print "bin2h.pl <firmware> <headername>\n";
    7   exit 1;
    8 } 
    9 
   10 my $success = open INPUT, "$ARGV[0]";
   11 unless ($success) {
   12   print "failed to open input\n";
   13   exit 1;
   14 }
   15 $success = open OUTPUT, ">$ARGV[1].h";
   16 unless ($success) {
   17   print "failed to open output\n";
   18   exit 1;
   19 }
   20 
   21 
   22 my $license = <<END;
   23 /**************************************************************************
   24 
   25 Copyright (c) 2007-2009, Chelsio Inc.
   26 All rights reserved.
   27 
   28 Redistribution and use in source and binary forms, with or without
   29 modification, are permitted provided that the following conditions are met:
   30 
   31  1. Redistributions of source code must retain the above copyright notice,
   32     this list of conditions and the following disclaimer.
   33 
   34  2. Neither the name of the Chelsio Corporation nor the names of its
   35     contributors may be used to endorse or promote products derived from
   36     this software without specific prior written permission.
   37 
   38 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   39 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   40 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   41 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
   42 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   43 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   44 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   45 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN22
   46 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   47 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   48 POSSIBILITY OF SUCH DAMAGE.
   49 
   50 
   51 \$FreeBSD\$
   52 
   53 ***************************************************************************/
   54 END
   55 print OUTPUT "$license\n";
   56 
   57 
   58 my $binary;
   59 
   60 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
   61  $atime,$mtime,$ctime,$blksize,$blocks)
   62   = stat($ARGV[0]);
   63 
   64 
   65 print OUTPUT "#define U (unsigned char)\n\n"; 
   66 
   67 print OUTPUT "static unsigned int $ARGV[1]_length = $size;\n";
   68 print OUTPUT "static unsigned char $ARGV[1]" . "[$size]" . " = {\n";
   69 
   70 for (my $i = 0; $i < $size; $i += 4) {
   71   my $number_read = read(INPUT, $binary, 4);
   72   my ($a, $b, $c, $d) = unpack("C C C C", $binary);
   73   $buf = sprintf("\tU 0x%02X, U 0x%02X, U 0x%02X, U 0x%02X, \n", $a, $b, $c, $d);
   74   print OUTPUT $buf;
   75 }
   76 print OUTPUT "};\n";
   77 
   78 
   79 

Cache object: 86c5425c3f5c004138869b66d4c1741c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.