From 05a346681d3d68b3a1cafc42ed7abff1d3d0aea5 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 21 Mar 2000 18:35:00 +0000 Subject: [PATCH] Patch from Gunter Magin where the type was not large enough to support high baud rates. brg_spd[] is an array which stores the baud rates, for which one of the 4 available BRG dividers has been set. The array is used for deciding if a BRG devider may be reused. > 1. What baud_rate and divisor is causing this to fail? divisor is dependent on the system clock (Cpu_table.clock_speed), and gets calculated in m860_get_brg_cd. m860_get_brg_clk fails for any baudrates > (2^16-1), as those baudrates are truncated to 16 bit which is the size of a short. In fact, as it has been a short and not an unsigned short, it will fail at any baudrate >(2^15-1). In any case, it failed for my application, which required 250000 Baud. --- .../libcpu/powerpc/mpc821/console-generic/console-generic.c | 2 +- .../libcpu/powerpc/mpc860/console-generic/console-generic.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c/src/lib/libcpu/powerpc/mpc821/console-generic/console-generic.c b/c/src/lib/libcpu/powerpc/mpc821/console-generic/console-generic.c index e8fa6ed3f4..b84e02a851 100644 --- a/c/src/lib/libcpu/powerpc/mpc821/console-generic/console-generic.c +++ b/c/src/lib/libcpu/powerpc/mpc821/console-generic/console-generic.c @@ -99,7 +99,7 @@ m821_get_brg_cd (int baud) /* at any time since the OS started. It needs to be fixed. FIXME */ unsigned char m821_get_brg_clk(int baud) { - static short brg_spd[4]; + static int brg_spd[4]; static char brg_used[4]; int i; diff --git a/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c b/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c index 3ace5ce9b6..e9cdf00b94 100644 --- a/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c +++ b/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c @@ -102,8 +102,8 @@ m860_get_brg_cd (int baud) /* at any time since the OS started. It needs to be fixed. FIXME */ unsigned char m860_get_brg_clk(int baud) { - static short brg_spd[4]; - static char brg_used[4]; + static int brg_spd[4]; + static char brg_used[4]; int i; /* first try to find a BRG that is already at the right speed */