altos: Make ao_freq_to_set reentrant
authorKeith Packard <keithp@keithp.com>
Sat, 7 Apr 2012 07:25:26 +0000 (00:25 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 7 Apr 2012 07:25:26 +0000 (00:25 -0700)
Save a bunch of data space this way.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/core/ao.h
src/core/ao_freq.c

index 67efa437f843fbe91143041ae7623c8bc8b49da8..150c08171f1593f8c08fcbe15fc9bfc2c10192fe 100644 (file)
@@ -1892,7 +1892,7 @@ ao_sqrt(uint32_t op);
  * ao_freq.c
  */
 
-int32_t ao_freq_to_set(int32_t freq, int32_t cal);
+int32_t ao_freq_to_set(int32_t freq, int32_t cal) __reentrant;
 
 #include <ao_arch_funcs.h>
 
index 67b0b037bdcc9defd2b2bd44f38fe7e6aea4a0a0..12496f6fdf785a2d94f5fac84c239092ede0e004 100644 (file)
  * frequency, and updating the radio setting along the way
  */
 
-int32_t ao_freq_to_set(int32_t freq, int32_t cal) {
-       __pdata int32_t set = 0;
-       uint8_t neg = 0;
-       __pdata int32_t error = -434550 / 2;
+int32_t ao_freq_to_set(int32_t freq, int32_t cal) __reentrant
+{
+       static __pdata int32_t  set;
+       static __pdata uint8_t  neg;
+       static __pdata int32_t  error;
+
+       set = 0;
+       neg = 0;
+       error = -434550 / 2;
 
        if ((freq -= 434550) < 0) {
                neg = 1;