In their internal development environment, TI had a way to build L1 standalone,i.e., omitting the G23 protocol stack and other large and complex pieces of thefull firmware. Such an ability is essential for sane development, and theabundant references to OP_L1_STANDALONE throughout the codebase confirm that TIhad it indeed.However, we (FreeCalypso) don't have a way to build an OP_L1_STANDALONE imageexactly the way TI did it - we don't have all of the necessary source - theglue pieces specific to this configuration are missing. Nor do we necessarilyneed to imitate what TI did in this department: it appears that TI's standaloneL1 build omitted GPF (with the exception of OS and OSX) and everything thatlives in Riviera land, but for us the situation is different: we already havea successful build with Riviera and GPF, but no L1, thus we simply need to addL1 to what we have. Our idea of standalone L1 simply means building withoutthe G23 stack, which we have yet to begin integrating.In the standard firmware build, there is a component called L1 PEI. It is partof the G23 stack, and has header and library dependencies of the latter - thusit is *not* part of the L1 code proper. However, it performs some essentialinitialization steps, and runs the L1A task. We don't know how TI handledthese functions in their standalone L1 build - we don't have that part of theirsource, not even in the otherwise complete LoCosto version, not even if we weretargeting LoCosto hardware.Our solution: we are going to lift l1_pei out of LoCosto's g23m-gsm, and hackup a special version of it that won't have the standard complement of G23header and library dependencies. It is virtually certain that TI did somethingdifferent, but our hack-solution should work for our needs.Because our standalone L1 build is a specially stripped-down version of theregular fw build, and not at all like TI's standalone L1, we do NOT defineOP_L1_STANDALONE. Instead we have a different preprocessor symbol:CONFIG_L1_STANDALONE.The standard version of l1_pei calls vsi_c_open() to get queue handles ofseveral G23 stack entities; it connects by name to "PL", "MMI", and if GPRS isenabled, also to "GRR", "LLC" and "SND". If we leave these connect-by-namecalls unchanged in our L1 standalone version, our pei_init() will always returnPEI_ERROR and never successfully initialize, which would not be very useful.If we removed these vsi_c_open() calls and the associated OSX queue setup, thefirst osx_send_prim() addressed to the queue in question will crash, so thatapproach wouldn't be useful either.What we would like to do is redirect all outbound messages emitted by ourstandalone L1 to the debug serial interface, using GPF's TST entity, just as ifan L1 REDIRECT or DUPLICATE command was given to a complete GSM fw image.However, simply connecting our queues to TST won't work, as TST is not designedto receive "internal" protocol stack primitives directly. When the routingfacility is used to DUPLICATE or REDIRECT a prim to an external entity, thecode in gpf/frame/route.c sends a special "wrapper" prim to TST, and we need toreplicate this wrapping in order to achieve the same effect.Our solution: we are going to construct a special forwarder entity called L1IF,and the connect-by-name calls in l1_pei which normally point to PL, MMI etcwill point to L1IF instead. L1IF will run in the passive body variant, and itspei_primitive() function will replicate the routing facility's logic forforwarding PS primitives to TST. Whew!