mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-31 14:20:26 +08:00
update mini2440
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1634 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
5b063d3030
commit
71f793e3e9
@ -153,11 +153,6 @@ void rt_dm9000_isr(int irqno)
|
||||
rt_uint16_t last_io;
|
||||
rt_uint32_t eint_pend;
|
||||
|
||||
eint_pend = EINTPEND;
|
||||
/* EINT7 for DM9000 */
|
||||
//if((eint_pend & 0x80) == 0x80)
|
||||
{
|
||||
|
||||
last_io = DM9000_IO;
|
||||
|
||||
/* Disable all interrupts */
|
||||
@ -220,10 +215,6 @@ void rt_dm9000_isr(int irqno)
|
||||
DM9000_IO = last_io;
|
||||
}
|
||||
|
||||
/* clear EINT pending bit */
|
||||
EINTPEND = eint_pend;
|
||||
}
|
||||
|
||||
/* RT-Thread Device Interface */
|
||||
/* initialize the interface */
|
||||
static rt_err_t rt_dm9000_init(rt_device_t dev)
|
||||
@ -282,12 +273,13 @@ static rt_err_t rt_dm9000_init(rt_device_t dev)
|
||||
|
||||
if (dm9000_device.mode == DM9000_AUTO)
|
||||
{
|
||||
i = 0;
|
||||
while (!(phy_read(1) & 0x20))
|
||||
{
|
||||
/* autonegation complete bit */
|
||||
rt_thread_delay( 10 );
|
||||
rt_thread_delay( RT_TICK_PER_SECOND/10 );
|
||||
i++;
|
||||
if (i > 20)
|
||||
if (i > 30 ) /* wait 3s */
|
||||
{
|
||||
rt_kprintf("could not establish link\n");
|
||||
return 0;
|
||||
@ -580,6 +572,22 @@ __error_retry:
|
||||
#define B4_Tacp 0x0
|
||||
#define B4_PMC 0x0
|
||||
|
||||
void INTEINT4_7_handler(int irqno)
|
||||
{
|
||||
rt_uint32_t eint_pend;
|
||||
|
||||
eint_pend = EINTPEND;
|
||||
|
||||
/* EINT7 : DM9000AEP */
|
||||
if( eint_pend & (1<<7) )
|
||||
{
|
||||
rt_dm9000_isr(0);
|
||||
}
|
||||
|
||||
/* clear EINT pending bit */
|
||||
EINTPEND = eint_pend;
|
||||
}
|
||||
|
||||
void rt_hw_dm9000_init()
|
||||
{
|
||||
/* Set GPF7 as EINT7 */
|
||||
@ -608,7 +616,7 @@ void rt_hw_dm9000_init()
|
||||
* Packet Transmitted, Packet Received
|
||||
*/
|
||||
|
||||
dm9000_device.dev_addr[0] = 0x01;
|
||||
dm9000_device.dev_addr[0] = 0x00;
|
||||
dm9000_device.dev_addr[1] = 0x60;
|
||||
dm9000_device.dev_addr[2] = 0x6E;
|
||||
dm9000_device.dev_addr[3] = 0x11;
|
||||
@ -629,26 +637,26 @@ void rt_hw_dm9000_init()
|
||||
eth_device_init(&(dm9000_device.parent), "e0");
|
||||
|
||||
/* instal interrupt */
|
||||
rt_hw_interrupt_install(INTEINT4_7, rt_dm9000_isr, RT_NULL);
|
||||
rt_hw_interrupt_install(INTEINT4_7, INTEINT4_7_handler, RT_NULL);
|
||||
rt_hw_interrupt_umask(INTEINT4_7);
|
||||
}
|
||||
|
||||
void dm9000a(void)
|
||||
{
|
||||
rt_kprintf("\n");
|
||||
rt_kprintf("NCR (0x00): %02x\n", dm9000_io_read(DM9000_NCR));
|
||||
rt_kprintf("NSR (0x01): %02x\n", dm9000_io_read(DM9000_NSR));
|
||||
rt_kprintf("TCR (0x02): %02x\n", dm9000_io_read(DM9000_TCR));
|
||||
rt_kprintf("TSRI (0x03): %02x\n", dm9000_io_read(DM9000_TSR1));
|
||||
rt_kprintf("TSRII (0x04): %02x\n", dm9000_io_read(DM9000_TSR2));
|
||||
rt_kprintf("RCR (0x05): %02x\n", dm9000_io_read(DM9000_RCR));
|
||||
rt_kprintf("RSR (0x06): %02x\n", dm9000_io_read(DM9000_RSR));
|
||||
rt_kprintf("ORCR (0x07): %02x\n", dm9000_io_read(DM9000_ROCR));
|
||||
rt_kprintf("CRR (0x2C): %02x\n", dm9000_io_read(DM9000_CHIPR));
|
||||
rt_kprintf("CSCR (0x31): %02x\n", dm9000_io_read(DM9000_CSCR));
|
||||
rt_kprintf("RCSSR (0x32): %02x\n", dm9000_io_read(DM9000_RCSSR));
|
||||
rt_kprintf("ISR (0xFE): %02x\n", dm9000_io_read(DM9000_ISR));
|
||||
rt_kprintf("IMR (0xFF): %02x\n", dm9000_io_read(DM9000_IMR));
|
||||
rt_kprintf("NCR (%02X): %02x\n", DM9000_NCR, dm9000_io_read(DM9000_NCR));
|
||||
rt_kprintf("NSR (%02X): %02x\n", DM9000_NSR, dm9000_io_read(DM9000_NSR));
|
||||
rt_kprintf("TCR (%02X): %02x\n", DM9000_TCR, dm9000_io_read(DM9000_TCR));
|
||||
rt_kprintf("TSRI (%02X): %02x\n", DM9000_TSR1, dm9000_io_read(DM9000_TSR1));
|
||||
rt_kprintf("TSRII (%02X): %02x\n", DM9000_TSR2, dm9000_io_read(DM9000_TSR2));
|
||||
rt_kprintf("RCR (%02X): %02x\n", DM9000_RCR, dm9000_io_read(DM9000_RCR));
|
||||
rt_kprintf("RSR (%02X): %02x\n", DM9000_RSR, dm9000_io_read(DM9000_RSR));
|
||||
rt_kprintf("ORCR (%02X): %02x\n", DM9000_ROCR, dm9000_io_read(DM9000_ROCR));
|
||||
rt_kprintf("CRR (%02X): %02x\n", DM9000_CHIPR, dm9000_io_read(DM9000_CHIPR));
|
||||
rt_kprintf("CSCR (%02X): %02x\n", DM9000_CSCR, dm9000_io_read(DM9000_CSCR));
|
||||
rt_kprintf("RCSSR (%02X): %02x\n", DM9000_RCSSR, dm9000_io_read(DM9000_RCSSR));
|
||||
rt_kprintf("ISR (%02X): %02x\n", DM9000_ISR, dm9000_io_read(DM9000_ISR));
|
||||
rt_kprintf("IMR (%02X): %02x\n", DM9000_IMR, dm9000_io_read(DM9000_IMR));
|
||||
rt_kprintf("\n");
|
||||
}
|
||||
|
||||
|
@ -156,10 +156,8 @@ void rtthread_startup(void)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
rt_uint32_t UNUSED level;
|
||||
|
||||
/* disable interrupt first */
|
||||
level = rt_hw_interrupt_disable();
|
||||
rt_hw_interrupt_disable();
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
Loading…
x
Reference in New Issue
Block a user