beautypg.com

1 m1x66_opendevice, Device/channel open, close and initialization apis, M1x66_opendevice – Maxim Integrated 73M1866B/73M1966B FXOAPI User Manual

Page 12: Device/channel open, close and, Initialization apis

background image

73M1866B/73M1966B FXOAPI User Guide

UG_1x66B_046

12

Rev. 2.1

2.3 Device/Channel Open, Close and Initialization APIs

2.3.1 M1x66_OpenDevice

Description

This API performs the low level opening of the device descriptor. By default, the device descriptor name
is known as “/dev/ter10”; however, since this is configurable during driver installation, a different
device descriptor name may be used. Refer to driver configuration and installation more detail. Calling to
this open device API is mandatory before any channel descriptor can be opened, and it must be called
after the FXO API Init function.

In addition to opening the device for accessing this API also requires a callback function. This function is
called by the API subsystem to convey the FOX events to the application program. Six parameters are
returned when this callback function is invoked:

eventId

:

This parameter is the event identification of type M1x66_EVENT_ID.

chanId

:

This parameter contains the FXO channel ID from which the event is generated.

evtData1:

are reserved for special purpose in event handling.

evtData2:
evtData3:
evtData4:

A successful open device returns a non-zero device handle that can be used to access other device
related APIs.

Prototype

M1x66_HANDLE M1x66_OpenDevice (char *devName, void *callback);

Parameters

Data Type

Name

Description

char *

devName

FXO device descriptor name (default: /dev/ter10).

void

(*eventCallback)(
M1x66_EVENT_ID eventId,
unsigned int chanId,
unsigned int evtData1,
unsigned int evtData2,
unsigned int evtData3,
unsigned int evtData4)

Event status callback function. The parameters
returned by this callback function are event ID,
channel ID and 4 event data that are specific to the
event ID. Most of these event data are not
applicable except those listed in the
“EventCallback Parameters” table below.


EventCallback Parameters

Event Name

Parameters

M1x66_EVENT_RING_START

evtData1 – Ring burst frequency (in Hz)

M1x66_EVENT_RING_END

evtData1 – Ring burst frequency (in Hz)
evtData2 – Ring burst duration (in milliseconds)

M1x66_EVENT_LINE_STATE

evtData1 – Channel Hook state (0-on-hook, 1-off-hook)
evtData2 – 0-line current, 1- voltage
evtData3 – IET index
evtData4 – Application defined event

M1x66_EVENT_GPIO_INTERRUPT

evtData1 – GPIO number