FreeCalypso > hg > fc-magnetite
view src/g23m-gprs/sndcp/sndcp_sup.c @ 673:62a5285e014a
Lorekeeping: allow tpudrv-leonardo.lib on Leonardo/Tango
Back in 2015 the Mother's idea was to produce a FreeCalypso development
board that would be a clone of TI Leonardo, including the original
quadband RFFE; one major additional stipulation was that this board
needed to be able to run original unmodified TCS211-20070608 firmware
with all blobs intact, with only minimal binary patches to main.lib
and tpudrv.lib. The necessary patched libs were produced at that time
in the tcs211-patches repository.
That plan was changed and we produced FCDEV3B instead, with Openmoko's
triband RFFE instead of Leonardo quadband, but when FC Magnetite started
in 2016, a TPUDRV_blob= provision was still made, allowing the possibility
of patching OM's tpudrv.lib for a restored Leonardo RFFE.
Now in 2020 we have FC Tango which is essentially a verbatim clone of
Leonardo core, including the original quadband RFFE. We have also
deblobbed our firmware so much that we have absolutely no real need
for a blob version of tpudrv.lib - but I thought it would be neat to put
the ancient TPUDRV_blob= mechanism (classic config) to its originally
intended use, just for the heck of it.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 29 May 2020 03:55:36 +0000 |
parents | 219afcfc6250 |
children |
line wrap: on
line source
/* +----------------------------------------------------------------------------- | Project : GPRS (8441) | Modul : sndcp_sup.c +----------------------------------------------------------------------------- | Copyright 2002 Texas Instruments Berlin, AG | All rights reserved. | | This file is confidential and a trade secret of Texas | Instruments Berlin, AG | The receipt of or possession of this file does not convey | any rights to reproduce or disclose its contents or to | manufacture, use, or sell anything it may describe, in | whole, or in part, without the specific written consent of | Texas Instruments Berlin, AG. +----------------------------------------------------------------------------- | Purpose : This modul is part of the entity SNDCP and implements all | functions to handles the incoming primitives as described in | the SDL-documentation (SU-statemachine) +----------------------------------------------------------------------------- */ /*---- HISTORY --------------------------------------------------------------*/ #define ENTITY_SNDCP /*==== INCLUDES =============================================================*/ #include "typedefs.h" /* to get Condat data types */ #include "vsi.h" /* to get a lot of macros */ #include "macdef.h" #include "prim.h" /* to get the definitions of used SAP and directions */ #include "dti.h" #include "sndcp.h" /* to get the global entity definitions */ #include "sndcp_f.h" /* to get the functions to access the global arrays*/ #include "sndcp_suf.h" /* to get internal functions of service su */ #include "sndcp_nus.h" /* to get signal functions to service nu */ /*==== CONST ================================================================*/ /*==== LOCAL VARS ===========================================================*/ /*==== PRIVATE FUNCTIONS ====================================================*/ /*==== PUBLIC FUNCTIONS =====================================================*/ #ifdef _SNDCP_DTI_2_ /* +------------------------------------------------------------------------------ | Function : su_ll_unitready_ind +------------------------------------------------------------------------------ | Description : Handles the primitive LL_UNITREADY_IND | | Parameters : *ll_unitready_ind - Ptr to primitive payload | +------------------------------------------------------------------------------ */ GLOBAL void su_ll_unitready_ind ( T_LL_UNITREADY_IND *ll_unitready_ind ) { U8 sapi_index = 0; TRACE_FUNCTION( "su_ll_unitready_ind" ); #ifdef FLOW_TRACE sndcp_trace_flow_control(FLOW_TRACE_SNDCP, FLOW_TRACE_UP, FLOW_TRACE_BOTTOM, TRUE); #endif /* * set service instance according to sapi in primitive */ sndcp_get_sapi_index(ll_unitready_ind->sapi, &sapi_index); sndcp_data->su = & sndcp_data->su_base[sapi_index]; switch( GET_STATE( SU ) ) { case SU_LLC_NOT_RECEPTIVE_SUSPEND: /* * Is queue with outgoing LL_UNITDESC_REQs empty? */ if (sndcp_data->su->ll_unitdesc_q_read == sndcp_data->su->ll_unitdesc_q_write) { if (sndcp_data->su->cia_state == CIA_IDLE) { su_next_sn_unitdata_req(ll_unitready_ind->sapi); } } SET_STATE(SU, SU_LLC_RECEPTIVE_SUSPEND); break; case SU_LLC_RECEPTIVE_SUSPEND: break; case SU_LLC_NOT_RECEPTIVE: /* * Is queue with outgoing LL_UNITDESC_REQs empty? */ if (sndcp_data->su->ll_unitdesc_q_read == sndcp_data->su->ll_unitdesc_q_write) { SET_STATE(SU, SU_LLC_RECEPTIVE); if (sndcp_data->su->cia_state == CIA_IDLE) { su_next_sn_unitdata_req(ll_unitready_ind->sapi); } } else { /* sndcp_data->su.ll_unitdesc_q is not empty */ /* * Send next ll_unitdesc_req from queue. */ U8 ll_unitdesc_seg_pos; U8 ll_unitdesc_nsapi; U8 ll_unitdesc_sapi; T_LL_UNITDESC_REQ* ll_unitdesc_req = sndcp_data->su->ll_unitdesc_q[sndcp_data->su->ll_unitdesc_q_read]; sndcp_data->su->ll_unitdesc_q[sndcp_data->su->ll_unitdesc_q_read] = NULL; sndcp_data->su->ll_unitdesc_q_read = (sndcp_data->su->ll_unitdesc_q_read + 1) % SNDCP_SEGMENT_NUMBERS_UNACK; #ifdef SNDCP_TRACE_ALL TRACE_EVENT("uplink with sn header at LL SAP: "); TRACE_EVENT_P1("%d octets", ll_unitdesc_req->desc_list3.list_len); sndcp_trace_desc_list3_content(ll_unitdesc_req->desc_list3); #endif #ifdef FLOW_TRACE sndcp_trace_flow_control(FLOW_TRACE_SNDCP, FLOW_TRACE_UP, FLOW_TRACE_BOTTOM, FALSE); #endif ll_unitdesc_seg_pos = ll_unitdesc_req->seg_pos; ll_unitdesc_nsapi = su_get_nsapi(ll_unitdesc_req); ll_unitdesc_sapi = ll_unitdesc_req->sapi; #ifdef _SIMULATION_ su_send_ll_unitdata_req_test(ll_unitdesc_req); #else /* _SIMULATION_ */ PSEND(hCommLLC, ll_unitdesc_req); #endif /* _SIMULATION_ */ if ((ll_unitdesc_seg_pos & SEG_POS_LAST) > 0) { sig_su_nu_ready_ind( ll_unitdesc_nsapi ); su_next_sn_unitdata_req( ll_unitdesc_sapi ); sndcp_data->su->cia_state = CIA_IDLE; } } /* sndcp_data->su.ll_unitdesc_q is not empty */ break; case SU_LLC_RECEPTIVE: break; default: TRACE_ERROR( "LL_UNITREADY_IND unexpected" ); break; } if (ll_unitready_ind != NULL) { PFREE(ll_unitready_ind); } } /* su_ll_unitready_ind() */ #else /* _SNDCP_DTI_2_ */ /* +------------------------------------------------------------------------------ | Function : su_ll_unitready_ind +------------------------------------------------------------------------------ | Description : Handles the primitive LL_UNITREADY_IND | | Parameters : *ll_unitready_ind - Ptr to primitive payload | +------------------------------------------------------------------------------ */ GLOBAL void su_ll_unitready_ind ( T_LL_UNITREADY_IND *ll_unitready_ind ) { UBYTE sapi_index = 0; TRACE_FUNCTION( "su_ll_unitready_ind" ); #ifdef FLOW_TRACE sndcp_trace_flow_control(FLOW_TRACE_SNDCP, FLOW_TRACE_UP, FLOW_TRACE_BOTTOM, TRUE); #endif /* * set service instance according to sapi in primitive */ sndcp_get_sapi_index(ll_unitready_ind->sapi, &sapi_index); sndcp_data->su = & sndcp_data->su_base[sapi_index]; switch( GET_STATE( SU ) ) { case SU_LLC_NOT_RECEPTIVE_SUSPEND: /* * Is queue with outgoing LL_UNITDATA_REQs empty? */ if (sndcp_data->su->ll_unitdata_q_read == sndcp_data->su->ll_unitdata_q_write) { if (sndcp_data->su->cia_state == CIA_IDLE) { su_next_sn_unitdata_req(ll_unitready_ind->sapi); } } SET_STATE(SU, SU_LLC_RECEPTIVE_SUSPEND); break; case SU_LLC_RECEPTIVE_SUSPEND: break; case SU_LLC_NOT_RECEPTIVE: /* * Is queue with outgoing LL_UNITDATA_REQs empty? */ if (sndcp_data->su->ll_unitdata_q_read == sndcp_data->su->ll_unitdata_q_write) { SET_STATE(SU, SU_LLC_RECEPTIVE); if (sndcp_data->su->cia_state == CIA_IDLE) { su_next_sn_unitdata_req(ll_unitready_ind->sapi); } } else { /* sndcp_data->su.ll_unitdata_q is not empty */ /* * Send next ll_unitdata_req from queue. */ UBYTE ll_unitdata_seg_pos; UBYTE ll_unitdata_nsapi; UBYTE ll_unitdata_sapi; T_LL_UNITDATA_REQ* ll_unitdata_req = sndcp_data->su->ll_unitdata_q[sndcp_data->su->ll_unitdata_q_read]; sndcp_data->su->ll_unitdata_q[sndcp_data->su->ll_unitdata_q_read] = NULL; sndcp_data->su->ll_unitdata_q_read = (sndcp_data->su->ll_unitdata_q_read + 1) % SNDCP_SEGMENT_NUMBERS_UNACK; #ifdef SNDCP_TRACE_ALL TRACE_EVENT("uplink with sn header at LL SAP: "); TRACE_EVENT_P1("%d octets", (ll_unitdata_req->sdu.l_buf + 7) / 8); sndcp_trace_sdu(& ll_unitdata_req->sdu); #endif #ifdef FLOW_TRACE sndcp_trace_flow_control(FLOW_TRACE_SNDCP, FLOW_TRACE_UP, FLOW_TRACE_BOTTOM, FALSE); #endif ll_unitdata_seg_pos = ll_unitdata_req->seg_pos; ll_unitdata_nsapi = su_get_nsapi(ll_unitdata_req); ll_unitdata_sapi = ll_unitdata_req->sapi; PSEND (hCommLLC, ll_unitdata_req); if ((ll_unitdata_seg_pos & SEG_POS_LAST) > 0) { sig_su_nu_ready_ind( ll_unitdata_nsapi ); su_next_sn_unitdata_req( ll_unitdata_sapi ); sndcp_data->su->cia_state = CIA_IDLE; } } /* sndcp_data->su.ll_unitdata_q is not empty */ break; case SU_LLC_RECEPTIVE: break; default: TRACE_ERROR( "LL_UNITREADY_IND unexpected" ); break; } if (ll_unitready_ind != NULL) { PFREE(ll_unitready_ind); } } /* su_ll_unitready_ind() */ #endif /* _SNDCP_DTI_2_ */