1 overview, Overview – Maxim Integrated 73M1866B/73M1966B FXOAPI User Manual

Page 6

Advertising
background image

73M1866B/73M1966B FXOAPI User Guide

UG_1x66B_046

6

Rev. 2.1

1.1 Overview

The FXOAPI is a user-friendly programming conduit used to access and manage the FXO device/channel
via the Reference Driver. This section describes the programming flow and how the application program
can be implemented using the FXOAPIs.

First, the concept of device versus channel, the Teridian FXO driver supports multiple FXO channels.
The application layer communicates with the driver using this channel descriptor. However, the driver
reports asynchronous FXO channel events through the device descriptor. At this point, the only use for
the device descriptor is for conveying event notification and for retrieving events from the driver.

The application program must first initialize the FXOAPI by calling FXO API Initialization and Termination
M1x66_FxoApiInit()
. This initializes internal data structures and prepares the API subsystem for
subsequent calls to other APIs.

After the FXO API is initialized, the application program opens the FXO device and channel descriptors to
access and manage the FXO device and channel(s) by calling Device/Channel Open, Close and
Initialization APIs
M1x66_OpenDevice()
and M1x66_OpenChannel() respectively. If more than one FXO channel exists
in the hardware platform, each channel is opened separately by calling M1x66_OpenChannel().

To simplify the usage of the driver, the API encapsulates all relevant data components required to
operate the FXO device and the channels into a data structure whose pointer is referred to as a “handle”.
This handle is returned from a successful call to open device/channel APIs and is used throughout the life
of the FXO device and channels.

The PCM Interface Config data is programmed by the M1x66_PcmIfConfig() API, and the PCM
timeslot config data by the M1x66_PcmConfig() API. Generally, the PCM Interface config data remains
static while the PCM timeslot may be dynamically allocated and set for each call establishment.

By default, the PCM channel is disabled and should remain disabled when there is no voice call on the
channel. The application program can use the M1x66_PcmActivation() to enable and
M1x66_PcmDeActivation()

to disable the PCM channel as needed.


Upon exiting the application program it is recommended that all device and channels descriptors be
closed, using
M1x66_

CloseDevice() and M1x66_CloseChannel(), and the API subsystem be shutdown using

M1x66_FxoApiRelease()

to ensure that the system resources are free up when the application

program terminates.

As mentioned earlier, the asynchronous FXO events from each channel are reported through the opened
device descriptor. The event message contains the channel ID from which the event occurred on. The
application program must distinguish the event for each channel and act accordingly. The way this event
is conveyed to the application program is via the callback function provided as one of the parameters
passed into Device/Channel Open, Close and Initialization APIs
M1x66_OpenDevice()
. The callback function serves as a “hook” for the API subsystem and notifies the
application whenever an FXO event is generated.

Section 5

provides a sample application using FXOAPI.

Advertising