Accessing the driver from the linux user space, Mknod, Open – Maxim Integrated 73M1822/73M1922 Hardware Module for SMDK412 User Manual

Page 7

Advertising
background image

UG_1x22_054

73M1822/73M1922 Hardware Module for SMDK412 User Guide

Rev. 1.1

7

3

Accessing the Driver from the Linux User Space

The driver provides the link between the modem device and the user application via a standard linux
character device. Access to the driver is done via Linux supplied file descriptors The following sections
describe how the driver is brought into action based on the operating system environment.

3.1 mknod

The device descriptors can be created using the mknod command as illustrated below:

mknod -m 660 /dev/tsc_1x22_mafe_0 c 251 0
mknod -m 660 /dev/tsc_1x22_mafe_1 c 251 1

In this example, one descriptor (tsc_1x22_ctl_mafe_0) is created with major number 251, minor
number 0, and one descriptor (tsc_1x22_ctl_mafe_l) is created with major number 251, minor
number 1. The minor number associated with the file descriptor is unused by the driver in this
implementation.

3.2 open

Description

Once the driver is installed and the device descriptors are created, the driver service can be accessed by
user applications via standard C library

open()

,

and subsequently reversed with

close()

Prototype

int open (

const char * path,

int flags);


Parameters

Data Type

Name

Description

Const char *

path

Path to the descriptor created by mknod.

int

flags

O_RDWR.


Return Values

Data Type

Description

int

File descriptor.

Advertising