packages/web/353/php_top/usb10369a.php

Go to the documentation of this file.
00001 #!/usr/local/sbin/php -q
00002 <?php
00003 /*!***************************************************************************
00004 *! FILE NAME  : usb10369a.php
00005 *! DESCRIPTION: initializes USB hub on the 10369a board
00006 *! Copyright (C) 2008 Elphel, Inc
00007 *! -----------------------------------------------------------------------------**
00008 *!
00009 *!  This program is free software: you can redistribute it and/or modify
00010 *!  it under the terms of the GNU General Public License as published by
00011 *!  the Free Software Foundation, either version 3 of the License, or
00012 *!  (at your option) any later version.
00013 *!
00014 *!  This program is distributed in the hope that it will be useful,
00015 *!  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 *!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 *!  GNU General Public License for more details.
00018 *!
00019 *!  You should have received a copy of the GNU General Public License
00020 *!  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00021 *! -----------------------------------------------------------------------------**
00022 *!  $Log: usb10369a.php,v $
00023 *!  Revision 1.1.1.1  2008/11/27 20:04:03  elphel
00024 *!
00025 *!
00026 *!  Revision 1.2  2008/11/24 10:39:47  spectr_rain
00027 *!  added PHP program for SHELL as run command
00028 *!
00029 *!  Revision 1.1  2008/06/24 00:44:35  elphel
00030 *!  configuration of USB hub on the 10369A board
00031 *!
00032 *!
00033 */
00034 
00035 require 'i2c.inc';
00036       $base_addr=  0x2c00;
00037       $base_addr16=0x5800;
00038       $defaults=array(
00039         array("addr"=>0x0,"data"=>0x34), // VID_LSB
00040         array("addr"=>0x1,"data"=>0x12), // VID_MSB
00041         array("addr"=>0x6,"data"=>0x9b), // CONFIG_BYTE_1
00042         array("addr"=>0x7,"data"=>0x10), // CONFIG_BYTE_2
00043         array("addr"=>0x8,"data"=>0x0 ) // CONFIG_BYTE_3
00044 
00045 
00046       );
00047 //      foreach ($defaults as $line) i2c_send(8,1,$base_addr+$line["addr"],$line["data"]+0);
00048 echo "<pre>\n";
00049       foreach ($defaults as $line) {
00050 //         $rslt=i2c_send(16,1,$base_addr16+$line["addr"],$line["data"]+0x100);
00051 //         $rslt=i2c_send(8,1,$base_addr+$line["addr"],$line["data"]+0); 
00052 //       printf("i2c_send(16,1,0x%x,0x%x) returned %d\n",$base_addr16+$line["addr"],$line["data"]+0x100,$rslt);
00053 //       printf("i2c_send(8,1,0x%x,0x%x) returned %d\n",$base_addr+$line["addr"],$line["data"]+0,$rslt);
00054          $rslt=smbus_send($base_addr+$line["addr"],array($line["data"]+0)); 
00055          printf("smbus_send(0x%x,0x%x) returned %d\n",$base_addr+$line["addr"],$line["data"]+0,$rslt);
00056       }
00057 echo "</pre>\n";
00058 ?>

Generated on Fri Nov 28 00:06:25 2008 for elphel by  doxygen 1.5.1