Content originally posted in LPCWare by sadegh.rabei on Mon Mar 14 11:34:42 MST 2016
Hello there,
i got a question about the easyweb example for the lpc1768.
Here's how to calculate the highlighted lines?
thank you.
[color=#c00]#define NUM_RX_FRAG 4 /* Num.of RX Fragments 4*1536= 6.0kB */
#define NUM_TX_FRAG 3 /* Num.of TX Fragments 3*1536= 4.6kB */ [/color]
#define ETH_FRAG_SIZE 1536 /* Packet Fragment size 1536 Bytes */
#define ETH_MAX_FLEN 1536 /* Max. Ethernet Frame Size */
/* EMAC variables located in 16K Ethernet SRAM _ bank 1 */
#define RX_DESC_BASE 0x20080000
#define RX_STAT_BASE (RX_DESC_BASE + [color=#c00]NUM_RX_FRAG*8[/color]) // 4*(2*4)
#define TX_DESC_BASE (RX_STAT_BASE + [color=#c00]NUM_RX_FRAG*8[/color]) // 4*(2*4)
#define TX_STAT_BASE (TX_DESC_BASE + [color=#c00]NUM_TX_FRAG*8[/color]) // (4-1)*(2*4)
#define RX_BUF_BASE (TX_STAT_BASE +[color=#c00] NUM_TX_FRAG*4[/color]) // (4-1)*(1*4)
#define TX_BUF_BASE (RX_BUF_BASE + [color=#c00]NUM_RX_FRAG*ETH_FRAG_SIZE[/color])
/* RX and TX descriptor and status definitions. */
#define RX_DESC_PACKET(i) (*(unsigned int *)(RX_DESC_BASE + 8*i))
#define RX_DESC_CTRL(i) (*(unsigned int *)(RX_DESC_BASE+4 + 8*i))
#define RX_STAT_INFO(i) (*(unsigned int *)(RX_STAT_BASE + 8*i))
#define RX_STAT_HASHCRC(i) (*(unsigned int *)(RX_STAT_BASE+4 + 8*i))
#define TX_DESC_PACKET(i) (*(unsigned int *)(TX_DESC_BASE + 8*i))
#define TX_DESC_CTRL(i) (*(unsigned int *)(TX_DESC_BASE+4 + 8*i))
#define TX_STAT_INFO(i) (*(unsigned int *)([color=#c00]TX_STAT_BASE + 4*i[/color]))
#define RX_BUF(i) ([color=#c00]RX_BUF_BASE + ETH_FRAG_SIZE*i[/color])
#define TX_BUF(i) ([color=#c00]TX_BUF_BASE + ETH_FRAG_SIZE*i[/color])