annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /**
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
2
217
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
3 @file: r2d_task.c
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
4
217
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
5 @author Christophe Favergeon
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
6
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
7 @version 0.5
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 Purpose: Refresh task for R2D. It is calling the LCD dependent refresh subroutine
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
10
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 */
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 /*
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
14
217
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
15 Date Modification
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
16 ------------------------------------
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
17 06/02/2001 Create
217
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
18 10/18/2001 Version 0.5 for first integration with Riviera database
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
19
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
20
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 */
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #include "rv/general.h"
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #include "rvf/rvf_api.h"
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 #include "rvm/rvm_api.h"
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #include "rvm/rvm_use_id_list.h"
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #include "r2d/r2d_messages.h"
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "r2d/r2d_env.h"
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "r2d/r2d_config.h"
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include "r2d/r2d.h"
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "r2d/r2d_i.h"
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 extern void r2d_refresh(void);
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 extern INT16 r2d_g_refresh_disabled;
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
217
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
39 extern void r2d_process_onoff_message(T_R2D_EVT *msg);
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
40
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 /* FreeCalypso addition */
277
0196b6bf633c R2D: LCD hardware suspend implemented for Luna
Mychaela Falconia <falcon@freecalypso.org>
parents: 276
diff changeset
42 int r2d_is_running, r2d_lcd_hw_suspend;
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 /*******************************************************************************
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 ** Function r2d_core
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 **
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 ** Description Core of the r2d task, which refresh the LCD
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
48 **
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 *******************************************************************************/
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 T_RVM_RETURN r2d_core(void)
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 {
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 BOOLEAN error_occured = FALSE;
217
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
53 T_R2D_EVT *msg;
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 //r2d_start();
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 rvf_send_trace("R2D REFRESH TASK STARTED", 24, NULL_PARAM,
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID);
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 #ifdef CONFIG_TARGET_LUNA
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 r2d_refresh_task_secondary_init();
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 rvf_send_trace("R2D secondary init complete", 27, NULL_PARAM,
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID);
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 #endif
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 r2d_is_running = 1;
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 /* loop to process messages */
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 while (error_occured == FALSE)
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 {
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 UINT16 received_event;
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
70 //rvf_send_trace("WAIT EVENT",strlen("WAIT EVENT"), NULL_PARAM,
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 // RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX );
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 /* Wait for the necessary events (infinite wait for a msg in the mailbox 0). */
217
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
73 received_event = rvf_wait(EVENT_MASK(RVF_APPL_EVT_0) |
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
74 RVF_TASK_MBOX_0_EVT_MASK, 0);
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
76 //rvf_send_trace("EVENT RECEIVED",strlen("EVENT RECEIVED"), NULL_PARAM,
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 // RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX );
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
78
217
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
79 /* Check for mailbox events */
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
80 if (received_event & RVF_TASK_MBOX_0_EVT_MASK)
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
81 {
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
82 /* Read the message in the driver mailbox and delegate action..*/
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
83 msg = (T_R2D_EVT *) rvf_read_mbox(RVF_TASK_MBOX_0);
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
84 if (msg) {
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
85 if (msg->os_hdr.msg_id == R2D_MESSAGE_ONOFF)
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
86 r2d_process_onoff_message(msg);
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
87 rvf_free_buf ((void *) msg);
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
88 }
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
89 }
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
90 /* Check for refresh trigger events */
6541e43f88e5 R2D display on/off control implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 216
diff changeset
91 if (received_event & EVENT_MASK(RVF_APPL_EVT_0))
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 {
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
93 //rvf_send_trace("GOOD EVENT",strlen("GOOD EVENT"), NULL_PARAM,
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 // RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX );
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 r2d_g_event_was_sent=FALSE;
277
0196b6bf633c R2D: LCD hardware suspend implemented for Luna
Mychaela Falconia <falcon@freecalypso.org>
parents: 276
diff changeset
97 if (r2d_g_refresh_disabled==0 && !r2d_lcd_hw_suspend)
276
4221c724c664 R2D: preparations for adding LCD hardware suspend handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
98 {
4221c724c664 R2D: preparations for adding LCD hardware suspend handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
99 r2d_refresh();
4221c724c664 R2D: preparations for adding LCD hardware suspend handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
100 rvf_delay(RVF_MS_TO_TICKS(R2D_REFRESH_PERIOD));
4221c724c664 R2D: preparations for adding LCD hardware suspend handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
101 }
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 }
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 }
216
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
104
777698cf6583 r2d_task.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
105 return RVM_OK;
0
4e78acac3d88 src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 }