Understanding Ethernet Protocol Stack and NE2000-Compatible Chip Configuration
This guide delves into the Ethernet protocol stack, focusing on ARP, Internet protocols, routing, and HTTP, with a specific emphasis on the NE2000-compatible Ethernet chip configuration. It covers critical aspects such as buffer size definitions, memory organization, and timing for data read/write operations. Key parameters like TXSTART, RXSTART, and RXSTOP are explained in detail, including how they are utilized and adjusted for packet transmission and reception. The document serves as a foundational resource for developers working with Ethernet networks and MCU integration.
Understanding Ethernet Protocol Stack and NE2000-Compatible Chip Configuration
E N D
Presentation Transcript
Driver 變數 • #define MAC_TX_BUFFER_SIZE (1024) //定義每一傳送封包最大Size • #define MAC_TX_BUFFER_COUNT (1) //定義幾個傳送封包的Buffer • #define NIC_PAGE_SIZE ( 256) //定義網卡每一個page等於256 bytes • // ( 此大小由網卡網卡硬體結構決定) • #define RAMPAGES (0x20) //網卡內建0x20(32) pages • // ( 此大小由網卡網卡硬體結構決定) • #define TXSTART (0x40) //網卡的傳送啟始頁(RAMPAGES由 此 • 開始往下到[0x20+0x40-1]結束) • #define TXPAGES (MAC_TX_BUFFER_COUNT * (MAC_TX_BUFFER_SIZE/NIC_PAGE_SIZE)) • #define RXSTART (TXSTART+TXPAGES) //網卡的接收起始頁 • #define RXSTOP (TXSTART+RAMPAGES-1) //網卡的糾收結束頁 • #define RXPAGES (RXSTOP - RXSTART) //定義網有多少接收page • // (PS.感覺RXSTOP-RXSTART比起實際的會少一頁) • // (需再仔細探討)
RTL8019AS Ethernet Chip TXSTART、RXSTART、RXSTOP 這三個初始化後,將固定不動 CURRP 初始化後,當開始接收封包時,網卡會依據收到的封包調整此暫存器之數值 BNRY 初始化後,當使用者從Receive Buffer拿走資料後,要將其空間釋放給網卡繼續接收封包時,必須有使用者自行修改新的數值
MCU 變數管理 NICReadPtr; 指向下一個新的receive packet所在網卡page number NICCurrentRdPtr 目前正在讀取的Receive packet起始page number NICCurrentTxBuffer 指定目前正在使用的Tx Buffer為規劃中的哪一塊