beautypg.com

3 driver service interface, 1 linux operating system, 2 other operating systems – Maxim Integrated 73M1866B/73M1966B Reference Driver User Manual

Page 13: Driver service interface, Linux operating system, Other operating systems

background image

UG_1x66B_015

73M1866B/73M1966B Reference Driver User Guide

Rev. 2.7

13

3 Driver Service Interface

The Driver Service provides the link between the FXO device and the user application. First, the driver
must be loaded and binded into the operating system environment before this service can be provided.
Access to the driver is done via two file descriptors – the device and channel file descriptors. The device
file descriptor provides access to device level management interface while the channel descriptor is used
to manage at the channel level interface. The driver supports multiple FXO channels through separated
channel descriptors; however, only one device descriptor is used.

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 driver. It is brought into operation by a user application or by Linux startup script using
the

insmod

command. This command inserts the driver module into 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 with the device and
channel descriptors created using mknod command. The driver expects the minor number 0 to be
associated with the device descriptor and the number from 1 to 16 with the channel descriptors. Device
major and minor numbers are configurable at build time as described in

Section 8.2

.


The device and channel descriptors can be created in the /dev directory at the same time when the
driver is insmod into the kernel. The mknod command is used to create those descriptors as illustrated
below:

mknod -m 660 /dev/ter10 c 221 10
mknod -m 660 /dev/ter11 c 221 11

In this example, one device descriptor (ter10) is created with major number 221, minor number 10, and
one channel descriptor (ter11) is created with major number 221, minor number 11. The minor number
base 10 can be changed (see the compile time configurable parameter in

Section 8.2

).


Once the driver is installed and the device/channel descriptors are created, the driver service can be
accessed via standard C library

open()

,

and subsequently with select(),

close(),

and

ioctl()

functions.

The following illustrates how the device and channel are opened, closed, and the IOCTL access:

devfd = open("/dev/daa_dev",O_RDONLY|O_WRONLY);
chanfd = open(“/dev/daa_chan1”, O_RDONLY|O_WRONLY);
ioctl (devfd, M1966_EVENT_GET, &event_structure);
ioctl (chanfd, M1966_ATH1, NULL);
close (devfd);
close (chanfd);

Accessing the driver using IOCTL must be done via an opened descriptor. There are two types of IOCTL
commands – the device level commands, which can be accessed by an opened device descriptor, and
channel level commands, which can be accessed using an opened channel descriptor.

Section 6

describes the IOCTL commands.

3.2 Other Operating Systems

To be provided.