mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
21 files changed
+1077
-1227
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,28 @@
|
||||
mainmenu "RT-Thread Project Configuration"
|
||||
|
||||
config BSP_DIR
|
||||
string
|
||||
option env="BSP_ROOT"
|
||||
default "."
|
||||
|
||||
config RTT_DIR
|
||||
string
|
||||
option env="RTT_ROOT"
|
||||
default "../.."
|
||||
|
||||
config PKGS_DIR
|
||||
string
|
||||
option env="PKGS_ROOT"
|
||||
default "packages"
|
||||
|
||||
config BOARD_MINI2440
|
||||
bool "mini2440"
|
||||
select ARCH_ARM_ARM9
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
default y
|
||||
|
||||
source "$RTT_DIR/Kconfig"
|
||||
source "$PKGS_DIR/Kconfig"
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ Export('rtconfig')
|
||||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT)
|
||||
|
||||
if GetDepend('RT_USING_RTGUI'):
|
||||
objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
|
||||
#if GetDepend('RT_USING_RTGUI'):
|
||||
# objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
|
||||
|
||||
# libc testsuite
|
||||
# objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0)
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,28 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "led.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("hello rt-thread\n");
|
||||
|
||||
while (1)
|
||||
{
|
||||
/* light on leds for one second */
|
||||
rt_hw_led_on(LED2|LED3);
|
||||
rt_hw_led_off(LED1|LED4);
|
||||
rt_thread_delay(100);
|
||||
|
||||
/* light off leds for one second */
|
||||
rt_hw_led_off(LED2|LED3);
|
||||
rt_hw_led_on(LED1|LED4);
|
||||
rt_thread_delay(100);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
#include <dfs_fs.h>
|
||||
#include "dfs_ramfs.h"
|
||||
|
||||
int mnt_init(void)
|
||||
{
|
||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||
{
|
||||
rt_kprintf("File System initialized!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("File System initialzation failed!\n");
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_ENV_EXPORT(mnt_init);
|
||||
#endif
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* File : startup.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-02-26 Bernard first implementation
|
||||
* 2006-05-05 Bernard add two test thread
|
||||
* 2006-08-10 Bernard use rt_show_version to display version information
|
||||
* 2008-07-14 Bernard modify the heap memory init parameter
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include <s3c24x0.h>
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <finsh.h>
|
||||
#endif
|
||||
|
||||
extern void rt_hw_interrupt_init(void);
|
||||
extern void rt_hw_board_init(void);
|
||||
extern void rt_hw_rtc_init(void);
|
||||
extern void rt_serial_init(void);
|
||||
extern void rt_system_timer_init(void);
|
||||
extern void rt_system_scheduler_init(void);
|
||||
extern void rt_thread_idle_init(void);
|
||||
extern void rt_hw_cpu_icache_enable(void);
|
||||
extern void rt_show_version(void);
|
||||
extern void rt_system_heap_init(void*, void*);
|
||||
extern void rt_hw_finsh_init(void);
|
||||
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
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
#if defined(__CC_ARM)
|
||||
extern int Image$$ER_ZI$$ZI$$Base;
|
||||
extern int Image$$ER_ZI$$ZI$$Length;
|
||||
extern int Image$$ER_ZI$$ZI$$Limit;
|
||||
#elif (defined (__GNUC__))
|
||||
rt_uint8_t _irq_stack_start[1024];
|
||||
rt_uint8_t _fiq_stack_start[1024];
|
||||
rt_uint8_t _undefined_stack_start[512];
|
||||
rt_uint8_t _abort_stack_start[512];
|
||||
rt_uint8_t _svc_stack_start[4096] SECTION(".nobss");
|
||||
extern unsigned char __bss_start;
|
||||
extern unsigned char __bss_end;
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
extern int finsh_system_init(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function will startup RT-Thread RTOS.
|
||||
*/
|
||||
void rtthread_startup(void)
|
||||
{
|
||||
/* enable cpu cache */
|
||||
rt_hw_cpu_icache_enable();
|
||||
rt_hw_cpu_dcache_enable();
|
||||
|
||||
/* init hardware interrupt */
|
||||
rt_hw_interrupt_init();
|
||||
|
||||
/* init board */
|
||||
rt_hw_board_init();
|
||||
|
||||
/* show version */
|
||||
rt_show_version();
|
||||
|
||||
/* init tick */
|
||||
rt_system_tick_init();
|
||||
|
||||
/* init kernel object */
|
||||
rt_system_object_init();
|
||||
|
||||
/* init timer system */
|
||||
rt_system_timer_init();
|
||||
|
||||
/* init heap memory system */
|
||||
#ifdef __CC_ARM
|
||||
rt_system_heap_init((void*)&Image$$ER_ZI$$ZI$$Limit, (void*)0x33F00000);
|
||||
#else
|
||||
rt_system_heap_init((void*)&__bss_end, (void*)0x33F00000);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_MODULE
|
||||
/* init module system*/
|
||||
rt_system_module_init();
|
||||
#endif
|
||||
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* 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();
|
||||
#ifdef RT_USING_DFS_UFFS
|
||||
rt_hw_nand_init();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* rtc init */
|
||||
rt_hw_rtc_init();
|
||||
#endif
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
/* init finsh */
|
||||
finsh_system_init();
|
||||
#ifdef RT_USING_DEVICE
|
||||
finsh_set_device("uart0");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
rt_system_timer_thread_init();
|
||||
|
||||
/* init idle thread */
|
||||
rt_thread_idle_init();
|
||||
|
||||
/* start scheduler */
|
||||
rt_system_scheduler_start();
|
||||
|
||||
/* never reach here */
|
||||
return ;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* disable interrupt first */
|
||||
rt_hw_interrupt_disable();
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
@@ -8,7 +8,7 @@ cwd = os.path.join(str(Dir('#')), 'drivers')
|
||||
src = Split("""
|
||||
board.c
|
||||
led.c
|
||||
console.c
|
||||
uart.c
|
||||
""")
|
||||
|
||||
if GetDepend('RT_USING_DFS'):
|
||||
@@ -17,16 +17,13 @@ if GetDepend('RT_USING_DFS'):
|
||||
if GetDepend('RT_USING_LWIP'):
|
||||
src += ['dm9000.c']
|
||||
|
||||
if GetDepend('RT_USING_RTGUI'):
|
||||
src += ['touch.c', 'key.c', 'calibration.c']
|
||||
|
||||
if GetDepend('RT_USING_FTK'):
|
||||
src += ['touch.c', 'key.c']
|
||||
if GetDepend('PKG_USING_GUIENGINE'):
|
||||
src += ['touch.c', 'key.c']
|
||||
|
||||
if GetDepend('RT_USING_RTI'):
|
||||
src += ['rti_stub.c']
|
||||
src += ['rti_stub.c']
|
||||
|
||||
if GetDepend('RT_USING_RTGUI') or GetDepend('RT_USING_FTK'):
|
||||
if GetDepend('PKG_USING_GUIENGINE'):
|
||||
if rtconfig.RT_USING_LCD_TYPE == 'PNL_A70':
|
||||
src += ['lcd_a70.c']
|
||||
elif rtconfig.RT_USING_LCD_TYPE == 'PNL_N35':
|
||||
|
||||
+39
-110
@@ -26,6 +26,29 @@
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
#if defined(__CC_ARM)
|
||||
extern int Image$$ER_ZI$$ZI$$Base;
|
||||
extern int Image$$ER_ZI$$ZI$$Length;
|
||||
extern int Image$$ER_ZI$$ZI$$Limit;
|
||||
#elif (defined (__GNUC__))
|
||||
rt_uint8_t _irq_stack_start[1024];
|
||||
rt_uint8_t _fiq_stack_start[1024];
|
||||
rt_uint8_t _undefined_stack_start[512];
|
||||
rt_uint8_t _abort_stack_start[512];
|
||||
rt_uint8_t _svc_stack_start[4096] SECTION(".nobss");
|
||||
#endif
|
||||
|
||||
#if defined(__CC_ARM)
|
||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||
#define HEAP_BEGIN ((void*)&Image$$RW_IRAM1$$ZI$$Limit)
|
||||
#elif defined(__GNUC__)
|
||||
extern int __bss_end;
|
||||
#define HEAP_BEGIN (((void*)&__bss_end) + 0x1000)
|
||||
#endif
|
||||
|
||||
#define HEAP_END (void*)(0x33F00000)
|
||||
|
||||
|
||||
extern rt_uint32_t PCLK, FCLK, HCLK, UCLK;
|
||||
|
||||
extern void rt_hw_clock_init(void);
|
||||
@@ -35,26 +58,6 @@ 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 =
|
||||
{
|
||||
UART0,
|
||||
&uart0_int_rx,
|
||||
RT_NULL
|
||||
};
|
||||
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
|
||||
*/
|
||||
@@ -63,92 +66,6 @@ static void rt_timer_handler(int vector, void *param)
|
||||
rt_tick_increase();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will handle serial
|
||||
*/
|
||||
static void rt_serial0_handler(int vector, void *param)
|
||||
{
|
||||
INTSUBMSK |= (BIT_SUB_RXD0);
|
||||
|
||||
rt_hw_serial_isr(&uart0_device);
|
||||
|
||||
SUBSRCPND |= BIT_SUB_RXD0;
|
||||
|
||||
/* Unmask sub interrupt (RXD0) */
|
||||
INTSUBMSK &=~(BIT_SUB_RXD0);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will handle serial
|
||||
*/
|
||||
static void rt_serial2_handler(int vector, void *param)
|
||||
{
|
||||
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
|
||||
*/
|
||||
static void rt_hw_uart_init(void)
|
||||
{
|
||||
int i;
|
||||
/* UART0 port configure */
|
||||
GPHCON |= 0xAA;
|
||||
/* PULLUP is disable */
|
||||
GPHUP |= 0xF;
|
||||
|
||||
/* FIFO enable, Tx/Rx FIFO clear */
|
||||
uart0.uart_device->ufcon = 0x0;
|
||||
/* disable the flow control */
|
||||
uart0.uart_device->umcon = 0x0;
|
||||
/* Normal,No parity,1 stop,8 bit */
|
||||
uart0.uart_device->ulcon = 0x3;
|
||||
/*
|
||||
* tx=level,rx=edge,disable timeout int.,enable rx error int.,
|
||||
* normal,interrupt or polling
|
||||
*/
|
||||
uart0.uart_device->ucon = 0x245;
|
||||
/* Set uart0 bps */
|
||||
uart0.uart_device->ubrd = (rt_int32_t)(PCLK / (BPS * 16)) - 1;
|
||||
/* 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 uart0 isr */
|
||||
INTSUBMSK &= ~(BIT_SUB_RXD0);
|
||||
|
||||
/* install uart2 isr */
|
||||
INTSUBMSK &= ~(BIT_SUB_RXD2);
|
||||
|
||||
rt_hw_interrupt_install(INTUART0, rt_serial0_handler, RT_NULL, "UART0");
|
||||
rt_hw_interrupt_umask(INTUART0);
|
||||
|
||||
rt_hw_interrupt_install(INTUART2, rt_serial2_handler, RT_NULL, "UART2");
|
||||
rt_hw_interrupt_umask(INTUART2);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will init timer4 for system ticks
|
||||
*/
|
||||
@@ -177,6 +94,12 @@ static void rt_hw_timer_init(void)
|
||||
*/
|
||||
void rt_hw_board_init(void)
|
||||
{
|
||||
rt_hw_cpu_icache_enable();
|
||||
rt_hw_cpu_dcache_enable();
|
||||
|
||||
/* init hardware interrupt */
|
||||
rt_hw_interrupt_init();
|
||||
|
||||
/* initialize the system clock */
|
||||
rt_hw_clock_init();
|
||||
|
||||
@@ -186,14 +109,20 @@ void rt_hw_board_init(void)
|
||||
/* initialize led port */
|
||||
rt_hw_led_init();
|
||||
|
||||
/* initialize uart */
|
||||
rt_hw_uart_init();
|
||||
|
||||
/* initialize mmu */
|
||||
rt_hw_mmu_init();
|
||||
|
||||
/* initialize timer4 */
|
||||
rt_hw_timer_init();
|
||||
}
|
||||
|
||||
/* initialize system heap */
|
||||
rt_system_heap_init(HEAP_BEGIN, HEAP_END);
|
||||
|
||||
rt_components_board_init();
|
||||
|
||||
#ifdef RT_USING_CONSOLE
|
||||
rt_console_set_device("uart0");
|
||||
#endif
|
||||
|
||||
}
|
||||
/*@}*/
|
||||
@@ -16,7 +16,6 @@
|
||||
#define __BOARD_H__
|
||||
|
||||
#include <s3c24x0.h>
|
||||
#include <serial.h>
|
||||
|
||||
void rt_hw_board_init(void);
|
||||
void rt_hw_sdcard_init(void);
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
#include <rtthread.h>
|
||||
|
||||
#include <serial.h>
|
||||
|
||||
#define RT_CONSOLE_WIDTH 240
|
||||
#define RT_CONSOLE_HEIGHT 320
|
||||
|
||||
#define RT_CONSOLE_FONT_WIDTH 8
|
||||
#define RT_CONSOLE_FONT_HEIGHT 16
|
||||
|
||||
#define RT_CONSOLE_COL (RT_CONSOLE_WIDTH/RT_CONSOLE_FONT_WIDTH)
|
||||
#define RT_CONSOLE_ROW (RT_CONSOLE_HEIGHT/RT_CONSOLE_FONT_HEIGHT)
|
||||
|
||||
#define RT_CONSOLE_TAB 4
|
||||
|
||||
#define RT_CONSOLE_FOREPIXEL (0x001f)
|
||||
|
||||
extern struct serial_device uart0;
|
||||
|
||||
struct rt_console
|
||||
{
|
||||
rt_uint8_t* video_ptr;
|
||||
rt_uint8_t* font_ptr;
|
||||
|
||||
/* bpp and pixel of width */
|
||||
rt_uint8_t bpp;
|
||||
rt_uint32_t pitch;
|
||||
|
||||
/* current cursor */
|
||||
rt_uint8_t current_col;
|
||||
rt_uint8_t current_row;
|
||||
};
|
||||
struct rt_console console;
|
||||
|
||||
void rt_hw_console_init(rt_uint8_t* video_ptr, rt_uint8_t* font_ptr, rt_uint8_t bpp);
|
||||
void rt_hw_console_newline(void);
|
||||
void rt_hw_console_putc(char c);
|
||||
void rt_hw_console_clear(void);
|
||||
|
||||
void rt_hw_console_init(rt_uint8_t* video_ptr, rt_uint8_t* font_ptr, rt_uint8_t bpp)
|
||||
{
|
||||
rt_memset(&console, 0, sizeof(struct rt_console));
|
||||
|
||||
console.video_ptr = video_ptr;
|
||||
console.font_ptr = font_ptr;
|
||||
console.bpp = bpp;
|
||||
console.pitch = console.bpp * RT_CONSOLE_WIDTH;
|
||||
|
||||
rt_hw_console_clear();
|
||||
}
|
||||
|
||||
void rt_hw_console_putc(char c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
/* to next line */
|
||||
rt_hw_console_newline();
|
||||
console.current_col = 0;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
console.current_col += RT_CONSOLE_TAB;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
rt_uint8_t* font_ptr;
|
||||
register rt_uint32_t cursor;
|
||||
register rt_uint32_t i, j;
|
||||
|
||||
if (console.current_col == RT_CONSOLE_COL)
|
||||
{
|
||||
rt_hw_console_newline();
|
||||
console.current_col = 0;
|
||||
|
||||
rt_hw_console_putc(c);
|
||||
return;
|
||||
}
|
||||
|
||||
font_ptr = console.font_ptr + c * RT_CONSOLE_FONT_HEIGHT;
|
||||
cursor = (console.current_row * RT_CONSOLE_FONT_HEIGHT) * console.pitch
|
||||
+ console.current_col * RT_CONSOLE_FONT_WIDTH * console.bpp;
|
||||
|
||||
for (i = 0; i < RT_CONSOLE_FONT_HEIGHT; i ++ )
|
||||
{
|
||||
for (j = 0; j < RT_CONSOLE_FONT_WIDTH; j ++)
|
||||
{
|
||||
if ( ((font_ptr[i] >> (7-j)) & 0x01) != 0 )
|
||||
{
|
||||
/* draw a pixel */
|
||||
rt_uint8_t *ptr = &(console.video_ptr[cursor + i * console.pitch + j * console.bpp]);
|
||||
switch(console.bpp)
|
||||
{
|
||||
case 1:
|
||||
*ptr = RT_CONSOLE_FOREPIXEL;
|
||||
break;
|
||||
case 2:
|
||||
*(rt_uint16_t*)ptr = RT_CONSOLE_FOREPIXEL;
|
||||
break;
|
||||
case 3:
|
||||
ptr[0] = RT_CONSOLE_FOREPIXEL & 0xff;
|
||||
ptr[1] = (RT_CONSOLE_FOREPIXEL >> 8) & 0xff;
|
||||
ptr[2] = (RT_CONSOLE_FOREPIXEL >> 16) & 0xff;
|
||||
break;
|
||||
case 4:
|
||||
*(rt_uint32_t*)ptr = RT_CONSOLE_FOREPIXEL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.current_col ++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rt_hw_console_newline()
|
||||
{
|
||||
console.current_row ++;
|
||||
if (console.current_row >= RT_CONSOLE_ROW)
|
||||
{
|
||||
rt_uint32_t i;
|
||||
|
||||
/* scroll to next line */
|
||||
for (i = 0; i < RT_CONSOLE_ROW - 1; i ++)
|
||||
{
|
||||
rt_memcpy(console.video_ptr + i * RT_CONSOLE_FONT_HEIGHT * console.pitch,
|
||||
console.video_ptr + (i + 1) * RT_CONSOLE_FONT_HEIGHT * console.pitch,
|
||||
RT_CONSOLE_FONT_HEIGHT * console.pitch);
|
||||
}
|
||||
|
||||
/* clear last line */
|
||||
rt_memset(console.video_ptr + (RT_CONSOLE_ROW - 1) * RT_CONSOLE_FONT_HEIGHT * console.pitch,
|
||||
0,
|
||||
RT_CONSOLE_FONT_HEIGHT * console.pitch);
|
||||
|
||||
console.current_row = RT_CONSOLE_ROW - 1;
|
||||
}
|
||||
}
|
||||
|
||||
void rt_hw_console_clear()
|
||||
{
|
||||
console.current_col = 0;
|
||||
console.current_row = 0;
|
||||
|
||||
rt_memset(console.video_ptr, 0, RT_CONSOLE_HEIGHT * console.pitch);
|
||||
}
|
||||
|
||||
/* write one character to serial, must not trigger interrupt */
|
||||
void rt_hw_serial_putc(const char c)
|
||||
{
|
||||
/*
|
||||
to be polite with serial console add a line feed
|
||||
to the carriage return character
|
||||
*/
|
||||
if (c=='\n')rt_hw_serial_putc('\r');
|
||||
|
||||
while (!(uart0.uart_device->ustat & USTAT_TXB_EMPTY));
|
||||
uart0.uart_device->utxh = (c & 0x1FF);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used by rt_kprintf to display a string on console.
|
||||
*
|
||||
* @param str the displayed string
|
||||
*/
|
||||
void rt_hw_console_output(const char* str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
rt_hw_serial_putc(*str++);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,6 +287,9 @@ static rt_err_t rt_dm9000_init(rt_device_t dev)
|
||||
}
|
||||
}
|
||||
|
||||
/* send a notify */
|
||||
eth_device_linkchange(&dm9000_device.parent, RT_TRUE);
|
||||
|
||||
/* see what we've got */
|
||||
lnk = phy_read(17) >> 12;
|
||||
rt_kprintf("operating at ");
|
||||
@@ -588,7 +591,7 @@ void INTEINT4_7_handler(int irqno, void *param)
|
||||
EINTPEND = eint_pend;
|
||||
}
|
||||
|
||||
void rt_hw_dm9000_init()
|
||||
int rt_hw_dm9000_init()
|
||||
{
|
||||
/* Set GPF7 as EINT7 */
|
||||
GPFCON = GPFCON & (~(3 << 14)) | (2 << 14);
|
||||
@@ -639,8 +642,12 @@ void rt_hw_dm9000_init()
|
||||
/* instal interrupt */
|
||||
rt_hw_interrupt_install(INTEINT4_7, INTEINT4_7_handler, RT_NULL, "EINT4_7");
|
||||
rt_hw_interrupt_umask(INTEINT4_7);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
INIT_DEVICE_EXPORT(rt_hw_dm9000_init);
|
||||
|
||||
void dm9000a(void)
|
||||
{
|
||||
rt_kprintf("\n");
|
||||
|
||||
@@ -143,6 +143,6 @@
|
||||
|
||||
#define GPCR_GEP_CNTL (1<<0)
|
||||
|
||||
void rt_hw_dm9000_init(void);
|
||||
int rt_hw_dm9000_init(void);
|
||||
|
||||
#endif
|
||||
@@ -79,7 +79,7 @@ static void rt_hw_key_isr(void)
|
||||
/**
|
||||
* This function is only for QEMU emulation
|
||||
*/
|
||||
static void rt_key_handler(int vector)
|
||||
static void rt_key_handler(int vector, void *param)
|
||||
{
|
||||
INTSUBMSK |= (BIT_SUB_RXD1);
|
||||
|
||||
|
||||
@@ -550,7 +550,7 @@ static rt_size_t rt_sdcard_write(rt_device_t dev,
|
||||
return size;
|
||||
}
|
||||
|
||||
void rt_hw_sdcard_init(void)
|
||||
int rt_hw_sdcard_init(void)
|
||||
{
|
||||
rt_uint8_t i, status;
|
||||
rt_uint8_t *sector;
|
||||
@@ -574,7 +574,7 @@ void rt_hw_sdcard_init(void)
|
||||
{
|
||||
rt_kprintf("allocate partition sector buffer failed\n");
|
||||
|
||||
return;
|
||||
return -RT_ERROR;
|
||||
}
|
||||
status = sd_readblock(0, sector);
|
||||
if (status == RT_EOK)
|
||||
@@ -637,12 +637,15 @@ void rt_hw_sdcard_init(void)
|
||||
/* release sector buffer */
|
||||
rt_free(sector);
|
||||
|
||||
return;
|
||||
return -RT_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("sdcard init failed\n");
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
INIT_BOARD_EXPORT(rt_hw_sdcard_init);
|
||||
#endif
|
||||
@@ -349,7 +349,7 @@ static void s3c2410_intc_stylus_updown(void)
|
||||
SUBSRCPND |= BIT_SUB_TC;
|
||||
}
|
||||
|
||||
static void rt_touch_handler(int irqno)
|
||||
static void rt_touch_handler(int irqno, void *param)
|
||||
{
|
||||
if (SUBSRCPND & BIT_SUB_ADC)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+210
-143
File diff suppressed because it is too large.
Load diff
@@ -9,14 +9,14 @@ ARCH = 'arm'
|
||||
CPU = 's3c24x0'
|
||||
TextBase = '0x30000000'
|
||||
|
||||
CROSS_TOOL = 'keil'
|
||||
CROSS_TOOL = 'gcc'
|
||||
|
||||
if os.getenv('RTT_CC'):
|
||||
CROSS_TOOL = os.getenv('RTT_CC')
|
||||
|
||||
if CROSS_TOOL == 'gcc':
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = 'C:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
|
||||
EXEC_PATH = '/opt/gcc-arm-none-eabi-6_2-2016q4/bin'
|
||||
elif CROSS_TOOL == 'keil':
|
||||
PLATFORM = 'armcc'
|
||||
EXEC_PATH = 'C:/Keil'
|
||||
@@ -43,12 +43,21 @@ if PLATFORM == 'gcc':
|
||||
SIZE = PREFIX + 'size'
|
||||
OBJDUMP = PREFIX + 'objdump'
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
STRIP = PREFIX + 'strip'
|
||||
|
||||
DEVICE = ' -mcpu=arm920t'
|
||||
CFLAGS = DEVICE
|
||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' + ' -DTEXT_BASE=' + TextBase
|
||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread_mini2440.map,-cref,-u,_start -nostartfiles -T mini2440_ram.ld' + ' -Ttext ' + TextBase
|
||||
|
||||
# module setting
|
||||
CXXFLAGS = ' -Woverloaded-virtual -fno-exceptions -fno-rtti '
|
||||
M_CFLAGS = CFLAGS + ' -mlong-calls -fPIC '
|
||||
M_CXXFLAGS = CXXFLAGS + ' -mlong-calls -fPIC'
|
||||
M_LFLAGS = DEVICE + CXXFLAGS + ' -Wl,--gc-sections,-z,max-page-size=0x4' +\
|
||||
' -shared -fPIC -nostartfiles -static-libgcc'
|
||||
M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n'
|
||||
|
||||
CPATH = ''
|
||||
LPATH = ''
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
#ifndef __RT_HW_SERIAL_H__
|
||||
#define __RT_HW_SERIAL_H__
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "s3c24x0.h"
|
||||
|
||||
#define USTAT_RCV_READY 0x01 /* receive data ready */
|
||||
#define USTAT_TXB_EMPTY 0x02 /* tx buffer empty */
|
||||
#define BPS 115200 /* serial baudrate */
|
||||
|
||||
#define UART_RX_BUFFER_SIZE 64
|
||||
#define UART_TX_BUFFER_SIZE 64
|
||||
|
||||
struct serial_int_rx
|
||||
{
|
||||
rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE];
|
||||
rt_uint32_t read_index, save_index;
|
||||
};
|
||||
|
||||
struct serial_int_tx
|
||||
{
|
||||
rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE];
|
||||
rt_uint32_t write_index, save_index;
|
||||
};
|
||||
|
||||
typedef struct uartport
|
||||
{
|
||||
volatile rt_uint32_t ulcon;
|
||||
volatile rt_uint32_t ucon;
|
||||
volatile rt_uint32_t ufcon;
|
||||
volatile rt_uint32_t umcon;
|
||||
volatile rt_uint32_t ustat;
|
||||
volatile rt_uint32_t urxb;
|
||||
volatile rt_uint32_t ufstat;
|
||||
volatile rt_uint32_t umstat;
|
||||
volatile rt_uint32_t utxh;
|
||||
volatile rt_uint32_t urxh;
|
||||
volatile rt_uint32_t ubrd;
|
||||
}uartport;
|
||||
|
||||
struct serial_device
|
||||
{
|
||||
uartport* uart_device;
|
||||
|
||||
/* rx structure */
|
||||
struct serial_int_rx* int_rx;
|
||||
|
||||
/* tx structure */
|
||||
struct serial_int_tx* int_tx;
|
||||
};
|
||||
|
||||
rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial);
|
||||
|
||||
void rt_hw_serial_isr(rt_device_t device);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user