Commit 0b99d589 authored by Lidza Louina's avatar Lidza Louina Committed by Greg Kroah-Hartman

staging: dgnc: add dgnc digi driver

This patch adds the DGNC driver. This is a TTY Serial Port
Driver for the Digi International Neo and Classic PCI based product
line by Digi International <http://www.digi.com>.

This driver isn't hooked up to the build system because it doesn't
build, it merely adds the driver written by Digi to the kernel tree so
that it can be cleaned up and fixed up properly over time.

Cc: Mark Hounschell <markh@compro.net>
Signed-off-by: default avatarLidza Louina <lidza.louina@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b9cc16c0
config DGNC
tristate "Digi Neo and Classic PCI Products"
default n
depends on TTY
---help---
Driver for the Digi International Neo and Classic PCI based product line.
EXTRA_CFLAGS += -DDG_NAME=\"dgnc-1.3-16\" -DDG_PART=\"40002369_F\"
obj-$(CONFIG_DGNC) += dgnc.o
dgnc-objs := dgnc_cls.o dgnc_driver.o\
dgnc_mgmt.o dgnc_neo.o\
dgnc_proc.o dgnc_trace.o dgnc_tty.o dgnc_sysfs.o
#
# From Makefile.inc
#
#
# Common definitions go here.
#
#
# TRUE_VERSION is the version string used in the driver build,
# it is intended to be in the form:
#
# 2.0-0
#
# A string noting a particular special modification could be
# used as well. This string will be reported when the driver
# is loaded, and will be exposed by its /proc/dgnc/info
# interface.
#
TRUE_VERSION="1.3-16"
#
# DGNC_PART_NUM is the part number string for the driver package.
# It should be in the form:
#
# 40002369_A
#
DGNC_PART_NUM=40002369_F
#
# DGNC_REL_NOTE is the part number string for the driver release
# notes. It should be in the form:
#
# 93000517_A
#
DGNC_REL_NOTE=93000517_F
#
# DGNC_PKG_VER is the "version" number string included in the
# various documentation and packaging files. It should be
# in the form:
#
# 1.0
#
DGNC_PKG_VER=1.3
#
# DGNC_PKG_REV is the "revision" of this version. Together,
# a linux module revision is built with:
#
# ${DGNC_PKG_VER}-${DGNC_PKG_REV}
#
DGNC_PKG_REV=16
#
# DRP_PKG_DATE is the "date" string included in (for now) the
# release notes. It should be in the form:
#
# 11/04/2003
#
DGNC_PKG_DATE=10/17/2008
INIT_DIR= $(shell \
if [ -d /etc/rc.d/init.d ]; \
then echo "$(RPM_BUILD_ROOT)/etc/rc.d/init.d"; \
else echo "$(RPM_BUILD_ROOT)/etc/init.d"; fi)
#
# Miscelaneous path macro's
#
PACKAGE= dgnc
DEVDIR= /dev/dg/$(PACKAGE)
SRCDIR= /usr/src/dg/$(PACKAGE)
BINDIR= /usr/bin
DRVLIBDIR= /etc/$(PACKAGE)
MANDIR= /usr/man
USRLIBDIR= /usr/lib
DGNCDIR= /etc/dgnc
INIT_DIR= $(shell \
if [ -d /etc/rc.d/init.d ]; \
then echo "/etc/rc.d/init.d"; \
else echo "/etc/init.d"; fi)
#
# From Makefile
#
ifndef MYPWD
MYPWD = $(shell pwd)
endif
ifeq ($(KERNDIR),)
KERNVERS := $(shell uname -r)
KERNDIR :=/lib/modules/${KERNVERS}/
endif
# Grab version and other important stuff
RPMNAME := $(PACKAGE)-$(TRUE_VERSION)
PARTNUM := $(DGNC_PART_NUM)
RELNOTES := $(DGNC_REL_NOTE)
MODDIR = $(shell echo $(BUILDROOT)/lib/modules/3.4.36-lcrs/misc)
LSMOD = /sbin/lsmod
RMMOD = /sbin/rmmod
INSMOD = /sbin/insmod
NEW_TTY_LOCKING = No
NEW_TTY_BUFFERING = No
REGISTER_TTYS_WITH_SYSFS = No
# Send in some extra things...
EXTRA_CFLAGS += -I${MYPWD} -I${MYPWD}/include -I${MYPWD}/../../commoninc\
-I${MYPWD}/../../dpa -DLINUX -DDG_NAME=\"$(RPMNAME)\"\
-DDG_PART=\"$(PARTNUM)\" -DDGNC_TRACER
ifeq ($(NEW_TTY_LOCKING),Yes)
EXTRA_CFLAGS += -DNEW_TTY_LOCKING
endif
ifeq ($(NEW_TTY_BUFFERING),Yes)
EXTRA_CFLAGS += -DNEW_TTY_BUFFERING
endif
ifeq ($(REGISTER_TTYS_WITH_SYSFS),Yes)
EXTRA_CFLAGS += -DREGISTER_TTYS_WITH_SYSFS
endif
# Conform to correct kbuild conventions...
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 __DGNC_CLS_H
#define __DGNC_CLS_H
#include "dgnc_types.h"
/************************************************************************
* Per channel/port Classic UART structure *
************************************************************************
* Base Structure Entries Usage Meanings to Host *
* *
* W = read write R = read only *
* U = Unused. *
************************************************************************/
struct cls_uart_struct {
volatile uchar txrx; /* WR RHR/THR - Holding Reg */
volatile uchar ier; /* WR IER - Interrupt Enable Reg */
volatile uchar isr_fcr; /* WR ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
volatile uchar lcr; /* WR LCR - Line Control Reg */
volatile uchar mcr; /* WR MCR - Modem Control Reg */
volatile uchar lsr; /* WR LSR - Line Status Reg */
volatile uchar msr; /* WR MSR - Modem Status Reg */
volatile uchar spr; /* WR SPR - Scratch Pad Reg */
};
/* Where to read the interrupt register (8bits) */
#define UART_CLASSIC_POLL_ADDR_OFFSET 0x40
#define UART_EXAR654_ENHANCED_REGISTER_SET 0xBF
#define UART_16654_FCR_TXTRIGGER_8 0x0
#define UART_16654_FCR_TXTRIGGER_16 0x10
#define UART_16654_FCR_TXTRIGGER_32 0x20
#define UART_16654_FCR_TXTRIGGER_56 0x30
#define UART_16654_FCR_RXTRIGGER_8 0x0
#define UART_16654_FCR_RXTRIGGER_16 0x40
#define UART_16654_FCR_RXTRIGGER_56 0x80
#define UART_16654_FCR_RXTRIGGER_60 0xC0
#define UART_IIR_XOFF 0x10 /* Received Xoff signal/Special character */
#define UART_IIR_CTSRTS 0x20 /* Received CTS/RTS change of state */
#define UART_IIR_RDI_TIMEOUT 0x0C /* Receiver data TIMEOUT */
/*
* These are the EXTENDED definitions for the Exar 654's Interrupt
* Enable Register.
*/
#define UART_EXAR654_EFR_ECB 0x10 /* Enhanced control bit */
#define UART_EXAR654_EFR_IXON 0x2 /* Receiver compares Xon1/Xoff1 */
#define UART_EXAR654_EFR_IXOFF 0x8 /* Transmit Xon1/Xoff1 */
#define UART_EXAR654_EFR_RTSDTR 0x40 /* Auto RTS/DTR Flow Control Enable */
#define UART_EXAR654_EFR_CTSDSR 0x80 /* Auto CTS/DSR Flow COntrol Enable */
#define UART_EXAR654_XOFF_DETECT 0x1 /* Indicates whether chip saw an incoming XOFF char */
#define UART_EXAR654_XON_DETECT 0x2 /* Indicates whether chip saw an incoming XON char */
#define UART_EXAR654_IER_XOFF 0x20 /* Xoff Interrupt Enable */
#define UART_EXAR654_IER_RTSDTR 0x40 /* Output Interrupt Enable */
#define UART_EXAR654_IER_CTSDSR 0x80 /* Input Interrupt Enable */
/*
* Our Global Variables
*/
extern struct board_ops dgnc_cls_ops;
#endif
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 __DGNC_KCOMPAT_H
#define __DGNC_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 *dgnc_##VAR; \
module_param(VAR, charp, PERM); \
MODULE_PARM_DESC(VAR, DESC);
# define PARM_INT(VAR, INIT, PERM, DESC) \
static int VAR = INIT; \
int dgnc_##VAR; \
module_param(VAR, int, PERM); \
MODULE_PARM_DESC(VAR, DESC);
# define PARM_ULONG(VAR, INIT, PERM, DESC) \
static ulong VAR = INIT; \
ulong dgnc_##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 /* ! __DGNC_KCOMPAT_H */
/*
* 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.
*
*/
/************************************************************************
*
* This file implements the mgmt functionality for the
* Neo and ClassicBoard based product lines.
*
************************************************************************
* $Id: dgnc_mgmt.c,v 1.2 2010/12/14 20:08:29 markh Exp $
*/
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/ctype.h>
#include <linux/sched.h> /* For jiffies, task states */
#include <linux/interrupt.h> /* For tasklet and interrupt structs/defines */
#include <linux/serial_reg.h>
#include <linux/termios.h>
#include <asm/uaccess.h> /* For copy_from_user/copy_to_user */
#include "dgnc_driver.h"
#include "dgnc_pci.h"
#include "dgnc_proc.h"
#include "dgnc_kcompat.h" /* Kernel 2.4/2.6 compat includes */
#include "dgnc_mgmt.h"
#include "dpacompat.h"
/* Our "in use" variables, to enforce 1 open only */
static int dgnc_mgmt_in_use[MAXMGMTDEVICES];
/*
* dgnc_mgmt_open()
*
* Open the mgmt/downld/dpa device
*/
int dgnc_mgmt_open(struct inode *inode, struct file *file)
{
unsigned long lock_flags;
unsigned int minor = iminor(inode);
DPR_MGMT(("dgnc_mgmt_open start.\n"));
DGNC_LOCK(dgnc_global_lock, lock_flags);
/* mgmt device */
if (minor < MAXMGMTDEVICES) {
/* Only allow 1 open at a time on mgmt device */
if (dgnc_mgmt_in_use[minor]) {
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
return (-EBUSY);
}
dgnc_mgmt_in_use[minor]++;
}
else {
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
return (-ENXIO);
}
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
DPR_MGMT(("dgnc_mgmt_open finish.\n"));
return 0;
}
/*
* dgnc_mgmt_close()
*
* Open the mgmt/dpa device
*/
int dgnc_mgmt_close(struct inode *inode, struct file *file)
{
unsigned long lock_flags;
unsigned int minor = iminor(inode);
DPR_MGMT(("dgnc_mgmt_close start.\n"));
DGNC_LOCK(dgnc_global_lock, lock_flags);
/* mgmt device */
if (minor < MAXMGMTDEVICES) {
if (dgnc_mgmt_in_use[minor]) {
dgnc_mgmt_in_use[minor] = 0;
}
}
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
DPR_MGMT(("dgnc_mgmt_close finish.\n"));
return 0;
}
/*
* dgnc_mgmt_ioctl()
*
* ioctl the mgmt/dpa device
*/
#ifdef HAVE_UNLOCKED_IOCTL
long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct inode *inode = file->f_dentry->d_inode;
#else
int dgnc_mgmt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
#endif
unsigned long lock_flags;
void __user *uarg = (void __user *) arg;
DPR_MGMT(("dgnc_mgmt_ioctl start.\n"));
switch (cmd) {
case DIGI_GETDD:
{
/*
* This returns the total number of boards
* in the system, as well as driver version
* and has space for a reserved entry
*/
struct digi_dinfo ddi;
DGNC_LOCK(dgnc_global_lock, lock_flags);
ddi.dinfo_nboards = dgnc_NumBoards;
sprintf(ddi.dinfo_version, "%s", DG_PART);
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
DPR_MGMT(("DIGI_GETDD returning numboards: %d version: %s\n",
ddi.dinfo_nboards, ddi.dinfo_version));
if (copy_to_user(uarg, &ddi, sizeof (ddi)))
return(-EFAULT);
break;
}
case DIGI_GETBD:
{
int brd;
struct digi_info di;
if (copy_from_user(&brd, uarg, sizeof(int))) {
return(-EFAULT);
}
DPR_MGMT(("DIGI_GETBD asking about board: %d\n", brd));
if ((brd < 0) || (brd > dgnc_NumBoards) || (dgnc_NumBoards == 0))
return (-ENODEV);
memset(&di, 0, sizeof(di));
di.info_bdnum = brd;
DGNC_LOCK(dgnc_Board[brd]->bd_lock, lock_flags);
di.info_bdtype = dgnc_Board[brd]->dpatype;
di.info_bdstate = dgnc_Board[brd]->dpastatus;
di.info_ioport = 0;
di.info_physaddr = (ulong) dgnc_Board[brd]->membase;
di.info_physsize = (ulong) dgnc_Board[brd]->membase - dgnc_Board[brd]->membase_end;
if (dgnc_Board[brd]->state != BOARD_FAILED)
di.info_nports = dgnc_Board[brd]->nasync;
else
di.info_nports = 0;
DGNC_UNLOCK(dgnc_Board[brd]->bd_lock, lock_flags);
DPR_MGMT(("DIGI_GETBD returning type: %x state: %x ports: %x size: %x\n",
di.info_bdtype, di.info_bdstate, di.info_nports, di.info_physsize));
if (copy_to_user(uarg, &di, sizeof (di)))
return (-EFAULT);
break;
}
case DIGI_GET_NI_INFO:
{
struct channel_t *ch;
struct ni_info ni;
uchar mstat = 0;
uint board = 0;
uint channel = 0;
if (copy_from_user(&ni, uarg, sizeof(struct ni_info))) {
return(-EFAULT);
}
DPR_MGMT(("DIGI_GETBD asking about board: %d channel: %d\n",
ni.board, ni.channel));
board = ni.board;
channel = ni.channel;
/* Verify boundaries on board */
if ((board < 0) || (board > dgnc_NumBoards) || (dgnc_NumBoards == 0))
return (-ENODEV);
/* Verify boundaries on channel */
if ((channel < 0) || (channel > dgnc_Board[board]->nasync))
return (-ENODEV);
ch = dgnc_Board[board]->channels[channel];
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (-ENODEV);
memset(&ni, 0, sizeof(ni));
ni.board = board;
ni.channel = channel;
DGNC_LOCK(ch->ch_lock, lock_flags);
mstat = (ch->ch_mostat | ch->ch_mistat);
if (mstat & UART_MCR_DTR) {
ni.mstat |= TIOCM_DTR;
ni.dtr = TIOCM_DTR;
}
if (mstat & UART_MCR_RTS) {
ni.mstat |= TIOCM_RTS;
ni.rts = TIOCM_RTS;
}
if (mstat & UART_MSR_CTS) {
ni.mstat |= TIOCM_CTS;
ni.cts = TIOCM_CTS;
}
if (mstat & UART_MSR_RI) {
ni.mstat |= TIOCM_RI;
ni.ri = TIOCM_RI;
}
if (mstat & UART_MSR_DCD) {
ni.mstat |= TIOCM_CD;
ni.dcd = TIOCM_CD;
}
if (mstat & UART_MSR_DSR)
ni.mstat |= TIOCM_DSR;
ni.iflag = ch->ch_c_iflag;
ni.oflag = ch->ch_c_oflag;
ni.cflag = ch->ch_c_cflag;
ni.lflag = ch->ch_c_lflag;
if (ch->ch_digi.digi_flags & CTSPACE || ch->ch_c_cflag & CRTSCTS)
ni.hflow = 1;
else
ni.hflow = 0;
if ((ch->ch_flags & CH_STOPI) || (ch->ch_flags & CH_FORCED_STOPI))
ni.recv_stopped = 1;
else
ni.recv_stopped = 0;
if ((ch->ch_flags & CH_STOP) || (ch->ch_flags & CH_FORCED_STOP))
ni.xmit_stopped = 1;
else
ni.xmit_stopped = 0;
ni.curtx = ch->ch_txcount;
ni.currx = ch->ch_rxcount;
ni.baud = ch->ch_old_baud;
DGNC_UNLOCK(ch->ch_lock, lock_flags);
if (copy_to_user(uarg, &ni, sizeof(ni)))
return (-EFAULT);
break;
}
}
DPR_MGMT(("dgnc_mgmt_ioctl finish.\n"));
return 0;
}
/*
* 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 __DGNC_MGMT_H
#define __DGNC_MGMT_H
#define MAXMGMTDEVICES 8
int dgnc_mgmt_open(struct inode *inode, struct file *file);
int dgnc_mgmt_close(struct inode *inode, struct file *file);
#ifdef HAVE_UNLOCKED_IOCTL
long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
#else
int dgnc_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 __DGNC_NEO_H
#define __DGNC_NEO_H
#include "dgnc_types.h"
#include "dgnc_driver.h"
/************************************************************************
* Per channel/port NEO UART structure *
************************************************************************
* Base Structure Entries Usage Meanings to Host *
* *
* W = read write R = read only *
* U = Unused. *
************************************************************************/
struct neo_uart_struct {
volatile uchar txrx; /* WR RHR/THR - Holding Reg */
volatile uchar ier; /* WR IER - Interrupt Enable Reg */
volatile uchar isr_fcr; /* WR ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
volatile uchar lcr; /* WR LCR - Line Control Reg */
volatile uchar mcr; /* WR MCR - Modem Control Reg */
volatile uchar lsr; /* WR LSR - Line Status Reg */
volatile uchar msr; /* WR MSR - Modem Status Reg */
volatile uchar spr; /* WR SPR - Scratch Pad Reg */
volatile uchar fctr; /* WR FCTR - Feature Control Reg */
volatile uchar efr; /* WR EFR - Enhanced Function Reg */
volatile uchar tfifo; /* WR TXCNT/TXTRG - Transmit FIFO Reg */
volatile uchar rfifo; /* WR RXCNT/RXTRG - Recieve FIFO Reg */
volatile uchar xoffchar1; /* WR XOFF 1 - XOff Character 1 Reg */
volatile uchar xoffchar2; /* WR XOFF 2 - XOff Character 2 Reg */
volatile uchar xonchar1; /* WR XON 1 - Xon Character 1 Reg */
volatile uchar xonchar2; /* WR XON 2 - XOn Character 2 Reg */
volatile uchar reserved1[0x2ff - 0x200]; /* U Reserved by Exar */
volatile uchar txrxburst[64]; /* RW 64 bytes of RX/TX FIFO Data */
volatile uchar reserved2[0x37f - 0x340]; /* U Reserved by Exar */
volatile uchar rxburst_with_errors[64]; /* R 64 bytes of RX FIFO Data + LSR */
};
/* Where to read the extended interrupt register (32bits instead of 8bits) */
#define UART_17158_POLL_ADDR_OFFSET 0x80
/* These are the current dvid's of the Neo boards */
#define UART_XR17C158_DVID 0x20
#define UART_XR17D158_DVID 0x20
#define UART_XR17E158_DVID 0x40
#define NEO_EECK 0x10 /* Clock */
#define NEO_EECS 0x20 /* Chip Select */
#define NEO_EEDI 0x40 /* Data In is an Output Pin */
#define NEO_EEDO 0x80 /* Data Out is an Input Pin */
#define NEO_EEREG 0x8E /* offset to EEPROM control reg */
#define NEO_VPD_IMAGESIZE 0x40 /* size of image to read from EEPROM in words */
#define NEO_VPD_IMAGEBYTES (NEO_VPD_IMAGESIZE * 2)
/*
* These are the redefinitions for the FCTR on the XR17C158, since
* Exar made them different than their earlier design. (XR16C854)
*/
/* These are only applicable when table D is selected */
#define UART_17158_FCTR_RTS_NODELAY 0x00
#define UART_17158_FCTR_RTS_4DELAY 0x01
#define UART_17158_FCTR_RTS_6DELAY 0x02
#define UART_17158_FCTR_RTS_8DELAY 0x03
#define UART_17158_FCTR_RTS_12DELAY 0x12
#define UART_17158_FCTR_RTS_16DELAY 0x05
#define UART_17158_FCTR_RTS_20DELAY 0x13
#define UART_17158_FCTR_RTS_24DELAY 0x06
#define UART_17158_FCTR_RTS_28DELAY 0x14
#define UART_17158_FCTR_RTS_32DELAY 0x07
#define UART_17158_FCTR_RTS_36DELAY 0x16
#define UART_17158_FCTR_RTS_40DELAY 0x08
#define UART_17158_FCTR_RTS_44DELAY 0x09
#define UART_17158_FCTR_RTS_48DELAY 0x10
#define UART_17158_FCTR_RTS_52DELAY 0x11
#define UART_17158_FCTR_RTS_IRDA 0x10
#define UART_17158_FCTR_RS485 0x20
#define UART_17158_FCTR_TRGA 0x00
#define UART_17158_FCTR_TRGB 0x40
#define UART_17158_FCTR_TRGC 0x80
#define UART_17158_FCTR_TRGD 0xC0
/* 17158 trigger table selects.. */
#define UART_17158_FCTR_BIT6 0x40
#define UART_17158_FCTR_BIT7 0x80
/* 17158 TX/RX memmapped buffer offsets */
#define UART_17158_RX_FIFOSIZE 64
#define UART_17158_TX_FIFOSIZE 64
/* 17158 Extended IIR's */
#define UART_17158_IIR_RDI_TIMEOUT 0x0C /* Receiver data TIMEOUT */
#define UART_17158_IIR_XONXOFF 0x10 /* Received an XON/XOFF char */
#define UART_17158_IIR_HWFLOW_STATE_CHANGE 0x20 /* CTS/DSR or RTS/DTR state change */
#define UART_17158_IIR_FIFO_ENABLED 0xC0 /* 16550 FIFOs are Enabled */
/*
* These are the extended interrupts that get sent
* back to us from the UART's 32bit interrupt register
*/
#define UART_17158_RX_LINE_STATUS 0x1 /* RX Ready */
#define UART_17158_RXRDY_TIMEOUT 0x2 /* RX Ready Timeout */
#define UART_17158_TXRDY 0x3 /* TX Ready */
#define UART_17158_MSR 0x4 /* Modem State Change */
#define UART_17158_TX_AND_FIFO_CLR 0x40 /* Transmitter Holding Reg Empty */
#define UART_17158_RX_FIFO_DATA_ERROR 0x80 /* UART detected an RX FIFO Data error */
/*
* These are the EXTENDED definitions for the 17C158's Interrupt
* Enable Register.
*/
#define UART_17158_EFR_ECB 0x10 /* Enhanced control bit */
#define UART_17158_EFR_IXON 0x2 /* Receiver compares Xon1/Xoff1 */
#define UART_17158_EFR_IXOFF 0x8 /* Transmit Xon1/Xoff1 */
#define UART_17158_EFR_RTSDTR 0x40 /* Auto RTS/DTR Flow Control Enable */
#define UART_17158_EFR_CTSDSR 0x80 /* Auto CTS/DSR Flow COntrol Enable */
#define UART_17158_XOFF_DETECT 0x1 /* Indicates whether chip saw an incoming XOFF char */
#define UART_17158_XON_DETECT 0x2 /* Indicates whether chip saw an incoming XON char */
#define UART_17158_IER_RSVD1 0x10 /* Reserved by Exar */
#define UART_17158_IER_XOFF 0x20 /* Xoff Interrupt Enable */
#define UART_17158_IER_RTSDTR 0x40 /* Output Interrupt Enable */
#define UART_17158_IER_CTSDSR 0x80 /* Input Interrupt Enable */
/*
* Our Global Variables
*/
extern struct board_ops dgnc_neo_ops;
#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: dgnc_pci.h,v 1.1.1.1 2009/05/20 12:19:19 markh Exp $ */
#ifndef __DGNC_PCI_H
#define __DGNC_PCI_H
#define PCIMAX 32 /* maximum number of PCI boards */
#define DIGI_VID 0x114F
#define PCI_DEVICE_CLASSIC_4_DID 0x0028
#define PCI_DEVICE_CLASSIC_8_DID 0x0029
#define PCI_DEVICE_CLASSIC_4_422_DID 0x00D0
#define PCI_DEVICE_CLASSIC_8_422_DID 0x00D1
#define PCI_DEVICE_NEO_4_DID 0x00B0
#define PCI_DEVICE_NEO_8_DID 0x00B1
#define PCI_DEVICE_NEO_2DB9_DID 0x00C8
#define PCI_DEVICE_NEO_2DB9PRI_DID 0x00C9
#define PCI_DEVICE_NEO_2RJ45_DID 0x00CA
#define PCI_DEVICE_NEO_2RJ45PRI_DID 0x00CB
#define PCI_DEVICE_NEO_1_422_DID 0x00CC
#define PCI_DEVICE_NEO_1_422_485_DID 0x00CD
#define PCI_DEVICE_NEO_2_422_485_DID 0x00CE
#define PCI_DEVICE_NEO_EXPRESS_8_DID 0x00F0
#define PCI_DEVICE_NEO_EXPRESS_4_DID 0x00F1
#define PCI_DEVICE_NEO_EXPRESS_4RJ45_DID 0x00F2
#define PCI_DEVICE_NEO_EXPRESS_8RJ45_DID 0x00F3
#define PCI_DEVICE_NEO_EXPRESS_4_IBM_DID 0x00F4
#define PCI_DEVICE_CLASSIC_4_PCI_NAME "ClassicBoard 4 PCI"
#define PCI_DEVICE_CLASSIC_8_PCI_NAME "ClassicBoard 8 PCI"
#define PCI_DEVICE_CLASSIC_4_422_PCI_NAME "ClassicBoard 4 422 PCI"
#define PCI_DEVICE_CLASSIC_8_422_PCI_NAME "ClassicBoard 8 422 PCI"
#define PCI_DEVICE_NEO_4_PCI_NAME "Neo 4 PCI"
#define PCI_DEVICE_NEO_8_PCI_NAME "Neo 8 PCI"
#define PCI_DEVICE_NEO_2DB9_PCI_NAME "Neo 2 - DB9 Universal PCI"
#define PCI_DEVICE_NEO_2DB9PRI_PCI_NAME "Neo 2 - DB9 Universal PCI - Powered Ring Indicator"
#define PCI_DEVICE_NEO_2RJ45_PCI_NAME "Neo 2 - RJ45 Universal PCI"
#define PCI_DEVICE_NEO_2RJ45PRI_PCI_NAME "Neo 2 - RJ45 Universal PCI - Powered Ring Indicator"
#define PCI_DEVICE_NEO_1_422_PCI_NAME "Neo 1 422 PCI"
#define PCI_DEVICE_NEO_1_422_485_PCI_NAME "Neo 1 422/485 PCI"
#define PCI_DEVICE_NEO_2_422_485_PCI_NAME "Neo 2 422/485 PCI"
#define PCI_DEVICE_NEO_EXPRESS_8_PCI_NAME "Neo 8 PCI Express"
#define PCI_DEVICE_NEO_EXPRESS_4_PCI_NAME "Neo 4 PCI Express"
#define PCI_DEVICE_NEO_EXPRESS_4RJ45_PCI_NAME "Neo 4 PCI Express RJ45"
#define PCI_DEVICE_NEO_EXPRESS_8RJ45_PCI_NAME "Neo 8 PCI Express RJ45"
#define PCI_DEVICE_NEO_EXPRESS_4_IBM_PCI_NAME "Neo 4 PCI Express IBM"
/* Size of Memory and I/O for PCI (4 K) */
#define PCI_RAM_SIZE 0x1000
/* Size of Memory (2MB) */
#define PCI_MEM_SIZE 0x1000
#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: dgnc_proc.h,v 1.1.1.1 2009/05/20 12:19:19 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 _DGNC_RW_PROC_H
#define _DGNC_RW_PROC_H
/*
* The list of DGNC entries with r/w capabilities.
* These magic numbers are used for identification purposes.
*/
enum {
DGNC_INFO = 1, /* Get info about the running module */
DGNC_MKNOD = 2, /* Get info about driver devices */
DGNC_BOARD_INFO = 3, /* Get info about the specific board */
DGNC_BOARD_VPD = 4, /* Get info about the board's VPD */
DGNC_BOARD_TTYSTATS = 5, /* Get info about the board's tty stats */
DGNC_BOARD_TTYINTR = 6, /* Get info about the board's tty intrs */
DGNC_BOARD_TTYFLAGS = 7, /* Get info about the board's tty flags */
DGNC_BOARD_MKNOD = 8, /* Get info about board devices */
DGNC_PORT_INFO = 9, /* Get info about the specific port */
DGNC_PORT_SNIFF = 10, /* Sniff data in/out of specific port */
DGNC_PORT_CUSTOM_TTYNAME = 11, /* Get info about UDEV tty name */
DGNC_PORT_CUSTOM_PRNAME = 12, /* Get info about UDEV pr name */
};
/*
* Directions for proc handlers
*/
enum {
INBOUND = 1, /* Data being written to kernel */
OUTBOUND = 2, /* Data being read from the kernel */
};
/*
* Each entry in a DGNC proc directory is described with a
* "dgnc_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
* DGNC.
*
* const char *name -- ASCII name associated with the /proc entry.
*
* mode_t mode -- File access permisssions for the /proc entry.
*
* dgnc_proc_entry *child -- When set, this entry refers to a directory,
* and points to the table which describes the
* entries in the subdirectory
*
* dgnc_proc_handler *open_handler -- When set, points to the fxn which
* does any "extra" open stuff.
*
* dgnc_proc_handler *close_handler -- When set, points to the fxn which
* does any "extra" close stuff.
*
* dgnc_proc_handler *read_handler -- When set, points to the fxn which
* handle outbound data flow
*
* dgnc_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 dgnc_proc_entry {
int magic; /* Integer identifier */
const char *name; /* ASCII identifier */
mode_t mode; /* File access permissions */
struct dgnc_proc_entry *child; /* Child pointer */
int (*open_handler) (struct dgnc_proc_entry *table, int dir, struct file *filp,
void *buffer, ssize_t *lenp, loff_t *ppos);
int (*close_handler) (struct dgnc_proc_entry *table, int dir, struct file *filp,
void *buffer, ssize_t *lenp, loff_t *ppos);
int (*read_handler) (struct dgnc_proc_entry *table, int dir, struct file *filp,
char __user *buffer, ssize_t *lenp, loff_t *ppos);
int (*write_handler) (struct dgnc_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 dgnc_proc_register_basic_prescan(void);
void dgnc_proc_register_basic_postscan(int board_num);
void dgnc_proc_unregister_all(void);
#endif /* _DGNC_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 __DGNC_SYSFS_H
#define __DGNC_SYSFS_H
#include "dgnc_driver.h"
#include <linux/device.h>
struct board_t;
struct channel_t;
struct un_t;
struct pci_driver;
struct class_device;
extern void dgnc_create_ports_sysfiles(struct board_t *bd);
extern void dgnc_remove_ports_sysfiles(struct board_t *bd);
extern void dgnc_create_driver_sysfiles(struct pci_driver *);
extern void dgnc_remove_driver_sysfiles(struct pci_driver *);
extern int dgnc_tty_class_init(void);
extern int dgnc_tty_class_destroy(void);
extern void dgnc_create_tty_sysfs(struct un_t *un, struct device *c);
extern void dgnc_remove_tty_sysfs(struct device *c);
#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!!!
*
*****************************************************************************
* Header file for dgnc_trace.c
*
* $Id: dgnc_trace.h,v 1.1.1.1 2009/05/20 12:19:19 markh Exp $
*/
#ifndef __DGNC_TRACE_H
#define __DGNC_TRACE_H
#include "dgnc_driver.h"
#if 0
# if !defined(TRC_TO_KMEM) && !defined(TRC_TO_CONSOLE)
void dgnc_tracef(const char *fmt, ...);
# else
void dgnc_tracef(const char *fmt, ...);
# endif
#endif
void dgnc_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 __DGNC_TTY_H
#define __DGNC_TTY_H
#include "dgnc_driver.h"
int dgnc_tty_register(struct board_t *brd);
int dgnc_tty_preinit(void);
int dgnc_tty_init(struct board_t *);
void dgnc_tty_post_uninit(void);
void dgnc_tty_uninit(struct board_t *);
void dgnc_input(struct channel_t *ch);
void dgnc_carrier(struct channel_t *ch);
void dgnc_wakeup_writes(struct channel_t *ch);
void dgnc_check_queue_flow_control(struct channel_t *ch);
void dgnc_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *buf, int nbuf);
#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!!!
*/
#ifndef __DGNC_TYPES_H
#define __DGNC_TYPES_H
#ifndef TRUE
# define TRUE 1
#endif
#ifndef FALSE
# define FALSE 0
#endif
/* Required for our shared headers! */
typedef unsigned char uchar;
#endif
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