forked from Imagelibrary/rtems
66 lines
1.4 KiB
C
66 lines
1.4 KiB
C
/*
|
|
* Copyright (c) 1998 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
|
*
|
|
* See the file COPYING for copyright notice.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h> /* strcmp, strerror */
|
|
#include <errno.h>
|
|
#include <getopt.h>
|
|
|
|
#include "sci.h"
|
|
|
|
static void usage( char *prog )
|
|
{
|
|
fprintf( stderr, "usage: %s [options] driver\n", prog );
|
|
fprintf( stderr, "options:\n" );
|
|
fprintf( stderr, "\t-M Phi .. processor frequency [MHz] default: 20\n" );
|
|
fprintf( stderr, "driver:\n" );
|
|
fprintf( stderr, "\tsci .. bitrate table for sci\n" );
|
|
exit ( 1 );
|
|
}
|
|
|
|
static void shgen_header( FILE *file )
|
|
{
|
|
fprintf( file,
|
|
"/*\n * DO NOT EDIT - this file is automatically generated by shgen 0.2\n" );
|
|
fprintf( file,
|
|
" * Copyright (c) 1998, Ralf Corsepius (corsepiu@faw.uni-ulm.de)\n */\n" );
|
|
fprintf( file,
|
|
"\n/* This file is not copyrighted */\n\n" );
|
|
}
|
|
|
|
int main( int argc, char *argv[] )
|
|
{
|
|
double Phi = 20.0 ;
|
|
|
|
while ( ( optopt = getopt( argc, argv, "M:" ) ) > 0 )
|
|
{
|
|
switch ( optopt )
|
|
{
|
|
case 'M' :
|
|
sscanf( optarg, "%lf", &Phi );
|
|
Phi = Phi * 1000000.0;
|
|
break ;
|
|
default :
|
|
usage( argv[0] );
|
|
break ;
|
|
}
|
|
}
|
|
|
|
if ( argc - optind != 1 )
|
|
usage( argv[0] );
|
|
|
|
shgen_header( stdout );
|
|
|
|
if ( strcmp( argv[optind], "sci" ) == 0 )
|
|
{
|
|
shgen_gensci( stdout, Phi );
|
|
}
|
|
else
|
|
usage( argv[0] );
|
|
|
|
return 0 ;
|
|
}
|