# HG changeset patch # User Michael Spacefalcon # Date 1389039893 0 # Node ID 2beb88a3d5281a53622eb4afad2169c00759883b # Parent fee45482aa2ac97bff5e24c0c00fde9706f103e4 gsm-fw links with FFS included diff -r fee45482aa2a -r 2beb88a3d528 gsm-fw/finlink/Makefile --- a/gsm-fw/finlink/Makefile Mon Jan 06 08:43:35 2014 +0000 +++ b/gsm-fw/finlink/Makefile Mon Jan 06 20:24:53 2014 +0000 @@ -15,7 +15,8 @@ ../nucleus/libplus.iram.a ../sprintf/libsprintf.a INT_PIECES= ../bsp/niq32.o -EXT_PIECES= ../bsp/xipcode.o ../serial/xipcode.o ../sysglue/xipcode.o +EXT_PIECES= ../bsp/xipcode.o ../serial/xipcode.o ../sysglue/xipcode.o \ + ../services/ffs/xipcode.o ifeq (${RVM_ETM_SWE},1) EXT_PIECES+= ../services/etm/xipcode.o endif diff -r fee45482aa2a -r 2beb88a3d528 gsm-fw/services/ffs/Makefile --- a/gsm-fw/services/ffs/Makefile Mon Jan 06 08:43:35 2014 +0000 +++ b/gsm-fw/services/ffs/Makefile Mon Jan 06 20:24:53 2014 +0000 @@ -2,7 +2,7 @@ CFLAGS= -O2 -fno-builtin -mthumb-interwork -mthumb LD= arm-elf-ld -OBJS= cfgffs.o core.o drv.o ffs_env.o ffs_target.o ffstrace.o fsck.o \ +OBJS= cfgffs.o core.o drv.o ffs_env.o ffs_target.o ffstrace.o fsck.o rand.o \ reclaim.o task.o HDRS= core.h drv.h ffs.h ffs_api.h ffs_env.h ffs_pool_size.h ffstrace.h \ diff -r fee45482aa2a -r 2beb88a3d528 gsm-fw/services/ffs/core.c --- a/gsm-fw/services/ffs/core.c Mon Jan 06 08:43:35 2014 +0000 +++ b/gsm-fw/services/ffs/core.c Mon Jan 06 20:24:53 2014 +0000 @@ -1344,8 +1344,11 @@ return error; } +/* FreeCalypso: stubbed out until we integrate TMFFS */ +#if 0 extern int tmffs_bufsize(void); // used by ffs_query() extern unsigned char *tmffs_bufaddr(void); // used by ffs_query() +#endif #if (TARGET == 1) // request_id_last is only used in TARGET not to any use on the PC side @@ -1415,8 +1418,11 @@ break; } +/* FreeCalypso: stubbed out until we integrate TMFFS */ +#if 0 case Q_TM_BUFADDR: *(uint32*)p = (uint32) tmffs_bufaddr(); break; case Q_TM_BUFSIZE: *(uint32*)p = tmffs_bufsize(); break; +#endif case Q_DEV_BASE: *(uint32*)p = (uint32) dev.base; break; // FFS versions diff -r fee45482aa2a -r 2beb88a3d528 gsm-fw/services/ffs/rand.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/services/ffs/rand.c Mon Jan 06 20:24:53 2014 +0000 @@ -0,0 +1,32 @@ +/* + * This version of rand() has been lifted from Ancient UNIX, and modified + * to match the version used in TI's TCS211 GSM firmware, as revealed by + * disassembly of rand.obj in the rts16le_flash.lib binary library used + * by that semi-src package. TI's version (most likely from their compiler + * tools group, rather than the GSM fw group, but who knows) uses the + * same trivial implementation of rand() as the original Ancient UNIX libc, + * but with one change: TI's return value is right-shifted by 16 bits + * compared to what the Ancient UNIX rand() would have returned. + * The caller thus gets back only 15 pseudo-random bits rather than 31, + * but then the lower bits of the original rand() return value are + * known to be pretty bad. + * + * rand() is used by some FFS code in reclaim.c. If we don't provide our + * own version of rand() and let the linker pull the version from newlib, + * the link fails because the latter uses malloc. This ancient implementation + * of rand() is quite poor, but my plan is to look into possibly adopting + * some better PRNG after we get the basic TI GSM firmware reintegrated. + */ + +static long randx = 1; + +srand(x) +unsigned x; +{ + randx = x; +} + +rand() +{ + return ((randx = randx * 1103515245 + 12345) & 0x7fffffff) >> 16; +} diff -r fee45482aa2a -r 2beb88a3d528 gsm-fw/services/ffs/reclaim.c --- a/gsm-fw/services/ffs/reclaim.c Mon Jan 06 08:43:35 2014 +0000 +++ b/gsm-fw/services/ffs/reclaim.c Mon Jan 06 20:24:53 2014 +0000 @@ -13,7 +13,7 @@ #include "drv.h" #include "ffstrace.h" -#include // rand() +extern int rand(); /****************************************************************************** * Inodes Reclaim diff -r fee45482aa2a -r 2beb88a3d528 gsm-fw/services/ffs/task.c --- a/gsm-fw/services/ffs/task.c Mon Jan 06 08:43:35 2014 +0000 +++ b/gsm-fw/services/ffs/task.c Mon Jan 06 20:24:53 2014 +0000 @@ -13,6 +13,7 @@ #include "core.h" #include "task.h" #include "ffstrace.h" +#include "intctl.h" #include "../../riviera/rvm/rvm_use_id_list.h" /****************************************************************************** @@ -113,18 +114,16 @@ req_id_t request_id_get(void) { - extern uint32 int_disable(void); - extern void int_enable(uint32 tmp); - uint32 cprs; + uint32 cpsr; // We disable interrupt to avoid any other tasks to get the same id. - cprs = int_disable(); + cpsr = int_disable(); request_id_last++; if (request_id_last < 0) request_id_last = 0; - int_enable(cprs); + int_enable(cpsr); return request_id_last; }