annotate src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_init_i.c @ 193:6a53de2c4fc2

R2D sync with Magnetite R2D is never compiled in Selenite, thus the present change has absolutely no impact on anything - but this sync is being done in order to keep the overall diff between Magnetite and Selenite to a minimum.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 23 May 2020 07:13:36 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
193
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include "r2d/lcds/luna/r2d_luna_lcd.h"
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #define R2D_MB_PRIM_SIZE (4000)
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 static void r2d_refresh_task_init(void)
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 {
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 /* reset pulse */
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 CNTL_RST_REG |= EXT_RESET;
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 rvf_delay(RVF_MS_TO_TICKS(10));
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 CNTL_RST_REG &= ~EXT_RESET;
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 /* finish the job in the running R2D refresh task */
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 }
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 void r2d_refresh_task_secondary_init(void)
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 {
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 UINT32 i;
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 rvf_delay(RVF_MS_TO_TICKS(50));
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 /* start register init */
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 LCD_REG_WR(0x0001, 0x011c); // set SS and NL bit
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 LCD_REG_WR(0x0002, 0x0100); // set 1 line inversion
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 LCD_REG_WR(0x0003, 0x1030); // set GRAM write direction and BGR=1.
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 LCD_REG_WR(0x0008, 0x0808); // set BP and FP
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 LCD_REG_WR(0x000F, 0x0901); // Set frame rate
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 rvf_delay(RVF_MS_TO_TICKS(10));
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 LCD_REG_WR(0x0010, 0x0000); // Set SAP,DSTB,STB
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 LCD_REG_WR(0x0011, 0x1B41); // Set APON,PON,AON,VCI1EN,VC
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 rvf_delay(RVF_MS_TO_TICKS(50));
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 LCD_REG_WR(0x0012, 0x200E); // Internal reference voltage= Vci;
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 LCD_REG_WR(0x0013, 0x0052); // Set GVDD
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 LCD_REG_WR(0x0014, 0x4B5C); // Set VCOMH/VCOML voltage
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 //------------- Set GRAM area ------------------//
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 LCD_REG_WR(0x0030, 0x0000);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 LCD_REG_WR(0x0031, 0x00DB);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 LCD_REG_WR(0x0032, 0x0000);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 LCD_REG_WR(0x0033, 0x0000);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 LCD_REG_WR(0x0034, 0x00DB);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 LCD_REG_WR(0x0035, 0x0000);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 LCD_REG_WR(0x0036, 0x00AF);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 LCD_REG_WR(0x0037, 0x0000);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 LCD_REG_WR(0x0038, 0x00DB);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 LCD_REG_WR(0x0039, 0x0000);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 // ----------- Adjust the Gamma Curve ----------//
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 LCD_REG_WR(0x0050, 0x0000);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 LCD_REG_WR(0x0051, 0x0705);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 LCD_REG_WR(0x0052, 0x0C0A);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 LCD_REG_WR(0x0053, 0x0401);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 LCD_REG_WR(0x0054, 0x040C);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 LCD_REG_WR(0x0055, 0x0608);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 LCD_REG_WR(0x0056, 0x0000);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 LCD_REG_WR(0x0057, 0x0104);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 LCD_REG_WR(0x0058, 0x0E06);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 LCD_REG_WR(0x0059, 0x060E);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 rvf_delay(RVF_MS_TO_TICKS(50));
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 LCD_REG_WR(0x0007, 0x1017);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 /* initial hw framebuffer clearing */
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 LCD_REG_WR(0x20, 0);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 LCD_REG_WR(0x21, 0);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 LCD_IR = 0x22;
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 for (i = 0; i < 176*220; i++)
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 LCD_DR = 0xFFFF; /* white color */
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 }
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 static void r2d_refresh_task_kill(void)
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 {
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 }
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 static void r2d_dithering_init(void)
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 {
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 R2D_MALLOC(r2d_mb_id,UINT32,sizeof(UINT32)*4,r2d_g_dithering_matrix);
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 if (r2d_g_dithering_matrix!=NULL)
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 {
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 r2d_g_dithering_matrix[0]=0;
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 r2d_g_dithering_matrix[1]=2;
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 r2d_g_dithering_matrix[2]=3;
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 r2d_g_dithering_matrix[3]=1;
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 }
6a53de2c4fc2 R2D sync with Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 }