MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
eLCDIF: Enhanced LCD Interface

Overview

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

Data Structures

struct  elcdif_pixel_format_reg_t
 The register value when using different pixel format. More...
 
struct  elcdif_rgb_mode_config_t
 eLCDIF configure structure for RGB mode (DOTCLK mode). More...
 
struct  elcdif_as_buffer_config_t
 eLCDIF alpha surface buffer configuration. More...
 
struct  elcdif_as_blend_config_t
 eLCDIF alpha surface blending configuration. More...
 

Enumerations

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...
 

Driver version

#define FSL_ELCDIF_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))
 eLCDIF driver version
 

eLCDIF initialization and de-initialization

void ELCDIF_RgbModeInit (LCDIF_Type *base, const elcdif_rgb_mode_config_t *config)
 Initializes the eLCDIF to work in RGB mode (DOTCLK mode). More...
 
static uint32_t ELCDIF_GetStatus (LCDIF_Type *base)
 Gets the eLCDIF default configuration structure for RGB (DOTCLK) mode. More...
 
static uint32_t ELCDIF_GetLFifoCount (LCDIF_Type *base)
 Get current count in Latency buffer (LFIFO). More...
 

Interrupts

static void ELCDIF_EnableInterrupts (LCDIF_Type *base, uint32_t mask)
 Enables eLCDIF interrupt requests. More...
 
static void ELCDIF_DisableInterrupts (LCDIF_Type *base, uint32_t mask)
 Disables eLCDIF interrupt requests. More...
 
static uint32_t ELCDIF_GetInterruptStatus (LCDIF_Type *base)
 Get eLCDIF interrupt peding status. More...
 
static void ELCDIF_ClearInterruptStatus (LCDIF_Type *base, uint32_t mask)
 Clear eLCDIF interrupt peding status. More...
 

LUT

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...
 

Data Structure Documentation

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]

Data Fields

uint32_t regCtrl
 Value of register CTRL. More...
 
uint32_t regCtrl1
 Value of register CTRL1. More...
 

Field Documentation

uint32_t elcdif_pixel_format_reg_t::regCtrl
uint32_t elcdif_pixel_format_reg_t::regCtrl1
struct elcdif_rgb_mode_config_t

Data Fields

uint16_t panelWidth
 Display panel width, pixels per line. More...
 
uint16_t panelHeight
 Display panel height, how many lines per panel. More...
 
uint8_t hsw
 HSYNC pulse width. More...
 
uint8_t hfp
 Horizontal front porch. More...
 
uint8_t hbp
 Horizontal back porch. More...
 
uint8_t vsw
 VSYNC pulse width. More...
 
uint8_t vfp
 Vrtical front porch. More...
 
uint8_t vbp
 Vertical back porch. More...
 
uint32_t polarityFlags
 OR'ed value of _elcdif_polarity_flags, used to contol the signal polarity. More...
 
uint32_t bufferAddr
 Frame buffer address. More...
 
elcdif_pixel_format_t pixelFormat
 Pixel format. More...
 
elcdif_lcd_data_bus_t dataBus
 LCD data bus. More...
 

Field Documentation

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
elcdif_pixel_format_t elcdif_rgb_mode_config_t::pixelFormat
elcdif_lcd_data_bus_t elcdif_rgb_mode_config_t::dataBus
struct elcdif_as_buffer_config_t

Data Fields

uint32_t bufferAddr
 Buffer address. More...
 
elcdif_as_pixel_format_t pixelFormat
 Pixel format. More...
 

Field Documentation

uint32_t elcdif_as_buffer_config_t::bufferAddr
elcdif_as_pixel_format_t elcdif_as_buffer_config_t::pixelFormat
struct elcdif_as_blend_config_t

Data Fields

uint8_t alpha
 User defined alpha value, only used when alphaMode is kELCDIF_AlphaOverride or kELCDIF_AlphaRop. More...
 
bool invertAlpha
 Set true to invert the alpha. More...
 
elcdif_alpha_mode_t alphaMode
 Alpha mode. More...
 
elcdif_rop_mode_t ropMode
 ROP mode, only valid when alphaMode is kELCDIF_AlphaRop. More...
 

Field Documentation

uint8_t elcdif_as_blend_config_t::alpha
bool elcdif_as_blend_config_t::invertAlpha
elcdif_alpha_mode_t elcdif_as_blend_config_t::alphaMode
elcdif_rop_mode_t elcdif_as_blend_config_t::ropMode

Enumeration Type Documentation

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.

Function Documentation

void ELCDIF_RgbModeInit ( LCDIF_Type *  base,
const elcdif_rgb_mode_config_t config 
)

This function ungates the eLCDIF clock and configures the eLCDIF peripheral according to the configuration structure.

Parameters
baseeLCDIF peripheral base address.
configPointer to the configuration structure.
static uint32_t ELCDIF_GetStatus ( LCDIF_Type *  base)
inlinestatic

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->polarityFlags = kELCDIF_VsyncActiveLow |
config->bufferAddr = 0U;
config->pixelFormat = kELCDIF_PixelFormatRGB888;
config->dataBus = kELCDIF_DataBus24Bit;
@code
*
* @param config Pointer to the eLCDIF configuration structure.
*/
void ELCDIF_RgbModeGetDefaultConfig(elcdif_rgb_mode_config_t *config);
void ELCDIF_Deinit(LCDIF_Type *base);
/* @} */
void ELCDIF_RgbModeSetPixelFormat(LCDIF_Type *base, elcdif_pixel_format_t pixelFormat);
static inline void ELCDIF_RgbModeStart(LCDIF_Type *base)
{
base->CTRL_SET = LCDIF_CTRL_RUN_MASK | LCDIF_CTRL_DOTCLK_MODE_MASK;
}
void ELCDIF_RgbModeStop(LCDIF_Type *base);
static inline void ELCDIF_SetNextBufferAddr(LCDIF_Type *base, uint32_t bufferAddr)
{
base->NEXT_BUF = bufferAddr;
}
void ELCDIF_Reset(LCDIF_Type *base);
#if !(defined(FSL_FEATURE_LCDIF_HAS_NO_RESET_PIN) && FSL_FEATURE_LCDIF_HAS_NO_RESET_PIN)
static inline void ELCDIF_PullUpResetPin(LCDIF_Type *base, bool pullUp)
{
if (pullUp)
{
base->CTRL1_SET = LCDIF_CTRL1_RESET_MASK;
}
else
{
base->CTRL1_CLR = LCDIF_CTRL1_RESET_MASK;
}
}
#endif
static inline void ELCDIF_EnablePxpHandShake(LCDIF_Type *base, bool enable)
{
if (enable)
{
base->CTRL_SET = LCDIF_CTRL_ENABLE_PXP_HANDSHAKE_MASK;
}
else
{
base->CTRL_CLR = LCDIF_CTRL_ENABLE_PXP_HANDSHAKE_MASK;
}
}
/* @} */
static inline uint32_t ELCDIF_GetCrcValue(LCDIF_Type *base)
{
return base->CRC_STAT;
}
static inline uint32_t ELCDIF_GetBusMasterErrorAddr(LCDIF_Type *base)
{
return base->BM_ERROR_STAT;
}
Parameters
baseeLCDIF 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
baseeLCDIF peripheral base address.
Returns
The LFIFO current count
static void ELCDIF_EnableInterrupts ( LCDIF_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
baseeLCDIF peripheral base address.
maskinterrupt source, OR'ed value of _elcdif_interrupt_enable.
static void ELCDIF_DisableInterrupts ( LCDIF_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
baseeLCDIF peripheral base address.
maskinterrupt source, OR'ed value of _elcdif_interrupt_enable.
static uint32_t ELCDIF_GetInterruptStatus ( LCDIF_Type *  base)
inlinestatic
Parameters
baseeLCDIF 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
baseeLCDIF peripheral base address.
maskof the flags to clear, OR'ed value of _elcdif_interrupt_flags.
static void ELCDIF_EnableLut ( LCDIF_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseeLCDIF peripheral base address.
enableTrue 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
baseeLCDIF peripheral base address.
lutWhich LUT to load.
startIndexThe start index of the LUT entry to update.
lutDataThe LUT data to load.
countCount of lutData.
Return values
kStatus_SuccessInitialization success.
kStatus_InvalidArgumentWrong argument.