summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-17 15:36:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-17 15:36:57 +0000
commit0d523caf976507445c97d8bc5bebf860056dc790 (patch)
tree6bb7e22ee343d9060ea9689317794b7341f74b8e
parentConditionally take out the offensive pragma pack when on RTEMS in addition (diff)
downloadrtems-0d523caf976507445c97d8bc5bebf860056dc790.tar.bz2
Patch rtems-rc-19991105-2.diff from Ralf Corsepius <corsepiu@faw.uni-ulm.de>.
His comments follow: This is a minor enhancement to shgen, which should not have any side-effects.
-rw-r--r--tools/cpu/sh/COPYING2
-rw-r--r--tools/cpu/sh/sci.c10
-rw-r--r--tools/cpu/sh/shgen.c20
3 files changed, 25 insertions, 7 deletions
diff --git a/tools/cpu/sh/COPYING b/tools/cpu/sh/COPYING
index 805cdd8ffc..c0f81890ca 100644
--- a/tools/cpu/sh/COPYING
+++ b/tools/cpu/sh/COPYING
@@ -1,7 +1,7 @@
shgen - code generator for the Hitachi SH microcontroller family
- Copyright (C) 1998 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
+ Copyright (C) 1998-1999 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/tools/cpu/sh/sci.c b/tools/cpu/sh/sci.c
index 3310e7e791..2b0cbd758f 100644
--- a/tools/cpu/sh/sci.c
+++ b/tools/cpu/sh/sci.c
@@ -67,7 +67,11 @@ static void Compute(
entry->err =
( ( Phi / ( (entry->N + 1) * a ) - 1.0 ) * 100.0 );
else
+ {
entry->err = 100.0 ;
+ entry->n = 255 ;
+ entry->N = 0 ;
+ }
}
static sci_tab_t *SelectN(
@@ -127,11 +131,14 @@ int shgen_gensci(
if ( i > 0 )
fprintf( file, ",\n" );
- fprintf( file, " { %1d, %3d } /* %+7.2f%% ; B%d */",
+ fprintf( file, " { %1d, %3d } /* %+7.2f%% ; B%d ",
best->n,
best->N,
best->err,
best->B );
+ if ( best->n > 3 )
+ fprintf( file, "(unusable) " );
+ fprintf( file, "*/" );
}
fprintf( file, "\n};\n\n" );
@@ -147,6 +154,7 @@ int shgen_gensci(
" + ( ( cflag & CBAUDEX ) ? B38400 : 0 );\n"
" if ( offset == 0 ) return -1 ;\n"
" offset-- ;\n\n"
+ " if ( _sci_bitrates[offset].n > 3 ) return -1;\n\n"
" *smr &= ~0x03;\n"
" *smr |= _sci_bitrates[offset].n;\n"
" *brr = _sci_bitrates[offset].N;\n\n"
diff --git a/tools/cpu/sh/shgen.c b/tools/cpu/sh/shgen.c
index 15c179a855..c101388ad8 100644
--- a/tools/cpu/sh/shgen.c
+++ b/tools/cpu/sh/shgen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
+ * Copyright (c) 1998-1999 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
*
* See the file COPYING for copyright notice.
*/
@@ -15,7 +15,10 @@ 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, "\t-M Phi .. processor frequency [MHz]\n" );
+ fprintf( stderr, "\t-K Phi .. processor frequency [KHz]\n" );
+ fprintf( stderr, "\t-H Phi .. processor frequency [Hz]\n" );
+ fprintf( stderr, "\t\t..default 20MHz" );
fprintf( stderr, "driver:\n" );
fprintf( stderr, "\tsci .. bitrate table for sci\n" );
exit ( 1 );
@@ -24,9 +27,9 @@ static void usage( char *prog )
static void shgen_header( FILE *file )
{
fprintf( file,
- "/*\n * DO NOT EDIT - this file is automatically generated by shgen 0.2\n" );
+ "/*\n * DO NOT EDIT - this file is automatically generated by shgen 0.3\n" );
fprintf( file,
- " * Copyright (c) 1998, Ralf Corsepius (corsepiu@faw.uni-ulm.de)\n */\n" );
+ " * Copyright (c) 1998-1999, Ralf Corsepius (corsepiu@faw.uni-ulm.de)\n */\n" );
fprintf( file,
"\n/* This file is not copyrighted */\n\n" );
}
@@ -35,7 +38,7 @@ int main( int argc, char *argv[] )
{
double Phi = 20.0 ;
- while ( ( optopt = getopt( argc, argv, "M:" ) ) > 0 )
+ while ( ( optopt = getopt( argc, argv, "M:K:H:" ) ) > 0 )
{
switch ( optopt )
{
@@ -43,6 +46,13 @@ int main( int argc, char *argv[] )
sscanf( optarg, "%lf", &Phi );
Phi = Phi * 1000000.0;
break ;
+ case 'K' :
+ sscanf( optarg, "%lf", &Phi );
+ Phi = Phi * 1000.0;
+ break ;
+ case 'H' :
+ sscanf( optarg, "%lf", &Phi );
+ break ;
default :
usage( argv[0] );
break ;