Embedded Web Server for the CR16
National Semiconductor
Jeff Wright
19
UWORD RxBufLen; /* Rx buffer length */
UBYTE *TxBuf; /* Pointer to data to send */
UWORD TxCount; /* Number of bytes to xmit */
const UBYTE *html; /* Points to any const data to xmit */
UWORD HtmLen; /* Number of bytes in HTML page */
} UDPAPI_T;
Figure 11 - UDPs Interface data structure
Where these are the command semaphores
#define UDP_RECV BIT1
#define UDP_SEND BIT5
The Network Layer (IP)
The IP layer interfaces with Transport protocols sitting above it, such as TCP and UDP (and
logically ICMP), and Data link protocols sitting below it, such as SLIP, PPP, and Ethernet. The
Transport layer interfaces with the IP layer by way of two data structures:
1.
IPAPI_T holds the command from the Transport layer, as well as several pointers necessary to
locate the various data.
typedef struct ipapi_t {
UBYTE Cmd;
// Command flags from Transport layer
UBYTE RxProtoc;
// Protocol number of Rx datagram
UBYTE TxProtoc;
// Protocol number of Tx datagram
UBYTE TTL;
// Time To Live value
QUADB_T ForIP;
// Source and Dest IP ddresses
QUADB_T LocIP;
UBYTE *RxBuf; // Pointers to the Rx and Tx buffers
UWORD RxCount; // Number of bytes recd
UWORD RxBufLen; // Rx buffer
UBYTE *TxBuf; // Pointer to RAM-based Tx data
UWORD TxCount; // RAM-based data length
const UBYTE *html; // Pointer to ROM-based Tx data (HTML page?)
UWORD HtmLen; // ROM-based data length
TCP_T *TCPTxSeg; // Pointer to TCP Tx segment header
TCP_T *TCPRxSeg; // Pointer to TCP Rx segment
UDP_T *UDPTxSeg; // Pointer to UDP Tx segment header
UDP_T *UDPRxSeg; // Pointer to UDP Rx segment header
ICMP_T *ICMPTxSeg; // Pointer to ICMP Tx segment header
ICMP_T *ICMPRxSeg; // Pointer to ICMP Rx segment header
}IPAPI_T;
Figure 12. IPs Interface data structure
IP responds to the following commands...
#define IPSEND BIT0
#define IPRECV BIT1