提交 aea59143 编写于 作者: D dzzxzz@gmail.com

update mini4020 project

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2185 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 594ccd79
import rtconfig
Import('RTT_ROOT')
from building import * from building import *
src = Glob('*.c') cwd = GetCurrentDir()
CPPPATH = [RTT_ROOT + '/bsp/mini4020'] objs = []
group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH) list = os.listdir(cwd)
Return('group') for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd, str(Dir('#'))]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
/* /*
* File : application.c * File : application.c
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
*/ */
/** /**
* @addtogroup mini2440 * @addtogroup mini4020
*/ */
/*@{*/ /*@{*/
#include <board.h> #include <board.h>
...@@ -27,13 +28,15 @@ ...@@ -27,13 +28,15 @@
#include <dfs_fs.h> #include <dfs_fs.h>
#include <dfs_posix.h> #include <dfs_posix.h>
#endif #endif
#ifdef RT_USING_RTGUI #ifdef RT_USING_RTGUI
#include <rtgui/rtgui.h> #include <rtgui/rtgui.h>
extern void radio_rtgui_init(void); extern void radio_rtgui_init(void);
#endif #endif
#define RT_INIT_THREAD_STACK_SIZE (2*1024) #define RT_INIT_THREAD_STACK_SIZE (2*1024)
void rt_init_thread_entry(void* parameter) void rt_init_thread_entry(void *parameter)
{ {
int fd; int fd;
rt_uint32_t sz; rt_uint32_t sz;
...@@ -57,21 +60,21 @@ void rt_init_thread_entry(void* parameter) ...@@ -57,21 +60,21 @@ void rt_init_thread_entry(void* parameter)
sz = write(fd,"Hello RT-Thread!",sizeof("Hello RT-Thread!")); sz = write(fd,"Hello RT-Thread!",sizeof("Hello RT-Thread!"));
if(sz!=0) if (sz != 0)
{ {
rt_kprintf("written %d\n",sz); rt_kprintf("written %d\n",sz);
} }
else else
rt_kprintf("haven't written\n"); rt_kprintf("haven't written\n");
lseek(fd,0,SEEK_SET); lseek(fd, 0, SEEK_SET);
sz = read(fd,buffer,sizeof(buffer)); sz = read(fd, buffer, sizeof(buffer));
if(sz!=0) if (sz != 0)
{ {
rt_kprintf("READ %d:",sz); rt_kprintf("READ %d:",sz);
while(sz--) while (sz--)
rt_kprintf("%c",buffer[sz]);//opposite rt_kprintf("%c",buffer[sz]);//opposite
rt_kprintf("\n"); rt_kprintf("\n");
} }
...@@ -86,9 +89,9 @@ void rt_init_thread_entry(void* parameter) ...@@ -86,9 +89,9 @@ void rt_init_thread_entry(void* parameter)
#endif #endif
} }
void rt_led_thread_entry(void* parameter) void rt_led_thread_entry(void *parameter)
{ {
/* /*
while (1) while (1)
{ {
count++; count++;
...@@ -103,12 +106,11 @@ void rt_led_thread_entry(void* parameter) ...@@ -103,12 +106,11 @@ void rt_led_thread_entry(void* parameter)
} }
int rt_application_init() int rt_application_init(void)
{ {
rt_thread_t init_thread; rt_thread_t init_thread;
rt_thread_t led_thread; rt_thread_t led_thread;
init_thread = rt_thread_create("init", init_thread = rt_thread_create("init",
rt_init_thread_entry, RT_NULL, rt_init_thread_entry, RT_NULL,
RT_INIT_THREAD_STACK_SIZE, 8, 20); RT_INIT_THREAD_STACK_SIZE, 8, 20);
...@@ -121,6 +123,7 @@ int rt_application_init() ...@@ -121,6 +123,7 @@ int rt_application_init()
if (led_thread != RT_NULL) if (led_thread != RT_NULL)
rt_thread_startup(led_thread); rt_thread_startup(led_thread);
return 0; return 0;
} }
......
/*
* File : application.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012, 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
*/
#include <rthw.h> #include <rthw.h>
#include <rtthread.h> #include <rtthread.h>
......
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
# remove no need file.
if GetDepend('RT_USING_LWIP') == False:
SrcRemove(src, 'dm9161.c')
if GetDepend('RT_USING_DFS') == False:
SrcRemove(src, 'sdcard.c')
if GetDepend('RT_USING_RTGUI') == False:
SrcRemove(src, 'lcd.c')
SrcRemove(src, 'lcdc.c')
CPPPATH = [cwd]
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
/* /*
* File : board.c * File : board.c
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2009 RT-Thread Develop Team * COPYRIGHT (C) 2006 - 2012 RT-Thread Develop Team
* *
* The license and distribution terms for this file may be * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
* 2009-05-16 Bernard first implementation * 2009-05-16 Bernard first implementation
* 2010-10-5 Wangmeng sep4020 implementation * 2010-10-5 Wangmeng sep4020 implementation
*/ */
#include <rthw.h> #include <rthw.h>
#include <rtthread.h> #include <rtthread.h>
...@@ -30,7 +31,6 @@ struct serial_device uart0 = ...@@ -30,7 +31,6 @@ struct serial_device uart0 =
RT_NULL RT_NULL
}; };
/** /**
* This function will handle rtos timer * This function will handle rtos timer
*/ */
...@@ -41,7 +41,7 @@ void rt_timer_handler(int vector) ...@@ -41,7 +41,7 @@ void rt_timer_handler(int vector)
/*Clear timer interrupt*/ /*Clear timer interrupt*/
clear_int = *(RP)TIMER_T1ISCR; clear_int = *(RP)TIMER_T1ISCR;
*(RP)TIMER_T1ISCR=clear_int; *(RP)TIMER_T1ISCR=clear_int;
} }
/** /**
...@@ -50,15 +50,13 @@ void rt_timer_handler(int vector) ...@@ -50,15 +50,13 @@ void rt_timer_handler(int vector)
void rt_serial_handler(int vector) void rt_serial_handler(int vector)
{ {
//rt_kprintf("in rt_serial_handler\n"); //rt_kprintf("in rt_serial_handler\n");
rt_int32_t stat = *(RP)UART0_IIR ; rt_int32_t stat = *(RP)UART0_IIR ;
UNUSED char c; UNUSED char c;
/*Received data*/ /*Received data*/
if(((stat & 0x0E) >> 1) == 0x02) if (((stat & 0x0E) >> 1) == 0x02)
{ {
rt_hw_serial_isr(&uart0_device);
rt_hw_serial_isr(&uart0_device);
} }
else else
{ {
...@@ -67,6 +65,7 @@ void rt_serial_handler(int vector) ...@@ -67,6 +65,7 @@ void rt_serial_handler(int vector)
c = uart0.uart_device->dlbl_fifo.rxfifo; c = uart0.uart_device->dlbl_fifo.rxfifo;
} }
} }
/** /**
* This function will init led on the board * This function will init led on the board
*/ */
...@@ -82,10 +81,10 @@ static void rt_hw_board_led_init(void) ...@@ -82,10 +81,10 @@ static void rt_hw_board_led_init(void)
/** /**
* This function will init timer4 for system ticks * This function will init timer4 for system ticks
*/ */
void rt_hw_timer_init() void rt_hw_timer_init(void)
{ {
/*Set timer1*/ /*Set timer1*/
*(RP)TIMER_T1LCR = 880000; *(RP)TIMER_T1LCR = 880000;
*(RP)TIMER_T1CR = 0x06; *(RP)TIMER_T1CR = 0x06;
rt_hw_interrupt_install(INTSRC_TIMER1, rt_timer_handler, RT_NULL); rt_hw_interrupt_install(INTSRC_TIMER1, rt_timer_handler, RT_NULL);
...@@ -93,7 +92,7 @@ static void rt_hw_board_led_init(void) ...@@ -93,7 +92,7 @@ static void rt_hw_board_led_init(void)
/*Enable timer1*/ /*Enable timer1*/
*(RP)TIMER_T1CR |= 0x01; *(RP)TIMER_T1CR |= 0x01;
} }
/** /**
* This function will handle init uart * This function will handle init uart
...@@ -128,9 +127,9 @@ void rt_hw_uart_init(void) ...@@ -128,9 +127,9 @@ void rt_hw_uart_init(void)
&uart0); &uart0);
} }
void rt_hw_board_init() void rt_hw_board_init(void)
{ {
/* initialize uart */ /* initialize uart */
rt_hw_uart_init(); rt_hw_uart_init();
// rt_hw_board_led_init(); // rt_hw_board_led_init();
rt_hw_timer_init(); rt_hw_timer_init();
...@@ -143,9 +142,11 @@ void rt_hw_serial_putc(const char c) ...@@ -143,9 +142,11 @@ void rt_hw_serial_putc(const char c)
to be polite with serial console add a line feed to be polite with serial console add a line feed
to the carriage return character to the carriage return character
*/ */
if (c=='\n')rt_hw_serial_putc('\r'); if (c=='\n')
rt_hw_serial_putc('\r');
while (!((*(RP)UART0_LSR) & 0x40)); while (!((*(RP)UART0_LSR) & 0x40));
*(RP)(UART0_BASE) = c; *(RP)(UART0_BASE) = c;
} }
...@@ -154,7 +155,7 @@ void rt_hw_serial_putc(const char c) ...@@ -154,7 +155,7 @@ void rt_hw_serial_putc(const char c)
* *
* @param str the displayed string * @param str the displayed string
*/ */
void rt_hw_console_output(const char* str) void rt_hw_console_output(const char *str)
{ {
while (*str) while (*str)
{ {
......
/* /*
* File : board.h * File : board.h
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Develop Team * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
......
/*
* File : dm9161.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012, 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
*/
#include <rtthread.h> #include <rtthread.h>
#include <netif/ethernetif.h> #include <netif/ethernetif.h>
...@@ -73,16 +86,18 @@ void rt_dm9161_isr(int irqno); ...@@ -73,16 +86,18 @@ void rt_dm9161_isr(int irqno);
static void udelay(unsigned long ns) static void udelay(unsigned long ns)
{ {
unsigned long i; unsigned long i;
while(ns--)
while (ns--)
{ {
i = 100; i = 100;
while(i--); while (i--);
} }
} }
static __inline unsigned long sep_emac_read(unsigned int reg) static __inline unsigned long sep_emac_read(unsigned int reg)
{ {
void __iomem *emac_base = (void __iomem *)reg; void __iomem *emac_base = (void __iomem *)reg;
return read_reg(emac_base); return read_reg(emac_base);
} }
...@@ -106,9 +121,10 @@ static __inline void sep_emac_write(unsigned int reg, unsigned long value) ...@@ -106,9 +121,10 @@ static __inline void sep_emac_write(unsigned int reg, unsigned long value)
static void enable_mdi(void) //need think more static void enable_mdi(void) //need think more
{ {
unsigned long ctl; unsigned long ctl;
ctl = sep_emac_read(MAC_CTRL); ctl = sep_emac_read(MAC_CTRL);
sep_emac_write(MAC_CTRL, ctl&(~0x3)); /* enable management port */ sep_emac_write(MAC_CTRL, ctl&(~0x3)); /* enable management port */
return; return;
} }
...@@ -121,6 +137,7 @@ static void disable_mdi(void) ...@@ -121,6 +137,7 @@ static void disable_mdi(void)
ctl = sep_emac_read(MAC_CTRL); ctl = sep_emac_read(MAC_CTRL);
sep_emac_write(MAC_CTRL, ctl|(0x3)); /* disable management port */ sep_emac_write(MAC_CTRL, ctl|(0x3)); /* disable management port */
return; return;
} }
...@@ -140,6 +157,7 @@ static __inline void sep_phy_wait(void) ...@@ -140,6 +157,7 @@ static __inline void sep_phy_wait(void)
break; break;
} }
} }
return; return;
} }
...@@ -158,6 +176,7 @@ static void write_phy(unsigned char phy_addr, unsigned char address, unsigned in ...@@ -158,6 +176,7 @@ static void write_phy(unsigned char phy_addr, unsigned char address, unsigned in
udelay(40); udelay(40);
sep_phy_wait(); sep_phy_wait();
return; return;
} }
...@@ -177,37 +196,35 @@ static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int ...@@ -177,37 +196,35 @@ static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int
mii_rxdata = sep_emac_read(MAC_MII_RXDATA); mii_rxdata = sep_emac_read(MAC_MII_RXDATA);
*value = mii_rxdata; *value = mii_rxdata;
return;
}
return;
}
/* interrupt service routine */ /* interrupt service routine */
void rt_dm9161_isr(int irqno) void rt_dm9161_isr(int irqno)
{ {
unsigned long intstatus; unsigned long intstatus;
rt_uint32_t address; rt_uint32_t address;
mask_irq(INTSRC_MAC); mask_irq(INTSRC_MAC);
intstatus = sep_emac_read(MAC_INTSRC); intstatus = sep_emac_read(MAC_INTSRC);
sep_emac_write(MAC_INTSRC,intstatus); sep_emac_write(MAC_INTSRC,intstatus);
/*Receive complete*/ /*Receive complete*/
if(intstatus & 0x04) if(intstatus & 0x04)
{ {
eth_device_ready(&(dm9161_device.parent)); eth_device_ready(&(dm9161_device.parent));
} }
/*Receive error*/ /*Receive error*/
else if(intstatus & 0x08) else if(intstatus & 0x08)
{ {
rt_kprintf("Receive error\n"); rt_kprintf("Receive error\n");
} }
/*Transmit complete*/ /*Transmit complete*/
else if(intstatus & 0x03) else if(intstatus & 0x03)
{ {
if(dm9161_device.tx_index == 0) if(dm9161_device.tx_index == 0)
address = (MAC_TX_BD +(MAX_TX_DESCR-2)*8); address = (MAC_TX_BD +(MAX_TX_DESCR-2)*8);
else if(dm9161_device.tx_index == 1) else if(dm9161_device.tx_index == 1)
address = (MAC_TX_BD +(MAX_TX_DESCR-1)*8); address = (MAC_TX_BD +(MAX_TX_DESCR-1)*8);
...@@ -215,12 +232,11 @@ void rt_dm9161_isr(int irqno) ...@@ -215,12 +232,11 @@ void rt_dm9161_isr(int irqno)
address = (MAC_TX_BD + dm9161_device.tx_index*8-16); address = (MAC_TX_BD + dm9161_device.tx_index*8-16);
//printk("free tx skb 0x%x in inter!!\n",lp->txBuffIndex); //printk("free tx skb 0x%x in inter!!\n",lp->txBuffIndex);
sep_emac_write(address,0x0); sep_emac_write(address,0x0);
} }
else if (intstatus & 0x10) else if (intstatus & 0x10)
{ {
rt_kprintf("ROVER ERROR\n"); rt_kprintf("ROVER ERROR\n");
}
}
while(intstatus) while(intstatus)
{ {
...@@ -229,7 +245,6 @@ void rt_dm9161_isr(int irqno) ...@@ -229,7 +245,6 @@ void rt_dm9161_isr(int irqno)
} }
unmask_irq(INTSRC_MAC); unmask_irq(INTSRC_MAC);
} }
static rt_err_t update_mac_address() static rt_err_t update_mac_address()
...@@ -249,15 +264,15 @@ static rt_err_t update_mac_address() ...@@ -249,15 +264,15 @@ static rt_err_t update_mac_address()
return RT_EOK; return RT_EOK;
} }
static int mii_link_ok (unsigned long phy_id) static int mii_link_ok(unsigned long phy_id)
{ {
/* first, a dummy read, needed to latch some MII phys */ /* first, a dummy read, needed to latch some MII phys */
unsigned int value; unsigned int value;
read_phy(phy_id, MII_BMSR,&value); read_phy(phy_id, MII_BMSR,&value);
if (value & BMSR_LSTATUS) if (value & BMSR_LSTATUS)
return 1; return 1;
return 0; return 0;
} }
...@@ -266,7 +281,7 @@ static void update_link_speed(unsigned short phy_addr) ...@@ -266,7 +281,7 @@ static void update_link_speed(unsigned short phy_addr)
unsigned int bmsr, bmcr, lpa, mac_cfg; unsigned int bmsr, bmcr, lpa, mac_cfg;
unsigned int speed, duplex; unsigned int speed, duplex;
if(!mii_link_ok(phy_addr)) if (!mii_link_ok(phy_addr))
{ {
EOUT("Link Down\n"); EOUT("Link Down\n");
//goto result; //goto result;
...@@ -296,9 +311,9 @@ static void update_link_speed(unsigned short phy_addr) ...@@ -296,9 +311,9 @@ static void update_link_speed(unsigned short phy_addr)
{ {
speed = (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10; speed = (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10;
duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF; duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF;
} }
/* Update the MAC */ /* Update the MAC */
mac_cfg = sep_emac_read(MAC_CTRL); mac_cfg = sep_emac_read(MAC_CTRL);
if (speed == SPEED_100) if (speed == SPEED_100)
{ {
...@@ -326,6 +341,7 @@ static void update_link_speed(unsigned short phy_addr) ...@@ -326,6 +341,7 @@ static void update_link_speed(unsigned short phy_addr)
result: result:
mac_cfg = sep_emac_read(MAC_CTRL); mac_cfg = sep_emac_read(MAC_CTRL);
DBOUT("After mac_cfg=%d\n",mac_cfg); DBOUT("After mac_cfg=%d\n",mac_cfg);
return; return;
} }
...@@ -380,58 +396,55 @@ static rt_err_t rt_dm9161_init(rt_device_t dev) ...@@ -380,58 +396,55 @@ static rt_err_t rt_dm9161_init(rt_device_t dev)
rt_dm9161_open(dev,0); rt_dm9161_open(dev,0);
return RT_EOK; return RT_EOK;
} }
/* ................................ MAC ................................ */ /* ................................ MAC ................................ */
/* /*
* Initialize and start the Receiver and Transmit subsystems * Initialize and start the Receiver and Transmit subsystems
*/ */
static void sepether_start() static void sepether_start(void)
{ {
int i; int i;
unsigned int tempaddr; unsigned int tempaddr;
sep_emac_write(MAC_TXBD_NUM,MAX_TX_DESCR); sep_emac_write(MAC_TXBD_NUM,MAX_TX_DESCR);
//初始化发送和接收描述符 //初始化发送和接收描述符
for (i = 0; i < MAX_TX_DESCR; i++) for (i = 0; i < MAX_TX_DESCR; i++)
{ {
tempaddr=(MAC_TX_BD+i*8); tempaddr=(MAC_TX_BD+i*8);
sep_emac_write(tempaddr,0); sep_emac_write(tempaddr,0);
tempaddr=(MAC_TX_BD+i*8+4); tempaddr=(MAC_TX_BD+i*8+4);
sep_emac_write(tempaddr,0); sep_emac_write(tempaddr,0);
} }
for (i = 0; i < MAX_RX_DESCR; i++) for (i = 0; i < MAX_RX_DESCR; i++)
{ {
tempaddr=(MAC_TX_BD + MAX_TX_DESCR*8+i*8); tempaddr=(MAC_TX_BD + MAX_TX_DESCR*8+i*8);
sep_emac_write(tempaddr,0); sep_emac_write(tempaddr,0);
tempaddr=(MAC_TX_BD + MAX_TX_DESCR*8+i*8+4); tempaddr=(MAC_TX_BD + MAX_TX_DESCR*8+i*8+4);
sep_emac_write(tempaddr,0); sep_emac_write(tempaddr,0);
} }
for (i = 0; i < MAX_RX_DESCR; i++) for (i = 0; i < MAX_RX_DESCR; i++)
{ {
tempaddr=(MAC_TX_BD + MAX_TX_DESCR*8+i*8); tempaddr=(MAC_TX_BD + MAX_TX_DESCR*8+i*8);
sep_emac_write(tempaddr,0xc000); sep_emac_write(tempaddr,0xc000);
tempaddr=(MAC_TX_BD + MAX_TX_DESCR*8+i*8+4); tempaddr=(MAC_TX_BD + MAX_TX_DESCR*8+i*8+4);
sep_emac_write(tempaddr,ESRAM_BASE+ MAX_TX_DESCR*0x600+i*0x600); sep_emac_write(tempaddr,ESRAM_BASE+ MAX_TX_DESCR*0x600+i*0x600);
} }
/* Set the Wrap bit on the last descriptor */ /* Set the Wrap bit on the last descriptor */
tempaddr=(MAC_TX_BD + MAX_TX_DESCR*8+i*8-8); tempaddr=(MAC_TX_BD + MAX_TX_DESCR*8+i*8-8);
sep_emac_write(tempaddr,0xe000); sep_emac_write(tempaddr,0xe000);
for (i = 0; i < MAX_TX_DESCR; i++) for (i = 0; i < MAX_TX_DESCR; i++)
{ {
tempaddr=(MAC_TX_BD+i*8); tempaddr=(MAC_TX_BD+i*8);
sep_emac_write(tempaddr,0x0); sep_emac_write(tempaddr,0x0);
tempaddr=(MAC_TX_BD+i*8+4); tempaddr=(MAC_TX_BD+i*8+4);
sep_emac_write(tempaddr,ESRAM_BASE+i*0x600); sep_emac_write(tempaddr,ESRAM_BASE+i*0x600);
} }
return; return;
...@@ -440,13 +453,13 @@ static void sepether_start() ...@@ -440,13 +453,13 @@ static void sepether_start()
static rt_err_t rt_dm9161_open(rt_device_t dev, rt_uint16_t oflag) static rt_err_t rt_dm9161_open(rt_device_t dev, rt_uint16_t oflag)
{ {
unsigned int dsintr; unsigned int dsintr;
enable_mdi(); enable_mdi();
mask_irq(28); mask_irq(28);
sep_emac_write(MAC_INTMASK,0x0); //首先屏蔽中断
sepether_start(); sep_emac_write(MAC_INTMASK,0x0); //首先屏蔽中断
sepether_start();
/* Enable PHY interrupt */ /* Enable PHY interrupt */
*(volatile unsigned long*)GPIO_PORTA_DIR |= 0x0080 ; //1 stands for in *(volatile unsigned long*)GPIO_PORTA_DIR |= 0x0080 ; //1 stands for in
...@@ -470,12 +483,13 @@ static rt_err_t rt_dm9161_open(rt_device_t dev, rt_uint16_t oflag) ...@@ -470,12 +483,13 @@ static rt_err_t rt_dm9161_open(rt_device_t dev, rt_uint16_t oflag)
/************************************************************************************/ /************************************************************************************/
/* Enable MAC interrupts */ /* Enable MAC interrupts */
sep_emac_write(MAC_INTMASK,0xff); //open中断 sep_emac_write(MAC_INTMASK,0xff); //open中断
sep_emac_write(MAC_INTSRC,0xff); //clear all mac irq sep_emac_write(MAC_INTSRC,0xff); //clear all mac irq
unmask_irq(28); unmask_irq(28);
disable_mdi(); disable_mdi();
rt_kprintf("SEP4020 ethernet interface open!\n\r"); rt_kprintf("SEP4020 ethernet interface open!\n\r");
return RT_EOK;
return RT_EOK;
} }
static rt_err_t rt_dm9161_close(rt_device_t dev) static rt_err_t rt_dm9161_close(rt_device_t dev)
...@@ -493,28 +507,28 @@ static rt_err_t rt_dm9161_close(rt_device_t dev) ...@@ -493,28 +507,28 @@ static rt_err_t rt_dm9161_close(rt_device_t dev)
/* Disable MAC interrupts */ /* Disable MAC interrupts */
sep_emac_write(MAC_INTMASK,0); //屏蔽中断 sep_emac_write(MAC_INTMASK,0); //屏蔽中断
// INT_DISABLE(28); // INT_DISABLE(28);
return RT_EOK; return RT_EOK;
} }
static rt_size_t rt_dm9161_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) static rt_size_t rt_dm9161_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
{ {
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0;
return 0;
} }
static rt_size_t rt_dm9161_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) static rt_size_t rt_dm9161_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
{ {
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0;
return 0;
} }
static rt_err_t rt_dm9161_control(rt_device_t dev, rt_uint8_t cmd, void *args) static rt_err_t rt_dm9161_control(rt_device_t dev, rt_uint8_t cmd, void *args)
{ {
return RT_EOK;
return RT_EOK;
} }
/* ethernet device interface */ /* ethernet device interface */
...@@ -527,26 +541,26 @@ rt_err_t rt_dm9161_tx( rt_device_t dev, struct pbuf* p) ...@@ -527,26 +541,26 @@ rt_err_t rt_dm9161_tx( rt_device_t dev, struct pbuf* p)
unsigned long address; unsigned long address;
unsigned long tmp_tx_bd; unsigned long tmp_tx_bd;
/* lock DM9000 device */ /* lock DM9000 device */
// rt_sem_take(&sem_lock, RT_WAITING_FOREVER); // rt_sem_take(&sem_lock, RT_WAITING_FOREVER);
/* disable dm9000a interrupt */ /* disable dm9000a interrupt */
#warning SHOULD DISABLE INTEERUPT? #warning SHOULD DISABLE INTEERUPT?
/*Search for available BD*/ /*Search for available BD*/
for(i = 0;i<MAX_TX_DESCR;) for (i = 0;i<MAX_TX_DESCR;)
{ {
address = MAC_TX_BD + i*8; address = MAC_TX_BD + i*8;
tmp_tx_bd = sep_emac_read(address); tmp_tx_bd = sep_emac_read(address);
if(!(tmp_tx_bd & 0x8000)) if (!(tmp_tx_bd & 0x8000))
{ {
if(i == (MAX_TX_DESCR-1)) if (i == (MAX_TX_DESCR-1))
i = 0; i = 0;
else else
i = i+1; i = i+1;
break; break;
} }
if(i == MAX_TX_DESCR-1) if (i == MAX_TX_DESCR-1)
i = 0; i = 0;
else else
i++; i++;
...@@ -564,7 +578,7 @@ rt_err_t rt_dm9161_tx( rt_device_t dev, struct pbuf* p) ...@@ -564,7 +578,7 @@ rt_err_t rt_dm9161_tx( rt_device_t dev, struct pbuf* p)
length = length << 16; length = length << 16;
if(i == MAX_TX_DESCR - 1) if (i == MAX_TX_DESCR - 1)
length |= 0xb800; length |= 0xb800;
else else
length |= 0x9800; length |= 0x9800;
...@@ -579,10 +593,10 @@ rt_err_t rt_dm9161_tx( rt_device_t dev, struct pbuf* p) ...@@ -579,10 +593,10 @@ rt_err_t rt_dm9161_tx( rt_device_t dev, struct pbuf* p)
/* unlock DM9000 device */ /* unlock DM9000 device */
// rt_sem_release(&sem_lock); // rt_sem_release(&sem_lock);
/* wait ack */ /* wait ack */
// rt_sem_take(&sem_ack, RT_WAITING_FOREVER); // rt_sem_take(&sem_ack, RT_WAITING_FOREVER);
return RT_EOK; return RT_EOK;
} }
/* reception packet. */ /* reception packet. */
...@@ -595,36 +609,36 @@ struct pbuf *rt_dm9161_rx(rt_device_t dev) ...@@ -595,36 +609,36 @@ struct pbuf *rt_dm9161_rx(rt_device_t dev)
struct pbuf* p = RT_NULL; struct pbuf* p = RT_NULL;
/* lock DM9000 device */ /* lock DM9000 device */
rt_sem_take(&sem_lock, RT_WAITING_FOREVER); rt_sem_take(&sem_lock, RT_WAITING_FOREVER);
while(1) while (1)
{ {
address = MAC_TX_BD + (MAX_TX_DESCR + i) * 8; address = MAC_TX_BD + (MAX_TX_DESCR + i) * 8;
temp_rx_bd = sep_emac_read(address); temp_rx_bd = sep_emac_read(address);
if(!(temp_rx_bd & 0x8000)) if (!(temp_rx_bd & 0x8000))
{ {
length = temp_rx_bd; length = temp_rx_bd;
length = length >> 16; length = length >> 16;
p_recv = (unsigned char*)(ESRAM_BASE + (MAX_TX_DESCR + i) * 0x600); p_recv = (unsigned char *)(ESRAM_BASE + (MAX_TX_DESCR + i) * 0x600);
p = pbuf_alloc(PBUF_LINK,length,PBUF_RAM); p = pbuf_alloc(PBUF_LINK,length,PBUF_RAM);
if(p != RT_NULL) if (p != RT_NULL)
{ {
struct pbuf* q; struct pbuf *q;
rt_int32_t len; rt_int32_t len;
for(q = p;q != RT_NULL;q = q->next) for (q = p; q != RT_NULL; q = q->next)
{ {
rt_memcpy((rt_uint8_t*)(q->payload),p_recv,q->len); rt_memcpy((rt_uint8_t *)(q->payload),p_recv,q->len);
} }
} }
else else
{ {
rt_kprintf("Droping %d packet \n",length); rt_kprintf("Droping %d packet \n",length);
} }
if(i == (MAX_RX_DESCR-1)) if(i == (MAX_RX_DESCR-1))
{ {
sep_emac_write(address,0xe000); sep_emac_write(address,0xe000);
...@@ -640,51 +654,49 @@ struct pbuf *rt_dm9161_rx(rt_device_t dev) ...@@ -640,51 +654,49 @@ struct pbuf *rt_dm9161_rx(rt_device_t dev)
break; break;
} }
rt_sem_release(&sem_lock); rt_sem_release(&sem_lock);
return p; return p;
} }
void rt_hw_dm9161_init() void rt_hw_dm9161_init()
{ {
rt_sem_init(&sem_ack, "tx_ack", 1, RT_IPC_FLAG_FIFO); rt_sem_init(&sem_ack, "tx_ack", 1, RT_IPC_FLAG_FIFO);
rt_sem_init(&sem_lock, "eth_lock", 1, RT_IPC_FLAG_FIFO); rt_sem_init(&sem_lock, "eth_lock", 1, RT_IPC_FLAG_FIFO);
dm9161_device.type = TYPE_DM9161; dm9161_device.type = TYPE_DM9161;
dm9161_device.mode = DM9161_AUTO; dm9161_device.mode = DM9161_AUTO;
dm9161_device.packet_cnt = 0; dm9161_device.packet_cnt = 0;
dm9161_device.queue_packet_len = 0; dm9161_device.queue_packet_len = 0;
/* /*
* SRAM Tx/Rx pointer automatically return to start address, * SRAM Tx/Rx pointer automatically return to start address,
* Packet Transmitted, Packet Received * Packet Transmitted, Packet Received
*/ */
#warning NOTICE: #warning NOTICE:
//dm9161_device.imr_all = IMR_PAR | IMR_PTM | IMR_PRM; //dm9161_device.imr_all = IMR_PAR | IMR_PTM | IMR_PRM;
dm9161_device.dev_addr[0] = 0x01; dm9161_device.dev_addr[0] = 0x01;
dm9161_device.dev_addr[1] = 0x60; dm9161_device.dev_addr[1] = 0x60;
dm9161_device.dev_addr[2] = 0x6E; dm9161_device.dev_addr[2] = 0x6E;
dm9161_device.dev_addr[3] = 0x11; dm9161_device.dev_addr[3] = 0x11;
dm9161_device.dev_addr[4] = 0x02; dm9161_device.dev_addr[4] = 0x02;
dm9161_device.dev_addr[5] = 0x0F; dm9161_device.dev_addr[5] = 0x0F;
dm9161_device.parent.parent.init = rt_dm9161_init; dm9161_device.parent.parent.init = rt_dm9161_init;
dm9161_device.parent.parent.open = rt_dm9161_open; dm9161_device.parent.parent.open = rt_dm9161_open;
dm9161_device.parent.parent.close = rt_dm9161_close; dm9161_device.parent.parent.close = rt_dm9161_close;
dm9161_device.parent.parent.read = rt_dm9161_read; dm9161_device.parent.parent.read = rt_dm9161_read;
dm9161_device.parent.parent.write = rt_dm9161_write; dm9161_device.parent.parent.write = rt_dm9161_write;
dm9161_device.parent.parent.control = rt_dm9161_control; dm9161_device.parent.parent.control = rt_dm9161_control;
dm9161_device.parent.parent.user_data = RT_NULL; dm9161_device.parent.parent.user_data = RT_NULL;
dm9161_device.parent.eth_rx = rt_dm9161_rx; dm9161_device.parent.eth_rx = rt_dm9161_rx;
dm9161_device.parent.eth_tx = rt_dm9161_tx; dm9161_device.parent.eth_tx = rt_dm9161_tx;
eth_device_init(&(dm9161_device.parent), "e0"); eth_device_init(&(dm9161_device.parent), "e0");
/* instal interrupt */ /* instal interrupt */
#warning TODO #warning TODO
//rt_hw_interrupt_install(INTEINT4_7, rt_dm9161_isr, RT_NULL); //rt_hw_interrupt_install(INTEINT4_7, rt_dm9161_isr, RT_NULL);
//rt_hw_interrupt_umask(INTEINT4_7); //rt_hw_interrupt_umask(INTEINT4_7);
......
/*
* File : dm9161.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012, 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
*/
#ifndef __DM9000_H__ #ifndef __DM9000_H__
#define __DM9000_H__ #define __DM9000_H__
......
/*
* File : lcd.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012, 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
*/
#include "lcdc.h" #include "lcdc.h"
#include "rtthread.h" #include "rtthread.h"
#include "board.h" #include "board.h"
...@@ -6,17 +19,16 @@ ...@@ -6,17 +19,16 @@
#include <rtgui/driver.h> #include <rtgui/driver.h>
#include <rtgui/rtgui_server.h> #include <rtgui/rtgui_server.h>
#include <rtgui/rtgui_system.h> #include <rtgui/rtgui_system.h>
extern rt_err_t sep4020_lcd_init(void); extern rt_err_t sep4020_lcd_init(void);
extern unsigned long pVideoBuffer; extern unsigned long pVideoBuffer;
struct rtgui_graphic_driver _rtgui_lcd_driver; struct rtgui_graphic_driver _rtgui_lcd_driver;
struct rtgui_graphic_driver_ops _rtgui_graphic_driver_ops; struct rtgui_graphic_driver_ops _rtgui_graphic_driver_ops;
void radio_rtgui_init(void) void radio_rtgui_init(void)
{ {
rtgui_rect_t rect; rtgui_rect_t rect;
// rtgui_color_t c=0xff;
rtgui_system_server_init(); rtgui_system_server_init();
/* register dock panel */ /* register dock panel */
...@@ -35,35 +47,28 @@ void radio_rtgui_init(void) ...@@ -35,35 +47,28 @@ void radio_rtgui_init(void)
rtgui_panel_register("main", &rect); rtgui_panel_register("main", &rect);
rtgui_panel_set_default_focused("main"); rtgui_panel_set_default_focused("main");
_rtgui_graphic_driver_ops.set_pixel=lcd_set_pixel; _rtgui_graphic_driver_ops.set_pixel=lcd_set_pixel;
_rtgui_graphic_driver_ops.get_pixel=lcd_get_pixel;
_rtgui_graphic_driver_ops.get_pixel=lcd_get_pixel; _rtgui_graphic_driver_ops.draw_hline=lcd_draw_hline;
_rtgui_graphic_driver_ops.draw_hline=lcd_draw_hline; _rtgui_graphic_driver_ops.draw_vline=lcd_draw_vline;
_rtgui_graphic_driver_ops.draw_vline=lcd_draw_vline; _rtgui_graphic_driver_ops.draw_raw_hline=lcd_draw_raw_hline;
_rtgui_graphic_driver_ops.draw_raw_hline=lcd_draw_raw_hline;
_rtgui_lcd_driver.bits_per_pixel = 16; _rtgui_lcd_driver.bits_per_pixel = 16;
_rtgui_lcd_driver.width = 320; _rtgui_lcd_driver.width = 320;
_rtgui_lcd_driver.height = 240; _rtgui_lcd_driver.height = 240;
_rtgui_lcd_driver.ops = &_rtgui_graphic_driver_ops; _rtgui_lcd_driver.ops = &_rtgui_graphic_driver_ops;
// _rtgui_lcd_driver.screen_update = lcd_update; //_rtgui_lcd_driver.screen_update = lcd_update;
// _rtgui_lcd_driver.get_framebuffer = lcd_get_framebuffer; //_rtgui_lcd_driver.get_framebuffer = lcd_get_framebuffer;
sep4020_lcd_init(); sep4020_lcd_init();
rt_memset((char*)pVideoBuffer,0xff,320*240*2); rt_memset((char*)pVideoBuffer,0xff,320*240*2);
// rt_memcpy((char*)pVideoBuffer,pic,320*240*2); //TESTING IMAGE //rt_memcpy((char*)pVideoBuffer,pic,320*240*2); //TESTING IMAGE
//˴ //˴
/* add lcd driver into graphic driver */ /* add lcd driver into graphic driver */
// rtgui_graphic_driver_add(&_rtgui_lcd_driver); // rtgui_graphic_driver_add(&_rtgui_lcd_driver);
} }
/*
* File : lcdc.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012, 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
*/
#include "lcdc.h" #include "lcdc.h"
#include <sep4020.h> #include <sep4020.h>
#define writel(DATA,ADDRESS) *((volatile rt_off_t *) ADDRESS)= DATA; #define writel(DATA,ADDRESS) *((volatile rt_off_t *) ADDRESS)= DATA;
unsigned long pVideoBuffer; unsigned long pVideoBuffer;
rt_err_t sep4020_lcd_init(void)
{
pVideoBuffer =(unsigned long) rt_malloc(LCDWIDTH*LCDHEIGHT*2);
rt_err_t sep4020_lcd_init(void)
{
pVideoBuffer =(unsigned long)rt_malloc(LCDWIDTH * LCDHEIGHT * 2);
*(RP)GPIO_PORTC_SEL |= 0X0008; //Portc8设置为通用口 *(RP)GPIO_PORTC_SEL |= 0X0008; //Portc8设置为通用口
*(RP)GPIO_PORTC_DIR &= (~0X0008); //Portc8设置为输出 *(RP)GPIO_PORTC_DIR &= (~0X0008); //Portc8设置为输出
*(RP)GPIO_PORTC_DATA |= 0X0008; //Portc8输出高电平 *(RP)GPIO_PORTC_DATA |= 0X0008; //Portc8输出高电平
writel(0x00000000,LCDC_LECR); //禁用LCDC
writel(pVideoBuffer,LCDC_SSA); //lcd数据帧的起始地址
writel(0x00000000,LCDC_LECR); //禁用LCDC writel(YMAX | XMAX,LCDC_SIZE);
writel(pVideoBuffer,LCDC_SSA); //lcd数据帧的起始地址 writel(TFT|COLOR|PBSIZE|BPIX|PIXPOL|FLMPOL|LPPOL|CLKPOL|OEPOL|END_SEL|ACD_SEL|ACD|PCD,LCDC_PCR);
writel(YMAX | XMAX,LCDC_SIZE); writel(H_WIDTH|H_WAIT_1|H_WAIT_2,LCDC_HCR);
writel(TFT|COLOR|PBSIZE|BPIX|PIXPOL|FLMPOL|LPPOL|CLKPOL|OEPOL|END_SEL|ACD_SEL|ACD|PCD,LCDC_PCR); writel(V_WIDTH|PASS_FRAME_WAIT|V_WAIT_1|V_WAIT_2,LCDC_VCR);
writel(H_WIDTH|H_WAIT_1|H_WAIT_2,LCDC_HCR); writel(SCR|CC_EN|PW,LCDC_PWMR);
writel(V_WIDTH|PASS_FRAME_WAIT|V_WAIT_1|V_WAIT_2,LCDC_VCR); writel(BL|HM|TM,LCDC_DMACR);
writel(SCR|CC_EN|PW,LCDC_PWMR); writel(0x00000001,LCDC_LECR); //使能LCDC
writel(BL|HM|TM,LCDC_DMACR); writel(0x00000000,LCDC_LCDISREN); //中断在加载帧的最后一个或第一个数据时设置,到LCD之间会有一个延时
writel(0x00000001,LCDC_LECR); //使能LCDC
writel(0x00000000,LCDC_LCDISREN); //中断在加载帧的最后一个或第一个数据时设置,到LCD之间会有一个延时 return RT_EOK;
return RT_EOK;
} }
void lcd_set_pixel(rtgui_color_t *c, int x, int y)
void lcd_set_pixel(rtgui_color_t *c, int x,int y)
{ {
unsigned short p; unsigned short p;
/* get color pixel */ /* get color pixel */
p = rtgui_color_to_565p(*c); p = rtgui_color_to_565p(*c);
*(unsigned short *)(pVideoBuffer + 2*y*LCDWIDTH + 2*x) = p;
*(unsigned short *)(pVideoBuffer+2*y*LCDWIDTH+2*x)=p;
} }
void lcd_get_pixel(rtgui_color_t *c, int x, int y) void lcd_get_pixel(rtgui_color_t *c, int x, int y)
{ {
*c = rtgui_color_from_565p( *(unsigned short *)(pVideoBuffer+2*y*LCDWIDTH+2*x)); *c = rtgui_color_from_565p( *(unsigned short *)(pVideoBuffer+2*y*LCDWIDTH+2*x));
} }
...@@ -59,12 +63,10 @@ void lcd_draw_hline(rtgui_color_t *c, int x1, int x2, int y) ...@@ -59,12 +63,10 @@ void lcd_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
/* get color pixel */ /* get color pixel */
p = rtgui_color_to_565p(*c); p = rtgui_color_to_565p(*c);
while (x1 < x2) while (x1 < x2)
{ {
*(unsigned short *)(pVideoBuffer+2*y*LCDWIDTH+2*x1)=p; *(unsigned short *)(pVideoBuffer+2*y*LCDWIDTH+2*x1)=p;
x1 ++; x1 ++;
} }
} }
...@@ -75,11 +77,9 @@ void lcd_draw_vline(rtgui_color_t *c, int x, int y1, int y2) ...@@ -75,11 +77,9 @@ void lcd_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
/* get color pixel */ /* get color pixel */
p = rtgui_color_to_565p(*c); p = rtgui_color_to_565p(*c);
while (y1 < y2) while (y1 < y2)
{ {
*(unsigned short *)(pVideoBuffer+2*y1*LCDWIDTH+2*x)=p;
*(unsigned short *)(pVideoBuffer+2*y1*LCDWIDTH+2*x)=p;
y1 ++; y1 ++;
} }
} }
...@@ -91,7 +91,6 @@ void lcd_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y) ...@@ -91,7 +91,6 @@ void lcd_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
/* get pixel */ /* get pixel */
ptr = (rt_uint16_t*) pixels; ptr = (rt_uint16_t*) pixels;
while (x1 < x2) while (x1 < x2)
{ {
*(unsigned short *)(pVideoBuffer+2*y*LCDWIDTH+2*x1)=*ptr; *(unsigned short *)(pVideoBuffer+2*y*LCDWIDTH+2*x1)=*ptr;
...@@ -105,7 +104,7 @@ void lcd_update(rtgui_rect_t *rect) ...@@ -105,7 +104,7 @@ void lcd_update(rtgui_rect_t *rect)
/* nothing for none-DMA mode driver */ /* nothing for none-DMA mode driver */
} }
rt_uint8_t * lcd_get_framebuffer(void) rt_uint8_t *lcd_get_framebuffer(void)
{ {
return RT_NULL; /* no framebuffer driver */ return RT_NULL; /* no framebuffer driver */
} }
/*
* File : lcdc.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012, 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
*/
#ifndef LCD_GENERAL_H_INCLUDED #ifndef LCD_GENERAL_H_INCLUDED
#define LCD_GENERAL_H_INCLUDED #define LCD_GENERAL_H_INCLUDED
......
/*
* File : mii.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012, 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
*/
#ifndef __MII_H__ #ifndef __MII_H__
#define __MII_H__ #define __MII_H__
......
/* /*
* File : sdcard.c * File : sdcard.c
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, 2007, RT-Thread Develop Team * COPYRIGHT (C) 2007 - 2012, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
......
/*
* File : sdcard.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012, 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
*/
#ifndef __SDCARD_H #ifndef __SDCARD_H
#define __SDCARD_H #define __SDCARD_H
...@@ -15,8 +27,8 @@ ...@@ -15,8 +27,8 @@
/*struct of the SDC*/ /*struct of the SDC*/
struct sd_c struct sd_c
{ {
__IO rt_uint32_t clk_ctl; __IO rt_uint32_t clk_ctl;
__IO rt_uint32_t soft_rst; __IO rt_uint32_t soft_rst;
__IO rt_uint32_t arg; __IO rt_uint32_t arg;
__IO rt_uint32_t cmd; __IO rt_uint32_t cmd;
__IO rt_uint32_t blk_sz; __IO rt_uint32_t blk_sz;
...@@ -44,8 +56,6 @@ struct sd_device ...@@ -44,8 +56,6 @@ struct sd_device
rt_uint32_t buf_size; /*buffer size*/ rt_uint32_t buf_size; /*buffer size*/
}; };
#endif #endif
#endif #endif
...@@ -3,160 +3,96 @@ ...@@ -3,160 +3,96 @@
Target (RT-Thread_Mini4020), 0x0004 // Tools: 'ARM-ADS' Target (RT-Thread_Mini4020), 0x0004 // Tools: 'ARM-ADS'
Group (Startup) Group (Applications)
Group (Drivers)
Group (Kernel) Group (Kernel)
Group (SEP4020) Group (SEP4020)
Group (Filesystem) Group (Filesystem)
Group (finsh) Group (finsh)
Group (LwIP) Group (LwIP)
Group (RTGUI)
File 1,1,<.\application.c><application.c> File 1,1,<applications\application.c><application.c>
File 1,1,<.\board.c><board.c> File 1,1,<applications\startup.c><startup.c>
File 1,1,<.\dm9161.c><dm9161.c> File 2,1,<drivers\board.c><board.c>
File 1,1,<.\lcd.c><lcd.c> File 2,1,<drivers\dm9161.c><dm9161.c>
File 1,1,<.\lcdc.c><lcdc.c> File 2,1,<drivers\sdcard.c><sdcard.c>
File 1,1,<.\sdcard.c><sdcard.c> File 3,1,<..\..\src\clock.c><clock.c>
File 1,1,<.\startup.c><startup.c> File 3,1,<..\..\src\device.c><device.c>
File 2,1,<..\..\src\clock.c><clock.c> File 3,1,<..\..\src\idle.c><idle.c>
File 2,1,<..\..\src\device.c><device.c> File 3,1,<..\..\src\ipc.c><ipc.c>
File 2,1,<..\..\src\idle.c><idle.c> File 3,1,<..\..\src\irq.c><irq.c>
File 2,1,<..\..\src\ipc.c><ipc.c> File 3,1,<..\..\src\kservice.c><kservice.c>
File 2,1,<..\..\src\irq.c><irq.c> File 3,1,<..\..\src\mempool.c><mempool.c>
File 2,1,<..\..\src\kservice.c><kservice.c> File 3,1,<..\..\src\object.c><object.c>
File 2,1,<..\..\src\memheap.c><memheap.c> File 3,1,<..\..\src\scheduler.c><scheduler.c>
File 2,1,<..\..\src\mempool.c><mempool.c> File 3,1,<..\..\src\slab.c><slab.c>
File 2,1,<..\..\src\object.c><object.c> File 3,1,<..\..\src\thread.c><thread.c>
File 2,1,<..\..\src\scheduler.c><scheduler.c> File 3,1,<..\..\src\timer.c><timer.c>
File 2,1,<..\..\src\slab.c><slab.c> File 4,1,<..\..\libcpu\arm\sep4020\clk.c><clk.c>
File 2,1,<..\..\src\thread.c><thread.c> File 4,1,<..\..\libcpu\arm\sep4020\cpu.c><cpu.c>
File 2,1,<..\..\src\timer.c><timer.c> File 4,1,<..\..\libcpu\arm\sep4020\interrupt.c><interrupt.c>
File 3,1,<..\..\libcpu\arm\sep4020\clk.c><clk.c> File 4,1,<..\..\libcpu\arm\sep4020\serial.c><serial.c>
File 3,1,<..\..\libcpu\arm\sep4020\cpu.c><cpu.c> File 4,1,<..\..\libcpu\arm\sep4020\stack.c><stack.c>
File 3,1,<..\..\libcpu\arm\sep4020\interrupt.c><interrupt.c> File 4,1,<..\..\libcpu\arm\sep4020\trap.c><trap.c>
File 3,1,<..\..\libcpu\arm\sep4020\serial.c><serial.c> File 4,2,<..\..\libcpu\arm\sep4020\context_rvds.S><context_rvds.S>
File 3,1,<..\..\libcpu\arm\sep4020\stack.c><stack.c> File 4,2,<..\..\libcpu\arm\sep4020\start_rvds.S><start_rvds.S>
File 3,1,<..\..\libcpu\arm\sep4020\trap.c><trap.c> File 4,1,<..\..\libcpu\arm\common\backtrace.c><backtrace.c>
File 3,2,<..\..\libcpu\arm\sep4020\context_rvds.S><context_rvds.S> File 4,1,<..\..\libcpu\arm\common\div0.c><div0.c>
File 3,2,<..\..\libcpu\arm\sep4020\start_rvds.S><start_rvds.S> File 4,1,<..\..\libcpu\arm\common\showmem.c><showmem.c>
File 3,1,<..\..\libcpu\arm\common\backtrace.c><backtrace.c> File 5,1,<..\..\components\dfs\src\dfs.c><dfs.c>
File 3,1,<..\..\libcpu\arm\common\div0.c><div0.c> File 5,1,<..\..\components\dfs\src\dfs_fs.c><dfs_fs.c>
File 3,1,<..\..\libcpu\arm\common\showmem.c><showmem.c> File 5,1,<..\..\components\dfs\src\dfs_file.c><dfs_file.c>
File 4,1,<..\..\components\dfs\src\dfs.c><dfs.c> File 5,1,<..\..\components\dfs\src\dfs_posix.c><dfs_posix.c>
File 4,1,<..\..\components\dfs\src\dfs_fs.c><dfs_fs.c> File 5,1,<..\..\components\dfs\filesystems\elmfat\dfs_elm.c><dfs_elm.c>
File 4,1,<..\..\components\dfs\src\dfs_file.c><dfs_file.c> File 5,1,<..\..\components\dfs\filesystems\elmfat\ff.c><ff.c>
File 4,1,<..\..\components\dfs\src\dfs_posix.c><dfs_posix.c> File 6,1,<..\..\components\finsh\cmd.c><cmd.c>
File 4,1,<..\..\components\dfs\filesystems\elmfat\dfs_elm.c><dfs_elm.c> File 6,1,<..\..\components\finsh\finsh_compiler.c><finsh_compiler.c>
File 4,1,<..\..\components\dfs\filesystems\elmfat\ff.c><ff.c> File 6,1,<..\..\components\finsh\finsh_error.c><finsh_error.c>
File 5,1,<..\..\components\finsh\cmd.c><cmd.c> File 6,1,<..\..\components\finsh\finsh_heap.c><finsh_heap.c>
File 5,1,<..\..\components\finsh\finsh_compiler.c><finsh_compiler.c> File 6,1,<..\..\components\finsh\finsh_init.c><finsh_init.c>
File 5,1,<..\..\components\finsh\finsh_error.c><finsh_error.c> File 6,1,<..\..\components\finsh\finsh_node.c><finsh_node.c>
File 5,1,<..\..\components\finsh\finsh_heap.c><finsh_heap.c> File 6,1,<..\..\components\finsh\finsh_ops.c><finsh_ops.c>
File 5,1,<..\..\components\finsh\finsh_init.c><finsh_init.c> File 6,1,<..\..\components\finsh\finsh_parser.c><finsh_parser.c>
File 5,1,<..\..\components\finsh\finsh_node.c><finsh_node.c> File 6,1,<..\..\components\finsh\finsh_token.c><finsh_token.c>
File 5,1,<..\..\components\finsh\finsh_ops.c><finsh_ops.c> File 6,1,<..\..\components\finsh\finsh_var.c><finsh_var.c>
File 5,1,<..\..\components\finsh\finsh_parser.c><finsh_parser.c> File 6,1,<..\..\components\finsh\finsh_vm.c><finsh_vm.c>
File 5,1,<..\..\components\finsh\finsh_token.c><finsh_token.c> File 6,1,<..\..\components\finsh\shell.c><shell.c>
File 5,1,<..\..\components\finsh\finsh_var.c><finsh_var.c> File 6,1,<..\..\components\finsh\symbol.c><symbol.c>
File 5,1,<..\..\components\finsh\finsh_vm.c><finsh_vm.c> File 7,1,<..\..\components\net\lwip\src\api\api_lib.c><api_lib.c>
File 5,1,<..\..\components\finsh\shell.c><shell.c> File 7,1,<..\..\components\net\lwip\src\api\api_msg.c><api_msg.c>
File 5,1,<..\..\components\finsh\symbol.c><symbol.c> File 7,1,<..\..\components\net\lwip\src\api\err.c><err.c>
File 6,1,<..\..\components\net\lwip\src\api\api_lib.c><api_lib.c> File 7,1,<..\..\components\net\lwip\src\api\netbuf.c><netbuf.c>
File 6,1,<..\..\components\net\lwip\src\api\api_msg.c><api_msg.c> File 7,1,<..\..\components\net\lwip\src\api\netdb.c><netdb.c>
File 6,1,<..\..\components\net\lwip\src\api\err.c><err.c> File 7,1,<..\..\components\net\lwip\src\api\netifapi.c><netifapi.c>
File 6,1,<..\..\components\net\lwip\src\api\netbuf.c><netbuf.c> File 7,1,<..\..\components\net\lwip\src\api\sockets.c><sockets.c>
File 6,1,<..\..\components\net\lwip\src\api\netdb.c><netdb.c> File 7,1,<..\..\components\net\lwip\src\api\tcpip.c><tcpip.c>
File 6,1,<..\..\components\net\lwip\src\api\netifapi.c><netifapi.c> File 7,1,<..\..\components\net\lwip\src\arch\sys_arch.c><sys_arch.c>
File 6,1,<..\..\components\net\lwip\src\api\sockets.c><sockets.c> File 7,1,<..\..\components\net\lwip\src\core\def.c><def.c>
File 6,1,<..\..\components\net\lwip\src\api\tcpip.c><tcpip.c> File 7,1,<..\..\components\net\lwip\src\core\dhcp.c><dhcp.c>
File 6,1,<..\..\components\net\lwip\src\arch\sys_arch.c><sys_arch.c> File 7,1,<..\..\components\net\lwip\src\core\dns.c><dns.c>
File 6,1,<..\..\components\net\lwip\src\core\def.c><def.c> File 7,1,<..\..\components\net\lwip\src\core\init.c><init.c>
File 6,1,<..\..\components\net\lwip\src\core\dhcp.c><dhcp.c> File 7,1,<..\..\components\net\lwip\src\core\memp.c><memp.c>
File 6,1,<..\..\components\net\lwip\src\core\dns.c><dns.c> File 7,1,<..\..\components\net\lwip\src\core\netif.c><netif.c>
File 6,1,<..\..\components\net\lwip\src\core\init.c><init.c> File 7,1,<..\..\components\net\lwip\src\core\pbuf.c><pbuf.c>
File 6,1,<..\..\components\net\lwip\src\core\memp.c><memp.c> File 7,1,<..\..\components\net\lwip\src\core\raw.c><raw.c>
File 6,1,<..\..\components\net\lwip\src\core\netif.c><netif.c> File 7,1,<..\..\components\net\lwip\src\core\stats.c><stats.c>
File 6,1,<..\..\components\net\lwip\src\core\pbuf.c><pbuf.c> File 7,1,<..\..\components\net\lwip\src\core\sys.c><sys.c>
File 6,1,<..\..\components\net\lwip\src\core\raw.c><raw.c> File 7,1,<..\..\components\net\lwip\src\core\tcp.c><tcp.c>
File 6,1,<..\..\components\net\lwip\src\core\stats.c><stats.c> File 7,1,<..\..\components\net\lwip\src\core\tcp_in.c><tcp_in.c>
File 6,1,<..\..\components\net\lwip\src\core\sys.c><sys.c> File 7,1,<..\..\components\net\lwip\src\core\tcp_out.c><tcp_out.c>
File 6,1,<..\..\components\net\lwip\src\core\tcp.c><tcp.c> File 7,1,<..\..\components\net\lwip\src\core\timers.c><timers.c>
File 6,1,<..\..\components\net\lwip\src\core\tcp_in.c><tcp_in.c> File 7,1,<..\..\components\net\lwip\src\core\udp.c><udp.c>
File 6,1,<..\..\components\net\lwip\src\core\tcp_out.c><tcp_out.c> File 7,1,<..\..\components\net\lwip\src\core\ipv4\autoip.c><autoip.c>
File 6,1,<..\..\components\net\lwip\src\core\timers.c><timers.c> File 7,1,<..\..\components\net\lwip\src\core\ipv4\icmp.c><icmp.c>
File 6,1,<..\..\components\net\lwip\src\core\udp.c><udp.c> File 7,1,<..\..\components\net\lwip\src\core\ipv4\igmp.c><igmp.c>
File 6,1,<..\..\components\net\lwip\src\core\ipv4\autoip.c><autoip.c> File 7,1,<..\..\components\net\lwip\src\core\ipv4\inet.c><inet.c>
File 6,1,<..\..\components\net\lwip\src\core\ipv4\icmp.c><icmp.c> File 7,1,<..\..\components\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c>
File 6,1,<..\..\components\net\lwip\src\core\ipv4\igmp.c><igmp.c> File 7,1,<..\..\components\net\lwip\src\core\ipv4\ip.c><ip.c>
File 6,1,<..\..\components\net\lwip\src\core\ipv4\inet.c><inet.c> File 7,1,<..\..\components\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c>
File 6,1,<..\..\components\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c> File 7,1,<..\..\components\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c>
File 6,1,<..\..\components\net\lwip\src\core\ipv4\ip.c><ip.c> File 7,1,<..\..\components\net\lwip\src\netif\etharp.c><etharp.c>
File 6,1,<..\..\components\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c> File 7,1,<..\..\components\net\lwip\src\netif\ethernetif.c><ethernetif.c>
File 6,1,<..\..\components\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c> File 7,1,<..\..\components\net\lwip\src\netif\slipif.c><slipif.c>
File 6,1,<..\..\components\net\lwip\src\netif\etharp.c><etharp.c>
File 6,1,<..\..\components\net\lwip\src\netif\ethernetif.c><ethernetif.c>
File 6,1,<..\..\components\net\lwip\src\netif\slipif.c><slipif.c>
File 7,1,<..\..\components\rtgui\common\blit.c><blit.c>
File 7,1,<..\..\components\rtgui\common\color.c><color.c>
File 7,1,<..\..\components\rtgui\common\region.c><region.c>
File 7,1,<..\..\components\rtgui\common\rtgui_object.c><rtgui_object.c>
File 7,1,<..\..\components\rtgui\common\rtgui_system.c><rtgui_system.c>
File 7,1,<..\..\components\rtgui\common\rtgui_theme.c><rtgui_theme.c>
File 7,1,<..\..\components\rtgui\common\rtgui_xml.c><rtgui_xml.c>
File 7,1,<..\..\components\rtgui\common\dc.c><dc.c>
File 7,1,<..\..\components\rtgui\common\dc_hw.c><dc_hw.c>
File 7,1,<..\..\components\rtgui\common\dc_buffer.c><dc_buffer.c>
File 7,1,<..\..\components\rtgui\common\dc_client.c><dc_client.c>
File 7,1,<..\..\components\rtgui\common\filerw.c><filerw.c>
File 7,1,<..\..\components\rtgui\common\image.c><image.c>
File 7,1,<..\..\components\rtgui\common\image_xpm.c><image_xpm.c>
File 7,1,<..\..\components\rtgui\common\image_hdc.c><image_hdc.c>
File 7,1,<..\..\components\rtgui\common\image_bmp.c><image_bmp.c>
File 7,1,<..\..\components\rtgui\common\image_png.c><image_png.c>
File 7,1,<..\..\components\rtgui\common\image_jpg.c><image_jpg.c>
File 7,1,<..\..\components\rtgui\common\image_container.c><image_container.c>
File 7,1,<..\..\components\rtgui\common\font.c><font.c>
File 7,1,<..\..\components\rtgui\common\font_bmp.c><font_bmp.c>
File 7,1,<..\..\components\rtgui\common\font_hz_file.c><font_hz_file.c>
File 7,1,<..\..\components\rtgui\common\font_hz_bmp.c><font_hz_bmp.c>
File 7,1,<..\..\components\rtgui\common\asc12font.c><asc12font.c>
File 7,1,<..\..\components\rtgui\common\asc16font.c><asc16font.c>
File 7,1,<..\..\components\rtgui\common\hz12font.c><hz12font.c>
File 7,1,<..\..\components\rtgui\common\hz16font.c><hz16font.c>
File 7,1,<..\..\components\rtgui\common\framebuffer_driver.c><framebuffer_driver.c>
File 7,1,<..\..\components\rtgui\common\pixel_driver.c><pixel_driver.c>
File 7,1,<..\..\components\rtgui\server\driver.c><driver.c>
File 7,1,<..\..\components\rtgui\server\mouse.c><mouse.c>
File 7,1,<..\..\components\rtgui\server\panel.c><panel.c>
File 7,1,<..\..\components\rtgui\server\server.c><server.c>
File 7,1,<..\..\components\rtgui\server\topwin.c><topwin.c>
File 7,1,<..\..\components\rtgui\widgets\box.c><box.c>
File 7,1,<..\..\components\rtgui\widgets\button.c><button.c>
File 7,1,<..\..\components\rtgui\widgets\checkbox.c><checkbox.c>
File 7,1,<..\..\components\rtgui\widgets\container.c><container.c>
File 7,1,<..\..\components\rtgui\widgets\combobox.c><combobox.c>
File 7,1,<..\..\components\rtgui\widgets\iconbox.c><iconbox.c>
File 7,1,<..\..\components\rtgui\widgets\label.c><label.c>
File 7,1,<..\..\components\rtgui\widgets\textview.c><textview.c>
File 7,1,<..\..\components\rtgui\widgets\listctrl.c><listctrl.c>
File 7,1,<..\..\components\rtgui\widgets\menu.c><menu.c>
File 7,1,<..\..\components\rtgui\widgets\progressbar.c><progressbar.c>
File 7,1,<..\..\components\rtgui\widgets\radiobox.c><radiobox.c>
File 7,1,<..\..\components\rtgui\widgets\slider.c><slider.c>
File 7,1,<..\..\components\rtgui\widgets\scrollbar.c><scrollbar.c>
File 7,1,<..\..\components\rtgui\widgets\staticline.c><staticline.c>
File 7,1,<..\..\components\rtgui\widgets\textbox.c><textbox.c>
File 7,1,<..\..\components\rtgui\widgets\listbox.c><listbox.c>
File 7,1,<..\..\components\rtgui\widgets\title.c><title.c>
File 7,1,<..\..\components\rtgui\widgets\toplevel.c><toplevel.c>
File 7,1,<..\..\components\rtgui\widgets\notebook.c><notebook.c>
File 7,1,<..\..\components\rtgui\widgets\view.c><view.c>
File 7,1,<..\..\components\rtgui\widgets\list_view.c><list_view.c>
File 7,1,<..\..\components\rtgui\widgets\about_view.c><about_view.c>
File 7,1,<..\..\components\rtgui\widgets\filelist_view.c><filelist_view.c>
File 7,1,<..\..\components\rtgui\widgets\widget.c><widget.c>
File 7,1,<..\..\components\rtgui\widgets\window.c><window.c>
File 7,1,<..\..\components\rtgui\widgets\workbench.c><workbench.c>
...@@ -219,7 +155,7 @@ Options 1,0,0 // Target 'RT-Thread_Mini4020' ...@@ -219,7 +155,7 @@ Options 1,0,0 // Target 'RT-Thread_Mini4020'
ADSCMISC (-g) ADSCMISC (-g)
ADSCDEFN () ADSCDEFN ()
ADSCUDEF () ADSCUDEF ()
ADSCINCD (..\..\components\rtgui\server;..\..\include;..\..\libcpu\arm\sep4020;..\..\components\rtgui\widgets;..\..\components\net\lwip\src\include;.;..\..\components\net\lwip\src\include\ipv4;..\..\components\dfs;..\..\components\rtgui\include;..\..\components\net\lwip\src\arch\include;..\..\components\dfs\include;..\..\components\net\lwip\src;..\..\libcpu\arm\common;..\..\components\rtgui\common;..\..\components\finsh;..\..\components\net\lwip\src\include\netif) ADSCINCD (..\..\include;..\..\libcpu\arm\sep4020;drivers;..\..\components\dfs;..\..\components\net\lwip\src\include;.;..\..\components\net\lwip\src\include\ipv4;applications;..\..\components\net\lwip\src\arch\include;..\..\components\dfs\include;..\..\components\net\lwip\src;..\..\libcpu\arm\common;..\..\components\finsh;..\..\components\net\lwip\src\include\netif)
ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
ADSAMISC () ADSAMISC ()
ADSADEFN () ADSADEFN ()
......
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
/* SECTION: RTGUI support */ /* SECTION: RTGUI support */
/* using RTGUI support */ /* using RTGUI support */
#define RT_USING_RTGUI /* #define RT_USING_RTGUI */
/* name length of RTGUI object */ /* name length of RTGUI object */
#define RTGUI_NAME_MAX 16 #define RTGUI_NAME_MAX 16
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册