Easy Web question

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Easy Web question

428 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tom84 on Tue Mar 27 01:47:02 MST 2012
Hello there,

i got a question about the easyweb example for the lpc1768.
Is the hole ethernetframe stored anywhere? If yes where?

Thanks and regards
0 Kudos
Reply
5 Replies

370 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sadegh.rabei on Wed Mar 09 13:15:20 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])
0 Kudos
Reply

370 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tom84 on Tue Mar 27 05:01:27 MST 2012
Of course i test if something is received [IMG]http://knowledgebase.nxp.com/images/icons/icon12.gif[/IMG],

but i see my idea was okay.:cool:
0 Kudos
Reply

370 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Mar 27 04:58:36 MST 2012
Could be useful to check if something is received :rolleyes:
CheckIfFrameReceived()
Then try:
StartReadingFrame();
CopyFromFrame_EthMAC(void *Dest, ETH_FRAG_SIZE);
StopReadingFrame();
0 Kudos
Reply

370 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tom84 on Tue Mar 27 04:38:47 MST 2012
so if i understand this right, i can do the following:

StartReadFrame // set rptr to the start of RX_DESC_PACKET = Rx_BUF
Copyfromframe(Memory i want to use, StartReadframe) // Read the hole frame
EndReadFrame // release the buffer

after that the hole frame should be in the meory area i wanted it to be. Right?

Thanks for the fast answer....
0 Kudos
Reply

370 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Mar 27 03:32:46 MST 2012
Of course :rolleyes:

As described in emac.h in AHB SRAM bank 1 :eek:

/* EMAC Memory Buffer configuration for 16K Ethernet RAM. */
#define NUM_RX_FRAG         4           /* Num.of RX Fragments 4*1536= 6.0kB */
#define NUM_TX_FRAG         2           /* Num.of TX Fragments 3*1536= 4.6kB */
#define ETH_FRAG_SIZE       1536        /* Packet Fragment size 1536 Bytes   */

#define ETH_MAX_FLEN        1536        /* Max. Ethernet Frame Size          */

/* EMAC variables located in AHB SRAM bank 1*/
#define RX_DESC_BASE        0x2007c000
#define RX_STAT_BASE        (RX_DESC_BASE + NUM_RX_FRAG*8)
#define TX_DESC_BASE        (RX_STAT_BASE + NUM_RX_FRAG*8)
#define TX_STAT_BASE        (TX_DESC_BASE + NUM_TX_FRAG*8)
#define[COLOR=Red] RX_BUF_BASE[/COLOR]         (TX_STAT_BASE + NUM_TX_FRAG*4)
#define[COLOR=Red] TX_BUF_BASE [/COLOR]        (RX_BUF_BASE  + NUM_RX_FRAG*ETH_FRAG_SIZE)
...
#define [COLOR=Red]RX_BUF(i) [/COLOR]          (RX_BUF_BASE + ETH_FRAG_SIZE*i)
#define [COLOR=Red]TX_BUF(i)[/COLOR]           (TX_BUF_BASE + ETH_FRAG_SIZE*i)
0 Kudos
Reply