1 | /*
|
---|
2 | * TOPPERS/ASP Kernel
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
4 | * Advanced Standard Profile Kernel
|
---|
5 | *
|
---|
6 | * Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
|
---|
7 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
8 | * Copyright (C) 2015-2017 by TOPPERS PROJECT Educational Working Group.
|
---|
9 | *
|
---|
10 | * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
|
---|
11 | * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
---|
12 | * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
---|
13 | * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
---|
14 | * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
---|
15 | * スコード中に含まれていること.
|
---|
16 | * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
---|
17 | * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
---|
18 | * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
---|
19 | * の無保証規定を掲載すること.
|
---|
20 | * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
---|
21 | * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
---|
22 | * と.
|
---|
23 | * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
---|
24 | * 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
---|
25 | * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
---|
26 | * 報告すること.
|
---|
27 | * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
---|
28 | * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
---|
29 | * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
---|
30 | * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
---|
31 | * 免責すること.
|
---|
32 | *
|
---|
33 | * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
---|
34 | * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
---|
35 | * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
---|
36 | * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
---|
37 | * の責任を負わない.
|
---|
38 | *
|
---|
39 | * @(#) $Id$
|
---|
40 | */
|
---|
41 | /*
|
---|
42 | *
|
---|
43 | * STM32F7xx DSIデバイスドライバの外部宣言
|
---|
44 | *
|
---|
45 | */
|
---|
46 |
|
---|
47 | #ifndef _DSI_H_
|
---|
48 | #define _DSI_H_
|
---|
49 |
|
---|
50 | #include "ltdc.h"
|
---|
51 |
|
---|
52 | #ifdef __cplusplus
|
---|
53 | extern "C" {
|
---|
54 | #endif
|
---|
55 |
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * DSI ACTIVE/INACTIVE設定
|
---|
59 | */
|
---|
60 | #define DSI_INACTIVE 0
|
---|
61 | #define DSI_ACTIVE 1
|
---|
62 |
|
---|
63 | /*
|
---|
64 | * DSI_VideoConfig_t設定
|
---|
65 | */
|
---|
66 | /* ColorCoding設定 */
|
---|
67 | #define DSI_RGB565 0x00000000 /* RGB565 color mode configuration */
|
---|
68 | #define DSI_RGB666 0x00000003 /* RGB666 color mode configuration */
|
---|
69 | #define DSI_RGB888 0x00000005
|
---|
70 |
|
---|
71 | /* Mode設定 */
|
---|
72 | #define DSI_VID_MODE_NB_PULSES 0x00000000
|
---|
73 | #define DSI_VID_MODE_NB_EVENTS 0x00000001
|
---|
74 | #define DSI_VID_MODE_BURST 0x00000002
|
---|
75 |
|
---|
76 | /* LPCommandEnable設定 */
|
---|
77 | #define DSI_LP_COMMAND_DISABLE 0x00000000
|
---|
78 | #define DSI_LP_COMMAND_ENABLE DSI_VMCR_LPCE
|
---|
79 |
|
---|
80 | /* LPHorizontalFrontPorchEnable設定 */
|
---|
81 | #define DSI_LP_HFP_DISABLE 0x00000000
|
---|
82 | #define DSI_LP_HFP_ENABLE DSI_VMCR_LPHFPE
|
---|
83 |
|
---|
84 | /* LPHorizontalBackPorchEnable設定 */
|
---|
85 | #define DSI_LP_HBP_DISABLE 0x00000000
|
---|
86 | #define DSI_LP_HBP_ENABLE DSI_VMCR_LPHBPE
|
---|
87 |
|
---|
88 | /* LPVerticalActiveEnable設定 */
|
---|
89 | #define DSI_LP_VACT_DISABLE 0x00000000
|
---|
90 | #define DSI_LP_VACT_ENABLE DSI_VMCR_LPVAE
|
---|
91 |
|
---|
92 | /* LPVerticalFrontPorchEnable設定 */
|
---|
93 | #define DSI_LP_VFP_DISABLE 0x00000000
|
---|
94 | #define DSI_LP_VFP_ENABLE DSI_VMCR_LPVFPE
|
---|
95 |
|
---|
96 | /* LPVerticalBackPorchEnable設定 */
|
---|
97 | #define DSI_LP_VBP_DISABLE 0x00000000
|
---|
98 | #define DSI_LP_VBP_ENABLE DSI_VMCR_LPVBPE
|
---|
99 |
|
---|
100 | /* LPVerticalSyncActiveEnable設定 */
|
---|
101 | #define DSI_LP_VSYNC_DISABLE 0x00000000
|
---|
102 | #define DSI_LP_VSYNC_ENABLE DSI_VMCR_LPVSAE
|
---|
103 |
|
---|
104 | /* FrameBTAAcknowledgeEnable設定 */
|
---|
105 | #define DSI_FBTAA_DISABLE 0x00000000
|
---|
106 | #define DSI_FBTAA_ENABLE DSI_VMCR_FBTAAE
|
---|
107 |
|
---|
108 | /* LooselyPacked設定 */
|
---|
109 | #define DSI_LOOSELY_PACKED_DISABLE 0x00000000
|
---|
110 | #define DSI_LOOSELY_PACKED_ENABLE DSI_LCOLCR_LPE
|
---|
111 |
|
---|
112 | /* HSPolarity設定 */
|
---|
113 | #define DSI_HSYNC_ACTIVE_HIGH 0x00000000
|
---|
114 | #define DSI_HSYNC_ACTIVE_LOW DSI_LPCR_HSP
|
---|
115 |
|
---|
116 | /* VSPolarity設定 */
|
---|
117 | #define DSI_VSYNC_ACTIVE_HIGH 0x00000000
|
---|
118 | #define DSI_VSYNC_ACTIVE_LOW DSI_LPCR_VSP
|
---|
119 |
|
---|
120 | /* DEPolarity設定 */
|
---|
121 | #define DSI_DATA_ENABLE_ACTIVE_HIGH 0x00000000
|
---|
122 | #define DSI_DATA_ENABLE_ACTIVE_LOW DSI_LPCR_DEP
|
---|
123 |
|
---|
124 |
|
---|
125 | /*
|
---|
126 | * DSI_CommandConfig_t設定
|
---|
127 | */
|
---|
128 | /* TearingEffectSource設定 */
|
---|
129 | #define DSI_TE_DSILINK 0x00000000
|
---|
130 | #define DSI_TE_EXTERNAL DSI_WCFGR_TESRC
|
---|
131 |
|
---|
132 | /* TearingEffectPolarity設定 */
|
---|
133 | #define DSI_TE_RISING_EDGE 0x00000000
|
---|
134 | #define DSI_TE_FALLING_EDGE DSI_WCFGR_TEPOL
|
---|
135 |
|
---|
136 | /* VSyncPol設定 */
|
---|
137 | #define DSI_VSYNC_FALLING 0x00000000
|
---|
138 | #define DSI_VSYNC_RISING DSI_WCFGR_VSPOL
|
---|
139 |
|
---|
140 | /* AutomaticRefresh設定 */
|
---|
141 | #define DSI_AR_DISABLE 0x00000000
|
---|
142 | #define DSI_AR_ENABLE DSI_WCFGR_AR
|
---|
143 |
|
---|
144 | /*
|
---|
145 | * LP COMMAND MODE(dsi_configcommand)設定ビット定義
|
---|
146 | */
|
---|
147 | /* DSI LP LPGen Short Write NoP */
|
---|
148 | #define DSI_LP_GSW0P_DISABLE 0x00000000
|
---|
149 | #define DSI_LP_GSW0P_ENABLE DSI_CMCR_GSW0TX
|
---|
150 |
|
---|
151 | /* DSI LP LPGen Short Write OneP */
|
---|
152 | #define DSI_LP_GSW1P_DISABLE 0x00000000
|
---|
153 | #define DSI_LP_GSW1P_ENABLE DSI_CMCR_GSW1TX
|
---|
154 |
|
---|
155 | /* DSI LP LPGen Short Write TwoP */
|
---|
156 | #define DSI_LP_GSW2P_DISABLE 0x00000000
|
---|
157 | #define DSI_LP_GSW2P_ENABLE DSI_CMCR_GSW2TX
|
---|
158 |
|
---|
159 | /* DSI LP LPGen Short Read NoP */
|
---|
160 | #define DSI_LP_GSR0P_DISABLE 0x00000000
|
---|
161 | #define DSI_LP_GSR0P_ENABLE DSI_CMCR_GSR0TX
|
---|
162 |
|
---|
163 | /* DSI LP LPGen Short Read OneP */
|
---|
164 | #define DSI_LP_GSR1P_DISABLE 0x00000000
|
---|
165 | #define DSI_LP_GSR1P_ENABLE DSI_CMCR_GSR1TX
|
---|
166 |
|
---|
167 | /* DSI LP LPGen Short Read TwoP */
|
---|
168 | #define DSI_LP_GSR2P_DISABLE 0x00000000
|
---|
169 | #define DSI_LP_GSR2P_ENABLE DSI_CMCR_GSR2TX
|
---|
170 |
|
---|
171 | /* DSI LP LPGen LongWrite */
|
---|
172 | #define DSI_LP_GLW_DISABLE 0x00000000
|
---|
173 | #define DSI_LP_GLW_ENABLE DSI_CMCR_GLWTX
|
---|
174 |
|
---|
175 | /* DSI LP LPDcs Short Write NoP */
|
---|
176 | #define DSI_LP_DSW0P_DISABLE 0x00000000
|
---|
177 | #define DSI_LP_DSW0P_ENABLE DSI_CMCR_DSW0TX
|
---|
178 |
|
---|
179 | /* DSI LP LPDcs Short Write OneP */
|
---|
180 | #define DSI_LP_DSW1P_DISABLE 0x00000000
|
---|
181 | #define DSI_LP_DSW1P_ENABLE DSI_CMCR_DSW1TX
|
---|
182 |
|
---|
183 | /* DSI LP LPDcs Short Read NoP */
|
---|
184 | #define DSI_LP_DSR0P_DISABLE 0x00000000
|
---|
185 | #define DSI_LP_DSR0P_ENABLE DSI_CMCR_DSR0TX
|
---|
186 |
|
---|
187 | /* DSI LP LPDcs Long Write */
|
---|
188 | #define DSI_LP_DLW_DISABLE 0x00000000
|
---|
189 | #define DSI_LP_DLW_ENABLE DSI_CMCR_DLWTX
|
---|
190 |
|
---|
191 | /* DSI LP LPMax Read Packet */
|
---|
192 | #define DSI_LP_MRDP_DISABLE 0x00000000
|
---|
193 | #define DSI_LP_MRDP_ENABLE DSI_CMCR_MRDPS
|
---|
194 |
|
---|
195 | /*
|
---|
196 | * DSI_HostTimeout_t設定
|
---|
197 | */
|
---|
198 | /* HighSpeedWritePrespMode設定 */
|
---|
199 | #define DSI_HS_PM_DISABLE 0x00000000
|
---|
200 | #define DSI_HS_PM_ENABLE DSI_TCCR3_PM
|
---|
201 |
|
---|
202 | /*
|
---|
203 | * DSI_Init_t設定
|
---|
204 | */
|
---|
205 | /* AutomaticClockLaneControl設定 */
|
---|
206 | #define DSI_AUTO_CLK_LANE_CTRL_DISABLE 0x00000000
|
---|
207 | #define DSI_AUTO_CLK_LANE_CTRL_ENABLE DSI_CLCR_ACR
|
---|
208 |
|
---|
209 | /* NumberOfLanes定義 */
|
---|
210 | #define DSI_ONE_DATA_LANE 0
|
---|
211 | #define DSI_TWO_DATA_LANES 1
|
---|
212 |
|
---|
213 | /* pllidf設定 */
|
---|
214 | #define DSI_PLL_IN_DIV1 0x00000001
|
---|
215 | #define DSI_PLL_IN_DIV2 0x00000002
|
---|
216 | #define DSI_PLL_IN_DIV3 0x00000003
|
---|
217 | #define DSI_PLL_IN_DIV4 0x00000004
|
---|
218 | #define DSI_PLL_IN_DIV5 0x00000005
|
---|
219 | #define DSI_PLL_IN_DIV6 0x00000006
|
---|
220 | #define DSI_PLL_IN_DIV7 0x00000007
|
---|
221 |
|
---|
222 | /* pllodf設定 */
|
---|
223 | #define DSI_PLL_OUT_DIV1 0x00000000
|
---|
224 | #define DSI_PLL_OUT_DIV2 0x00000001
|
---|
225 | #define DSI_PLL_OUT_DIV4 0x00000002
|
---|
226 | #define DSI_PLL_OUT_DIV8 0x00000003
|
---|
227 |
|
---|
228 |
|
---|
229 | /*
|
---|
230 | * DSIショートWRITEコマンドモード定義(Mode)
|
---|
231 | */
|
---|
232 | #define DSI_DCS_SHORT_PKT_WRITE_P0 0x00000005 /* DCS short write, no parameters */
|
---|
233 | #define DSI_DCS_SHORT_PKT_WRITE_P1 0x00000015 /* DCS short write, one parameter */
|
---|
234 | #define DSI_GEN_SHORT_PKT_WRITE_P0 0x00000003 /* Generic short write, no parameters */
|
---|
235 | #define DSI_GEN_SHORT_PKT_WRITE_P1 0x00000013 /* Generic short write, one parameter */
|
---|
236 | #define DSI_GEN_SHORT_PKT_WRITE_P2 0x00000023 /* Generic short write, two parameters */
|
---|
237 |
|
---|
238 | /*
|
---|
239 | * DSIロングWRITEコマンドモード定義(Mode)
|
---|
240 | */
|
---|
241 | #define DSI_DCS_LONG_PKT_WRITE 0x00000039 /* DCS long write */
|
---|
242 | #define DSI_GEN_LONG_PKT_WRITE 0x00000029 /* Generic long write */
|
---|
243 |
|
---|
244 | /*
|
---|
245 | * DSIコマンドREADコマンドモード定義(Mode)
|
---|
246 | */
|
---|
247 | #define DSI_DCS_SHORT_PKT_READ 0x00000006 /* DCS short read */
|
---|
248 | #define DSI_GEN_SHORT_PKT_READ_P0 0x00000004 /* Generic short read, no parameters */
|
---|
249 | #define DSI_GEN_SHORT_PKT_READ_P1 0x00000014 /* Generic short read, one parameter */
|
---|
250 | #define DSI_GEN_SHORT_PKT_READ_P2 0x00000024 /* Generic short read, two parameters */
|
---|
251 |
|
---|
252 | /*
|
---|
253 | * DSI DCSコマンドモード定義
|
---|
254 | */
|
---|
255 | #define DSI_ENTER_IDLE_MODE 0x39
|
---|
256 | #define DSI_ENTER_INVERT_MODE 0x21
|
---|
257 | #define DSI_ENTER_NORMAL_MODE 0x13
|
---|
258 | #define DSI_ENTER_PARTIAL_MODE 0x12
|
---|
259 | #define DSI_ENTER_SLEEP_MODE 0x10
|
---|
260 | #define DSI_EXIT_IDLE_MODE 0x38
|
---|
261 | #define DSI_EXIT_INVERT_MODE 0x20
|
---|
262 | #define DSI_EXIT_SLEEP_MODE 0x11
|
---|
263 | #define DSI_GET_3D_CONTROL 0x3F
|
---|
264 | #define DSI_GET_ADDRESS_MODE 0x0B
|
---|
265 | #define DSI_GET_BLUE_CHANNEL 0x08
|
---|
266 | #define DSI_GET_DIAGNOSTIC_RESULT 0x0F
|
---|
267 | #define DSI_GET_DISPLAY_MODE 0x0D
|
---|
268 | #define DSI_GET_GREEN_CHANNEL 0x07
|
---|
269 | #define DSI_GET_PIXEL_FORMAT 0x0C
|
---|
270 | #define DSI_GET_POWER_MODE 0x0A
|
---|
271 | #define DSI_GET_RED_CHANNEL 0x06
|
---|
272 | #define DSI_GET_SCANLINE 0x45
|
---|
273 | #define DSI_GET_SIGNAL_MODE 0x0E
|
---|
274 | #define DSI_NOP 0x00
|
---|
275 | #define DSI_READ_DDB_CONTINUE 0xA8
|
---|
276 | #define DSI_READ_DDB_START 0xA1
|
---|
277 | #define DSI_READ_MEMORY_CONTINUE 0x3E
|
---|
278 | #define DSI_READ_MEMORY_START 0x2E
|
---|
279 | #define DSI_SET_3D_CONTROL 0x3D
|
---|
280 | #define DSI_SET_ADDRESS_MODE 0x36
|
---|
281 | #define DSI_SET_COLUMN_ADDRESS 0x2A
|
---|
282 | #define DSI_SET_DISPLAY_OFF 0x28
|
---|
283 | #define DSI_SET_DISPLAY_ON 0x29
|
---|
284 | #define DSI_SET_GAMMA_CURVE 0x26
|
---|
285 | #define DSI_SET_PAGE_ADDRESS 0x2B
|
---|
286 | #define DSI_SET_PARTIAL_COLUMNS 0x31
|
---|
287 | #define DSI_SET_PARTIAL_ROWS 0x30
|
---|
288 | #define DSI_SET_PIXEL_FORMAT 0x3A
|
---|
289 | #define DSI_SET_SCROLL_AREA 0x33
|
---|
290 | #define DSI_SET_SCROLL_START 0x37
|
---|
291 | #define DSI_SET_TEAR_OFF 0x34
|
---|
292 | #define DSI_SET_TEAR_ON 0x35
|
---|
293 | #define DSI_SET_TEAR_SCANLINE 0x44
|
---|
294 | #define DSI_SET_VSYNC_TIMING 0x40
|
---|
295 | #define DSI_SOFT_RESET 0x01
|
---|
296 | #define DSI_WRITE_LUT 0x2D
|
---|
297 | #define DSI_WRITE_MEMORY_CONTINUE 0x3C
|
---|
298 | #define DSI_WRITE_MEMORY_START 0x2C
|
---|
299 |
|
---|
300 |
|
---|
301 | /*
|
---|
302 | * DSIカスタムレーン定義(customlane)
|
---|
303 | */
|
---|
304 | #define DSI_SWAP_LANE_PINS 0x00000000
|
---|
305 | #define DSI_INVERT_HS_SIGNAL 0x00000001
|
---|
306 |
|
---|
307 | /*
|
---|
308 | * DSIレーンタイミング定義(lane)
|
---|
309 | */
|
---|
310 | #define DSI_CLOCK_LANE 0x00000000
|
---|
311 | #define DSI_DATA_LANES 0x00000001
|
---|
312 | #define DSI_DATA_LANE0 0x00000001
|
---|
313 | #define DSI_DATA_LANE1 0x00000002
|
---|
314 |
|
---|
315 | /*
|
---|
316 | * DSI PHYタイミング定義(timing)
|
---|
317 | */
|
---|
318 | #define DSI_TCLK_POST 0x00000000
|
---|
319 | #define DSI_TLPX_CLK 0x00000001
|
---|
320 | #define DSI_THS_EXIT 0x00000002
|
---|
321 | #define DSI_TLPX_DATA 0x00000003
|
---|
322 | #define DSI_THS_ZERO 0x00000004
|
---|
323 | #define DSI_THS_TRAIL 0x00000005
|
---|
324 | #define DSI_THS_PREPARE 0x00000006
|
---|
325 | #define DSI_TCLK_ZERO 0x00000007
|
---|
326 | #define DSI_TCLK_PREPARE 0x00000008
|
---|
327 |
|
---|
328 | /*
|
---|
329 | * DSIエラー定義
|
---|
330 | */
|
---|
331 | #define DSI_ERROR_NONE 0x00000000 /* エラーなし */
|
---|
332 | #define DSI_ERROR_ACK 0x00000001 /* ACKエラー */
|
---|
333 | #define DSI_ERROR_PHY 0x00000002 /* PHYエラー */
|
---|
334 | #define DSI_ERROR_TX 0x00000004 /* 送信エラー */
|
---|
335 | #define DSI_ERROR_RX 0x00000008 /* 受信エラー */
|
---|
336 | #define DSI_ERROR_ECC 0x00000010 /* ECCエラー */
|
---|
337 | #define DSI_ERROR_CRC 0x00000020 /* CRCエラー */
|
---|
338 | #define DSI_ERROR_PSE 0x00000040 /* パケットサイズエラー */
|
---|
339 | #define DSI_ERROR_EOT 0x00000080 /* EOTエラー */
|
---|
340 | #define DSI_ERROR_OVF 0x00000100 /* FIFOオーバーフローエラー */
|
---|
341 | #define DSI_ERROR_GEN 0x00000200 /* ジェネリックFIFOエラー */
|
---|
342 |
|
---|
343 | /*
|
---|
344 | * DSI状態定義
|
---|
345 | */
|
---|
346 | #define DSI_STATE_RESET 0x00000000 /* DSI リセット状態 */
|
---|
347 | #define DSI_STATE_READY 0x00000001 /* DSI レディ状態 */
|
---|
348 | #define DSI_STATE_BUSY 0x00000002 /* DSI ビジィ状態 */
|
---|
349 | #define DSI_STATE_ERROR 0x00010000 /* DSI エラー状態 */
|
---|
350 |
|
---|
351 |
|
---|
352 | /*
|
---|
353 | * DSI初期化設定定義
|
---|
354 | */
|
---|
355 | typedef struct
|
---|
356 | {
|
---|
357 | uint32_t AutomaticClockLaneControl; /* Automatic clock lane control */
|
---|
358 | uint32_t TXEscapeCkdiv; /* TX Escape clock division */
|
---|
359 | uint32_t NumberOfLanes; /* Number of lanes */
|
---|
360 | uint32_t pllndiv; /* PLL Loop Division Factor */
|
---|
361 | uint32_t pllidf; /* PLL Input Division Factor */
|
---|
362 | uint32_t pllodf; /* PLL Output Division Factor */
|
---|
363 | } DSI_Init_t;
|
---|
364 |
|
---|
365 | /*
|
---|
366 | * DSIビデオコンフィギュレーション設定
|
---|
367 | */
|
---|
368 | typedef struct
|
---|
369 | {
|
---|
370 | uint32_t VirtualChannelID; /* Virtual channel ID */
|
---|
371 | uint32_t ColorCoding; /* Color coding for LTDC interface */
|
---|
372 | uint32_t LooselyPacked; /* Enable or disable loosely packed stream */
|
---|
373 | uint32_t Mode; /* Video mode type */
|
---|
374 | uint32_t PacketSize; /* Video packet size */
|
---|
375 | uint32_t NumberOfChunks; /* Number of chunks */
|
---|
376 | uint32_t NullPacketSize; /* Null packet size */
|
---|
377 | uint32_t HSPolarity; /* HSYNC pin polarity */
|
---|
378 | uint32_t VSPolarity; /* VSYNC pin polarity */
|
---|
379 | uint32_t DEPolarity; /* Data Enable pin polarity */
|
---|
380 | uint32_t HorizontalSyncActive; /* Horizontal synchronism active duration */
|
---|
381 | uint32_t HorizontalBackPorch; /* Horizontal back-porch duration */
|
---|
382 | uint32_t HorizontalLine; /* Horizontal line duration */
|
---|
383 | uint32_t VerticalSyncActive; /* Vertical synchronism active duration */
|
---|
384 | uint32_t VerticalBackPorch; /* Vertical back-porch duration */
|
---|
385 | uint32_t VerticalFrontPorch; /* Vertical front-porch duration */
|
---|
386 | uint32_t VerticalActive; /* Vertical active duration */
|
---|
387 | uint32_t LPCommandEnable; /* Low-power command enable */
|
---|
388 | uint32_t LPLargestPacketSize; /* the low power largest packet size that can fit in a line during VSA, VBP and VFP regions */
|
---|
389 | uint32_t LPVACTLargestPacketSize; /* the low power largest packet size that can fit in a line during VACT region */
|
---|
390 | uint32_t LPHorizontalFrontPorchEnable; /* Low-power horizontal front-porch enable */
|
---|
391 | uint32_t LPHorizontalBackPorchEnable; /* Low-power horizontal back-porch enable */
|
---|
392 | uint32_t LPVerticalActiveEnable; /* Low-power vertical active enable */
|
---|
393 | uint32_t LPVerticalFrontPorchEnable; /* Low-power vertical front-porch enable */
|
---|
394 | uint32_t LPVerticalBackPorchEnable; /* Low-power vertical back-porch enable */
|
---|
395 | uint32_t LPVerticalSyncActiveEnable; /* Low-power vertical sync active enable */
|
---|
396 | uint32_t FrameBTAAcknowledgeEnable; /* Frame bus-turn-around acknowledge enable */
|
---|
397 | } DSI_VideoConfig_t;
|
---|
398 |
|
---|
399 | /*
|
---|
400 | * DSI コマンドコンフィギュレーション定義
|
---|
401 | */
|
---|
402 | typedef struct
|
---|
403 | {
|
---|
404 | uint32_t VirtualChannelID; /* Virtual channel ID */
|
---|
405 | uint32_t ColorCoding; /* Color coding for LTDC interface */
|
---|
406 | uint32_t CommandSize; /* Maximum allowed size for an LTDC write memory command, measured in pixels */
|
---|
407 | uint32_t TearingEffectSource; /* Tearing effect source */
|
---|
408 | uint32_t TearingEffectPolarity; /* Tearing effect pin polarity */
|
---|
409 | uint32_t HSPolarity; /* HSYNC pin polarity */
|
---|
410 | uint32_t VSPolarity; /* VSYNC pin polarity */
|
---|
411 | uint32_t DEPolarity; /* Data Enable pin polarity */
|
---|
412 | uint32_t VSyncPol; /* VSync edge on which the LTDC is halted */
|
---|
413 | uint32_t AutomaticRefresh; /* Automatic refresh mode */
|
---|
414 | } DSI_CommandConfig_t;
|
---|
415 |
|
---|
416 | /*
|
---|
417 | * DSI PHY タイミング定義
|
---|
418 | */
|
---|
419 | typedef struct
|
---|
420 | {
|
---|
421 | uint32_t ClockLaneHS2LPTime; /* The maximum time that the D-PHY clock lane takes to go from high-speed to low-power transmission */
|
---|
422 | uint32_t ClockLaneLP2HSTime; /* The maximum time that the D-PHY clock lane takes to go from low-power to high-speed transmission */
|
---|
423 | uint32_t DataLaneHS2LPTime; /* The maximum time that the D-PHY data lanes takes to go from high-speed to low-power transmission */
|
---|
424 | uint32_t DataLaneLP2HSTime; /* The maximum time that the D-PHY data lanes takes to go from low-power to high-speed transmission */
|
---|
425 | uint32_t DataLaneMaxReadTime; /* The maximum time required to perform a read command */
|
---|
426 | uint32_t StopWaitTime; /* The minimum wait period to request a High-Speed transmission after the Stop state */
|
---|
427 | } DSI_PHY_Time_t;
|
---|
428 |
|
---|
429 | /*
|
---|
430 | * DSI HOSTタイムアウト定義
|
---|
431 | */
|
---|
432 | typedef struct
|
---|
433 | {
|
---|
434 | uint32_t TimeoutCkdiv; /* Time-out clock division */
|
---|
435 | uint32_t HighSpeedTransmissionTimeout; /* High-speed transmission time-out */
|
---|
436 | uint32_t LowPowerReceptionTimeout; /* Low-power reception time-out */
|
---|
437 | uint32_t HighSpeedReadTimeout; /* High-speed read time-out */
|
---|
438 | uint32_t LowPowerReadTimeout; /* Low-power read time-out */
|
---|
439 | uint32_t HighSpeedWriteTimeout; /* High-speed write time-out */
|
---|
440 | uint32_t HighSpeedWritePrespMode; /* High-speed write presp mode */
|
---|
441 | uint32_t LowPowerWriteTimeout; /* Low-speed write time-out */
|
---|
442 | uint32_t BTATimeout; /* BTA time-out */
|
---|
443 |
|
---|
444 | } DSI_HostTimeout_t;
|
---|
445 |
|
---|
446 | /**
|
---|
447 | * @brief DSI Handle Structure definition
|
---|
448 | */
|
---|
449 | typedef struct DSI_Handle_s DSI_Handle_t;
|
---|
450 | struct DSI_Handle_s
|
---|
451 | {
|
---|
452 | uint32_t base; /* DSI ベースレジスタ */
|
---|
453 | DSI_Init_t Init; /* DSI required parameters */
|
---|
454 | void (*teffectcallback)(DSI_Handle_t * hdsi); /* TearEffctコールバック関数 */
|
---|
455 | void (*refreshcallback)(DSI_Handle_t * hdsi); /* リフレッシュ終了コールバック関数 */
|
---|
456 | void (*errorcallback)(DSI_Handle_t * hdsi); /* エラーコールバック関数 */
|
---|
457 | volatile uint32_t state; /* DSI 実行状態 */
|
---|
458 | volatile uint32_t errorcode; /* DSI Error code */
|
---|
459 | };
|
---|
460 |
|
---|
461 | extern ER dsi_init(DSI_Handle_t *hdsi);
|
---|
462 | extern ER dsi_deinit(DSI_Handle_t *hdsi);
|
---|
463 | extern ER dsi_configvideo(DSI_Handle_t *hdsi, DSI_VideoConfig_t *pini);
|
---|
464 | extern ER dci_configltdc(LTDC_Handle_t* hltdc, DSI_VideoConfig_t *pini);
|
---|
465 | extern ER dsi_configadaptedCmdMode(DSI_Handle_t *hdsi, DSI_CommandConfig_t *pcfg, uint32_t ackactive);
|
---|
466 | extern ER dsi_configcommand(DSI_Handle_t *hdsi, uint32_t lpcmode, uint32_t ackactive);
|
---|
467 | extern ER dsi_configPhyTimer(DSI_Handle_t *hdsi, DSI_PHY_Time_t *ptime);
|
---|
468 | extern ER dsi_configHostTimeout(DSI_Handle_t *hdsi, DSI_HostTimeout_t *ptimeout);
|
---|
469 | extern ER dsi_start(DSI_Handle_t *hdsi);
|
---|
470 | extern ER dsi_stop(DSI_Handle_t *hdsi);
|
---|
471 | extern ER dsi_swrite(DSI_Handle_t *hdsi, uint32_t Channel, uint32_t Mode, uint32_t Param1, uint32_t Param2);
|
---|
472 | extern ER dsi_lwrite(DSI_Handle_t *hdsi, uint32_t Channel, uint32_t Mode, uint32_t NbParams, uint32_t Param1, uint8_t* buf);
|
---|
473 | extern ER dsi_read(DSI_Handle_t *hdsi, uint32_t Channel, uint8_t* Array, uint32_t Size, uint32_t Mode, uint32_t DCSCmd, uint8_t* buf);
|
---|
474 | extern ER dsi_enterULPMData(DSI_Handle_t *hdsi);
|
---|
475 | extern ER dsi_exitULPMData(DSI_Handle_t *hdsi);
|
---|
476 | extern ER dsi_enterULPM(DSI_Handle_t *hdsi);
|
---|
477 | extern ER dsi_exitULPM(DSI_Handle_t *hdsi);
|
---|
478 | extern void dsi_startPatternGenerator(DSI_Handle_t *hdsi, uint32_t Mode, uint32_t Orientation);
|
---|
479 | extern void dsi_stopPatternGenerator(DSI_Handle_t *hdsi);
|
---|
480 | extern ER dsi_setLanePinsConfiguration(DSI_Handle_t *hdsi, uint32_t CustomLane, uint32_t Lane, uint32_t active);
|
---|
481 | extern ER dsi_setPHYTiming(DSI_Handle_t *hdsi, uint32_t Timing, uint32_t active, uint32_t Value);
|
---|
482 | extern ER dsi_forceTXStopMode(DSI_Handle_t *hdsi, uint32_t Lane, uint32_t active);
|
---|
483 |
|
---|
484 | extern void dsi_irqhandler(DSI_Handle_t *hdsi);
|
---|
485 |
|
---|
486 | /*
|
---|
487 | * SLEW RATE High-Speed Transmission Slew Rate Control on Clock Lane設定
|
---|
488 | */
|
---|
489 | #define dsi_setSRateHSTXClock(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1), \
|
---|
490 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1)) & ~DSI_WPCR1_HSTXSRCCL) |((v)<<16)))
|
---|
491 |
|
---|
492 | /*
|
---|
493 | * SLEW RATE High-Speed Transmission Slew Rate Control on Data Lanes設定
|
---|
494 | */
|
---|
495 | #define dsi_setSRateHSTXLane(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1), \
|
---|
496 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1)) & ~DSI_WPCR1_HSTXSRCDL) |((v)<<18)))
|
---|
497 |
|
---|
498 | /*
|
---|
499 | * SLEW RATE Low-Power transmission Slew Rate Compensation on Clock Lane設定
|
---|
500 | */
|
---|
501 | #define dsi_setSRateLPTXClock(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1), \
|
---|
502 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1)) & ~DSI_WPCR1_LPSRCCL) |((v)<<6)))
|
---|
503 |
|
---|
504 | /*
|
---|
505 | * SLEW RATE Low-Power transmission Slew Rate Compensation on Data Lanes設定
|
---|
506 | */
|
---|
507 | #define dsi_setSRateLPTXLane(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1), \
|
---|
508 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1)) & ~DSI_WPCR1_LPSRCDL) |((v)<<8)))
|
---|
509 |
|
---|
510 | /*
|
---|
511 | * DEALYタイミング High-Speed Transmission Delay on Clock Lane設定
|
---|
512 | */
|
---|
513 | #define dsi_setHSDealyClock(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1), \
|
---|
514 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1)) & ~DSI_WPCR1_HSTXDCL) |(v)))
|
---|
515 |
|
---|
516 | /*
|
---|
517 | * DEAYタイミング High-Speed Transmission Delay on Data Lanes設定
|
---|
518 | */
|
---|
519 | #define dsi_setHSDealyLane(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1), \
|
---|
520 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1)) & ~DSI_WPCR1_HSTXDDL) |((v)<<2)))
|
---|
521 |
|
---|
522 |
|
---|
523 | /*
|
---|
524 | * Configure the Generic interface read-back Virtual Channel ID.
|
---|
525 | */
|
---|
526 | #define dsi_setGenericVCID(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_GVCIDR), \
|
---|
527 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_GVCIDR)) & ~DSI_GVCIDR_VCID) |(v)))
|
---|
528 |
|
---|
529 | /*
|
---|
530 | * Configure the flow control parameters
|
---|
531 | */
|
---|
532 | #define dsi_confFlowControl(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_PCR), \
|
---|
533 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_PCR)) & ~DSI_FLOW_CONTROL_ALL) |(v)))
|
---|
534 |
|
---|
535 | /*
|
---|
536 | * Refresh the display in command mode
|
---|
537 | */
|
---|
538 | #define dsi_refresh(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WCR), \
|
---|
539 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WCR)) | DSI_WCR_LTDCEN))
|
---|
540 |
|
---|
541 | /*
|
---|
542 | * Controls the display color mode in Video mode
|
---|
543 | */
|
---|
544 | #define dsi_colorMode(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WCR), \
|
---|
545 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WCR)) & ~DSI_WCR_COLM) |(v)))
|
---|
546 |
|
---|
547 | /*
|
---|
548 | * Control the display shutdown in Video mode
|
---|
549 | */
|
---|
550 | #define dsi_shutdown(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WCR), \
|
---|
551 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WCR)) & ~DSI_WCR_SHTDN) |((v)<<1)))
|
---|
552 |
|
---|
553 | /*
|
---|
554 | * Low-Power Reception Filter Tuning
|
---|
555 | */
|
---|
556 | #define dsi_setLowPowRXFilter(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1), \
|
---|
557 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1)) & ~DSI_WPCR1_LPRXFT) |((v)<<25)))
|
---|
558 |
|
---|
559 | /*
|
---|
560 | * Activate an additional current path on all lanes to meet the SDDTx parameter
|
---|
561 | */
|
---|
562 | #define dsi_setSDD(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1), \
|
---|
563 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1)) & ~DSI_WPCR1_SDDC) |((v)<<12)))
|
---|
564 |
|
---|
565 | /*
|
---|
566 | * Forces LP Receiver in Low-Power Mode
|
---|
567 | */
|
---|
568 | #define dsi_forceRXLowPower(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1), \
|
---|
569 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR1)) & ~DSI_WPCR1_FLPRXLPM) |((v)<<22)))
|
---|
570 |
|
---|
571 | /*
|
---|
572 | * Force Data Lanes in RX Mode after a BTA
|
---|
573 | */
|
---|
574 | #define dsi_forceDataLanesRX(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR0), \
|
---|
575 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR0)) & ~DSI_WPCR0_TDDL) |((v)<<16)))
|
---|
576 |
|
---|
577 | /*
|
---|
578 | * Enable a pull-down on the lanes to prevent from floating states when unused
|
---|
579 | */
|
---|
580 | #define dsi_setPullDown(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR0), \
|
---|
581 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR0)) & ~DSI_WPCR0_PDEN) |((v)<<18)))
|
---|
582 |
|
---|
583 | /*
|
---|
584 | * Switch off the contention detection on data lanes
|
---|
585 | */
|
---|
586 | #define dsi_setContDetectOff(h, v) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR0), \
|
---|
587 | ((sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_WPCR0)) & ~DSI_WPCR0_CDOFFDL) |((v)<<14)))
|
---|
588 |
|
---|
589 | /*
|
---|
590 | * エラー割込み設定
|
---|
591 | */
|
---|
592 | #define DSI_INT_ACKERR_REQ (DSI_ISR0_AE0 | DSI_ISR0_AE1 | DSI_ISR0_AE2 | DSI_ISR0_AE3 | \
|
---|
593 | DSI_ISR0_AE4 | DSI_ISR0_AE5 | DSI_ISR0_AE6 | DSI_ISR0_AE7 | \
|
---|
594 | DSI_ISR0_AE8 | DSI_ISR0_AE9 | DSI_ISR0_AE10 | DSI_ISR0_AE11 | \
|
---|
595 | DSI_ISR0_AE12 | DSI_ISR0_AE13 | DSI_ISR0_AE14 | DSI_ISR0_AE15)
|
---|
596 | #define DSI_INT_PHYERR_REQ (DSI_ISR0_PE0 | DSI_ISR0_PE1 | DSI_ISR0_PE2 | DSI_ISR0_PE3 | DSI_ISR0_PE4)
|
---|
597 | #define DSI_INT_GENERR_REQ (DSI_ISR1_GCWRE | DSI_ISR1_GPWRE | DSI_ISR1_GPTXE | DSI_ISR1_GPRDE | DSI_ISR1_GPRXE)
|
---|
598 |
|
---|
599 | /*
|
---|
600 | * ACKエラー割込み要求
|
---|
601 | */
|
---|
602 | #define dsi_int_ackerr(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_IER0), \
|
---|
603 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_IER0)) | DSI_INT_ACKERR_REQ))
|
---|
604 |
|
---|
605 | /*
|
---|
606 | * PHYエラー割込み要求
|
---|
607 | */
|
---|
608 | #define dsi_int_phyerr(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_IER0), \
|
---|
609 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_IER0)) | DSI_INT_PHYERR_REQ))
|
---|
610 |
|
---|
611 | /*
|
---|
612 | * TXエラー割込み要求
|
---|
613 | */
|
---|
614 | #define dsi_int_txerr(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_IER1), \
|
---|
615 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_IER1)) | DSI_ISR1_TOHSTX))
|
---|
616 |
|
---|
617 | /*
|
---|
618 | * RXエラー割込み要求
|
---|
619 | */
|
---|
620 | #define dsi_int_rxerr(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_IER1), \
|
---|
621 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_IER1)) | DSI_ISR1_TOLPRX))
|
---|
622 | /*
|
---|
623 | * ECCエラー割込み要求
|
---|
624 | */
|
---|
625 | #define dsi_int_eccerr(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_IER1), \
|
---|
626 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_IER1)) | (DSI_ISR1_ECCSE | DSI_ISR1_ECCME)))
|
---|
627 |
|
---|
628 | /*
|
---|
629 | * CRCエラー割込み要求
|
---|
630 | */
|
---|
631 | #define dsi_int_crcerr(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_IER1), \
|
---|
632 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_IER1)) | DSI_ISR1_CRCE))
|
---|
633 |
|
---|
634 | /*
|
---|
635 | * PSEエラー割込み要求
|
---|
636 | */
|
---|
637 | #define dsi_int_pseerr(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_IER1), \
|
---|
638 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_IER1)) | DSI_ISR1_PSE))
|
---|
639 |
|
---|
640 | /*
|
---|
641 | * EOTエラー割込み要求
|
---|
642 | */
|
---|
643 | #define dsi_int_eoterr(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_IER1), \
|
---|
644 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_IER1)) | DSI_ISR1_EOTPE))
|
---|
645 |
|
---|
646 | /*
|
---|
647 | * VOFエラー割込み要求
|
---|
648 | */
|
---|
649 | #define dsi_int_voferr(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_IER1), \
|
---|
650 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_IER1)) | DSI_ISR1_LPWRE))
|
---|
651 |
|
---|
652 | /*
|
---|
653 | * GENエラー割込み要求
|
---|
654 | */
|
---|
655 | #define dsi_int_generr(h) sil_wrw_mem((uint32_t *)((h)->base+TOFF_DSI_IER1), \
|
---|
656 | (sil_rew_mem((uint32_t *)((h)->base+TOFF_DSI_IER1)) | DSI_INT_GENERR_REQ))
|
---|
657 |
|
---|
658 | #ifdef __cplusplus
|
---|
659 | }
|
---|
660 | #endif
|
---|
661 |
|
---|
662 | #endif /* _DSI_H_ */
|
---|
663 |
|
---|