diff --git a/bsp/mini2440/dm9000.c b/bsp/mini2440/dm9000.c index 1a51738ad9..8cf294bff1 100644 --- a/bsp/mini2440/dm9000.c +++ b/bsp/mini2440/dm9000.c @@ -2,9 +2,13 @@ #include #include "dm9000.h" +#include /* * Davicom DM9000EP driver + * + * IRQ_LAN connects to EINT7(GPF7) + * nLAN_CS connects to nGCS4 */ // #define DM9000_DEBUG 1 @@ -57,7 +61,7 @@ struct rt_dm9000_eth static struct rt_dm9000_eth dm9000_device; static struct rt_semaphore sem_ack, sem_lock; -void rt_dm9000_isr(void); +void rt_dm9000_isr(int irqno); static void delay_ms(rt_uint32_t ms) { @@ -147,7 +151,7 @@ rt_inline void phy_mode_set(rt_uint32_t media_mode) } /* interrupt service routine */ -void rt_dm9000_isr() +void rt_dm9000_isr(int irqno) { rt_uint16_t int_status; rt_uint16_t last_io; @@ -239,6 +243,7 @@ static rt_err_t rt_dm9000_init(rt_device_t dev) } else { + rt_kprintf("dm9000 id: 0x%x\n", value); return -RT_ERROR; } @@ -560,8 +565,21 @@ struct pbuf *rt_dm9000_rx(rt_device_t dev) return p; } +#define B4_Tacs 0x0 +#define B4_Tcos 0x0 +#define B4_Tacc 0x7 +#define B4_Tcoh 0x0 +#define B4_Tah 0x0 +#define B4_Tacp 0x0 +#define B4_PMC 0x0 + void rt_hw_dm9000_init() { + // GPFCON = 0x000055AA; + // GPFUP = 0x000000FF; + + // BANKCON4 = ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)); + rt_sem_init(&sem_ack, "tx_ack", 1, RT_IPC_FLAG_FIFO); rt_sem_init(&sem_lock, "eth_lock", 1, RT_IPC_FLAG_FIFO); @@ -597,8 +615,8 @@ void rt_hw_dm9000_init() eth_device_init(&(dm9000_device.parent), "e0"); /* instal interrupt */ - rt_hw_interrupt_install(INTADC, rt_touch_handler, RT_NULL); - rt_hw_interrupt_umask(INTADC); + // rt_hw_interrupt_install(INT_EXIT7, rt_dm9000_isr, RT_NULL); + // rt_hw_interrupt_umask(INT_EXIT7); } void dm9000a(void) diff --git a/bsp/mini2440/dm9000.h b/bsp/mini2440/dm9000.h index 93e83ca791..a5a39ebd19 100644 --- a/bsp/mini2440/dm9000.h +++ b/bsp/mini2440/dm9000.h @@ -1,11 +1,11 @@ #ifndef __DM9000_H__ #define __DM9000_H__ -#define DM9000_IO_BASE 0x20000300 -#define DM9000_DATA_BASE 0x20000304 +#define DM9000_IO_BASE 0x20000000 +#define DM9000_DATA_BASE 0x20000004 -#define DM9000_IO (*((volatile rt_uint16_t *) DM9000_IO_BASE)) // CMD = 0 -#define DM9000_DATA (*((volatile rt_uint16_t *) DM9000_DATA_BASE)) // CMD = 1 +#define DM9000_IO (*((volatile rt_uint16_t *) DM9000_IO_BASE)) // CMD = 0 +#define DM9000_DATA (*((volatile rt_uint16_t *) DM9000_DATA_BASE)) // CMD = 1 #define DM9000_inb(r) (*(volatile rt_uint8_t *)r) #define DM9000_outb(r, d) (*(volatile rt_uint8_t *)r = d) diff --git a/bsp/mini2440/rtconfig.h b/bsp/mini2440/rtconfig.h index 2a982a8731..116852d2b3 100644 --- a/bsp/mini2440/rtconfig.h +++ b/bsp/mini2440/rtconfig.h @@ -79,8 +79,6 @@ /* #define RT_USING_NEWLIB */ /* SECTION: a mini libc */ -/* Using mini libc library */ -/* #define RT_USING_MINILIBC */ /* SECTION: C++ support */ /* Using C++ support */ @@ -88,7 +86,7 @@ /* SECTION: RTGUI support */ /* using RTGUI support */ -/* #define RT_USING_RTGUI */ +#define RT_USING_RTGUI /* SECTION: Device filesystem support */ /* using DFS support */ @@ -107,15 +105,9 @@ /* SECTION: lwip, a lighwight TCP/IP protocol stack */ /* Using lighweight TCP/IP protocol stack */ -/* #define RT_USING_LWIP */ +#define RT_USING_LWIP #define RT_LWIP_DNS -/* Using webserver goahead support */ -#define RT_USING_WEBSERVER - -/* Using ftpserver support */ -#define RT_USING_FTPSERVER - /* Trace LwIP protocol */ /* #define RT_LWIP_DEBUG */ diff --git a/bsp/mini2440/rtconfig.py b/bsp/mini2440/rtconfig.py index 2230b062a0..39fcbedbdb 100644 --- a/bsp/mini2440/rtconfig.py +++ b/bsp/mini2440/rtconfig.py @@ -4,22 +4,21 @@ RT_USING_FINSH = True # device file system options -RT_USING_DFS = False +RT_USING_DFS = True RT_USING_DFS_EFSL = True RT_USING_DFS_ELMFAT = False RT_USING_DFS_YAFFS2 = False # lwip options -RT_USING_LWIP = False +RT_USING_LWIP = True # rtgui options -RT_USING_RTGUI = False +RT_USING_RTGUI = True # panel options # 'PNL_A70','PNL_N35', 'PNL_T35' RT_USING_LCD_TYPE = 'PNL_T35' - # toolchains options ARCH='arm' CPU='s3c24x0'