RZ/A Flexible Software Package Documentation  Release v3.0.0

 
LCD Controller (r_lcdc)

Functions

fsp_err_t R_LCDC_Open (display_ctrl_t *const p_api_ctrl, display_cfg_t const *const p_cfg)
 
fsp_err_t R_LCDC_Close (display_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_LCDC_Start (display_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_LCDC_Stop (display_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_LCDC_LayerChange (display_ctrl_t const *const p_api_ctrl, display_runtime_cfg_t const *const p_cfg, display_frame_layer_t layer)
 
fsp_err_t R_LCDC_BufferChange (display_ctrl_t const *const p_api_ctrl, uint8_t *const framebuffer, display_frame_layer_t layer)
 
fsp_err_t R_LCDC_ColorKeySet (display_ctrl_t const *const p_api_ctrl, display_colorkeying_layer_t ck_cfg, display_frame_layer_t layer)
 
fsp_err_t R_LCDC_StatusGet (display_ctrl_t const *const p_api_ctrl, display_status_t *const p_status)
 

Detailed Description

Driver for the LCDC peripheral on RZ MPUs. This module implements the Display Interface.

Overview

The LCDC is a multi-stage graphics output peripheral designed to automatically generate timing and data signals for LCD panels. As part of its internal pipeline the two internal graphics layers can be repositioned, alpha blended, and converted to from a wide variety of pixel formats.

Features

Feature Options
Input color formats RGB565, RGB888, BGR888, ARGB8888, RGBA8888, ABGR8888, YCbCr444(interleaved), YCbCr422(interleaved)-UYVY, YCbCr422(interleaved)-YUYV, YCbCr422(interleaved)-YVYU, YCbCr422(interleaved)-YYUV, YCbCr420(interleaved), YUV420(Planar)
Correction processes Alpha blending, positioning, dithering
Timing signals Vsync, Hsync, Vertical and horizontal data enable (DE)
Maximum resolution Up to 1280 x 800 pixels (dependent on sync signal width)
Interrupts Frame End, Underrun
Other functions Byte Swap configuration, Backgrand color setting, color space conversion

Configuration

Build Time Configurations for r_lcdc

The following build time configurations are defined in fsp_cfg/r_lcdc_cfg.h:

ConfigurationOptionsDefaultDescription
Parameter Checking
  • Default (BSP)
  • Enabled
  • Disabled
Default (BSP) If selected, code for parameter checking is included in the build.

Configurations for Graphics > Display Driver on r_lcdc

This module can be added to the Stacks tab via New Stack > Graphics > Display Driver on r_lcdc.

ConfigurationOptionsDefaultDescription
General > NameName must be a valid C symbolg_display0 Module name.
Interrupts > Callback FunctionName must be a valid C symbolNULL A user callback function can be defined here.
Interrupts > Frame End Interrupt PriorityValue must be an integer from 0 to 3124 Input the frame end interrupt priority.
Interrupts > Underrun Interrupt PriorityValue must be an integer from 0 to 3124 Input the frame end interrupt priority.
Input > Graphics Layer 1 > General > Enabled
  • Yes
  • No
Yes Specify Used if the graphics layer 1 is used. If so a framebuffer will be automatically generated based on the specified height and horizontal stride.
Input > Graphics Layer 1 > General > Horizontal sizeValue must be an integer from 1 to 12801280 Specify the number of horizontal pixels.
Input > Graphics Layer 1 > General > Vertical sizeValue must be an integer from 1 to 800720 Specify the number of vertical pixels.
Input > Graphics Layer 1 > General > Horizontal positionMust be a valid non-negative integer with a maximum configurable value of 12790 Specify the horizontal offset in pixels of the graphics layer from the background layer.
Input > Graphics Layer 1 > General > Vertical positionMust be a valid non-negative integer with a maximum configurable value of 7190 Specify the vertical offset in pixels of the graphics layer from the background layer.
Input > Graphics Layer 1 > General > Color formatRefer to the RZA Configuration tool for available options.YCbCr422 interleaved YUYV (16-bit) Specify the graphics layer Input format. If selecting CLUT formats, you must write the CLUT table data before starting output.
Input > Graphics Layer 1 > General > 64bit swap
  • Enabled
  • Disabled
Disabled Select Used if enable 64bits swap input data.
Input > Graphics Layer 1 > General > 32bit swap
  • Enabled
  • Disabled
Disabled Select Used if enable 32bits swap input data.
Input > Graphics Layer 1 > General > 16bit swap
  • Enabled
  • Disabled
Disabled Select Used if enable 16bits swap input data.
Input > Graphics Layer 1 > General > 8bit swap
  • Enabled
  • Disabled
Disabled Select Used if enable 8bits swap input data.
Input > Graphics Layer 1 > Framebuffer > Framebuffer nameThis property must be a valid C symbolfb_background Specify the name for the framebuffer for Layer 1.
Input > Graphics Layer 1 > Framebuffer > Number of buffersValue must be an integer from 0 to 81 Specify the number of buffers to create.When user select 0,the buffer set in user application can be used.
Input > Graphics Layer 1 > Framebuffer > Section for framebuffer allocationManual EntryUNCACHED_BSS Specify the section in which to allocate the framebuffer. When Arm Compiler 6 is used to place this memory in on-chip SRAM, the section name must be .bss or start with .bss. to avoid consuming unnecessary ROM space.
Input > Graphics Layer 2 > General > Enabled
  • Yes
  • No
Yes Specify Used if the graphics layer 2 is used. If so a framebuffer will be automatically generated based on the specified height and horizontal stride.
Input > Graphics Layer 2 > General > Horizontal sizeValue must be an integer from 1 to 12801280 Specify the number of horizontal pixels.
Input > Graphics Layer 2 > General > Vertical sizeValue must be an integer from 1 to 800800 Specify the number of vertical pixels.
Input > Graphics Layer 2 > General > Horizontal positionMust be a valid non-negative integer with a maximum configurable value of 12800 Specify the horizontal offset in pixels of the graphics layer from the background layer.
Input > Graphics Layer 2 > General > Vertical positionMust be a valid non-negative integer with a maximum configurable value of 8000 Specify the vertical offset in pixels of the graphics layer from the background layer.
Input > Graphics Layer 2 > General > Color formatRefer to the RZA Configuration tool for available options.ARGB8888 (24-bit) Specify the graphics layer Input format. If selecting CLUT formats, you must write the CLUT table data before starting output.
Input > Graphics Layer 2 > General > 64bit swap
  • Enabled
  • Disabled
Disabled Select Used if enable 64bits swap input data.
Input > Graphics Layer 2 > General > 32bit swap
  • Enabled
  • Disabled
Disabled Select Used if enable 32bits swap input data.
Input > Graphics Layer 2 > General > 16bit swap
  • Enabled
  • Disabled
Disabled Select Used if enable 16bits swap input data.
Input > Graphics Layer 2 > General > 8bit swap
  • Enabled
  • Disabled
Disabled Select Used if enable 8bits swap input data.
Input > Graphics Layer 2 > Framebuffer > Framebuffer nameThis property must be a valid C symbolfb_foreground Specify the name for the framebuffer for Layer 2.
Input > Graphics Layer 2 > Framebuffer > Number of buffersValue must be an integer from 0 to 81 Specify the number of buffers to create.When user select 0,the buffer set in user application can be used.
Input > Graphics Layer 2 > Framebuffer > Section for framebuffer allocationManual EntryUNCACHED_BSS Specify the section in which to allocate the framebuffer. When Arm Compiler 6 is used to place this memory in on-chip SRAM, the section name must be .bss or start with .bss. to avoid consuming unnecessary ROM space.
Output > Timing > Horizontal total cyclesValue must be an integer from 3 to 286681650 Specify the total cycles in a horizontal line. Set to the number of cycles defined in the data sheet of LCD panel sheet in your system
Output > Timing > Horizontal active video cyclesValue must be an integer from 0 to 81911280 Specify the number of active video cycles in a horizontal line (including front and back porch). Set to the number of cycles defined in the data sheet of LCD panel sheet in your system.
Output > Timing > Horizontal back porch cyclesValue must be an integer from 0 to 12286260 Specify the number of back porch cycles in a horizontal line. Back porch starts from the beginning of Hsync cycles, which means back porch cycles contain Hsync cycles. Set to the number of cycles defined in the data sheet of LCD panel sheet in your system.
Output > Timing > Horizontal sync signal cyclesValue must be an integer from 0 to 819140 Specify the number of Hsync signal assertion cycles. Set to the number of cycles defined in the data sheet of LCD panel sheet in your system.
Output > Timing > Horizontal sync signal polarity
  • Low active
  • High active
High active Select the polarity of Hsync signal to match your system.
Output > Timing > Vertical total linesValue must be an integer from 0 to 28668750 Specify number of total lines in a frame (including front and back porch).
Output > Timing > Vertical active video linesValue must be an integer from 0 to 8191720 Specify the number of active video lines in a frame.
Output > Timing > Vertical back porch linesValue must be an integer from 0 to 1228625 Specify the number of back porch lines in a frame. Back porch starts from the beginning of Vsync lines, which means back porch lines contain Vsync lines.
Output > Timing > Vertical sync signal linesValue must be an integer from 0 to 81915 Specify the Vsync signal assertion lines in a frame.
Output > Timing > Vertical sync signal polarity
  • Low active
  • High active
High active Select the polarity of Vsync signal to match to your system.
Output > Timing > Data Enable Signal Polarity
  • Low active
  • High active
High active Select the polarity of Data Enable signal to match to your system.
Output > Timing > Sync edge
  • Rising edge
  • Falling edge
Falling edge Select the polarity of Sync signals to match to your system.
Output > Background > RedValue must be an integer from 0 to 2550 Red component of the background color.
Output > Background > GreenValue must be an integer from 0 to 2550 Green component of the background color.
Output > Background > BlueValue must be an integer from 0 to 2550 Blue component of the background color.
Output > Dithering > Enabled
  • Yes
  • No
No Enable dithering to reduce the effect of color banding.
Color Keying > Graphics Layer 1 > Source Color > RedValue must be an integer from 0 to 2550 Red component of the soucre color for color keying.
Color Keying > Graphics Layer 1 > Source Color > GreenValue must be an integer from 0 to 2550 Green component of the soucre color for color keying.
Color Keying > Graphics Layer 1 > Source Color > BlueValue must be an integer from 0 to 2550 Blue component of the soucre color for color keying.
Color Keying > Graphics Layer 1 > Destination Color > AlphaValue must be an integer from 0 to 2550 Alpha component of the destination color for color keying.
Color Keying > Graphics Layer 1 > Destination Color > RedValue must be an integer from 0 to 2550 Red component of the soucre color for color keying.
Color Keying > Graphics Layer 1 > Destination Color > GreenValue must be an integer from 0 to 2550 Green component of the soucre color for color keying.
Color Keying > Graphics Layer 1 > Destination Color > BlueValue must be an integer from 0 to 2550 Blue component of the soucre color for color keying.
Color Keying > Graphics Layer 1 > Enable
  • Enabled
  • Disabled
Disabled Enable Color Keying.
Color Keying > Graphics Layer 2 > Source Color > RedValue must be an integer from 0 to 2550 Red component of the soucre color for color keying.
Color Keying > Graphics Layer 2 > Source Color > GreenValue must be an integer from 0 to 2550 Green component of the soucre color for color keying.
Color Keying > Graphics Layer 2 > Source Color > BlueValue must be an integer from 0 to 2550 Blue component of the soucre color for color keying.
Color Keying > Graphics Layer 2 > Destination Color > AlphaValue must be an integer from 0 to 2550 Alpha component of the destination color for color keying.
Color Keying > Graphics Layer 2 > Destination Color > RedValue must be an integer from 0 to 2550 Red component of the soucre color for color keying.
Color Keying > Graphics Layer 2 > Destination Color > GreenValue must be an integer from 0 to 2550 Green component of the soucre color for color keying.
Color Keying > Graphics Layer 2 > Destination Color > BlueValue must be an integer from 0 to 2550 Blue component of the soucre color for color keying.
Color Keying > Graphics Layer 2 > Enable
  • Enabled
  • Disabled
Disabled Enable Color Keying.

Examples

Basic Example

This is a basic example showing the minimum code required to initialize and start the LCDC module. If the entire display can be drawn within the vertical blanking period no further code may be necessary.

void basic_example (void)
{
fsp_err_t err;
// Open the LCDC driver
err = g_display_on_lcdc.open(&g_display_ctrl, &g_display_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
// Start display output
err = R_LCDC_Start(&g_display_ctrl);
assert(FSP_SUCCESS == err);
}

Example for YUV420 Planar

This is a example using the YUV420 Planar format. If you use this format, you should set 0 into Number of buffers and configure the base address for Y, Cr and Cr Plane.

void planar_example (void)
{
fsp_err_t err;
g_display_runtime_cfg_bg.input.p_base = (uint32_t *) &plane_y;
g_display_runtime_cfg_bg.input.p_base_cb = (uint32_t *) &plane_cb;
g_display_runtime_cfg_bg.input.p_base_cr = (uint32_t *) &plane_cr;
g_display_runtime_cfg_bg.input.hstride = DISPLAY_BUFFER_STRIDE_BYTES_INPUT0;
g_display_runtime_cfg_bg.input.hstride_cbcr = DISPLAY_BUFFER_STRIDE_UV_BYTES_INPUT0;
// Open the LCDC driver
err = g_display_on_lcdc.open(&g_display_ctrl, &g_display_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
// Start display output
err = g_display_on_lcdc.start(&g_display_ctrl);
assert(FSP_SUCCESS == err);
// Change configuration for layer1 to display YUV420 Planar format
err = g_display_on_lcdc.layerChange(&g_display_ctrl, &g_display_runtime_cfg_bg, DISPLAY_FRAME_LAYER_1);
assert(FSP_SUCCESS == err);
}

Data Structures

struct  lcdc_extended_cfg_t
 
struct  lcdc_instance_ctrl_t
 

Data Structure Documentation

◆ lcdc_extended_cfg_t

struct lcdc_extended_cfg_t

LCDC hardware specific configuration

Data Fields
uint8_t frame_end_ipl Frame end interrupt priority.
uint8_t underrun_ipl Under run interrupt priority.
IRQn_Type frame_end_irq Frame end interrupt vector.
IRQn_Type underrun_irq Under run interrupt vector.

◆ lcdc_instance_ctrl_t

struct lcdc_instance_ctrl_t

Display control block. DO NOT INITIALIZE.

Function Documentation

◆ R_LCDC_Open()

fsp_err_t R_LCDC_Open ( display_ctrl_t *const  p_api_ctrl,
display_cfg_t const *const  p_cfg 
)

 Initializes the LCDC modules and enables interrupts

Return values
FSP_SUCCESSInitializes the LCDC modules.
FSP_ERR_ALREADY_OPENLCDC module is open already.
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_INVALID_TIMING_SETTINGInvalid timing parameter.
FSP_ERR_INVALID_LAYER_SETTINGInvalid layer parameter.

◆ R_LCDC_Close()

fsp_err_t R_LCDC_Close ( display_ctrl_t *const  p_api_ctrl)

Close the display while the LCDC module is operating

Return values
FSP_SUCCESSClose the LCDC module
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_NOT_OPENLCDC module is not open

◆ R_LCDC_Start()

fsp_err_t R_LCDC_Start ( display_ctrl_t *const  p_api_ctrl)

Start displaying a layer image. It is possible when LCDC state is open

Return values
FSP_SUCCESSStart display Normally
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_NOT_OPENLCDC module is not open

◆ R_LCDC_Stop()

fsp_err_t R_LCDC_Stop ( display_ctrl_t *const  p_api_ctrl)

Start displaying a layer image. It is possible when LCDC state is displaying

Return values
FSP_SUCCESSStop the LCDC module
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_INVALID_MODELCDC module status is invalid for R_LCDC_Stop API

◆ R_LCDC_LayerChange()

fsp_err_t R_LCDC_LayerChange ( display_ctrl_t const *const  p_api_ctrl,
display_runtime_cfg_t const *const  p_cfg,
display_frame_layer_t  layer 
)

Change layer configurations. It is possible when LCDC state is displaying

Return values
FSP_SUCCESSThe LCDC layer is changed
FSP_ERR_INVALID_LAYER_SETTINGInvalid layer parameter
FSP_ERR_ASSERTIONPointer to the control block and configuration structure is NULL.
FSP_ERR_INVALID_MODELCDC module status is invalid for R_LCDC_LayerChange API

◆ R_LCDC_BufferChange()

fsp_err_t R_LCDC_BufferChange ( display_ctrl_t const *const  p_api_ctrl,
uint8_t *const  framebuffer,
display_frame_layer_t  layer 
)

Change Buffer configuration. It is possible when LCDC state is displaying

Return values
FSP_SUCCESSThe Buffer read by LCDC is changed
FSP_ERR_INVALID_LAYER_SETTINGInvalid layer parameter
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_INVALID_MODELCDC module status is invalid for R_LCDC_BufferChange API

◆ R_LCDC_ColorKeySet()

fsp_err_t R_LCDC_ColorKeySet ( display_ctrl_t const *const  p_api_ctrl,
display_colorkeying_layer_t  ck_cfg,
display_frame_layer_t  layer 
)

Set the Color Keying Configuration. It is possible when LCDC state is displaying.

Return values
FSP_SUCCESSThe source color is changed to destination color
FSP_ERR_INVALID_LAYER_SETTINGInvalid layer parameter
FSP_ERR_ASSERTIONPointer to the control block is NULL.
FSP_ERR_INVALID_MODELCDC module status is invalid for R_LCDC_ColorKeying API

◆ R_LCDC_StatusGet()

fsp_err_t R_LCDC_StatusGet ( display_ctrl_t const *const  p_api_ctrl,
display_status_t *const  p_status 
)

Get the current status of LCDC module. (close or open or displaying)

Return values
FSP_SUCCESSGet status of LCDC module
FSP_ERR_ASSERTIONPointer to the control block and status structure is NULL.