From fa21a8439f23b608448f1ce5f1f01c51a63ed258 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 17 Jul 1998 15:17:29 +0000 Subject: New files from Ralf Corsepius . His comments: * c/src/exec/score/tools/sh - NEW DIRECTORY - contains shgen Most of it should be self-explanatory. I am a little bit concerned about host-dependent features (getopt, floating point libraries). This shouldn't disturb much now, as this tool should be compileable on all gnu-based hosts and is only applicable for the sh. But in case somebody complains, we may need to add autoconf checks or even restructurize parts of rtems (IMO, rtems needs to be restructurized - remember the "turning rtems upside down" issue). --- c/src/exec/score/tools/sh/shgen.c | 65 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 c/src/exec/score/tools/sh/shgen.c (limited to 'c/src/exec/score/tools/sh/shgen.c') diff --git a/c/src/exec/score/tools/sh/shgen.c b/c/src/exec/score/tools/sh/shgen.c new file mode 100644 index 0000000000..3fa6ae9b75 --- /dev/null +++ b/c/src/exec/score/tools/sh/shgen.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1998 Ralf Corsepius (corsepiu@faw.uni-ulm.de) + * + * See the file COPYING for copyright notice. + */ + +#include +#include /* strcmp, strerror */ +#include +#include + +#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\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 ; +} -- cgit v1.2.3