comparison src/cs/drivers/drv_app/r2d/lcds/ColorBoard/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
5
6
7 #define R2D_MB_PRIM_SIZE 3000
8
9
10 #define MASTER_CMD(data) *(volatile unsigned char*)0x2000005 = (data)
11 #define MASTER_DATA(data) *(volatile unsigned char*)0x2000004 = (data)
12 #define SLAVE_CMD(data) *(volatile unsigned char*)0x2000003 = (data)
13 #define SLAVE_DATA(data) *(volatile unsigned char*)0x2000002 = (data)
14
15
16 static void r2d_refresh_task_init(void)
17 {
18
19 INT16 x,y;
20
21 #ifndef _WINDOWS
22 // Coded on 5 bits for the wait states
23 //*(volatile short*)0xfffffb0a = 0xe80 | 0x1f; // max waitstates and dummy cycles on CS3 and CS4
24 //*(volatile short*)0xfffffb06 = 0xe80 | 0x1f; // and config. as 8-bit I/O
25
26 *(volatile short*)0xfffffb0a = 0xe80 | 0x3; // max waitstates and dummy cycles on CS3 and CS4
27 *(volatile short*)0xfffffb06 = 0xe80 | 0x3; // and config. as 8-bit I/O
28
29 MASTER_CMD(0xF4); // RE register set
30 MASTER_CMD(0xB6); // electronic volume set (lower) (b5)
31 MASTER_CMD(0xA0); // electronic volume set (upper) (a9)
32 MASTER_CMD(0xF0); // RE register set
33 MASTER_CMD(0xE2); // Bias ratio set = 1/7 (e2)
34 MASTER_CMD(0xD3); // Booster set = 4x
35 MASTER_CMD(0x66); // 7 line alternated
36 MASTER_CMD(0x70); // 7 line alternated
37
38 MASTER_CMD(0xBA); // power control (DC, AMP = ON)
39
40 for (x=0;x<300;x++)
41 for (y=0;y<300;y++) ; // Delay while initializing
42
43 //functions master
44 MASTER_CMD(0xf4); // RE register set
45 MASTER_CMD(0x60); // common start line
46 MASTER_CMD(0xf0); // RE register set
47 MASTER_CMD(0x40); // display start line lower
48 MASTER_CMD(0x50); // display start line upper
49 MASTER_CMD(0xc7); // display duty cycle = 1/66
50
51 //functions slave
52 SLAVE_CMD(0xf4); // RE register set
53 SLAVE_CMD(0x60); // common start line
54 SLAVE_CMD(0xf0); // RE register set
55 SLAVE_CMD(0x40); // display start line lower
56 SLAVE_CMD(0x50); // display start line upper
57 SLAVE_CMD(0xc7); // display duty cycle = 1/66
58
59 MASTER_CMD(0x81); // display ON master
60 SLAVE_CMD(0x89); // display ON slave (89)
61 #endif
62 }
63
64 static void r2d_refresh_task_kill(void)
65 {
66 }
67
68 static void r2d_dithering_init(void)
69 {
70 R2D_MALLOC(r2d_mb_id,UINT32,sizeof(UINT32)*4,r2d_g_dithering_matrix);
71 if (r2d_g_dithering_matrix!=NULL)
72 {
73 r2d_g_dithering_matrix[0]=0;
74 r2d_g_dithering_matrix[1]=2;
75 r2d_g_dithering_matrix[2]=3;
76 r2d_g_dithering_matrix[3]=1;
77 }
78 }