Commit c84b8b50 authored by Scott_Kilau@digi.com's avatar Scott_Kilau@digi.com Committed by Greg Kroah-Hartman

staging: dgap: adds dgap driver to staging

This patch adds the dgap driver to staging. This is
a TTY serial port driver for the EPCA PCI based
product line by Digi International <www.digi.com>.
Signed-off-by: default avatarLidza Louina <lidza.louina@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6b5ad9d2
config DGAP
tristate "Digi EPCA PCI products"
default n
depends on TTY
---help---
Driver for the Digi International EPCA PCI based product line
EXTRA_CFLAGS += -DDG_NAME=\"dgap-1.3-16\" -DDG_PART=\"40002347_C\"
obj-$(CONFIG_DGAP) += dgap.o
dgap-objs := dgap_driver.o dgap_fep5.o dgap_mgmt.o \
dgap_parse.o dgap_proc.o dgap_trace.o \
dgap_tty.o dgap_sysfs.o
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************
*
* dgap_conf.h - Header file for installations and parse files.
*
* $Id: dgap_conf.h,v 1.1 2009/10/23 14:01:57 markh Exp $
*
* NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
*/
#ifndef _DGAP_CONF_H
#define _DGAP_CONF_H
#define NULLNODE 0 /* header node, not used */
#define BNODE 1 /* Board node */
#define LNODE 2 /* Line node */
#define CNODE 3 /* Concentrator node */
#define MNODE 4 /* EBI Module node */
#define TNODE 5 /* tty name prefix node */
#define CUNODE 6 /* cu name prefix (non-SCO) */
#define PNODE 7 /* trans. print prefix node */
#define JNODE 8 /* maJor number node */
#define ANODE 9 /* altpin */
#define TSNODE 10 /* tty structure size */
#define CSNODE 11 /* channel structure size */
#define BSNODE 12 /* board structure size */
#define USNODE 13 /* unit schedule structure size */
#define FSNODE 14 /* f2200 structure size */
#define VSNODE 15 /* size of VPIX structures */
#define INTRNODE 16 /* enable interrupt */
/* Enumeration of tokens */
#define BEGIN 1
#define END 2
#define BOARD 10
#define EPCFS 11 /* start of EPC family definitions */
#define ICX 11
#define MCX 13
#define PCX 14
#define IEPC 15
#define EEPC 16
#define MEPC 17
#define IPCM 18
#define EPCM 19
#define MPCM 20
#define PEPC 21
#define PPCM 22
#ifdef CP
#define ICP 23
#define ECP 24
#define MCP 25
#endif
#define EPCFE 25 /* end of EPC family definitions */
#define PC2E 26
#define PC4E 27
#define PC4E8K 28
#define PC8E 29
#define PC8E8K 30
#define PC16E 31
#define MC2E8K 34
#define MC4E8K 35
#define MC8E8K 36
#define AVANFS 42 /* start of Avanstar family definitions */
#define A8P 42
#define A16P 43
#define AVANFE 43 /* end of Avanstar family definitions */
#define DA2000FS 44 /* start of AccelePort 2000 family definitions */
#define DA22 44 /* AccelePort 2002 */
#define DA24 45 /* AccelePort 2004 */
#define DA28 46 /* AccelePort 2008 */
#define DA216 47 /* AccelePort 2016 */
#define DAR4 48 /* AccelePort RAS 4 port */
#define DAR8 49 /* AccelePort RAS 8 port */
#define DDR24 50 /* DataFire RAS 24 port */
#define DDR30 51 /* DataFire RAS 30 port */
#define DDR48 52 /* DataFire RAS 48 port */
#define DDR60 53 /* DataFire RAS 60 port */
#define DA2000FE 53 /* end of AccelePort 2000/RAS family definitions */
#define PCXRFS 106 /* start of PCXR family definitions */
#define APORT4 106
#define APORT8 107
#define PAPORT4 108
#define PAPORT8 109
#define APORT4_920I 110
#define APORT8_920I 111
#define APORT4_920P 112
#define APORT8_920P 113
#define APORT2_920P 114
#define PCXRFE 117 /* end of PCXR family definitions */
#define LINE 82
#ifdef T1
#define T1M 83
#define E1M 84
#endif
#define CONC 64
#define CX 65
#define EPC 66
#define MOD 67
#define PORTS 68
#define METHOD 69
#define CUSTOM 70
#define BASIC 71
#define STATUS 72
#define MODEM 73
/* The following tokens can appear in multiple places */
#define SPEED 74
#define NPORTS 75
#define ID 76
#define CABLE 77
#define CONNECT 78
#define IO 79
#define MEM 80
#define DPSZ 81
#define TTYN 90
#define CU 91
#define PRINT 92
#define XPRINT 93
#define CMAJOR 94
#define ALTPIN 95
#define STARTO 96
#define USEINTR 97
#define PCIINFO 98
#define TTSIZ 100
#define CHSIZ 101
#define BSSIZ 102
#define UNTSIZ 103
#define F2SIZ 104
#define VPSIZ 105
#define TOTAL_BOARD 2
#define CURRENT_BRD 4
#define BOARD_TYPE 6
#define IO_ADDRESS 8
#define MEM_ADDRESS 10
#define FIELDS_PER_PAGE 18
#define TB_FIELD 1
#define CB_FIELD 3
#define BT_FIELD 5
#define IO_FIELD 7
#define ID_FIELD 8
#define ME_FIELD 9
#define TTY_FIELD 11
#define CU_FIELD 13
#define PR_FIELD 15
#define MPR_FIELD 17
#define MAX_FIELD 512
#define INIT 0
#define NITEMS 128
#define MAX_ITEM 512
#define DSCRINST 1
#define DSCRNUM 3
#define ALTPINQ 5
#define SSAVE 7
#define DSCR "32"
#define ONETONINE "123456789"
#define ALL "1234567890"
struct cnode {
struct cnode *next;
int type;
int numbrd;
union {
struct {
char type; /* Board Type */
short port; /* I/O Address */
char *portstr; /* I/O Address in string */
long addr; /* Memory Address */
char *addrstr; /* Memory Address in string */
long pcibus; /* PCI BUS */
char *pcibusstr; /* PCI BUS in string */
long pcislot; /* PCI SLOT */
char *pcislotstr; /* PCI SLOT in string */
char nport; /* Number of Ports */
char *id; /* tty id */
int start; /* start of tty counting */
char *method; /* Install method */
char v_type;
char v_port;
char v_addr;
char v_pcibus;
char v_pcislot;
char v_nport;
char v_id;
char v_start;
char v_method;
char line1;
char line2;
char conc1; /* total concs in line1 */
char conc2; /* total concs in line2 */
char module1; /* total modules for line1 */
char module2; /* total modules for line2 */
char *status; /* config status */
char *dimstatus; /* Y/N */
int status_index; /* field pointer */
} board;
struct {
char *cable;
char v_cable;
char speed;
char v_speed;
} line;
struct {
char type;
char *connect;
char speed;
char nport;
char *id;
char *idstr;
int start;
char v_type;
char v_connect;
char v_speed;
char v_nport;
char v_id;
char v_start;
} conc;
struct {
char type;
char nport;
char *id;
char *idstr;
int start;
char v_type;
char v_nport;
char v_id;
char v_start;
} module;
char *ttyname;
char *cuname;
char *printname;
int majornumber;
int altpin;
int ttysize;
int chsize;
int bssize;
int unsize;
int f2size;
int vpixsize;
int useintr;
} u;
};
#endif
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: dgap_downld.h,v 1.1 2009/10/23 14:01:57 markh Exp $
*
* NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
*
*/
/*
** downld.h
** - describes the interface between the user level download process
** and the concentrator download driver.
*/
#ifndef _DGAP_DOWNLD_H_
#define _DGAP_DOWNLD_H_
struct fepimg {
int type; /* board type */
int len; /* length of image */
char fepimage[1]; /* begining of image */
};
struct downldio {
unsigned int req_type; /* FEP or concentrator */
unsigned int bdid; /* opaque board identifier */
union {
struct downld_t dl; /* download structure */
struct fepimg fi; /* fep/bios image structure */
} image;
};
#define DIGI_DLREQ_GET (('d'<<8) | 220)
#define DIGI_DLREQ_SET (('d'<<8) | 221)
#define DIGI_DL_NUKE (('d'<<8) | 222) /* Not really a dl request, but
dangerous enuff to not put in
digi.h */
/* Packed bits of intarg for DIGI_DL_NUKE */
#define DIGI_NUKE_RESET_ALL (1 << 31)
#define DIGI_NUKE_INHIBIT_POLLER (1 << 30)
#define DIGI_NUKE_BRD_NUMB 0x0f
#define DLREQ_BIOS 0
#define DLREQ_FEP 1
#define DLREQ_CONC 2
#define DLREQ_CONFIG 3
#define DLREQ_DEVCREATE 4
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Copyright 2004 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
*
*************************************************************************
*
* This file is intended to contain all the kernel "differences" between the
* various kernels that we support.
*
*************************************************************************/
#ifndef __DGAP_KCOMPAT_H
#define __DGAP_KCOMPAT_H
# ifndef KERNEL_VERSION
# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
# endif
#if !defined(TTY_FLIPBUF_SIZE)
# define TTY_FLIPBUF_SIZE 512
#endif
/* Sparse stuff */
# ifndef __user
# define __user
# define __kernel
# define __safe
# define __force
# define __chk_user_ptr(x) (void)0
# endif
# define PARM_STR(VAR, INIT, PERM, DESC) \
static char *VAR = INIT; \
char *dgap_##VAR; \
module_param(VAR, charp, PERM); \
MODULE_PARM_DESC(VAR, DESC);
# define PARM_INT(VAR, INIT, PERM, DESC) \
static int VAR = INIT; \
int dgap_##VAR; \
module_param(VAR, int, PERM); \
MODULE_PARM_DESC(VAR, DESC);
# define PARM_ULONG(VAR, INIT, PERM, DESC) \
static ulong VAR = INIT; \
ulong dgap_##VAR; \
module_param(VAR, long, PERM); \
MODULE_PARM_DESC(VAR, DESC);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
/* NOTHING YET */
# else
# error "this driver does not support anything below the 2.6.27 kernel series."
# endif
#endif /* ! __DGAP_KCOMPAT_H */
This diff is collapsed.
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
*/
#ifndef __DGAP_MGMT_H
#define __DGAP_MGMT_H
#define MGMT_MGMT 0
#define MGMT_DOWNLD 1
int dgap_mgmt_open(struct inode *inode, struct file *file);
int dgap_mgmt_close(struct inode *inode, struct file *file);
#ifdef HAVE_UNLOCKED_IOCTL
long dgap_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
#else
int dgap_mgmt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
#endif
#endif
This diff is collapsed.
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
*/
#ifndef _DGAP_PARSE_H
#define _DGAP_PARSE_H
#include "dgap_driver.h"
extern int dgap_parsefile(char **in, int Remove);
extern struct cnode *dgap_find_config(int type, int bus, int slot);
extern uint dgap_config_get_number_of_ports(struct board_t *bd);
extern char *dgap_create_config_string(struct board_t *bd, char *string);
extern char *dgap_get_config_letters(struct board_t *bd, char *string);
extern uint dgap_config_get_useintr(struct board_t *bd);
extern uint dgap_config_get_altpin(struct board_t *bd);
#endif
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
*/
/* $Id: dgap_pci.h,v 1.1 2009/10/23 14:01:57 markh Exp $ */
#ifndef __DGAP_PCI_H
#define __DGAP_PCI_H
#define PCIMAX 32 /* maximum number of PCI boards */
#define DIGI_VID 0x114F
#define PCI_DEVICE_EPC_DID 0x0002
#define PCI_DEVICE_XEM_DID 0x0004
#define PCI_DEVICE_XR_DID 0x0005
#define PCI_DEVICE_CX_DID 0x0006
#define PCI_DEVICE_XRJ_DID 0x0009 /* PLX-based Xr adapter */
#define PCI_DEVICE_XR_IBM_DID 0x0011 /* IBM 8-port Async Adapter */
#define PCI_DEVICE_XR_BULL_DID 0x0013 /* BULL 8-port Async Adapter */
#define PCI_DEVICE_XR_SAIP_DID 0x001c /* SAIP card - Xr adapter */
#define PCI_DEVICE_XR_422_DID 0x0012 /* Xr-422 */
#define PCI_DEVICE_920_2_DID 0x0034 /* XR-Plus 920 K, 2 port */
#define PCI_DEVICE_920_4_DID 0x0026 /* XR-Plus 920 K, 4 port */
#define PCI_DEVICE_920_8_DID 0x0027 /* XR-Plus 920 K, 8 port */
#define PCI_DEVICE_EPCJ_DID 0x000a /* PLX 9060 chip for PCI */
#define PCI_DEVICE_CX_IBM_DID 0x001b /* IBM 128-port Async Adapter */
#define PCI_DEVICE_920_8_HP_DID 0x0058 /* HP XR-Plus 920 K, 8 port */
#define PCI_DEVICE_XEM_HP_DID 0x0059 /* HP Xem PCI */
#define PCI_DEVICE_XEM_NAME "AccelePort XEM"
#define PCI_DEVICE_CX_NAME "AccelePort CX"
#define PCI_DEVICE_XR_NAME "AccelePort Xr"
#define PCI_DEVICE_XRJ_NAME "AccelePort Xr (PLX)"
#define PCI_DEVICE_XR_SAIP_NAME "AccelePort Xr (SAIP)"
#define PCI_DEVICE_920_2_NAME "AccelePort Xr920 2 port"
#define PCI_DEVICE_920_4_NAME "AccelePort Xr920 4 port"
#define PCI_DEVICE_920_8_NAME "AccelePort Xr920 8 port"
#define PCI_DEVICE_XR_422_NAME "AccelePort Xr 422"
#define PCI_DEVICE_EPCJ_NAME "AccelePort EPC (PLX)"
#define PCI_DEVICE_XR_BULL_NAME "AccelePort Xr (BULL)"
#define PCI_DEVICE_XR_IBM_NAME "AccelePort Xr (IBM)"
#define PCI_DEVICE_CX_IBM_NAME "AccelePort CX (IBM)"
#define PCI_DEVICE_920_8_HP_NAME "AccelePort Xr920 8 port (HP)"
#define PCI_DEVICE_XEM_HP_NAME "AccelePort XEM (HP)"
/*
* On the PCI boards, there is no IO space allocated
* The I/O registers will be in the first 3 bytes of the
* upper 2MB of the 4MB memory space. The board memory
* will be mapped into the low 2MB of the 4MB memory space
*/
/* Potential location of PCI Bios from E0000 to FFFFF*/
#define PCI_BIOS_SIZE 0x00020000
/* Size of Memory and I/O for PCI (4MB) */
#define PCI_RAM_SIZE 0x00400000
/* Size of Memory (2MB) */
#define PCI_MEM_SIZE 0x00200000
/* Max PCI Window Size (2MB) */
#define PCI_WIN_SIZE 0x00200000
#define PCI_WIN_SHIFT 21 /* 21 bits max */
/* Offset of I/0 in Memory (2MB) */
#define PCI_IO_OFFSET 0x00200000
/* Size of IO (2MB) */
#define PCI_IO_SIZE 0x00200000
#endif
This diff is collapsed.
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
*
*
* $Id: dgap_proc.h,v 1.1 2009/10/23 14:01:57 markh Exp $
*
* Description:
*
* Describes the private structures used to manipulate the "special"
* proc constructs (not read-only) used by the Digi Neo software.
* The concept is borrowed heavily from the "sysctl" interface of
* the kernel. I decided not to use the structures and functions
* provided by the kernel for two reasons:
*
* 1. Due to the planned use of "/proc" in the Neo driver, many
* of the functions of the "sysctl" interface would go unused.
* A simpler interface will be easier to maintain.
*
* 2. I'd rather divorce our "added package" from the kernel internals.
* If the "sysctl" structures should change, I will be insulated
* from those changes. These "/proc" entries won't be under the
* "sys" tree anyway, so there is no need to maintain a strict
* dependence relationship.
*
* Author:
*
* Scott H Kilau
*
*/
#ifndef _DGAP_RW_PROC_H
#define _DGAP_RW_PROC_H
/*
* The list of DGAP entries with r/w capabilities.
* These magic numbers are used for identification purposes.
*/
enum {
DGAP_INFO = 1, /* Get info about the running module */
DGAP_MKNOD = 2, /* Get info about driver devices */
DGAP_BOARD_INFO = 3, /* Get info about the specific board */
DGAP_BOARD_VPD = 4, /* Get info about the board's VPD */
DGAP_BOARD_VPDDATA = 5, /* Get info about the board's VPD */
DGAP_BOARD_TTYSTATS = 6, /* Get info about the board's tty stats */
DGAP_BOARD_TTYFLAGS = 7, /* Get info about the board's tty flags */
DGAP_BOARD_MKNOD = 8, /* Get info about board devices */
DGAP_PORT_INFO = 9, /* Get info about the specific port */
DGAP_PORT_SNIFF = 10, /* Sniff data in/out of specific port */
DGAP_PORT_CUSTOM_TTYNAME = 11, /* Get info about UDEV tty name */
DGAP_PORT_CUSTOM_PRNAME = 12, /* Get info about UDEV pr name */
DGAP_PORT_FEPSTATE = 13, /* Get info about Ports FEP state */
};
#define DGAP_MAX_PROC_ENTRIES 999
/*
* Directions for proc handlers
*/
enum {
INBOUND = 1, /* Data being written to kernel */
OUTBOUND = 2, /* Data being read from the kernel */
};
/*
* Each entry in a DGAP proc directory is described with a
* "dgap_proc_entry" structure. A collection of these
* entries (in an array) represents the members associated
* with a particular "/proc" directory, and is referred to
* as a table. All "tables" are terminated by an entry with
* zeros for every member.
*
* The structure members are as follows:
*
* int magic -- ID number associated with this particular
* entry. Should be unique across all of
* DGAP.
*
* const char *name -- ASCII name associated with the /proc entry.
*
* mode_t mode -- File access permisssions for the /proc entry.
*
* dgap_proc_entry *child -- When set, this entry refers to a directory,
* and points to the table which describes the
* entries in the subdirectory
*
* dgap_proc_handler *open_handler -- When set, points to the fxn which
* does any "extra" open stuff.
*
* dgap_proc_handler *close_handler -- When set, points to the fxn which
* does any "extra" close stuff.
*
* dgap_proc_handler *read_handler -- When set, points to the fxn which
* handle outbound data flow
*
* dgap_proc_handler *write_handler -- When set, points to the fxn which
* handles inbound data flow
*
* struct proc_dir_entry *de -- Pointer to the directory entry for this
* object once registered. Used to grab
* the handle of the object for
* unregistration
*
* void *data; When set, points to the parent structure
*
*/
struct dgap_proc_entry {
int magic; /* Integer identifier */
const char *name; /* ASCII identifier */
mode_t mode; /* File access permissions */
struct dgap_proc_entry *child; /* Child pointer */
int (*open_handler) (struct dgap_proc_entry *table, int dir, struct file *filp,
void *buffer, ssize_t *lenp, loff_t *ppos);
int (*close_handler) (struct dgap_proc_entry *table, int dir, struct file *filp,
void *buffer, ssize_t *lenp, loff_t *ppos);
int (*read_handler) (struct dgap_proc_entry *table, int dir, struct file *filp,
char __user *buffer, ssize_t *lenp, loff_t *ppos);
int (*write_handler) (struct dgap_proc_entry *table, int dir, struct file *filp,
const char __user *buffer, ssize_t *lenp, loff_t *ppos);
struct proc_dir_entry *de; /* proc entry pointer */
struct semaphore excl_sem; /* Protects exclusive access var */
int excl_cnt; /* Counts number of curr accesses */
void *data; /* Allows storing a pointer to parent */
};
void dgap_proc_register_basic_prescan(void);
void dgap_proc_unregister_all(void);
void dgap_proc_register_basic_postscan(int board_num);
void dgap_proc_register_channel_postscan(int board_num);
#endif /* _DGAP_RW_PROC_H */
This diff is collapsed.
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
*/
#ifndef __DGAP_SYSFS_H
#define __DGAP_SYSFS_H
#include "dgap_driver.h"
#include <linux/device.h>
struct board_t;
struct channel_t;
struct un_t;
struct pci_driver;
struct class_device;
extern void dgap_create_ports_sysfiles(struct board_t *bd);
extern void dgap_remove_ports_sysfiles(struct board_t *bd);
extern void dgap_create_driver_sysfiles(struct pci_driver *);
extern void dgap_remove_driver_sysfiles(struct pci_driver *);
extern int dgap_tty_class_init(void);
extern int dgap_tty_class_destroy(void);
extern void dgap_create_tty_sysfs(struct un_t *un, struct device *c);
extern void dgap_remove_tty_sysfs(struct device *c);
#endif
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE!
*
* This is shared code between Digi's CVS archive and the
* Linux Kernel sources.
* Changing the source just for reformatting needlessly breaks
* our CVS diff history.
*
* Send any bug fixes/changes to: Eng.Linux at digi dot com.
* Thank you.
*
*/
/* $Id: dgap_trace.c,v 1.1 2009/10/23 14:01:57 markh Exp $ */
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/sched.h> /* For jiffies, task states */
#include <linux/interrupt.h> /* For tasklet and interrupt structs/defines */
#include <linux/vmalloc.h>
#include "dgap_driver.h"
#define TRC_TO_CONSOLE 1
/* file level globals */
static char *dgap_trcbuf; /* the ringbuffer */
#if defined(TRC_TO_KMEM)
static int dgap_trcbufi = 0; /* index of the tilde at the end of */
#endif
extern int dgap_trcbuf_size; /* size of the ringbuffer */
#if defined(TRC_TO_KMEM)
static DEFINE_SPINLOCK(dgap_tracef_lock);
#endif
#if 0
#if !defined(TRC_TO_KMEM) && !defined(TRC_TO_CONSOLE)
void dgap_tracef(const char *fmt, ...)
{
return;
}
#else /* !defined(TRC_TO_KMEM) && !defined(TRC_TO_CONSOLE) */
void dgap_tracef(const char *fmt, ...)
{
va_list ap;
char buf[TRC_MAXMSG+1];
size_t lenbuf;
int i;
static int failed = FALSE;
# if defined(TRC_TO_KMEM)
unsigned long flags;
#endif
if(failed)
return;
# if defined(TRC_TO_KMEM)
DGAP_LOCK(dgap_tracef_lock, flags);
#endif
/* Format buf using fmt and arguments contained in ap. */
va_start(ap, fmt);
i = vsprintf(buf, fmt, ap);
va_end(ap);
lenbuf = strlen(buf);
# if defined(TRC_TO_KMEM)
{
static int initd=0;
/*
* Now, in addition to (or instead of) printing this stuff out
* (which is a buffered operation), also tuck it away into a
* corner of memory which can be examined post-crash in kdb.
*/
if (!initd) {
dgap_trcbuf = (char *) vmalloc(dgap_trcbuf_size);
if(!dgap_trcbuf) {
failed = TRUE;
printk("dgap: tracing init failed!\n");
return;
}
memset(dgap_trcbuf, '\0', dgap_trcbuf_size);
dgap_trcbufi = 0;
initd++;
printk("dgap: tracing enabled - " TRC_DTRC
" 0x%lx 0x%x\n",
(unsigned long)dgap_trcbuf,
dgap_trcbuf_size);
}
# if defined(TRC_ON_OVERFLOW_WRAP_AROUND)
/*
* This is the less CPU-intensive way to do things. We simply
* wrap around before we fall off the end of the buffer. A
* tilde (~) demarcates the current end of the trace.
*
* This method should be used if you are concerned about race
* conditions as it is less likely to affect the timing of
* things.
*/
if (dgap_trcbufi + lenbuf >= dgap_trcbuf_size) {
/* We are wrapping, so wipe out the last tilde. */
dgap_trcbuf[dgap_trcbufi] = '\0';
/* put the new string at the beginning of the buffer */
dgap_trcbufi = 0;
}
strcpy(&dgap_trcbuf[dgap_trcbufi], buf);
dgap_trcbufi += lenbuf;
dgap_trcbuf[dgap_trcbufi] = '~';
# elif defined(TRC_ON_OVERFLOW_SHIFT_BUFFER)
/*
* This is the more CPU-intensive way to do things. If we
* venture into the last 1/8 of the buffer, we shift the
* last 7/8 of the buffer forward, wiping out the first 1/8.
* Advantage: No wrap-around, only truncation from the
* beginning.
*
* This method should not be used if you are concerned about
* timing changes affecting the behaviour of the driver (ie,
* race conditions).
*/
strcpy(&dgap_trcbuf[dgap_trcbufi], buf);
dgap_trcbufi += lenbuf;
dgap_trcbuf[dgap_trcbufi] = '~';
dgap_trcbuf[dgap_trcbufi+1] = '\0';
/* If we're near the end of the trace buffer... */
if (dgap_trcbufi > (dgap_trcbuf_size/8)*7) {
/* Wipe out the first eighth to make some more room. */
strcpy(dgap_trcbuf, &dgap_trcbuf[dgap_trcbuf_size/8]);
dgap_trcbufi = strlen(dgap_trcbuf)-1;
/* Plop overflow message at the top of the buffer. */
bcopy(TRC_OVERFLOW, dgap_trcbuf, strlen(TRC_OVERFLOW));
}
# else
# error "TRC_ON_OVERFLOW_WRAP_AROUND or TRC_ON_OVERFLOW_SHIFT_BUFFER?"
# endif
}
DGAP_UNLOCK(dgap_tracef_lock, flags);
# endif /* defined(TRC_TO_KMEM) */
}
#endif /* !defined(TRC_TO_KMEM) && !defined(TRC_TO_CONSOLE) */
#endif
/*
* dgap_tracer_free()
*
*
*/
void dgap_tracer_free(void)
{
if(dgap_trcbuf)
vfree(dgap_trcbuf);
}
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
*
*****************************************************************************
* Header file for dgap_trace.c
*
* $Id: dgap_trace.h,v 1.1 2009/10/23 14:01:57 markh Exp $
*/
#ifndef __DGAP_TRACE_H
#define __DGAP_TRACE_H
#include "dgap_driver.h"
void dgap_tracef(const char *fmt, ...);
void dgap_tracer_free(void);
#endif
This diff is collapsed.
/*
* Copyright 2003 Digi International (www.digi.com)
* Scott H Kilau <Scott_Kilau at digi dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
*/
#ifndef __DGAP_TTY_H
#define __DGAP_TTY_H
#include "dgap_driver.h"
int dgap_tty_register(struct board_t *brd);
int dgap_tty_preinit(void);
int dgap_tty_init(struct board_t *);
void dgap_tty_post_uninit(void);
void dgap_tty_uninit(struct board_t *);
void dgap_carrier(struct channel_t *ch);
void dgap_input(struct channel_t *ch);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment