Delta Tau GEO BRICK LV User Manual

Page of 440
Turbo PMAC User Manual 
Writing a Host Communications Program
 
413
 
Turbo PMAC Ethernet communications ports talk using the UDP or TCP protocol of the TCP/IP suite of 
protocols on port 1025.  Therefore, the programmer should open either a datagram socket (UDP) or a 
stream socket (TCP) on port 1025 the PMACPORT. 
sock = socket(PF_INET,SOCK_DGRAM,0);   // UDP Mode 
 
 
 
or  
sock = socket(PF_INET,SOCK_STREAM,0);   // TCP Mode 
// 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)); 
PMAC Ethernet Protocol Command Packet Description 
Command Packets.  All commands are sent over the socket in the form of the following structure: 
/ Ethernet command structure 
typedef struct tagEthernetCmd 
  BYTE  RequestType; 
  BYTE  Request; 
  WORD  wValue; 
  WORD  wIndex; 
  WORD  wLength; 
  BYTE  bData[1492]; 
} ETHERNETCMD,*PETHERNETCMD; 
The following is a description of the fields in the ETHERNETCMD structure. 
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 Tau 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 you are requesting from the Turbo PMAC Ethernet 
connection0.  Below is 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 
#define VR_PMAC_WRITEBUFFER  0xC6 
#define VR_PMAC_WRITEERROR   0xC7 
#define VR_FWDOWNLOAD        0xCB 
#define VR_IPADDRESS         0xE0 
wValue is request specific, and its use is indicated in under the description of each command. 
wIndex is request specific, and its use is indicated in under the description of each command. 
wLength indicates the length of the bData field below. 
bData is the meaningful data that is sent to the PMAC.