3 buffer offset, Example 2 – Texas Instruments TMS320DM36X User Manual

Page 27

Advertising
background image

www.ti.com

Architecture

Example 2. Receive Buffer Descriptor in C Structure Format

/*

// EMAC Descriptor

//

// The following is the format of a single buffer descriptor

// on the EMAC.

*/

typedef struct _EMAC_Desc {

struct _EMAC_Desc *pNext;

/* Pointer to next descriptor in chain

*/

Uint8

*pBuffer;

/* Pointer to data buffer

*/

Uint32

BufOffLen;

/* Buffer Offset(MSW) and Length(LSW)

*/

Uint32

PktFlgLen;

/* Packet Flags(MSW) and Length(LSW)

*/

} EMAC_Desc;

/* Packet Flags

*/

#define EMAC_DSC_FLAG_SOP

0x80000000u

#define EMAC_DSC_FLAG_EOP

0x40000000u

#define EMAC_DSC_FLAG_OWNER

0x20000000u

#define EMAC_DSC_FLAG_EOQ

0x10000000u

#define EMAC_DSC_FLAG_TDOWNCMPLT

0x08000000u

#define EMAC_DSC_FLAG_PASSCRC

0x04000000u

#define EMAC_DSC_FLAG_JABBER

0x02000000u

#define EMAC_DSC_FLAG_OVERSIZE

0x01000000u

#define EMAC_DSC_FLAG_FRAGMENT

0x00800000u

#define EMAC_DSC_FLAG_UNDERSIZED

0x00400000u

#define EMAC_DSC_FLAG_CONTROL

0x00200000u

#define EMAC_DSC_FLAG_OVERRUN

0x00100000u

#define EMAC_DSC_FLAG_CODEERROR

0x00080000u

#define EMAC_DSC_FLAG_ALIGNERROR

0x00040000u

#define EMAC_DSC_FLAG_CRCERROR

0x00020000u

#define EMAC_DSC_FLAG_NOMATCH

0x00010000u

2.6.5.3

Buffer Offset

This 16-bit field must be initialized to zero by the software application before adding the descriptor to a
receive queue.

Whether or not this field is updated depends on the setting of the RXBUFFEROFFSET register. When the
offset register is set to a non-zero value, the received packet is written to the packet buffer at an offset
given by the value of the register, and this value is also written to the buffer offset field of the descriptor.

When a packet is fragmented over multiple buffers because it does not fit in the first buffer supplied, the
buffer offset only applies to the first buffer in the list, which is where the start of packet (SOP) flag is set in
the corresponding buffer descriptor. In other words, the buffer offset field is only updated by the EMAC on
SOP descriptors.

The range of legal values for the BUFFEROFFSET register is 0 to (Buffer Length – 1) for the smallest
value of buffer length for all descriptors in the list.

27

SPRUFI5B – March 2009 – Revised December 2010

Ethernet Media Access Controller (EMAC)/Management Data Input/Output

(MDIO)

Submit Documentation Feedback

© 2009–2010, Texas Instruments Incorporated

Advertising