dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_max7456_priv.h
Go to the documentation of this file.
1 
11 /*
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20  * for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, see <http://www.gnu.org/licenses/>
24  *
25  * Additional note on redistribution: The copyright and license notices above
26  * must be maintained in each individual source file that is a derivative work
27  * of this source file; otherwise redistribution is prohibited.
28  */
29 
30 #ifndef PIOS_MAX7456_PRIV_H_
31 #define PIOS_MAX7456_PRIV_H_
32 
67 };
68 
69 
70 /* Video Mode 0 Register */
71 #define MAX7456_VM0_VBE_MASK (0b1)
72 #define MAX7456_VM0_VBE_R(val) (val & MAX7456_VM0_VBE_MASK)
73 #define MAX7456_VM0_VBE_W(regval, val) ((regval & ~MAX7456_VM0_VBE_MASK) | (val & MAX7456_VM0_VBE_MASK))
74 #define MAX7456_VM0_VBE_ENABLE 0b0
75 #define MAX7456_VM0_VBE_DISABLE 0b1
76 
77 #define MAX7456_VM0_SRB_MASK (0b1 << 1)
78 #define MAX7456_VM0_SRB_R(val) ((val & MAX7456_VM0_SRB_MASK) >> 1)
79 #define MAX7456_VM0_SRB_W(regval, val) ((regval & ~MAX7456_VM0_SRB_MASK) | (val << 1 & MAX7456_VM0_SRB_MASK))
80 #define MAX7456_VM0_SRB_RESET 0b1
81 #define MAX7456_VM0_SRB_CLEAR 0b0
82 
83 #define MAX7456_VM0_VS_MASK (0b1 << 2)
84 #define MAX7456_VM0_VS_R(val) ((val & MAX7456_VM0_VS_MASK) >> 2)
85 #define MAX7456_VM0_VS_W(regval, val) ((regval & ~MAX7456_VM0_VS_MASK) | (val << 2 & MAX7456_VM0_VS_MASK))
86 #define MAX7456_VM0_VS_VSYNC 0b1
87 #define MAX7456_VM0_VS_IMMEDIATE 0b0
88 
89 #define MAX7456_VM0_OSD_MASK (0b1 << 3)
90 #define MAX7456_VM0_OSD_R(val) ((val & MAX7456_VM0_OSD_MASK) >> 3)
91 #define MAX7456_VM0_OSD_W(regval, val) ((regval & ~MAX7456_VM0_OSD_MASK) | (val << 3 & MAX7456_VM0_OSD_MASK))
92 #define MAX7456_VM0_OSD_ENABLE 0b1
93 #define MAX7456_VM0_OSD_DISABLE 0b0
94 
95 
96 #define MAX7456_VM0_SYNC_MASK (0b11 << 4)
97 #define MAX7456_VM0_SYNC_R(val) ((val & MAX7456_VM0_SYNC_MASK) >> 4)
98 #define MAX7456_VM0_SYNC_W(regval, val) ((regval & ~MAX7456_VM0_SYNC_MASK) | (val << 4 & MAX7456_VM0_SYNC_MASK))
99 #define MAX7456_VM0_SYNC_AUTO 0b00
100 #define MAX7456_VM0_SYNC_EXT 0b10
101 #define MAX7456_VM0_SYNC_INT 0b11
102 
103 #define MAX7456_VM0_VSS_MASK (0b1 << 6)
104 #define MAX7456_VM0_VSS_R(val) ((val & MAX7456_VM0_VSS_MASK) >> 6)
105 #define MAX7456_VM0_VSS_W(regval, val) ((regval & ~MAX7456_VM0_VSS_MASK) | (val << 6 & MAX7456_VM0_VSS_MASK))
106 #define MAX7456_VM0_VSS_PAL 0b1
107 #define MAX7456_VM0_VSS_NTSC 0b0
108 
109 /* Video Mode 1 Register */
110 #define MAX7456_VM1_BDUTY_MASK (0b11)
111 #define MAX7456_VM1_BDUTY_R(val) (val & MAX7456_VM1_BDUTY_MASK)
112 #define MAX7456_VM1_BDUTY_W(regval, val) ((regval & ~MAX7456_VM1_BDUTY_MASK) | (val & MAX7456_VM1_BDUTY_MASK))
113 #define MAX7456_VM1_BDUTY_BT 0b00
114 #define MAX7456_VM1_BDUTY_2BT 0b01
115 #define MAX7456_VM1_BDUTY_3BT 0b10
116 #define MAX7456_VM1_BDUTY_13BT 0b11
117 
118 #define MAX7456_VM1_BTIME_MASK (0b11 << 2)
119 #define MAX7456_VM1_BTIME_R(val) ((val & MAX7456_VM1_BTIME_MASK) >> 2)
120 #define MAX7456_VM1_BTIME_W(regval, val) ((regval & ~MAX7456_VM1_BTIME_MASK) | (val << 2 & MAX7456_VM1_BTIME_MASK))
121 #define MAX7456_VM1_BTIME_2FIELD 0b00
122 #define MAX7456_VM1_BTIME_4FIELD 0b01
123 #define MAX7456_VM1_BTIME_6FIELD 0b10
124 #define MAX7456_VM1_BTIME_8FIELD 0b11
125 
126 #define MAX7456_VM1_BGLVL_MASK (0b111 << 4)
127 #define MAX7456_VM1_BGLVL_R(val) ((val & MAX7456_VM1_BGLVL_MASK) >> 4)
128 #define MAX7456_VM1_BGLVL_W(regval, val) ((regval & ~MAX7456_VM1_BGLVL_MASK) | (val << 4 & MAX7456_VM1_BGLVL_MASK))
129 #define MAX7456_VM1_BGLVL_0 0b000
130 #define MAX7456_VM1_BGLVL_7 0b001
131 #define MAX7456_VM1_BGLVL_14 0b010
132 #define MAX7456_VM1_BGLVL_21 0b011
133 #define MAX7456_VM1_BGLVL_28 0b100
134 #define MAX7456_VM1_BGLVL_35 0b101
135 #define MAX7456_VM1_BGLVL_42 0b110
136 #define MAX7456_VM1_BGLVL_49 0b111
137 
138 #define MAX7456_VM1_BGMODE_MASK (0b1 << 7)
139 #define MAX7456_VM1_BGMODE_R(val) ((val & MAX7456_VM1_BGMODE_MASK) >> 7)
140 #define MAX7456_VM1_BGMODE_W(regval, val) ((regval & ~MAX7456_VM1_BGMODE_MASK) | (val << 7 & MAX7456_VM1_BGMODE_MASK))
141 #define MAX7456_VM1_BGMODE_LOCAL 0b0
142 #define MAX7456_VM1_BGMODE_GRAY 0b1
143 
144 /* Horizontal Offset Register */
145 #define MAX7456_HOS_POS_MASK (0x3f)
146 #define MAX7456_HOS_POS_R(val) (val & MAX7456_HOS_POS_MASK)
147 #define MAX7456_HOS_POS_W(regval, val) (val & MAX7456_HOS_POS_MASK)
148 
149 /* Vertical Offset Register */
150 #define MAX7456_VOS_POS_MASK (0x3f)
151 #define MAX7456_VOS_POS_R(val) (val & MAX7456_VOS_POS_MASK)
152 #define MAX7456_VOS_POS_W(regval, val) (val & MAX7456_VOS_POS_MASK)
153 
154 /* Display Memory Mode Register */
155 #define MAX7456_DMM_CLR_MASK (0b1 << 2)
156 #define MAX7456_DMM_CLR_R(val) ((val & MAX7456_DMM_CLR_MASK) >> 2)
157 #define MAX7456_DMM_CLR_W(regval, val) ((regval & ~MAX7456_DMM_CLR_MASK) | (val << 2 & MAX7456_DMM_CLR_MASK))
158 #define MAX7456_DMM_CLR_CLEAR 0b1
159 #define MAX7456_DMM_CLR_READY 0b0
160 
161 /* OSD Black Level Register */
162 #define MAX7456_OSDBL_CTL_MASK (0b1 << 4)
163 #define MAX7456_OSDBL_CTL_R(val) ((val & MAX7456_OSDBL_CTL_MASK) >> 4)
164 #define MAX7456_OSDBL_CTL_W(regval, val) ((regval & ~MAX7456_OSDBL_CTL_MASK) | (val << 4 & MAX7456_OSDBL_CTL_MASK))
165 #define MAX7456_OSDBL_CTL_ENABLE 0b0
166 #define MAX7456_OSDBL_CTL_DISABLE 0b1
167 
168 /* Status Register */
169 #define MAX7456_STAT_PAL_R(val) (val & 0b1)
170 #define MAX7456_STAT_PAL_TRUE 0b1
171 #define MAX7456_STAT_PAL_FALSE 0b0
172 #define MAX7456_STAT_NTSC_R(val) ((val >> 1) & 0b1)
173 #define MAX7456_STAT_NTSC_TRUE 0b1
174 #define MAX7456_STAT_NTSC_FALSE 0b0
175 #define MAX7456_STAT_SYNC_R(val) ((val >> 2) & 0b1)
176 #define MAX7456_STAT_SYNC_FALSE 0b1
177 #define MAX7456_STAT_SYNC_TRUE 0b0
178 #define MAX7456_STAT_HSYNC_R(val) ((val >> 3) & 0b1)
179 #define MAX7456_STAT_HSYNC_FALSE 0b1
180 #define MAX7456_STAT_HSYNC_TRUE 0b0
181 #define MAX7456_STAT_VSYNC_R(val) ((val >> 4) & 0b1)
182 #define MAX7456_STAT_VSYNC_FALSE 0b1
183 #define MAX7456_STAT_VSYNC_TRUE 0b0
184 #define MAX7456_STAT_CHMEM_R(val) ((val >> 5) & 0b1)
185 #define MAX7456_STAT_CHMEM_RDY 0b0
186 #define MAX7456_STAT_CHMEM_BUSY 0b1
187 #define MAX7456_STAT_RESET_R(val) ((val >> 6) & 0b1)
188 #define MAX7456_STAT_RESET_DONE 0b0
189 #define MAX7456_STAT_RESET_BUSY 0b1
190 
191 /* Display memory data register magical 'no autoincrement' value */
192 #define MAX7456_DMDI_AUTOINCREMENT_STOP 0xff
193 
194 /* Magical "write to NVM array" command */
195 #define MAX7456_CMM_WRITE_NVM 0xa0
196 
197 /* "read char from NVM array" command */
198 #define MAX7456_CMM_READ_NVM 0x50
199 
200 #endif // PIOS_MAX7456_PRIV_H_
201 
pios_max7456_reg