mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
update mini2440 bsp
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1239 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
1 parent
50bd74d3cb
commit
7c83c7da56
7 files changed
+738
-475
No files matched your search
@@ -105,6 +105,9 @@ void rt_init_thread_entry(void* parameter)
|
||||
/* init touch panel */
|
||||
rtgui_touch_hw_init();
|
||||
|
||||
/* init keypad */
|
||||
rt_hw_key_init();
|
||||
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
@@ -143,6 +146,9 @@ void rt_init_thread_entry(void* parameter)
|
||||
/* init touch panel */
|
||||
rtgui_touch_hw_init();
|
||||
|
||||
/* init keypad */
|
||||
rt_hw_key_init();
|
||||
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
|
||||
+51
-15
@@ -29,16 +29,12 @@
|
||||
extern rt_uint32_t PCLK, FCLK, HCLK, UCLK;
|
||||
|
||||
extern void rt_hw_clock_init(void);
|
||||
extern void rt_hw_lcd_init(void);
|
||||
extern void rt_hw_mmu_init(void);
|
||||
extern void rt_hw_touch_init(void);
|
||||
extern void rt_hw_key_init(void);
|
||||
|
||||
extern void rt_hw_get_clock(void);
|
||||
extern void rt_hw_set_dividor(rt_uint8_t hdivn, rt_uint8_t pdivn);
|
||||
extern void rt_hw_set_clock(rt_uint8_t sdiv, rt_uint8_t pdiv, rt_uint8_t mdiv);
|
||||
|
||||
|
||||
#define UART0 ((struct uartport *)&U0BASE)
|
||||
struct serial_int_rx uart0_int_rx;
|
||||
struct serial_device uart0 =
|
||||
@@ -49,10 +45,20 @@ struct serial_device uart0 =
|
||||
};
|
||||
struct rt_device uart0_device;
|
||||
|
||||
#define UART2 ((struct uartport *)&U2BASE)
|
||||
struct serial_int_rx uart2_int_rx;
|
||||
struct serial_device uart2 =
|
||||
{
|
||||
UART2,
|
||||
&uart2_int_rx,
|
||||
RT_NULL
|
||||
};
|
||||
struct rt_device uart2_device;
|
||||
|
||||
/**
|
||||
* This function will handle rtos timer
|
||||
*/
|
||||
void rt_timer_handler(int vector)
|
||||
static void rt_timer_handler(int vector)
|
||||
{
|
||||
rt_tick_increase();
|
||||
}
|
||||
@@ -60,7 +66,7 @@ void rt_timer_handler(int vector)
|
||||
/**
|
||||
* This function will handle serial
|
||||
*/
|
||||
void rt_serial_handler(int vector)
|
||||
static void rt_serial0_handler(int vector)
|
||||
{
|
||||
INTSUBMSK |= (BIT_SUB_RXD0);
|
||||
|
||||
@@ -72,10 +78,25 @@ void rt_serial_handler(int vector)
|
||||
INTSUBMSK &=~(BIT_SUB_RXD0);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will handle serial
|
||||
*/
|
||||
static void rt_serial2_handler(int vector)
|
||||
{
|
||||
INTSUBMSK |= (BIT_SUB_RXD2);
|
||||
|
||||
rt_hw_serial_isr(&uart2_device);
|
||||
|
||||
SUBSRCPND |= BIT_SUB_RXD2;
|
||||
|
||||
/* Unmask sub interrupt (RXD0) */
|
||||
INTSUBMSK &=~(BIT_SUB_RXD2);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will handle init uart
|
||||
*/
|
||||
void rt_hw_uart_init(void)
|
||||
static void rt_hw_uart_init(void)
|
||||
{
|
||||
int i;
|
||||
/* UART0 port configure */
|
||||
@@ -99,19 +120,39 @@ void rt_hw_uart_init(void)
|
||||
/* output PCLK to UART0/1, PWMTIMER */
|
||||
CLKCON |= 0x0D00;
|
||||
|
||||
/* FIFO enable, Tx/Rx FIFO clear */
|
||||
uart2.uart_device->ufcon = 0x0;
|
||||
/* disable the flow control */
|
||||
uart2.uart_device->umcon = 0x0;
|
||||
/* Normal,No parity,1 stop,8 bit */
|
||||
uart2.uart_device->ulcon = 0x3;
|
||||
/*
|
||||
* tx=level,rx=edge,disable timeout int.,enable rx error int.,
|
||||
* normal,interrupt or polling
|
||||
*/
|
||||
uart2.uart_device->ucon = 0x245;
|
||||
/* Set uart0 bps */
|
||||
uart2.uart_device->ubrd = (rt_int32_t)(PCLK / (BPS * 16)) - 1;
|
||||
|
||||
for (i = 0; i < 100; i++);
|
||||
|
||||
/* install uart isr */
|
||||
/* install uart0 isr */
|
||||
INTSUBMSK &= ~(BIT_SUB_RXD0);
|
||||
|
||||
rt_hw_interrupt_install(INTUART0, rt_serial_handler, RT_NULL);
|
||||
/* install uart2 isr */
|
||||
INTSUBMSK &= ~(BIT_SUB_RXD2);
|
||||
|
||||
rt_hw_interrupt_install(INTUART0, rt_serial0_handler, RT_NULL);
|
||||
rt_hw_interrupt_umask(INTUART0);
|
||||
|
||||
rt_hw_interrupt_install(INTUART2, rt_serial2_handler, RT_NULL);
|
||||
rt_hw_interrupt_umask(INTUART2);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will init timer4 for system ticks
|
||||
*/
|
||||
void rt_hw_timer_init()
|
||||
static void rt_hw_timer_init()
|
||||
{
|
||||
/* timer4, pre = 15+1 */
|
||||
TCFG0 &= 0xffff00ff;
|
||||
@@ -148,11 +189,6 @@ void rt_hw_board_init()
|
||||
/* initialize uart */
|
||||
rt_hw_uart_init();
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
/* init virtual keypad */
|
||||
rt_hw_key_init();
|
||||
#endif
|
||||
|
||||
/* initialize mmu */
|
||||
rt_hw_mmu_init();
|
||||
|
||||
|
||||
+366
-366
File diff suppressed because it is too large.
Load diff
+282
-84
File diff suppressed because it is too large.
Load diff
+20
-4
@@ -113,8 +113,8 @@
|
||||
|
||||
#define S3C2410_LCDINT_FRSYNC (1<<1)
|
||||
|
||||
static volatile rt_uint16_t _rt_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
|
||||
static volatile rt_uint16_t _rt_hw_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
|
||||
volatile rt_uint16_t _rt_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
|
||||
volatile rt_uint16_t _rt_hw_framebuffer[RT_HW_LCD_HEIGHT][RT_HW_LCD_WIDTH];
|
||||
|
||||
struct rtgui_lcd_device
|
||||
{
|
||||
@@ -307,7 +307,7 @@ static rt_err_t rt_lcd_init (rt_device_t dev)
|
||||
GPDCON = 0xaaaaaaaa;
|
||||
|
||||
#define M5D(n) ((n)&0x1fffff)
|
||||
#define LCD_ADDR ((rt_uint32_t)_rt_hw_framebuffer)
|
||||
#define LCD_ADDR ((rt_uint32_t)_rt_framebuffer)
|
||||
LCDCON1 = (LCD_PIXCLOCK << 8) | (3 << 5) | (12 << 1);
|
||||
LCDCON2 = (LCD_UPPER_MARGIN << 24) | ((LCD_HEIGHT - 1) << 14) | (LCD_LOWER_MARGIN << 6) | (LCD_VSYNC_LEN << 0);
|
||||
LCDCON3 = (LCD_RIGHT_MARGIN << 19) | ((LCD_WIDTH - 1) << 8) | (LCD_LEFT_MARGIN << 0);
|
||||
@@ -357,6 +357,20 @@ static rt_err_t rt_lcd_control (rt_device_t dev, rt_uint8_t cmd, void *args)
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_lcd_open(rt_device_t dev, rt_uint16_t oflag)
|
||||
{
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_lcd_close(rt_device_t dev)
|
||||
{
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
void rt_hw_lcd_init(void)
|
||||
{
|
||||
lcd = (struct rtgui_lcd_device*)rt_malloc(sizeof(struct rtgui_lcd_device));
|
||||
@@ -365,12 +379,14 @@ void rt_hw_lcd_init(void)
|
||||
/* init device structure */
|
||||
lcd->parent.type = RT_Device_Class_Unknown;
|
||||
lcd->parent.init = rt_lcd_init;
|
||||
lcd->parent.open = rt_lcd_open;
|
||||
lcd->parent.open = rt_lcd_close;
|
||||
lcd->parent.control = rt_lcd_control;
|
||||
lcd->parent.user_data = RT_NULL;
|
||||
lcd->byte_per_pixel = 2;
|
||||
lcd->width = LCD_WIDTH;
|
||||
lcd->height = LCD_HEIGHT;
|
||||
lcd->hw_framebuffer = (void*)_rt_hw_framebuffer;
|
||||
lcd->hw_framebuffer = (void*)_rt_framebuffer;
|
||||
|
||||
/* register touch device to RT-Thread */
|
||||
rt_device_register(&(lcd->parent), "lcd", RT_DEVICE_FLAG_RDWR);
|
||||
|
||||
@@ -340,22 +340,22 @@ struct dfs_partition part[4];
|
||||
|
||||
static rt_err_t rt_sdcard_init(rt_device_t dev)
|
||||
{
|
||||
return 0;
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_sdcard_open(rt_device_t dev, rt_uint16_t oflag)
|
||||
{
|
||||
return 0;
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_sdcard_close(rt_device_t dev)
|
||||
{
|
||||
return 0;
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_sdcard_control(rt_device_t dev, rt_uint8_t cmd, void *args)
|
||||
{
|
||||
return 0;
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_size_t rt_sdcard_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
|
||||
@@ -406,7 +406,7 @@ static rt_size_t rt_sdcard_write (rt_device_t dev, rt_off_t pos, const void* buf
|
||||
return size;
|
||||
}
|
||||
|
||||
void rt_hw_sdcard_init()
|
||||
void rt_hw_sdcard_init(void)
|
||||
{
|
||||
rt_uint8_t i, status;
|
||||
rt_uint8_t *sector;
|
||||
|
||||
@@ -38,6 +38,8 @@ extern void rt_application_init(void);
|
||||
|
||||
extern struct serial_device uart0;
|
||||
extern struct rt_device uart0_device;
|
||||
extern struct serial_device uart2;
|
||||
extern struct rt_device uart2_device;
|
||||
|
||||
/**
|
||||
* @addtogroup mini2440
|
||||
@@ -105,11 +107,16 @@ void rtthread_startup(void)
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* register uart1 */
|
||||
/* register uart0 */
|
||||
rt_hw_serial_register(&uart0_device, "uart0",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
|
||||
&uart0);
|
||||
|
||||
/* register uart2, used for RTI debug */
|
||||
rt_hw_serial_register(&uart2_device, "uart2",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
|
||||
&uart2);
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
rt_hw_sdcard_init();
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user