summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/build/binpatch.c12
-rw-r--r--tools/build/packhex.c2
-rw-r--r--tools/build/unhex.c2
-rw-r--r--tools/cpu/sh/sci.c38
-rw-r--r--tools/cpu/sh/shgen.c16
5 files changed, 35 insertions, 35 deletions
diff --git a/tools/build/binpatch.c b/tools/build/binpatch.c
index 9f7e87c835..b9e2ac1a06 100644
--- a/tools/build/binpatch.c
+++ b/tools/build/binpatch.c
@@ -13,7 +13,7 @@
static char buf[512];
-static void
+static void
usage(void)
{
printf("usage: binpatch [-h] <ofile> <ifile> <reloc> <off> <byte0> "
@@ -40,8 +40,8 @@ main(int argc, char **argv)
FILE *ofp, *ifp;
char patch[4], *end;
int patchLen, tmp, i, off, cnt, patched, len, reloc;
-
-
+
+
/* parse command line options */
while ((c = getopt(argc, argv, "h")) >= 0)
{
@@ -93,7 +93,7 @@ main(int argc, char **argv)
}
patch[i] = tmp;
}
-
+
ifp = fopen(argv[2], "r");
if(ifp == NULL)
{
@@ -137,7 +137,7 @@ main(int argc, char **argv)
}
patched = 1;
}
-
+
fwrite(buf, 1, len, ofp);
cnt += len;
@@ -145,7 +145,7 @@ main(int argc, char **argv)
fclose(ifp);
fclose(ofp);
-
+
if(!patched)
{
fprintf(stderr, "warning: offset is beyond input file length\n");
diff --git a/tools/build/packhex.c b/tools/build/packhex.c
index 3b85a7c927..1e8edb615e 100644
--- a/tools/build/packhex.c
+++ b/tools/build/packhex.c
@@ -493,7 +493,7 @@ int main(
}
length = strlen(inbuff);
inbuff[length - 1] = '\0';
-
+
}
diff --git a/tools/build/unhex.c b/tools/build/unhex.c
index 484a4d02d1..693049f465 100644
--- a/tools/build/unhex.c
+++ b/tools/build/unhex.c
@@ -111,7 +111,7 @@ void error(int errn, ...);
#else
#define stol(p) strtol(p, (char **) NULL, 0)
#endif
-
+
int unhex(FILE *ifp, char *inm, FILE *ofp, char *onm);
int convert_Intel_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
int convert_S_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
diff --git a/tools/cpu/sh/sci.c b/tools/cpu/sh/sci.c
index 2b0cbd758f..bc7fdd83a8 100644
--- a/tools/cpu/sh/sci.c
+++ b/tools/cpu/sh/sci.c
@@ -12,11 +12,11 @@
/*
n .. baudrate generator source 0,1,2,3
-
+
N .. BRR setting (0..255)
-
+
Phi .. processor baud rate
-
+
B .. bitrate
*/
@@ -51,20 +51,20 @@ static unsigned int bitrate [] = {
static sci_tab_t test_array[4] ;
-static void Compute(
- unsigned int n,
- unsigned int B,
+static void Compute(
+ unsigned int n,
+ unsigned int B,
double Phi,
struct sci_tab *entry )
{
int a = ( 32 << ( 2 * n ) ) * B ;
-
+
entry->n = n ;
entry->B = B ;
entry->N = rint( ( Phi / a ) - 1.0 ) ;
- if ( ( entry->N > 0 ) && ( entry->N < 256 ) )
- entry->err =
+ if ( ( entry->N > 0 ) && ( entry->N < 256 ) )
+ entry->err =
( ( Phi / ( (entry->N + 1) * a ) - 1.0 ) * 100.0 );
else
{
@@ -74,17 +74,17 @@ static void Compute(
}
}
-static sci_tab_t *SelectN(
+static sci_tab_t *SelectN(
unsigned int B,
double Phi )
{
unsigned int i ;
struct sci_tab* best = NULL ;
-
+
for ( i = 0 ; i < 4 ; i++ )
- {
+ {
double err ;
-
+
Compute( i, B, Phi, &test_array[i] );
err = fabs( test_array[i].err );
@@ -97,7 +97,7 @@ static sci_tab_t *SelectN(
best = &test_array[i] ;
}
- return best ;
+ return best ;
}
int shgen_gensci(
@@ -106,7 +106,7 @@ int shgen_gensci(
{
unsigned int i ;
- fprintf( file,
+ fprintf( file,
"/*\n * Bitrate table for the serial devices (sci) of the SH at %.3f MHz\n"
" */\n\n", Phi / 1000000.0 );
fprintf( file,
@@ -118,13 +118,13 @@ int shgen_gensci(
" * We experienced values less than 2%% to be stable\n"
" */\n\n" );
fprintf( file, "#include <termios.h>\n\n" );
- fprintf( file,
+ fprintf( file,
"static struct sci_bitrate_t {\n"
" unsigned char n ;\n"
" unsigned char N ;\n"
"} _sci_bitrates[] = {\n"
"/* n N error */\n" );
-
+
for ( i = 0 ; i < sizeof(bitrate)/sizeof(int) ; i++ )
{
struct sci_tab* best = SelectN( bitrate[i], Phi );
@@ -143,7 +143,7 @@ int shgen_gensci(
fprintf( file, "\n};\n\n" );
- fprintf( file,
+ fprintf( file,
"int _sci_get_brparms( \n"
" tcflag_t cflag,\n"
" unsigned char *smr,\n"
@@ -160,6 +160,6 @@ int shgen_gensci(
" *brr = _sci_bitrates[offset].N;\n\n"
" return 0;\n"
"}\n" );
-
+
return 0 ;
}
diff --git a/tools/cpu/sh/shgen.c b/tools/cpu/sh/shgen.c
index 73c8a4f027..b4ab34b5cd 100644
--- a/tools/cpu/sh/shgen.c
+++ b/tools/cpu/sh/shgen.c
@@ -44,12 +44,12 @@ static struct option long_options[] =
static void shgen_header( FILE *file )
{
- fprintf( file,
+ fprintf( file,
"/*\n * DO NOT EDIT - this file is automatically generated by shgen %s\n",
VERSION );
fprintf( file,
" * Copyright (c) 1998,1999,2000 Ralf Corsepius (corsepiu@faw.uni-ulm.de)\n */\n" );
- fprintf( file,
+ fprintf( file,
"\n/* This file is not copyrighted */\n\n" );
}
@@ -57,7 +57,7 @@ int main( int argc, char *argv[] )
{
double Phi = 20000000.0 ;
-#if HAVE_GETOPT_LONG
+#if HAVE_GETOPT_LONG
int option_index = 0 ;
while( ( optopt = getopt_long( argc, argv, "M:K:H:hv",
long_options, &option_index ) ) > 0 )
@@ -68,11 +68,11 @@ int main( int argc, char *argv[] )
switch ( optopt )
{
case 'M' :
- sscanf( optarg, "%lf", &Phi );
+ sscanf( optarg, "%lf", &Phi );
Phi = Phi * 1000000.0;
break ;
case 'K' :
- sscanf( optarg, "%lf", &Phi );
+ sscanf( optarg, "%lf", &Phi );
Phi = Phi * 1000.0;
break ;
case 'H' :
@@ -96,9 +96,9 @@ int main( int argc, char *argv[] )
fprintf( stderr, "%s: Missing argument: driver\n", argv[0] );
exit(1);
}
-
+
shgen_header( stdout );
-
+
if ( strcmp( argv[optind], "sci" ) == 0 )
{
shgen_gensci( stdout, Phi );
@@ -108,6 +108,6 @@ int main( int argc, char *argv[] )
fprintf( stderr, "%s: Invalid argument: driver\n", argv[0] );
exit(1);
}
-
+
return 0 ;
}