Skip to content

Commit c0947d4

Browse files
committed
1. Add 4.3 inch lcd(480x272) support for mini2440
2. Add choice menu for lcd configure 3. Remove origin sdcard driver and add new mmc driver that use kernel mmc stack for s3c2440
1 parent 5c399d5 commit c0947d4

File tree

18 files changed

+704
-732
lines changed

18 files changed

+704
-732
lines changed

bsp/mini2440/.config

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,13 @@ CONFIG_RT_USING_PIN=y
161161
# CONFIG_RT_USING_MTD_NAND is not set
162162
# CONFIG_RT_USING_PM is not set
163163
# CONFIG_RT_USING_RTC is not set
164-
# CONFIG_RT_USING_SDIO is not set
164+
CONFIG_RT_USING_SDIO=y
165+
CONFIG_RT_SDIO_STACK_SIZE=512
166+
CONFIG_RT_SDIO_THREAD_PRIORITY=15
167+
CONFIG_RT_MMCSD_STACK_SIZE=1024
168+
CONFIG_RT_MMCSD_THREAD_PREORITY=22
169+
CONFIG_RT_MMCSD_MAX_PARTITION=16
170+
# CONFIG_RT_SDIO_DEBUG is not set
165171
# CONFIG_RT_USING_SPI is not set
166172
# CONFIG_RT_USING_WDT is not set
167173
# CONFIG_RT_USING_AUDIO is not set

bsp/mini2440/Kconfig

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,33 @@ config PKGS_DIR
1616
default "packages"
1717

1818
config BOARD_MINI2440
19-
bool "mini2440"
19+
bool
2020
select ARCH_ARM_ARM9
2121
select RT_USING_COMPONENTS_INIT
2222
select RT_USING_USER_MAIN
2323
default y
2424

25+
choice
26+
prompt "Lcd for mini2440"
27+
default RT_MINI2440_LCD_T35
28+
depends on PKG_USING_GUIENGINE
29+
30+
config RT_MINI2440_LCD_A70
31+
bool "A70"
32+
33+
config RT_MINI2440_LCD_T43
34+
bool "T43"
35+
36+
config RT_MINI2440_LCD_N35
37+
bool "N35"
38+
39+
config RT_MINI2440_LCD_T35
40+
bool "T35"
41+
42+
config RT_MINI2440_LCD_X35
43+
bool "X35"
44+
endchoice
45+
2546
source "$RTT_DIR/Kconfig"
2647
source "$PKGS_DIR/Kconfig"
2748

bsp/mini2440/applications/main.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,24 @@
55

66
#include "led.h"
77

8+
#ifdef PKG_USING_GUIENGINE
9+
#include <rtgui/driver.h>
10+
#endif
11+
812
int main(void)
913
{
10-
printf("hello rt-thread\n");
14+
rt_device_t device;
15+
16+
printf("hello rt-thread\n");
17+
18+
#ifdef PKG_USING_GUIENGINE
19+
device = rt_device_find("lcd");
20+
if (device)
21+
{
22+
rtgui_graphic_set_device(device);
23+
}
24+
#endif
25+
1126

1227
while (1)
1328
{

bsp/mini2440/applications/mnt.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,28 @@
66

77
int mnt_init(void)
88
{
9-
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
9+
rt_uint32_t tryCnt = 5;
10+
rt_device_t dev;
11+
12+
while(tryCnt--)
1013
{
11-
rt_kprintf("File System initialized!\n");
14+
dev = rt_device_find("sd0");
15+
if(dev != RT_NULL)
16+
{
17+
break;
18+
}
19+
rt_thread_mdelay(500);
20+
}
21+
22+
if(dfs_mount("sd0", "/", "elm", 0, 0) == 0)
23+
{
24+
rt_kprintf("File System initialized!\n");
1225
}
1326
else
1427
{
1528
rt_kprintf("File System initialzation failed!\n");
1629
}
17-
30+
1831
return RT_EOK;
1932
}
2033
INIT_ENV_EXPORT(mnt_init);

bsp/mini2440/drivers/SConscript

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@ cwd = os.path.join(str(Dir('#')), 'drivers')
88
src = Split("""
99
board.c
1010
led.c
11+
key.c
1112
uart.c
1213
""")
1314

14-
if GetDepend('RT_USING_DFS'):
15-
src += ['sdcard.c']
16-
1715
if GetDepend('RT_USING_LWIP'):
1816
src += ['dm9000.c']
1917

20-
if GetDepend('PKG_USING_GUIENGINE'):
21-
src += ['touch.c', 'key.c']
18+
if GetDepend('RT_MINI2440_LCD_A70'):
19+
src += ['lcd_a70.c']
20+
if GetDepend('RT_MINI2440_LCD_T43'):
21+
src += ['lcd_t43.c']
22+
if GetDepend('RT_MINI2440_LCD_N35'):
23+
src += ['lcd_n35.c']
24+
if GetDepend('RT_MINI2440_LCD_T35'):
25+
src += ['lcd_t35.c']
26+
if GetDepend('RT_MINI2440_LCD_X35'):
27+
src += ['lcd_x35.c']
2228

23-
if GetDepend('RT_USING_RTI'):
24-
src += ['rti_stub.c']
25-
2629
if GetDepend('PKG_USING_GUIENGINE'):
27-
if rtconfig.RT_USING_LCD_TYPE == 'PNL_A70':
28-
src += ['lcd_a70.c']
29-
elif rtconfig.RT_USING_LCD_TYPE == 'PNL_N35':
30-
src += ['lcd_n35.c']
31-
elif rtconfig.RT_USING_LCD_TYPE == 'PNL_T35':
32-
src += ['lcd_t35.c']
33-
elif rtconfig.RT_USING_LCD_TYPE == 'PNL_X35':
34-
src += ['lcd_x35.c']
30+
src += ['touch.c']
31+
32+
if GetDepend('RT_USING_SDIO'):
33+
src += ['s3cmci.c']
34+
3535

3636
CPPPATH = [cwd]
3737

bsp/mini2440/drivers/lcd.h

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

bsp/mini2440/drivers/lcd_a70.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <rtthread.h>
1616
#include <s3c24x0.h>
1717

18-
#include "lcd.h"
1918

2019
/* LCD driver for A7' */
2120
#define LCD_WIDTH 800
@@ -223,10 +222,11 @@ static rt_err_t rt_lcd_control (rt_device_t dev, int cmd, void *args)
223222
return RT_EOK;
224223
}
225224

226-
void rt_hw_lcd_init(void)
225+
int rt_hw_lcd_init(void)
227226
{
228227
rt_device_t lcd = rt_malloc(sizeof(struct rt_device));
229-
if (lcd == RT_NULL) return; /* no memory yet */
228+
if (lcd == RT_NULL)
229+
return -RT_ERROR; /* no memory yet */
230230

231231
_lcd_info.bits_per_pixel = 16;
232232
_lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P;
@@ -246,3 +246,4 @@ void rt_hw_lcd_init(void)
246246
rt_device_register(lcd, "lcd", RT_DEVICE_FLAG_RDWR);
247247
}
248248

249+
INIT_BOARD_EXPORT(rt_hw_lcd_init);

bsp/mini2440/drivers/lcd_n35.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <rtthread.h>
1616
#include <s3c24x0.h>
1717

18-
#include "lcd.h"
1918

2019
/* LCD driver for N3'5 */
2120
#define LCD_WIDTH 240
@@ -224,10 +223,11 @@ static rt_err_t rt_lcd_control (rt_device_t dev, int cmd, void *args)
224223
return RT_EOK;
225224
}
226225

227-
void rt_hw_lcd_init(void)
226+
int rt_hw_lcd_init(void)
228227
{
229228
rt_device_t lcd = rt_malloc(sizeof(struct rt_device));
230-
if (lcd == RT_NULL) return; /* no memory yet */
229+
if (lcd == RT_NULL)
230+
return -RT_ERROR; /* no memory yet */
231231

232232
_lcd_info.bits_per_pixel = 16;
233233
_lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P;
@@ -247,3 +247,4 @@ void rt_hw_lcd_init(void)
247247
rt_device_register(lcd, "lcd", RT_DEVICE_FLAG_RDWR);
248248
}
249249

250+
INIT_BOARD_EXPORT(rt_hw_lcd_init);

bsp/mini2440/drivers/lcd_t35.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <rtthread.h>
1616

1717
#include <s3c24x0.h>
18-
#include "lcd.h"
1918

2019
/* LCD driver for T3'5 */
2120
#define LCD_WIDTH 240
@@ -225,10 +224,11 @@ static rt_err_t rt_lcd_control (rt_device_t dev, int cmd, void *args)
225224
return RT_EOK;
226225
}
227226

228-
void rt_hw_lcd_init(void)
227+
int rt_hw_lcd_init(void)
229228
{
230229
rt_device_t lcd = rt_malloc(sizeof(struct rt_device));
231-
if (lcd == RT_NULL) return; /* no memory yet */
230+
if (lcd == RT_NULL)
231+
return -RT_ERROR; /* no memory yet */
232232

233233
_lcd_info.bits_per_pixel = 16;
234234
_lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P;
@@ -248,3 +248,4 @@ void rt_hw_lcd_init(void)
248248
rt_device_register(lcd, "lcd", RT_DEVICE_FLAG_RDWR);
249249
}
250250

251+
INIT_BOARD_EXPORT(rt_hw_lcd_init);

0 commit comments

Comments
 (0)