FreeCalypso > hg > freecalypso-tools
view target-utils/simtest/setup.c @ 964:a96cb97b66a2
ringtools/imy: fix duplicate definition of tdma_durations[]
The bug was reported by Vadim Yanitskiy <fixeria@osmocom.org>,
although the present fix is slightly different from the contributed
patch: because main.c doesn't need this tdma_durations[] array
at all, let's simply remove the reference to this array from main.c
rather than turn it into an extern.
I no longer remember my original thought flow that resulted (by mistake)
in tdma_durations[] being multiply defined in main.c and durations.c.
My intent might have been to define all globals in main.c and have
the reference in durations.c be an extern - and I missed that extern -
but without clear memory, I have no certainty. In any case, having
this data array defined in the same module that fills it (durations.c)
is sensible, so let's make it the new way.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 31 Aug 2023 19:38:18 +0000 |
parents | 06ad5e30e8d0 |
children |
line wrap: on
line source
#include "types.h" #include "abbdefs.h" #include "simregs.h" #define WAIT_ONE_TDMA 60000 extern u16 abb_reg_read(); extern void abb_reg_write(); u16 conf1_reg; void cmd_setup(argbulk) char *argbulk; { u16 abb_sim_reg; abb_sim_reg = abb_reg_read(VRPCSIM); if (!(abb_sim_reg & 2)) { printf("ERROR: VRSIM is not enabled\n"); return; } if (!(abb_sim_reg & 4)) { printf("ERROR: VRSIM is not in proper regulation\n"); return; } /* TI's SIM_ManualStart() code follows */ SIMREGS.conf1 = conf1_reg = 0x8004; SIMREGS.cmd = SIM_CMD_CLKEN; SIMREGS.cmd = SIM_CMD_CLKEN | SIM_CMD_STOP; wait_ARM_cycles(WAIT_ONE_TDMA * 4); SIMREGS.cmd = SIM_CMD_CLKEN | SIM_CMD_SWRST; wait_ARM_cycles(WAIT_ONE_TDMA); SIMREGS.conf2 = 0x0940; //enter in manual mode to start the ATR sequence SIMREGS.conf1 = conf1_reg |= SIM_CONF1_BYPASS; wait_ARM_cycles(WAIT_ONE_TDMA); SIMREGS.conf1 = conf1_reg |= SIM_CONF1_SVCCLEV; wait_ARM_cycles(WAIT_ONE_TDMA); abb_sim_reg |= 8; abb_reg_write(VRPCSIM, abb_sim_reg); wait_ARM_cycles(WAIT_ONE_TDMA); SIMREGS.conf1 = conf1_reg &= ~SIM_CONF1_SIOLOW; wait_ARM_cycles(WAIT_ONE_TDMA); SIMREGS.conf1 = conf1_reg |= SIM_CONF1_SCLKEN; SIMREGS.conf1 = conf1_reg &= ~SIM_CONF1_TXRX; //set to receive mode }