Delta Tau GEO BRICK LV Manuale Utente
Turbo PMAC User Manual
Writing a Host Communications Program
419
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 read data from the DPRAM shared between the Turbo
PMAC CPU and the Ethernet microcontroller. 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.
PMAC CPU and the Ethernet microcontroller. 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 Turbo PMAC
CPU and the Ethernet microcontroller. 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 1 byte via the recv function before
continuing. The data received is irrelevant; its purpose is to insure the sender’s command was received.
CPU and the Ethernet microcontroller. 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 1 byte via the recv function before
continuing. The data received is irrelevant; its purpose is to insure the sender’s command was received.
Example
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 DPRAM shared between the Turbo
PMAC CPU and the Ethernet microcontroller 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 from. After
sending the packet the programmer must wait to receive 1 byte via the recv function before continuing.
The data received is irrelevant; its purpose is to insure the sender’s command was received.
PMAC CPU and the Ethernet microcontroller 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 from. After
sending the packet the programmer must wait to receive 1 byte via the recv function before continuing.
The data received is irrelevant; its purpose is to insure 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 complement mask to prepare firmware for AND
if(!on)