Teridian Semiconductor Cor poration makes no warrant y for the use of its products, other than expressl y
contained in the Comp any’s warrant y detailed i n the Teridian Semiconduct or Corporation stan dard Terms
and C ondit ions. The company assumes no responsibility for any errors which may appear in this
document, reserves the right to c hange devices or specific ations detailed herein at any tim e without
notice and does not make any commitment to updat e the i nform ation contained herein . Accord in gly, the
reader is cau tioned to verify that this docum ent i s c urren t by comp ar i ng it to the latest vers ion on
http:// w ww.teridian .com or by checking with your s al es representat i ve.
Teridian Semiconductor Corp., 64 40 Oak Canyon, Sui te 100, I r vine, CA 92618
TEL (714) 508-8800, FAX (714) 508-8877, http://www.teridian.com
2 Rev. 2.7
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
Figure 2: Driver Function al B lock Diag ram
Figure 3: Loopback Modes
Tables
Table 1: Summary of Initializ ation IOCTLs ............................................................................................. 23
Table 2: FX O Line Status Services
Table 3: FX O Hook Switch Control Services
Table 4: Call ID Services
Table 5: Ring Detecti on Services
Table 6: Li ne State An alysis S er vices
Table 7: Driv er Sour ce Code F iles
Table 8: Cou ntry Code Tab l e
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
1 Introduction
This document describes t he capabilit i es of th e 73M1866B/73M1966B Reference Driver. This driv er
software is provided for use and integration by Teridian customers on their individual platforms. The
intent i on of this Reference Driver is to provide a customizabl e frame work that is independent of p r ocessor
and operating system.
Throughout thi s do c u me nt the 73M1x66B Reference Device driver will b e sim ply referred to as “driver ” or
“device dri ver”. The 73M1866B and 73M196 6B will b e collectively referred to as the 73M1x66B.
1.1 Purpose and Scope
The 73M1x6 6B Referen ce Driver p rovid es the necessary system interfaces for the con trol an d
management of the 73M1x66B. The driver supports API calls from the application and translates these to
and from the device. The driver can be u sed as i s, in whole or in part, or customized to accommodate a
custo me r ’s unique envir o nme nt.
The scope of this document includes discussion of driver’s architecture and design, interface to the user
application, the driver in ternal state machine, and the h ar dware interfac e to the 73M1x66B hardware
device via the S PI bus .
Figure 1 illustrates the bas ic architectu r e m odel for t he dr i ver. The mod el is intended to b e i ndependent
of processor and operati ng system. Layers above t he referen ce driver address software interfaces wh ich
may pre-exist for a given application ( e.g. Aster i sk
interfaces bet ween t he pr ocessor and the 73M1x66B devices.
®
) and the layer b elow addresses hardware related
Figure 1: Driver Architecture
Rev. 2.7 7
73 M1 866B/73M1966B Reference Dr iver U ser Guide UG_1x66B_015
1.2 Conventions Used in this Guide
This document uses the following conventions:
•Software code, I OCTL names , F XO events, data t ypes, and Linux c ommands are presen ted i n
Couri er font.
•A table with a blue header i s a summary tab le. A tabl e with a g r ay header i s a det ail table.
1.3 Acronyms
APOH – An other Phone Off Hook
BSP – Board Support Package
DAA – Data A ccess Arran gem ent
FXO – Foreign eXchange Office
ISR – Interrupt Service Routine
IOCTL – I/O Control
NOPOH – N o Phone Off Hook
POH – Phone Off Hook
SPI – Serial Perip heral Int er face
GPIO – General Pu r pose Input/Output
8 Rev. 2.7
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
2 Overview
2.1 Driv er Arc hite ctur e
The dri ver provides a framework by which appli cations can leverage the featu r es of t he chipset . The
main interface o f th e driver (IOCTLs) provides an abstraction layer for monit or i ng and cont r ol of the
device s tatus. Device status is analyzed and pr ocessed by an independently running process based on
predefined algor i thms. When an event or an even sequence is recog nized, the d r i ver post s th e
correspondin g event to be retrieved by th e user applicati on. Figure 2 depicts the driver functional block
diagram.
Figure 2: Driver Functional Block Diagram
The driver provides an interface to user ap plication th r ough the IOCTL and Events interface. Through this
interface, the user applic ation communicates with the driver via a st andar d device interface (open, close,
select, ioctl functions). Using this interface the appl icati on will b e able t o cont rol the operation of th e
device and to retri eve the status of the FXO line. Section 6 descri bes the det ai ls of th i s interfac e.
The driver provides access to the 73M1x66B device via the SPI bus, and through the interrupt s er vice
routine (ISR) triggered by the hardware interrupt signal. The driver accesses t he platfor m's SPI hardware
interface directly through the system’s board support package (BSP). This access is in the context of an
operat ing system p latform device defini tion .
The 73M1x66B driver is bui lt as a Linux load able module (for Linux) or integrated wi th the operating
system kernel. It will be brought into operation by a user ap plic ation or by an operati ng system startup
script. For Linux, the insmod command is used t o inser t the dri ver i nto the ker nel. The insmod
command invokes the module_init() macro, which in turn runs the one-time initializati on function of
the driver. Before exiting the ini tialization the driver enters its main operational s tate via the scheduli ng of
one of m any timers that make up the driver’s m ain processing.
Rev. 2.7 9
73 M1 866B/73M1966B Reference Dr iver U ser Guide UG_1x66B_015
2.2 Functional Overv ie w
Once inst alled, th e dr iver is a self-contained module run ning in dependently along with the kernel
processes. Its main purpose is to monitor the F XO line for various conditions, gen erates appropriated
event when they occur, and t o provide access to the 73M1x66B device for management purposes , via
standard driver access methods such as open, close, select, ioctl, etc . Th e following sections
provide an overview of the functionalities.
2.2.1 Event Generation
During operation the d r i ver constantly monitors th e line for the following conditions:
1. APOH condition.
2. Transition back to no APOH condition (NOPOH).
3. R i ng start detection.
4. End of Ri ng condition.
5. Battery dis connected condition.
6. Battery restored conditi on.
7. Polarity reve r sal condition.
8. Line State condition – monit or ing of voltage and current.
9. Device failure condition.
10. Over voltage, curren t, or l oad condition.
11. Pu l se dial compl ete event .
12. Pulse dial aborted event .
13. Device rec overed even t.
Section 5 provides detail descripti ons of each even t.
If any of these conditions occur the dri ver creates an event ent r y in the event queue and notifies the
app l icati on layer via file descrip tor ready mechanism (or via file descr ipt or select() function). Upon
receiving th is “wakeup” n otification, the application can then test the file d escriptor “ready” status with the
FD_ISSET macro to con fir m, and then retrieve the event from the driver via IOCTL event get command.
2.2.2 FXO Channel Config and Management
Configuration of the FXO parameter s such as PCM parameter and other management command such as
hook switch operation are done via st andar d device driver IOCTLs. The 73M1x66B Referen ce Driv er
provides an extended list of IOCTLs for this purpose. The IOCTL command descriptions in Section 6
provide details of how the y work.
2.2.3 Line State Analysis via Current and Voltage Measurements
The 73M1x66B Reference Driver can be programmed to provide extended line status information and
line monitori ng capabil i ty. The d r iver op er ates autonomously, under the application la yer cont r ol , to detect
line condition specified in pre-set criteria and automatically report status change. This allevi ates t he
bu r den of con stant polli ng from the appl ication layer. The line stat us c onsists of t he line vo ltag e and l ine
curr ent measurements. Each measurement entity is operated independently as descri bed below.
2.2.3.1 Interval and Even Table
The Interval and Event Table (IE T) is a tab le th at con sists of mul tip l e r ows of the following informati on:
1. Row number.
2. Lower bound threshold.
3. Upper bound threshold.
4. Applicati on defined event.
10 Rev. 2.7
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
The application is responsible for building up the IET using the IET table update IOCTL –
M1966_MEASURE_UPDATE. This IOCTL can be used t o create/update or to read back the current table
en try (see Section 6.6.3 for detail s).
2.2.3.2 Measurement Procedure
The dri ver is responsible for readi ng the raw valu e r equi r ed at a given s amp le rate f r om the device. The
result is computed and averaged over a specified number of those pr eviously read values, and then
compare to the i nterval and event table (I ET) des cribed below. Based on these compar isons dedicated
events may be sent to the appl i cation.
The dri ver compares th e calculated averag e of the readi ng value with the l ow er and upper bou nd
thr eshold in each IET table entry. I f the value falls in between the ranges and it is th e fir st t r ansition int o
these new ran ges t he specific appl ication defi ned event (4) will be sent t o the application. Th e lower and
upp er bound rang es are exp r essed i n m illiamps for curren t intensity, or in volts for line voltage.
2.2.3.3 Management of the Procedure
Controlling the operati on of this cur r ent/voltage measurement is exclusively done by the application layer.
The application layer uses the M1966_MEASURE_START and M1966_MEASURE_STOP to start and stop
the measurement, respectively. The M1966_MEASURE_STOP simply stops the measurem ent and
requires no additi onal p ar ameter , while M1966_MEASURE_START starts the measuri ng pr ocess and it
consists of two parameters:
1. Sample t ime interval.
2. Average sample c ount.
The sample tim e i nterval i s the time i nterval between two cons ecut ive read i ng sampl es expressed in
mil l iseconds, and the average sam ple count is the number of reading samples to be us ed for average
calculati on. Any one of these p ar ameter s can be ZE RO indicat es a no change. The ap plic ation l ayer can
adjust one or both par amet er s anyti me using M1966_MEASURE_START.
2.2.3.4 Even Handling
The dri ver emits the M1966_LINE_STATE event when line s tate c ondit i on changes from one interval to
another. The application i s expected t o r eceive t he notification and can reques t for the event from the
driver using the M1966_GET_EVENT IOCTL. Refer to Section 5 for details on how to get notified and to
retrieve t he event from the driver’s queue. The following supporting data will accompany the line st ate
event:
1. Th e stat e of the FXO channel – on or off-hook.
2. Lin e current or line voltag e.
3. IET row index.
4. Applicati on defined event.
2.2.4 GPIO Support
Three General Purpose I/O pins (GPIOs) pins can be managed independently and used for carrying input
or out put signal to and from the 1906 device. If used as input, signal transition on the pin can be detected
and trigger interrupt to the host CPU. The driver provides the ability to program each GPIO pin as input
or out put port, the ab ility t o r ead and write data t o the GPIO pin as well as generating in terru pt event
correspond the signal transition. Secti on 6.7 describes the GPIO related IOCTL.
Note: The GPIO feature exi sts only on the 73M1906B 32-Pin QFN package.
Rev. 2.7 11
73 M1 866B/73M1966B Reference Dr iver U ser Guide UG_1x66B_015
TBS
DSDM
PRMSCM
MSBI
LSBI
RxAFE
SinC3
Filter
Onchip
LIC
SPI
Interface
PCM
Interface
TxAFE
Interp.
Filter
Decim.
Filter
TxData
RxData
RBS
Tip
Ring
PRPSCP
TxD
RxD
CTL
STA
External
LIC
73M1906B
73M1916
Aux A/D
STA
ALB
INTLB1
DIGLB2
DIGLB1
INTLB2
RxA
TxA
PCMLB
2.2.5 Loopback and Testi ng Mo de s
The 1966B devices support six variations of loopback modes. Refer to the “Loopback and Testing
Modes” secti on of the 73M1866B/73M1966B Data Sheet for mor e detai l . Each loopback mod e i s
desi gned to test connectivity at variou s points in the system. Systematically use of the loopback feature
in c onjun ction with ext er nal application that c ontrol d ata st r eam in and out of the s ystem can be an
effect ive tool to i solate faults . While the driver provides IOCTLs to manage those loopbac k test points, i t
does not have a way to i nject or in tercept d ata flow throu gh the syst em to perform d iagnostic. It reli es on
external ap plic ation for those capabilities. The IOCTL for managing the l oopback can be foun d in Section
6.8.1
Figure 3 shows the si x different loopback m odes.
Figure 3: Loopback Modes
2.2.6 Call Progress Monitor
The 1966B device provides th e ability to monitor act i vity on the l i ne via feature c alled the Call Progress
Monitor. The gain setting of its au dio path can be adjusted using the M1966_CPROG_MONITOR IOCTL
detailed in Sectio n 6.9.3. For more detail on this subj ect, refer to the “Call Prog ress Monitor” section of
the 73M1866B/73M1966B Data Sheet.
2.2.7 Billing Tone Filter
Some countries use a large am plitude out-of-ban d tone to measure c al l duration and to allow remote
central offices to determine the durat ion of a call for billing purposes. To a void sat uration and distortion of
the input caus ed by th ese tones, i t is imp or tant t o be able to rejec t them. These frequencies ar e typic ally
12 kHz and 16 kHz. Refer to section “ Billi ng Tone Rejection” in the 73M1866B/73M1966B Data Sheet for
more detail .
To enable or d i sable the billi ng tone filter, the driver offers the M1966_BTONE_FILTER IOCTL. Its
description can be found in Section 6.9.2.
12 Rev. 2.7
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
3 Driver Service Interface
The Driver Ser vice provides the link b etween the FXO device and th e user application. First, the driver
must be load ed and bind ed into the operatin g system environment before this s er vice can be provid ed.
Access to the driver is done via two file descriptors – the device and channel file descriptors. The d evice
file descript or provides access to device level management interface while the channel descriptor is used
to m anage at the ch annel l evel interface. The driver supports multiple FXO channels through separated
channel descriptors ; however, only one device descr ipt or i s us ed.
The following sections describe how the driver is brought into action based on the operating system
environment.
3.1 Linux Operating System
This description is valid for Linux 2.4 and 2.6. The 73M1x66B driver takes the form of a Linux standard
character device driv er . It is brought into operation by a user ap plic ation or by Linux startup s crip t using
the
insmod command. This command inserts the dr iver module in to the kernel which in turn registers
with the kernel using the default major number of 221. Multiple FXO channels are supported via the use
of minor number which can varies from 0 to 16. This minor number associated wit h the device an d
channel descriptors c r eated using mknod command. The driver expects the minor number 0 to be
associ ated with the device descriptor an d the number from 1 to 16 with the channel descriptors. Device
major and minor numbers ar e configurable at bui ld time as desc ribed in Sec tion 8 .2.
The dev i ce and ch annel d escriptors can be created in the /dev directory at th e same time when th e
driver is insmod into the ker nel. The mknod command is used to create t hose descrip tors as illustrated
below:
mknod -m 660 /de v/ter10 c 221 10
mknod -m 660 /de v/ter11 c 221 11
In this example, one device descriptor (ter10) is created with major number 221, minor number 10, and
one channel d escriptor (ter11) is created with m ajor number 221, minor number 11. The min or numb er
base 10 can be changed (see the c om pile time configurabl e parameter in Section 8.2).
Once the driver is installed and the device/channel descriptors are created, the dr i ver service can be
accessed via standard C library
functi ons.
The following illustrates how the device and channel ar e open ed, c losed, and the IOCTL access:
devfd = open("/dev/daa_dev",O_RDONLY|O_WRONLY);
chanfd = open (“/ dev /daa_chan1”, O_RDONLY|O_WRONLY);
ioctl (devfd, M1 966 _EV ENT _GE T, &event_st ruc tur e);
ioctl (chanfd, M1966_ATH1, NULL);
close (devfd);
close (chanfd);
Accessing the driver using IOCTL must be done via an opened descriptor. There are t w o types of IOCTL
commands – the device level commands, which can be accessed by an op ened device descrip tor, and
channel l evel commands, which can be acc essed using an opened channel descriptor. Section 6
describes th e IOCTL commands.
3.2 Other Oper ati ng Systems
open(), and sub sequently with select(), close(),and ioctl()
To be provided.
Rev. 2.7 13
73 M1 866B/73M1966B Reference Dr iver U ser Guide UG_1x66B_015
4 Country Specific Settings
The 73M1x66B Reference Dri ver supports gl obal comp l iance par ameter s for each DA A device it
manages. When select ed for a specific country code using M1966_CH_INIT, the following predefined
parameters will be applied:
1. AC ter minat ion impedance – AC impedance register value.
2. DC termination mask – DC mask value.
3. Ring Detection – Ri ng detection threshold value.
4. Automatic CID Enable – Automatic ally enter CID s tate when on hook .
5. U se Seize State – I f s et, the driver enter s eize state for 350 ms before s etting ENNOM (refer to the
73M1x 6 6B Data Sheet, Section 10.2 – DC Terminati on, for the detail explanation of the seize state) .
These p ar ameter s are defined i n the Country Cod e Parameter files (m1966_cntry_tbl.c) and c an be
changed as required. The list of the country codes supported can be found in Appendix A.
14 Rev. 2.7
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
unsigned int
event_id
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
5 FXO Events
The dri ver provides event service to the high l evel appl ication by main taining a FIFO queue of even t
structures, M1966_FXO_EVENT_t. Events ar e created by the driver to r eflect various conditions as
described in Section 5.2. Once created, this new e vent is added to the FIFO queue and the driver notifies
the application layer via file descr i ptor stat us change mechanism. This in turn triggers th e application t o
request for the ev ent via the M1966_EVENT_GET IOCTL. Upon retr i eval, eac h event structure is removed
from t he FI FO queu e after its informati on is conveyed to th e hi gh level ap plic ation.
To receive t his F XO event noti fi cation the app licat i on mu st register for file descriptor s tatus change us i ng
the standard UN IX select() function. When this function returns the FXO event availability status will
reflec t in the fil e desc r i ptor parameter. The FD_ISSET macro can be used for checking the status, and if
available, the application c an request for the even t us ing M1966_EVENT_GET.
5.1 M1966_FXO_EVENT_t
Description
Thi s str uct ur e is us e d by M1966_EVENT_GET to retrieve an event from the event queue. The event
structure consists of event ID indentifying the event, the channel ID identifying the FXO channel where
the event was g ener ated, the number of remaining events in the queue, and up t o four event d ata that
carries addi tion al info r mati on per tain i ng to that s pecific even t.
Prototype
typedef struct {
unsigned int event_id; /* Event ID */
unsigned int channel_id; /* Channel ID */
unsigned int event_cnt; /* number of remaining queued events */
unsigned int event_data1; /* additional data 1 */
unsigned int event_data2; /* additional data 2 */
unsigned int event_data3; /* additional data 3 */
unsigned int event_data4; /* additional data 4 */
}
M1966_FXO_EVENT_t;
Parameters
Data T ype Name Description
Event ID (see Section 5.2).
Channel ID.
Number of even ts t hat remain in the queue.
Event dat a 1.
Event dat a 2.
Event dat a 3.
Event dat a 4.
Rev. 2.7 15
73 M1 866B/73M1966B Reference Dr iver U ser Guide UG_1x66B_015
unsigned int
event_id
M1966_BATTERY_DROPPED
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
M1966_BATTERY_FEEDED
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
M1966_ONH_APOH_DETECT
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
5.2 Event Identification
5.2.1 M1966_BATTERY_DROPPED
This event occurs when the FXO line is disconnected from the telephone network.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
5.2.2 M1966_BATTERY_FEEDED
This event is generated when the line is connected to the telephone network and the vo ltag e is restored
to normal operating level.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
5.2.3 M1966_ONH_APOH_DETECT
This event is generated when a parall el phone goes off hook while the FXO line i s in on-hook state.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
16 Rev. 2.7
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
unsigned int
event_id
M1966_ONH_NOPOH_DETECT
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
M1966_ONH_POLARITY_CHG
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
M1966_OFH_POLARITY_CHG
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
5.2.4 M1966_ONH_NOPOH_DETECT
This event i s generated when a parallel phone goes back on hook while the FXO line is in on-hook state.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
5.2.5 M1966_ONH_POLARITY_CHG
This event is gener ated when there is a voltage revers al occurs on the line while in on-hook state.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
5.2.6 M1966_OFH_POLARITY_CHG
This event is gener ated when there is a voltage revers al occurs on the line while in off-hook state.
Parameters
Data T ype Name Description
Rev. 2.7 17
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
73 M1 866B/73M1966B Reference Dr iver U ser Guide UG_1x66B_015
unsigned int
event_id
M1966_RING_DETECT_START
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
M1966_RING_DETECT_END
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
M1966_DEVICE_FAILURE_DETECT
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
5.2.7 M1966_RING_DETECT_START
This event is gener ated at the b eginning of t he ring bur s t .
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
Ring burst frequency (in Hz).
N/A.
N/A.
N/A.
5.2.8 M1966_RING_DETECT_END
This event is gener ated when the driver detects the end of the ring burst.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
Ring burst frequency (in Hz).
Ring bur st durat ion (in ms).
N/A.
N/A.
5.2.9 M1966_DEVICE_FAILURE_DETECT
This event is generated when th e dr i ver detec ts the device failure.
Parameters
Data T ype Name Description
18 Rev. 2.7
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
unsigned int
event_id
M1966_OV_DETECT
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
M1966_OI_DETECT
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
M1966_OL_DETECT
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
5.2.10 M1966_OV_DETECT
This event is gener ated on detection of an over voltage lin e condition.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
5.2.11 M1966_OI_DETECT
This event is gener ated on detection of an over c urrent line condition.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
5.2.12 M1966_OL_DETECT
This event is gener ated on detection of an over load line c ondition.
Parameters
Data T ype Name Description
Rev. 2.7 19
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
73 M1 866B/73M1966B Reference Dr iver U ser Guide UG_1x66B_015
unsigned int
event_id
M1966_LINE_STATE
unsigned int
channel_id
unsigned int
event_cnt
M1966_OFF_HOOK
M1966_CURRENT
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
M1966_DIAL_COMPLETE
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
M1966_DIAL_ABORTED
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
5.2.13 M1966_LINE_STATE
This event is generated when the line st ate analys i s process detects a change in the state of the li ne.
The lin e stat e analysis process will monitor (u nder user control) the line current and/or voltage in both On
and off hook states. This event indicates that ei ther the user has r equest ed the current lin e stat e or one
of the progr ammable threshold s tates has become active or non active.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
unsigned int event_data1
unsigned int event_data2
M1966_ON_HOOK,
.
M1966_VOLTAGE,
.
IET row number.
Event identifier.
5.2.14 M1966_DIAL_COMPLETE
This event is gener ated when a pulse di al session is compl eted s uccessfully.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
5.2.15 M1966_DIAL_ABORTED
This event is gener ated when a pulse di al session is aborted or canceled by t he user application .
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
20 Rev. 2.7
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
unsigned int
event_id
M1966_DEVICE_RECOVERED
unsigned int
channel_id
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
unsigned int
event_id
unsigned int
channel_cid
unsigned int
event_cnt
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
M1966_ONH_DETECT
unsigned int
channel_cid
unsigned int
event_cnt
unsigned int
event_data1
unsigned int
event_data2
unsigned int
event_data3
unsigned int
event_data4
5.2.16 M1966_DEVICE_RECOVERED
This event is gener ated aft er the device is successfull y recovered from a failure.
Parameters
Data T ype Name Description
.
Channel ID.
Number of even ts t hat remain in the queue.
N/A.
N/A.
N/A.
N/A.
5.2.17 M1966_GPIO_INTERRUPT
This event occurs when an input GPIO interrupt is triggered. The “ data1” field contains the sour ce GPIO
that generates t he in terru pt.
Parameters
Data T ype Name Description
M1966_GPIO_INTERRUPT.
Channel CID.
Number of even ts t hat remain in the queue.
unsigned int event_data1
M1966_GPIO_NUMBER – the GPIO that triggers the
interrupt event.
N/A
N/A
N/A
5.2.18 M1966_ONH_DETECT
This event occurs when the FXO line goes on-hook. This generally occurs after device rec overy from a
failure.
Parameters
Data T ype Name Description
unsigned int event_id
Channel CID.
Number of even ts t hat remain in the queue.
N/A
N/A
N/A
N/A
.
Rev. 2.7 21
73 M1 866B/73M1966B Reference Dr iver U ser Guide UG_1x66B_015
6 IOCTL Commands Description
Upon succ essful openi ng of a devic e or channel d escriptor the application layer can control the operation
of the device and the FXO channel. The application i n user sp ace communicates wit h the driver via
standard Linux driver in ter face IOCTL calls.
Unless specified, in general, the IOCTL function retu rn s zero (0) for succes sful request, or a negative
value of EFAULT (-EFAULT) if any error is detected during the processing of the IOCTL. The more detail
cause of error, or also known as error code, is stored internally and can be retrieved with the
M1966_ERROR_CODE_GET IOCTL. The driver keeps only the last error code of the last IOCTL per device
or channel descriptor. Therefore, if r equi r ed, the error code must be retrieved immed iately after the
execution of th e IOCTL or before the next IOCTL is executed. The error c odes are listed in Secti on 7.4.
The follo wing s ections desc r ibe t he detail of each IO CTL command. The dr iver IOCTL belongs to on e of
the fol l owing c ategories:
• Initialization
• Event and Status Services
• FXO Hook Switch C ontrol Services
• Caller-ID Services
• Ring Detection Services
• Lin e State Analysi s Services
• GPIO Services
• Miscell aneous Service
22 Rev. 2.7
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
M1966_CH_INIT
M1966_PCM_IF_CSET_OPMODE_SET
M1966_PCM_IF_CSET_FREQUENCY_SET
M1966_PCM_IF_CSET_RPOL_SET
M1966_PCM_IF_CSET_TPOL_SET
M1966_PCM_IF_CSET_RCS_SET
M1966_PCM_IF_CSET_TCS_SET
M1966_PCM_CSET_TSLOT_RX_SET
M1966_PCM_CSET_TSLOT_TX_SET
M1966_PCM_CSET_COMPRESSION_SET
M1966_PCM_ACTIVATION_SET
M1966_PCM_ACTIVATION_GET
M1966_PHONE_VOLUME_SET
M1966_PERF_RX_OFFSET_CALIB
M1966_CLEAR_RX_OFFSET_REG
M1966_SAMPLE_RATE
6.1 Initialization and Configuration IOCTLs
The following IOCTLs are defined to configure the 73M1x66B. Some commands pert ai n to device level
configur ation such as PCM in terface parameters; th ese must b e called using device d escriptor, while
other s are channel level commands and must be called using channel descriptors. Table 1 provides a
summary of the IOCTL s.
Table 1: Summary of Initialization IOCTLs
IOCTL Name Description Descriptor
Initiali zing FXO channel for operation . Channel
Set PCM interface operational mode. Channel
Set PCM frequency. Channel
Set r eceive edge polarity. Channel
Set transmit edge pol ar i ty. Channel
Set r eceive cl ock sl ot number . Channel
Set transmit clock slot number. Channel
Set r eceive P CM time slot number. Channel
Set transmit PCM time slot number. Channel
Set PCM data compression mode. Channel
Activate PCM ch annel . Channel
M1966_PCM_ACTIVATION_CLEAR
M1966_CNTRY_NMBR_GET
M1966_GET_COUNTRY_CONFIG
M1966_SET_COUNTRY_CONFIG
De-acti vates the PCM time slots
configured for this FXO channel.
Retrieve PCM activation stat e. Channel
Convert ASCII two-character country code
into country code index used by the driver.
Read the current defaul t set ting for a given
country code.
Overwrites the current default setting for a
particular country.
Set transmit and receive gain. Channel
Perfo r m receiver DC offset calibration . Channel
Clear receive D C offset calib ration regist er . Channel
Select PCM sampl e r ate Channel
Channel
Channel
Channel
Channel
Rev. 2.7 23
73 M1 866B/73M1966B Reference Dr iver U ser Guide UG_1x66B_015
int
chan_fd
int
M1966_CH_INIT
M1966_COUNTRY_CODE
6.1.1 M1966_CH_INIT
Description
Performs 73M1x66 channel initialization. This includes initialize all defau lt registers an d country specific
threshold parameters. This IOCTL requires the cou ntry c ode lis ted in M1966_COUNTRY_CODE as input.
The FXO channel will be initial i zed ac cording to the default setting parameter of the input country code.
The default setting parameter can be found in the 73m1966_cntry_tbl.c file. See also M1966_GET_COUNTRY_CONFIG and M1966_SET_COUNTRY_CONFIG for run-time modification of country
default setting.
#define M1966_CH_INIT _IOWR(0 xA4,0xC8,unsigned int )
Prototype
int ioctl (
int chan_fd,
int M1966_ CH_ INIT,
unsigned long param );
Parameters
Data T ype Name Description
Channel descriptor.
I/O contr ol identifier for this operati on.
unsigned long param
Return Values
Country code as listed in
.
Data T ype Description
int
-1 – Failed to obtain PLL_LOCKED on devic e.
0 – Successful.
24 Rev. 2.7
UG_1x66B_015 73M1866B/ 73M196 6B Referen ce Driver Us er Guide
int
chan_fd
int
M1966_PCM_IF_CSET_OPMODE_SET
unsigned long
param
int
6.1.2 M1966_PCM_IF_CSET_OPMODE_SET
Description
Sets the 73M1x6 6 to operate in slave mode. The 73M1x66 i s always in slave mode th er efore this IOCTL
merely returns 0.
#define M1966_PCM_IF_CSET_OPMODE_SET _IOWR(0xA4,0x D0, uns ign ed int)
Prototype
int ioctl (
int chan_fd,
int M1966_ PCM _IF_CSET_ OPM ODE _SE T,
unsigned long param );
Parameters
Data T ype Name Description
Channel descriptor.
I/O control identifier for this operati on.
N/A.
Return Values
Data T ype Description
Always returns 0.
Rev. 2.7 25
73 M1 866B/73M1966B Reference Dr iver U ser Guide UG_1x66B_015
int
chan_fd
int
M1966_PCM_IF_CSET_FREQUENCY_SET
6.1.3 M1966_PCM_IF_CSET_FREQUENCY_SET
Description
If the incoming PCM frequency differs from the default value, then this IOCTL changes the 73M1x66 to
the requested frequency.