|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
|
Listing 2ýThis portion of the RTL8019AS initialization process is more concerned with getting the RCM2100ýs Rabbit Semiconductor 2000 microprocessor in line.
After that is accomplished, the code does a ý9346 head fake on the RTL8019AS.
#ifdef ETHCOREMOD
#asm
;
; initializes Ethernet Core Module boards
;
ld a,(PEDDRShadow) ; PE2,PE6 io strobes
or a,0x44
ld (PEDDRShadow),a
ioi ld (PEDDR),a
ld a,(PEFRShadow) ; PE2,PE6 io strobes
or a,0x44
ld (PEFRShadow),a
ioi ld (PEFR),a
ld a,0x90 ; set the io strobes
ld (IB2CRShadow),a
ioi ld (IB2CR),a
ld a,0xa8
ld (IB6CRShadow),a
ioi ld (IB6CR),a
ld a,(PDDDRShadow)
or a,0x90 ; PD7,PD4 outputs
ld (PDDDRShadow),a
ioi ld (PDDDR),a
ld a,(PDDCRShadow) ; no open drains, no special functions
and a,0x6f
ld (PDDCRShadow),a
ioi ld (PDDCR),a
ld a,(PDFRShadow)
and a,0x6f
ld (PDFRShadow),a
ioi ld (PDFR),a
ld a,(PDDRShadow)
or a,0x10
ld (PDDRShadow),a
ioi ld (PDDR),a
ld hl,1000 ; wait for NIC to reset and establish link...
call mswait
ld a,(PDDRShadow) ; PD7=OFF,PD4=OFF
and a,0x6f
ld (PDDRShadow),a
ioi ld (PDDR),a
ld hl, PD_RD1
resetloop: ; wait for NIC to reset and establish link...
ioe ld a, (hl)
cp 0x7E
jr z, resetloop
;
; read then write to the RESET register
; Poll the reset bit in the INTSTATUS register
;
ioe ld a,(PD_RD1+PD_RESET)
ld hl,16
call tickwait
ioe ld (PD_WR1+PD_RESET),a
ld a,0x21 ; stop NIC
ioe ld (PD_WR1),a
ld hl,16 ; wait 1.6ms
call tickwait
;; clear all currently pending interrupts
ld a,0xFF
ioe ld (PD_WR1+PD_INTSTATUS),a
;; set up interrupt vector
ld hl, pd_int0
push hl
ld hl, 0x0001
push hl
call SetVectExtern2000
add sp, 4
;; set up PE4,5 exteral interrupt lines
ld a, 0x33
ioi ld (I0CR), a
ioi ld (I1CR), a
;
; emulate the 9346 for first RealTek
;
ipset 1
ld a,0xc0
ioe ld (PD_WR1),a
ld a,0x40
ioe ld (PD_WR1+PD_9346CR),a
call emu_9346
ipres
ld hl,5
call tickwait
#endasm
j = 0;
for (i=0; i<6; i++) {
EthAddress1[i] = SysIDBlock.macAddr[i];
j += EthAddress1[i];
}
// if ID block's MAC address is zero, hit a runtime error...
if (j == 0) exception(251);
rt_init(PD_WR1, EthAddress1);
// any initialization code common to all boards goes here
#endif // ETHCOREMOD
|
|||||||||||||||||||||||||||||||||
|
Copyright © 2003 ChipCenter-QuestLink About ChipCenter-Questlink |
||||||||||||||||||||||||||||||||||