From abf800fc845ce8736704cbe769f831b73700fa04 Mon Sep 17 00:00:00 2001 From: markster Date: Fri, 2 Jan 2004 23:28:52 +0000 Subject: *Begin* Linux 2.6 build process... not all drivers build, and lots of DEC/INC usecount warnings need to be replaced git-svn-id: http://svn.digium.com/svn/zaptel/trunk@291 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- Makefile | 74 +++++++++++++------------------------------------------ README.Linux26 | 6 +++++ tor2.c | 27 +++++++++++++++----- zaptel.c | 17 +++++++------ zaptel.h | 7 ++++++ zconfig.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 138 insertions(+), 70 deletions(-) create mode 100755 README.Linux26 create mode 100755 zconfig.h diff --git a/Makefile b/Makefile index 4d46c59..792b637 100755 --- a/Makefile +++ b/Makefile @@ -1,9 +1,6 @@ # # Makefile for tormenta/carrier driver and utilities # -BASEADDR=0xd0000 -DEFAULTZONE=0 - # # Okay, the people at RedHat have to break everything they can possibly even attempt to. # So, we have to look in /usr/src/linux-2.4/include for header files given their brain dead @@ -23,61 +20,8 @@ KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I/usr/src/linux/drivers/net \ KFLAGS+=$(shell [ -f $(KINCLUDES)/linux/modversions.h ] && echo "-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h") KFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-msoft-float -fsigned-char"; fi) # -# Features -# -# Take out calibration -#KFLAGS+=-DNO_CALIBRATION -#KFLAGS+=-DNO_DCDC -# Boost ring voltage (Higher ring voltage, takes more power) -#KFLAGS+=-DBOOST_RINGER -# -# Define CONFIG_CALC_XLAW if you have a small number of channels and/or -# a small level 2 cache, to optimize for few channels -# -#KFLAGS+=-DCONFIG_CALC_XLAW -# -# Define if you want MMX optimizations in zaptel -# -#KFLAGS+=-DCONFIG_ZAPTEL_MMX -# -# Pick your echo canceller: MARK2, MARK3, STEVE, or STEVE2 :) -# -#KFLAGS+=-DECHO_CAN_STEVE -#KFLAGS+=-DECHO_CAN_STEVE2 -#KFLAGS+=-DECHO_CAN_MARK -KFLAGS+=-DECHO_CAN_MARK2 -#KFLAGS+=-DECHO_CAN_MARK3 -# -# Uncomment for aggressive residual echo supression under -# MARK2 echo canceller -# -#KFLAGS+=-DAGGRESSIVE_SUPPRESSOR -# -# Uncomment -DCONFIG_ZAPATA_NET to enable SyncPPP, CiscoHDLC, and Frame Relay -# support. -# -#KFLAGS+=-DCONFIG_ZAPATA_NET -# -# Uncomment -DCONFIG_OLD_HDLC_API if your are compiling with ZAPATA_NET -# defined and you are using the old kernel HDLC interface (or if you get -# an error about ETH_P_HDLC while compiling). +# Features are now configured in zconfig.h # -#KFLAGS+=-DCONFIG_OLD_HDLC_API -# -# Uncomment for Generic PPP support (i.e. ZapRAS) -# -#KFLAGS+=-DCONFIG_ZAPATA_PPP -# -# Uncomment to enable "watchdog" to monitor if interfaces -# stop taking interrupts or otherwise misbehave -# -#KFLAGS+=-DCONFIG_ZAPTEL_WATCHDOG -# -# ISA Defaults can be set here. -# -KFLAGS+=-DTORMENTA_BASE=$(BASEADDR) - -KFLAGS+=-DDEFAULT_TONE_ZONE=$(DEFAULTZONE) # # Uncomment if you have an SMP kernel # @@ -101,9 +45,23 @@ ZTTOOL=$(shell if [ -f /usr/include/newt.h ]; then echo zttool; fi) #PRIMARY=wcfxsusb PRIMARY=torisa #PRIMARY=wcfxo +PWD=$(shell pwd) all: $(MODULES) ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL) +linux26: +linux26: prereq ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL) + @if ! [ -d /usr/src/linux-2.6 ]; then echo "Link /usr/src/linux-2.6 to your kernel sources first!"; exit 1 ; fi + make -C /usr/src/linux-2.6 SUBDIRS=$(PWD) modules + +obj-m := $(MODULES) + +#ifneq ($(TOPDIR),) +#include $(TOPDIR)/Rules.make +#endif + +MOD_DESTDIR := zaptel + devel: tor2ee tests: patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest @@ -172,6 +130,8 @@ gendigits: gendigits.o zaptel.c: tones.h +prereq: tones.h tor2fw.h + zttool.o: zttool.c zaptel.h ztprovision.o: ztprovision.c zaptel.h diff --git a/README.Linux26 b/README.Linux26 new file mode 100755 index 0000000..ecb34c3 --- /dev/null +++ b/README.Linux26 @@ -0,0 +1,6 @@ +To build for Linux 2.6, first you must be sure that you have a +symlink to your linux-2.6 sources in /usr/src/linux-2.6 and then you +can type: + +# make linux26 + diff --git a/tor2.c b/tor2.c index 8392354..de76a82 100755 --- a/tor2.c +++ b/tor2.c @@ -181,7 +181,11 @@ static int tor2_shutdown(struct zt_span *span); static int tor2_rbsbits(struct zt_chan *chan, int bits); static int tor2_maint(struct zt_span *span, int cmd); static int tor2_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data); +#ifdef LINUX26 +static irqreturn_t tor2_intr(int irq, void *dev_id, struct pt_regs *regs); +#else static void tor2_intr(int irq, void *dev_id, struct pt_regs *regs); +#endif /* translations of data channels for 24 channels in a 32 bit PCM highway */ @@ -228,7 +232,7 @@ static int tor2_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) static int tor2_chanconfig(struct zt_chan *chan, int sigtype) { int alreadyrunning; - unsigned int flags; + unsigned long flags; struct tor2_chan *p = chan->pvt; alreadyrunning = chan->span->flags & ZT_FLAG_RUNNING; @@ -564,7 +568,7 @@ err_out_free_tor: for (x = 0; x < 3; x++) kfree(tor->chans[x]); kfree(tor); } - return -NODEV; + return -ENODEV; } static struct pci_driver tor2_driver; @@ -652,7 +656,7 @@ static int tor2_rbsbits(struct zt_chan *chan, int bits) u_char m,c; int k,n,b; struct tor2_chan *p = chan->pvt; - unsigned int flags; + unsigned long flags; #if 0 printk("Setting bits to %d on channel %s\n", bits, chan->name); #endif @@ -721,7 +725,7 @@ static int tor2_shutdown(struct zt_span *span) int i; int tspan; int wasrunning; - unsigned int flags; + unsigned long flags; struct tor2_span *p = span->pvt; tspan = p->span + 1; @@ -762,7 +766,7 @@ static int tor2_startup(struct zt_span *span) unsigned long endjif; int i; int tspan; - unsigned int flags; + unsigned long flags; char *coding; char *framing; char *crcing; @@ -1078,7 +1082,7 @@ static int tor2_findsync(struct tor2 *tor) { int i; int x; - long flags; + unsigned long flags; int p; int nonzero; int newsyncsrc = 0; /* Zaptel span number */ @@ -1150,7 +1154,11 @@ found: return 0; } +#ifdef LINUX26 +static irqreturn_t tor2_intr(int irq, void *dev_id, struct pt_regs *regs) +#else static void tor2_intr(int irq, void *dev_id, struct pt_regs *regs) +#endif { int n, i, j, k, syncsrc; unsigned long rxword,txword; @@ -1162,7 +1170,11 @@ static void tor2_intr(int irq, void *dev_id, struct pt_regs *regs) /* make sure its a real interrupt for us */ if (!(tor->mem8[STATREG] & INTACTIVE)) /* if not, just return */ { +#ifdef LINUX26 + return IRQ_NONE; +#else return; +#endif } if (tor->cardtype == TYPE_E1) @@ -1442,6 +1454,9 @@ static void tor2_intr(int irq, void *dev_id, struct pt_regs *regs) else /* clear OUTBIT and enable interrupts */ tor->mem8[CTLREG] = INTENA | tor->master; +#ifdef LINUX26 + return IRQ_RETVAL(1); +#endif } diff --git a/zaptel.c b/zaptel.c index 98b5ac5..de3e4af 100755 --- a/zaptel.c +++ b/zaptel.c @@ -36,6 +36,9 @@ * $Id$ */ + +#include "zconfig.h" + #include #include #include @@ -668,7 +671,7 @@ static inline void calc_fcs(struct zt_chan *ss) static int zt_reallocbufs(struct zt_chan *ss, int j, int numbufs) { unsigned char *newbuf, *oldbuf; - long flags; + unsigned long flags; int x; /* Check numbufs */ if (numbufs < 2) @@ -1989,7 +1992,7 @@ static int initialize_channel(struct zt_chan *chan) static int zt_timing_open(struct inode *inode, struct file *file) { struct zt_timer *t; - long flags; + unsigned long flags; t = kmalloc(sizeof(struct zt_timer), GFP_KERNEL); if (!t) return -ENOMEM; @@ -2008,7 +2011,7 @@ static int zt_timing_open(struct inode *inode, struct file *file) static int zt_timer_release(struct inode *inode, struct file *file) { struct zt_timer *t, *cur, *prev; - long flags; + unsigned long flags; t = file->private_data; if (t) { spin_lock_irqsave(&zaptimerlock, flags); @@ -4870,7 +4873,7 @@ void zt_ec_chunk(struct zt_chan *ss, unsigned char *rxchunk, const unsigned char { short rxlin, txlin; int x; - long flags; + unsigned long flags; spin_lock_irqsave(&ss->lock, flags); /* Perform echo cancellation on a chunk if necessary */ if (ss->ec) { @@ -5418,7 +5421,7 @@ out in the later versions, and is put back now. */ static void process_timers(void) { - long flags; + unsigned long flags; struct zt_timer *cur; spin_lock_irqsave(&zaptimerlock, flags); cur = zaptimers; @@ -5439,7 +5442,7 @@ static void process_timers(void) static unsigned int zt_timer_poll(struct file *file, struct poll_table_struct *wait_table) { struct zt_timer *timer = file->private_data; - long flags; + unsigned long flags; int ret = 0; if (timer) { poll_wait(file, &timer->sel, wait_table); @@ -5459,7 +5462,7 @@ zt_chan_poll(struct file *file, struct poll_table_struct *wait_table, int unit) struct zt_chan *chan = chans[unit]; int ret; - long flags; + unsigned long flags; /* do the poll wait */ if (chan) { diff --git a/zaptel.h b/zaptel.h index c153171..a45b561 100755 --- a/zaptel.h +++ b/zaptel.h @@ -31,7 +31,9 @@ #define _LINUX_ZAPTEL_H #ifdef __KERNEL__ +#include "zconfig.h" #include +#include #ifdef CONFIG_ZAPATA_NET #include #endif @@ -1369,6 +1371,11 @@ static inline short zt_txtone_nextsample(struct zt_chan *ss) #define ZT_LIN2X(a,c) ((c)->lin2x[((unsigned short)(a)) >> 2]) #endif /* CONFIG_CALC_XLAW */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) +#define LINUX26 +#endif + #endif /* __KERNEL__ */ #endif /* _LINUX_ZAPTEL_H */ diff --git a/zconfig.h b/zconfig.h new file mode 100755 index 0000000..d02daca --- /dev/null +++ b/zconfig.h @@ -0,0 +1,77 @@ +/* + * Zaptel configuration options + * + */ +#ifndef _ZCONFIG_H +#define _ZCONFIG_H + +/* Zaptel compile time options */ + +/* + * Uncomment to disable calibration and/or DC/DC converter tests + * (not generally recommended) + */ +/* #define NO_CALIBRATION */ +/* #define NO_DCDC */ + +/* + * Boost ring voltage (Higher ring voltage, takes more power) + */ +/* #define BOOST_RINGER */ + +/* + * Define CONFIG_CALC_XLAW if you have a small number of channels and/or + * a small level 2 cache, to optimize for few channels + * + */ +/* #define CONFIG_CALC_XLAW */ + +/* + * Define if you want MMX optimizations in zaptel + * + */ +/* #define CONFIG_ZAPTEL_MMX */ + +/* + * Pick your echo canceller: MARK2, MARK3, STEVE, or STEVE2 :) + */ +/* #define ECHO_CAN_STEVE */ +/* #define ECHO_CAN_STEVE2 */ +/* #define ECHO_CAN_MARK */ +#define ECHO_CAN_MARK2 +/* #define ECHO_CAN_MARK3 */ + +/* + * Uncomment for aggressive residual echo supression under + * MARK2 echo canceller + */ +/* #define AGGRESSIVE_SUPPRESSOR */ + +/* + * Uncomment CONFIG_ZAPATA_NET to enable SyncPPP, CiscoHDLC, and Frame Relay + * support. + */ +/* #define CONFIG_ZAPATA_NET */ + +/* + * Uncomment CONFIG_OLD_HDLC_API if your are compiling with ZAPATA_NET + * defined and you are using the old kernel HDLC interface (or if you get + * an error about ETH_P_HDLC while compiling). + */ +/* #define CONFIG_OLD_HDLC_API */ + +/* + * Uncomment for Generic PPP support (i.e. ZapRAS) + */ +/* #define CONFIG_ZAPATA_PPP */ +/* + * Uncomment to enable "watchdog" to monitor if interfaces + * stop taking interrupts or otherwise misbehave + */ +/* CONFIG_ZAPTEL_WATCHDOG */ + +/* Tone zone info */ +#define DEFAULT_TONE_ZONE 0 + + +#endif -- cgit v1.2.3