OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [powerpc/] [csb281/] [v2_0/] [src/] [sed1356_16bit.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//------------------------------------------------------------------------
2
// sed1356.h: SED1356 LCD/CRT Controllers - 16-Bit access mode
3
//
4
// Copyright (C) 2003 Gary Thomas
5
 
6
//------------------------------------------------
7
// Bit position defines
8
#define BIT0     0x00000001
9
#define BIT1     0x00000002
10
#define BIT2     0x00000004
11
#define BIT3     0x00000008
12
#define BIT4     0x00000010
13
#define BIT5     0x00000020
14
#define BIT6     0x00000040
15
#define BIT7     0x00000080
16
#define BIT8     0x00000100
17
#define BIT9     0x00000200
18
#define BIT10    0x00000400
19
#define BIT11    0x00000800
20
#define BIT12    0x00001000
21
#define BIT13    0x00002000
22
#define BIT14    0x00004000
23
#define BIT15    0x00008000
24
#define BIT16    0x00010000
25
#define BIT17    0x00020000
26
#define BIT18    0x00040000
27
#define BIT19    0x00080000
28
#define BIT20    0x00100000
29
#define BIT21    0x00200000
30
#define BIT22    0x00400000
31
#define BIT23    0x00800000
32
#define BIT24    0x01000000
33
#define BIT25    0x02000000
34
#define BIT26    0x04000000
35
#define BIT27    0x08000000
36
#define BIT28    0x10000000
37
#define BIT29    0x20000000
38
#define BIT30    0x40000000
39
#define BIT31    0x80000000
40
 
41
 
42
//------------------------------------------------------------------------
43
// cpu specific code must define the following board specific macros.
44
// in cpuio.h.  These examples assume the SED135x has been placed in 
45
// the correct endian mode via hardware.
46
// #define SED_MEM_BASE   0xf0600000 <-- just example addresses, 
47
// #define SED_REG_BASE    0xf0400000 <-- define for each board
48
// #define SED_STEP      1 <-- 1 = device is on 16-bit boundry, 2 = 32-bit boundry, 4 = 64-bit boundry
49
// #define SED_REG16(_x_)    *(vushortr *)(SED_REG_BASE + (_x_ * SED_STEP))  // Control/Status Registers
50
// #define RD_FB16(_reg_,_val_) ((_val_) = *((vushort *)((SED_MEM_BASE + (_reg_ * SED_STEP)))))
51
// #define WR_FB16(_reg_,_val_) (*((vushort *)((SED_MEM_BASE + (_reg_ * 2)))) = (_val_))
52
// Big endian processors
53
// #define H2SED(_x_)  ((((x) & 0xff00U) >> 8) | (((x) & 0x00ffU) << 8))
54
// Little endian
55
// #define H2SED(_x_)  (_x_)
56
 
57
 
58
// ----------------------------------------------------------
59
// SED1356 registers - 16-Bit Access Mode.  The first register
60
// referenced is the even addressed register.  The byte offsets
61
// of the odd registers are shown in the comments
62
#define SED1356_REG_REV_and_MISC         SED_REG16(0x00) 
63
//  #define SED1356_REG_MISC                    SED_REG(0x01)
64
#define SED1356_REG_GPIO_CFG             SED_REG16(0x04)
65
#define SED1356_REG_GPIO_CTL             SED_REG16(0x08)
66
#define SED1356_REG_MD_CFG_RD_LO_and_HI  SED_REG16(0x0c) 
67
//  #define SED1356_REG_MD_CFG_RD_HI          SED_REG(0x0d)
68
#define SED1356_REG_MCLK_CFG             SED_REG16(0x10)
69
#define SED1356_REG_LCD_PCLK_CFG         SED_REG16(0x14)
70
#define SED1356_REG_CRT_PCLK_CFG         SED_REG16(0x18)
71
#define SED1356_REG_MEDIA_PCLK_CFG       SED_REG16(0x1c)
72
#define SED1356_REG_WAIT_STATE           SED_REG16(0x1e)
73
#define SED1356_REG_MEM_CFG_and_REF_RATE SED_REG16(0x20) 
74
//  #define SED1356_REG_REF_RATE                SED_REG(0x21)
75
#define SED1356_REG_MEM_TMG0_and_1       SED_REG16(0x2a) 
76
//  #define SED1356_REG_MEM_TMG1               SED_REG(0x2b)
77
#define SED1356_REG_PANEL_TYPE_and_MOD_RATE SED_REG16(0x30) 
78
//  #define SED1356_REG_MOD_RATE                SED_REG(0x31)
79
// LCD Control registers
80
#define SED1356_REG_LCD_HOR_DISP              SED_REG16(0x32)
81
#define SED1356_REG_LCD_HOR_NONDISP_and_START SED_REG16(0x34) 
82
//  #define SED1356_REG_LCD_HOR_START         SED_REG(0x35)
83
#define SED1356_REG_LCD_HOR_PULSE             SED_REG16(0x36)
84
#define SED1356_REG_LCD_VER_DISP_HT_LO_and_HI SED_REG16(0x38) 
85
//  #define SED1356_REG_LCD_VER_DISP_HT_HI      SED_REG(0x39)
86
#define SED1356_REG_LCD_VER_NONDISP_and_START SED_REG16(0x3a) 
87
//  #define SED1356_REG_LCD_VER_START          SED_REG(0x3b)
88
#define SED1356_REG_LCD_VER_PULSE             SED_REG16(0x3c)
89
#define SED1356_REG_LCD_DISP_MODE_and_MISC    SED_REG16(0x40) 
90
//  #define SED1356_REG_LCD_MISC        SED_REG(0x41)
91
#define SED1356_REG_LCD_DISP_START_LO_and_MID SED_REG16(0x42) 
92
//  #define SED1356_REG_LCD_DISP_START_MID     SED_REG(0x43)
93
#define SED1356_REG_LCD_DISP_START_HI         SED_REG16(0x44)
94
#define SED1356_REG_LCD_ADD_OFFSET_LO_and_HI  SED_REG16(0x46) 
95
//  #define SED1356_REG_LCD_ADD_OFFSET_HI       SED_REG(0x47)
96
#define SED1356_REG_LCD_PIXEL_PAN             SED_REG16(0x48)  
97
#define SED1356_REG_LCD_FIFO_THRESH_LO_and_HI SED_REG16(0x4a) 
98
//  #define SED1356_REG_LCD_FIFO_LO_THRES      SED_REG(0x4b)
99
// CRT/TV Control registers
100
#define SED1356_REG_CRT_HOR_DISP              SED_REG16(0x50)
101
#define SED1356_REG_CRT_HOR_NONDISP_and_START SED_REG16(0x52) 
102
//  #define SED1356_REG_CRT_HOR_START         SED_REG(0x53)
103
#define SED1356_REG_CRT_HOR_PULSE             SED_REG16(0x54)
104
#define SED1356_REG_CRT_VER_DISP_HT_LO_and_HI SED_REG16(0x56) 
105
//  #define SED1356_REG_CRT_VER_DISP_HT_HI      SED_REG(0x57)
106
#define SED1356_REG_CRT_VER_NONDISP_and_START SED_REG16(0x58) 
107
 
108
//  #define SED1356_REG_CRT_VER_START          SED_REG(0x59)
109
#define SED1356_REG_CRT_VER_PULSE_and_OUT_CTL    SED_REG16(0x5a) 
110
//  #define SED1356_REG_CRT_OUT_CTL        SED_REG(0x5b)
111
#define SED1356_REG_CRT_DISP_MODE          SED_REG16(0x60)
112
#define SED1356_REG_CRT_DISP_START_LO_and_MID       SED_REG16(0x62) 
113
//  #define SED1356_REG_CRT_DISP_START_MID     SED_REG(0x63)
114
#define SED1356_REG_CRT_DISP_START_HI           SED_REG16(0x64)
115
#define SED1356_REG_CRT_ADD_OFFSET_LO_and_HI       SED_REG16(0x66) 
116
//  #define SED1356_REG_CRT_ADD_OFFSET_HI       SED_REG(0x67)
117
#define SED1356_REG_CRT_PIXEL_PAN             SED_REG16(0x68)
118
#define SED1356_REG_CRT_FIFO_THRESH_LO_and_HI      SED_REG16(0x6a) 
119
//  #define SED1356_REG_CRT_FIFO_LO_THRES      SED_REG(0x6b)
120
 
121
// LCD Cursor Control Registers
122
#define SED1356_REG_LCD_CURSOR_CTL_and_START_ADD  SED_REG16(0x70) 
123
//  #define SED1356_REG_LCD_CURSOR_START_ADD  SED_REG(0x71)
124
#define SED1356_REG_LCD_CURSOR_X_POS_LO_and_HI     SED_REG16(0x72) 
125
//  #define SED1356_REG_LCD_CURSOR_X_POS_HI   SED_REG(0x73)
126
#define SED1356_REG_LCD_CURSOR_Y_POS_LO_and_HI    SED_REG16(0x74) 
127
//  #define SED1356_REG_LCD_CURSOR_Y_POS_HI    SED_REG(0x75)
128
#define SED1356_REG_LCD_CURSOR_BLUE_and_GREEN_CLR_0  SED_REG16(0x76) 
129
//  #define SED1356_REG_LCD_CURSOR_GREEN_CLR_0  SED_REG(0x77)
130
#define SED1356_REG_LCD_CURSOR_RED_CLR_0      SED_REG16(0x78)  
131
#define SED1356_REG_LCD_CURSOR_BLUE_and_GREEN_CLR_1  SED_REG16(0x7a) 
132
//  #define SED1356_REG_LCD_CURSOR_GREEN_CLR_1  SED_REG(0x7b)
133
#define SED1356_REG_LCD_CURSOR_RED_CLR_1      SED_REG16(0x7c)
134
#define SED1356_REG_LCD_CURSOR_FIFO_THRESH      SED_REG16(0x7e)
135
 
136
// CRT Cursor Control Registers
137
#define SED1356_REG_CRT_CURSOR_CTL_and_START_ADD  SED_REG16(0x80) 
138
//  #define SED1356_REG_CRT_CURSOR_START_ADD  SED_REG(0x81)
139
#define SED1356_REG_CRT_CURSOR_X_POS_LO_and_HI     SED_REG16(0x82) 
140
//  #define SED1356_REG_CRT_CURSOR_X_POS_HI   SED_REG(0x83)
141
#define SED1356_REG_CRT_CURSOR_Y_POS_LO_and_HI    SED_REG16(0x84) 
142
//  #define SED1356_REG_CRT_CURSOR_Y_POS_HI    SED_REG(0x85)
143
#define SED1356_REG_CRT_CURSOR_BLUE_and_GREEN_CLR_0  SED_REG16(0x86) 
144
//  #define SED1356_REG_CRT_CURSOR_GREEN_CLR_0  SED_REG(0x87)
145
#define SED1356_REG_CRT_CURSOR_RED_CLR_0      SED_REG16(0x88)
146
#define SED1356_REG_CRT_CURSOR_BLUE_and_GREEN_CLR_1  SED_REG16(0x8a) 
147
//  #define SED1356_REG_CRT_CURSOR_GREEN_CLR_1  SED_REG(0x8b)
148
#define SED1356_REG_CRT_CURSOR_RED_CLR_1      SED_REG16(0x8c)
149
#define SED1356_REG_CRT_CURSOR_FIFO_THRESH      SED_REG16(0x8e)
150
 
151
// BitBlt Control Registers
152
#define SED1356_REG_BLT_CTL_0_and_1          SED_REG16(0x100) 
153
//  #define SED1356_REG_BLT_CTL_1        SED_REG(0x101)
154
#define SED1356_REG_BLT_ROP_CODE_and_BLT_OP      SED_REG16(0x102) 
155
//  #define SED1356_REG_BLT_OP          SED_REG(0x103)
156
#define SED1356_REG_BLT_SRC_START_LO_and_MID    SED_REG16(0x104) 
157
//  #define SED1356_REG_BLT_SRC_START_MID    SED_REG(0x105)
158
#define SED1356_REG_BLT_SRC_START_HI        SED_REG16(0x106)
159
#define SED1356_REG_BLT_DEST_START_LO_and_MID    SED_REG16(0x108) 
160
//  #define SED1356_REG_BLT_DEST_START_MID    SED_REG(0x109)
161
#define SED1356_REG_BLT_DEST_START_HI        SED_REG16(0x10a)
162
#define SED1356_REG_BLT_ADD_OFFSET_LO_and_HI    SED_REG16(0x10c) 
163
//  #define SED1356_REG_BLT_ADD_OFFSET_HI    SED_REG(0x10d)
164
#define SED1356_REG_BLT_WID_LO_and_HI        SED_REG16(0x110) 
165
//  #define SED1356_REG_BLT_WID_HI        SED_REG(0x111)
166
#define SED1356_REG_BLT_HGT_LO_and_HI        SED_REG16(0x112) 
167
//  #define SED1356_REG_BLT_HGT_HI        SED_REG(0x113)
168
#define SED1356_REG_BLT_BG_CLR_LO_and_HI      SED_REG16(0x114) 
169
//  #define SED1356_REG_BLT_BG_CLR_HI      SED_REG(0x115)
170
#define SED1356_REG_BLT_FG_CLR_LO_and_HI      SED_REG16(0x118) 
171
//  #define SED1356_REG_BLT_FG_CLR_HI      SED_REG(0x119)
172
 
173
// Look-Up Table Control Registers
174
#define SED1356_REG_LUT_MODE            SED_REG16(0x1e0)
175
#define SED1356_REG_LUT_ADD              SED_REG16(0x1e2)
176
#define SED1356_REG_LUT_DATA            SED_REG16(0x1e4)
177
 
178
// Power and Miscellaneous Control Registers
179
#define SED1356_REG_PWR_CFG_and_STAT        SED_REG16(0x1f0) 
180
//  #define SED1356_REG_PWR_STAT        SED_REG(0x1f1)
181
#define SED1356_REG_WATCHDOG_CTL          SED_REG16(0x1f4)
182
#define SED1356_REG_DISP_MODE            SED_REG16(0x1fc)
183
 
184
 
185
//------------------------------------------------------------------------------------------------------------
186
 
187
// Bit Assignments - Little Endian, Use H2SED() macro to access
188
 
189
//
190
 
191
// SED1356_REG_REV_and_MISC - even
192
#define SED1356_REV_ID_MASK          0xfc    
193
// ID bits - masks off the rev bits
194
#define SED1356_REV_ID_1356          BIT4
195
#define SED1356_REV_ID_1355          BIT3
196
 
197
 
198
// SED1356_REG_REV_and_MISC - odd
199
#define SED1356_MISC_HOST_DIS        BIT7 << 8  
200
// 0 = enable host access, 1 = disable
201
 
202
 
203
// SED1356_REG_GPIO_CFG and SED1356_REG_GPIO_STAT
204
#define SED1356_GPIO_GPIO3           BIT3    
205
// 0 = input, 1 = output, if configured as GPIO
206
#define SED1356_GPIO_GPIO2           BIT2
207
#define SED1356_GPIO_GPIO1           BIT1
208
 
209
 
210
// SED1356_REG_MCLK_CFG
211
#define SED1356_MCLK_DIV2            BIT4 
212
#define SED1356_MCLK_SRC_BCLK        BIT0 
213
#define SED1356_MCLK_SRC_CLKI        0x00
214
 
215
 
216
// SED1356_REG_LCD_PCLK_CFG, SED1356_REG_CRT_PCLK_CFG 
217
 
218
// and SED1356_REG_MEDIA_PCLK_CFG
219
#define SED1356_PCLK_X2            BIT7    
220
// SED1356_REG_CRT_PCLK_CFG only
221
#define SED1356_PCLK_DIV1          0x00 << 4
222
#define SED1356_PCLK_DIV2          0x01 << 4
223
#define SED1356_PCLK_DIV3          0x02 << 4
224
#define SED1356_PCLK_DIV4          0x03 << 4
225
#define SED1356_PCLK_SRC_CLKI      0x00
226
#define SED1356_PCLK_SRC_BCLK      0x01
227
#define SED1356_PCLK_SRC_CLKI2     0x02
228
#define SED1356_PCLK_SRC_MCLK      0x03
229
 
230
 
231
// SED1356_REG_MEM_CFG_and_REF_RATE - even
232
#define SED1356_MEM_CFG_2CAS_EDO   0x00   
233
#define SED1356_MEM_CFG_2CAS_FPM   0x01   
234
#define SED1356_MEM_CFG_2WE_EDO    0x02   
235
#define SED1356_MEM_CFG_2WE_FPM    0x03   
236
#define SED1356_MEM_CFG_MASK       0x03   
237
 
238
 
239
// SED1356_REG_MEM_CFG_and_REF_RATE - odd
240
#define SED1356_REF_TYPE_CBR       0x00 << 6 << 8
241
#define SED1356_REF_TYPE_SELF      0x01 << 6 << 8
242
#define SED1356_REF_TYPE_NONE      0x02 << 6 << 8
243
#define SED1356_REF_TYPE_MASK      0x03 << 6 << 8
244
#define SED1356_REF_RATE_64        0x00 << 0 << 8  
245
// MCLK / 64
246
#define SED1356_REF_RATE_128       0x01 << 0 << 8  
247
// MCLK / 128
248
#define SED1356_REF_RATE_256       0x02 << 0 << 8  
249
// MCLK / 256
250
#define SED1356_REF_RATE_512       0x03 << 0 << 8  
251
// MCLK / 512
252
#define SED1356_REF_RATE_1024      0x04 << 0 << 8  
253
// MCLK / 1024
254
#define SED1356_REF_RATE_2048      0x05 << 0 << 8  
255
// MCLK / 2048
256
#define SED1356_REF_RATE_4096      0x06 << 0 << 8  
257
// MCLK / 4096
258
#define SED1356_REF_RATE_8192      0x07 << 0 << 8  
259
// MCLK / 8192
260
#define SED1356_REF_RATE_MASK      0x07 << 0 << 8  
261
// MCLK / 8192
262
 
263
 
264
// SED1356_REG_MEM_TMG0_and_1 - even
265
#define SED1356_MEM_TMG0_EDO50_MCLK40    0x01
266
#define SED1356_MEM_TMG0_EDO50_MCLK33    0x01
267
#define SED1356_MEM_TMG0_EDO60_MCLK33    0x01
268
#define SED1356_MEM_TMG0_EDO50_MCLK30    0x12
269
#define SED1356_MEM_TMG0_EDO60_MCLK30    0x01
270
#define SED1356_MEM_TMG0_EDO70_MCLK30    0x00
271
#define SED1356_MEM_TMG0_EDO50_MCLK25    0x12
272
#define SED1356_MEM_TMG0_EDO60_MCLK25    0x12
273
#define SED1356_MEM_TMG0_EDO70_MCLK25    0x01
274
#define SED1356_MEM_TMG0_EDO80_MCLK25    0x00
275
#define SED1356_MEM_TMG0_EDO50_MCLK20    0x12
276
#define SED1356_MEM_TMG0_EDO60_MCLK20    0x12
277
#define SED1356_MEM_TMG0_EDO70_MCLK20    0x12
278
#define SED1356_MEM_TMG0_EDO80_MCLK20    0x01
279
#define SED1356_MEM_TMG0_FPM50_MCLK25    0x12
280
#define SED1356_MEM_TMG0_FPM60_MCLK25    0x01
281
#define SED1356_MEM_TMG0_FPM50_MCLK20    0x12
282
#define SED1356_MEM_TMG0_FPM60_MCLK20    0x12
283
#define SED1356_MEM_TMG0_FPM70_MCLK20    0x11
284
#define SED1356_MEM_TMG0_FPM80_MCLK20    0x01
285
 
286
 
287
// SED1356_REG_MEM_TMG0_and_1 - odd
288
#define SED1356_MEM_TMG1_EDO50_MCLK40    0x01 << 8
289
#define SED1356_MEM_TMG1_EDO50_MCLK33    0x01 << 8
290
#define SED1356_MEM_TMG1_EDO60_MCLK33    0x01 << 8
291
#define SED1356_MEM_TMG1_EDO50_MCLK30    0x02 << 8
292
#define SED1356_MEM_TMG1_EDO60_MCLK30    0x01 << 8
293
#define SED1356_MEM_TMG1_EDO70_MCLK30    0x00 << 8
294
#define SED1356_MEM_TMG1_EDO50_MCLK25    0x02 << 8
295
#define SED1356_MEM_TMG1_EDO60_MCLK25    0x02 << 8
296
#define SED1356_MEM_TMG1_EDO70_MCLK25    0x01 << 8
297
#define SED1356_MEM_TMG1_EDO80_MCLK25    0x01 << 8
298
#define SED1356_MEM_TMG1_EDO50_MCLK20    0x02 << 8
299
#define SED1356_MEM_TMG1_EDO60_MCLK20    0x02 << 8
300
#define SED1356_MEM_TMG1_EDO70_MCLK20    0x02 << 8
301
#define SED1356_MEM_TMG1_EDO80_MCLK20    0x01 << 8
302
#define SED1356_MEM_TMG1_FPM50_MCLK25    0x02 << 8
303
#define SED1356_MEM_TMG1_FPM60_MCLK25    0x01 << 8
304
#define SED1356_MEM_TMG1_FPM50_MCLK20    0x02 << 8
305
#define SED1356_MEM_TMG1_FPM60_MCLK20    0x02 << 8
306
#define SED1356_MEM_TMG1_FPM70_MCLK20    0x02 << 8
307
#define SED1356_MEM_TMG1_FPM80_MCLK20    0x01 << 8
308
 
309
 
310
 
311
// Bit definitions                         
312
 
313
//
314
 
315
// SED1356_REG_PANEL_TYPE_AND_MOD_RATE - even
316
#define SED1356_PANEL_TYPE_EL      BIT7
317
#define SED1356_PANEL_TYPE_4_9     (0x00 << 4)    
318
// Passive 4-Bit, TFT 9-Bit
319
#define SED1356_PANEL_TYPE_8_12    (0x01 << 4)    
320
// Passive 8-Bit, TFT 12-Bit
321
#define SED1356_PANEL_TYPE_16      (0x02 << 4)    
322
// Passive 16-Bit, or TFT 18-Bit
323
#define SED1356_PANEL_TYPE_MASK    (0x03 << 4)
324
#define SED1356_PANEL_TYPE_FMT     BIT3      
325
// 0 = Passive Format 1, 1 = Passive Format 2
326
#define SED1356_PANEL_TYPE_CLR     BIT2      
327
// 0 = Passive Mono, 1 = Passive Color
328
#define SED1356_PANEL_TYPE_DUAL    BIT1      
329
// 0 = Passive Single, 1 = Passive Dual
330
#define SED1356_PANEL_TYPE_TFT     BIT0      
331
// 0 = Passive, 1 = TFT (DUAL, FMT & CLR are don't cares)
332
 
333
 
334
// SED1356_REG_CRT_HOR_PULSE, SED1356_REG_CRT_VER_PULSE,
335
 
336
// SED1356_REG_LCD_HOR_PULSE and SED1356_REG_LCD_VER_PULSE
337
#define SED1356_PULSE_POL_HIGH     BIT7      
338
// 0 = CRT/TFT Pulse is Low, Passive is High, 1 = CRT/TFT Pulse is High, Passive is Low
339
#define SED1356_PULSE_POL_LOW      0x00      
340
// 0 = CRT/TFT Pulse is Low, Passive is High, 1 = CRT/TFT Pulse is High, Passive is Low
341
#define SED1356_PULSE_WID(_x_)     (_x_ & 0x0f)  
342
// Pulse Width in Pixels
343
 
344
 
345
// SED1356_LCD_DISP_MODE_and_MISC - even        
346
#define SED1356_LCD_DISP_BLANK     BIT7      
347
// 1 = Blank LCD Display
348
#define SED1356_LCD_DISP_SWIV_NORM (0x00 << 4)    
349
// Used with SED1356_REG_DISP_MODE Bit 6
350
#define SED1356_LCD_DISP_SWIV_90   (0x00 << 4)
351
#define SED1356_LCD_DISP_SWIV_180  (0x01 << 4)
352
#define SED1356_LCD_DISP_SWIV_270  (0x01 << 4)
353
#define SED1356_LCD_DISP_SWIV_MASK (0x01 << 4)
354
#define SED1356_LCD_DISP_16BPP     0x05      
355
// Bit Per Pixel Selection
356
#define SED1356_LCD_DISP_15BPP     0x04
357
#define SED1356_LCD_DISP_8BPP      0x03
358
#define SED1356_LCD_DISP_4BPP      0x02
359
#define SED1356_LCD_DISP_BPP_MASK  0x07
360
 
361
 
362
// SED1356_LCD_DISP_MODE_and_MISC - odd
363
#define SED1356_LCD_MISC_DITH      BIT1 << 8    
364
// 1 = Dither Disable, Passive Panel Only
365
#define SED1356_LCD_MISC_DUAL      BIT0 << 8    
366
// 1 = Dual Panel Disable, Passive Panel Only
367
 
368
 
369
// SED1356_REG_CRT_VER_PULSE_and_OUT_CTL - odd
370
#define SED1356_CRT_OUT_CHROM      BIT5 << 8    
371
// 1 = TV Chrominance Filter Enable
372
#define SED1356_CRT_OUT_LUM        BIT4 << 8    
373
// 1 = TV Luminance Filter Enable
374
#define SED1356_CRT_OUT_DAC_LVL    BIT3 << 8    
375
// 1 = 4.6ma IREF, 0 = 9.2 IREF
376
#define SED1356_CRT_OUT_SVIDEO     BIT1 << 8    
377
// 1 = S-Video Output, 0 = Composite Video Output
378
#define SED1356_CRT_OUT_PAL        BIT0 << 8    
379
// 1 = PAL Format Output, 0 = NTSC Format Output
380
 
381
 
382
// SED1356_REG_CRT_DISP_MODE
383
#define SED1356_CRT_DISP_BLANK     BIT7      
384
// 1 = Blank CRT Display
385
#define SED1356_CRT_DISP_16BPP     0x05      
386
// Bit Per Pixel Selection
387
#define SED1356_CRT_DISP_15BPP     0x04
388
#define SED1356_CRT_DISP_8BPP      0x03
389
#define SED1356_CRT_DISP_4BPP      0x02
390
#define SED1356_CRT_DISP_BPP_MASK  0x07
391
 
392
 
393
// SED1356_DISP_MODE        
394
#define SED1356_DISP_SWIV_NORM     (0x00 << 6)    
395
// Used with SED1356_LCD_DISP_MODE Bit 4
396
#define SED1356_DISP_SWIV_90       (0x01 << 6)
397
#define SED1356_DISP_SWIV_180      (0x00 << 6)
398
#define SED1356_DISP_SWIV_270      (0x01 << 6)
399
#define SED1356_DISP_MODE_OFF      0x00      
400
// All Displays Off
401
#define SED1356_DISP_MODE_LCD      0x01      
402
// LCD Only
403
#define SED1356_DISP_MODE_CRT      0x02      
404
// CRT Only
405
#define SED1356_DISP_MODE_LCD_CRT  0x03      
406
// Simultaneous LCD and CRT
407
#define SED1356_DISP_MODE_TV       0x04      
408
// TV Only, Flicker Filter Off
409
#define SED1356_DISP_MODE_TV_LCD   0x05      
410
// Simultaneous LCD and TV, Flicker Filter Off
411
#define SED1356_DISP_MODE_TV_FLICK 0x06      
412
// TV Only, Flicker Filter On
413
#define SED1356_DISP_MODE_TV_LCD_FLICK  0x07      
414
// Simultaneous LCD and TV, Flicker Filter On
415
 
416
 
417
// SED1356_REG_PWR_CFG and SED1356_REG_PWR_STAT
418
#define SED1356_PWR_PCLK        BIT1      
419
// SED1356_REG_PWR_STAT only
420
#define SED1356_PWR_MCLK        BIT0
421
 
422
 
423
// SED1356_REG_VER_NONDISP
424
#define SED1356_VER_NONDISP        BIT7      
425
// vertical retrace status 1 = in retrace
426
 
427
 
428
// Display size defines
429
#define PIXELS_PER_ROW     640
430
#define PIXELS_PER_COL     480
431
#define BYTES_PER_PIXEL    2
432
#define COLS_PER_SCREEN    80
433
#define ROWS_PER_SCREEN    30
434
 
435
 
436
// 16-bit pixels are RGB 565 - LSB of RED and BLUE are tied low at the 
437
 
438
// LCD Interface, while the LSB of GREEN is loaded as 0
439
#define RED_SUBPIXEL(n)    ((n & 0x1f) << 11)
440
#define GREEN_SUBPIXEL(n)  ((n & 0x1f) << 5)
441
#define BLUE_SUBPIXEL(n)  ((n & 0x1f) << 0)
442
 
443
 
444
// define a simple VGA style 16-color pallette
445
#define  LU_BLACK    (RED_SUBPIXEL(0x00) | GREEN_SUBPIXEL(0x00) | BLUE_SUBPIXEL(0x00))
446
#define  LU_BLUE      (RED_SUBPIXEL(0x00) | GREEN_SUBPIXEL(0x00) | BLUE_SUBPIXEL(0x0f))
447
#define  LU_GREEN    (RED_SUBPIXEL(0x00) | GREEN_SUBPIXEL(0x0f) | BLUE_SUBPIXEL(0x00))
448
#define  LU_CYAN      (RED_SUBPIXEL(0x00) | GREEN_SUBPIXEL(0x0f) | BLUE_SUBPIXEL(0x0f))
449
#define  LU_RED      (RED_SUBPIXEL(0x0f) | GREEN_SUBPIXEL(0x00) | BLUE_SUBPIXEL(0x00))
450
#define  LU_VIOLET    (RED_SUBPIXEL(0x0f) | GREEN_SUBPIXEL(0x00) | BLUE_SUBPIXEL(0x0f))
451
#define  LU_YELLOW    (RED_SUBPIXEL(0x0f) | GREEN_SUBPIXEL(0x0f) | BLUE_SUBPIXEL(0x00))
452
#define  LU_GREY      (RED_SUBPIXEL(0x0f) | GREEN_SUBPIXEL(0x0f) | BLUE_SUBPIXEL(0x0f))
453
#define  LU_WHITE    (RED_SUBPIXEL(0x17) | GREEN_SUBPIXEL(0x17) | BLUE_SUBPIXEL(0x17))
454
#define  LU_BRT_BLUE    (RED_SUBPIXEL(0x00) | GREEN_SUBPIXEL(0x00) | BLUE_SUBPIXEL(0x1f))
455
#define  LU_BRT_GREEN  (RED_SUBPIXEL(0x00) | GREEN_SUBPIXEL(0x1f) | BLUE_SUBPIXEL(0x00))
456
#define  LU_BRT_CYAN    (RED_SUBPIXEL(0x00) | GREEN_SUBPIXEL(0x1f) | BLUE_SUBPIXEL(0x1f))
457
#define  LU_BRT_RED    (RED_SUBPIXEL(0x1f) | GREEN_SUBPIXEL(0x00) | BLUE_SUBPIXEL(0x00))
458
#define  LU_BRT_VIOLET  (RED_SUBPIXEL(0x1f) | GREEN_SUBPIXEL(0x00) | BLUE_SUBPIXEL(0x1f))
459
#define  LU_BRT_YELLOW  (RED_SUBPIXEL(0x1f) | GREEN_SUBPIXEL(0x1f) | BLUE_SUBPIXEL(0x00))
460
#define  LU_BRT_WHITE  (RED_SUBPIXEL(0x1f) | GREEN_SUBPIXEL(0x1f) | BLUE_SUBPIXEL(0x1f))
461
 
462
static const ushort vga_lookup[] = {
463
LU_BLACK,
464
// 0
465
LU_BLUE,
466
// 1
467
LU_GREEN,
468
// 2
469
LU_CYAN,
470
// 3
471
LU_RED,
472
// 4
473
LU_GREY,
474
// 5
475
LU_VIOLET,
476
// 6
477
LU_YELLOW,
478
// 7
479
LU_WHITE,
480
// 8
481
LU_BRT_BLUE,
482
// 9
483
LU_BRT_GREEN,
484
// 10
485
LU_BRT_CYAN,
486
// 11
487
LU_BRT_RED,
488
// 12
489
LU_BRT_VIOLET,
490
// 13
491
LU_BRT_YELLOW,
492
// 14
493
LU_BRT_WHITE
494
// 15
495
};
496
 
497
 
498
// default foreground and background colors
499
#define SED_BG_DEF      1
500
#define SED_FG_DEF      14
501
 
502
 
503
// Vertical and Horizontal Pulse, Start and Non-Display values vary depending
504
 
505
// upon the mode.  The following section gives some insight into how the
506
 
507
// values are arrived at.
508
 
509
// ms = milliseconds, us = microseconds, ns = nanoseconds    
510
 
511
// Mhz = Megaherz, Khz = Kiloherz, Hz = Herz   
512
 
513
//
514
 
515
// ***************************************************************************************************   
516
 
517
// CRT Mode is 640x480 @ 72Hz VESA compatible timing.  PCLK = 31.5Mhz (31.75ns)
518
 
519
// ***************************************************************************************************   
520
 
521
//
522
 
523
//                               CRT MODE HORIZONTAL TIMING PARAMETERS   
524
 
525
//
526
 
527
//                                       |<-------Tha------->|   
528
 
529
//                                       |___________________|                     ______   
530
 
531
// Display Enable   _____________________|                   |____________________|      
532
 
533
//                                       |                   |   
534
 
535
// Horizontal Pulse __           ________|___________________|________          __________   
536
 
537
//                    |_________|        |                   |        |________|   
538
 
539
//                    |<- Thp ->|        |                   |        |   
540
 
541
//                    |         |<-Thbp->|                   |        |   
542
 
543
//                    |                                      |<-Thfp->|   
544
 
545
//                    |<----------------------Tht-------------------->|    
546
 
547
//
548
 
549
// Tha  - Active Display Time                      = 640 pixels   
550
 
551
// Thp  - Horizontal Pulse       = 1.27us/31.75ns  =  40 pixels   
552
 
553
// Thbp - Horizontal Front Porch = 1.016us/31.75ns =  32 pixels   
554
 
555
// Thfp - Horizontal Back Porch  = 3.8us/31.75ns   = 120 pixels   
556
 
557
// Tht  - Total Horizontal Time                    = 832 pixels x 32.75ns/pixel = 26.416us or 38.785Khz   
558
 
559
//
560
 
561
// Correlation between horizontal timing parameters and SED registers   
562
#define SED_HOR_PULSE_WIDTH_CRT 0x07 
563
// Horizontal Pulse Width Register           = (Thp/8) - 1
564
#define SED_HOR_PULSE_START_CRT  0x02 
565
// Horizontal Pulse Start Position Register    = ((Thfp + 2)/8) - 1
566
#define SED_HOR_NONDISP_CRT    0x17 
567
// Horizontal Non-Display Period Register     = ((Thp + Thfp + Thbp)/8) - 1
568
//
569
//                                CRT MODE VERTICAL TIMING PARAMTERS   
570
//
571
//                                       |<-------Tva------->|   
572
//                                       |___________________|                     ______   
573
// Display Enable   _____________________|                   |_____________________|      
574
//                                       |                   |   
575
// Vertical Pulse   __           ________|___________________|________          __________   
576
//                    |_________|        |                   |        |________|   
577
//                    |<- Tvp ->|        |                   |        |   
578
//                    |         |<-Tvbp->|                   |        |   
579
//                    |                                      |<-Tvfp->|   
580
//                    |<----------------------Tvt-------------------->|    
581
//
582
// Tva  - Active Display Time   = 480 lines   
583
// Tvp  - Vertical Pulse        =  3 lines   
584
// Tvfp - Vertical Front Porch  =   9 lines   
585
// Tvbp - Vertical Back Porch   =  28 lines   
586
// Tvt  - Total Horizontal Time = 520 lines x 26.416us/line = 13.73632ms or 72.8Hz   
587
 
588
//
589
 
590
// Correlation between vertical timing parameters and SED registers   
591
#define SED_VER_PULSE_WIDTH_CRT 0x02 // VRTC/FPFRAME Pulse Width Register    = Tvp - 1
592
#define SED_VER_PULSE_START_CRT 0x08 // VRTC/FPFRAME Start Position Register = Tvfp - 1            
593
#define SED_VER_NONDISP_CRT    0x27 // Vertical Non-Display Period Register = (Tvp + Tvfp + Tvbp) - 1
594
 
595
//
596
 
597
// ***************************************************************************************************   
598
// DUAL LCD Mode is 640x480 @ 60Hz VGA compatible timing.   PCLK = 25.175Mhz (39.722ns)
599
// ***************************************************************************************************   
600
//
601
//                              LCD MODE HORIZONTAL TIMING PARAMTERS   
602
//
603
//                                       |<-------Tha------->|   
604
//                                       |___________________|                     ______   
605
// Display Enable   _____________________|                   |____________________|      
606
//                                       |                   |   
607
// Horizontal Pulse __           ________|___________________|________          __________   
608
//                    |_________|        |                   |        |________|   
609
//                    |<- Thp ->|        |                   |        |   
610
//                    |         |<-Thbp->|                   |        |   
611
//                    |                                      |<-Thfp->|   
612
//                    |<----------------------Tht-------------------->|    
613
//
614
// Tha  - Active Display Time                     = 640 pixels   
615
// Thp  - Horizontal Pulse       = 3.8us/39.72ns  =  96 pixels   
616
// Thfp - Horizontal Front Porch = .595us/39.72ns =  16 pixels   
617
// Thbp - Horizontal Backporch   = 1.9us/39.72ns  =  48 pixels   
618
// Tht  - Total Horizontal Time  =                = 800 pixels @ 39.72ns/pixel = 31.776us or 31.47Khz   
619
 
620
//
621
 
622
// Correlation between horizontal timing parameters and SED registers   
623
#define SED_HOR_PULSE_WIDTH_LCD 0x0b  // HRTC/FPLINE Pulse Width Register       = (Thp/8) - 1
624
#define SED_HOR_PULSE_START_LCD  0x02 // HRTC/FPLINE Start Position Register    = (Thfp/8) - 2
625
#define SED_HOR_NONDISP_LCD   0x13    // Horizontal Non-Display Period Register = ((Thp + Thfp + Thbp)/8) - 1
626
 
627
//
628
//                              LCD MODE VERTICAL TIMING PARAMTERS   
629
//
630
//                                       |<-------Tva------->|   
631
//                                       |___________________|                     ______   
632
// Display Enable   _____________________|                   |_____________________|      
633
//                                       |                   |   
634
// Vertical Pulse   __           ________|___________________|________          __________   
635
//                    |_________|        |                   |        |________|   
636
//                    |<- Tvp ->|        |                   |        |   
637
//                    |         |<-Tvbp->|                   |        |   
638
//                    |                                      |<-Tvfp->|   
639
//                    |<----------------------Tvt-------------------->|    
640
//
641
// Tva  - Active Display Time   = 480 lines   
642
// Tvp  - Vertical Pulse        = 2 lines   
643
// Tvfp - Vertical Front Porch  = 10 lines   
644
// Tvbp - Vertical Backporch    = 33 lines   
645
// Tvt  - Total Horizontal Time = 525 lines @ 31.776us/line = 16.682ms or 60Hz   
646
 
647
//
648
// Correlation between vertical timing parameters and SED registers   
649
#define SED_VER_PULSE_WIDTH_LCD 0x01 // VRTC/FPFRAME Pulse Width Register    = Tvp - 1
650
#define SED_VER_PULSE_START_LCD 0x09 // VRTC/FPFRAME Start Position Register = Tvfp - 1            
651
#define SED_VER_NONDISP_LCD   0x2c   // Vertical Non-Display Period Register = (Tvp + Tvfp + Tvbp) - 1

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.