User's Manual

Turbo PMAC User Manual
Writing a Host Communications Program 417
EthCmd.wValue = htons((WORD)offset);
EthCmd.wIndex = htons((WORD)outch);
EthCmd.wLength = 0;
To receive data from the host port set the packet as follows. After sending the packet the programmer will
receive 1 byte, which is the value the Ethernet port read from the Turbo PMAC’s CPU host port.
EthCmd.RequestType = VR_UPLOAD;
EthCmd.Request = VR_PMAC_PORT;
EthCmd.wValue = htons(offset);
EthCmd.wIndex = 0;
EthCmd.wLength = 0;
VR_PMAC_READREADY
This packet permits determining if there is data on the Turbo PMAC CPU ready to be read.
Two bytes will be returned. The first byte, if non-zero, indicates there is data to be read; if zero, there is
no data to be read. The packet will be set up as follows:
EthCmd.RequestType = VR_UPLOAD;
EthCmd.Request = VR_PMAC_READREADY;
EthCmd.wValue = 0;
EthCmd.wIndex = 0;
EthCmd.wLength = htons(2);
Example
ETHERNETCMD EthCmd;
char data[2];
int rc;
EthCmd.RequestType = VR_UPLOAD;
EthCmd.Request = VR_PMAC_READREADY;
EthCmd.wValue = 0;
EthCmd.wIndex = 0;
EthCmd.wLength = htons(2);
rc = send(sock,((char *)&EthCmd),ETHERNETCMDSIZE,0);
rc = recv(*((SOCKET *)vh[dwDevice].hDriver),data,2,0);
return data[0];
VR_CTRL_REPONSE
This packet permits obtaining the response after sending a control character. The packet is set up as
follows. The received data is the response to the sent control character. Meaningful data is returned for
the following control characters <CTRL-B>, <CTRL-C>, <CTRL-F>, <CTRL-G>, <CTRL-P>, and
<CTRL-V>. All other data control characters do not return meaningful data.
EthCmd.RequestType = VR_UPLOAD;
EthCmd.Request = VR_CTRL_RESPONSE;
EthCmd.wValue = htons(outchar);//outchar=ctrl char to send out
EthCmd.wIndex = 0;
EthCmd.wLength = htons(len);
rc = send(sock,((char *)&EthCmd),ETHERNETCMDSIZE,0);
rc = recv(sock,outstr,len,0); // returned data appears
VR_PMAC_WRITEBUFFER
This packet permits writing multiple lines to the Turbo PMAC with just one packet. The packet is set up
as follows. The received data is the response to the sent control character. It is usually used for
downloading a file. Data should be of the form in which each line is separated by null byte.