FreeCalypso > hg > fc-tourmaline
view src/g23m-gprs/grr/grr_ctrlp.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 | fa8dc04885d8 |
children |
line wrap: on
line source
/* +----------------------------------------------------------------------------- | Project : GPRS (8441) | Modul : GRR +----------------------------------------------------------------------------- | 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 : Definitions for grr_ctrlp.c. +----------------------------------------------------------------------------- */ #ifndef GRR_CTRLP_H #define GRR_CTRLP_H /* TIMER */ EXTERN void ctrl_t3134 ( void ); EXTERN void ctrl_t3174 ( void ); EXTERN void ctrl_t3176 ( void ); #ifdef REL99 EXTERN void ctrl_t_poll_timer(void); #endif /* GMMRR */ EXTERN void ctrl_gmmrr_enable_req ( T_GMMRR_ENABLE_REQ *gmmrr_enable_req ); EXTERN void ctrl_gmmrr_assign_req ( T_GMMRR_ASSIGN_REQ *gmmrr_assign_req ); EXTERN void ctrl_gmmrr_disable_req ( T_GMMRR_DISABLE_REQ *gmmrr_disable_req ); EXTERN void ctrl_gmmrr_suspend_req ( T_GMMRR_SUSPEND_REQ *gmmrr_suspend_req ); EXTERN void ctrl_gmmrr_resume_req ( T_GMMRR_RESUME_REQ *gmmrr_resume_req ); EXTERN void ctrl_gmmrr_cs_page_res ( T_GMMRR_CS_PAGE_RES *gmmrr_cs_page_res ); EXTERN void ctrl_gmmrr_standby_req ( T_GMMRR_STANDBY_REQ *gmmrr_standby_req ); EXTERN void ctrl_gmmrr_ready_req ( T_GMMRR_READY_REQ *gmmrr_ready_req ); EXTERN void ctrl_gmmrr_attach_started_req ( T_GMMRR_ATTACH_STARTED_REQ *gmmrr_attach_started_req ); EXTERN void ctrl_gmmrr_attach_finished_req ( T_GMMRR_ATTACH_FINISHED_REQ *gmmrr_attach_finished_req ); EXTERN void ctrl_gmmrr_cell_res ( T_GMMRR_CELL_RES *gmmrr_cell_res ); /* RRGRR */ EXTERN void ctrl_rrgrr_gprs_si13_ind ( T_RRGRR_GPRS_SI13_IND *rrgrr_gprs_si13_ind ); EXTERN void ctrl_rrgrr_packet_paging_ind ( T_RRGRR_PACKET_PAGING_IND *rrgrr_packet_paging_ind ); EXTERN void ctrl_rrgrr_ia_ind ( T_RRGRR_IA_IND *rrgrr_ia_ind ); EXTERN void ctrl_rrgrr_iaext_ind ( T_RRGRR_IAEXT_IND *rrgrr_iaext_ind ); EXTERN void ctrl_rrgrr_assignment_rej_ind ( T_RRGRR_ASSIGNMENT_REJ_IND *rrgrr_assignment_rej_ind ); EXTERN void ctrl_rrgrr_data_ind ( T_RRGRR_DATA_IND *rrgrr_data_ind ); EXTERN void ctrl_rrgrr_ia_downlink_ind ( T_RRGRR_IA_DOWNLINK_IND *rrgrr_ia_downlink_ind ); EXTERN void ctrl_rrgrr_stop_task_cnf ( T_RRGRR_STOP_TASK_CNF *rrgrr_stop_task_cnf ); EXTERN void ctrl_rrgrr_rr_est_ind ( T_RRGRR_RR_EST_IND *rrgrr_rr_est_ind); EXTERN void ctrl_rrgrr_suspend_dcch_cnf ( T_RRGRR_SUSPEND_DCCH_CNF *rrgrr_suspend_dcch_cnf); EXTERN void ctrl_rrgrr_reconnect_dcch_cnf ( T_RRGRR_RECONNECT_DCCH_CNF *rrgrr_reconnect_dcch_cnf); EXTERN void ctrl_rrgrr_stop_dcch_ind(T_RRGRR_STOP_DCCH_IND* rrgrr_stop_dcch_ind); EXTERN void ctrl_rrgrr_cr_ind( T_RRGRR_CR_IND *cr_ind); EXTERN void ctrl_rrgrr_check_bsic_ind ( T_RRGRR_NCELL_SYNC_IND *rrgrr_check_bsic_ind ); EXTERN void ctrl_rrgrr_sync_ind ( T_RRGRR_SYNC_IND *rrgrr_sync_ind ); EXTERN void ctrl_rrgrr_meas_rep_cnf ( T_RRGRR_MEAS_REP_CNF *rrgrr_meas_rep_cnf ); EXTERN void ctrl_rrgrr_ext_meas_cnf ( T_RRGRR_EXT_MEAS_CNF *rrgrr_ext_meas_cnf ); EXTERN void ctrl_rrgrr_ms_id_ind(T_RRGRR_MS_ID_IND *ms_id); /* CGRLC */ EXTERN void ctrl_cgrlc_standby_state_ind ( T_CGRLC_STANDBY_STATE_IND *cgrlc_standby_state_ind ); EXTERN void ctrl_cgrlc_ready_state_ind ( T_CGRLC_READY_STATE_IND *cgrlc_ready_state_ind ); #if defined (REL99) AND defined (TI_PS_FF_EMR) EXTERN void ctrl_rrgrr_si2quater_ind(T_RRGRR_SI2QUATER_IND *rrgrr_enh_para_ind); #endif #endif /* !GRR_CTRLP_H */