User's Manual

UMAC Turbo CPU/Communications Board Hardware Manual
Ethernet Protocol 32
ETHERNET PROTOCOL
This section is intended for application programmers who have a fundamental understanding of Berkley
sockets used in the TCP/IP protocol suite. Before any attempt to read or understand the contents of this
manual, review basic sockets (recv, send and socket) and understand them before proceeding.
The examples in this manual are for demonstration purposes only and to convey the concepts of how to
communicate to the Delta Tau card. Therefore, the examples do not include error checking and timeouts.
Delta Tau’s actual production code does, however, and application programmers are strongly encouraged
to include error checking and timeouts in the code to prevent hang-ups and unresponsive behavior.
The UMAC Turbo CPU/Communications Board talks using either the UDP or the TCP protocol of the
TCP/IP suite of protocols on port 1025. (See the section on protocol setup.) Therefore, the programmer
should open a datagram socket on the port 1025, the PMACPORT.
sock = socket(PF_INET,SOCK_DGRAM,0);// change SOCK_DGRAM to
SOCK_STREAM for TCP
// Embedded Ethernet's IP address
// The port that the embedded program is listening on.
sin.sin_port = htons(PMACPORT);
connect(*sock,(struct sockaddr*)&sin,sizeof(sin));
Ethernet Protocol Command Packet Description
Command Packets
All commands sent over the socket are in the following structure:
/ Ethernet command structure
typedef struct tagEthernetCmd
{
BYTE RequestType;
BYTE Request;
WORD wValue;
WORD wIndex;
WORD wLength;
BYTE bData[1492];
} ETHERNETCMD,*PETHERNETCMD;
A description of the fields in the ETHERNETCMD structure follows:
RequestType is used in certain commands to indicate whether the request is an input with respect to the
PC or an output command with respect to the PC.
Delta makes the following defines VR_UPLOAD = 0xC0 for a command sent to host and
VR_DOWNLOAD = 0x40 for a command sent to the device.
Request indicates what type of command if requesting from the PMAC Ethernet connection. A list of
defines for the currently supported command set:
#define VR_PMAC_SENDLINE 0xB0
#define VR_PMAC_GETLINE 0xB1
#define VR_PMAC_FLUSH 0xB3
#define VR_PMAC_GETMEM 0xB4
#define VR_PMAC_SETMEM 0xB5
#define VR_PMAC_SETBIT 0xBA
#define VR_PMAC_SETBITS 0xBB
#define VR_PMAC_PORT 0xBE
#define VR_PMAC_GETRESPONSE 0xBF
#define VR_PMAC_READREADY 0xC2
#define VR_CTRL_RESPONSE 0xC4
#define VR_PMAC_GETBUFFER 0xC5