1 |
25 |
rherveille |
/*
|
2 |
|
|
/////////////////////////////////////////////////////////////////////
|
3 |
|
|
//// ////
|
4 |
|
|
//// Include file for OpenCores VGA/LCD Controller ////
|
5 |
|
|
//// ////
|
6 |
|
|
//// File : oc_vga_lcd.h ////
|
7 |
|
|
//// Function: c-include file ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// Authors: Richard Herveille (richard@asics.ws) ////
|
10 |
|
|
//// www.opencores.org ////
|
11 |
|
|
//// ////
|
12 |
|
|
/////////////////////////////////////////////////////////////////////
|
13 |
|
|
//// ////
|
14 |
|
|
//// Copyright (C) 2001 Richard Herveille ////
|
15 |
|
|
//// richard@asics.ws ////
|
16 |
|
|
//// www.asics.ws ////
|
17 |
|
|
//// ////
|
18 |
|
|
//// This source file may be used and distributed without ////
|
19 |
|
|
//// restriction provided that this copyright statement is not ////
|
20 |
|
|
//// removed from the file and that any derivative work contains ////
|
21 |
|
|
//// the original copyright notice and the associated disclaimer.////
|
22 |
|
|
//// ////
|
23 |
|
|
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
|
24 |
|
|
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
|
25 |
|
|
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
|
26 |
|
|
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
|
27 |
|
|
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
|
28 |
|
|
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
|
29 |
|
|
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
|
30 |
|
|
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
|
31 |
|
|
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
|
32 |
|
|
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
|
33 |
|
|
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
|
34 |
|
|
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
|
35 |
|
|
//// POSSIBILITY OF SUCH DAMAGE. ////
|
36 |
|
|
//// ////
|
37 |
|
|
/////////////////////////////////////////////////////////////////////
|
38 |
|
|
*/
|
39 |
|
|
|
40 |
|
|
/*
|
41 |
|
|
* Definitions for the Opencores VGA/LCD Controller Core
|
42 |
|
|
*/
|
43 |
|
|
|
44 |
|
|
/* --- Register definitions --- */
|
45 |
|
|
|
46 |
|
|
/* ----- Read-write access */
|
47 |
|
|
|
48 |
|
|
#define OC_VGA_CTRL 0x000 /* Control register */
|
49 |
|
|
#define OC_VGA_STAT 0x004 /* Status register */
|
50 |
|
|
#define OC_VGA_HTIM 0x008 /* Horizontal Timing register */
|
51 |
|
|
#define OC_VGA_VTIM 0x00c /* Vertical Timing register */
|
52 |
|
|
#define OC_VGA_HVLEN 0x010 /* Horizontal/Vertical length register*/
|
53 |
|
|
#define OC_VGA_VBARA 0x014 /* Video Base Address register A */
|
54 |
|
|
#define OC_VGA_VBARB 0x018 /* Video Base Address register B */
|
55 |
|
|
|
56 |
|
|
/* ----- Bits definition */
|
57 |
|
|
|
58 |
|
|
/* ----- Control register */
|
59 |
|
|
/* bits 31-16 are reserved */
|
60 |
|
|
#define OC_VGA_BL (1<<15) /* Blank level bit: */
|
61 |
|
|
#define OC_VGA_CSL (1<<14) /* Composite Sync. level bit */
|
62 |
|
|
#define OC_VGA_VSL (1<<13) /* Vertical Sync. level bit */
|
63 |
|
|
#define OC_VGA_HSL (1<<12) /* Horizontal Sync. level bit */
|
64 |
|
|
/* 0 - Positive */
|
65 |
|
|
/* 1 - Negative */
|
66 |
|
|
#define OC_VGA_PC (1<<11) /* Pseudo Color (only for 8bpp mode) */
|
67 |
|
|
/* 0 - 8bpp gray scale */
|
68 |
|
|
/* 1 - 8bpp pseudo color */
|
69 |
|
|
#define OC_VGA_CD (1<< 9) /* Color Depth */
|
70 |
|
|
/* 00 - 8bits per pixel */
|
71 |
|
|
/* 01 - 16bits per pixel */
|
72 |
|
|
/* 10 - 24bits per pixel */
|
73 |
|
|
/* 11 - reserved */
|
74 |
|
|
#define OC_VGA_VBL (1<< 7) /* Video burst length */
|
75 |
|
|
/* 00 - 1 cycle */
|
76 |
|
|
/* 01 - 2 cycle */
|
77 |
|
|
/* 10 - 4 cycle */
|
78 |
|
|
/* 11 - 8 cycle */
|
79 |
|
|
#define OC_VGA_CBSWE (1<<6) /* CLUT Bank Switch Enable bit */
|
80 |
|
|
#define OC_VGA_VBSWE (1<<5) /* Video Bank Switch Enable bit */
|
81 |
|
|
#define OC_VGA_CBSIE (1<<4) /* CLUT Bank Switch Interrupt enable */
|
82 |
|
|
#define OC_VGA_VBSIE (1<<3) /* Video Bank Switch Interrupt enable */
|
83 |
|
|
#define OC_VGA_HIE (1<<2) /* Horizontal Interrupt enable */
|
84 |
|
|
#define OC_VGA_VIE (1<<1) /* Vertical Interrupt enable */
|
85 |
|
|
#define OC_VGA_VEN (1<<0) /* Video Enable bit */
|
86 |
|
|
/* 1 - Enabled */
|
87 |
|
|
/* 0 - Disabled */
|
88 |
|
|
|
89 |
|
|
/* ----- Status register */
|
90 |
|
|
/* bits 31-18 are reserved */
|
91 |
|
|
#define OC_VGA_ACMP (1<<17) /* Active CLUT Memory Page */
|
92 |
|
|
#define OC_VGA_AVMP (1<<16) /* Active Video Memory Page */
|
93 |
|
|
/* bits 15-8 are reserved */
|
94 |
|
|
#define OC_VGA_CBSINT (1<<7) /* CLUT Bank Switch Interrupt pending */
|
95 |
|
|
#define OC_VGA_VBSINT (1<<6) /* Bank Switch Interrupt pending */
|
96 |
|
|
#define OC_VGA_HINT (1<<5) /* Horizontal Interrupt pending */
|
97 |
|
|
#define OC_VGA_VINT (1<<4) /* Vertical Interrupt pending */
|
98 |
|
|
/* bits 3-2 are reserved */
|
99 |
|
|
#define OC_VGA_LUINT (1<<1) /* LineFIFO Underrun interrupt pending*/
|
100 |
|
|
#define OC_VGA_SINT (1<<0) /* System Error Interrupt pending */
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
/* ----- Horizontal/Vertical Timing registers */
|
104 |
|
|
|
105 |
|
|
#define OC_VGA_TSYNC (1<<24) /* Synchronization pulse width */
|
106 |
|
|
#define OC_VGA_TGDEL (1<<16) /* Gate delay time */
|
107 |
|
|
#define OC_VGA_TGATE (1<< 0) /* Gate time */
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
/* ----- Horizontal and Vertcial Length registers */
|
111 |
|
|
|
112 |
|
|
#define OC_VGA_THLEN (1<<16) /* Horizontal length */
|
113 |
|
|
#define OC_VGA_TVLEN (1<< 0) /* Vertical length */
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
/* bit testing and setting macros */
|
117 |
|
|
|
118 |
|
|
#define OC_ISSET(reg,bitmask) ((reg)&(bitmask))
|
119 |
|
|
#define OC_ISCLEAR(reg,bitmask) (!(OC_ISSET(reg,bitmask)))
|
120 |
|
|
#define OC_BITSET(reg,bitmask) ((reg)|(bitmask))
|
121 |
|
|
#define OC_BITCLEAR(reg,bitmask) ((reg)|(~(bitmask)))
|
122 |
|
|
#define OC_BITTOGGLE(reg,bitmask) ((reg)^(bitmask))
|
123 |
|
|
#define OC_REGMOVE(reg,value) ((reg)=(value))
|