WebRadioApp  0.1
ew_bsp_display.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * E M B E D D E D W I Z A R D P R O J E C T
4  *
5  * Copyright (c) TARA Systems
6  *GmbH written by Paul Banach and Manfred Schweyer
7  *
8  ********************************************************************************
9  *
10  * This software is delivered "as is" and shows the usage of other software
11  * components. It is provided as an example software which is intended to be
12  * modified and extended according to particular requirements.
13  *
14  * TARA Systems hereby disclaims all warranties and conditions with regard to
15  *the software, including all implied warranties and conditions of
16  *merchantability and non-infringement of any third party IPR or other rights
17  *which may result from the use or the inability to use the software.
18  *
19  ********************************************************************************
20  *
21  * DESCRIPTION:
22  * This file is part of the interface (glue layer) between an Embedded Wizard
23  * generated UI application and the board support package (BSP) of a dedicated
24  * target.
25  * This template is responsible to initialize the display hardware of the
26  *board and to provide the necessary access to update the display content.
27  *
28  *******************************************************************************/
29 
41 #ifndef EW_BSP_DISPLAY_H
42 #define EW_BSP_DISPLAY_H
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /* flag to indicate normal display update with full access to frame buffer */
49 #define EW_BSP_DISPLAY_UPDATE_NORMAL 0x00000000
50 
51 /* flag to indicate partial frame buffer update in case of a synchroneous single
52  buffer - update is divided in stripes (fields) defined by the display driver
53  */
54 #define EW_BSP_DISPLAY_UPDATE_PARTIAL 0x00000001
55 
56 /* flag to indicate display update by using a scratch-pad buffer - update is
57  done in subareas that fit into the scratch-pad buffer */
58 #define EW_BSP_DISPLAY_UPDATE_SCRATCHPAD 0x00000002
59 
60 /******************************************************************************
61  * TYPE:
62  * XDisplayInfo
63  *
64  * DESCRIPTION:
65  * The structure XDisplayInfo describes the attributes and current
66  *configuration of the display. The interpretation and usage of the members may
67  *depend on the underlying system and the selected framebuffer integration
68  *scenario.
69  *
70  * ELEMENTS:
71  * FrameBuffer - Pointer to the framebuffer memory. In case of
72  *double-buffering it refers to the first framebuffer (not the currently active
73  *front-buffer). If the display is updated from a scrach-pad buffer, the pointer
74  *refers to the scratch-pad buffer memory. DoubleBuffer - Pointer to the
75  *second framebuffer or scratch-pad buffer in case of double-buffering.
76  * BufferWidth - Width of the framebuffer(s) / scratch-pad buffer(s) in
77  *pixel. BufferHeight - Height of the framebuffer(s) / scratch-pad buffer(s)
78  *in pixel. DisplayWidth - Width of the display in pixel. DisplayHeight -
79  *Height of the display in pixel. UpdateMode - The display update mode
80  *(normal, partial, scratch-pad). Context - Optional pointer to a target
81  *specific struct.
82  *
83  ******************************************************************************/
84 typedef struct {
85  void *FrameBuffer;
86  void *DoubleBuffer;
87  int BufferWidth;
88  int BufferHeight;
89  int DisplayWidth;
90  int DisplayHeight;
91  int UpdateMode;
92  void *Context;
93 } XDisplayInfo;
94 
95 /*******************************************************************************
96  * FUNCTION:
97  * EwBspDisplayInit
98  *
99  * DESCRIPTION:
100  * The function EwBspDisplayInit initializes the display hardware and returns
101  * the display parameter.
102  *
103  * ARGUMENTS:
104  * aDisplayInfo - Display info data structure.
105  *
106  * RETURN VALUE:
107  * Returns 1 if successful, 0 otherwise.
108  *
109  *******************************************************************************/
110 int EwBspDisplayInit(XDisplayInfo *aDisplayInfo);
111 
112 /*******************************************************************************
113  * FUNCTION:
114  * EwBspDisplayDone
115  *
116  * DESCRIPTION:
117  * The function EwBspDisplayDone deinitializes the display hardware.
118  *
119  * ARGUMENTS:
120  * None
121  *
122  * RETURN VALUE:
123  * None
124  *
125  *******************************************************************************/
126 void EwBspDisplayDone(void);
127 
128 /*******************************************************************************
129  * FUNCTION:
130  * EwBspDisplayGetUpdateArea
131  *
132  * DESCRIPTION:
133  * The function EwBspDisplayGetUpdateArea returns the next update area
134  * depending on the selected display mode:
135  * In case of a synchroneous single-buffer, the function has to return the
136  * the rectangular areas that correspond to the horizontal stripes (fields)
137  * of the framebuffer.
138  * In case of a scratch-pad buffer, the function has to return the subareas
139  * that fit into the provided update rectangle.
140  * During each display update, this function is called until it returns 0.
141  *
142  * ARGUMENTS:
143  * aUpdateRect - Rectangular area which should be updated (redrawn).
144  *
145  * RETURN VALUE:
146  * Returns 1 if a further update area can be provided, 0 otherwise.
147  *
148  *******************************************************************************/
149 int EwBspDisplayGetUpdateArea(XRect *aUpdateRect);
150 
151 /*******************************************************************************
152  * FUNCTION:
153  * EwBspDisplayWaitForCompletion
154  *
155  * DESCRIPTION:
156  * The function EwBspDisplayWaitForCompletion is called from the Graphics
157  *Engine to ensure that all pending activities of the display system are
158  *completed, so that the rendering of the next frame can start. In case of a
159  *double-buffering system, the function has to wait until the V-sync has occured
160  *and the pending buffer is used by the display controller. In case of an
161  *external display controller, the function has to wait until the transfer
162  *(update) of the graphics data has been completed and there are no pending
163  *buffers.
164  *
165  * ARGUMENTS:
166  * None
167  *
168  * RETURN VALUE:
169  * None
170  *
171  *******************************************************************************/
173 
174 /*******************************************************************************
175  * FUNCTION:
176  * EwBspDisplayCommitBuffer
177  *
178  * DESCRIPTION:
179  * The function EwBspDisplayCommitBuffer is called from the Graphics Engine
180  * when the rendering of a certain buffer has been completed.
181  * The type of buffer depends on the selected framebuffer concept.
182  * If the display is running in a double-buffering mode, the function is
183  *called after each buffer update in order to change the currently active
184  *framebuffer address. Changing the framebuffer address should be synchronized
185  *with V-sync. If the system is using an external graphics controller, this
186  *function is responsible to start the transfer of the framebuffer content.
187  *
188  * ARGUMENTS:
189  * aAddress - Address of the framebuffer to be shown on the display.
190  * aX,
191  * aY - Origin of the area which has been updated by the Graphics
192  *Engine. aWidth, aHeight - Size of the area which has been updated by the
193  *Graphics Engine.
194  *
195  * RETURN VALUE:
196  * None
197  *
198  *******************************************************************************/
199 void EwBspDisplayCommitBuffer(void *aAddress, int aX, int aY, int aWidth,
200  int aHeight);
201 
202 /*******************************************************************************
203  * FUNCTION:
204  * EwBspDisplaySetClut
205  *
206  * DESCRIPTION:
207  * The function EwBspDisplaySetClut is called from the Graphics Engine
208  * in order to update the hardware CLUT of the current framebuffer.
209  * The function is only called when the color format of the framebuffer is
210  * Index8 or LumA44.
211  *
212  * ARGUMENTS:
213  * aClut - Pointer to a color lookup table with 256 entries.
214  *
215  * RETURN VALUE:
216  * None
217  *
218  *******************************************************************************/
219 void EwBspDisplaySetClut(unsigned long *aClut);
220 
221 #ifdef __cplusplus
222 }
223 #endif
224 
225 #endif /* EW_BSP_DISPLAY_H */
226 
227 /* msy */
228 
OTM8009A_FORMAT
#define OTM8009A_FORMAT
Definition: ew_bsp_display.c:83
XDisplayInfo::DisplayWidth
int DisplayWidth
Definition: ew_bsp_display.h:112
WaitForDsiTransfer
static void WaitForDsiTransfer(void)
Definition: ew_bsp_display.c:299
ew_bsp_graphics.h
FRAME_BUFFER_HEIGHT
#define FRAME_BUFFER_HEIGHT
Definition: ewconfig.h:130
DSI_IRQHandler
void DSI_IRQHandler(void)
Definition: ew_bsp_display.c:248
ewrte.h
DSI_COLOR_CODING
#define DSI_COLOR_CODING
Definition: ew_bsp_display.c:82
DSI_IO_Write
static int32_t DSI_IO_Write(uint16_t ChannelNbr, uint16_t Reg, uint8_t *pData, uint16_t Size)
DCS or Generic short/long write command.
Definition: ew_bsp_display.c:195
FRAME_BUFFER_WIDTH
#define FRAME_BUFFER_WIDTH
Definition: ewconfig.h:129
LTDC_IRQHandler
void LTDC_IRQHandler(void)
Definition: ew_bsp_display.c:238
VBP
#define VBP
Definition: ew_bsp_display.c:57
EwBspGraphicsConcurrentOperation
void EwBspGraphicsConcurrentOperation(int aEnable)
The function EwBspGraphicsConcurrentOperation configures the operation mode of DMA2D and CPU....
Definition: ew_bsp_graphics.c:212
HAL_DSI_EndOfRefreshCallback
void HAL_DSI_EndOfRefreshCallback(DSI_HandleTypeDef *hdsi)
Definition: ew_bsp_display.c:262
__DSI_MASK_TE
#define __DSI_MASK_TE()
Definition: ew_bsp_display.c:70
VSYNC
#define VSYNC
Definition: ew_bsp_display.c:56
EwBspDisplaySetClut
void EwBspDisplaySetClut(unsigned long *aClut)
The function EwBspDisplaySetClut is called from the Graphics Engine in order to update the hardware C...
Definition: ew_bsp_display.c:709
LCD_DisplayOn
static void LCD_DisplayOn(void)
LCD ON.
Definition: ew_bsp_display.c:168
EwBspDisplayWaitForCompletion
void EwBspDisplayWaitForCompletion(void)
The function EwBspDisplayWaitForCompletion is called from the Graphics Engine to ensure that all pend...
Definition: ew_bsp_display.c:621
DSI_IO_Read
static int32_t DSI_IO_Read(uint16_t ChannelNbr, uint16_t Reg, uint8_t *pData, uint16_t Size)
DCS or Generic read command.
Definition: ew_bsp_display.c:225
XDisplayInfo
Definition: ew_bsp_display.h:84
XDisplayInfo::UpdateMode
int UpdateMode
Definition: ew_bsp_display.h:114
pColLeft
uint8_t pColLeft[]
Definition: ew_bsp_display.c:107
EwBspDisplayGetUpdateArea
int EwBspDisplayGetUpdateArea(XRect *aUpdateRect)
The function EwBspDisplayGetUpdateArea returns the next update area depending on the selected display...
Definition: ew_bsp_display.c:604
DOUBLE_BUFFER_ADDR
#define DOUBLE_BUFFER_ADDR
Definition: ewconfig.h:142
FRAME_BUFFER_ADDR
#define FRAME_BUFFER_ADDR
Definition: ewconfig.h:133
LEFT_AREA
#define LEFT_AREA
Definition: ew_bsp_display.c:64
FirstUpdateIsDone
static int FirstUpdateIsDone
Definition: ew_bsp_display.c:120
__DSI_UNMASK_TE
#define __DSI_UNMASK_TE()
Definition: ew_bsp_display.c:73
LCD_DisplayOff
static void LCD_DisplayOff(void)
LCD OFF.
Definition: ew_bsp_display.c:180
LAYER_INDEX
#define LAYER_INDEX
Definition: ew_bsp_display.c:54
XRect
Definition: ewrte.h:1639
EwPrint
void EwPrint(const char *aFormat,...)
ew_bsp_clock.h
LayerConfig
static LTDC_LayerCfgTypeDef LayerConfig
Definition: ew_bsp_display.c:92
ew_bsp_display.h
RIGHT_AREA
#define RIGHT_AREA
Definition: ew_bsp_display.c:65
EwBspDisplayInit
int EwBspDisplayInit(XDisplayInfo *aDisplayInfo)
The function EwBspDisplayInit initializes the display hardware and returns the display parameter.
Definition: ew_bsp_display.c:331
CPU_LOAD_SET_ACTIVE
#define CPU_LOAD_SET_ACTIVE()
Definition: ew_bsp_clock.h:56
LTDC_ER_IRQHandler
void LTDC_ER_IRQHandler(void)
Definition: ew_bsp_display.c:243
VFP
#define VFP
Definition: ew_bsp_display.c:58
EwBspDisplayDone
void EwBspDisplayDone(void)
The function EwBspDisplayDone deinitializes the display hardware.
Definition: ew_bsp_display.c:586
pColRight
uint8_t pColRight[]
Definition: ew_bsp_display.c:108
XDisplayInfo::FrameBuffer
void * FrameBuffer
Definition: ew_bsp_display.h:108
pPage
uint8_t pPage[]
Definition: ew_bsp_display.c:109
CPU_LOAD_SET_IDLE
#define CPU_LOAD_SET_IDLE()
Definition: ew_bsp_clock.h:55
HAL_DSI_TearingEffectCallback
void HAL_DSI_TearingEffectCallback(DSI_HandleTypeDef *hdsi)
Definition: ew_bsp_display.c:253
EwBspDisplayCommitBuffer
void EwBspDisplayCommitBuffer(void *aAddress, int aX, int aY, int aWidth, int aHeight)
The function EwBspDisplayCommitBuffer is called from the Graphics Engine when the rendering of a cert...
Definition: ew_bsp_display.c:650
PeriphClkInitStruct
static RCC_PeriphCLKInitTypeDef PeriphClkInitStruct
Definition: ew_bsp_display.c:94
HSYNC
#define HSYNC
Definition: ew_bsp_display.c:59
ewconfig.h
This file contains general configuration settings for the target system, like memory ranges and displ...
EW_BSP_DISPLAY_UPDATE_NORMAL
#define EW_BSP_DISPLAY_UPDATE_NORMAL
Definition: ew_bsp_display.h:49
ActiveArea
static volatile int32_t ActiveArea
Definition: ew_bsp_display.c:93
XDisplayInfo::BufferHeight
int BufferHeight
Definition: ew_bsp_display.h:111
XDisplayInfo::DisplayHeight
int DisplayHeight
Definition: ew_bsp_display.h:113
XDisplayInfo::BufferWidth
int BufferWidth
Definition: ew_bsp_display.h:110
NO_AREA
#define NO_AREA
Definition: ew_bsp_display.c:63
HBP
#define HBP
Definition: ew_bsp_display.c:60
hltdc_handle
#define hltdc_handle
Definition: ew_bsp_display.c:67
LCD_MspInit
void LCD_MspInit(void)
LCD Intialization.
Definition: ew_bsp_display.c:127
hdsi_handle
#define hdsi_handle
Definition: ew_bsp_display.c:68
XDisplayInfo::DoubleBuffer
void * DoubleBuffer
Definition: ew_bsp_display.h:109
HFP
#define HFP
Definition: ew_bsp_display.c:61
pScanCol
uint8_t pScanCol[]
Definition: ew_bsp_display.c:110