Improve renesas LCD driver.

This commit is contained in:
Rbb666 2024-04-12 14:09:31 +08:00 committed by Meco Man
parent 5d64ea1ed6
commit 86f1a0d2b2
6 changed files with 345 additions and 179 deletions

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-03-01 Rbb666 the first version
*/
#ifndef __LCD_CONFIG_H_
#define __LCD_CONFIG_H_
typedef enum
{
ROTATION_ZERO = 0,
ROTATION_090 = 90,
ROTATION_180 = 180,
ROTATION_270 = 270,
} bsp_rotation;
#define LCD_WIDTH DISPLAY_HSIZE_INPUT0
#define LCD_HEIGHT DISPLAY_VSIZE_INPUT0
#define LCD_BITS_PER_PIXEL DISPLAY_BITS_PER_PIXEL_INPUT1
#define LCD_PIXEL_FORMAT RTGRAPHIC_PIXEL_FORMAT_RGB565
#define LCD_BUF_SIZE (LCD_WIDTH * LCD_HEIGHT * LCD_BITS_PER_PIXEL / 8)
#define LCD_NUM_FRAMEBUFFERS (2)
#define ENABLE_DOUBLE_BUFFER (1)
#define LCD_BL_PIN BSP_IO_PORT_10_PIN_11
#define LCD_RST_PIN BSP_IO_PORT_11_PIN_04
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@ -9,114 +9,87 @@
*/
#include <rtthread.h>
#include <rtdevice.h>
#if (defined(BSP_USING_LCD)) || (defined(SOC_SERIES_R7FA6M3))
#ifdef BSP_USING_LCD
#ifdef SOC_SERIES_R7FA8M85
#include <ra8/lcd_config.h>
#endif
#include <drv_lcd.h>
#include <lcd_port.h>
#include "r_display_api.h"
#include "hal_data.h"
//#define DRV_DEBUG
//#define LOG_TAG "drv.lcd"
//#include <drv_log.h>
#define DRV_DEBUG
#define LOG_TAG "drv_lcd"
#include <drv_log.h>
struct drv_lcd_device
{
struct rt_device parent;
struct rt_device_graphic_info lcd_info;
void *framebuffer;
};
struct drv_lcd_device _lcd;
static uint16_t screen_rotation;
static struct rt_completion sync_completion;
uint16_t screen_rotation;
uint16_t *lcd_current_working_buffer = (uint16_t *) &fb_background[0];
static uint16_t *gp_single_buffer = NULL;
static uint16_t *gp_double_buffer = NULL;
static uint16_t *lcd_current_working_buffer = (uint16_t *) &fb_background[0];
// jpeg and lvgl can only select one
__WEAK void _ra_port_display_callback(display_callback_args_t *p_args)
#ifdef SOC_SERIES_R7FA8M85
static uint8_t lcd_framebuffer[LCD_BUF_SIZE] BSP_ALIGN_VARIABLE(64) BSP_PLACE_IN_SECTION(".sdram");
#else
static uint8_t lcd_framebuffer[LCD_BUF_SIZE] BSP_ALIGN_VARIABLE(64);
#endif
// G2D
extern d2_device *d2_handle0;
static d2_device **_d2_handle_user = &d2_handle0;
static d2_renderbuffer *renderbuffer;
extern void ra8_mipi_lcd_init(void);
rt_weak void DisplayVsyncCallback(display_callback_args_t *p_args)
{
rt_interrupt_enter();
if (DISPLAY_EVENT_LINE_DETECTION == p_args->event)
{
rt_completion_done(&sync_completion);
}
rt_interrupt_leave();
}
void turn_on_lcd_backlight(void)
// Wait until Vsync is triggered through callback function
static void vsync_wait(void)
{
#ifdef BSP_USING_PWM5
#define LCD_PWM_DEV_NAME "pwm5"
#define LCD_PWM_DEV_CHANNEL 0
rt_completion_wait(&sync_completion, RT_WAITING_FOREVER);
}
static void turn_on_lcd_backlight(void)
{
#ifdef BSP_USING_LCD_PWM_BACKLIGHT
struct rt_device_pwm *pwm_dev;
/* turn on the LCD backlight */
pwm_dev = (struct rt_device_pwm *)rt_device_find(LCD_PWM_DEV_NAME);
/* pwm frequency:100K = 10000ns */
rt_pwm_set(pwm_dev, LCD_PWM_DEV_CHANNEL, 10000, 7000);
rt_pwm_enable(pwm_dev, LCD_PWM_DEV_CHANNEL);
#endif
rt_pwm_set(pwm_dev, 0, 10000, 7000);
rt_pwm_enable(pwm_dev, 0);
#else
rt_pin_mode(LCD_BL_PIN, PIN_MODE_OUTPUT); /* LCD_BL */
rt_pin_write(LCD_BL_PIN, PIN_HIGH);
#endif
}
void ra_bsp_lcd_init(void)
static void ra_bsp_lcd_clear(uint16_t color)
{
fsp_err_t error;
// Set screen rotation to default view
screen_rotation = ROTATION_ZERO;
/** Display driver open */
error = R_GLCDC_Open(&g_display0_ctrl, &g_display0_cfg);
if (FSP_SUCCESS == error)
{
/** Display driver start */
error = R_GLCDC_Start(&g_display0_ctrl);
}
}
void ra_bsp_lcd_set_display_buffer(uint8_t index)
{
R_GLCDC_BufferChange(&g_display0_ctrl, fb_background[index - 1], DISPLAY_FRAME_LAYER_1);
}
void ra_bsp_lcd_set_working_buffer(uint8_t index)
{
if (index >= 1 && index <= 2)
{
lcd_current_working_buffer = (uint16_t *)fb_background[index - 1];
}
}
void ra_bsp_lcd_enable_double_buffer(void)
{
ra_bsp_lcd_set_display_buffer(1);
ra_bsp_lcd_set_working_buffer(2);
}
void ra_bsp_lcd_clear(uint16_t color)
{
for (uint32_t i = 0; i < (LCD_WIDTH * LCD_HEIGHT); i++)
for (uint32_t i = 0; i < LCD_BUF_SIZE; i++)
{
lcd_current_working_buffer[i] = color;
}
}
void ra_bsp_lcd_swap_buffer(void)
{
if (lcd_current_working_buffer == (uint16_t *)fb_background[0])
{
ra_bsp_lcd_set_display_buffer(1);
ra_bsp_lcd_set_working_buffer(2);
}
else
{
ra_bsp_lcd_set_display_buffer(2);
ra_bsp_lcd_set_working_buffer(1);
}
}
void bsp_lcd_draw_pixel(uint32_t x, uint32_t y, uint16_t color)
void lcd_draw_pixel(uint32_t x, uint32_t y, uint16_t color)
{
// Verify pixel is within LCD range
if ((x <= LCD_WIDTH) && (y <= LCD_HEIGHT))
@ -142,7 +115,7 @@ void bsp_lcd_draw_pixel(uint32_t x, uint32_t y, uint16_t color)
}
else
{
rt_kprintf("draw pixel outof range:%d,%d\n", x, y);
LOG_D("draw pixel outof range:%d,%d", x, y);
}
}
@ -157,17 +130,124 @@ void lcd_fill_array(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t
{
for (x_offset = 0; x_start + x_offset <= x_end; x_offset++)
{
bsp_lcd_draw_pixel(x_start + x_offset, cycle_y, *pixel++);
lcd_draw_pixel(x_start + x_offset, cycle_y, *pixel++);
}
cycle_y++;
}
}
static rt_err_t ra_lcd_init(rt_device_t device)
d2_device *d2_handle_obj_get(void)
{
RT_ASSERT(device != RT_NULL);
return *_d2_handle_user;
}
ra_bsp_lcd_init();
d2_renderbuffer *d2_renderbuffer_get(void)
{
return renderbuffer;
}
void lcd_draw_jpg(int32_t x, int32_t y, const void *p, int32_t xSize, int32_t ySize)
{
uint32_t ModeSrc;
ModeSrc = d2_mode_rgb565;
// Generate render operations
d2_framebuffer(d2_handle_obj_get(), (uint16_t *)&fb_background[0], LCD_WIDTH, LCD_WIDTH, LCD_HEIGHT, ModeSrc);
d2_selectrenderbuffer(d2_handle_obj_get(), d2_renderbuffer_get());
d2_cliprect(d2_handle_obj_get(), 0, 0, LCD_WIDTH, LCD_HEIGHT);
d2_setblitsrc(d2_handle_obj_get(), (void *) p, xSize, xSize, ySize, ModeSrc);
d2_blitcopy(d2_handle_obj_get(), xSize, ySize, 0, 0, (d2_width)(LCD_WIDTH << 4), (d2_width)(LCD_HEIGHT << 4),
(d2_point)(x << 4), (d2_point)(y << 4), 0);
// Execute render operations
d2_executerenderbuffer(d2_handle_obj_get(), d2_renderbuffer_get(), 0);
// In single-buffered mode always wait for DRW to finish before returning
d2_flushframe(d2_handle_obj_get());
}
void lcd_gpu_fill_array(size_t x1, size_t y1, size_t x2, size_t y2, uint16_t *color_data)
{
uint32_t ModeSrc;
int32_t width;
int32_t heigh;
width = (x2 - x1) + 1;
heigh = (y2 - y1) + 1;
ModeSrc = d2_mode_rgb565;
// Generate render operations
d2_framebuffer(d2_handle_obj_get(), (uint16_t *)&fb_background[0], LCD_WIDTH, LCD_WIDTH, LCD_HEIGHT, ModeSrc);
d2_selectrenderbuffer(d2_handle_obj_get(), d2_renderbuffer_get());
d2_cliprect(d2_handle_obj_get(), 0, 0, LCD_WIDTH, LCD_HEIGHT);
d2_setblitsrc(d2_handle_obj_get(), (void *) color_data, width, width, heigh, ModeSrc);
d2_blitcopy(d2_handle_obj_get(), width, heigh, 0, 0, (d2_width)(LCD_WIDTH << 4), (d2_width)(LCD_HEIGHT << 4),
(d2_point)(x1 << 4), (d2_point)(y1 << 4), 0);
// Execute render operations
d2_executerenderbuffer(d2_handle_obj_get(), d2_renderbuffer_get(), 0);
// In single-buffered mode always wait for DRW to finish before returning
d2_flushframe(d2_handle_obj_get());
}
void g2d_display_write_area(const void *pSrc, void *pDst, int WidthSrc, int HeightSrc, int x, int y)
{
uint32_t ModeSrc;
ModeSrc = d2_mode_rgb565;
/* Set the new buffer to the current draw buffer */
d2_framebuffer(d2_handle_obj_get(), (uint16_t *)pDst, LCD_WIDTH, LCD_WIDTH, LCD_HEIGHT, ModeSrc);
d2_selectrenderbuffer(d2_handle_obj_get(), d2_renderbuffer_get());
d2_cliprect(d2_handle_obj_get(), 0, 0, LCD_WIDTH, LCD_HEIGHT);
d2_setblitsrc(d2_handle_obj_get(), (void *) pSrc, WidthSrc, WidthSrc, HeightSrc, ModeSrc);
d2_blitcopy(d2_handle_obj_get(), WidthSrc, HeightSrc, 0, 0, (d2_width)(WidthSrc << 4), (d2_width)(HeightSrc << 4),
(d2_point)(x << 4), (d2_point)(y << 4), 0);
/* End the current display list */
d2_executerenderbuffer(d2_handle_obj_get(), d2_renderbuffer_get(), 0);
d2_flushframe(d2_handle_obj_get());
}
static int g2d_drv_hwInit(void)
{
d2_s32 d2_err;
uint32_t ModeSrc;
ModeSrc = d2_mode_rgb565;
// Initialize D/AVE 2D driver
*_d2_handle_user = d2_opendevice(0);
d2_err = d2_inithw(*_d2_handle_user, 0);
if (d2_err != D2_OK)
{
LOG_E("g2d init fail");
d2_closedevice(*_d2_handle_user);
return -RT_ERROR;
}
// Clear both buffers
d2_framebuffer(*_d2_handle_user, (uint16_t *)&fb_background[0], LCD_WIDTH, LCD_WIDTH,
LCD_HEIGHT, ModeSrc);
d2_clear(*_d2_handle_user, 0x000000);
// Set various D2 parameters
d2_setblendmode(*_d2_handle_user, d2_bm_alpha, d2_bm_one_minus_alpha);
d2_setalphamode(*_d2_handle_user, d2_am_constant);
d2_setalpha(*_d2_handle_user, UINT8_MAX);
d2_setantialiasing(*_d2_handle_user, 1);
d2_setlinecap(*_d2_handle_user, d2_lc_butt);
d2_setlinejoin(*_d2_handle_user, d2_lj_miter);
renderbuffer = d2_newrenderbuffer(*_d2_handle_user, 20, 20);
if (!renderbuffer)
{
LOG_E("no renderbuffer");
d2_closedevice(*_d2_handle_user);
return -RT_ERROR;
}
return RT_EOK;
}
@ -181,14 +261,28 @@ static rt_err_t ra_lcd_control(rt_device_t device, int cmd, void *args)
case RTGRAPHIC_CTRL_RECT_UPDATE:
{
struct rt_device_rect_info *info = (struct rt_device_rect_info *)args;
#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)lcd->lcd_info.framebuffer, sizeof(fb_background[0]));
#endif
#if defined(ENABLE_DOUBLE_BUFFER) && ENABLE_DOUBLE_BUFFER
/* Swap the active framebuffer */
lcd_current_working_buffer = (lcd_current_working_buffer == gp_single_buffer) ? gp_double_buffer : gp_single_buffer;
#endif
(void)info; /* nothing, right now */
rt_kprintf("update screen...\n");
g2d_display_write_area((uint8_t *)lcd->lcd_info.framebuffer, lcd_current_working_buffer,
info->width, info->height, info->x, info->y);
#if defined(ENABLE_DOUBLE_BUFFER) && ENABLE_DOUBLE_BUFFER
/* Now that the framebuffer is ready, update the GLCDC buffer pointer on the next Vsync */
fsp_err_t err = R_GLCDC_BufferChange(&g_display0_ctrl, (uint8_t *) lcd_current_working_buffer, DISPLAY_FRAME_LAYER_1);
RT_ASSERT(err == 0);
#endif
/* wait for vsync interrupt */
vsync_wait();
}
break;
case RTGRAPHIC_CTRL_POWERON:
rt_pin_write(LCD_BL_PIN, PIN_HIGH);
turn_on_lcd_backlight();
break;
case RTGRAPHIC_CTRL_POWEROFF:
@ -215,9 +309,46 @@ static rt_err_t ra_lcd_control(rt_device_t device, int cmd, void *args)
return RT_EOK;
}
static rt_err_t drv_lcd_init(struct rt_device *device)
{
return RT_EOK;
}
static void reset_lcd_panel(void)
{
rt_pin_mode(LCD_RST_PIN, PIN_MODE_OUTPUT);
rt_pin_write(LCD_RST_PIN, PIN_LOW);
rt_thread_mdelay(100);
rt_pin_write(LCD_RST_PIN, PIN_HIGH);
rt_thread_mdelay(100);
}
static rt_err_t ra_bsp_lcd_init(void)
{
fsp_err_t error;
/* Set screen rotation to default view */
screen_rotation = ROTATION_ZERO;
/* Display driver open */
error = R_GLCDC_Open(&g_display0_ctrl, &g_display0_cfg);
if (FSP_SUCCESS == error)
{
/* config mipi */
ra8_mipi_lcd_init();
/* Initialize g2d */
error = g2d_drv_hwInit();
/** Display driver start */
error = R_GLCDC_Start(&g_display0_ctrl);
}
return error;
}
int rt_hw_lcd_init(void)
{
rt_err_t result = RT_EOK;
struct rt_device *device = &_lcd.parent;
/* memset _lcd to zero */
@ -229,39 +360,68 @@ int rt_hw_lcd_init(void)
_lcd.lcd_info.bits_per_pixel = LCD_BITS_PER_PIXEL;
_lcd.lcd_info.pixel_format = LCD_PIXEL_FORMAT;
_lcd.lcd_info.framebuffer = (uint8_t *)&fb_background[0];
_lcd.lcd_info.framebuffer = (uint8_t *)lcd_framebuffer;
if (_lcd.lcd_info.framebuffer == NULL)
{
LOG_E("alloc lcd framebuffer fail");
return -RT_ERROR;
}
LOG_D("\nlcd framebuffer address:%#x", _lcd.lcd_info.framebuffer);
memset(_lcd.lcd_info.framebuffer, 0x0, LCD_BUF_SIZE);
device->type = RT_Device_Class_Graphic;
#ifdef RT_USING_DEVICE_OPS
device->ops = &lcd_ops;
#else
device->init = ra_lcd_init;
device->init = drv_lcd_init;
device->control = ra_lcd_control;
#endif
/* register lcd device */
rt_device_register(device, "lcd", RT_DEVICE_FLAG_RDWR);
rt_completion_init(&sync_completion);
/* Initialize buffer pointers */
gp_single_buffer = (uint16_t *) g_display0_cfg.input[0].p_base;
/* Double buffer for drawing color bands with good quality */
gp_double_buffer = gp_single_buffer + LCD_BUF_SIZE;
reset_lcd_panel();
ra_bsp_lcd_init();
/* turn on lcd backlight */
turn_on_lcd_backlight();
// Initialize lcd controller
ra_lcd_init(device);
ra_bsp_lcd_set_display_buffer(1);
ra_bsp_lcd_clear(0x0);
screen_rotation = ROTATION_ZERO;
return result;
return RT_EOK;
}
INIT_DEVICE_EXPORT(rt_hw_lcd_init);
int lcd_test()
#ifdef SOC_SERIES_R7FA8M85
rt_weak void ra8_mipi_lcd_init(void)
{
LOG_E("please Implementation function %s", __func__);
}
#endif
int lcd_test(void)
{
struct drv_lcd_device *lcd;
struct rt_device_rect_info rect_info;
rect_info.x = 0;
rect_info.y = 0;
rect_info.width = LCD_WIDTH;
rect_info.height = LCD_HEIGHT;
lcd = (struct drv_lcd_device *)rt_device_find("lcd");
while (1)
for (int i = 0; i < 2; i++)
{
/* red */
for (int i = 0; i < LCD_BUF_SIZE / 2; i++)
@ -269,7 +429,8 @@ int lcd_test()
lcd->lcd_info.framebuffer[2 * i] = 0x00;
lcd->lcd_info.framebuffer[2 * i + 1] = 0xF8;
}
lcd->parent.control(&lcd->parent, RTGRAPHIC_CTRL_RECT_UPDATE, RT_NULL);
LOG_D("red buffer...");
lcd->parent.control(&lcd->parent, RTGRAPHIC_CTRL_RECT_UPDATE, &rect_info);
rt_thread_mdelay(1000);
/* green */
for (int i = 0; i < LCD_BUF_SIZE / 2; i++)
@ -277,7 +438,8 @@ int lcd_test()
lcd->lcd_info.framebuffer[2 * i] = 0xE0;
lcd->lcd_info.framebuffer[2 * i + 1] = 0x07;
}
lcd->parent.control(&lcd->parent, RTGRAPHIC_CTRL_RECT_UPDATE, RT_NULL);
LOG_D("green buffer...");
lcd->parent.control(&lcd->parent, RTGRAPHIC_CTRL_RECT_UPDATE, &rect_info);
rt_thread_mdelay(1000);
/* blue */
for (int i = 0; i < LCD_BUF_SIZE / 2; i++)
@ -285,10 +447,12 @@ int lcd_test()
lcd->lcd_info.framebuffer[2 * i] = 0x1F;
lcd->lcd_info.framebuffer[2 * i + 1] = 0x00;
}
lcd->parent.control(&lcd->parent, RTGRAPHIC_CTRL_RECT_UPDATE, RT_NULL);
LOG_D("blue buffer...");
lcd->parent.control(&lcd->parent, RTGRAPHIC_CTRL_RECT_UPDATE, &rect_info);
rt_thread_mdelay(1000);
}
return RT_EOK;
}
MSH_CMD_EXPORT(lcd_test, lcd_test);
MSH_CMD_EXPORT(lcd_test, lcd test cmd);
#endif /* BSP_USING_LCD */

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-02-28 Rbb666 first commit
*/
#ifndef __DRV_LCD_H_
#define __DRV_LCD_H_
void lcd_draw_pixel(uint32_t x, uint32_t y, uint16_t color);
void lcd_draw_jpg(int32_t x, int32_t y, const void *p, int32_t xSize, int32_t ySize);
void lcd_gpu_fill_array(size_t x1, size_t y1, size_t x2, size_t y2, uint16_t *color_data);
#endif

View File

@ -9,43 +9,16 @@ menu "Hardware Drivers Config"
menu "Onboard Peripheral Drivers"
menuconfig BSP_USING_FS
bool "Enable filesystem"
default n
if BSP_USING_FS
config BSP_USING_ONCHIP_FS
bool "Enable ONCHIP filesystem"
select RT_USING_FAL
select RT_USING_DFS_ELMFAT
select RT_USING_MTD_NOR
select BSP_USING_ONCHIP_FLASH
default n
config BSP_USING_SDCARD_FS
bool "Enable SDCARD filesystem"
select BSP_USING_SDHI
select BSP_USING_SDHI1
select RT_USING_DFS_ELMFAT
default n
config BSP_USING_SPICARD_FS
bool "Enable SPI FLASH filesystem"
select BSP_USING_SCI_SPI
select BSP_USING_SCI_SPI2
select RT_USING_SPI_MSD
select RT_USING_DFS_ELMFAT
default n
endif
menuconfig BSP_USING_LVGL
bool "Enable LVGL for LCD"
select PKG_USING_LVGL
default n
if BSP_USING_LVGL
if BSP_USING_LVGL
config BSP_USING_LCD_RGB
bool "Enable LVGL for LCD_RGB565"
select BSP_USING_LCD
default n
endif
endmenu
menu "On-chip Peripheral Drivers"
@ -566,6 +539,12 @@ menu "Hardware Drivers Config"
default n
select RT_USING_PWM
if BSP_USING_PWM
config BSP_USING_PWM3
bool "Enable GPT3 (16-Bits) output PWM"
default n
config BSP_USING_PWM6
bool "Enable GPT6 (16-Bits) output PWM"
default n
config BSP_USING_PWM12
bool "Enable GPT12 (16-Bits) output PWM"
default n
@ -581,6 +560,23 @@ menu "Hardware Drivers Config"
default n
endif
menuconfig BSP_USING_SDRAM
bool "Enable SDRAM"
if BSP_USING_SDRAM
config BSP_USING_SDRAM_SIZE
hex "(HEX)SDRAM SIZE"
default 0x8000000
endif
config BSP_USING_ETH
bool "Enable Ethernet"
select RT_USING_SAL
select RT_USING_LWIP
select RT_USING_NETDEV
default n
endmenu
menu "Board extended module Drivers"
menuconfig BSP_USING_LCD
bool "Enable LCD"
default n
@ -592,32 +588,18 @@ menu "Hardware Drivers Config"
config BSP_USING_MIPI_LCD
bool "Enable MIPI LCD"
default n
menuconfig BSP_USING_LCD_PWM_BACKLIGHT
bool "Use pwm to drive lcd backlight"
default n
select BSP_USING_PWM
select BSP_USING_PWM3
if BSP_USING_LCD_PWM_BACKLIGHT
config LCD_PWM_DEV_NAME
string "lcd backlight pwm name"
default "pwm3"
endif
endif
menuconfig BSP_USING_SDRAM
bool "Enable SDRAM"
if BSP_USING_SDRAM
config BSP_USING_SDRAM_SIZE
hex "(HEX)SDRAM SIZE"
default 0x8000000
endif
config BSP_USING_G2D
bool "Enable G2D"
default n
config BSP_USING_JPEG
bool "Enable JPEG"
default n
config BSP_USING_ETH
bool "Enable Ethernet"
select RT_USING_SAL
select RT_USING_LWIP
select RT_USING_NETDEV
default n
endmenu
menu "Board extended module Drivers"
menuconfig BSP_USING_RW007
bool "Enable RW007"
default n

View File

@ -7,12 +7,7 @@ list = os.listdir(cwd)
CPPPATH = [cwd]
src = Glob('*.c')
if GetDepend(['BSP_USING_FS']):
src += Glob('ports/mnt.c')
CPPDEFINES = ['BSP_CFG_RTOS = 2']
objs = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
objs = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):

View File

@ -12,10 +12,6 @@
#include "hal_data.h"
#include <rtdevice.h>
#define DRV_DEBUG
#define LOG_TAG "main"
#include <drv_log.h>
#define LED_PIN BSP_IO_PORT_06_PIN_00 /* Onboard LED pins */
void hal_entry(void)
@ -30,24 +26,3 @@ void hal_entry(void)
rt_thread_mdelay(500);
}
}
#ifdef BSP_USING_SDRAM
#ifdef RT_USING_MEMHEAP_AS_HEAP
struct rt_memheap system_heap;
#endif
#include "ra/board/ra8d1_ek/board_sdram.h"
static int SDRAM_Init(void)
{
bsp_sdram_init();
LOG_D("sdram init success, mapped at 0x%X, size is %d bytes, data width is %d", 0x68000000, BSP_USING_SDRAM_SIZE, 16);
#ifdef RT_USING_MEMHEAP_AS_HEAP
/* If RT_USING_MEMHEAP_AS_HEAP is enabled, SDRAM is initialized to the heap */
rt_memheap_init(&system_heap, "sdram", (void *)0x68000000, BSP_USING_SDRAM_SIZE);
#endif
return RT_EOK;
}
INIT_BOARD_EXPORT(SDRAM_Init);
#endif