找回密码
 注册
搜索
查看: 685|回复: 1

[讨论] 那位兄弟做过cs8900a?帮俺看一段代码,谢谢

[复制链接]
发表于 2008-3-21 14:33:41 | 显示全部楼层 |阅读模式
我的是DV710的开发板str710+cs8900
非常感谢?
另硬件上如果8900的D线连接不变,但A线有偏移
比如本来SA0是连到A11的,现在变SA0口连到A0
是否可以修改下面的代码得以实现
谢谢
下面这一段语句看不懂。
摘至ethernet.h
// Ports for I/O-Mode
#define ETH_Port(n) (*(vu16*)(0x64000000 | (n) << 11))

#define ETH_RX_Frame_Port   ETH_Port(0)
#define ETH_TX_Frame_Port   ETH_Port(0)
#define ETH_TX_CMD_Port     ETH_Port(4)
#define ETH_TX_LEN_Port     ETH_Port(6)
#define ETH_Addr_Port       ETH_Port(10)
#define ETH_Data_Port       ETH_Port(12)

象下面这一段语句,这一些定义可以在cs8900a的datasheet里找到地址定义
// Configuration and control registers
#define PP_RxCFG        0x0102  // Rx Bus config
#define PP_RxCTL        0x0104  // Receive Control Register
#define PP_LineCTL      0x0112  // Line Config Register
#define PP_SelfCTL      0x0114  // Self Command Register

// Status and Event Registers
#define PP_RxEvent      0x0124  // Rx Event Register
#define PP_LineST       0x0134  // Line State Register
#define PP_SelfST       0x0136  // Self State register
#define PP_BusST        0x0138  // Bus Status

// Adress Filter Registers
#define PP_IA           0x0158  // Physical Address Register

然而下面的这段代码,地址定义cs8900a的datasheet中就没有定义

// PP_RxCFG - Receive Configuration and Interrupt Mask bit definition -
Read/write
#define SKIP_1              0x0040
#define RX_OK_ENBL          0x0100

// PP_RxCTL - Receive Control bit definition - Read/write
#define RX_OK_ACCEPT        0x0100
#define RX_IA_ACCEPT        0x0400
#define RX_BROADCAST_ACCEPT 0x0800

// PP_TxCMD - Transmit Command bit definition - Read-only and
// PP_TxCommand - Write-only
#define TX_START_ALL_BYTES  0x00C9

// PP_LineCTL - Line Control bit definition - Read/write
#define SERIAL_RX_ON        0x0040
#define SERIAL_TX_ON        0x0080

// PP_SelfCTL - Software Self Control bit definition - Read/write
#define POWER_ON_RESET      0x0040

// PP_RxEvent - Receive Event Bit definition - Read-only
#define RX_OK               0x0100
#define RX_IA               0x0400
#define RX_BROADCAST        0x0800

// PP_LineST - Ethernet Line Status bit definition - Read-only
#define LINK_OK             0x0080

// PP_SelfST - Chip Software Status bit definition
#define INIT_DONE           0x0080

// PP_BusST - ISA Bus Status bit definition
#define READY_FOR_TX_NOW    0x0100
发表于 2008-3-21 19:27:49 | 显示全部楼层
你看看Datasheet中Table 17. I/O Mode Mapping就应该能明白
#define ETH_Port(n) (*(vu16*)(0x64000000 | (n) << 11))
n<<11的原因是SA0接了A11,如果接A0就不需要移位了,但0x64000000就要根据片选/CHIPSEL来决定
点评回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )

GMT+8, 2024-10-7 18:21 , Processed in 0.045406 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表