Maxim Integrated 73M1822, 73M1922 User Manual

Simplifying System IntegrationTM
Hardware Module for SMDK412 User Guide
January 20, 2010
Rev. 1.1
UG_1x22_054
73M1822/73M1922 Hardware Module for SMDK412 User Guide UG_1x22_054
© 20 10 Teridi an Semiconductor Cor poration. All rig hts reser ved. Teridian Semic onductor Corporation is a registered trademark of Teridian Semi condu ct or Corporat ion . Simplifying Syst em Integrat i on is a trademark of Teridian Semi condu ct or Corporat ion . Linux is a regist er ed trademark of Linu s Torvalds. All other t r ademar ks are the property of their respective owners.
Terid i an Semiconductor Corpor ation makes no warrant y for the use of i ts pr oducts, other than expr essly contained in the Company’s warranty detailed in the Teridian Semiconduct or C or poration standard Terms and C onditi ons. The company assumes no r espon sibilit y for any er r or s which m ay appear in this document, reserves the right to change devices or specifi cations detailed herein at any tim e without notice and does not make any co mm i tment to update the information contained herein. Accordingly, the reader is cautioned to veri fy that th i s document is curren t by compari ng it to th e l atest version on http://w w w. teridian.com or by checking with your sales represen tative .
Terid i an Semiconductor Corp., 6440 Oak Canyon, Suite 100 , Irvine, C A 92618
TEL (714) 508-8800, FAX (714) 508-8877, http://www.teridian.com
2 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
Table of Contents
1
Introduction ............................................................................................................................... 5
1.1 Purpose and Scope ............................................................................................................ 5
1.2 Conventions Used in this Guide ........................................................................................ 5
1.3 Acronyms ............................................................................................................................ 5
2 Overview.................................................................................................................................... 6
2.1 Driver Architecture ............................................................................................................. 6
2.2 Functional Overview ........................................................................................................... 6
3 Accessing the Driver from t he Linu x User Space.................................................................... 7
3.1 mknod ................................................................................................................................. 7
3.2 open..................................................................................................................................... 7
3.3 close .................................................................................................................................... 8
3.4 read ..................................................................................................................................... 8
3.5 write ..................................................................................................................................... 9
3.6 ioctl ...................................................................................................................................... 9
3.6.1 TSC_1X22_MAFE_GET_RS232 .............................................................................. 10
3.6.2 TSC_1X22_MAFE_SET_RS232 .............................................................................. 10
3.6.3 TSC_1X22_MAFE_GET_RX_STAT ......................................................................... 11
3.6.4 TSC_1X22_MAFE_GET_TX_STAT ......................................................................... 11
3.6.5 TSC_1X22_MAFE_RD_REG_NB ............................................................................ 12
3.6.6 TSC_1X22_MAFE_RD_REG_IM ............................................................................. 13
3.6.7 TSC_1X22_MAFE_RD_REG_BL ............................................................................. 13
3.6.8 TSC_1X22_MAFE_WR_REG_NB............................................................................ 14
3.6.9 TSC_1X22_MAFE_WR_REG_BL ............................................................................ 14
3.6.10 TSC_1X22_MAFE_SET_REG_AUTO_POLL ........................................................... 15
3.6.11 TSC_1X22_MAFE_IRQ_HW .................................................................................... 15
3.6.12 TSC_1X22_MAFE_IRQ_SW .................................................................................... 16
3.6.13 TSC_1X22_MAFE_IRQ_ENABLE ............................................................................ 16
3.6.14 TSC_1X22_MAFE_IRQ_DISABLE ........................................................................... 17
3.6.15 TSC_1X22_MAFE_IRQ_DOWN .............................................................................. 17
3.6.16 TSC_1X22_MAFE_IRQ_DOWN_TRY...................................................................... 18
3.6.17 TSC_1X22_MAFE_IRQ_UP ..................................................................................... 18
4 Accessing the Driver from the Linux Kernel Space .............................................................. 19
4.1 mknod ............................................................................................................................... 19
4.2 tsc_1x22_mafe_open ........................................................................................................ 19
4.3 tsc_1x22_mafe_close ....................................................................................................... 19
4.4 tsc_1x22_mafe_read ......................................................................................................... 20
4.5 tsc_1x22_mafe_write ........................................................................................................ 20
4.6 ioctl .................................................................................................................................... 21
4.6.1 tsc_1x22_rs232_get ................................................................................................. 21
4.6.2 tsc_1x22_rs232_set ................................................................................................. 21
4.6.3 tsc_1x22_mafe_get_rx_stat ..................................................................................... 22
4.6.4 tsc_1x22_mafe_get_tx_stat...................................................................................... 22
4.6.5 tsc_1x22_mafe_rd_rg_nb ......................................................................................... 23
4.6.6 tsc_1x22_mafe_rd_rg_im ......................................................................................... 24
4.6.7 tsc_1x22_mafe_rd_rg_bl .......................................................................................... 24
4.6.8 tsc_1x22_mafe_wr_rg_nb ........................................................................................ 25
4.6.9 tsc_1x22_mafe_wr_rg_bl ......................................................................................... 25
4.6.10 tsc_1x22_mafe_set_reg_auto_poll ........................................................................... 26
Rev. 1.1 3
73M1822/73M1922 Control Module User Guide UG_1x22_054
4.6.11 tsc_1x22_mafe_irq_hw ............................................................................................ 26
4.6.12 tsc_1x22_mafe_irq_sw............................................................................................. 27
4.6.13 tsc_1x22_mafe_irq_enable ...................................................................................... 27
4.6.14 tsc_1x22_mafe_irq_disable ...................................................................................... 28
4.6.15 tsc_1x22_mafe_irq_down ........................................................................................ 28
4.6.16 tsc_1x22_mafe_irq_down_try ................................................................................... 29
4.6.17 tsc_1x22_mafe_irq_up ............................................................................................. 29
4.7 Type and St ru ct ure Defin it i on R ef er ence ........................................................................ 30
4.7.1 RS232 #defines ....................................................................................................... 30
4.8 Rx and Tx FIFO status #defines ....................................................................................... 30
4.9 TSC_1X22_REG_IOCTL_t ................................................................................................. 30
4.10 TSC_1X22_REG_t ............................................................................................................ 30
4.11 Driver Source and Include Files...................................................................................... 31
4.12 Compile Time Configurable Parameter .......................................................................... 31
5 Related Documentation .......................................................................................................... 31
6 Contact Information ................................................................................................................ 31
Revision History ............................................................................................................................ 32
Figures
Figure 1: Driver Function al B lock Diag ram ............................................................................................... 6
Tables
Table 1: Driver Source Code Fil es ......................................................................................................... 31
4 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
1 Introduction
This document describes the capabilities of the 73M1822/73M1922 Hardware Module for the SMDK2412. This driver software is provided for use and integration by Teridian customers on their individual platforms.
Throughout this document the 73M1822/73M1922 Hardware Module for the SMDK2412 is simply ref er r ed to as “driver” or “device driver”. The 73M1822 and 73M1922 is collectively re ferred to as the 73M1x22 or the device.
1.1 Purpose and Scope
The 73M1822/73M1922 Hardware Module for the SM DK2412 provides the necessary system in terfaces for the contr ol and management of t he 73M1x22. The driver supports calls from a user space application or kern el mod ule and translates these to and from the device. The d r iver can be u sed as is, in whol e or i n part , or cu stomize d to accommodate a custom er ’ s unique environmen t.
The scope of this document includes discussion of driver’ s arch i te ct ur e and de sign a nd interface to th e user. The 73 M1 822/73M1922 Hardware M odule for the S M DK2412 is intended specific ally for the Samsung S3C2412 processor on the SMDK2412 devel opment board and for the Linux version 2.6.19 as customized by Samsung for t he aforementioned system. Layers above the reference driver add r ess software interfaces wh ich may pre-exist for a gi ven ap plication and the layer below add r esses hardware r elated interfaces betwe en the processor and the 73M1x22 device.
®
operating system
1.2 Conventions Used in this Guide
This document uses the following conventions:
Software code, IO CTL names, modem event s, data types, and Linux comm ands are presented in Couri er font .
1.3 Acronyms
MAFE – Modem Analog Front End DAA – Data A ccess Arrangement IOCTL – Linux I/O Control ISR – Interrupt Service Routine BSP – Board Support Package
Rev. 1.1 5
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
73M1x22
Device
&
External
Components
SCLK
73M1x22 Hardware Interface Module
Control Module
System
BSP
Register Read/Write
Control & Status
FS
SDIN
SDOUT
Data
Module
DATA
DATA
DATA
DATA
DATA
CTL
DATA
CTL
DATA
CTL
DATA
CTL
CTL
CTL
CTL
CTL
DATA
DATA
DATA
DATA
CTL
CTL
CTL
CTL
Tx/Rx Data
Control & Status
State Machine
API
INT
MS
TYPE
2 Overview
2.1 Driver Arc hite cture
The driver provides a framework by which applications can leverage the features of the 73M1x22 device. The mai n interface o f the d r i ver provides an abstraction layer for monitoring and cont r ol of the d evice status. Figure 1 depi ct s the driver functio nal block diagram .
Figure 1: Driver Functional Block Diagram
2.2 Functio nal Overv ie w
The 73M1x22 driver is built as a Linux loadable module (for Linux) or integ r ated with the operating system kernel. It is brought into operat ion by a user application or by an op er ating system start up script. For Linux, the insmod command is used to inser t the d r iver into the ker nel. Th e insmod comm and invokes
the module_init() macro, which in turn runs the one-ti me init ializat i on function of th e driver. Before exiti ng the initialization the driver enter s its main op er ational state via th e scheduling of one of many timers that make u p the driver’s main processing. This descripti on is valid for Linux 2.6. The driver take s the form of a Linux stand ar d character device driver. It is brought into operation by a user application or by Linux startup script using the
insmod
command. Th i s command inser ts the driver module into the kernel which in turn registers with the kernel usi ng the default major number of 250 Once instal led, the driver is a sel f-contained module running independent l y along wit h the ker nel processes. Its main purp ose is to monitor and co ntrol the MAFE interface, transfer M AFE frames t o and from t he 73M1x22 device and to provide access to the 73M1x22 device for management purpose s, via standard driver access meth ods such as open, close, select, ioctl, etc. Th e following sections provide an overview of that functionality.
6 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
Const char *
path
int
flags
int
3 Accessing the Driver from the Linux User Space
The dri ver provides the link b etween the modem device and the user application via a standard linux character d evice. Access to th e driver is done via Linux supplied file descriptors The fol lowing sections describe how the driver is brought into action based on the operating system environment.
3.1 mknod
The device descrip tors can be cr eated using the mknod command as il lustrated b elo w:
mknod -m 660 /dev/tsc_1x22_mafe_0 c 251 0 mknod -m 660 /de v/tsc_1x22_mafe_1 c 251 1
In this exam ple, one descriptor (tsc_1x22_ctl_mafe_0) is created with major number 251, m i nor number 0, and one descriptor (tsc_1x22_ctl_mafe_l) is cr eated with maj or number 251, minor number 1. The minor num ber associated with the fi l e descriptor i s unused by the driver in this implementation.
3.2 open
Description
Once the dr iver is installed and the device descript or s are cre ated, the driver service can be accessed by user applications via st andard C library
Prototype
open(), an d subsequently reversed with close()
int open ( const char * path, int flags);
Parameters
Data T ype Name Description
Path to th e descriptor created b y mkn od. O_RDWR.
Return Values
Data T ype Description
File descriptor.
Rev. 1.1 7
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
int
fd
int
fd
void *
buf
size_t
buf_size
size_t
3.3 close
Description
A file descriptor obtained with an open() com mand mu st be subsequently released with a correspond i ng close..
Prototype
int close (in t fd);
Parameters
Data T ype Name Description
File descriptor to close.
Return Values
Data Type Description
int
0 = Success.
-1 = Failure.
3.4 read
Description
A file descriptor obtained with an open() com mand can be cal l ed with the standard Linux read comm and to obtain MAFE audio samples. The read command reads as many 16 bit samples into the user supplied bu ffer as possi ble and return the amount of data t hat was copied.
Prototype
size_t read (int fd, void * buf, size_t buf_size);
Parameters
Data T ype Name Description
File descriptor. Bu ffer to read samples into. Maximum size of dat a that can be copied.
Return Values
Data T ype Description
Amount of data that was actually cop ied.
8 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
int
fd
Const void *
buf
size_t
buf_size
size_t
int
fd
int
request
args
int
3.5 write
Description
A file descriptor obtained with an open() com mand can be cal l ed with the standard Linux write command to transmit MAFE audio samples. The write command copy as many 16 bit sam ples from th e user supplied buffer as possible and r eturn the am ount of d ata that was copied.
Prototype
size_t wri te (in t fd, con st voi d * buf, size_t buf_s ize );
Parameters
Data Type Name Description
File descriptor. Bu ffer to copy sampl es from. Maximum size of dat a that can be copied.
Return Values
Data T ype Description
Amount of data that was actually cop ied.
3.6 ioctl
Description
A file descriptor obtained with an open() command can be called with the standard Linux ioctl command to perform various tasks.
Prototype
int ioctl (in t fd, int reque st, … args);
Parameters
Data T ype Name Description
File descriptor. Requested service. Request depend ent arguments.
Return Values
Data T ype Description
Request depend ent return value.
The following section s describe th e detail of each IOCTL command.
Rev. 1.1 9
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
int
fd
int
TSC_1X22_MAFE_GET_RS232
void
NA
unsigned char
int
fd
int
TSC_1X22_MAFE_SET_RS232
unsigned char
RS232
unsigned char
TSC_1X22_MAFE_GET_RS232
3.6.1 TSC_1X22_MAFE_GET_RS232
Description
Retrieves the cur r ent statu s of t he RS232 RTS, DTS, CTR and DTR pins.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_GET_RS232, void );
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier for this operation.
Return Values
Data T ype Description
See RS232 #defines .
3.6.2 TSC_1X22_MAFE_SET_RS232
Description
Sets the current statu s of the RS 232 RTS, DTS, CTR and DTR pins and then returns the resulting status via call to TSC_1X22_MAFE_GET_RS232.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_SET_RS232, unsigned char RS232);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier for this operation.
Bit s to set. See RS23 2 #de fines .
Return Values
Data T ype Description
See
.
10 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
int
fd
int
TSC_1X22_MAFE_GET_RX_STAT
void
NA
Unsigned char
int
fd
int
TSC_1X22_MAFE_GET_TX_STAT
void
NA
Unsigned char
3.6.3 TSC_1X22_MAFE_GET_RX_STAT
Description
Retrieves the curr ent statu s of t he Rx Data Sample FIF O.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_GET_RX_STAT, void );
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier for this operation.
Return Values
Data Type Description
See Rx an d Tx FIFO st atus #defi nes.
3.6.4 TSC_1X22_MAFE_GET_TX_STAT
Description
Retrieves the curr ent statu s of t he Tx Data Sample FIFO.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_GET_TX_STAT, void );
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier for this operation.
Return Values
Data T ype Description
See R x and Tx FIF O status #defi nes.
Rev. 1.1 11
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
int
fd
int
TSC_1X22_MAFE_RD_REG_NB
TSC_1X22_REG_IOCTL_t *
3.6.5 TSC_1X22_MAFE_RD_REG_NB
Description
It copies the last r ead value of the suppl ied reg ister number i nto th e m em bers of the su pplied structure pointer and then requests another read access from the device.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_RD_REG_NB, TSC_1X22_REG_IOCTL_t *);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
See TSC_1X22_REG_IOCTL_t.
Return Values
Data T ype Description
int
0 = Success.
-1 = Fail ure.
12 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
Int
Fd
Int
TSC_1X22_MAFE_RD_REG_IM
TSC_1X22_REG_IOCTL_t *
int
fd
int
TSC_1X22_MAFE_WR_REG_BL
TSC_1X22_REG_IOCTL_t *
int
3.6.6 TSC_1X22_MAFE_RD_REG_IM
Description
It copies the last r ead value of the suppl ied reg ister number i nto th e m em bers of the su pplied structure pointer without r equesting another read from the device.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_RD_REG_IM, TSC_1X22_REG_IOCTL_t *);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
See TSC_1X22_REG_IOCTL_t.
Return Values
Data T ype Description
Int
0 = Success.
-1 = Fail ure.
3.6.7 TSC_1X22_MAFE_RD_REG_BL
Description
Issues a MAFE command to the 73M1x22 to the supplied register and copies the read value into the members of the supplied structure pointer.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_RD_REG_BL, TSC_1X22_REG_IOCTL_t *);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
See TSC_1X22_REG_IOCTL_t.
Return Values
Data T ype Description
0 = Success.
-1 = Fail ure.
Rev. 1.1 13
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
int
fd
int
TSC_1X22_MAFE_WR_REG_NB
TSC_1X22_REG_IOCTL_t *
int int
fd
int
TSC_1X22_MAFE_WR_REG_BL
TSC_1X22_REG_IOCTL_t *
3.6.8 TSC_1X22_MAFE_WR_REG_NB
Description
Issues a writ e command t o the 73M1x22 device of the supplied r egist er number with the supp l ied data.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_WR_REG_NB, TSC_1X22_REG_IOCTL_t *);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
See TSC_1X22_REG_IOCTL_t.
Return Values
Data T ype Description
0 = Success.
-1 = Fail ure.
3.6.9 TSC_1X22_MAFE_WR_REG_BL
Description
Issues a writ e command t o the 73M1x22 device of the supplied r egist er number with the supplied data. It only ret urns once confirm ation i s recei ved that the com mand has been sent.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_WR_REG_BL, TSC_1X22_REG_IOCTL_t *);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
See TSC_1X22_REG_IOCTL_t.
Return Values
Data T ype Description
int
0 = Success.
-1 = Fail ure.
14 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
int
fd
int
TSC_1X22_MAFE_SET_REG_AUTO_POLL
unsigned int
mask
int
fd
int
TSC_1X22_MAFE_IRQ_HW
int
3.6.10 TSC_1X22_MAFE_SET_REG_AUTO_POLL
Description
This IOCLT starts/stops the automatic polling of the 73M1x22 device registers dependent upon the user supplied ar guments. An argument (mask) of 0 disables this feature.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_SET_REG_AUTO_POLL, unsigne d int mas k);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
If mask[b it i] is set th en poll register i.
Return Values
Data T ype Description
int
0 = Success.
-1 = Fail ure.
3.6.11 TSC_1X22_MAFE_IRQ_HW
Description
This IOCTL enables the use of the HW interrupt pin on the 73M1x22 device to be reported through the HW Module. The current SMDK interrupt assigned is through EINT11 / IRQ 39. The interrupt is enabled by default after this call.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_IRQ_HW);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
Return Values
Data T ype Description
Returns 0 upon success, -1 upon f a i l ur e
Rev. 1.1 15
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
int
fd
int
TSC_1X22_MAFE_IRQ_SW
int
fd
int
TSC_1X22_MAFE_IRQ_ENABLE
3.6.12 TSC_1X22_MAFE_IRQ_SW
Description
This IOCTL enables the use of a SW based interrupt scheme for th e 73M1x22 device to be reported thr ough the HW Module. Aut o polling (see TSC_1X22_MAFE_SET_REG_AUTO_POLL) must be enabled for register 0x03 for this feature to work properly. The interrupt mutex/enables remains in their current state after this call.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_IRQ_SW);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
Return Values
Data T ype Description
int
0 = Success.
-1 = Fail ure.
3.6.13 TSC_1X22_MAFE_IRQ_ENABLE
Description
This IOCTL enables the interrupt scheme for the 73M1x22 device to be reported through the HW Module.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_IRQ_ENABLE);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
Return Values
Data T ype Description
int
0 = Success.
-1 = Failure.
16 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
int
fd
int
TSC_1X22_MAFE_IRQ_DISABLE
int int
fd
int
TSC_1X22_MAFE_IRQ_DOWN
-1 = Fail ure.
3.6.14 TSC_1X22_MAFE_IRQ_DISABLE
Description
This IOCTL disables the reporting of interrupts for the 73M1x22 device through the HW Module.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_IRQ_DISABLE);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
Return Values
Data T ype Description
0 = Success.
-1 = Fail ure.
3.6.15 TSC_1X22_MAFE_IRQ_DOWN
Description
This IOCTL attempts a mut ex down call on an internal mutex. This IOCTL blocks until successful. This mut ex is up ’ d inter r upt ser vice routine (SW or HW triggered) and by TSC_1X22_MAFE_IRQ_UP.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_IRQ_DOWN);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
Return Values
Data T ype Description
int
0 = Success.
Rev. 1.1 17
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
int
fd
int
TSC_1X22_MAFE_IRQ_DOWN_TRY
int
int
fd
int
TSC_1X22_MAFE_IRQ_UP
3.6.16 TSC_1X22_MAFE_IRQ_DOWN_TRY
Description
This IOCTL attempts a mut ex down_t r y ca ll on an internal m utex. This IOCTL does not block and always completes.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_IRQ_DOWN_TRY);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
Return Values
Data T ype Description
Returns 0 upon successfully acquiring the lock, non-zero upon failu r e.
3.6.17 TSC_1X22_MAFE_IRQ_UP
Description
This IOCTL attempts a mut ex up call on an internal mut ex. This IOCTL does not b lock and always completes.
Prototype
int ioctl ( int fd, int TSC_1X22_MAFE_IRQ_UP);
Parameters
Data T ype Name Description
Channel descriptor. I/O control identifier.
Return Values
Data T ype Description
int
0 = Success.
-1 = Fail ure.
18 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
void
NA
Void
NA
4 Accessing the Driver from the Linux Kernel Space
When accessing t he driver from the Linux Kernel space the user shou ld use th e exported API function calls instead of the standard device fil e based user space funct i ons.
4.1 mknod
The device does not requir e a character device fi l e to be cr eated via a mknod co m mand to access the driver functionality fr om the kern el space.
4.2 tsc_1x22_mafe_open
Description
Once the dr iver is installed (via insmod) th e driver service can be acce ssed and initialize d wit h a tsc_1x22_mafe_open() call.
Prototype
int tsc_1x 22_ maf e_o pen (void);
Parameters
Data T ype Name Description
Return Values
NA
Data T ype Description
int
0 = Success. Not 0 = Failure.
4.3 tsc_1x22_mafe_close
Description
A file descriptor obtained with a tsc_1x22_mafe_open() command must be subsequently released with a co r respond ing close.
Prototype
int tsc_1x 22_ maf e_c lose (void);
Parameters
Data T ype Name Description
NA
Return Values
Data T ype Description
int
0 = Success. Not 0 = Failure.
Rev. 1.1 19
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
int
fd
void *
vuf
size_t
vuf_size
size_t
int
fd
const void *
buf
size_t
buf_size
size_t
4.4 tsc_1x22_mafe_read
Description
The use r can cal l this tsc_1x22_mafe_read command to obt ai n MAFE audio samples. The read command reads as many 16 bit samples in to the user supp l ied kernel space buffer as possibl e and returns the amount of d ata that was cop ied.
Prototype
size_t tsc_1x22_mafe_read (void * buf, size_t buf_size);
Parameters
Data T ype Name Description
File descriptor. Kernel buffer to read samples i nto. Maximum size of dat a that can be copied.
Return Values
Data T ype Description
Amount of data that was actually cop ied.
4.5 tsc_1x22_mafe_write
Description
The use r may call tsc_1x22_mafe_write to transmit MAFE audio sampl es. The writ e command copies as many 16 bit samp les from the user supp l ied kernel space buffer as possibl e and returns the amount of data that was copi ed.
Prototype
size_t write (const void * buf, size_t buf_size);
Parameters
Data T ype Name Description
File descriptor. Kernel buffer to cop y samples from. Maximum size of dat a that can be copied.
Return Values
Data T ype Description
Amount of data that was actually cop ied.
20 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
Void
NA
unsigned char
unsigned char
RS232
unsigned char
tsc_1x22_rs232_get
4.6 ioctl
Description
The dri ver, while accessed from the kernel space, does not require the cal ling of a specific IOCTL command. The following sections detail the equivalent exported direct fun ction calls that are available in the Kernel space.
4.6.1 tsc_1x22_rs232_get
Description
Retrieves the curr ent statu s of t he RS232 RTS, DTS, CTR and DTR pins.
IOCTL Equivalent
TSC_1X22_MAFE_GET_RS232
Prototype
unsigned char tsc_1x22_rs232_get(void);
Parameters
Data T ype Name Description
NA
Return Values
Data T ype Description
See RS232 #defines .
4.6.2 tsc_1x22_rs232_set
Description
Sets the current status of the RS232 RTS,DTS,CTR and DTR pins and then returns the resulting status via call to tsc_1x22_rs232_get.
IOCTL Equivalent
TSC_1X22_MAFE_SET_RS232
Prototype
unsigned char tsc_1x22_rs232_set(unsigned char RS232);
Parameters
Data T ype Name Description
Bit s to set. See RS23 2 #de fines .
Return Values
Data T ype Description
See
.
Rev. 1.1 21
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
void
NA
unsigned char
void
NA
unsigned char
4.6.3 tsc_1x22_mafe_get_rx_stat
Description
Retrieves the curr ent statu s of t he Rx Data Sample FIF O.
IOCTL Equivalent
TSC_1X22_MAFE_GET_RX_STAT
Prototype
int tsc_1x 22_ maf e_g et_rx_sta t (voi d);
Parameters
Data T ype Name Description
NA
Return Values
Data T ype Description
See Rx an d Tx FIFO st atus #defi nes.
4.6.4 tsc_1x22_mafe_get_tx_stat
Description
Retrieves the curr ent statu s of t he Tx Data Sample FIFO.
IOCTL Equivalent
TSC_1X22_MAFE_GET_TX_STAT
Prototype
int tsc_1x 22_ maf e_g et_tx_sta t (voi d);
Parameters
Data T ype Name Description
Return Values
Data T ype Description
See Rx an d Tx FIFO st atus #defi nes.
22 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
TSC_1X22_REG_t
4.6.5 tsc_1x22_mafe_rd_rg_nb
Description
It copies the last r ead value of the suppl ied reg ister number i nto th e m em bers of the su pplied structure pointer and th en r equests an other read update from t he device.
IOCTL Equivalent
TSC_1X22_MAFE_RD_REG_NB
Prototype
int tsc_1x22_mafe_rd_rg_nb(TSC_1X22_REG_t *);
Parameters
Data T ype Name Description
TSC_1X22_REG_t *
Return Values
Data T ype Description
int
0 = Success.
-1 = Fail ure.
See
.
Rev. 1.1 23
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
TSC_1X22_REG_t *
TSC_1X22_REG_t
TSC_1X22_REG_t
int
4.6.6 tsc_1x22_mafe_rd_rg_im
Description
It copies the last r ead value of the suppl ied reg ister number i nto th e m em bers of the su pplied structure pointer without r equesting another read from the device.
IOCTL Equivalent
TSC_1X22_MAFE_RD_REG_IM
Prototype
int tsc_1x 22_ maf e_r d_rg_im(T SC_ 1X2 2_REG_t *);
Parameters
Data T ype Name Description
Return Values
Data T ype Description
int
0 = Success.
-1 = Fail ure.
See
.
4.6.7 tsc_1x22_mafe_rd_rg_bl
Description
Issues a MAFE command to the 73M1x22 to the supplied register and copies the read value into the members of the supplied structure poi nter.
IOCTL Equivalent
TSC_1X22_MAFE_RD_REG_BL
Prototype
int tsc_1x 22_ mafe_rd_rg_bl(TSC_1X22_REG_t *);
Parameters
Data T ype Name Description
TSC_1X22_REG_t *
Return Values
Data T ype Description
0 = Success.
-1 = Fail ure.
See
.
24 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
TSC_1X22_REG_t *
TSC_1X22_REG_t
TSC_1X22_REG_t
int
4.6.8 tsc_1x22_mafe_wr_rg_nb
Description
Issues a writ e command t o the 73M1x22 device of the supplied r egist er number with the supp l ied data.
IOCTL Equivalent
TSC_1X22_MAFE_WR_REG_NB
Prototype
int tsc_1x 22_ maf e_w r_rg_nb(TSC_1X22_REG_t *);
Parameters
Data T ype Name Description
Return Values
Data T ype Description
int
0 = Success.
-1 = Fail ure.
See
.
4.6.9 tsc_1x22_mafe_wr_rg_bl
Description
Issues a writ e command t o the 73M1x22 device of the supplied register number with the supplied data. It only ret urns once confirm ation i s recei ved that the com mand has been sent.
IOCTL Equivalent
TSC_1X22_MAFE_WR_REG_BL
Prototype
int tsc_1x 22_ maf e_w r_rg_bl(T SC_ 1X2 2_REG_t *);
Parameters
Data T ype Name Description
TSC_1X22_REG_t *
Return Values
Data T ype Description
0 = Success.
-1 = Fail ure.
See
.
Rev. 1.1 25
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
unsigned int
mask
void
4.6.10 tsc_1x22_mafe_set_reg_auto_poll
Description
This starts/stops the automatic polling of the 73M1x22 device registers dependent upon the user supplied argument s. An argument (m ask) of 0 disables th is featu r e.
IOCTL Equivalent
TSC_1X22_MAFE_SET_REG_AUTO_POLL
Prototype
int tsc_1x 22_ maf e_s et_reg_au to_poll(unsi gned int mask);
Parameters
Data T ype Name Description
If mask[b it i] is set th en poll register i.
Return Values
Data T ype Description
int
0 = Success.
-1 = Fail ure.
4.6.11 tsc_1x22_mafe_irq_hw
Description
This function enabl es the use of the HW interrupt pin on the 73M1x22 device to be reported through the HW Module. The current SMDK interrupt assigned is through EINT11 / IRQ 39. The interrupt is enabled by default after this call.
IOCTL Equivalent
TSC_1X22_MAFE_IRQ_HW
Prototype
void tsc_1x22_mafe_irq_hw(void);
Parameters
Data T ype Name Description
NA NA NA
Return Values
Data T ype Description
NA
26 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
void
void
4.6.12 tsc_1x22_mafe_irq_sw
Description
This IOCTL enables the use of a SW based interrupt scheme for th e 73M1x22 device to be reported thr ough the HW Module. Aut o polling (see TSC_1X22_MAFE_SET_REG_AUTO_POLL) must b e enabled for register 0x03 for this feature to work properly. The interrupt m utex/enables remains in their current state after this call.
IOCTL Equivalent
TSC_1X22_MAFE_IRQ_SW
Prototype
void tsc_1x22_mafe_irq_sw(void);
Parameters
Data T ype Name Description
NA NA NA
Return Values
Data T ype Description
NA
4.6.13 tsc_1x22_mafe_irq_enable
Description
This IOCTL enables the interrupt scheme for the 73M1x22 device to be reported through the HW Module.
IOCTL Equivalent
TSC_1X22_MAFE_IRQ_ENABLE
Prototype
void tsc_1x22_mafe_irq_enable(void);
Parameters
Data T ype Name Description
NA NA NA
Return Values
Data T ype Description
NA
Rev. 1.1 27
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
void
void
4.6.14 tsc_1x22_mafe_irq_disable
Description
This IOCTL disables the reporting of interrupts for the 73M1x22 device through the HW Module.
IOCTL Equivalent
TSC_1X22_MAFE_IRQ_DISABLE
Prototype
void tsc_1x22_mafe_irq_disable(void);
Parameters
Data T ype Name Description
NA NA NA
Return Values
Data T ype Description
NA
4.6.15 tsc_1x22_mafe_irq_down
Description
This IOCTL attempts a mut ex down call on an internal mutex. This IOCTL blocks until successful. This mut ex is up ’ d inter r upt ser vice routine (SW or HW triggered) and by TSC_1X22_MAFE_IRQ_UP.
IOCTL Equivalent
TSC_1X22_MAFE_IRQ_DOWN
Prototype
void tsc_1x22_mafe_irq_down(void);
Parameters
Data T ype Name Description
NA NA NA
Return Values
Data T ype Description
NA
28 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
NA
NA
int
NA
NA
void
4.6.16 tsc_1x22_mafe_irq_down_try
Description
This IOCTL attempts a mut ex down_t r y ca ll on an internal mutex. This IOCTL does not block and always complete.
IOCTL Equivalent
TSC_1X22_MAFE_IRQ_DOWN_TRY
Prototype
int tsc_1x22_mafe_irq_down_try(void);
Parameters
Data T ype Name Description
NA
Return Values
Data T ype Description
Returns 0 upon successfully acquiring the lock, non-zero upon failu r e.
4.6.17 tsc_1x22_mafe_irq_up
Description
This IOCTL attempts a mutex up call on an internal m utex. Th is IO C TL does not block and always completes.
IOCTL Equivalent
TSC_1X22_MAFE_IRQ_UP
Prototype
void tsc_1x22_mafe_irq_up(void);
Parameters
Data T ype Name Description
NA
Return Values
Data T ype Description
NA
Rev. 1.1 29
73M1822/73M1922 Hardware Module for SMDK412 User Gu ide UG_1x22_054
4.7 Type and Structure Definition Reference
This section contains the type definitions, reference of data type and structur e used in the dr iver.
4.7.1 RS232 #defines
Description
#defines used in the TSC_1X22_MAFE_GET_RS232 and TSC_1X22_MAFE_SET_RS232 IOCTLs.
Prototype
#define RS232_DTR_O 0x40 #define RS232_RTS_O 0x02 #define RS232_DSR_I 0x80 #define RS232_CTS_I 0x01
4.8 Rx and Tx FIFO status #defines
Description
#defines used in the TSC_1X22_MAFE_GET_RX_STAT and TSC_1X22_MAFE_GET_TX_STAT IOCTLs.
Prototype
#define FIFO_FF 0x0008 #define FIFO_AF 0x0004 #define FIFO_AE 0x0002 #define FIFO_EE 0x0001
4.9 TSC_1X22_REG_IOCTL_t
Description
Stru cture used in the TSC_1X22_MAFE_RD_REG_NB, TSC_1X22_MAFE_RD_REG_BL, TSC_1X22_MAFE_WR_REG_NB and TSC_1X22_MAFE_WR_REG_BL IOCTLs.
Prototype
typedef struct { unsigned char reg; unsigned char dat; } TSC_1X22_REG_IOCTL_t;
4.10 TSC_1X22_REG_t
Description
Structure used by the functions.
Prototype
typedef struct { unsigned char reg; unsigned char dat; } TSC_1X22_REG_t;
30 Rev. 1.1
UG_1x22_054 73M1822/73M1922 Hardware Module for SMDK412 User Guide
tsc_1x22_mafe_module.h
tsc_1x22_mafe_module.c
tsc_1x22_mafe_api.h
tsc_1x22_mafe_api.c
tsc_1x22_mafe_ioctls.h
tsc_1x22_mafe_global.h
4.11 Driver Source and Include Files
The driver softwar e is written excl usive ly in the C programming language and consists of the following:
Table 1: Driver Source Code Files
File Name Description
Contains headers for the Linux module. Contains definitions for the Linux module. Contains headers for the export ed API functions. Contains definitions and support for the API functions. Contains definitions of the Linux IOCTLs. Contains global vari ables and d efi nitions.
4.12 Compile Time Configurable Parameter
The following p ar ameter can be changed at compile an d build time t o r efl ect the real customer environm ent. These param eters are found in the header files:
#define LINUX_DEVICE_MAJOR 250
5 Relat ed Do cument ation
The following 73 M 1x22B documents are available from Teridian Semiconductor Corporation:
73M1822B73M1X22 Data Sheet 73M1822B73M1X22 Layout Guidelines 73M1x22 Worldwide Desi g n Guide 73M1822/73M1922 Control Module User Guide 73M1822/73M1922 Hardware Module for SMDK412 User Guide 73M1822/73M1922 Modem API User Guide 73M1822/7 3M 1 92 2 Mo dem CTL Ap pli catio n User Guide 73M1822/73M1922 MicroDAA Software Architecture
6 Contact Informatio n
For more information about Teridian Semicondu ctor products or to check the availabil i ty of the 73M1822 and 73M1922, contact us at:
644 0 Oak Canyon Road Suite 100 Irvin e, CA 92618-5201
Telephone: (714) 508-8800 FAX: (714) 508-8878 Email: modem.support@teridian.com
For a complete list of worldwide sales offices, go to http://www.teridian.com.
Rev. 1.1 31
Loading...