ebuf

Name

ebuf -- Routines to manipulate EBUFs

Synopsis



#define     EBUF_MAX_PACKET
#define     EBUF_POOL_SIZE
#define     EBUF_RECEIVE
#define     EBUF_TRANSMIT
#define     EBUF_NO_TX_FREE
#define     EBUF_TX_FAILURE
#define     EBUF_TX_OK
#define     ebuf_init                       (buf)
#define     ebuf_remlen                     (buf)
#define     ebuf_moveptr                    (buf,len)
void        ebuf_add_u8                     (EBUF *buf,
                                             u8 b);
void        ebuf_add_u16                    (EBUF *buf,
                                             u16 w);
void        ebuf_add_u32                    (EBUF *buf,
                                             u32 w);
#define     ebuf_add_bytes                  (buf,bytes,cnt)
#define     ebuf_get_u8                     (buf,var)
#define     ebuf_get_u16                    (buf,var)
#define     ebuf_get_u32                    (buf,var)

Description

These routines muck with EBUFs, named so for their ancient Ethernet heritage. We do most of our communications with the PJB in an EBUF.

Details

EBUF_MAX_PACKET

#define EBUF_MAX_PACKET 1518	/* max size of an Ethernet packet + CRC */


EBUF_POOL_SIZE

#define EBUF_POOL_SIZE	4	/* number of packets in the Ethernet pool */


EBUF_RECEIVE

#define EBUF_RECEIVE	0


EBUF_TRANSMIT

#define EBUF_TRANSMIT   0x8000


EBUF_NO_TX_FREE

#define EBUF_NO_TX_FREE	0x4000


EBUF_TX_FAILURE

#define EBUF_TX_FAILURE	0x2000


EBUF_TX_OK

#define EBUF_TX_OK	0x1000


ebuf_init()

#define ebuf_init(buf) usb_initbuf(buf)

initialize an ebuf so we can add data to it

buf : an EBUF structure


ebuf_remlen()

#define ebuf_remlen(buf) ((buf)->eb_length)

return remaining bytes (length) while parsing packets

buf : an EBUF structure


ebuf_moveptr()

#define     ebuf_moveptr(buf,len)

??

buf : an EBUF structure
len : Length


ebuf_add_u8 ()

void        ebuf_add_u8                     (EBUF *buf,
                                             u8 b);

Add a byte to an EBUF, incrementing the length

buf : an EBUF structure
b : byte to add


ebuf_add_u16 ()

void        ebuf_add_u16                    (EBUF *buf,
                                             u16 w);

Add a 16-bit word to an EBUF, incrementing the length

buf : an EBUF structure
w : word to add


ebuf_add_u32 ()

void        ebuf_add_u32                    (EBUF *buf,
                                             u32 w);

Add a 32-bit word to teh ebuf, incrementing the length

buf : an EBUF structure
w : dword to add


ebuf_add_bytes()

#define     ebuf_add_bytes(buf,bytes,cnt)

add a buffer of bytes

buf : an EBUF structure
bytes : ??
cnt : ??


ebuf_get_u8()

#define     ebuf_get_u8(buf,var)

return next u8 from the ebuf, advancing pointer and reducing length

buf : an EBUF structure
var : ??


ebuf_get_u16()

#define     ebuf_get_u16(buf,var)

return next u16 from the ebuf, advancing pointer and reducing length

buf : an EBUF structure
var : ??


ebuf_get_u32()

#define     ebuf_get_u32(buf,var)

return next u32 from the ebuf, advancing pointer and reducing length

buf : an EBUF structure
var : ??