source: rtems/c/src/exec/score/tools/sh/shgen.c @ 287e9584

4.104.114.84.95
Last change on this file since 287e9584 was 1fd26a5, checked in by Joel Sherrill <joel.sherrill@…>, on 09/23/98 at 16:46:52

Patch from Ralf Corsepius <corsepiu@…>.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 * Copyright (c) 1998 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
3 *
4 * See the file COPYING for copyright notice.
5 */
6
7#include <stdio.h>
8#include <string.h>     /* strcmp, strerror */
9#include <errno.h>
10#include <getopt.h>
11
12#include "sci.h"
13
14static void usage( char *prog )
15{
16  fprintf( stderr, "usage: %s [options] driver\n", prog );
17  fprintf( stderr, "options:\n" );
18  fprintf( stderr, "\t-M Phi      .. processor frequency [MHz] default: 20\n" );
19  fprintf( stderr, "driver:\n" );
20  fprintf( stderr, "\tsci .. bitrate table for sci\n" );
21  exit ( 1 );
22}
23
24static void shgen_header( FILE *file )
25{
26  fprintf( file,
27    "/*\n * DO NOT EDIT - this file is automatically generated by shgen 0.2\n" );
28  fprintf( file,
29    " * Copyright (c) 1998, Ralf Corsepius (corsepiu@faw.uni-ulm.de)\n */\n" );
30  fprintf( file,
31    "\n/* This file is not copyrighted */\n\n" );
32}
33
34int main( int argc, char *argv[] )
35{
36  double        Phi = 20.0 ;
37 
38  while ( ( optopt = getopt( argc, argv, "M:" ) ) > 0 )
39  {
40    switch ( optopt )
41    {
42    case 'M' :
43      sscanf( optarg, "%lf", &Phi );
44      Phi = Phi * 1000000.0;
45      break ;
46    default  :
47      usage( argv[0] );
48      break ;
49    }
50  }
51
52  if ( argc - optind != 1 )
53    usage( argv[0] );
54
55  shgen_header( stdout );
56     
57  if ( strcmp( argv[optind], "sci" ) == 0 )
58  {
59    shgen_gensci( stdout, Phi );
60  }
61  else
62    usage( argv[0] );
63     
64  return 0 ;
65}
Note: See TracBrowser for help on using the repository browser.