Maxim Integrated 73M1866B/73M1966B FXOAPI User Manual
Page 63

UG_1x66B_046
73M1866B/73M1966B FXOAPI User Guide
Rev. 2.1
63
/* Initialize the channel for operation in US */
if (M1x66_InitChannel (channels[i].pHandle, M1x66_CNTRY_CODE_US)
!= M1x66_SUCCESS)
return (-1);
}
/* program main loop */
While (1)
{
/* this is the main program loop…
/* . . . */
}
/* Release the API subsystem before exiting */
M1x66_RET M1x66_FxoApiRelease (void);
Return (0);
}
/*
*****************************************************************************
***********************
* FUNCTION NAME:
* fxoEventCallback
*
* DESCRIPTION:
* This is the FXO event callback function. It is invoked by the API
* subsystem when an FOX event occurs. Currently, this callback function
* only handles the RING start event. It takes the FXO line off-hook when
* the ring burst is detected.
*
* PARAMETERS:
* event_id - Event ID
* channelId - FXO channel where event is occurring
* data1 - Additional data (1)
* data2 - Additional data (2)
* data3 - Additional data (3)
* data4 - Additional data (4)
*
* RETURNS:
* N/A
*****************************************************************************
***********************
*/
void fxoEventCallback (M1x66_EVENT_ID event_id,
unsigned int channelId,
unsigned int data1,
unsigned int data2,
unsigned int data3,
unsigned int data4)
{
int ret;
M1x66_HANDLE pHandle;
M1x66_PCM_CFG pcmConfig;
pHandle = channels[channelId].pHandle;