The MCUXpresso SDK provides a peripheral driver for the Enhanced LCD Interface(eLCDIF)
The Enhanced LCD Interface supports MPU mode, VSYNC mode, RGB mode (or DOTCLK mode), and DVI mode. The current eLCDIF driver only supports RGB mode.
Typical use case
Frame buffer update
The function ELCDIF_SetNextBufferAddr sets the next frame to show to eLCDIF, the eLCDIF loads the new frame and sets the interrupt kELCDIF_CurFrameDone. If no new frame is set, the old one is displayed.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/elcdif
Alpha surface
The alpha surface can be enabled to add an extra overlay on the normal display buffer. In this example, the alpha surface is enabled, and the alpha value is updated after every frame loaded to eLCDIF.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/elcdif
|
enum | _elcdif_polarity_flags {
kELCDIF_VsyncActiveLow = 0U,
kELCDIF_VsyncActiveHigh = LCDIF_VDCTRL0_VSYNC_POL_MASK,
kELCDIF_HsyncActiveLow = 0U,
kELCDIF_HsyncActiveHigh = LCDIF_VDCTRL0_HSYNC_POL_MASK,
kELCDIF_DataEnableActiveLow = 0U,
kELCDIF_DataEnableActiveHigh = LCDIF_VDCTRL0_ENABLE_POL_MASK,
kELCDIF_DriveDataOnFallingClkEdge = 0U,
kELCDIF_DriveDataOnRisingClkEdge = LCDIF_VDCTRL0_DOTCLK_POL_MASK
} |
| eLCDIF signal polarity flags More...
|
|
enum | _elcdif_interrupt_enable {
kELCDIF_BusMasterErrorInterruptEnable = LCDIF_CTRL1_BM_ERROR_IRQ_EN_MASK,
kELCDIF_TxFifoOverflowInterruptEnable = LCDIF_CTRL1_OVERFLOW_IRQ_EN_MASK,
kELCDIF_TxFifoUnderflowInterruptEnable = LCDIF_CTRL1_UNDERFLOW_IRQ_EN_MASK,
kELCDIF_CurFrameDoneInterruptEnable,
kELCDIF_VsyncEdgeInterruptEnable
} |
| The eLCDIF interrupts to enable. More...
|
|
enum | _elcdif_interrupt_flags {
kELCDIF_BusMasterError = LCDIF_CTRL1_BM_ERROR_IRQ_MASK,
kELCDIF_TxFifoOverflow = LCDIF_CTRL1_OVERFLOW_IRQ_MASK,
kELCDIF_TxFifoUnderflow = LCDIF_CTRL1_UNDERFLOW_IRQ_MASK,
kELCDIF_CurFrameDone,
kELCDIF_VsyncEdge = LCDIF_CTRL1_VSYNC_EDGE_IRQ_MASK
} |
| The eLCDIF interrupt status flags. More...
|
|
enum | _elcdif_status_flags {
kELCDIF_LFifoFull = LCDIF_STAT_LFIFO_FULL_MASK,
kELCDIF_LFifoEmpty = LCDIF_STAT_LFIFO_EMPTY_MASK,
kELCDIF_TxFifoFull = LCDIF_STAT_TXFIFO_FULL_MASK,
kELCDIF_TxFifoEmpty = LCDIF_STAT_TXFIFO_EMPTY_MASK
} |
| eLCDIF status flags More...
|
|
enum | elcdif_pixel_format_t {
kELCDIF_PixelFormatRAW8 = 0,
kELCDIF_PixelFormatRGB565 = 1,
kELCDIF_PixelFormatRGB666 = 2,
kELCDIF_PixelFormatXRGB8888 = 3,
kELCDIF_PixelFormatRGB888 = 4
} |
| The pixel format. More...
|
|
enum | elcdif_lcd_data_bus_t {
kELCDIF_DataBus8Bit = LCDIF_CTRL_LCD_DATABUS_WIDTH(1),
kELCDIF_DataBus16Bit = LCDIF_CTRL_LCD_DATABUS_WIDTH(0),
kELCDIF_DataBus18Bit = LCDIF_CTRL_LCD_DATABUS_WIDTH(2),
kELCDIF_DataBus24Bit = LCDIF_CTRL_LCD_DATABUS_WIDTH(3)
} |
| The LCD data bus type. More...
|
|
enum | elcdif_as_pixel_format_t {
kELCDIF_AsPixelFormatARGB8888 = 0x0,
kELCDIF_AsPixelFormatRGB888 = 0x4,
kELCDIF_AsPixelFormatARGB1555 = 0x8,
kELCDIF_AsPixelFormatARGB4444 = 0x9,
kELCDIF_AsPixelFormatRGB555 = 0xC,
kELCDIF_AsPixelFormatRGB444 = 0xD,
kELCDIF_AsPixelFormatRGB565 = 0xE
} |
| eLCDIF alpha surface pixel format. More...
|
|
enum | elcdif_alpha_mode_t {
kELCDIF_AlphaEmbedded,
kELCDIF_AlphaOverride,
kELCDIF_AlphaMultiply,
kELCDIF_AlphaRop
} |
| eLCDIF alpha mode during blending. More...
|
|
enum | elcdif_rop_mode_t {
kELCDIF_RopMaskAs = 0x0,
kELCDIF_RopMaskNotAs = 0x1,
kELCDIF_RopMaskAsNot = 0x2,
kELCDIF_RopMergeAs = 0x3,
kELCDIF_RopMergeNotAs = 0x4,
kELCDIF_RopMergeAsNot = 0x5,
kELCDIF_RopNotCopyAs = 0x6,
kELCDIF_RopNot = 0x7,
kELCDIF_RopNotMaskAs = 0x8,
kELCDIF_RopNotMergeAs = 0x9,
kELCDIF_RopXorAs = 0xA,
kELCDIF_RopNotXorAs = 0xB
} |
| eLCDIF ROP mode during blending. More...
|
|
enum | elcdif_lut_t {
kELCDIF_Lut0 = 0,
kELCDIF_Lut1
} |
| eLCDIF LUT More...
|
|
|
The Lookup Table (LUT) is used to expand the 8 bits pixel to 24 bits pixel before output to external displayer.
There are two 256x24 bits LUT memory in LCDIF, the LSB of frame buffer address determins which memory to use.
|
static void | ELCDIF_EnableLut (LCDIF_Type *base, bool enable) |
| Enable or disable the LUT. More...
|
|
status_t | ELCDIF_UpdateLut (LCDIF_Type *base, elcdif_lut_t lut, uint16_t startIndex, const uint32_t *lutData, uint16_t count) |
| Load the LUT value. More...
|
|
struct elcdif_pixel_format_reg_t |
These register bits control the pixel format:
- CTRL[DATA_FORMAT_24_BIT]
- CTRL[DATA_FORMAT_18_BIT]
- CTRL[DATA_FORMAT_16_BIT]
- CTRL[WORD_LENGTH]
- CTRL1[BYTE_PACKING_FORMAT]
uint32_t elcdif_pixel_format_reg_t::regCtrl |
uint32_t elcdif_pixel_format_reg_t::regCtrl1 |
struct elcdif_rgb_mode_config_t |
uint16_t elcdif_rgb_mode_config_t::panelWidth |
uint16_t elcdif_rgb_mode_config_t::panelHeight |
uint8_t elcdif_rgb_mode_config_t::hsw |
uint8_t elcdif_rgb_mode_config_t::hfp |
uint8_t elcdif_rgb_mode_config_t::hbp |
uint8_t elcdif_rgb_mode_config_t::vsw |
uint8_t elcdif_rgb_mode_config_t::vfp |
uint8_t elcdif_rgb_mode_config_t::vbp |
uint32_t elcdif_rgb_mode_config_t::polarityFlags |
uint32_t elcdif_rgb_mode_config_t::bufferAddr |
struct elcdif_as_buffer_config_t |
uint32_t elcdif_as_buffer_config_t::bufferAddr |
struct elcdif_as_blend_config_t |
uint8_t elcdif_as_blend_config_t::alpha |
bool elcdif_as_blend_config_t::invertAlpha |
Enumerator |
---|
kELCDIF_VsyncActiveLow |
VSYNC active low.
|
kELCDIF_VsyncActiveHigh |
VSYNC active high.
|
kELCDIF_HsyncActiveLow |
HSYNC active low.
|
kELCDIF_HsyncActiveHigh |
HSYNC active high.
|
kELCDIF_DataEnableActiveLow |
Data enable line active low.
|
kELCDIF_DataEnableActiveHigh |
Data enable line active high.
|
kELCDIF_DriveDataOnFallingClkEdge |
Drive data on falling clock edge, capture data on rising clock edge.
|
kELCDIF_DriveDataOnRisingClkEdge |
Drive data on falling clock edge, capture data on rising clock edge.
|
Enumerator |
---|
kELCDIF_BusMasterErrorInterruptEnable |
Bus master error interrupt.
|
kELCDIF_TxFifoOverflowInterruptEnable |
TXFIFO overflow interrupt.
|
kELCDIF_TxFifoUnderflowInterruptEnable |
TXFIFO underflow interrupt.
|
kELCDIF_CurFrameDoneInterruptEnable |
Interrupt when hardware enters vertical blanking state.
|
kELCDIF_VsyncEdgeInterruptEnable |
Interrupt when hardware encounters VSYNC edge.
|
Enumerator |
---|
kELCDIF_BusMasterError |
Bus master error interrupt.
|
kELCDIF_TxFifoOverflow |
TXFIFO overflow interrupt.
|
kELCDIF_TxFifoUnderflow |
TXFIFO underflow interrupt.
|
kELCDIF_CurFrameDone |
Interrupt when hardware enters vertical blanking state.
|
kELCDIF_VsyncEdge |
Interrupt when hardware encounters VSYNC edge.
|
Enumerator |
---|
kELCDIF_LFifoFull |
LFIFO full.
|
kELCDIF_LFifoEmpty |
LFIFO empty.
|
kELCDIF_TxFifoFull |
TXFIFO full.
|
kELCDIF_TxFifoEmpty |
TXFIFO empty.
|
This enumerator should be defined together with the array s_pixelFormatReg. To support new pixel format, enhance this enumerator and s_pixelFormatReg.
Enumerator |
---|
kELCDIF_PixelFormatRAW8 |
RAW 8 bit, four data use 32 bits.
|
kELCDIF_PixelFormatRGB565 |
RGB565, two pixel use 32 bits.
|
kELCDIF_PixelFormatRGB666 |
RGB666 unpacked, one pixel uses 32 bits, high byte unused, upper 2 bits of other bytes unused.
|
kELCDIF_PixelFormatXRGB8888 |
XRGB8888 unpacked, one pixel uses 32 bits, high byte unused.
|
kELCDIF_PixelFormatRGB888 |
RGB888 packed, one pixel uses 24 bits.
|
Enumerator |
---|
kELCDIF_DataBus8Bit |
8-bit data bus.
|
kELCDIF_DataBus16Bit |
16-bit data bus, support RGB565.
|
kELCDIF_DataBus18Bit |
18-bit data bus, support RGB666.
|
kELCDIF_DataBus24Bit |
24-bit data bus, support RGB888.
|
Enumerator |
---|
kELCDIF_AsPixelFormatARGB8888 |
32-bit pixels with alpha.
|
kELCDIF_AsPixelFormatRGB888 |
32-bit pixels without alpha (unpacked 24-bit format)
|
kELCDIF_AsPixelFormatARGB1555 |
16-bit pixels with alpha.
|
kELCDIF_AsPixelFormatARGB4444 |
16-bit pixels with alpha.
|
kELCDIF_AsPixelFormatRGB555 |
16-bit pixels without alpha.
|
kELCDIF_AsPixelFormatRGB444 |
16-bit pixels without alpha.
|
kELCDIF_AsPixelFormatRGB565 |
16-bit pixels without alpha.
|
Enumerator |
---|
kELCDIF_AlphaEmbedded |
The alpha surface pixel alpha value will be used for blend.
|
kELCDIF_AlphaOverride |
The user defined alpha value will be used for blend directly.
|
kELCDIF_AlphaMultiply |
The alpha surface pixel alpha value scaled the user defined alpha value will be used for blend, for example, pixel alpha set set to 200, user defined alpha set to 100, then the reault alpha is 200 * 100 / 255.
|
kELCDIF_AlphaRop |
Raster operation.
|
Explanation:
- AS: Alpha surface
- PS: Process surface
- nAS: Alpha surface NOT value
- nPS: Process surface NOT value
Enumerator |
---|
kELCDIF_RopMaskAs |
AS AND PS.
|
kELCDIF_RopMaskNotAs |
nAS AND PS.
|
kELCDIF_RopMaskAsNot |
AS AND nPS.
|
kELCDIF_RopMergeAs |
AS OR PS.
|
kELCDIF_RopMergeNotAs |
nAS OR PS.
|
kELCDIF_RopMergeAsNot |
AS OR nPS.
|
kELCDIF_RopNotCopyAs |
nAS.
|
kELCDIF_RopNot |
nPS.
|
kELCDIF_RopNotMaskAs |
AS NAND PS.
|
kELCDIF_RopNotMergeAs |
AS NOR PS.
|
kELCDIF_RopXorAs |
AS XOR PS.
|
kELCDIF_RopNotXorAs |
AS XNOR PS.
|
The Lookup Table (LUT) is used to expand the 8 bits pixel to 24 bits pixel before output to external displayer.
There are two 256x24 bits LUT memory in LCDIF, the LSB of frame buffer address determins which memory to use.
Enumerator |
---|
kELCDIF_Lut0 |
LUT 0.
|
kELCDIF_Lut1 |
LUT 1.
|
This function ungates the eLCDIF clock and configures the eLCDIF peripheral according to the configuration structure.
- Parameters
-
base | eLCDIF peripheral base address. |
config | Pointer to the configuration structure. |
This function sets the configuration structure to default values. The default configuration is set to the following values.
config->panelWidth = 480U;
config->panelHeight = 272U;
config->hsw = 41;
config->hfp = 4;
config->hbp = 8;
config->vsw = 10;
config->vfp = 4;
config->vbp = 2;
config->bufferAddr = 0U;
- Parameters
-
config | Pointer to the eLCDIF configuration structure. |
void ELCDIF_Deinit |
( |
LCDIF_Type * |
base | ) |
|
- Parameters
-
base | eLCDIF peripheral base address. |
- Parameters
-
base | eLCDIF peripheral base address. |
pixelFormat | The pixel format. |
static void ELCDIF_RgbModeStart |
( |
LCDIF_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | eLCDIF peripheral base address. |
void ELCDIF_RgbModeStop |
( |
LCDIF_Type * |
base | ) |
|
- Parameters
-
base | eLCDIF peripheral base address. |
static void ELCDIF_SetNextBufferAddr |
( |
LCDIF_Type * |
base, |
|
|
uint32_t |
bufferAddr |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | eLCDIF peripheral base address. |
bufferAddr | The frame buffer address to set. |
void ELCDIF_Reset |
( |
LCDIF_Type * |
base | ) |
|
- Parameters
-
base | eLCDIF peripheral base address. |
static void ELCDIF_EnablePxpHandShake |
( |
LCDIF_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | eLCDIF peripheral base address. |
enable | True to enable, false to disable. |
static uint32_t ELCDIF_GetCrcValue |
( |
LCDIF_Type * |
base | ) |
|
|
inlinestatic |
When a frame is sent complete (the interrupt kELCDIF_CurFrameDone assert), this function can be used to get the CRC value of the frame sent.
- Parameters
-
base | eLCDIF peripheral base address. |
- Returns
- The CRC value.
- Note
- The CRC value is dependent on the LCD_DATABUS_WIDTH.
static uint32_t ELCDIF_GetBusMasterErrorAddr |
( |
LCDIF_Type * |
base | ) |
|
|
inlinestatic |
When bus master error occurs (the interrupt kELCDIF_BusMasterError assert), this function can get the virtual address at which the AXI master received an error response from the slave.
- Parameters
-
base | eLCDIF peripheral base address. |
- Returns
- The error virtual address.
static uint32_t ELCDIF_GetStatus |
( |
LCDIF_Type * |
base | ) |
|
|
inlinestatic |
The status flags are returned as a mask value, application could check the corresponding bit. Example:
uint32_t statusFlags;
{
}
{
}
- Parameters
-
base | eLCDIF peripheral base address. |
- Returns
- The mask value of status flags, it is OR'ed value of _elcdif_status_flags.
static uint32_t ELCDIF_GetLFifoCount |
( |
LCDIF_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | eLCDIF peripheral base address. |
- Returns
- The LFIFO current count
static void ELCDIF_EnableInterrupts |
( |
LCDIF_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | eLCDIF peripheral base address. |
mask | interrupt source, OR'ed value of _elcdif_interrupt_enable. |
static void ELCDIF_DisableInterrupts |
( |
LCDIF_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | eLCDIF peripheral base address. |
mask | interrupt source, OR'ed value of _elcdif_interrupt_enable. |
static uint32_t ELCDIF_GetInterruptStatus |
( |
LCDIF_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | eLCDIF peripheral base address. |
- Returns
- Interrupt pending status, OR'ed value of _elcdif_interrupt_flags.
static void ELCDIF_ClearInterruptStatus |
( |
LCDIF_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | eLCDIF peripheral base address. |
mask | of the flags to clear, OR'ed value of _elcdif_interrupt_flags. |
static void ELCDIF_EnableLut |
( |
LCDIF_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | eLCDIF peripheral base address. |
enable | True to enable, false to disable. |
status_t ELCDIF_UpdateLut |
( |
LCDIF_Type * |
base, |
|
|
elcdif_lut_t |
lut, |
|
|
uint16_t |
startIndex, |
|
|
const uint32_t * |
lutData, |
|
|
uint16_t |
count |
|
) |
| |
This function loads the LUT value to the specific LUT memory, user can specify the start entry index.
- Parameters
-
base | eLCDIF peripheral base address. |
lut | Which LUT to load. |
startIndex | The start index of the LUT entry to update. |
lutData | The LUT data to load. |
count | Count of lutData . |
- Return values
-
kStatus_Success | Initialization success. |
kStatus_InvalidArgument | Wrong argument. |