Delta Tau GEO BRICK LV User Manual

Page of 440
 
Turbo PMAC User Manual 
414 
Writing a Host Communications Program 
Every command that is sent to the Turbo PMAC through an Ethernet port begins using the 
ETHERNETCMD packet structure and is initiated with a PC send command.  Every command then must 
issue a recv command to either receive an acknowledgement character back via the recv command or 
receive meaningful data. 
#define ETHERNETCMDSIZE 8 
send(sock,(char *)&EthCmd,ETHERNETCMDSIZE,0); 
recv(sock,(char *)&EthCmd,1,0); 
Turbo PMAC Ethernet Protocol Command Set 
This section describes the important commands in the Ethernet communications protocols and how they 
must be implemented. 
VR_PMAC_FLUSH 
This packet causes a <CTRL-X> command character (flush communications buffers) to be issued to the 
Turbo PMAC and will wait up to 10 msec for Turbo PMAC to respond with an acknowledging <CTRL-
X> echo character.  The packet that is sent should be set up as follows.  One byte will be returned upon 
successful completion of the command. 
EthCmd.RequestType = VR_DOWNLOAD; 
EthCmd.Request     = VR_PMAC_FLUSH; 
EthCmd.wValue      = 0; 
EthCmd.wIndex      = 0; 
EthCmd.wLength     = 0; 
EthCmd.bData – not used for this command 
Example 
int CALLBACK PmacSockFlush() 
   ETHERNETCMD EthCmd; 
   int         rc,iTimeout; 
 
   EthCmd.RequestType = VR_DOWNLOAD; 
   EthCmd.Request     = VR_PMAC_FLUSH; 
   EthCmd.wValue      = htons(FLUSH_TIMEOUT); 
   EthCmd.wIndex      = 0; 
   EthCmd.wLength     = 0; 
 
   send(sock, 
        (char *)&EthCmd, 
         ETHERNETCMDSIZE , 
         0); 
   recv(sock, 
        (char *)&EthCmd, 
        1, 
        0); 
The above example and all of the examples in this document do not perform error checking and timeout 
checking.  It is the application developer’s responsibility to perform error checking and timeout checks to 
insure that the application does not hang. 
VR_PMAC_SENDLINE 
This packet causes the NULL-terminated string in EthCmd.bData to be sent to the Turbo PMAC.   The 
string should not be terminated with a carriage return as this is done by the firmware.  One byte will be 
returned upon successful completion of the command.