User's Manual
UMAC Turbo CPU/Communications Board Hardware Manual
Ethernet Protocol 38
EthCmd.wIndex = 0;
EthCmd.wLength = htons( (WORD)strlen(outstr));
strncpy((char *)&EthCmd.bData[0],outstr,(WORD)strlen(outstr));
send(sock,(char*)&EthCmd,ETHERNETCMDSIZE + strlen(outstr),0);
recv(sock, szPmacData,1400,0);
VR_PMAC_GETMEM
This packet causes the Ethernet connection to retrieve DPRAM data from the UMAC Turbo
CPU/Communications Board. Up to 1400 bytes may be received in a single packet. The wValue field
contains the byte offset to retrieve the data from, while the wLength parameter indicates how many bytes
to receive.
Example:
EthCmd.RequestType = VR_UPLOAD;
EthCmd.Request = VR_PMAC_GETMEM;
EthCmd.wValue = htons(offset); //
EthCmd.wIndex = 0;
EthCmd.wLength = htons(length);
send(sock,(char *)&EthCmd,ETHERNETCMDSIZE ,0);
recv(sock,(char *)data,1400,0);
VR_PMAC_SETMEM
This packet causes the Ethernet connection to write data to the DPRAM shared between the UMAC
Turbo CPU/Communications Board and the host port. Up to 1400 bytes may be written in a single
packet. The wValue field contains the byte offset to write the data to while the wLength parameter
indicates how many bytes to write. After sending the packet, the programmer must wait to receive one
byte via the Recv function before continuing. The data received is irrelevant; its purpose is to ensure that
the sender’s command was received.
Example Packet Setup:
EthCmd.RequestType = VR_UPLOAD;
EthCmd.Request = VR_PMAC_SETMEM;
EthCmd.wValue = htons(offset);
EthCmd.wIndex = 0;
EthCmd.wLength = htons(length);
VR_PMAC_SETBIT
This packet causes the Ethernet connection to perform a write to the DPRAM shared between the PMAC
and the PMAC that either sets bits in a 32-bit word or clears bits in a 32-bit word. If the wIndex
parameter is supplied with a 1, a logical or is performed that sets bits. If it is 0, a logical AND is
performed, which clears bits. It is the programmer’s responsibility to use the appropriate mask for setting
or clearing bits. The wValue field contains the byte offset to retrieve the data. After sending the packet,
the programmer must wait to receive one byte via the Recv function before continuing. The data received
is irrelevant; its purpose is to ensure that the sender’s command was received.
Example:
DWORD mask = 0x00000001;
EthCmd.RequestType = VR_UPLOAD;
EthCmd.Request = VR_PMAC_SETBIT;
EthCmd.wValue = htons((WORD)offset);
EthCmd.wIndex = htons((WORD)on);
EthCmd.wLength = htons(len);
// generate the mask
mask <<= bitno; // zero based
// If clearing a bit compliment mask to prepare the firmware for AND
if(!on)
mask = ~mask;