阅读:2475回复:5
请问rtl8139中,如何访问serial EEPROM?
请问rtl8139中,如何访问serial EEPROM啊
/* Serial EEPROM section. */ /* EEPROM_Ctrl bits. */ #define EE_SHIFT_CLK 0x04 /* EEPROM shift clock. */ #define EE_CS 0x08 /* EEPROM chip select. */ #define EE_DATA_WRITE 0x02 /* EEPROM chip data in. */ #define EE_WRITE_0 0x00 #define EE_WRITE_1 0x02 #define EE_DATA_READ 0x01 /* EEPROM chip data out. */ #define EE_ENB (0x80 | EE_CS) /* Delay between EEPROM clock transitions. No extra delay is needed with 33Mhz PCI, but 66Mhz may change this. */ #define eeprom_delay() inl(ee_addr) /* The EEPROM commands include the alway-set leading bit. */ #define EE_WRITE_CMD (5) #define EE_READ_CMD (6) #define EE_ERASE_CMD (7) static int read_eeprom(long ioaddr, int location, int addr_len) { int i; unsigned retval = 0; long ee_addr = ioaddr + Cfg9346; int read_cmd = location | (EE_READ_CMD << addr_len); outb(EE_ENB & ~EE_CS, ee_addr); outb(EE_ENB, ee_addr); /* Shift the read command bits out. */ for (i = 4 + addr_len; i >= 0; i--) { int dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; outb(EE_ENB | dataval, ee_addr); eeprom_delay(); outb(EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); eeprom_delay(); } outb(EE_ENB, ee_addr); eeprom_delay(); for (i = 16; i > 0; i--) { outb(EE_ENB | EE_SHIFT_CLK, ee_addr); eeprom_delay(); retval = (retval << 1) | ((inb(ee_addr) & EE_DATA_READ) ? 1 : 0); outb(EE_ENB, ee_addr); eeprom_delay(); } /* Terminate the EEPROM access. */ outb(~EE_CS, ee_addr); return retval; } EE_WRITE_CMD,EE_READ_CMD,EE_ERASE_CMD是干什么的呀? EEPROM的地址空间是怎样的? rtl8139B中有几个地址空间? 谢谢! |
|
最新喜欢:changj...
|
沙发#
发布于:2003-01-18 01:17
网卡的eeprom用的一般都是3线(EECS, EECLK, EEIO,也就是Microwire总线)的串行eeprom
其中最常用的就是93cXX系列,rtl8139中存取eeprom用到的就是ee_addr = ioaddr + Cfg9346寄存器 bit7 6 5 4 3 2 1 0 1 x x x EECS EECLK EEDI EEDO 关于eeprom的读写可参看附件 或下载地址:http://www.laogu.com/script/display.asp?Did=235 |
|
|
板凳#
发布于:2003-02-08 21:01
我已经明白了,不过还是要谢谢你!
由于放寒假,没有及时地给分,I am sorry. 祝你春节愉快! |
|
|
地板#
发布于:2003-02-14 10:34
有8139的驱动manual么?有的话给我一份,谢谢
callmefire@sina.com |
|
地下室#
发布于:2003-02-14 11:46
是要8139的LINUX源代码还是8139的芯片资料?
|
|
|
5楼#
发布于:2007-04-27 17:22
怎么下不了了
|
|