Performs reply message verification and swabbing. txinfoReply is called each time a TX INFO message is received. The function verifies the received message and then converts all fields in the message to the native representation of fields that span more than 1 byte (for example, 16-bit or 32-bit values).
TXINFO_MSG *txinfoReply ( CPIPKT *pkt, S16 len, U32 *ccode)
Argument |
Description |
pkt |
Pointer to CPI packet to be verified and converted to native representation. |
len |
Byte length of packet to be converted. |
ccode |
Address where the verification or conversion result code is placed. |
Return value |
Description |
SUCCESS |
|
SCCIP_INVALID_TYPE |
Invalid TX INFO message type encountered. |
SCCIP_NULL_POINTER |
Invalid NULL pointer detected. |
SCCIP_TOO_SMALL |
Provided buffer size is too small. |
SCCIP_UNKNOWN_COMMAND |
Unknown command (TX INFO operation) encountered. |
Call txinfoReply for each message that is received in response to any other TX INFO API request (such as a response to a txinfoSystemInfo request). Call txinfoReply before performing additional processing of the TX INFO response. Once txinfoReply has returned successfully, all fields of the received message hold values represented in the host system’s native orientation.
void CpiaRxNotif( TX_HANDLE handle, void *chkey )
{
CPIPKT rcvBuf;
S16 len;
CPI_ERR_TYPE cpi_error;
TXINFO_MSG *msg;
U32 ccode;
/* ----- read the received message ----- */
len = sizeof( CPIPKT );
if (cpia_get_data( handle, &rcvBuf, &len ) == CPI_ERROR)
{
cpi_error = cpi_get_last_error( );
fprintf( stderr, "\nERROR: Receive error (%s)\n",
cpi_get_error_str( cpi_error ) );
return;
}
/* ----- process (and verify) received system information message ----- */
msg = txinfoReply( &rcvBuf, len, &ccode );
if ( (msg == NULL) || (ccode != 0) )
{ /* invalid message received */
fprintf( stderr, "\nERROR: Reply message (%p) ccode=0x%08X\n",
msg, ccode );
return;
}
/* ----- entire message has been verified ----- */
sysInfo = &msg->response.info.system;
temp = sysInfo->status.cpuTemp;
printf( "CPU Temp: %dC [%dF] degrees\n", temp, (U32)(((temp*9)/5)+32));
temp = sysInfo->status.boardTemp;
printf( "Board Temp: %dC [%dF] degrees\n", temp, (U32)(((temp*9)/5)+32));
temp = sysInfo->status.cpuTemp;
printf( "Fan State: %u\n", sysInfo->status.fanState );