#include "example.h"
#define LOCAL
typedef struct
{
HMXF_BUFFER bufferTx;
uint64 moduleType;
}
EVENT_INFO;
uint32 eventHandler(HMXF_HANDLE hAsyncEvent, void* pParam);
int main(void)
{
uint32 rc;
uint64 channelCount=0;
HMXF_SERVER server;
HMXF_MODULE module=0;
HMXF_CHANNEL rx=0;
HMXF_CHANNEL tx=0;
HMXF_BUFFER bufferTx=0;
HMXF_BUFFER bufferRx=0;
HMXF_ASYNCEVENT asyncEvent=0;
uint32 txBufferSize;
uint32 rxBufferSize=0;
EVENT_INFO eventInfo;
char errorString[200];
uint64 moduleType=0;
#ifdef LOCAL
#else
#endif
if(!rc)
{
printf("Starting ...\n");
}
if(!rc)
rc =
mxfChannelAllGet(server, MXF_CLASS_DISCRETE, MXF_SCLASS_RX_CHANNEL, MXF_MODULE_ALL, 1, &channelCount, &rx);
if(!rc && channelCount)
rc =
mxfChannelAllGet(server, MXF_CLASS_DISCRETE, MXF_SCLASS_TX_CHANNEL, MXF_MODULE_ALL, 1, &channelCount, &tx);
if(!rc && !channelCount)
rc = MAXT_ERROR_NOT_FOUND;
if(!rc)
if(!rc)
if(!rc)
if(!rc)
if (!rc)
if (!rc)
{
if (moduleType != MXF_MODULE_DIOFIFO_EH)
{
}
}
if(!rc)
{
if(!rc)
{
if(!txBuffer)
rc = MAXT_ERROR_MEM;
}
}
if(!rc)
{
rxBufferSize = 10*1024;
if(!rc)
{
if(!rxBuffer)
rc = MAXT_ERROR_MEM;
}
}
if(!rc)
if(!rc)
{
eventInfo.rxHostBuffer = rxBuffer;
eventInfo.txHostBuffer = txBuffer;
eventInfo.bufferTx = bufferTx;
eventInfo.moduleType = moduleType;
}
if(!rc)
{
condition.
condID = MXF_ASYNCEVENT_COND_RXACQ_BUFFER_THRESHOLD;
}
if(!rc)
if(!rc)
if(!rc)
if(!rc)
if(!rc)
if(!rc)
if(!rc)
if(txBuffer)
free(txBuffer);
if(rxBuffer)
free(rxBuffer);
if(rc)
{
sprintf (errorString,"ERROR # 0x%08X", rc);
printf("%s\n\r", errorString);
}
if(bufferRx)
if(bufferTx)
printf("\nPress a key to terminate\n");
getchar();
return rc;
}
uint32 eventHandler(HMXF_HANDLE hAsyncEvent, void* pParam)
{
EVENT_INFO* eventInfo=(EVENT_INFO*)pParam;
uint32 rc;
uint64 count;
uint64 status, msgCount, byteCount;
HMXF_CHANNEL channel;
HMXF_DEVICE device=0;
if(!rc && count)
{
if(pendingInfo.
condID == MXF_ASYNCEVENT_COND_RXACQ_BUFFER_THRESHOLD)
{
if(!rc && msgCount)
{
rxRec = eventInfo->rxHostBuffer;
txRec = eventInfo->txHostBuffer;
if(eventInfo->moduleType == MXF_MODULE_DIOFIFO_EH)
{
}
else
{
}
if(!rc)
{
if (eventInfo->moduleType == MXF_MODULE_DIOFIFO_EH)
{
if(!rc)
if(!rc)
{
printf(
"Set led #0 state to %s\n", (rxRec->
data & 0x01)?
"OFF":
"ON");
}
}
}
}
}
}
if(rc)
printf("event handler rc=0x%08x\n", rc);
return rc;
}