FreeCalypso > hg > fc-selenite
comparison src/cs/drivers/drv_app/r2d/lcds/D_Sample/r2d_task_init_i.c @ 0:b6a5e36de839
src/cs: initial import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 15 Jul 2018 04:39:26 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b6a5e36de839 |
---|---|
1 /* Used by refresh task to extract bytes from the | |
2 framebuffer */ | |
3 | |
4 #include "r2d/lcds/d_sample/r2d_tfd_lcd.h" | |
5 | |
6 #include "main/sys_types.h" | |
7 #include "l1_types.h" | |
8 #include "memif/mem.h" | |
9 | |
10 | |
11 #define R2D_MB_PRIM_SIZE (4000) | |
12 | |
13 | |
14 #ifdef CONFIG_TARGET_DSAMPLE | |
15 const unsigned char INIT_DISCTL[11] = { 0xDE,0x01,0x64,0x00,0x1B,0xF4,0x00,0xDC,0x00,0x02,0x00}; | |
16 | |
17 | |
18 const unsigned char INIT_GCP64[126] = { | |
19 0x3B, 0x0, 0x42, 0x0, 0x4A, 0x0, 0x51, | |
20 0x0, 0x58, 0x0, 0x5F, 0x0, 0x66, 0x0, 0x6E, | |
21 0x0, 0x75, 0x0, 0x7C, 0x0, 0x83, 0x0, 0x8A, | |
22 0x0, 0x92, 0x0, 0x99, 0x0, 0xA0, 0x0, 0xA7, | |
23 0x0, 0xAE, 0x0, 0xB6, 0x0, 0xBD, 0x0, 0xC4, | |
24 0x0, 0xCB, 0x0, 0xD2, 0x0, 0xDA, 0x0, 0xE1, | |
25 0x0, 0xE8, 0x0, 0xEF, 0x0, 0xF6, 0x0, 0xFE, | |
26 0x0, 0x5, 0x1, 0xC, 0x1, 0x13, 0x1, 0x1A, | |
27 0x1, 0x22, 0x1, 0x29, 0x1, 0x30, 0x1, 0x37, | |
28 0x1, 0x3E, 0x1, 0x46, 0x1, 0x4D, 0x1, 0x54, | |
29 0x1, 0x5B, 0x1, 0x62, 0x1, 0x6A, 0x1, 0x71, | |
30 0x1, 0x78, 0x1, 0x7F, 0x1, 0x86, 0x1, 0x8E, | |
31 0x1, 0x95, 0x1, 0x9C, 0x1, 0xA3, 0x1, 0xAA, | |
32 0x1, 0xB2, 0x1, 0xB9, 0x1, 0xC0, 0x1, 0xC7, | |
33 0x1, 0xCE, 0x1, 0xD6, 0x1, 0xDD, 0x1, 0xE4, | |
34 0x1, 0xEB, 0x1, 0xF2, 0x1, 0xFA, 0x1 }; | |
35 const unsigned char INIT_GCP16[15] = { | |
36 0x1A,0x31,0x48,0x54,0x5F,0x67,0x70,0x76,0x7C,0x80,0x83,0x84,0x85,0x87,0x96 }; | |
37 | |
38 | |
39 #ifdef EPSOM_ARRAY | |
40 const unsigned char INIT_GCP64[126] = { | |
41 0x08,0x00,0x2A,0x00,0x4E,0x00,0x6B,0x00, 0x88,0x00,0xA3,0x00,0xBA,0x00,0XD1,0x00, | |
42 0XE2,0x00,0XF3,0x00,0X03,0x01,0X13,0x01, 0X22,0x01,0x2F,0x01,0X2B,0x01,0X46,0x01, | |
43 0x51,0x01,0x5B,0x01,0x64,0x01,0x6C,0x01, 0x74,0x01,0x7C,0x01,0x83,0x01,0x8A,0x01, | |
44 0x91,0x01,0x98,0x01,0x9F,0x01,0xA6,0x01, 0xAC,0x01,0XB2,0x01,0xB7,0x01,0xBC,0x01, | |
45 0xC1,0x01,0xC6,0x01,0xCB,0x01,0xD0,0x01, 0xD4,0x01,0xD8,0x01,0xDC,0x01,0xE0,0x01, | |
46 0xE4,0x01,0xE8,0x01,0xEC,0x01,0xF0,0x01, 0xF4,0x01,0xF8,0x01,0xFB,0x01,0xFE,0x01, | |
47 0x01,0x02,0x03,0x02,0x05,0x02,0x07,0x02, 0x09,0x02,0x0B,0x02,0x0D,0x02,0x0F,0x02, | |
48 0x11,0x02,0x13,0x02,0x15,0x02,0x17,0x02, 0x19,0x02,0x1B,0x02,0x1C,0x02 }; | |
49 #endif | |
50 | |
51 const unsigned char INIT_MD_PSET[4] = { 0x00, 0x01, 0x00, 0x01 }; | |
52 const unsigned char INIT_MD_CSET[4] = { 0x00, 0x02, 0x00, 0x02 }; | |
53 | |
54 const unsigned char INIT_SD_PSET[4] = { 0, 0, 219, 0 }; | |
55 const unsigned char INIT_SD_CSET[4] = { 2, 0, 177, 0 }; | |
56 | |
57 const unsigned char INIT_ASCSET[7] = { 0x00, 0x00, 0xDB, 0x00, 0xDC, 0x00, 0x01 }; | |
58 const unsigned char INIT_SCSTART[2] = { 0x00, 0x00 }; | |
59 | |
60 static void r2d_nop_delay(UINT32 ms) | |
61 { | |
62 unsigned short a; | |
63 while (ms-- > 0) for (a=0;a<1000;a++) asm(" nop"); | |
64 } | |
65 #endif | |
66 | |
67 void r2d_refresh_task_init(void) | |
68 { | |
69 | |
70 #ifdef CONFIG_TARGET_DSAMPLE | |
71 | |
72 UINT32 i; | |
73 | |
74 LCD_activate; | |
75 | |
76 LCD_cmd(LCD_DISOFF); | |
77 LCD_cmd(LCD_SLPIN); | |
78 LCD_cmd(LCD_DISNOR); | |
79 LCD_cmd(LCD_GSSET); | |
80 LCD_data(INIT_GSSET); // 64 gradients | |
81 | |
82 r2d_nop_delay(100); | |
83 | |
84 | |
85 LCD_cmd(LCD_DISCTL); // Init LCD controller | |
86 for (i=0; i<11; i++) LCD_data(INIT_DISCTL[i]); | |
87 | |
88 LCD_cmd(LCD_GCP64); // Init palette for 64 gradient palette | |
89 for (i=0; i<126; i++) LCD_data(INIT_GCP64[i]); | |
90 | |
91 LCD_cmd(LCD_GCP16); // Init palette for 16 gradient palette | |
92 | |
93 for (i=0; i<15; i++) LCD_data(INIT_GCP16[i]); | |
94 | |
95 LCD_cmd(LCD_MD_CSET); // set area devoted to DSP interface | |
96 for (i=0; i<4; i++) LCD_data(INIT_MD_CSET[i]); | |
97 | |
98 LCD_cmd(LCD_MD_PSET); // set area devoted to DSP interface | |
99 | |
100 for (i=0; i<4; i++) LCD_data(INIT_MD_PSET[i]); | |
101 | |
102 LCD_cmd(LCD_SD_CSET); // set area devoted to MPU interface | |
103 for (i=0; i<4; i++) LCD_data(INIT_SD_CSET[i]); | |
104 | |
105 LCD_cmd(LCD_SD_PSET); // set area devoted to MPU interface | |
106 for (i=0; i<4; i++) LCD_data(INIT_SD_PSET[i]); | |
107 | |
108 LCD_cmd(LCD_DATCTL); | |
109 LCD_data(INIT_DATCTL);//0x08); | |
110 | |
111 LCD_cmd(LCD_OSCISEL); | |
112 LCD_data(INIT_OSCISEL);//0x05); | |
113 | |
114 LCD_cmd(LCD_14MSET); | |
115 LCD_data(INIT_14MSET);//0x4B); | |
116 | |
117 LCD_cmd(LCD_14MEND); | |
118 | |
119 LCD_cmd(LCD_3500KSET); | |
120 LCD_data(INIT_3500KSET);//0x45); | |
121 | |
122 LCD_cmd(LCD_3500KEND); | |
123 | |
124 r2d_nop_delay(30); | |
125 | |
126 LCD_cmd(LCD_SLPOUT); | |
127 | |
128 r2d_nop_delay(20); | |
129 | |
130 LCD_cmd(LCD_VOLCTL); | |
131 LCD_data(INIT_VOLCTL_Ton);// 152); | |
132 | |
133 r2d_nop_delay(20); | |
134 | |
135 LCD_cmd(LCD_VOLCTL); | |
136 LCD_data(INIT_VOLCTL); | |
137 | |
138 | |
139 | |
140 r2d_nop_delay(20); | |
141 LCD_cmd(LCD_DISON); | |
142 | |
143 LCD_cmd(LCD_RAMWR); | |
144 | |
145 for (i=0; i<176*220; i++) | |
146 { | |
147 //LCD_data(pic_data[i]); | |
148 LCD_data(0xFFFF); | |
149 // Try filling with white color | |
150 } | |
151 | |
152 | |
153 | |
154 LCD_deactivate; | |
155 | |
156 #endif | |
157 } | |
158 | |
159 static void r2d_refresh_task_kill(void) | |
160 { | |
161 } | |
162 | |
163 static void r2d_dithering_init(void) | |
164 { | |
165 R2D_MALLOC(r2d_mb_id,UINT32,sizeof(UINT32)*4,r2d_g_dithering_matrix); | |
166 if (r2d_g_dithering_matrix!=NULL) | |
167 { | |
168 r2d_g_dithering_matrix[0]=0; | |
169 r2d_g_dithering_matrix[1]=2; | |
170 r2d_g_dithering_matrix[2]=3; | |
171 r2d_g_dithering_matrix[3]=1; | |
172 } | |
173 } | |
174 | |
175 void r2d_lcd_off(void) | |
176 { | |
177 #ifdef CONFIG_TARGET_DSAMPLE | |
178 LCD_cmd(LCD_DISOFF); | |
179 //wait 70ms | |
180 r2d_nop_delay(70); | |
181 LCD_cmd(LCD_SLPIN); | |
182 //wait 110ms | |
183 r2d_nop_delay(110); | |
184 #endif | |
185 } |