Skip to content

Commit 6d2a7d0

Browse files
committed
Update drivers.
1. Improve LVGL avg FPS. 2. Sync configuration to 4.1.0.
1 parent 5e24acf commit 6d2a7d0

File tree

21 files changed

+761
-279
lines changed

21 files changed

+761
-279
lines changed

bsp/nuvoton/libraries/m2354/StdDriver/src/nu_crypto.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
#include <stdio.h>
1111
#include <string.h>
12+
#ifdef __has_include
13+
#if __has_include("strings.h")
14+
#include <strings.h>
15+
#endif
16+
#endif
1217
#include "NuMicro.h"
1318

1419
#define ENABLE_DEBUG 0

bsp/nuvoton/libraries/n9h30/Driver/Include/nu_spi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extern "C"
4040
#define TX2 0x18 /*!< Transfer Register 2 Address */
4141
#define TX3 0x1C /*!< Transfer Register 3 Address */
4242

43-
#define SPI_INPUT_CLOCK 75000000 /* Unit: Hz */
43+
#define SPI_INPUT_CLOCK (sysGetClock(SYS_PCLK)*1000000) /* Unit: Hz */
4444
/// @endcond HIDDEN_SYMBOLS
4545

4646
#define SPI_NUMBER 2 /*!< 2 spi interfaces */

bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,18 +480,30 @@ config SOC_SERIES_N9H30
480480
config VPOST_USING_LCD_IDX
481481
int
482482
default 0 if LCM_USING_E50A2V1
483-
484483
default 2 if LCM_USING_LSA40AT9001
485484
default 3 if LCM_USING_FW070TFT
486485
default 4 if LCM_USING_FW043TFT
487486

488-
config LCM_USING_BPP
487+
config BSP_LCD_BPP
489488
int
490-
default 2 if LCM_USING_E50A2V1
489+
default 16 if LCM_USING_E50A2V1
490+
default 16 if LCM_USING_LSA40AT9001
491+
default 32 if LCM_USING_FW070TFT
492+
default 32 if LCM_USING_FW043TFT
491493

492-
default 2 if LCM_USING_LSA40AT9001
493-
default 4 if LCM_USING_FW070TFT
494-
default 4 if LCM_USING_FW043TFT
494+
config BSP_LCD_WIDTH
495+
int
496+
default 800 if LCM_USING_E50A2V1
497+
default 800 if LCM_USING_LSA40AT9001
498+
default 800 if LCM_USING_FW070TFT
499+
default 480 if LCM_USING_FW043TFT
500+
501+
config BSP_LCD_HEIGHT
502+
int
503+
default 480 if LCM_USING_E50A2V1
504+
default 600 if LCM_USING_LSA40AT9001
505+
default 480 if LCM_USING_FW070TFT
506+
default 272 if LCM_USING_FW043TFT
495507

496508
config BSP_USING_VPOST_OSD
497509
bool "Enable VPOST OSD layer"

bsp/nuvoton/libraries/n9h30/rtt_port/drv_common.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,40 @@ RT_WEAK void rt_hw_board_init(void)
7676
rt_kprintf("Heap: Begin@%08x, END@%08x, SIZE:%d\n", BOARD_HEAP_START, BOARD_HEAP_END, (rt_uint32_t)BOARD_HEAP_END - (rt_uint32_t)BOARD_HEAP_START);
7777
#endif
7878
}
79+
80+
81+
void devmem(int argc, char *argv[])
82+
{
83+
volatile unsigned int u32Addr;
84+
unsigned int value = 0, mode = 0;
85+
86+
if (argc < 2 || argc > 3)
87+
{
88+
goto exit_devmem;
89+
}
90+
91+
if (argc == 3)
92+
{
93+
if (sscanf(argv[2], "0x%x", &value) != 1)
94+
goto exit_devmem;
95+
mode = 1; //Write
96+
}
97+
98+
if (sscanf(argv[1], "0x%x", &u32Addr) != 1)
99+
goto exit_devmem;
100+
else if (!u32Addr || u32Addr & (4 - 1))
101+
goto exit_devmem;
102+
103+
if (mode)
104+
{
105+
*((volatile uint32_t *)u32Addr) = value;
106+
}
107+
rt_kprintf("0x%08x\n", *((volatile uint32_t *)u32Addr));
108+
109+
return;
110+
exit_devmem:
111+
rt_kprintf("Read: devmem <physical address in hex>\n");
112+
rt_kprintf("Write: devmem <physical address in hex> <value in hex format>\n");
113+
return;
114+
}
115+
MSH_CMD_EXPORT(devmem, dump device registers);

bsp/nuvoton/libraries/n9h30/rtt_port/drv_ge2d.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -629,11 +629,10 @@ static struct nu_ge2d g_sNuGe2d =
629629
}
630630

631631
#define NU_GE2D_COND_WAIT() { \
632-
if( (inpw(REG_GE2D_INTSTS) & 0x01) == 0 ) \
633-
{ \
634-
rt_thread_mdelay(1); \
635-
rt_completion_wait(&g_sNuGe2d.signal, 100); \
636-
} \
632+
if( (inpw(REG_GE2D_INTSTS) & 0x01) == 0 ) \
633+
{ \
634+
rt_completion_wait(&g_sNuGe2d.signal, 60); \
635+
} \
637636
}
638637

639638
#define NU_GE2D_SIGNAL() { \
@@ -3179,7 +3178,7 @@ void ge2dInitMonoPattern(int opt, int fore_color, int back_color)
31793178
* @param[in] back_color is color of background
31803179
* @return none
31813180
*/
3182-
void ge2dInitMonoInputPattern(UINT32 PatternA, UINT32 PatternB, int fore_color, int back_color)
3181+
void ge2dInitMonoInputPattern(uint32_t PatternA, uint32_t PatternB, int fore_color, int back_color)
31833182
{
31843183
UINT32 color32;
31853184

bsp/nuvoton/libraries/n9h30/rtt_port/drv_qspi.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ static rt_err_t nu_qspi_bus_configure(struct rt_spi_device *device,
154154

155155
/* Set speed */
156156
u32SPISpeed = configuration->max_hz;
157-
if (u32SPISpeed > DEF_SPI_MAX_SPEED)
157+
158+
/* Limitation: SPI clock must be lower than 37.5MHz. */
159+
if ((SPI_INPUT_CLOCK / 2) > 37500000)
160+
u32SPISpeed = SPI_INPUT_CLOCK / 4;
161+
else if (u32SPISpeed > DEF_SPI_MAX_SPEED)
158162
u32SPISpeed = DEF_SPI_MAX_SPEED;
159163

160164
u32SPISpeed = spiIoctl(qspi_bus->idx, SPI_IOC_SET_SPEED, u32SPISpeed, 0);

bsp/nuvoton/libraries/n9h30/rtt_port/drv_vpost.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ struct nu_vpost
4141
IRQn_Type irqn;
4242
E_SYS_IPRST rstidx;
4343
E_SYS_IPCLK clkidx;
44+
uint32_t last_commit;
4445
struct rt_device_graphic_info info;
4546
};
4647
typedef struct nu_vpost *nu_vpost_t;
4748

4849
static volatile uint32_t g_u32VSyncBlank = 0;
49-
static volatile uint32_t g_u32VSyncLastCommit = 0;
5050
static struct rt_completion vsync_wq;
5151

5252
static struct nu_vpost nu_fbdev[eVpost_Cnt] =
@@ -87,7 +87,7 @@ static rt_err_t vpost_layer_open(rt_device_t dev, rt_uint16_t oflag)
8787
/* Set scale to 1:1 */
8888
vpostOSDScalingCtrl(1, 0, 0);
8989

90-
#if (LCM_USING_BPP==4)
90+
#if (BSP_LCD_BPP==32)
9191
vpostOSDSetColMask(0xff, 0xff, 0xff);
9292
#else
9393
vpostOSDSetColMask(0x1f, 0x3f, 0x1f);
@@ -163,7 +163,7 @@ static rt_err_t vpost_layer_control(rt_device_t dev, int cmd, void *args)
163163
{
164164
uint8_t *pu8BufPtr = (uint8_t *)args;
165165

166-
g_u32VSyncLastCommit = g_u32VSyncBlank;
166+
psVpost->last_commit = g_u32VSyncBlank;
167167

168168
/* Pan display */
169169
switch (psVpost->layer)
@@ -191,9 +191,9 @@ static rt_err_t vpost_layer_control(rt_device_t dev, int cmd, void *args)
191191
case RTGRAPHIC_CTRL_WAIT_VSYNC:
192192
{
193193
if (args != RT_NULL)
194-
g_u32VSyncLastCommit = g_u32VSyncBlank + 1;
194+
psVpost->last_commit = g_u32VSyncBlank + 1;
195195

196-
if (g_u32VSyncLastCommit >= g_u32VSyncBlank)
196+
if (psVpost->last_commit >= g_u32VSyncBlank)
197197
{
198198
rt_completion_init(&vsync_wq);
199199
rt_completion_wait(&vsync_wq, RT_TICK_PER_SECOND / 60);
@@ -287,9 +287,9 @@ int rt_hw_vpost_init(void)
287287
rt_memset((void *)&psVpost->info, 0, sizeof(struct rt_device_graphic_info));
288288

289289
/* Register VPOST information */
290-
psVpost->info.bits_per_pixel = LCM_USING_BPP * 8;
291-
psVpost->info.pixel_format = (LCM_USING_BPP == 4) ? RTGRAPHIC_PIXEL_FORMAT_ARGB888 : RTGRAPHIC_PIXEL_FORMAT_RGB565;
292-
psVpost->info.pitch = psVpostLcmInst->u32DevWidth * LCM_USING_BPP;
290+
psVpost->info.bits_per_pixel = BSP_LCD_BPP;
291+
psVpost->info.pixel_format = (BSP_LCD_BPP == 32) ? RTGRAPHIC_PIXEL_FORMAT_ARGB888 : RTGRAPHIC_PIXEL_FORMAT_RGB565;
292+
psVpost->info.pitch = psVpostLcmInst->u32DevWidth * (BSP_LCD_BPP / 8);
293293
psVpost->info.width = psVpostLcmInst->u32DevWidth;
294294
psVpost->info.height = psVpostLcmInst->u32DevHeight;
295295

@@ -298,7 +298,7 @@ int rt_hw_vpost_init(void)
298298
/* Note: before get pointer of frame buffer, must set display color depth first */
299299
if (psVpost->layer == eVpost_LCD)
300300
{
301-
#if (LCM_USING_BPP==4)
301+
#if (BSP_LCD_BPP==32)
302302
vpostSetVASrc(VA_SRC_RGB888);
303303
#else
304304
vpostSetVASrc(VA_SRC_RGB565);
@@ -310,7 +310,7 @@ int rt_hw_vpost_init(void)
310310
{
311311
vpostOSDSetWindow(0, 0, psVpost->info.width, psVpost->info.height);
312312

313-
#if (LCM_USING_BPP==4)
313+
#if (BSP_LCD_BPP==32)
314314
vpostSetOSDSrc(OSD_SRC_RGB888);
315315
#else
316316
vpostSetOSDSrc(OSD_SRC_RGB565);

bsp/nuvoton/libraries/nuc980/rtt_port/drv_emac.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct nu_emac_lwip_pbuf
5757
struct pbuf_custom p; // lwip pbuf
5858
EMAC_FRAME_T *psPktFrameDataBuf; // gmac descriptor
5959
EMAC_MEMMGR_T *psMemMgr;
60-
EMAC_DESCRIPTOR_T * rx_desc;
60+
EMAC_DESCRIPTOR_T *rx_desc;
6161
const struct memp_desc *memp_rx_pool;
6262
};
6363
typedef struct nu_emac_lwip_pbuf *nu_emac_lwip_pbuf_t;
@@ -107,11 +107,11 @@ static void nu_emac_rx_isr(int vector, void *param);
107107

108108
/* Private variables ------------------------------------------------------------*/
109109
#if defined(BSP_USING_EMAC0)
110-
LWIP_MEMPOOL_DECLARE(emac0_rx, EMAC_RX_DESC_SIZE, sizeof(struct nu_emac_lwip_pbuf), "EMAC0 RX PBUF pool");
110+
LWIP_MEMPOOL_DECLARE(emac0_rx, EMAC_RX_DESC_SIZE, sizeof(struct nu_emac_lwip_pbuf), "EMAC0 RX PBUF pool");
111111
#endif
112112

113113
#if defined(BSP_USING_EMAC1)
114-
LWIP_MEMPOOL_DECLARE(emac1_rx, EMAC_RX_DESC_SIZE, sizeof(struct nu_emac_lwip_pbuf), "EMAC1 RX PBUF pool");
114+
LWIP_MEMPOOL_DECLARE(emac1_rx, EMAC_RX_DESC_SIZE, sizeof(struct nu_emac_lwip_pbuf), "EMAC1 RX PBUF pool");
115115
#endif
116116

117117
static struct nu_emac nu_emac_arr[] =
@@ -479,7 +479,7 @@ static struct pbuf *nu_emac_rx(rt_device_t dev)
479479
/* Check available data. */
480480
if ((avaialbe_size = EMAC_GetAvailRXBufSize(&psNuEmac->memmgr, &pu8DataBuf)) > 0)
481481
{
482-
EMAC_DESCRIPTOR_T * cur_rx = EMAC_RecvPktDoneWoRxTrigger(&psNuEmac->memmgr);
482+
EMAC_DESCRIPTOR_T *cur_rx = EMAC_RecvPktDoneWoRxTrigger(&psNuEmac->memmgr);
483483
nu_emac_lwip_pbuf_t my_pbuf = (nu_emac_lwip_pbuf_t)memp_malloc_pool(psNuEmac->memp_rx_pool);
484484
if (my_pbuf != RT_NULL)
485485
{
@@ -495,11 +495,11 @@ static struct pbuf *nu_emac_rx(rt_device_t dev)
495495
#endif
496496
//rt_kprintf("%08x, %08x, %d\n", my_pbuf, cur_rx, avaialbe_size);
497497
p = pbuf_alloced_custom(PBUF_RAW,
498-
avaialbe_size,
499-
PBUF_REF,
500-
&my_pbuf->p,
501-
pu8DataBuf,
502-
EMAC_MAX_PKT_SIZE);
498+
avaialbe_size,
499+
PBUF_REF,
500+
&my_pbuf->p,
501+
pu8DataBuf,
502+
EMAC_MAX_PKT_SIZE);
503503
if (p == RT_NULL)
504504
{
505505
rt_kprintf("%s : failed to alloted %08x\n", __func__, p);

0 commit comments

Comments
 (0)