Linux Kernel: Drivers/tty/n_gsm.c File Reference - Huihoo

Linux Kernel  3.7.1
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
  • drivers
  • tty
Data Structures | Macros | Functions | Variables n_gsm.c File Reference #include <linux/types.h> #include <linux/major.h> #include <linux/errno.h> #include <linux/signal.h> #include <linux/fcntl.h> #include <linux/sched.h> #include <linux/interrupt.h> #include <linux/tty.h> #include <linux/ctype.h> #include <linux/mm.h> #include <linux/string.h> #include <linux/slab.h> #include <linux/poll.h> #include <linux/bitops.h> #include <linux/file.h> #include <linux/uaccess.h> #include <linux/module.h> #include <linux/timer.h> #include <linux/tty_flip.h> #include <linux/tty_driver.h> #include <linux/serial.h> #include <linux/kfifo.h> #include <linux/skbuff.h> #include <net/arp.h> #include <linux/ip.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/gsmmux.h>

Go to the source code of this file.

Data Structures

struct  gsm_mux_net
 
struct  gsm_msg
 
struct  gsm_dlci
 
struct  gsm_control
 
struct  gsm_mux
 

Macros

#define T1   10 /* 100mS */
 
#define T2   34 /* 333mS */
 
#define N2   3 /* Retry 3 times */
 
#define MAX_MRU   1500
 
#define MAX_MTU   1500
 
#define GSM_NET_TX_TIMEOUT   (HZ*10)
 
#define STATS(net)   (((struct gsm_mux_net *)netdev_priv(net))->stats)
 
#define DLCI_CLOSED   0
 
#define DLCI_OPENING   1 /* Sending SABM not seen UA */
 
#define DLCI_OPEN   2 /* SABM/UA complete */
 
#define DLCI_CLOSING   3 /* Sending DISC not seen UA/DM */
 
#define NUM_DLCI   64
 
#define GSM_SEARCH   0
 
#define GSM_START   1
 
#define GSM_ADDRESS   2
 
#define GSM_CONTROL   3
 
#define GSM_LEN   4
 
#define GSM_DATA   5
 
#define GSM_FCS   6
 
#define GSM_OVERRUN   7
 
#define GSM_LEN0   8
 
#define GSM_LEN1   9
 
#define GSM_SSOF   10
 
#define TX_THRESH_HI   8192
 
#define TX_THRESH_LO   2048
 
#define MAX_MUX   4 /* 256 minors */
 
#define CR   0x02
 
#define EA   0x01
 
#define PF   0x10
 
#define RR   0x01
 
#define UI   0x03
 
#define RNR   0x05
 
#define REJ   0x09
 
#define DM   0x0F
 
#define SABM   0x2F
 
#define DISC   0x43
 
#define UA   0x63
 
#define UIH   0xEF
 
#define CMD_NSC   0x09
 
#define CMD_TEST   0x11
 
#define CMD_PSC   0x21
 
#define CMD_RLS   0x29
 
#define CMD_FCOFF   0x31
 
#define CMD_PN   0x41
 
#define CMD_RPN   0x49
 
#define CMD_FCON   0x51
 
#define CMD_CLD   0x61
 
#define CMD_SNC   0x69
 
#define CMD_MSC   0x71
 
#define MDM_FC   0x01
 
#define MDM_RTC   0x02
 
#define MDM_RTR   0x04
 
#define MDM_IC   0x20
 
#define MDM_DV   0x40
 
#define GSM0_SOF   0xF9
 
#define GSM1_SOF   0x7E
 
#define GSM1_ESCAPE   0x7D
 
#define GSM1_ESCAPE_BITS   0x20
 
#define XON   0x11
 
#define XOFF   0x13
 
#define INIT_FCS   0xFF
 
#define GOOD_FCS   0xCF
 
#define HDR_LEN   6 /* ADDR CTRL [LEN.2] DATA FCS */
 
#define TX_SIZE   512
 

Functions

 module_param (debug, int, 0600)
 
void gsm_cleanup_mux (struct gsm_mux *gsm)
 
 EXPORT_SYMBOL_GPL (gsm_cleanup_mux)
 
int gsm_activate_mux (struct gsm_mux *gsm)
 
 EXPORT_SYMBOL_GPL (gsm_activate_mux)
 
void gsm_free_mux (struct gsm_mux *gsm)
 
 EXPORT_SYMBOL_GPL (gsm_free_mux)
 
struct gsm_mux * gsm_alloc_mux (void)
 
 EXPORT_SYMBOL_GPL (gsm_alloc_mux)
 
int gsm_change_mtu (struct net_device *net, int new_mtu)
 
 module_init (gsm_init)
 
 module_exit (gsm_exit)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS_LDISC (N_GSM0710)
 

Variables

struct tty_ldisc_ops tty_ldisc_packet
 

Macro Definition Documentation

#define CMD_CLD   0x61

Definition at line 312 of file n_gsm.c.

#define CMD_FCOFF   0x31

Definition at line 308 of file n_gsm.c.

#define CMD_FCON   0x51

Definition at line 311 of file n_gsm.c.

#define CMD_MSC   0x71

Definition at line 314 of file n_gsm.c.

#define CMD_NSC   0x09

Definition at line 304 of file n_gsm.c.

#define CMD_PN   0x41

Definition at line 309 of file n_gsm.c.

#define CMD_PSC   0x21

Definition at line 306 of file n_gsm.c.

#define CMD_RLS   0x29

Definition at line 307 of file n_gsm.c.

#define CMD_RPN   0x49

Definition at line 310 of file n_gsm.c.

#define CMD_SNC   0x69

Definition at line 313 of file n_gsm.c.

#define CMD_TEST   0x11

Definition at line 305 of file n_gsm.c.

#define CR   0x02

Definition at line 288 of file n_gsm.c.

#define DISC   0x43

Definition at line 299 of file n_gsm.c.

#define DLCI_CLOSED   0

Definition at line 133 of file n_gsm.c.

#define DLCI_CLOSING   3 /* Sending DISC not seen UA/DM */

Definition at line 136 of file n_gsm.c.

#define DLCI_OPEN   2 /* SABM/UA complete */

Definition at line 135 of file n_gsm.c.

#define DLCI_OPENING   1 /* Sending SABM not seen UA */

Definition at line 134 of file n_gsm.c.

#define DM   0x0F

Definition at line 297 of file n_gsm.c.

#define EA   0x01

Definition at line 289 of file n_gsm.c.

#define GOOD_FCS   0xCF

Definition at line 372 of file n_gsm.c.

#define GSM0_SOF   0xF9

Definition at line 323 of file n_gsm.c.

#define GSM1_ESCAPE   0x7D

Definition at line 325 of file n_gsm.c.

#define GSM1_ESCAPE_BITS   0x20

Definition at line 326 of file n_gsm.c.

#define GSM1_SOF   0x7E

Definition at line 324 of file n_gsm.c.

#define GSM_ADDRESS   2

Definition at line 211 of file n_gsm.c.

#define GSM_CONTROL   3

Definition at line 212 of file n_gsm.c.

#define GSM_DATA   5

Definition at line 214 of file n_gsm.c.

#define GSM_FCS   6

Definition at line 215 of file n_gsm.c.

#define GSM_LEN   4

Definition at line 213 of file n_gsm.c.

#define GSM_LEN0   8

Definition at line 217 of file n_gsm.c.

#define GSM_LEN1   9

Definition at line 218 of file n_gsm.c.

#define GSM_NET_TX_TIMEOUT   (HZ*10)

Definition at line 87 of file n_gsm.c.

#define GSM_OVERRUN   7

Definition at line 216 of file n_gsm.c.

#define GSM_SEARCH   0

Definition at line 209 of file n_gsm.c.

#define GSM_SSOF   10

Definition at line 219 of file n_gsm.c.

#define GSM_START   1

Definition at line 210 of file n_gsm.c.

#define HDR_LEN   6 /* ADDR CTRL [LEN.2] DATA FCS */

Definition at line 640 of file n_gsm.c.

#define INIT_FCS   0xFF

Definition at line 371 of file n_gsm.c.

#define MAX_MRU   1500

Definition at line 85 of file n_gsm.c.

#define MAX_MTU   1500

Definition at line 86 of file n_gsm.c.

#define MAX_MUX   4 /* 256 minors */

Definition at line 276 of file n_gsm.c.

#define MDM_DV   0x40

Definition at line 321 of file n_gsm.c.

#define MDM_FC   0x01

Definition at line 317 of file n_gsm.c.

#define MDM_IC   0x20

Definition at line 320 of file n_gsm.c.

#define MDM_RTC   0x02

Definition at line 318 of file n_gsm.c.

#define MDM_RTR   0x04

Definition at line 319 of file n_gsm.c.

#define N2   3 /* Retry 3 times */

Definition at line 73 of file n_gsm.c.

#define NUM_DLCI   64

Definition at line 167 of file n_gsm.c.

#define PF   0x10

Definition at line 290 of file n_gsm.c.

#define REJ   0x09

Definition at line 296 of file n_gsm.c.

#define RNR   0x05

Definition at line 295 of file n_gsm.c.

#define RR   0x01

Definition at line 293 of file n_gsm.c.

#define SABM   0x2F

Definition at line 298 of file n_gsm.c.

#define STATS (   net)    (((struct gsm_mux_net *)netdev_priv(net))->stats)

Definition at line 102 of file n_gsm.c.

#define T1   10 /* 100mS */

Definition at line 71 of file n_gsm.c.

#define T2   34 /* 333mS */

Definition at line 72 of file n_gsm.c.

#define TX_SIZE   512

Definition at line 2827 of file n_gsm.c.

#define TX_THRESH_HI   8192

Definition at line 246 of file n_gsm.c.

#define TX_THRESH_LO   2048

Definition at line 247 of file n_gsm.c.

#define UA   0x63

Definition at line 300 of file n_gsm.c.

#define UI   0x03

Definition at line 294 of file n_gsm.c.

#define UIH   0xEF

Definition at line 301 of file n_gsm.c.

#define XOFF   0x13

Definition at line 328 of file n_gsm.c.

#define XON   0x11

Definition at line 327 of file n_gsm.c.

Function Documentation

EXPORT_SYMBOL_GPL ( gsm_cleanup_mux  )
EXPORT_SYMBOL_GPL ( gsm_activate_mux  )
EXPORT_SYMBOL_GPL ( gsm_free_mux  )
EXPORT_SYMBOL_GPL ( gsm_alloc_mux  )
int gsm_activate_mux ( struct gsm_mux *  gsm)

gsm_activate_mux - generic GSM setup : our mux

Set up the bits of the mux which are the same for all framing protocols. Add the mux to the mux table so it can be opened and finally kick off connecting to DLCI 0 on the modem.

Definition at line 2069 of file n_gsm.c.

struct gsm_mux* gsm_alloc_mux ( void  )
read

gsm_alloc_mux - allocate a mux

Creates a new mux ready for activation.

Definition at line 2149 of file n_gsm.c.

int gsm_change_mtu ( struct net_device *  net,
int  new_mtu 
)

Definition at line 2707 of file n_gsm.c.

void gsm_cleanup_mux ( struct gsm_mux *  gsm)

gsm_cleanup_mux - generic GSM protocol cleanup : our mux

Clean up the bits of the mux which are the same for all framing protocols. Remove the mux from the mux table, stop all the timers and then shut down each device hanging up the channels as we go.

Definition at line 2015 of file n_gsm.c.

void gsm_free_mux ( struct gsm_mux *  gsm)

gsm_free_mux - free up a mux : mux to free

Dispose of allocated resources for a dead mux

Definition at line 2113 of file n_gsm.c.

MODULE_ALIAS_LDISC ( N_GSM0710  )
module_exit ( gsm_exit  )
module_init ( gsm_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( debug  ,
int  ,
0600   
)

Variable Documentation

struct tty_ldisc_ops tty_ldisc_packet
Initial value:= { .owner = THIS_MODULE, .magic = TTY_LDISC_MAGIC, .name = "n_gsm", .open = gsmld_open, .close = gsmld_close, .flush_buffer = gsmld_flush_buffer, .chars_in_buffer = gsmld_chars_in_buffer, .read = gsmld_read, .write = gsmld_write, .ioctl = gsmld_ioctl, .poll = gsmld_poll, .receive_buf = gsmld_receive_buf, .write_wakeup = gsmld_write_wakeup }

Definition at line 2807 of file n_gsm.c.

Generated on Thu Jan 10 2013 15:51:02 for Linux Kernel by   doxygen 1.8.2

Từ khóa » N_gsm.c