FreeCalypso > hg > fc-tourmaline
view cdg-hybrid/cdginc/p_8010_134_mmpm_sap.h @ 220:0ed36de51973
ABB semaphore protection overhaul
The ABB semaphone protection logic that came with TCS211 from TI
was broken in several ways:
* Some semaphore-protected functions were called from Application_Initialize()
context. NU_Obtain_Semaphore() called with NU_SUSPEND fails with
NU_INVALID_SUSPEND in this context, but the return value wasn't checked,
and NU_Release_Semaphore() would be called unconditionally at the end.
The latter call would increment the semaphore count past 1, making the
semaphore no longer binary and thus no longer effective for resource
protection. The fix is to check the return value from NU_Obtain_Semaphore()
and skip the NU_Release_Semaphore() call if the semaphore wasn't properly
obtained.
* Some SPI hardware manipulation was being done before entering the semaphore-
protected critical section. The fix is to reorder the code: first obtain
the semaphore, then do everything else.
* In the corner case of L1/DSP recovery, l1_abb_power_on() would call some
non-semaphore-protected ABB & SPI init functions. The fix is to skip those
calls in the case of recovery.
* A few additional corner cases existed, all of which are fixed by making
ABB semaphore protection 100% consistent for all ABB functions and code paths.
There is still one remaining problem of priority inversion: suppose a low-
priority task calls an ABB function, and some medium-priority task just happens
to preempt right in the middle of that semaphore-protected ABB operation. Then
the high-priority SPI task is locked out for a non-deterministic time until
that medium-priority task finishes its work and goes back to sleep. This
priority inversion problem remains outstanding for now.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Mon, 26 Apr 2021 20:55:25 +0000 |
| parents | 35f7a1dc9f7d |
| children |
line wrap: on
line source
/* +--------------------------------------------------------------------------+ | PROJECT : PROTOCOL STACK | | FILE : p_8010_134_mmpm_sap.h | | SOURCE : "sap\8010_134_mmpm_sap.pdf" | | LastModified : "2003-07-29" | | IdAndVersion : "8010.134.02.007" | | SrcFileTime : "Thu Nov 29 09:27:04 2007" | | Generated by CCDGEN_2.5.5A on Fri Oct 14 21:41:52 2016 | | !!DO NOT MODIFY!!DO NOT MODIFY!!DO NOT MODIFY!! | +--------------------------------------------------------------------------+ */ /* PRAGMAS * PREFIX : MMPM * COMPATIBILITY_DEFINES : NO * ALWAYS_ENUM_IN_VAL_FILE: YES * ENABLE_GROUP: NO * CAPITALIZE_TYPENAME: NO */ #ifndef P_8010_134_MMPM_SAP_H #define P_8010_134_MMPM_SAP_H #define CDG_ENTER__P_8010_134_MMPM_SAP_H #define CDG_ENTER__FILENAME _P_8010_134_MMPM_SAP_H #define CDG_ENTER__P_8010_134_MMPM_SAP_H__FILE_TYPE CDGINC #define CDG_ENTER__P_8010_134_MMPM_SAP_H__LAST_MODIFIED _2003_07_29 #define CDG_ENTER__P_8010_134_MMPM_SAP_H__ID_AND_VERSION _8010_134_02_007 #define CDG_ENTER__P_8010_134_MMPM_SAP_H__SRC_FILE_TIME _Thu_Nov_29_09_27_04_2007 #include "CDG_ENTER.h" #undef CDG_ENTER__P_8010_134_MMPM_SAP_H #undef CDG_ENTER__FILENAME #include "p_8010_134_mmpm_sap.val" #include "p_8010_137_nas_include.h" #include "p_8010_152_ps_include.h" #include "p_8010_153_cause_include.h" /* * typedef between var and valtab enums */ #ifndef __T_MMPM_establish_cause__ #define __T_MMPM_establish_cause__ typedef T_MMPM_VAL_establish_cause T_MMPM_establish_cause; #endif #ifndef __T_MMPM_reg_state__ #define __T_MMPM_reg_state__ typedef T_MMPM_VAL_reg_state T_MMPM_reg_state; #endif #ifndef __T_MMPM_npdu_list__ #define __T_MMPM_npdu_list__ /* * list of received N-PDU numbers * CCDGEN:WriteStruct_Count==1247 */ typedef struct { U8 nsapi; /*< 0: 1> T_NAS_nsapi, network layer service access point identifier */ U8 receive_n_pdu_number_val; /*< 1: 1> Receive N-PDU Number value */ U8 _align0; /*< 2: 1> alignment */ U8 _align1; /*< 3: 1> alignment */ } T_MMPM_npdu_list; #endif /* * End of substructure section, begin of primitive definition section */ #ifndef __T_MMPM_ATTACH_IND__ #define __T_MMPM_ATTACH_IND__ /* * * CCDGEN:WriteStruct_Count==1248 */ typedef struct { U8 rat; /*< 0: 1> T_PS_rat, Radio access technology */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_MMPM_ATTACH_IND; #endif #ifndef __T_MMPM_DETACH_IND__ #define __T_MMPM_DETACH_IND__ /* * * CCDGEN:WriteStruct_Count==1249 */ typedef struct { T_CAUSE_ps_cause ps_cause; /*< 0: 4> Cause element containing result of operation (type defined in "p_8010_153_cause_include.h") */ } T_MMPM_DETACH_IND; #endif #ifndef __T_MMPM_PDP_CONTEXT_STATUS_REQ__ #define __T_MMPM_PDP_CONTEXT_STATUS_REQ__ /* * * CCDGEN:WriteStruct_Count==1250 */ typedef struct { U16 nsapi_set; /*< 0: 2> PDP Context Status */ U8 _align0; /*< 2: 1> alignment */ U8 _align1; /*< 3: 1> alignment */ } T_MMPM_PDP_CONTEXT_STATUS_REQ; #endif #ifndef __T_MMPM_RAT_CHANGE_COMPLETED_IND__ #define __T_MMPM_RAT_CHANGE_COMPLETED_IND__ /* * * CCDGEN:WriteStruct_Count==1251 */ typedef struct { U8 rat; /*< 0: 1> T_PS_rat, Radio access technology */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_MMPM_RAT_CHANGE_COMPLETED_IND; #endif #ifndef __T_MMPM_RAT_CHANGE_IND__ #define __T_MMPM_RAT_CHANGE_IND__ /* * * CCDGEN:WriteStruct_Count==1252 */ typedef struct { U8 rat; /*< 0: 1> T_PS_rat, Radio access technology */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_MMPM_RAT_CHANGE_IND; #endif #ifndef __T_MMPM_REESTABLISH_REQ__ #define __T_MMPM_REESTABLISH_REQ__ /* * * CCDGEN:WriteStruct_Count==1253 */ typedef struct { U8 establish_cause; /*< 0: 1> T_MMPM_establish_cause, Establish Cause */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_MMPM_REESTABLISH_REQ; #endif #ifndef __T_MMPM_REESTABLISH_CNF__ #define __T_MMPM_REESTABLISH_CNF__ /* * * CCDGEN:WriteStruct_Count==1254 */ typedef struct { U8 dummy; /*< 0: 1> no parameters */ } T_MMPM_REESTABLISH_CNF; #endif #ifndef __T_MMPM_REESTABLISH_REJ__ #define __T_MMPM_REESTABLISH_REJ__ /* * * CCDGEN:WriteStruct_Count==1255 */ typedef struct { T_CAUSE_ps_cause ps_cause; /*< 0: 4> Cause element containing result of operation (type defined in "p_8010_153_cause_include.h") */ } T_MMPM_REESTABLISH_REJ; #endif #ifndef __T_MMPM_REG_STATE_REQ__ #define __T_MMPM_REG_STATE_REQ__ /* * * CCDGEN:WriteStruct_Count==1256 */ typedef struct { U8 dummy; /*< 0: 1> no parameters */ } T_MMPM_REG_STATE_REQ; #endif #ifndef __T_MMPM_REG_STATE_CNF__ #define __T_MMPM_REG_STATE_CNF__ /* * * CCDGEN:WriteStruct_Count==1257 */ typedef struct { U8 reg_state; /*< 0: 1> T_MMPM_reg_state, Registration State */ U8 _align0; /*< 1: 1> alignment */ U8 _align1; /*< 2: 1> alignment */ U8 _align2; /*< 3: 1> alignment */ } T_MMPM_REG_STATE_CNF; #endif #ifndef __T_MMPM_ERROR_IND__ #define __T_MMPM_ERROR_IND__ /* * * CCDGEN:WriteStruct_Count==1258 */ typedef struct { T_CAUSE_ps_cause ps_cause; /*< 0: 4> Cause element containing result of operation (type defined in "p_8010_153_cause_include.h") */ } T_MMPM_ERROR_IND; #endif #ifndef __T_MMPM_RESUME_IND__ #define __T_MMPM_RESUME_IND__ /* * * CCDGEN:WriteStruct_Count==1259 */ typedef struct { U8 dummy; /*< 0: 1> no parameters */ } T_MMPM_RESUME_IND; #endif #ifndef __T_MMPM_SEQUENCE_IND__ #define __T_MMPM_SEQUENCE_IND__ /* * * CCDGEN:WriteStruct_Count==1260 */ typedef struct { U8 _align0; /*< 0: 1> alignment */ U8 _align1; /*< 1: 1> alignment */ U8 _align2; /*< 2: 1> alignment */ U8 c_npdu_list; /*< 3: 1> counter */ T_MMPM_npdu_list npdu_list[MMPM_MAX_N_PDU_NUMBER_LIST]; /*< 4: 64> list of received N-PDU numbers */ } T_MMPM_SEQUENCE_IND; #endif #ifndef __T_MMPM_SEQUENCE_RES__ #define __T_MMPM_SEQUENCE_RES__ /* * * CCDGEN:WriteStruct_Count==1261 */ typedef struct { U8 _align0; /*< 0: 1> alignment */ U8 _align1; /*< 1: 1> alignment */ U8 _align2; /*< 2: 1> alignment */ U8 c_npdu_list; /*< 3: 1> counter */ T_MMPM_npdu_list npdu_list[MMPM_MAX_N_PDU_NUMBER_LIST]; /*< 4: 64> list of received N-PDU numbers */ } T_MMPM_SEQUENCE_RES; #endif #ifndef __T_MMPM_SUSPEND_IND__ #define __T_MMPM_SUSPEND_IND__ /* * * CCDGEN:WriteStruct_Count==1262 */ typedef struct { T_CAUSE_ps_cause ps_cause; /*< 0: 4> Cause element containing result of operation (type defined in "p_8010_153_cause_include.h") */ } T_MMPM_SUSPEND_IND; #endif #ifndef __T_MMPM_UNITDATA_IND__ #define __T_MMPM_UNITDATA_IND__ /* * * CCDGEN:WriteStruct_Count==1263 */ typedef struct { T_sdu sdu; /*< 0: 0> Container for a message */ } T_MMPM_UNITDATA_IND; #endif #ifndef __T_MMPM_UNITDATA_REQ__ #define __T_MMPM_UNITDATA_REQ__ /* * * CCDGEN:WriteStruct_Count==1264 */ typedef struct { U8 org_entity; /*< 0: 1> T_NAS_org_entity, Originator of a request to MM */ U8 v_establish_cause; /*< 1: 1> valid-flag */ U8 establish_cause; /*< 2: 1> T_MMPM_establish_cause, Establish Cause */ U8 v_nsapi_set; /*< 3: 1> valid-flag */ U16 nsapi_set; /*< 4: 2> PDP Context Status */ U8 _align0; /*< 6: 1> alignment */ U8 _align1; /*< 7: 1> alignment */ T_sdu sdu; /*< 8: 0> Container for a message */ } T_MMPM_UNITDATA_REQ; #endif #include "CDG_LEAVE.h" #endif
