24
API-FDX Linux Getting Started Manual
GmbH
Section 8 – Programming the API-FDX Module
8.1.3. Initializing the AyI-FDX Board and IRIG Time source
void MyFdxResetBoard()
{
int i;
AiUInt32 ul_Mode;
time_t loc_time;
struct tm * ptm;
TY_FDX_BOARD_CTRL_IN x_BoardCtrlIn;
TY_FDX_BOARD_CTRL_OUT x_BoardCtrlOut;
TY_FDX_IRIG_TIME x_IrigTime;
if (g_ulBoardHandle > 0)
{
//--- init input structure
for (i=0; i<FDX_MAX_BOARD_PORTS; i++)
{
x_BoardCtrlIn.aul_PortConfig[i] = FDX_SINGLE;
x_BoardCtrlIn.aul_ExpertMode[i] = FDX_DISA_GHOST;
}
//--- reset board, initialize ports to Single ports
FdxCmdBoardControl(g_ulBoardHandle,FDX_WRITE,&x_BoardCtrlIn,
&x_BoardCtrlOut);
//--- sync board-internal irigtime-source with PC-time
loc_time = time(NULL);
ptm = localtime(&loc_time);
if (ptm != NULL)
{
// tm.YearOfDay is ZeroBased but we are OneBased
x_IrigTime.ul_Day = ptm->t 1;
x_IrigTime.ul_Hour = ptm->tm_hour;
x_IrigTime.ul_Min = ptm->tm_min;
x_IrigTime.ul_Second = ptm->tm_sec;
FdxCmdIrigTimeControl(g_ulBoardHandle,FDX_IRIG_WRITE,&x_IrigTime,
&ul_Mode);
}
}
}