AT91SAM9261EK板DM9000网卡求助

中文QNX 讨论: 欢迎大家灌水,讨论有关QNX 问题。

AT91SAM9261EK板DM9000网卡求助

帖子vansharp » 周五 8月 05, 2011 3:27 pm

AT91SAM9261EK硬件连接如下:
NRD/CFOE-------IOR#
NWE/NWR0/CFWE------IOW#
EBI0-NCS2------CS#
PC11/FIQ------INT
PC10-----------RST
PC2/NWAIT-------IOWAIT
A2——CMD
首先u-boot下是能正常启动dm9000网卡的(TFTP可正常工作),u-boot启动过程输出:
dm9000 i/o: 0x30000000, id: 0x90000a46
MAC: 22:34:56:78:08:14
operating at 100M full duplex mode

/********************************************************************************************************************************************/
dm9000网卡驱动是参考ti-dm355 BSP中的,还有参考了版上comquter对相同问题的解答,对9261 startup修改如下:
pio-init()中增加如下相关代码:
kprintf("ETH, ");
/*Set SMC for ETH (refer to u-boot 1.1.4)*/
out32(AT91SAM9261_SMC_BASE + AT91_SMC_SETUP(2), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0)| AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0));
out32(AT91SAM9261_SMC_BASE + AT91_SMC_PULSE(2), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_( 8 )| AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_( 8 ));
out32(AT91SAM9261_SMC_BASE + AT91_SMC_CYCLE(2), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
out32(AT91SAM9261_SMC_BASE + AT91_SMC_MODE(2), AT91_SMC_BAT_WRITE|AT91_SMC_DBW_16 | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1));
/*Configure Reset signal in output PC10*/
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PER, 0x00000400); // Set in PIO mode
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_OER, 0x00000400); //Configure in Output
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_CODR, 0x00000400); /*clear Output*/
/*Configure PIOC(PC11)interrupt for Ethernet Dm9000 (function inti_gpio_intr()in intrinfo.c )*/

/********************************************************************************************************************************/
同时参考i.MX27 BSP的写了GPIO interrupt callout
Init_intrinfo.c中修改增加相关内容
const static struct startup_intrinfo intrs[] = {
{ _NTO_INTR_CLASS_EXTERNAL, // vector base
32, // number of vectors
_NTO_INTR_SPARE, // cascade vector
0, // CPU vector base
0, // CPU vector stride
0, // flags

{ INTR_GENFLAG_LOAD_SYSPAGE, 0, &interrupt_id_at91sam9xx_aic },
{ INTR_GENFLAG_LOAD_SYSPAGE | INTR_GENFLAG_LOAD_INTRMASK, 0, &interrupt_eoi_at91sam9xx_aic },
&interrupt_mask_at91sam9xx_aic, // mask callout
&interrupt_unmask_at91sam9xx_aic, // unmask callout
0, // config callout
&aic_base,
},
{ 32, // vector base
96, // number of vectors
8, // cascade vector how to desicde???
0, // CPU vector base
0, // CPU vector stride
0, // flags

{ 0, 0, &interrupt_id_at91sam9261_gpio },
{ INTR_GENFLAG_LOAD_INTRMASK, 0, &interrupt_eoi_at91sam9261_gpio },
&interrupt_mask_at91sam9261_gpio, // mask callout
&interrupt_unmask_at91sam9261_gpio, // unmask callout
0, // config callout
&gpio_base,
},
};
void init_gpio_intr(void)
{
/*Mask off all PIO interrupts, and clear status (disable all PIO interrupts)*/
out32(AT91SAM9261_PIOA_BASE + AT91_PIO_IER, 0x00000000);
out32(AT91SAM9261_PIOA_BASE + AT91_PIO_IDR,0xFFFFFFFF);
out32(AT91SAM9261_PIOB_BASE + AT91_PIO_IER, 0x00000000);
out32(AT91SAM9261_PIOB_BASE + AT91_PIO_IDR,0xFFFFFFFF);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IER, 0x00000000);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IDR,0xFFFFFFFF);

/*enalbe PC11 interrupt*/
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IDR, 0xFFFFF7FF);

/*Enable PIO & Configure PIO pin as input, with pull-up resistors, glitch filters and input change interrupts*/
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PDR, 0xFFFFF7FF);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IFER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IFDR, 0xFFFFF7FF);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PUER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PUDR, 0xFFFFF7FF);
}
/*****************************************************************************************************************************/
系统内核起来后
# io-pkt-v4-hc -d dm9000 ioport=0x30000300,irq=107,step=4
Unable to init devn-dm9000.so: Unknown error

# sloginfo
Time Sev Major Minor Args
Jan 01 00:01:38 5 14 0 tcpip starting
Jan 01 00:01:38 3 14 0 Unable to attach to pci server: No such file or directory
Jan 01 00:01:38 3 14 0 Using pseudo random generator. See "random" option
Jan 01 00:01:38 5 14 0 initializing IPsec... done
Jan 01 00:01:38 5 14 0 IPsec: Initialized Security Association Processing.
Jan 01 00:01:38 6 10 0 id = 0
Jan 01 00:01:38 6 10 0 id = 0
Jan 01 00:01:38 2 10 0 DM9000 not found
Jan 01 00:01:38 2 14 0 shim: unable to init dll devn-dm9000.so: No such device
Jan 01 00:01:38 2 14 0 Unable to init devn-dm9000.so: Unknown error
执行
# io-pkt-v4-hc -d dm9000 ioport=0x30000000,irq=107,step=4
结果也都是无法获取dm9000的ID:id=0
麻烦大家帮分析分析问题出在哪里呀,3Q
vansharp
Senior Member
 
帖子: 49
注册: 周五 1月 16, 2009 10:40 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子comquter » 周一 8月 08, 2011 9:39 pm

直接VID(0x28~0x29), PID(0x2A~0x2B)看看,VID应为0x0A46,PID应为0x9000.读不对的话,说明CS2设置有问题,或者地址有误.能够正确读到VID/PID后再调驱动.
comquter
Moderator
 
帖子: 269
注册: 周四 9月 18, 2003 3:08 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子vansharp » 周三 8月 10, 2011 8:38 pm

comquter您好,参照你的提议,重新设置了CS2。调试过程中发现当我把init_intrinfo.c中有关初始化设置INT(PC11)的代码注释掉
即注释以下代码
/*Enable PIO & Configure PIO pin as input, with pull-up resistors, glitch filters and input change interrupts*/
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PDR, 0xFFFFF7FF);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IFER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IFDR, 0xFFFFF7FF);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PUER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PUDR, 0xFFFFF7FF);
后可以正常能够正确读到VID/PID(0x90000a46)
/****************************************************************************************************************************************************/
这时再去启动:
# io-pkt-v4-hc -d dm9000 ioport=0x30000000,irq=107
# sloginfo
Time Sev Major Minor Args
Jan 01 00:00:39 5 14 0 tcpip starting
Jan 01 00:00:39 3 14 0 Unable to attach to pci server: No such file or
directory
Jan 01 00:00:39 3 14 0 Using pseudo random generator. See "random" op
tion
Jan 01 00:00:39 5 14 0 initializing IPsec... done
Jan 01 00:00:39 5 14 0 IPsec: Initialized Security Association Process
ing.
Jan 01 00:00:39 6 10 0 id = 0x90000a46
Jan 01 00:00:40 6 10 0 Fastether
Jan 01 00:00:40 2 10 0 InterruptAttachEvent at "C:/ide-4.5-workspace/B
SP-ATMEL-AT91SAM9261-EK_devn-dm9000/dm9000/dm9000.c":515: Invalid argument
Jan 01 00:00:40 2 14 0 shim: unable to init dll devn-dm9000.so: No suc
h device
Jan 01 00:00:40 2 14 0 Unable to init devn-dm9000.so: Unknown error
中断号有问题呀,麻烦再帮分析分析呀 :)
不理解为什么一旦设置了PC11为PIO使能就无法读取dm9000的ID了呢
最后由 vansharp 编辑于 周三 8月 10, 2011 9:04 pm,总共编辑了 1 次
vansharp
Senior Member
 
帖子: 49
注册: 周五 1月 16, 2009 10:40 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子vansharp » 周三 8月 10, 2011 9:01 pm

还有能讲解讲解callout的机理吗。今天参考参考i.MX27 BSP重新修改了GPIO interrupt callout。我对interrupt callout 的理解是:
1)id:每个interrupt handler的起始都会调用这段汇编代码获取相应的中断号,同时屏蔽和清除相应的中断;
2)eoi:每个interrupt handler的结尾出调用这段汇编代码重新使能开放相应的中断;
3)mask和unmask:是每次调用InterruptMask()和InterruptUnmask()才触发的。
o(∩_∩)o 请指正。
中断‘级联’时参数cascade vector是怎么确定的呢?
/******************************************************************************************************************************************************************/
init_intrinfo.c:
extern struct callout_rtn interrupt_id_at91sam9xx_aic;
extern struct callout_rtn interrupt_eoi_at91sam9xx_aic;
extern struct callout_rtn interrupt_mask_at91sam9xx_aic;
extern struct callout_rtn interrupt_unmask_at91sam9xx_aic;

extern struct callout_rtn interrupt_id_at91sam9261_gpio;
extern struct callout_rtn interrupt_eoi_at91sam9261_gpio;
extern struct callout_rtn interrupt_mask_at91sam9261_gpio;
extern struct callout_rtn interrupt_unmask_at91sam9261_gpio;

static paddr_t aic_base = AT91SAM9261_AIC_BASE;
static paddr_t gpio_base = AT91SAM9261_PIOA_BASE;

const static struct startup_intrinfo intrs[] = {
{ _NTO_INTR_CLASS_EXTERNAL, // vector base
32, // number of vectors
_NTO_INTR_SPARE, // cascade vector
0, // CPU vector base
0, // CPU vector stride
0, // flags

{ INTR_GENFLAG_LOAD_SYSPAGE, 0, &interrupt_id_at91sam9xx_aic },
{ INTR_GENFLAG_LOAD_SYSPAGE | INTR_GENFLAG_LOAD_INTRMASK, 0, &interrupt_eoi_at91sam9xx_aic },
&interrupt_mask_at91sam9xx_aic, // mask callout
&interrupt_unmask_at91sam9xx_aic, // unmask callout
0, // config callout
&aic_base,
},
{ 32, // vector base
96, // number of vectors
2, // cascade vector ?????how to know???
0, // CPU vector base
0, // CPU vector stride
0, // flags

{ 0, 0, &interrupt_id_at91sam9261_gpio },
{ INTR_GENFLAG_LOAD_INTRMASK, 0, &interrupt_eoi_at91sam9261_gpio },
&interrupt_mask_at91sam9261_gpio, // mask callout
&interrupt_unmask_at91sam9261_gpio, // unmask callout
0, // config callout
&gpio_base,
},
};
/****************************************************************************************************************************************************************/
参考Customizing Image Startup Programs 和 at91sam9261 datasheet都没找到相应的依据(可能是我还不理解),最后我是参考at91sam9261 datasheet中Peripheral ID来设置的(给PIOA/PIOB/PIOC分别分配了ID 2/3/4),能解释下该怎么指定吗
vansharp
Senior Member
 
帖子: 49
注册: 周五 1月 16, 2009 10:40 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子vansharp » 周四 8月 11, 2011 8:32 pm

前面引起无法读取dm9000的ID是由于我设置GPIO时的一个错误引起的
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PDR, 0xFFFFF7FF);该设置影响了RST(---PC10)硬件复位信号。 :oops:
/*************************************************************************************************************************************************/
# io-pkt-v4-hc -d dm9000 ioport=0x30000000,irq=107,mac=112233445566,verbose=9 -p tcpip &
# sloginfo
Time Sev Major Minor Args
Jan 01 00:01:14 5 14 0 tcpip starting
Jan 01 00:01:14 3 14 0 Unable to attach to pci server: No such file or
directory
Jan 01 00:01:14 3 14 0 Using pseudo random generator. See "random" op
tion
Jan 01 00:01:14 5 14 0 initializing IPsec... done
Jan 01 00:01:14 5 14 0 IPsec: Initialized Security Association Process
ing.
Jan 01 00:01:14 6 10 0 id = 90000a46
Jan 01 00:01:14 6 10 0 Fastether
Jan 01 00:12:01 5 14 0 tcpip starting
Jan 01 00:12:01 3 14 0 Unable to attach to pci server: No such file or
directory
Jan 01 00:12:01 3 14 0 Using pseudo random generator. See "random" op
tion
Jan 01 00:12:01 5 14 0 initializing IPsec... done
Jan 01 00:12:01 5 14 0 IPsec: Initialized Security Association Process
ing.
Jan 01 00:12:01 6 10 0 id = 90000a46
Jan 01 00:12:01 6 10 0 Chip Revision 1
Jan 01 00:12:01 5 10 0 I/O mode 0
Jan 01 00:12:01 6 10 0 Fastether
Jan 01 00:12:01 5 14 0 io-pkt shim
Jan 01 00:12:01 5 14 0 Vendor .............. 0x0
Jan 01 00:12:01 5 14 0 Device .............. 0x0
Jan 01 00:12:01 5 14 0 Revision ............ 0x0
Jan 01 00:12:01 5 14 0 I/O port base ....... 0x30000000
Jan 01 00:12:01 5 14 0 Interrupt ........... 0x6b
Jan 01 00:12:01 5 14 0 MAC address ......... 112233 445566
Jan 01 00:12:01 5 10 0 Starting DM9000 driver

Process 73734 (sloginfo) exited status=0.
# nicinfo
en0:
Davicom DM9000 Ethernet Controller

Physical Node ID ........................... 008000 800000
Current Physical Node ID ................... 112233 445566
Current Operation Rate ..................... Unknown
Active Interface Type ...................... MII
Active PHY address ....................... 1
Maximum Transmittable data Unit ............ 1514
Maximum Receivable data Unit ............... 1514
Hardware Interrupt ......................... 0x6b
I/O Aperture ............................... 0x30000000
Promiscuous Mode ........................... Off
Multicast Support .......................... Enabled

Packets Transmitted OK ..................... 0
Bytes Transmitted OK ....................... 0

Packets Received OK ........................ 0
Bytes Received OK .......................... 0

Single Collisions on Transmit .............. 0
Multiple Collisions on Transmit ............ 0
Deferred Transmits ......................... 0
Late Collision on Transmit errors .......... 0
Transmit Underruns ......................... 0
Receive Alignment errors ................... 0
Received packets with CRC errors ........... 0
Packets Dropped on receive ................. 0
Ethernet Headers out of range .............. 0
Oversized Packets received ................. 0
Short packets .............................. 0
Total Frames experiencing Collison(s) ...... 0
/*************************************************************************************************************************************************/
# ifconfig en0 192.168.0.5
# ping -c 10 192.168.0.5
PING 192.168.0.5 (192.168.0.5): 56 data bytes
64 bytes from 192.168.0.5: icmp_seq=0 ttl=255 time=2 ms
64 bytes from 192.168.0.5: icmp_seq=1 ttl=255 time=2 ms
64 bytes from 192.168.0.5: icmp_seq=2 ttl=255 time=2 ms
64 bytes from 192.168.0.5: icmp_seq=3 ttl=255 time=2 ms
64 bytes from 192.168.0.5: icmp_seq=4 ttl=255 time=2 ms
64 bytes from 192.168.0.5: icmp_seq=5 ttl=255 time=2 ms
64 bytes from 192.168.0.5: icmp_seq=6 ttl=255 time=3 ms
64 bytes from 192.168.0.5: icmp_seq=7 ttl=255 time=3 ms
64 bytes from 192.168.0.5: icmp_seq=8 ttl=255 time=2 ms
64 bytes from 192.168.0.5: icmp_seq=9 ttl=255 time=3 ms

----192.168.0.5 PING Statistics----
10 packets transmitted, 10 packets received, 0% packet loss
round-trip min/avg/max = 2/2/3 ms variance = 1 ms^2

# ping -c 10 192.168.0.6
PING 192.168.0.6 (192.168.0.6): 56 data bytes
ping: sendto: Host is down
ping: sendto: Host is down
ping: sendto: Host is down
ping: sendto: Host is down
只能ping自身ok,其他都不行呀。麻烦版上的各位大大再帮看看分析分析呀
vansharp
Senior Member
 
帖子: 49
注册: 周五 1月 16, 2009 10:40 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子xtang » 周四 8月 11, 2011 11:58 pm

mac 地址改成 "001122334455" 试试?
xtang
Moderator
 
帖子: 1815
注册: 周五 9月 12, 2003 4:14 am
地址: China

Re: AT91SAM9261EK板DM9000网卡求助

帖子comquter » 周五 8月 12, 2011 3:48 am

1)id:每个interrupt handler的起始都会调用这段汇编代码获取相应的中断号,同时屏蔽和清除相应的中断;
每当硬件有中断产生时,内核会调用第一级的id callout, 若有设备挂到返回的ID上,则1)如果是用InterruptAttach()挂的,内核会调用interrupt handler,然后调用eoi callout. 2)如果是用InterruptAttachEvent()挂的,内核会先调用mask callout, 然后eoi callout,然后向用户发送event,用户必须调用InterruptUnmask来重新使能中断.

中断‘级联’的cascade vector为此级联callout所挂的中断号,比如说你的GPIO系统中断号为8,cascade vector应置为8,这样如果第一级ID返回为8的话,内核会自动调用级联中断的callout.
comquter
Moderator
 
帖子: 269
注册: 周四 9月 18, 2003 3:08 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子comquter » 周五 8月 12, 2011 3:56 am

你的PortC中断callout应级联到4上,共有32个中断.
comquter
Moderator
 
帖子: 269
注册: 周四 9月 18, 2003 3:08 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子vansharp » 周五 8月 12, 2011 10:41 am

xtang你好,将mac 地址改成 "001122334455" ,还是不行呀,现象还是一样的。所以我从两个方面来看,一是gpio的中断处理有问题,二是dm9000 driver的问题。为此参考i.mx27中的gpio interrupt callout处理重新查阅了at91sam9261的gpio interrupt callout,感觉处理没问题的呀(i.mx27和at91sam9261对register方式有些不一样,所以参考9261 datasheet也重新确认<at91:PIO_IER/IDR write_only, PIO_IMR/ISR read_only>),麻烦各位帮忙再看看gpio interrupt callout 代码:
/*****************************************************************************************************************************************************/
#include "callout.ah"
#include <arm/at91sam9xx.h>

/*
* -----------------------------------------------------------------------
* Patch callout code (for GPIO)
*
* On entry:
* r0 - physical address of syspage
* r1 - virtual address of syspage
* r2 - offset from start of syspage to start of the callout routine
* r3 - offset from start of syspage to read/write data used by callout
* -----------------------------------------------------------------------
*/
interrupt_patch_gpio:
stmdb sp!, {r4, lr}
ldr r1, [sp, #8]
ldr r1, [r1]
add r4, r0, r2 /* address of callout routine */

/*
* Map interrupt controller registers
*/
mov r0, #0x600 /* size of GPIO registers:0x200*3 */
bl callout_io_map

/*
* Patch the callout routine
*/
CALLOUT_PATCH r4, r0, r1, r2, ip
ldmia sp!, {r4, pc}


/*
* -----------------------------------------------------------------------
* Identify GPIO interrupt source.
*
* Returns interrupt number in r4
* -----------------------------------------------------------------------
*/
CALLOUT_START(interrupt_id_at91sam9261_gpio, 0, interrupt_patch_gpio)
/*
* Get the interrupt controller base address (patched)
*/
mov ip, #0x000000ff
orr ip, ip, #0x0000ff00
orr ip, ip, #0x00ff0000
orr ip, ip, #0xff000000

mov r5, #0

2:
cmp r5, #0x40 /* Scan PIO A to PIO C */
bgt 1f

/*
* Read Interrupt Mask and Status
*/
ldr r3, [ip, #AT91_PIO_IMR]
ldr r2, [ip, #AT91_PIO_ISR]
ands r2, r3, r2
addeq r5, r5, #0x20
addeq ip, ip, #0x200
beq 2b

/*
* Scan for first set bit
*/
mov r4, #32
mov r1, #1

0:
subs r4, r4, #1
blt 1f
tst r2, r1, lsl r4
beq 0b

/*
* Mask the interrupt source(current)
*/
mov r1, r1, lsl r4
/*bic r3, r3, r1*/
/*str r3, [ip, #AT91_PIO_IMR]*/
str r1, [ip, #AT91_PIO_IDR]

/*
* Clear interrupt status (ISR auto clear)
*When the software reads PIO_ISR, all the interrupts are automatically cleared.
*This signifies that all the interrupts that are pending when PIO_ISR is read
*must be handled.
*/
/*str r1, [ip, #AT91_PIO_ISR]*/

add r4, r4, r5
1:
CALLOUT_END(interrupt_id_at91sam9261_gpio)

/*
* -----------------------------------------------------------------------
* Acknowledge specified GPIO interrupt
*
* On entry:
* r4 contains the interrupt number
* r7 contains the interrupt mask count
* -----------------------------------------------------------------------
*/
CALLOUT_START(interrupt_eoi_at91sam9261_gpio, 0, interrupt_patch_gpio)
/*
* Get the interrupt controller base address (patched)
*/
mov ip, #0x000000ff
orr ip, ip, #0x0000ff00
orr ip, ip, #0x00ff0000
orr ip, ip, #0xff000000

/*
* Only unmask interrupt if mask count is zero(+0x200)
*/
teq r7, #0
bne 0f

and r2, r4, #0x1F
sub r1, r4, r2
orr ip, ip, r1, lsl #4

/*
* Unmask the interrupt
*/
/*ldr r3, [ip, #AT91_PIO_IMR]*/
mov r1, #1
/*orr r3, r3, r1, lsl r2*/
mov r3, r1, lsl r2
str r3, [ip, #AT91_PIO_IER]

0:
CALLOUT_END(interrupt_eoi_at91sam9261_gpio)

/*
* -----------------------------------------------------------------------
* Mask specified GPIO interrupt
*
* On entry:
* r0 - syspage_ptr
* r1 - interrupt number
*
* Returns:
* r0 - error status
* -----------------------------------------------------------------------
*/
CALLOUT_START(interrupt_mask_at91sam9261_gpio, 0, interrupt_patch_gpio)
/*
* Get the interrupt controller base address (patched)
*/
mov ip, #0x000000ff
orr ip, ip, #0x0000ff00
orr ip, ip, #0x00ff0000
orr ip, ip, #0xff000000

and r2, r1, #0x1F
sub r1, r1, r2
orr ip, ip, r1, lsl #4

/*
* Mask the interrupt
*/
/*ldr r3, [ip, #AT91_PIO_IMR]*/
mov r1, #1
/*bic r3, r3, r1, lsl r2*/
mov r3, r1, lsl r2
str r3, [ip, #AT91_PIO_IDR]

mov r0, #0
mov pc, lr
CALLOUT_END(interrupt_mask_at91sam9261_gpio)

/*
* -----------------------------------------------------------------------
* Unmask specified GPIO interrupt
*
* On entry:
* r0 - syspage_ptr
* r1 - interrupt number
*
* Returns:
* r0 - error status
* -----------------------------------------------------------------------
*/
CALLOUT_START(interrupt_unmask_at91sam9261_gpio, 0, interrupt_patch_gpio)
/*
* Get the interrupt controller base address (patched)
*/
mov ip, #0x000000ff
orr ip, ip, #0x0000ff00
orr ip, ip, #0x00ff0000
orr ip, ip, #0xff000000

and r2, r1, #0x1F
sub r1, r1, r2
orr ip, ip, r1, lsl #4

/*
* Unmask the interrupt
*/
/*ldr r3, [ip, #AT91_PIO_IMR]*/
mov r1, #1
/*orr r3, r3, r1, lsl r2*/
mov r3, r1, lsl r2
str r3, [ip, #AT91_PIO_IER]

mov r0, #0
mov pc, lr
CALLOUT_END(interrupt_unmask_at91sam9261_gpio)
vansharp
Senior Member
 
帖子: 49
注册: 周五 1月 16, 2009 10:40 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子comquter » 周五 8月 12, 2011 10:59 pm

你的callout不对,MX27的几个PORT都挂到同一个IRQ(8)上,而AT91SAM9261的PORT!,B,C是分别挂到IRQ2,3,4上的.
comquter
Moderator
 
帖子: 269
注册: 周四 9月 18, 2003 3:08 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子vansharp » 周二 8月 16, 2011 7:13 pm

comquter你好,之前网络不通是由于gpio interrupt callout的问题。现在网络的状况是偶尔可以ping通(目标板与开发机直连,网线是OK的),接收数据包大部分都丢失了:
/*************************************************************************************************************************/
# nicinfo
en0:
Davicom DM9000 Ethernet Controller

Physical Node ID ........................... 008000 800000
Current Physical Node ID ................... 001122 334455
Current Operation Rate ..................... Unknown
Active Interface Type ...................... MII
Active PHY address ....................... 1
Maximum Transmittable data Unit ............ 1514
Maximum Receivable data Unit ............... 1514
Hardware Interrupt ......................... 0x6b
I/O Aperture ............................... 0x30000000
Promiscuous Mode ........................... Off
Multicast Support .......................... Enabled

Packets Transmitted OK ..................... 23
Bytes Transmitted OK ....................... 768

Packets Received OK ........................ 63
Bytes Received OK .......................... 26532

Single Collisions on Transmit .............. 0
Multiple Collisions on Transmit ............ 0
Deferred Transmits ......................... 0
Late Collision on Transmit errors .......... 0
Transmit Underruns ......................... 0
Receive Alignment errors ................... 0
Received packets with CRC errors ........... 0
Packets Dropped on receive ................. 5278
Ethernet Headers out of range .............. 0
Oversized Packets received ................. 0
Short packets .............................. 0
Total Frames experiencing Collison(s) ...... 0
vansharp
Senior Member
 
帖子: 49
注册: 周五 1月 16, 2009 10:40 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子comquter » 周二 8月 16, 2011 8:24 pm

Current Operation Rate为什么是Unknown?给驱动加一个verbose然后用sloginfo看看MII的是什么情况.
comquter
Moderator
 
帖子: 269
注册: 周四 9月 18, 2003 3:08 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子vansharp » 周二 8月 16, 2011 10:16 pm

# sloginfo
Time Sev Major Minor Args
Jan 01 00:02:11 5 14 0 tcpip starting
Jan 01 00:02:11 3 14 0 Unable to attach to pci server: No such file or
directory
Jan 01 00:02:11 3 14 0 Using pseudo random generator. See "random" op
tion
Jan 01 00:02:11 5 14 0 initializing IPsec... done
Jan 01 00:02:11 5 14 0 IPsec: Initialized Security Association Process
ing.
Jan 01 00:02:11 6 10 0 id = 90000a46
Jan 01 00:02:11 6 10 0 Chip Revision 1
Jan 01 00:02:11 5 10 0 I/O mode 0
Jan 01 00:02:11 6 10 0 Fastether
Jan 01 00:02:11 5 14 0 io-pkt shim
Jan 01 00:02:11 5 14 0 Vendor .............. 0x0
Jan 01 00:02:11 5 14 0 Device .............. 0x0
Jan 01 00:02:11 5 14 0 Revision ............ 0x0
Jan 01 00:02:11 5 14 0 I/O port base ....... 0x30000000
Jan 01 00:02:11 5 14 0 Interrupt ........... 0x6b
Jan 01 00:02:11 5 14 0 MAC address ......... 001122 334455
Jan 01 00:02:11 5 10 0 Starting DM9000 driver
Jan 01 00:03:27 5 10 0 multicast msg bdb14 - type 105 - flags 0
请问Current Operation Rate是在哪块检测的呢?看驱动一直没看到在哪处理呀 :oops:
vansharp
Senior Member
 
帖子: 49
注册: 周五 1月 16, 2009 10:40 am

Re: AT91SAM9261EK板DM9000网卡求助

帖子vansharp » 周三 8月 17, 2011 12:50 pm

在驱动程序中强制设定参数media_rate和duplex,网络正常了(看来是自动检测处理有问题)
# sloginfo
Time Sev Major Minor Args
Jan 01 00:01:14 5 14 0 tcpip starting
Jan 01 00:01:14 3 14 0 Unable to attach to pci server: No such file or
directory
Jan 01 00:01:14 3 14 0 Using pseudo random generator. See "random" op
tion
Jan 01 00:01:14 6 10 0 id = 90000a46
Jan 01 00:01:14 6 10 0 Chip Revision 1
Jan 01 00:01:14 5 10 0 I/O mode 0
Jan 01 00:01:14 6 10 0 Fastether
Jan 01 00:01:14 5 10 0 devn-dm9000: forcing the link
Jan 01 00:01:14 5 14 0 io-pkt shim
Jan 01 00:01:14 5 14 0 Vendor .............. 0x0
Jan 01 00:01:14 5 14 0 Device .............. 0x0
Jan 01 00:01:14 5 14 0 Revision ............ 0x0
Jan 01 00:01:14 5 14 0 I/O port base ....... 0x30000000
Jan 01 00:01:14 5 14 0 Interrupt ........... 0x6b
Jan 01 00:01:14 5 14 0 MAC address ......... 001122 334455
Jan 01 00:01:14 5 10 0 Starting DM9000 driver
Jan 01 00:03:12 5 10 0 multicast msg bdb18 - type 105 - flags 0

Process 229382 (sloginfo) exited status=0.
# nicinfo
en0:
Davicom DM9000E Ethernet Controller

Physical Node ID ........................... 008000 800000
Current Physical Node ID ................... 001122 334455
Current Operation Rate ..................... 100.00 Mb/s full-duplex
Active Interface Type ...................... MII
Active PHY address ....................... 1
Maximum Transmittable data Unit ............ 1514
Maximum Receivable data Unit ............... 1514
Hardware Interrupt ......................... 0x6b
I/O Aperture ............................... 0x30000000
I/O Aperture ............................... 0x30000000
Multicast Support .......................... Enabled

Packets Transmitted OK ..................... 6612258
Bytes Transmitted OK ....................... 647663460

Packets Received OK ........................ 6613450
Bytes Received OK .......................... 647761136

Single Collisions on Transmit .............. 0
Multiple Collisions on Transmit ............ 0
Deferred Transmits ......................... 0
Late Collision on Transmit errors .......... 0
Transmit Underruns ......................... 0
Receive Alignment errors ................... 0
Received packets with CRC errors ........... 0
Packets Dropped on receive ................. 0
Ethernet Headers out of range .............. 0
Oversized Packets received ................. 0
Short packets .............................. 0
Total Frames experiencing Collison(s) ...... 0
vansharp
Senior Member
 
帖子: 49
注册: 周五 1月 16, 2009 10:40 am


回到 四海同心QNX论坛

在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客

cron