📄 drv_8019.lst
字号:
381 1 print("\n\r Write/Read Write/Read Write/Read Write/Read");
382 1 print("\n\r------------------------------------------------------------------------");
-
383 1 for (i=0; i < 16; i++) {
384 2 /* Page0 select */
385 2 EN_CMD = EN_PAGE0 + EN_NODMA + EN_START;
386 2 print("\n\r"); putb_ser(i);print(" ");
387 2 write = EN_PAGE0 + EN_NODMA + EN_START;
388 2 /* outportb(i,write); */
389 2 putb_ser(write);
390 2 print(" "); read = inportb(i);
391 2 putb_ser(read); print(" ");
392 2
393 2 /* Page1 select */
394 2 EN_CMD = EN_PAGE1 + EN_NODMA + EN_START;
395 2 write = EN_PAGE1 + EN_NODMA + EN_START;
396 2 /* outportb(i,write); */
397 2 putb_ser(write); print(" ");
398 2 read = inportb(i);
399 2 putb_ser(read); print(" ");
400 2
401 2 /* Page2 select */
402 2 EN_CMD = EN_PAGE2 + EN_NODMA + EN_START;
403 2 print("x ");
404 2 read = inportb(i);
405 2 putb_ser(read); print(" ");
406 2
407 2 /* Page3 select */
408 2 EN_CMD = EN_PAGE3 + EN_NODMA + EN_START;
409 2 write = EN_PAGE3 + EN_NODMA + EN_START;
410 2 /* outportb(i,write); */
411 2 putb_ser(write);
412 2 print(" ");
413 2 read = inportb(i);
414 2 putb_ser(read); print(" ");
415 2 }
416 1 print("\n\r------------------------------------------------------------------------\n\r");
417 1 }
418
419 //*****************************************************************************/
420 //* D M A Write
- */
421 //*****************************************************************************/
422 void DMA_write(byte *buffer, word StartAddr, word Count)
C51 COMPILER V7.07 DRV_8019 04/20/2004 18:04:40 PAGE 8
423 {
424 1 word loop;
425 1
426 1 //print("\n\rDMA write : ");
427 1 EN_CMD = EN_PAGE0 + EN_NODMA + EN_START; /* Remote DMA, Start the chip, clear reset */
428 1
429 1 EN0_RCNTLO = (byte)(Count & 0xff); /* LSB Remote byte count reg */
430 1 EN0_RCNTHI = (byte)(Count >> 8); /* MSB Remote byte count reg */
431 1
432 1 EN0_RSARLO = (byte)(StartAddr & 0xff); /* LSB Remote start address reg */
433 1 EN0_RSARHI = (byte)(StartAddr >> 8); /* MSB Remote start address reg */
434 1
435 1 EN_CMD = EN_PAGE0 + EN_RWRITE + EN_START; /* Remote Write, Start the chip, clear reset */
436 1 for(loop=0;loop < Count;loop++){
437 2 EN_DATA = *buffer++;
438 2 //putb_ser(*buffer++);
439 2 }
440 1
441 1 }
442
443
444 /*****************************************************************************/
445 /* D M A Read */
446 /*****************************************************************************/
447 void ethernet_test(void)
448 {
449 1 byte temp1,temp2;
450 1
451 1 print("\n\n\r/*****************************************************************/\n\r");
452 1 print("/* RTL8019AS TEST ROUTINE 0.5.2 */\n\r");
453 1 print("/* If you see 0x50 and 0x70 or 'P' and 'p', it operate well */\n\r");
454 1 print("/*****************************************************************/\n\r");
455 1
456 1 temp1 = EN0_8019ID0; /* EN0_8019ID0 */
457 1 temp2 = EN0_8019ID1; /* EN0_8019ID1 */
458 1 putb_ser(temp1);
459 1 putb_ser(temp2);
460 1
461 1 if ((temp1 != 0x50)|(temp2 != 0x70)) {
462 2 print(" Circuit have H/W problem.\n\r");
463 2
464 2 }
465 1 print(" Circuit OK!\n\r");
466 1
467 1
468 1 #ifdef STRING_TEST
test = 0x1234;
printf("\n\n\r%x %d ",test,test);
putb_ser(test);
test1 = (byte)test;
printf("\n\n\r%x %d ",test1,test1);
#endif
475 1
476 1 }
477
478 /*****************************************************************************/
479 /* RTL8019AS Initialize */
480 /*****************************************************************************/
481 void ethernet_init(void)
482 {
483 1 word i;
484 1
C51 COMPILER V7.07 DRV_8019 04/20/2004 18:04:40 PAGE 9
485 1 #ifdef RTL8019AS_ID_CHECK
ethernet_test();
#endif
488 1
489 1 EN_RESET = 0x00; /* very important !!!!! */
490 1 for (i=0;i<DELAY;i++);
491 1
492 1 EN_CMD = EN_PAGE0 + EN_NODMA + EN_STOP; /* 00001010B: PS1 PS0 RD2 RD1 RD0 TXP STA STP */
493 1 EN0_DCFG = ENDCFG_FT10 + ENDCFG_BMS + ENDCFG_BOS; /* ?FIFO treshold 8byte !!,normal operation, byte
- transfer mode selection */
494 1
495 1 /* Clear the remote byte count registers. */
496 1 EN0_RCNTHI = 0x00; /* MSB remote byte count reg */
497 1 EN0_RCNTLO = 0x00; /* LSB remote byte count reg */
498 1
499 1 EN0_RXCR = E8390_RXOFF; /* RX configuration reg Monitor mode (no packet receive) */
500 1 EN0_TXCR = E8390_TXOFF; /* TX configuration reg set internal loopback mode */
501 1
502 1 EN0_TPSR = NE_START_PG;
503 1 EN0_STARTPG = RX_START_PG ; /* 菩哦 荐脚矫俊 肺拿 DMA啊 荐脚窍绰 其捞瘤甫 瘤沥茄促. 46h */
504 1 /* Starting page of ring buffer. First page of Rx ring buffer 46h*/
505 1 EN0_BOUNDARY = RX_START_PG; /* Boundary page of ring buffer */
506 1 EN0_STOPPG = NE_STOP_PG; /* Ending page +1 of ring buffer */
507 1
508 1 EN_CMD = EN_PAGE1 + EN_NODMA + EN_STOP;
509 1 EN1_CURR = RX_START_PG + 1; /* RX_CURR_PG; Current memory page = RX_CURR_PG ? */
510 1 current_page = RX_START_PG + 1; /* assert boundary+1 */
511 1 next_pkt = RX_START_PG + 1;
512 1 EN_CMD = EN_PAGE0 + EN_NODMA + EN_STOP;
513 1 EN0_ISR = 0xff; /* INTerrupt stauts reg */
514 1 /* Host绰 牢磐反飘甫 老栏虐绰 巴阑 茫酒郴扁困秦 佬绰促.
515 1 阿 厚飘绰 包访等 bit俊 1阑 结 持澜栏肺辑 努府绢 等促.
516 1 弊巴篮 颇况诀 饶俊 馆靛矫 努府绢 登绢具茄促.(must) */
517 1 EN0_IMR = 0; /* INTerrupt mask reg = Disable all Interrupt */
518 1
519 1 EN_CMD = EN_NODMA + EN_PAGE1 + EN_STOP; /* Select page 1, remote DMA */
520 1
521 1 EN1_PAR0 = 0x12;
522 1 EN1_PAR1 = 0x34;
523 1 EN1_PAR2 = 0x56;
524 1 EN1_PAR3 = 0x78;
525 1 EN1_PAR4 = 0x9A;
526 1 EN1_PAR5 = 0xBC;
527 1 /* Initialize the multicast list to accept-all. If we enable multicast
528 1 the higher levels can do the filtering. multicast filter mask array (8 bytes) */
529 1 EN1_MAR0 = 0xff;
530 1 EN1_MAR1 = 0xff;
531 1 EN1_MAR2 = 0xff;
532 1 EN1_MAR3 = 0xff;
533 1 EN1_MAR4 = 0xff;
534 1 EN1_MAR5 = 0xff;
535 1 EN1_MAR6 = 0xff;
536 1 EN1_MAR7 = 0xff;
537 1
538 1 EN_CMD = EN_PAGE0 + EN_NODMA + EN_STOP; /* 00001010B: PS1 PS0 RD2 RD1 RD0 TXP STA STP */
539 1
540 1 EN0_ISR = 0xff; /* Individual bits are cleared by writing a "1" into it. */
541 1 /* It must be cleared after power up. */
542 1 EN0_IMR = ENISR_ALL; /* INTerrupt mask reg */
543 1
544 1 EN_CMD = EN_PAGE0 + EN_NODMA + EN_START;
545 1 EN0_TXCR = ENTXCR_TXCONFIG; /* xmit on. */
C51 COMPILER V7.07 DRV_8019 04/20/2004 18:04:40 PAGE 10
546 1 /* 3c503 TechMan says rxconfig only after the NIC is started. */
547 1 EN0_RXCR = ENRXCR_RXCONFIG; /* rx on(broadcasts, no multicast,errors */
548 1
549 1 CONFIG1 = 0x90; /* IRQ enable + INT0:IRQ2/9(pin 4) + I/O BASE(300H) */
550 1 CONFIG2 = 0x00;
551 1 CONFIG3 = 0xf0;
552 1 CONFIG4 = 0x00;
553 1
554 1 EthRxBufRdPtr = 0;
555 1 EthRxBufWrPtr = EthRxBufRdPtr + 1;
556 1
557 1 EN_CMD = EN_PAGE0 + EN_NODMA + EN_START;
558 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1881 ----
CONSTANT SIZE = 744 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 33
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 2 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -