view src/cs/drivers/drv_app/r2d/r2d_task.c @ 303:f76436d19a7a default tip

!GPRS config: fix long-standing AT+COPS chance hanging bug There has been a long-standing bug in FreeCalypso going back years: sometimes in the AT command bring-up sequence of an ACI-only MS, the AT+COPS command would produce only a power scan followed by cessation of protocol stack activity (only L1 ADC traces), instead of the expected network search sequence. This behaviour was seen in different FC firmware versions going back to Citrine, and seemed to follow some law of chance, not reliably repeatable. This bug has been tracked down and found to be specific to !GPRS configuration, stemming from our TCS2/TCS3 hybrid and reconstruction of !GPRS support that was bitrotten in TCS3.2/LoCosto version. ACI module psa_mms.c, needed only for !GPRS, was missing in the TCS3 version and had to be pulled from TCS2 - but as it turns out, there is a new field in the MMR_REG_REQ primitive that needs to be set correctly, and that psa_mms.c module is the place where this initialization needed to be added.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 08 Jun 2023 08:23:37 +0000
parents 0196b6bf633c
children
line wrap: on
line source

/**

    @file:	r2d_task.c

    @author Christophe Favergeon

    @version 0.5

    Purpose: Refresh task for R2D. It is calling the LCD dependent refresh subroutine

*/

/*

    Date       	Modification
  ------------------------------------
    06/02/2001	Create
    10/18/2001  Version 0.5 for first integration with Riviera database


 (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved
*/


#include "rv/general.h"
#include "rvf/rvf_api.h"
#include "rvm/rvm_api.h"
#include "rvm/rvm_use_id_list.h"
#include "r2d/r2d_messages.h"
#include "r2d/r2d_env.h"
#include "r2d/r2d_config.h"
#include "r2d/r2d.h"
#include "r2d/r2d_i.h"

extern void r2d_refresh(void);

extern INT16 r2d_g_refresh_disabled;

extern void r2d_process_onoff_message(T_R2D_EVT *msg);

/* FreeCalypso addition */
int r2d_is_running, r2d_lcd_hw_suspend;

/*******************************************************************************
** Function         r2d_core
**
** Description      Core of the r2d task, which refresh the LCD
**
*******************************************************************************/
T_RVM_RETURN r2d_core(void)
{
	BOOLEAN error_occured = FALSE;
	T_R2D_EVT *msg;

	//r2d_start();

	rvf_send_trace("R2D REFRESH TASK STARTED", 24, NULL_PARAM,
			RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID);
#ifdef CONFIG_TARGET_LUNA
	r2d_refresh_task_secondary_init();
	rvf_send_trace("R2D secondary init complete", 27, NULL_PARAM,
			RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID);
#endif
	r2d_is_running = 1;

	/* loop to process messages */
	while (error_occured == FALSE)
	{
		UINT16 received_event;
		//rvf_send_trace("WAIT EVENT",strlen("WAIT EVENT"), NULL_PARAM,
		//	   RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX );
		/* Wait for the necessary events (infinite wait for a msg in the mailbox 0). */
		received_event = rvf_wait(EVENT_MASK(RVF_APPL_EVT_0) |
					  RVF_TASK_MBOX_0_EVT_MASK, 0);

		 //rvf_send_trace("EVENT RECEIVED",strlen("EVENT RECEIVED"), NULL_PARAM,
		//	   RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX );

		/* Check for mailbox events */
		if (received_event & RVF_TASK_MBOX_0_EVT_MASK) 
		{
			/* Read the message in the driver mailbox and delegate action..*/
			msg = (T_R2D_EVT *) rvf_read_mbox(RVF_TASK_MBOX_0);
			if (msg) {
				if (msg->os_hdr.msg_id == R2D_MESSAGE_ONOFF)
					r2d_process_onoff_message(msg);
				rvf_free_buf ((void *) msg);
			}
		}
		/* Check for refresh trigger events */
		if (received_event & EVENT_MASK(RVF_APPL_EVT_0))
		{
			//rvf_send_trace("GOOD EVENT",strlen("GOOD EVENT"), NULL_PARAM,
			//   RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX );

			r2d_g_event_was_sent=FALSE;
			if (r2d_g_refresh_disabled==0 && !r2d_lcd_hw_suspend)
			{
			    r2d_refresh();
			    rvf_delay(RVF_MS_TO_TICKS(R2D_REFRESH_PERIOD));
			}
		}
	}

	return RVM_OK;
}