[target][[stm32f746g-disco] allocate the LCD framebuffer out of the novm arena

This commit is contained in:
Travis Geiselbrecht
2015-10-20 16:20:33 -07:00
parent 9ef65bb98b
commit 8fa97e8552
2 changed files with 14 additions and 6 deletions

View File

@@ -26,6 +26,7 @@
#include <trace.h>
#include <target.h>
#include <compiler.h>
#include <reg.h>
#include <dev/gpio.h>
#include <platform/stm32.h>
#include <platform/sdram.h>
@@ -34,13 +35,13 @@
#include <platform/qspi.h>
#include <target/debugconfig.h>
#include <target/gpioconfig.h>
#include <reg.h>
#include <kernel/novm.h>
#if WITH_LIB_MINIP
#include <lib/minip.h>
#endif
extern uint8_t BSP_LCD_Init(uint32_t fb_address);
extern uint8_t BSP_LCD_Init(void);
const sdram_config_t target_sdram_config = {
.bus_width = SDRAM_BUS_WIDTH_16,
@@ -61,8 +62,8 @@ void target_early_init(void)
/* now that the uart gpios are configured, enable the debug uart */
stm32_debug_early_init();
/* The lcd framebuffer starts at the base of SDRAM */
BSP_LCD_Init(SDRAM_BASE);
/* start the lcd */
BSP_LCD_Init();
}
static uint8_t* gen_mac_address(void)

View File

@@ -57,6 +57,7 @@
#include <lib/gfx.h>
#include <dev/gpio.h>
#include <dev/display.h>
#include <kernel/novm.h>
#include <platform/stm32.h>
/*
@@ -345,7 +346,7 @@ static void BSP_LCD_ClockConfig(LTDC_HandleTypeDef *hltdc, void *Params)
* @brief Initializes the LCD.
* @retval LCD state
*/
uint8_t BSP_LCD_Init(uint32_t fb_address)
uint8_t BSP_LCD_Init(void)
{
/* Timing Configuration */
ltdc_handle.Init.HorizontalSync = (RK043FN48H_HSYNC - 1);
@@ -382,7 +383,13 @@ uint8_t BSP_LCD_Init(uint32_t fb_address)
HAL_LTDC_Init(&ltdc_handle);
BSP_LCD_LayerDefaultInit(0, fb_address);
/* allocate the framebuffer */
size_t fb_size_pages = PAGE_ALIGN(RK043FN48H_WIDTH * RK043FN48H_HEIGHT * 4) / PAGE_SIZE;
void *fb_address = novm_alloc_pages(fb_size_pages, NOVM_ARENA_SECONDARY);
if (!fb_address)
panic("failed to allocate framebuffer for LCD\n");
BSP_LCD_LayerDefaultInit(0, (uint32_t)fb_address);
BSP_LCD_SelectLayer(0);
/* clear framebuffer */