diff --git a/fx2pipe/fx2pipe/main.cc b/fx2pipe/fx2pipe/main.cc index 2605d8f..53d71b7 100644 --- a/fx2pipe/fx2pipe/main.cc +++ b/fx2pipe/fx2pipe/main.cc @@ -1,17 +1,17 @@ /* * usb_io/main.cc - * - * FX2 pipe program main routine. - * - * Copyright (c) 2006--2009 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ - * - * This file may be distributed and/or modified under the terms of the - * GNU General Public License version 2 as published by the Free Software + * + * FX2 pipe program main routine. + * + * Copyright (c) 2006--2009 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ + * + * This file may be distributed and/or modified under the terms of the + * GNU General Public License version 2 as published by the Free Software * Foundation. (See COPYING.GPL for details.) - * + * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * + * */ #include "../oconfig.h" @@ -84,7 +84,7 @@ static void PrintHelp() int main(int argc,char **arg) { FX2Pipe p; - + int errors=0; int dir_spec=0; int fifo_width=2; // 1 or 2 (8 or 16 bits) @@ -98,7 +98,7 @@ int main(int argc,char **arg) char cko_invert=0; for(int i=1; i16384) { @@ -300,14 +300,14 @@ int main(int argc,char **arg) "range 1..16384, bs=%u is invalid\n",p.io_block_size); ++errors; } - - // Set up config for firmware: + + // Set up config for firmware: p.fc.FC_DIR = p.dir<0 ? 0x12U : 0x21U; - p.fc.FC_CPUCS = - ((cko_speed==12 ? 0U : cko_speed==24 ? 1U : 2U)<<3) | - (cko_invert ? 0x04U : 0x00U) | + p.fc.FC_CPUCS = + ((cko_speed==12 ? 0U : cko_speed==24 ? 1U : 2U)<<3) | + (cko_invert ? 0x04U : 0x00U) | (cko_output ? 0x02U : 0x00U); - p.fc.FC_IFCONFIG = + p.fc.FC_IFCONFIG = (ifclk_speed ? 0x80U : 0x00U) | // Internal (1) / external? (ifclk_speed==30 ? 0x00U : 0x40U) | // 30 (0) / 48 (1) MHz? (ifclk_output ? 0x20U : 0x00U) | // Enable (1) output to IFCLK? @@ -331,30 +331,30 @@ int main(int argc,char **arg) { case 2: p.fc.FC_EPCFG|=0x02U; break; case 3: p.fc.FC_EPCFG|=0x03U; break; - case 4: break; // Do nothing. + case 4: break; // Do nothing. default: assert(0); break; } if(fifo_width==2) { p.fc.FC_EPFIFOCFG|=0x01U; } - - // Dump firmware config values: + + // Dump firmware config values: fprintf(stderr,"Firmware config: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", (unsigned int)p.fc.FC_DIR, (unsigned int)p.fc.FC_IFCONFIG, (unsigned int)p.fc.FC_EPCFG, (unsigned int)p.fc.FC_EPFIFOCFG, (unsigned int)p.fc.FC_CPUCS ); - + if(errors) { return(1); } - - // Install signal handler for SIGINT. + + // Install signal handler for SIGINT. struct sigaction sa; memset(&sa,0,sizeof(sa)); sa.sa_handler=&SigIntHandler; sigaction(SIGINT,&sa,NULL); - + int ecode=0; - + ecode=p.run(); - + return(ecode); }