[bsp] add iar support for lpc54608 and fix sdram bug
This commit is contained in:
parent
a0c2e50e36
commit
40d0ff9960
|
@ -1,136 +1,136 @@
|
|||
/*
|
||||
* File : application.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development 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
|
||||
* 2009-01-05 Bernard the first version
|
||||
* 2013-07-12 aozima update for auto initial.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup STM32
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
#include <board.h>
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
#include <components.h>
|
||||
#endif /* RT_USING_COMPONENTS_INIT */
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
/* dfs filesystem:ELM filesystem init */
|
||||
#include <dfs_elm.h>
|
||||
/* dfs Filesystem APIs */
|
||||
#include <dfs_fs.h>
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/rtgui_server.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/calibration.h>
|
||||
#endif
|
||||
|
||||
void rt_init_thread_entry(void* parameter)
|
||||
{
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
/* initialization RT-Thread Components */
|
||||
rt_components_init();
|
||||
#endif
|
||||
|
||||
/* Filesystem Initialization */
|
||||
#if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
|
||||
/* mount sd card fat partition 1 as root directory */
|
||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||
{
|
||||
rt_kprintf("File System initialized!\n");
|
||||
}
|
||||
else
|
||||
rt_kprintf("File System initialzation failed!\n");
|
||||
#endif /* RT_USING_DFS */
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
{
|
||||
extern void rt_hw_lcd_init();
|
||||
extern void rtgui_touch_hw_init(void);
|
||||
|
||||
rt_device_t lcd;
|
||||
|
||||
/* init lcd */
|
||||
rt_hw_lcd_init();
|
||||
|
||||
/* init touch panel */
|
||||
rtgui_touch_hw_init();
|
||||
|
||||
/* find lcd device */
|
||||
lcd = rt_device_find("lcd");
|
||||
|
||||
/* set lcd device as rtgui graphic driver */
|
||||
rtgui_graphic_set_device(lcd);
|
||||
|
||||
#ifndef RT_USING_COMPONENTS_INIT
|
||||
/* init rtgui system server */
|
||||
rtgui_system_server_init();
|
||||
#endif
|
||||
|
||||
calibration_set_restore(cali_setup);
|
||||
calibration_set_after(cali_store);
|
||||
calibration_init();
|
||||
}
|
||||
#endif /* #ifdef RT_USING_RTGUI */
|
||||
}
|
||||
|
||||
//#include "debug.h"
|
||||
//
|
||||
//rt_thread_t test_thread[2];
|
||||
//
|
||||
//void rt_test_thread_entry(void *parameter)
|
||||
//{
|
||||
// uint32_t num = (uint32_t)parameter;
|
||||
// uint32_t schedule_times = 0;
|
||||
//
|
||||
// while (1)
|
||||
// {
|
||||
// DEBUG(1, 0, "%d:%d\r\n", num, schedule_times++);
|
||||
// rt_thread_delay(1);
|
||||
// }
|
||||
//}
|
||||
|
||||
int rt_application_init(void)
|
||||
{
|
||||
rt_thread_t init_thread;
|
||||
|
||||
#if (RT_THREAD_PRIORITY_MAX == 32)
|
||||
init_thread = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, 8, 20);
|
||||
#else
|
||||
init_thread = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, 80, 20);
|
||||
#endif
|
||||
|
||||
if (init_thread != RT_NULL)
|
||||
rt_thread_startup(init_thread);
|
||||
|
||||
// test_thread[0] = rt_thread_create("t1", rt_test_thread_entry, (void *)1, 1024, 26, 5);
|
||||
// test_thread[1] = rt_thread_create("t2", rt_test_thread_entry, (void *)2, 1024, 26, 5);
|
||||
// if (test_thread[0] != RT_NULL)
|
||||
// rt_thread_startup(test_thread[0]);
|
||||
// if (test_thread[1] != RT_NULL)
|
||||
// rt_thread_startup(test_thread[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
/*
|
||||
* File : application.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development 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
|
||||
* 2009-01-05 Bernard the first version
|
||||
* 2013-07-12 aozima update for auto initial.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup STM32
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
#include <board.h>
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
#include <components.h>
|
||||
#endif /* RT_USING_COMPONENTS_INIT */
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
/* dfs filesystem:ELM filesystem init */
|
||||
#include <dfs_elm.h>
|
||||
/* dfs Filesystem APIs */
|
||||
#include <dfs_fs.h>
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/rtgui_server.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/calibration.h>
|
||||
#endif
|
||||
|
||||
void rt_init_thread_entry(void* parameter)
|
||||
{
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
/* initialization RT-Thread Components */
|
||||
rt_components_init();
|
||||
#endif
|
||||
|
||||
/* Filesystem Initialization */
|
||||
#if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
|
||||
/* mount sd card fat partition 1 as root directory */
|
||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||
{
|
||||
rt_kprintf("File System initialized!\n");
|
||||
}
|
||||
else
|
||||
rt_kprintf("File System initialzation failed!\n");
|
||||
#endif /* RT_USING_DFS */
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
{
|
||||
extern void rt_hw_lcd_init();
|
||||
extern void rtgui_touch_hw_init(void);
|
||||
|
||||
rt_device_t lcd;
|
||||
|
||||
/* init lcd */
|
||||
rt_hw_lcd_init();
|
||||
|
||||
/* init touch panel */
|
||||
rtgui_touch_hw_init();
|
||||
|
||||
/* find lcd device */
|
||||
lcd = rt_device_find("lcd");
|
||||
|
||||
/* set lcd device as rtgui graphic driver */
|
||||
rtgui_graphic_set_device(lcd);
|
||||
|
||||
#ifndef RT_USING_COMPONENTS_INIT
|
||||
/* init rtgui system server */
|
||||
rtgui_system_server_init();
|
||||
#endif
|
||||
|
||||
calibration_set_restore(cali_setup);
|
||||
calibration_set_after(cali_store);
|
||||
calibration_init();
|
||||
}
|
||||
#endif /* #ifdef RT_USING_RTGUI */
|
||||
}
|
||||
|
||||
//#include "debug.h"
|
||||
//
|
||||
//rt_thread_t test_thread[2];
|
||||
//
|
||||
//void rt_test_thread_entry(void *parameter)
|
||||
//{
|
||||
// uint32_t num = (uint32_t)parameter;
|
||||
// uint32_t schedule_times = 0;
|
||||
//
|
||||
// while (1)
|
||||
// {
|
||||
// DEBUG(1, 0, "%d:%d\r\n", num, schedule_times++);
|
||||
// rt_thread_delay(1);
|
||||
// }
|
||||
//}
|
||||
|
||||
int rt_application_init(void)
|
||||
{
|
||||
rt_thread_t init_thread;
|
||||
|
||||
#if (RT_THREAD_PRIORITY_MAX == 32)
|
||||
init_thread = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, 8, 20);
|
||||
#else
|
||||
init_thread = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, 80, 20);
|
||||
#endif
|
||||
|
||||
if (init_thread != RT_NULL)
|
||||
rt_thread_startup(init_thread);
|
||||
|
||||
// test_thread[0] = rt_thread_create("t1", rt_test_thread_entry, (void *)1, 1024, 26, 5);
|
||||
// test_thread[1] = rt_thread_create("t2", rt_test_thread_entry, (void *)2, 1024, 26, 5);
|
||||
// if (test_thread[0] != RT_NULL)
|
||||
// rt_thread_startup(test_thread[0]);
|
||||
// if (test_thread[1] != RT_NULL)
|
||||
// rt_thread_startup(test_thread[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -1,95 +1,95 @@
|
|||
/*
|
||||
* File : board.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009 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
|
||||
* 2009-01-05 Bernard first implementation
|
||||
* 2013-07-12 aozima update for auto initial.
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "nds32.h"
|
||||
#include "bsp_hal.h"
|
||||
#include "ae210p.h"
|
||||
#include "debug.h"
|
||||
//#include "uart/uart.h"
|
||||
#include "uart_dev.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "rtconfig.h"
|
||||
|
||||
/**
|
||||
* This is the timer interrupt service routine.
|
||||
*
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
/* clean timer device pending*/
|
||||
hal_timer_irq_clear(1);
|
||||
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
rt_tick_increase();
|
||||
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* Set timer 1 as system tick by default
|
||||
***********************************************************/
|
||||
|
||||
void BSP_Tmr_TickInit(uint32_t tmrId, uint32_t period, uint32_t vecId, void *isr)
|
||||
{
|
||||
/* set tick period */
|
||||
hal_timer_set_period(tmrId, period);
|
||||
|
||||
/* enable timer1 interrupt */
|
||||
hal_timer_irq_control(tmrId, 1);
|
||||
|
||||
/******************************
|
||||
* tick ISR init
|
||||
******************************/
|
||||
/* init trigger mode */
|
||||
/* Set edge trigger, falling edge */
|
||||
hal_intc_irq_config(vecId, 1, 0);
|
||||
/* clean pending */
|
||||
hal_intc_irq_clean(vecId);
|
||||
/* enable timer interrupt */
|
||||
hal_intc_irq_enable(vecId);
|
||||
|
||||
if (isr)
|
||||
OS_CPU_Vector_Table[vecId] = isr;
|
||||
else
|
||||
DEBUG(1, 1, "Invalid tick handler!!\r\n");
|
||||
|
||||
/* start timer */
|
||||
hal_timer_start(tmrId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup system tick for OS required.
|
||||
*/
|
||||
void bsp_init(void)
|
||||
{
|
||||
/* disable interrupt first */
|
||||
rt_hw_interrupt_disable();
|
||||
|
||||
// drv_uart_init();
|
||||
rt_hw_usart_init();
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
|
||||
/* System tick init */
|
||||
BSP_Tmr_TickInit(0x1, (MB_PCLK / RT_TICK_PER_SECOND), IRQ_SYS_TICK_VECTOR, SysTick_Handler);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
/*
|
||||
* File : board.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009 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
|
||||
* 2009-01-05 Bernard first implementation
|
||||
* 2013-07-12 aozima update for auto initial.
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "nds32.h"
|
||||
#include "bsp_hal.h"
|
||||
#include "ae210p.h"
|
||||
#include "debug.h"
|
||||
//#include "uart/uart.h"
|
||||
#include "uart_dev.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "rtconfig.h"
|
||||
|
||||
/**
|
||||
* This is the timer interrupt service routine.
|
||||
*
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
/* clean timer device pending*/
|
||||
hal_timer_irq_clear(1);
|
||||
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
rt_tick_increase();
|
||||
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* Set timer 1 as system tick by default
|
||||
***********************************************************/
|
||||
|
||||
void BSP_Tmr_TickInit(uint32_t tmrId, uint32_t period, uint32_t vecId, void *isr)
|
||||
{
|
||||
/* set tick period */
|
||||
hal_timer_set_period(tmrId, period);
|
||||
|
||||
/* enable timer1 interrupt */
|
||||
hal_timer_irq_control(tmrId, 1);
|
||||
|
||||
/******************************
|
||||
* tick ISR init
|
||||
******************************/
|
||||
/* init trigger mode */
|
||||
/* Set edge trigger, falling edge */
|
||||
hal_intc_irq_config(vecId, 1, 0);
|
||||
/* clean pending */
|
||||
hal_intc_irq_clean(vecId);
|
||||
/* enable timer interrupt */
|
||||
hal_intc_irq_enable(vecId);
|
||||
|
||||
if (isr)
|
||||
OS_CPU_Vector_Table[vecId] = isr;
|
||||
else
|
||||
DEBUG(1, 1, "Invalid tick handler!!\r\n");
|
||||
|
||||
/* start timer */
|
||||
hal_timer_start(tmrId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup system tick for OS required.
|
||||
*/
|
||||
void bsp_init(void)
|
||||
{
|
||||
/* disable interrupt first */
|
||||
rt_hw_interrupt_disable();
|
||||
|
||||
// drv_uart_init();
|
||||
rt_hw_usart_init();
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
|
||||
/* System tick init */
|
||||
BSP_Tmr_TickInit(0x1, (MB_PCLK / RT_TICK_PER_SECOND), IRQ_SYS_TICK_VECTOR, SysTick_Handler);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -1,212 +1,212 @@
|
|||
/*
|
||||
* File : uart_dev.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development 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
|
||||
* 2009-01-05 Bernard the first version
|
||||
* 2010-03-29 Bernard remove interrupt Tx and DMA Rx mode
|
||||
* 2013-05-13 aozima update for kehong-lingtai.
|
||||
*/
|
||||
|
||||
#include "uart/uart.h"
|
||||
#include "uart_dev.h"
|
||||
#include "ae210p.h"
|
||||
#include "board.h"
|
||||
#include "bsp_hal.h"
|
||||
|
||||
#include "rtdevice.h"
|
||||
|
||||
#include "serial.h"
|
||||
|
||||
#define UART_ENABLE_IRQ(n) hal_intc_irq_enable(n)
|
||||
#define UART_DISABLE_IRQ(n) hal_intc_irq_disable(n)
|
||||
|
||||
struct uart_device
|
||||
{
|
||||
uint32_t uart_base;
|
||||
uint32_t irq;
|
||||
};
|
||||
|
||||
static rt_err_t __uart_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
RT_ASSERT(cfg != RT_NULL);
|
||||
|
||||
uartDev = (struct uart_device *)serial->parent.user_data;
|
||||
|
||||
__drv_uart_init(uartDev->uart_base, cfg->baud_rate);
|
||||
|
||||
// todo : enable FIFO threshold, enable rx & rx timeout(threshold) interrupt
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t __uart_control(struct rt_serial_device *serial, int cmd, void *arg)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uartDev = (struct uart_device *)serial->parent.user_data;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case RT_DEVICE_CTRL_CLR_INT: /* disable rx irq */
|
||||
UART_DISABLE_IRQ(uartDev->irq);
|
||||
break;
|
||||
|
||||
case RT_DEVICE_CTRL_SET_INT: /* enable rx irq */
|
||||
UART_ENABLE_IRQ(uartDev->irq);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static int __uart_putc(struct rt_serial_device *serial, char c)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
|
||||
uartDev = (struct uart_device *)serial->parent.user_data;
|
||||
|
||||
__drv_uart_put_char(uartDev->uart_base, c); // Transmit Data
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int __uart_getc(struct rt_serial_device *serial)
|
||||
{
|
||||
int ch = -1;
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uartDev = (struct uart_device *)serial->parent.user_data;
|
||||
|
||||
ch = -1;
|
||||
|
||||
if (__drv_uart_is_kbd_hit(uartDev->uart_base))
|
||||
{
|
||||
ch = __drv_uart_get_char(uartDev->uart_base) & 0x00FF;
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
static const struct rt_uart_ops __uart_ops =
|
||||
{
|
||||
__uart_configure,
|
||||
__uart_control,
|
||||
__uart_putc,
|
||||
__uart_getc,
|
||||
RT_NULL
|
||||
};
|
||||
|
||||
#if RT_USING_UART01
|
||||
struct uart_device uartDev01 =
|
||||
{ // UART01 device driver structure
|
||||
UART1_BASE,
|
||||
IRQ_UART1_VECTOR
|
||||
};
|
||||
|
||||
struct rt_serial_device serial01;
|
||||
|
||||
void URT01_IRQHandler(void)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
uartDev = &uartDev01;
|
||||
|
||||
rt_interrupt_enter(); /* enter interrupt */
|
||||
|
||||
// if (uart->uart_device->Interrupt & ((1 << bsUART_TIMEOUT_INTENAB) | (1 << bsUART_RECEIVE_INTENAB))) // RX
|
||||
// {
|
||||
// rt_hw_serial_isr(&serial01, RT_SERIAL_EVENT_RX_IND);
|
||||
// }
|
||||
//
|
||||
// if (uart->uart_device->Interrupt & (1 << bsUART_TRANSMIT_INTENAB)) // TX
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
//
|
||||
// /* clear all interrupt */
|
||||
// uart->uart_device->IntClear = (1 << bsUART_RECEIVE_INTENAB)
|
||||
// | (1 << bsUART_TRANSMIT_INTENAB)
|
||||
// | (1 << bsUART_TIMEOUT_INTENAB);
|
||||
|
||||
rt_interrupt_leave(); /* leave interrupt */
|
||||
}
|
||||
#endif /* RT_USING_UART01 */
|
||||
|
||||
#if RT_USING_UART02
|
||||
struct uart_device uartDev02 =
|
||||
{ // UART02 device driver structure
|
||||
UART2_BASE,
|
||||
IRQ_UATR2_VECTOR
|
||||
};
|
||||
|
||||
struct rt_serial_device serial02;
|
||||
|
||||
void URT02_IRQHandler(void)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
uartDev = &uartDev02;
|
||||
|
||||
rt_interrupt_enter(); /* enter interrupt */
|
||||
|
||||
uartDev = uartDev;
|
||||
|
||||
rt_interrupt_leave(); /* leave interrupt */
|
||||
}
|
||||
#endif /* RT_USING_UART02 */
|
||||
|
||||
void rt_hw_usart_init(void)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
|
||||
#if RT_USING_UART01
|
||||
uart = &uartDev01;
|
||||
config.baud_rate = BAUD_RATE_38400;
|
||||
|
||||
serial01.ops = &__uart_ops;
|
||||
serial01.config = config;
|
||||
|
||||
// set interrupt priority level
|
||||
// disable interrupt
|
||||
|
||||
// register UART01 device
|
||||
rt_hw_serial_register(&serial01, "uart01",
|
||||
RT_DEVICE_FLAG_RDWR /*| RT_DEVICE_FLAG_INT_RX*/,
|
||||
uartDev);
|
||||
#endif /* RT_USING_UART01 */
|
||||
|
||||
#if RT_USING_UART02
|
||||
uartDev = &uartDev02;
|
||||
|
||||
config.baud_rate = BAUD_RATE_38400;
|
||||
serial02.ops = &__uart_ops;
|
||||
serial02.config = config;
|
||||
|
||||
// set interrupt priority level
|
||||
// disable interrupt
|
||||
|
||||
/* register UART02 device */
|
||||
rt_hw_serial_register(&serial02, "uart02",
|
||||
RT_DEVICE_FLAG_RDWR /*| RT_DEVICE_FLAG_INT_RX*/,
|
||||
uartDev);
|
||||
#endif /* RT_USING_UART02 */
|
||||
}
|
||||
|
||||
/*
|
||||
* File : uart_dev.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development 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
|
||||
* 2009-01-05 Bernard the first version
|
||||
* 2010-03-29 Bernard remove interrupt Tx and DMA Rx mode
|
||||
* 2013-05-13 aozima update for kehong-lingtai.
|
||||
*/
|
||||
|
||||
#include "uart/uart.h"
|
||||
#include "uart_dev.h"
|
||||
#include "ae210p.h"
|
||||
#include "board.h"
|
||||
#include "bsp_hal.h"
|
||||
|
||||
#include "rtdevice.h"
|
||||
|
||||
#include "serial.h"
|
||||
|
||||
#define UART_ENABLE_IRQ(n) hal_intc_irq_enable(n)
|
||||
#define UART_DISABLE_IRQ(n) hal_intc_irq_disable(n)
|
||||
|
||||
struct uart_device
|
||||
{
|
||||
uint32_t uart_base;
|
||||
uint32_t irq;
|
||||
};
|
||||
|
||||
static rt_err_t __uart_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
RT_ASSERT(cfg != RT_NULL);
|
||||
|
||||
uartDev = (struct uart_device *)serial->parent.user_data;
|
||||
|
||||
__drv_uart_init(uartDev->uart_base, cfg->baud_rate);
|
||||
|
||||
// todo : enable FIFO threshold, enable rx & rx timeout(threshold) interrupt
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t __uart_control(struct rt_serial_device *serial, int cmd, void *arg)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uartDev = (struct uart_device *)serial->parent.user_data;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case RT_DEVICE_CTRL_CLR_INT: /* disable rx irq */
|
||||
UART_DISABLE_IRQ(uartDev->irq);
|
||||
break;
|
||||
|
||||
case RT_DEVICE_CTRL_SET_INT: /* enable rx irq */
|
||||
UART_ENABLE_IRQ(uartDev->irq);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static int __uart_putc(struct rt_serial_device *serial, char c)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
|
||||
uartDev = (struct uart_device *)serial->parent.user_data;
|
||||
|
||||
__drv_uart_put_char(uartDev->uart_base, c); // Transmit Data
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int __uart_getc(struct rt_serial_device *serial)
|
||||
{
|
||||
int ch = -1;
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uartDev = (struct uart_device *)serial->parent.user_data;
|
||||
|
||||
ch = -1;
|
||||
|
||||
if (__drv_uart_is_kbd_hit(uartDev->uart_base))
|
||||
{
|
||||
ch = __drv_uart_get_char(uartDev->uart_base) & 0x00FF;
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
static const struct rt_uart_ops __uart_ops =
|
||||
{
|
||||
__uart_configure,
|
||||
__uart_control,
|
||||
__uart_putc,
|
||||
__uart_getc,
|
||||
RT_NULL
|
||||
};
|
||||
|
||||
#if RT_USING_UART01
|
||||
struct uart_device uartDev01 =
|
||||
{ // UART01 device driver structure
|
||||
UART1_BASE,
|
||||
IRQ_UART1_VECTOR
|
||||
};
|
||||
|
||||
struct rt_serial_device serial01;
|
||||
|
||||
void URT01_IRQHandler(void)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
uartDev = &uartDev01;
|
||||
|
||||
rt_interrupt_enter(); /* enter interrupt */
|
||||
|
||||
// if (uart->uart_device->Interrupt & ((1 << bsUART_TIMEOUT_INTENAB) | (1 << bsUART_RECEIVE_INTENAB))) // RX
|
||||
// {
|
||||
// rt_hw_serial_isr(&serial01, RT_SERIAL_EVENT_RX_IND);
|
||||
// }
|
||||
//
|
||||
// if (uart->uart_device->Interrupt & (1 << bsUART_TRANSMIT_INTENAB)) // TX
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
//
|
||||
// /* clear all interrupt */
|
||||
// uart->uart_device->IntClear = (1 << bsUART_RECEIVE_INTENAB)
|
||||
// | (1 << bsUART_TRANSMIT_INTENAB)
|
||||
// | (1 << bsUART_TIMEOUT_INTENAB);
|
||||
|
||||
rt_interrupt_leave(); /* leave interrupt */
|
||||
}
|
||||
#endif /* RT_USING_UART01 */
|
||||
|
||||
#if RT_USING_UART02
|
||||
struct uart_device uartDev02 =
|
||||
{ // UART02 device driver structure
|
||||
UART2_BASE,
|
||||
IRQ_UATR2_VECTOR
|
||||
};
|
||||
|
||||
struct rt_serial_device serial02;
|
||||
|
||||
void URT02_IRQHandler(void)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
|
||||
uartDev = &uartDev02;
|
||||
|
||||
rt_interrupt_enter(); /* enter interrupt */
|
||||
|
||||
uartDev = uartDev;
|
||||
|
||||
rt_interrupt_leave(); /* leave interrupt */
|
||||
}
|
||||
#endif /* RT_USING_UART02 */
|
||||
|
||||
void rt_hw_usart_init(void)
|
||||
{
|
||||
struct uart_device *uartDev = RT_NULL;
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
|
||||
#if RT_USING_UART01
|
||||
uart = &uartDev01;
|
||||
config.baud_rate = BAUD_RATE_38400;
|
||||
|
||||
serial01.ops = &__uart_ops;
|
||||
serial01.config = config;
|
||||
|
||||
// set interrupt priority level
|
||||
// disable interrupt
|
||||
|
||||
// register UART01 device
|
||||
rt_hw_serial_register(&serial01, "uart01",
|
||||
RT_DEVICE_FLAG_RDWR /*| RT_DEVICE_FLAG_INT_RX*/,
|
||||
uartDev);
|
||||
#endif /* RT_USING_UART01 */
|
||||
|
||||
#if RT_USING_UART02
|
||||
uartDev = &uartDev02;
|
||||
|
||||
config.baud_rate = BAUD_RATE_38400;
|
||||
serial02.ops = &__uart_ops;
|
||||
serial02.config = config;
|
||||
|
||||
// set interrupt priority level
|
||||
// disable interrupt
|
||||
|
||||
/* register UART02 device */
|
||||
rt_hw_serial_register(&serial02, "uart02",
|
||||
RT_DEVICE_FLAG_RDWR /*| RT_DEVICE_FLAG_INT_RX*/,
|
||||
uartDev);
|
||||
#endif /* RT_USING_UART02 */
|
||||
}
|
||||
|
||||
|
|
|
@ -1,199 +1,199 @@
|
|||
/* RT-Thread config file */
|
||||
#ifndef __RTTHREAD_CFG_H__
|
||||
#define __RTTHREAD_CFG_H__
|
||||
|
||||
/* RT_NAME_MAX*/
|
||||
#define RT_NAME_MAX 8
|
||||
|
||||
/* RT_ALIGN_SIZE*/
|
||||
#define RT_ALIGN_SIZE 4
|
||||
|
||||
/* PRIORITY_MAX */
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
|
||||
/* Tick per Second */
|
||||
#define RT_TICK_PER_SECOND (100)
|
||||
|
||||
/* SECTION: RT_DEBUG */
|
||||
/* Thread Debug */
|
||||
#define RT_DEBUG
|
||||
#define RT_THREAD_DEBUG
|
||||
|
||||
#define RT_USING_OVERFLOW_CHECK
|
||||
|
||||
/* Using Hook */
|
||||
#define RT_USING_HOOK
|
||||
|
||||
/* Using Software Timer */
|
||||
/* #define RT_USING_TIMER_SOFT */
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 512
|
||||
#define RT_TIMER_TICK_PER_SECOND 10
|
||||
|
||||
//#define RT_PRINTF_LONGLONG
|
||||
|
||||
/* SECTION: IPC */
|
||||
/* Using Semaphore*/
|
||||
#define RT_USING_SEMAPHORE
|
||||
|
||||
/* Using Mutex */
|
||||
#define RT_USING_MUTEX
|
||||
|
||||
/* Using Event */
|
||||
#define RT_USING_EVENT
|
||||
|
||||
/* Using MailBox */
|
||||
#define RT_USING_MAILBOX
|
||||
|
||||
/* Using Message Queue */
|
||||
#define RT_USING_MESSAGEQUEUE
|
||||
|
||||
/* SECTION: Memory Management */
|
||||
/* Using Memory Pool Management*/
|
||||
//#define RT_USING_MEMPOOL
|
||||
|
||||
/* Using Dynamic Heap Management */
|
||||
#define RT_USING_HEAP
|
||||
|
||||
/* Using Small MM */
|
||||
#define RT_USING_SMALL_MEM
|
||||
|
||||
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
|
||||
/* SECTION: Device System */
|
||||
/* Using Device System */
|
||||
#define RT_USING_DEVICE
|
||||
// <bool name="RT_USING_DEVICE_IPC" description="Using device communication" default="true" />
|
||||
#define RT_USING_DEVICE_IPC
|
||||
// <bool name="RT_USING_SERIAL" description="Using Serial" default="true" />
|
||||
#define RT_USING_SERIAL
|
||||
|
||||
/* SECTION: Console options */
|
||||
#define RT_USING_CONSOLE
|
||||
//#define RT_KPRINTF
|
||||
/* the buffer size of console*/
|
||||
#define RT_CONSOLEBUF_SIZE 260
|
||||
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" />
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart02"
|
||||
|
||||
/* SECTION: finsh, a C-Express shell */
|
||||
#define RT_USING_FINSH
|
||||
/* Using symbol table */
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
|
||||
/* SECTION: MSH, a bash shell */
|
||||
#define FINSH_USING_MSH
|
||||
#define FINSH_USING_MSH_DEFAULT
|
||||
|
||||
/* SECTION: MXCLI, modified base-on MSH */
|
||||
//#define FINSH_USING_MXCLI
|
||||
|
||||
/* SECTION: device filesystem */
|
||||
//#define RT_USING_DFS
|
||||
//#define DFS_USING_WORKDIR
|
||||
//#define RT_USING_DFS_DEVFS
|
||||
|
||||
//#define RT_USING_DFS_JFFS2
|
||||
/* Reentrancy (thread safe) of the FatFs module. */
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
/* Number of volumes (logical drives) to be used. */
|
||||
#define RT_DFS_ELM_DRIVES 2
|
||||
/* #define RT_DFS_ELM_USE_LFN 1 */
|
||||
/* #define RT_DFS_ELM_CODE_PAGE 936 */
|
||||
#define RT_DFS_ELM_MAX_LFN 255
|
||||
/* Maximum sector size to be handled. */
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
|
||||
|
||||
/* the max number of mounted filesystem */
|
||||
#define DFS_FILESYSTEMS_MAX 2
|
||||
/* the max number of opened files */
|
||||
#define DFS_FD_MAX 4
|
||||
|
||||
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
|
||||
/* #define RT_USING_LWIP */
|
||||
/* LwIP uses RT-Thread Memory Management */
|
||||
#define RT_LWIP_USING_RT_MEM
|
||||
/* Enable ICMP protocol*/
|
||||
#define RT_LWIP_ICMP
|
||||
/* Enable UDP protocol*/
|
||||
#define RT_LWIP_UDP
|
||||
/* Enable TCP protocol*/
|
||||
#define RT_LWIP_TCP
|
||||
/* Enable DNS */
|
||||
#define RT_LWIP_DNS
|
||||
|
||||
/* the number of simulatenously active TCP connections*/
|
||||
#define RT_LWIP_TCP_PCB_NUM 5
|
||||
|
||||
/* Using DHCP */
|
||||
/* #define RT_LWIP_DHCP */
|
||||
|
||||
/* ip address of target*/
|
||||
#define RT_LWIP_IPADDR0 192
|
||||
#define RT_LWIP_IPADDR1 168
|
||||
#define RT_LWIP_IPADDR2 1
|
||||
#define RT_LWIP_IPADDR3 30
|
||||
|
||||
/* gateway address of target*/
|
||||
#define RT_LWIP_GWADDR0 192
|
||||
#define RT_LWIP_GWADDR1 168
|
||||
#define RT_LWIP_GWADDR2 1
|
||||
#define RT_LWIP_GWADDR3 1
|
||||
|
||||
/* mask address of target*/
|
||||
#define RT_LWIP_MSKADDR0 255
|
||||
#define RT_LWIP_MSKADDR1 255
|
||||
#define RT_LWIP_MSKADDR2 255
|
||||
#define RT_LWIP_MSKADDR3 0
|
||||
|
||||
/* tcp thread options */
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 12
|
||||
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 10
|
||||
#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
|
||||
|
||||
/* ethernet if thread options */
|
||||
#define RT_LWIP_ETHTHREAD_PRIORITY 15
|
||||
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 10
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
|
||||
|
||||
/* TCP sender buffer space */
|
||||
#define RT_LWIP_TCP_SND_BUF 8192
|
||||
/* TCP receive window. */
|
||||
#define RT_LWIP_TCP_WND 8192
|
||||
|
||||
/* SECTION: RT-Thread/GUI */
|
||||
/* #define RT_USING_RTGUI */
|
||||
|
||||
/* name length of RTGUI object */
|
||||
#define RTGUI_NAME_MAX 12
|
||||
/* support 16 weight font */
|
||||
#define RTGUI_USING_FONT16
|
||||
/* support Chinese font */
|
||||
#define RTGUI_USING_FONTHZ
|
||||
/* use DFS as file interface */
|
||||
#define RTGUI_USING_DFS_FILERW
|
||||
/* use font file as Chinese font */
|
||||
#define RTGUI_USING_HZ_FILE
|
||||
/* use Chinese bitmap font */
|
||||
#define RTGUI_USING_HZ_BMP
|
||||
/* use small size in RTGUI */
|
||||
#define RTGUI_USING_SMALL_SIZE
|
||||
/* use mouse cursor */
|
||||
/* #define RTGUI_USING_MOUSE_CURSOR */
|
||||
/* default font size in RTGUI */
|
||||
#define RTGUI_DEFAULT_FONT_SIZE 16
|
||||
|
||||
/* image support */
|
||||
/* #define RTGUI_IMAGE_XPM */
|
||||
/* #define RTGUI_IMAGE_BMP */
|
||||
|
||||
// <bool name="RT_USING_CMSIS_OS" description="Using CMSIS OS API" default="true" />
|
||||
// #define RT_USING_CMSIS_OS
|
||||
// <bool name="RT_USING_RTT_CMSIS" description="Using CMSIS in RTT" default="true" />
|
||||
#define RT_USING_RTT_CMSIS
|
||||
// <bool name="RT_USING_BSP_CMSIS" description="Using CMSIS in BSP" default="true" />
|
||||
// #define RT_USING_BSP_CMSIS
|
||||
|
||||
#endif
|
||||
/* RT-Thread config file */
|
||||
#ifndef __RTTHREAD_CFG_H__
|
||||
#define __RTTHREAD_CFG_H__
|
||||
|
||||
/* RT_NAME_MAX*/
|
||||
#define RT_NAME_MAX 8
|
||||
|
||||
/* RT_ALIGN_SIZE*/
|
||||
#define RT_ALIGN_SIZE 4
|
||||
|
||||
/* PRIORITY_MAX */
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
|
||||
/* Tick per Second */
|
||||
#define RT_TICK_PER_SECOND (100)
|
||||
|
||||
/* SECTION: RT_DEBUG */
|
||||
/* Thread Debug */
|
||||
#define RT_DEBUG
|
||||
#define RT_THREAD_DEBUG
|
||||
|
||||
#define RT_USING_OVERFLOW_CHECK
|
||||
|
||||
/* Using Hook */
|
||||
#define RT_USING_HOOK
|
||||
|
||||
/* Using Software Timer */
|
||||
/* #define RT_USING_TIMER_SOFT */
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 512
|
||||
#define RT_TIMER_TICK_PER_SECOND 10
|
||||
|
||||
//#define RT_PRINTF_LONGLONG
|
||||
|
||||
/* SECTION: IPC */
|
||||
/* Using Semaphore*/
|
||||
#define RT_USING_SEMAPHORE
|
||||
|
||||
/* Using Mutex */
|
||||
#define RT_USING_MUTEX
|
||||
|
||||
/* Using Event */
|
||||
#define RT_USING_EVENT
|
||||
|
||||
/* Using MailBox */
|
||||
#define RT_USING_MAILBOX
|
||||
|
||||
/* Using Message Queue */
|
||||
#define RT_USING_MESSAGEQUEUE
|
||||
|
||||
/* SECTION: Memory Management */
|
||||
/* Using Memory Pool Management*/
|
||||
//#define RT_USING_MEMPOOL
|
||||
|
||||
/* Using Dynamic Heap Management */
|
||||
#define RT_USING_HEAP
|
||||
|
||||
/* Using Small MM */
|
||||
#define RT_USING_SMALL_MEM
|
||||
|
||||
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
|
||||
/* SECTION: Device System */
|
||||
/* Using Device System */
|
||||
#define RT_USING_DEVICE
|
||||
// <bool name="RT_USING_DEVICE_IPC" description="Using device communication" default="true" />
|
||||
#define RT_USING_DEVICE_IPC
|
||||
// <bool name="RT_USING_SERIAL" description="Using Serial" default="true" />
|
||||
#define RT_USING_SERIAL
|
||||
|
||||
/* SECTION: Console options */
|
||||
#define RT_USING_CONSOLE
|
||||
//#define RT_KPRINTF
|
||||
/* the buffer size of console*/
|
||||
#define RT_CONSOLEBUF_SIZE 260
|
||||
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" />
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart02"
|
||||
|
||||
/* SECTION: finsh, a C-Express shell */
|
||||
#define RT_USING_FINSH
|
||||
/* Using symbol table */
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
|
||||
/* SECTION: MSH, a bash shell */
|
||||
#define FINSH_USING_MSH
|
||||
#define FINSH_USING_MSH_DEFAULT
|
||||
|
||||
/* SECTION: MXCLI, modified base-on MSH */
|
||||
//#define FINSH_USING_MXCLI
|
||||
|
||||
/* SECTION: device filesystem */
|
||||
//#define RT_USING_DFS
|
||||
//#define DFS_USING_WORKDIR
|
||||
//#define RT_USING_DFS_DEVFS
|
||||
|
||||
//#define RT_USING_DFS_JFFS2
|
||||
/* Reentrancy (thread safe) of the FatFs module. */
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
/* Number of volumes (logical drives) to be used. */
|
||||
#define RT_DFS_ELM_DRIVES 2
|
||||
/* #define RT_DFS_ELM_USE_LFN 1 */
|
||||
/* #define RT_DFS_ELM_CODE_PAGE 936 */
|
||||
#define RT_DFS_ELM_MAX_LFN 255
|
||||
/* Maximum sector size to be handled. */
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
|
||||
|
||||
/* the max number of mounted filesystem */
|
||||
#define DFS_FILESYSTEMS_MAX 2
|
||||
/* the max number of opened files */
|
||||
#define DFS_FD_MAX 4
|
||||
|
||||
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
|
||||
/* #define RT_USING_LWIP */
|
||||
/* LwIP uses RT-Thread Memory Management */
|
||||
#define RT_LWIP_USING_RT_MEM
|
||||
/* Enable ICMP protocol*/
|
||||
#define RT_LWIP_ICMP
|
||||
/* Enable UDP protocol*/
|
||||
#define RT_LWIP_UDP
|
||||
/* Enable TCP protocol*/
|
||||
#define RT_LWIP_TCP
|
||||
/* Enable DNS */
|
||||
#define RT_LWIP_DNS
|
||||
|
||||
/* the number of simulatenously active TCP connections*/
|
||||
#define RT_LWIP_TCP_PCB_NUM 5
|
||||
|
||||
/* Using DHCP */
|
||||
/* #define RT_LWIP_DHCP */
|
||||
|
||||
/* ip address of target*/
|
||||
#define RT_LWIP_IPADDR0 192
|
||||
#define RT_LWIP_IPADDR1 168
|
||||
#define RT_LWIP_IPADDR2 1
|
||||
#define RT_LWIP_IPADDR3 30
|
||||
|
||||
/* gateway address of target*/
|
||||
#define RT_LWIP_GWADDR0 192
|
||||
#define RT_LWIP_GWADDR1 168
|
||||
#define RT_LWIP_GWADDR2 1
|
||||
#define RT_LWIP_GWADDR3 1
|
||||
|
||||
/* mask address of target*/
|
||||
#define RT_LWIP_MSKADDR0 255
|
||||
#define RT_LWIP_MSKADDR1 255
|
||||
#define RT_LWIP_MSKADDR2 255
|
||||
#define RT_LWIP_MSKADDR3 0
|
||||
|
||||
/* tcp thread options */
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 12
|
||||
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 10
|
||||
#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
|
||||
|
||||
/* ethernet if thread options */
|
||||
#define RT_LWIP_ETHTHREAD_PRIORITY 15
|
||||
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 10
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
|
||||
|
||||
/* TCP sender buffer space */
|
||||
#define RT_LWIP_TCP_SND_BUF 8192
|
||||
/* TCP receive window. */
|
||||
#define RT_LWIP_TCP_WND 8192
|
||||
|
||||
/* SECTION: RT-Thread/GUI */
|
||||
/* #define RT_USING_RTGUI */
|
||||
|
||||
/* name length of RTGUI object */
|
||||
#define RTGUI_NAME_MAX 12
|
||||
/* support 16 weight font */
|
||||
#define RTGUI_USING_FONT16
|
||||
/* support Chinese font */
|
||||
#define RTGUI_USING_FONTHZ
|
||||
/* use DFS as file interface */
|
||||
#define RTGUI_USING_DFS_FILERW
|
||||
/* use font file as Chinese font */
|
||||
#define RTGUI_USING_HZ_FILE
|
||||
/* use Chinese bitmap font */
|
||||
#define RTGUI_USING_HZ_BMP
|
||||
/* use small size in RTGUI */
|
||||
#define RTGUI_USING_SMALL_SIZE
|
||||
/* use mouse cursor */
|
||||
/* #define RTGUI_USING_MOUSE_CURSOR */
|
||||
/* default font size in RTGUI */
|
||||
#define RTGUI_DEFAULT_FONT_SIZE 16
|
||||
|
||||
/* image support */
|
||||
/* #define RTGUI_IMAGE_XPM */
|
||||
/* #define RTGUI_IMAGE_BMP */
|
||||
|
||||
// <bool name="RT_USING_CMSIS_OS" description="Using CMSIS OS API" default="true" />
|
||||
// #define RT_USING_CMSIS_OS
|
||||
// <bool name="RT_USING_RTT_CMSIS" description="Using CMSIS in RTT" default="true" />
|
||||
#define RT_USING_RTT_CMSIS
|
||||
// <bool name="RT_USING_BSP_CMSIS" description="Using CMSIS in BSP" default="true" />
|
||||
// #define RT_USING_BSP_CMSIS
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,113 +1,113 @@
|
|||
/*
|
||||
* 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://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-08-31 Bernard first implementation
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
#include <components.h>
|
||||
#endif /* RT_USING_COMPONENTS_INIT */
|
||||
|
||||
#include "board.h"
|
||||
|
||||
extern int rt_application_init(void); // define in application/application.c
|
||||
|
||||
#ifdef __CC_ARM
|
||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||
#elif __ICCARM__
|
||||
#pragma section="HEAP"
|
||||
#else
|
||||
extern int __bss_end;
|
||||
extern int _stack;
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : assert_failed
|
||||
* Description : Reports the name of the source file and the source line number
|
||||
* where the assert error has occurred.
|
||||
* Input : - file: pointer to the source file name
|
||||
* - line: assert error line source number
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void assert_failed(char* file, int line)
|
||||
{
|
||||
rt_kprintf("\n\r Wrong parameter value detected on\r\n");
|
||||
rt_kprintf(" file %s\r\n", file);
|
||||
rt_kprintf(" line %d\r\n", line);
|
||||
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will startup RT-Thread RTOS.
|
||||
*/
|
||||
void rtthread_startup(void)
|
||||
{
|
||||
/* show version */
|
||||
rt_show_version();
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
#if STM32_EXT_SRAM
|
||||
rt_system_heap_init((void*)STM32_EXT_SRAM_BEGIN, (void*)STM32_EXT_SRAM_END);
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)MXT_IRAM_END);
|
||||
#elif __ICCARM__
|
||||
rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
|
||||
#else
|
||||
/* init memory system */
|
||||
rt_system_heap_init((void *)0x00250000, (void *)0x00280000);
|
||||
#endif
|
||||
#endif /* STM32_EXT_SRAM */
|
||||
#endif /* RT_USING_HEAP */
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
rt_components_board_init();
|
||||
#endif
|
||||
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
/* initialize timer */
|
||||
rt_system_timer_init();
|
||||
|
||||
/* init timer thread */
|
||||
rt_system_timer_thread_init();
|
||||
|
||||
/* init application */
|
||||
rt_application_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;
|
||||
//}
|
||||
|
||||
/*@}*/
|
||||
/*
|
||||
* 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://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-08-31 Bernard first implementation
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
#include <components.h>
|
||||
#endif /* RT_USING_COMPONENTS_INIT */
|
||||
|
||||
#include "board.h"
|
||||
|
||||
extern int rt_application_init(void); // define in application/application.c
|
||||
|
||||
#ifdef __CC_ARM
|
||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||
#elif __ICCARM__
|
||||
#pragma section="HEAP"
|
||||
#else
|
||||
extern int __bss_end;
|
||||
extern int _stack;
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : assert_failed
|
||||
* Description : Reports the name of the source file and the source line number
|
||||
* where the assert error has occurred.
|
||||
* Input : - file: pointer to the source file name
|
||||
* - line: assert error line source number
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void assert_failed(char* file, int line)
|
||||
{
|
||||
rt_kprintf("\n\r Wrong parameter value detected on\r\n");
|
||||
rt_kprintf(" file %s\r\n", file);
|
||||
rt_kprintf(" line %d\r\n", line);
|
||||
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will startup RT-Thread RTOS.
|
||||
*/
|
||||
void rtthread_startup(void)
|
||||
{
|
||||
/* show version */
|
||||
rt_show_version();
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
#if STM32_EXT_SRAM
|
||||
rt_system_heap_init((void*)STM32_EXT_SRAM_BEGIN, (void*)STM32_EXT_SRAM_END);
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)MXT_IRAM_END);
|
||||
#elif __ICCARM__
|
||||
rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
|
||||
#else
|
||||
/* init memory system */
|
||||
rt_system_heap_init((void *)0x00250000, (void *)0x00280000);
|
||||
#endif
|
||||
#endif /* STM32_EXT_SRAM */
|
||||
#endif /* RT_USING_HEAP */
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
rt_components_board_init();
|
||||
#endif
|
||||
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
/* initialize timer */
|
||||
rt_system_timer_init();
|
||||
|
||||
/* init timer thread */
|
||||
rt_system_timer_thread_init();
|
||||
|
||||
/* init application */
|
||||
rt_application_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;
|
||||
//}
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
** ###################################################################
|
||||
** Processors: LPC54608J512BD208
|
||||
** LPC54608J512ET180
|
||||
**
|
||||
** Compiler: IAR ANSI C/C++ Compiler for ARM
|
||||
** Reference manual: LPC54S60x/LPC5460x User manual Rev.0.9 7 Nov 2016
|
||||
** Version: rev. 1.1, 2016-11-25
|
||||
** Build: b161227
|
||||
**
|
||||
** Abstract:
|
||||
** Linker file for the IAR ANSI C/C++ Compiler for ARM
|
||||
**
|
||||
** Copyright (c) 2016 Freescale Semiconductor, Inc.
|
||||
** Copyright 2016 - 2017 NXP
|
||||
** Redistribution and use in source and binary forms, with or without modification,
|
||||
** are permitted provided that the following conditions are met:
|
||||
**
|
||||
** o Redistributions of source code must retain the above copyright notice, this list
|
||||
** of conditions and the following disclaimer.
|
||||
**
|
||||
** o Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** list of conditions and the following disclaimer in the documentation and/or
|
||||
** other materials provided with the distribution.
|
||||
**
|
||||
** o Neither the name of the copyright holder nor the names of its
|
||||
** contributors may be used to endorse or promote products derived from this
|
||||
** software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
** http: www.nxp.com
|
||||
** mail: support@nxp.com
|
||||
**
|
||||
** ###################################################################
|
||||
*/
|
||||
|
||||
define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000400 : 0;
|
||||
define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x000003FF : 0;
|
||||
|
||||
define symbol m_interrupts_start = 0x00000000;
|
||||
define symbol m_interrupts_end = 0x000003FF;
|
||||
|
||||
define symbol m_text_start = 0x00000400;
|
||||
define symbol m_text_end = 0x0007FFFF;
|
||||
|
||||
define symbol m_interrupts_ram_start = 0x20000000;
|
||||
define symbol m_interrupts_ram_end = 0x20000000 + __ram_vector_table_offset__;
|
||||
|
||||
define symbol m_data_start = m_interrupts_ram_start + __ram_vector_table_size__;
|
||||
define symbol m_data_end = 0x20027FFF;
|
||||
|
||||
define symbol m_usb_sram_start = 0x40100000;
|
||||
define symbol m_usb_sram_end = 0x40101FFF;
|
||||
|
||||
/* USB BDT size */
|
||||
define symbol usb_bdt_size = 0x0;
|
||||
/* Sizes */
|
||||
if (isdefinedsymbol(__stack_size__)) {
|
||||
define symbol __size_cstack__ = __stack_size__;
|
||||
} else {
|
||||
define symbol __size_cstack__ = 0x0400;
|
||||
}
|
||||
|
||||
if (isdefinedsymbol(__heap_size__)) {
|
||||
define symbol __size_heap__ = __heap_size__;
|
||||
} else {
|
||||
define symbol __size_heap__ = 0x0400;
|
||||
}
|
||||
|
||||
define exported symbol __VECTOR_TABLE = m_interrupts_start;
|
||||
define exported symbol __VECTOR_RAM = isdefinedsymbol(__ram_vector_table__) ? m_interrupts_ram_start : m_interrupts_start;
|
||||
define exported symbol __RAM_VECTOR_TABLE_SIZE = __ram_vector_table_size__;
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region TEXT_region = mem:[from m_interrupts_start to m_interrupts_end]
|
||||
| mem:[from m_text_start to m_text_end];
|
||||
define region DATA_region = mem:[from m_data_start to m_data_end-__size_cstack__];
|
||||
define region CSTACK_region = mem:[from m_data_end-__size_cstack__+1 to m_data_end];
|
||||
define region m_interrupts_ram_region = mem:[from m_interrupts_ram_start to m_interrupts_ram_end];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __size_heap__ { };
|
||||
define block RW { readwrite };
|
||||
define block ZI { zi };
|
||||
define block RTT_INIT_FUNC with fixed order { readonly section .rti_fn* };
|
||||
|
||||
/* regions for USB */
|
||||
define region USB_BDT_region = mem:[from m_usb_sram_start to m_usb_sram_start + usb_bdt_size - 1];
|
||||
define region USB_SRAM_region = mem:[from m_usb_sram_start + usb_bdt_size to m_usb_sram_end];
|
||||
place in USB_BDT_region { section m_usb_bdt };
|
||||
place in USB_SRAM_region { section m_usb_global };
|
||||
|
||||
initialize by copy { readwrite, section .textrw };
|
||||
|
||||
if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
|
||||
{
|
||||
/* Required in a multi-threaded application */
|
||||
initialize by copy with packing = none { section __DLIB_PERTHREAD };
|
||||
}
|
||||
|
||||
do not initialize { section .noinit, section m_usb_bdt, section m_usb_global };
|
||||
|
||||
keep { section FSymTab };
|
||||
keep { section VSymTab };
|
||||
keep { section .rti_fn* };
|
||||
keep { section RTMSymTab };
|
||||
|
||||
place at address mem: m_interrupts_start { readonly section .intvec };
|
||||
place in TEXT_region { readonly, block RTT_INIT_FUNC };
|
||||
place in DATA_region { block RW , block ZI, block CSTACK, last block HEAP};
|
||||
place in m_interrupts_ram_region { section m_interrupts_ram };
|
||||
|
|
@ -6,6 +6,12 @@ cwd = os.path.join(str(Dir('#')), 'applications')
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd, str(Dir('#'))]
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
# add for startup script
|
||||
if rtconfig.CROSS_TOOL == 'iar':
|
||||
CPPDEFINES = ['_TIMESPEC_DEFINED']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -41,7 +41,7 @@ void rtthread_startup(void)
|
|||
rt_show_version();
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
#if LPC_EXT_SDRAM
|
||||
#ifdef BSP_DRV_SDRAM
|
||||
rt_kprintf(" heap: [0x%08x - 0x%08x]\n", LPC_EXT_SDRAM_BEGIN, LPC_EXT_SDRAM_END);
|
||||
rt_system_heap_init((void *)LPC_EXT_SDRAM_BEGIN, (void *)LPC_EXT_SDRAM_END);
|
||||
sram_init();
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* File : application.c
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-11-14 Tanek porting from stm32f429-apollo
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include <LPC54608.h>
|
||||
|
||||
#define DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#define MPU_PRINT(...) rt_kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define MPU_PRINT((...))
|
||||
#endif
|
||||
|
||||
/* initialize for gui driver */
|
||||
int rt_hw_mpu_init(void)
|
||||
{
|
||||
uint32_t rbar;
|
||||
uint32_t rasr;
|
||||
|
||||
MPU_PRINT("\nnumber of regions: %d\n", (MPU->TYPE & MPU_TYPE_DREGION_Msk) >> MPU_TYPE_DREGION_Pos);
|
||||
|
||||
/* Disable MPU */
|
||||
ARM_MPU_Disable();
|
||||
|
||||
/* - Region 0: 0x00000000 - 0x0007FFFF --- on-chip non-volatile memory
|
||||
* + Size: 512kB
|
||||
* + Acess permission: full access
|
||||
*/
|
||||
rbar = ARM_MPU_RBAR(0, 0x00000000);
|
||||
rasr = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512KB);
|
||||
ARM_MPU_SetRegion(rbar, rasr);
|
||||
|
||||
/* - Region 1:0x20000000 - 0x20027FFF --- on chip SRAM
|
||||
* + Size: 160kB
|
||||
* + Access permission: full access
|
||||
*/
|
||||
rbar = ARM_MPU_RBAR(1, 0x20000000);
|
||||
rasr = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_256KB);
|
||||
ARM_MPU_SetRegion(rbar, rasr);
|
||||
|
||||
/* - Region 2: 0x40000000 - 0x43FFFFFF --- APB peripheral
|
||||
* + Size: 64MB
|
||||
* + Access permission: full access
|
||||
*/
|
||||
rbar = ARM_MPU_RBAR(2, 0x40000000);
|
||||
rasr = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_64MB);
|
||||
ARM_MPU_SetRegion(rbar, rasr);
|
||||
|
||||
/* - Region 3: 0xA0000000 - 0xA0800000 --- External SDRAM
|
||||
* + Size: 8MB
|
||||
* + AP=b011: full access
|
||||
*/
|
||||
rbar = ARM_MPU_RBAR(3, 0xA0000000);
|
||||
rasr = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_8MB);
|
||||
ARM_MPU_SetRegion(rbar, rasr);
|
||||
|
||||
/* - Region 4: 0xE0000000 - 0xE00FFFFF --- System control
|
||||
* + Size: 1MB
|
||||
* + Access permission: full access
|
||||
*/
|
||||
rbar = ARM_MPU_RBAR(4, 0xE0000000);
|
||||
rasr = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1MB);
|
||||
ARM_MPU_SetRegion(rbar, rasr);
|
||||
|
||||
ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_BOARD_EXPORT(rt_hw_mpu_init);
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* File : application.c
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-11-14 Tanek the first version
|
||||
*/
|
||||
|
||||
#ifndef __DRV_MPU_H__
|
||||
#define __DRV_MPU_H__
|
||||
|
||||
void rt_hw_mpu_init(void);
|
||||
|
||||
#endif
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <rtthread.h>
|
||||
|
||||
#if LPC_EXT_SDRAM
|
||||
#ifdef BSP_DRV_SDRAM
|
||||
struct rt_memheap system_heap;
|
||||
|
||||
void sram_init(void)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue