User's Manual

UMAC Turbo CPU/Communications Board Hardware Manual
Ethernet Protocol 39
memcpy(EthCmd.bData,&mask,len);
// Send command request
send(sock,(char *)&EthCmd,ETHERNETCMDSIZE+len,0);
recv(sock,(char *)&errcode,1,0);
VR_PMAC_SETBITS
This packet causes the Ethernet connection to perform a write to the DPRAM shared between the PMAC
and the PMAC that sets bits in a 32-bit word to a new value. The wValue field contains the byte offset to
retrieve the data.. The bData field of the Ethernet command packet must be stuffed with a mask
indicating which bits to set in four bytes followed by four bytes that indicate the bits to clear in a 32-bit
word. 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:
EthCmd.RequestType = VR_UPLOAD;
EthCmd.Request = VR_PMAC_SETBITS;
EthCmd.wValue = htons((WORD)offset);
EthCmd.wIndex = 0;
EthCmd.wLength = htons(2*sizeof(DWORD));
temp = 0xFF03FFFF ;
memcpy(EthCmd.bData,&temp,sizeof(DWORD));
temp = 0x00030000 ;
memcpy(EthCmd.bData + 4,&temp,sizeof(DWORD));
// Send command request
send(sock,(char *)&EthCmd,ETHERNETCMDSIZE + 2*sizeof(DWORD),0);
recv(sock,(char *)&errcode,1,0);