3 driver service interface, 1 linux operating system, 2 other operating systems – Maxim Integrated 73M1822/73M1922 Control Module User Manual

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

Advertising
background image

UG_1x22_053

73M1822/73M1922 Control Module User Guide

Rev. 1.0

13

3 Driver Service Interface

The Driver Service provides the link between the modem device and the user application. First, the driver
must be loaded and bound 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 modem 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 73M1x22 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 251. Multiple modem 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/tsc_1x22_ctl_device c 251 0
mknod -m 660 /dev/tsc_1x22_ctl_channel c 251 1

In this example, one device descriptor (tsc_1x22_ctl_device) is created with major number 251,
minor number 0, and one channel descriptor (tsc_1x22_ctl_channel) is created with major number
251, minor number 1. The minor number base (0) 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/tsc_1x22_ctl_device", O_RDONLY|O_WRONLY);
chanfd = open(“/dev/tsc_1x22_ctl_channel”, O_RDONLY|O_WRONLY);
ioctl (devfd, M1X22_EVENT_GET, &event_structure);
ioctl (chanfd, M1X22_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.

Advertising