FreeCalypso > hg > fc-tourmaline
annotate src/cs/drivers/drv_app/r2d/lcds/c139/r2d_task_i.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 | 4221c724c664 |
children |
rev | line source |
---|---|
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 #include "r2d/lcds/c139/colors.h" |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 void c139_uwire_xmit(UINT16 cmd) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 { |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * (volatile UINT16 *) TDR = cmd << 7; |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * (volatile UINT16 *) CSR |= NB_BITS_WR_9 + CS_CMD + START ; // transmit command data |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 while (((* (volatile UINT16 *) CSR) & CSRB) != 0 ); // wait for end of WRITE |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 * (volatile UINT16 *) CSR &= ~CS_CMD; // clears Chip Select |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 void c139_lcd_ctrl_cmd(UINT8 cmd, UINT8 param) |
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 c139_uwire_xmit(cmd); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 c139_uwire_xmit(param | 0x100); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 void c139_set_lcd_addr_region(UINT8 xstart, UINT8 xend, |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 UINT8 ystart, UINT8 yend) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 { |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 c139_lcd_ctrl_cmd(0x10, xstart); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 c139_lcd_ctrl_cmd(0x11, ystart); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 c139_lcd_ctrl_cmd(0x12, xend); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 c139_lcd_ctrl_cmd(0x13, yend); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 c139_lcd_ctrl_cmd(0x14, xstart); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 c139_lcd_ctrl_cmd(0x15, ystart); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 void c139_lcd_send_pix(UINT16 pixval) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 { |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 c139_uwire_xmit((pixval >> 8) | 0x100); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 c139_uwire_xmit((pixval & 0xFF) | 0x100); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 void r2d_lcd_power_on(void) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 { |
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 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 void r2d_lcd_power_off(void) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 { |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 void r2d_refresh(void) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 { |
47
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
44 UINT16 i, j, k; |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
45 UINT32 v; |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
46 UINT32 *p; |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
47 INT16 y1, y2; |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 |
47
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
49 p=r2d_g_framebuffer->p_memory_words; |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
50 |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
51 y1=r2d_update_ul_y; //0 |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
52 y2=r2d_update_br_y; //63 |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
53 |
276
4221c724c664
R2D: preparations for adding LCD hardware suspend handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
47
diff
changeset
|
54 if (y1 > y2) |
4221c724c664
R2D: preparations for adding LCD hardware suspend handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
47
diff
changeset
|
55 return; |
4221c724c664
R2D: preparations for adding LCD hardware suspend handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
47
diff
changeset
|
56 r2d_reinit_update_region(); |
4221c724c664
R2D: preparations for adding LCD hardware suspend handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
47
diff
changeset
|
57 |
47
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
58 /* set window area */ |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
59 c139_set_lcd_addr_region(0, 95, y1, y2); |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
60 |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
61 p=p+y1*R2D_MWWIDTH; |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 |
47
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
63 for (i=y1;i<=y2;i++) |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
64 { |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
65 for (j = 0; j < R2D_MWWIDTH-1; j++) |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
66 { |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
67 v=*p++; |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
68 for (k=0;k<32;k++) |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
69 { |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
70 if (v&1) |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
71 c139_lcd_send_pix(LCD16_COLOR_BLACK); |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
72 else |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
73 c139_lcd_send_pix(LCD16_COLOR_WHITE); |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
74 v=v>>1; |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
75 } |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
76 } |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
77 p++; |
502a0a3f6a49
C139 LCD support reinstated in the new way
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
78 } |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 } |