Skip to content

Commit e9133d5

Browse files
committed
[bsp][renesas]fix ra6m3 can't use lcd problem.
1 parent eb6591d commit e9133d5

File tree

4 files changed

+59
-45
lines changed

4 files changed

+59
-45
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2006-2024, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2024-03-01 Rbb666 the first version
9+
*/
10+
#ifndef __LCD_CONFIG_H_
11+
#define __LCD_CONFIG_H_
12+
13+
typedef enum
14+
{
15+
ROTATION_ZERO = 0,
16+
ROTATION_090 = 90,
17+
ROTATION_180 = 180,
18+
ROTATION_270 = 270,
19+
} bsp_rotation;
20+
21+
#define LCD_WIDTH DISPLAY_HSIZE_INPUT0
22+
#define LCD_HEIGHT DISPLAY_VSIZE_INPUT0
23+
#define LCD_BITS_PER_PIXEL DISPLAY_BITS_PER_PIXEL_INPUT1
24+
#define LCD_PIXEL_FORMAT RTGRAPHIC_PIXEL_FORMAT_RGB565
25+
#define LCD_BUF_SIZE (LCD_WIDTH * LCD_HEIGHT * LCD_BITS_PER_PIXEL / 8)
26+
27+
#define ENABLE_DOUBLE_BUFFER (0)
28+
29+
#define LCD_BL_PIN BSP_IO_PORT_01_PIN_00
30+
31+
#endif

bsp/renesas/libraries/HAL_Drivers/drv_lcd.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#ifdef BSP_USING_LCD
1515
#ifdef SOC_SERIES_R7FA8M85
1616
#include <ra8/lcd_config.h>
17+
#else
18+
#include <ra6m3/lcd_config.h>
1719
#endif
1820
#include <drv_lcd.h>
1921

@@ -38,16 +40,16 @@ static uint16_t *lcd_current_working_buffer = (uint16_t *) &fb_background[0];
3840

3941
#ifdef SOC_SERIES_R7FA8M85
4042
static uint8_t lcd_framebuffer[LCD_BUF_SIZE] BSP_ALIGN_VARIABLE(64) BSP_PLACE_IN_SECTION(".sdram");
41-
#else
42-
static uint8_t lcd_framebuffer[LCD_BUF_SIZE] BSP_ALIGN_VARIABLE(64);
4343
#endif
4444

4545
// G2D
4646
extern d2_device *d2_handle0;
4747
static d2_device **_d2_handle_user = &d2_handle0;
4848
static d2_renderbuffer *renderbuffer;
4949

50+
#ifdef SOC_SERIES_R7FA8M85
5051
extern void ra8_mipi_lcd_init(void);
52+
#endif
5153

5254
rt_weak void DisplayVsyncCallback(display_callback_args_t *p_args)
5355
{
@@ -260,6 +262,7 @@ static rt_err_t ra_lcd_control(rt_device_t device, int cmd, void *args)
260262
{
261263
case RTGRAPHIC_CTRL_RECT_UPDATE:
262264
{
265+
#ifdef SOC_SERIES_R7FA8M85
263266
struct rt_device_rect_info *info = (struct rt_device_rect_info *)args;
264267
#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
265268
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)lcd->lcd_info.framebuffer, sizeof(fb_background[0]));
@@ -276,6 +279,7 @@ static rt_err_t ra_lcd_control(rt_device_t device, int cmd, void *args)
276279
fsp_err_t err = R_GLCDC_BufferChange(&g_display0_ctrl, (uint8_t *) lcd_current_working_buffer, DISPLAY_FRAME_LAYER_1);
277280
RT_ASSERT(err == 0);
278281
#endif
282+
#endif /* SOC_SERIES_R7FA8M85 */
279283
/* wait for vsync interrupt */
280284
vsync_wait();
281285
}
@@ -316,11 +320,13 @@ static rt_err_t drv_lcd_init(struct rt_device *device)
316320

317321
static void reset_lcd_panel(void)
318322
{
323+
#ifdef LCD_RST_PIN
319324
rt_pin_mode(LCD_RST_PIN, PIN_MODE_OUTPUT);
320325
rt_pin_write(LCD_RST_PIN, PIN_LOW);
321326
rt_thread_mdelay(100);
322327
rt_pin_write(LCD_RST_PIN, PIN_HIGH);
323328
rt_thread_mdelay(100);
329+
#endif
324330
}
325331

326332
static rt_err_t ra_bsp_lcd_init(void)
@@ -334,13 +340,14 @@ static rt_err_t ra_bsp_lcd_init(void)
334340
error = R_GLCDC_Open(&g_display0_ctrl, &g_display0_cfg);
335341
if (FSP_SUCCESS == error)
336342
{
343+
#ifdef SOC_SERIES_R7FA8M85
337344
/* config mipi */
338345
ra8_mipi_lcd_init();
339-
346+
#endif
340347
/* Initialize g2d */
341348
error = g2d_drv_hwInit();
342349

343-
/** Display driver start */
350+
/* Display driver start */
344351
error = R_GLCDC_Start(&g_display0_ctrl);
345352
}
346353

@@ -359,13 +366,11 @@ int rt_hw_lcd_init(void)
359366
_lcd.lcd_info.width = LCD_WIDTH;
360367
_lcd.lcd_info.bits_per_pixel = LCD_BITS_PER_PIXEL;
361368
_lcd.lcd_info.pixel_format = LCD_PIXEL_FORMAT;
362-
369+
#ifdef SOC_SERIES_R7FA8M85
363370
_lcd.lcd_info.framebuffer = (uint8_t *)lcd_framebuffer;
364-
if (_lcd.lcd_info.framebuffer == NULL)
365-
{
366-
LOG_E("alloc lcd framebuffer fail");
367-
return -RT_ERROR;
368-
}
371+
#else
372+
_lcd.lcd_info.framebuffer = (uint8_t *)&fb_background[0];
373+
#endif
369374
LOG_D("\nlcd framebuffer address:%#x", _lcd.lcd_info.framebuffer);
370375
memset(_lcd.lcd_info.framebuffer, 0x0, LCD_BUF_SIZE);
371376

bsp/renesas/ra6m3-hmi-board/board/ports/lcd_port.h

Lines changed: 0 additions & 34 deletions
This file was deleted.

bsp/renesas/ra6m3-hmi-board/configuration.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@
540540
</module>
541541
<module id="module.driver.display_on_glcdc.467730287">
542542
<property id="module.driver.display.name" value="g_display0"/>
543-
<property id="module.driver.display.callback" value="_ra_port_display_callback"/>
543+
<property id="module.driver.display.callback" value="DisplayVsyncCallback"/>
544544
<property id="module.driver.display.line_detect_ipl" value="board.icu.common.irq.priority12"/>
545545
<property id="module.driver.display.underflow_1_ipl" value="_disabled"/>
546546
<property id="module.driver.display.underflow_2_ipl" value="_disabled"/>
@@ -952,6 +952,9 @@
952952
<configSetting altId="glcdc0.lcd_data13.p301" configurationId="glcdc0.lcd_data13"/>
953953
<configSetting altId="glcdc0.lcd_data14.p302" configurationId="glcdc0.lcd_data14"/>
954954
<configSetting altId="glcdc0.lcd_data15.p303" configurationId="glcdc0.lcd_data15"/>
955+
<configSetting altId="glcdc0.lcd_tcon0.p102" configurationId="glcdc0.lcd_tcon0"/>
956+
<configSetting altId="glcdc0.lcd_tcon1.p103" configurationId="glcdc0.lcd_tcon1"/>
957+
<configSetting altId="glcdc0.lcd_tcon2.p104" configurationId="glcdc0.lcd_tcon2"/>
955958
<configSetting altId="glcdc0.mode.rgb565.free" configurationId="glcdc0.mode"/>
956959
<configSetting altId="gpt0.gtioca.p512" configurationId="gpt0.gtioca"/>
957960
<configSetting altId="gpt0.mode.gtiocaorgtiocb.free" configurationId="gpt0.mode"/>
@@ -983,6 +986,15 @@
983986
<configSetting altId="p101.glcdc0.lcd_clk" configurationId="p101"/>
984987
<configSetting altId="p101.gpio_speed.gpio_speed_high" configurationId="p101.gpio_drivecapacity"/>
985988
<configSetting altId="p101.gpio_mode.gpio_mode_peripheral" configurationId="p101.gpio_mode"/>
989+
<configSetting altId="p102.glcdc0.lcd_tcon0" configurationId="p102"/>
990+
<configSetting altId="p102.gpio_speed.gpio_speed_high" configurationId="p102.gpio_drivecapacity"/>
991+
<configSetting altId="p102.gpio_mode.gpio_mode_peripheral" configurationId="p102.gpio_mode"/>
992+
<configSetting altId="p103.glcdc0.lcd_tcon1" configurationId="p103"/>
993+
<configSetting altId="p103.gpio_speed.gpio_speed_high" configurationId="p103.gpio_drivecapacity"/>
994+
<configSetting altId="p103.gpio_mode.gpio_mode_peripheral" configurationId="p103.gpio_mode"/>
995+
<configSetting altId="p104.glcdc0.lcd_tcon2" configurationId="p104"/>
996+
<configSetting altId="p104.gpio_speed.gpio_speed_high" configurationId="p104.gpio_drivecapacity"/>
997+
<configSetting altId="p104.gpio_mode.gpio_mode_peripheral" configurationId="p104.gpio_mode"/>
986998
<configSetting altId="p106.glcdc0.lcd_data00" configurationId="p106"/>
987999
<configSetting altId="p106.gpio_speed.gpio_speed_high" configurationId="p106.gpio_drivecapacity"/>
9881000
<configSetting altId="p106.gpio_mode.gpio_mode_peripheral" configurationId="p106.gpio_mode"/>

0 commit comments

Comments
 (0)