[Asterisk-cvs] zaptel README.Linux26,NONE,1.1 zconfig.h,NONE,1.1 Makefile,1.30,1.31 tor2.c,1.15,1.16 zaptel.c,1.52,1.53 zaptel.h,1.24,1.25

markster at lists.digium.com markster at lists.digium.com
Fri Jan 2 17:37:15 CST 2004


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv15709

Modified Files:
	Makefile tor2.c zaptel.c zaptel.h 
Added Files:
	README.Linux26 zconfig.h 
Log Message:
*Begin* Linux 2.6 build process...  not all drivers build, and lots of DEC/INC usecount warnings need to be replaced


--- NEW FILE: README.Linux26 ---
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


--- NEW FILE: zconfig.h ---
/*
 * 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

Index: Makefile
===================================================================
RCS file: /usr/cvsroot/zaptel/Makefile,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- Makefile	11 Dec 2003 01:30:42 -0000	1.30
+++ Makefile	2 Jan 2004 23:28:52 -0000	1.31
@@ -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+=$(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).
-#
-#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
+# Features are now configured in zconfig.h
 #
-# 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 @@
 #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
@@ -171,6 +129,8 @@
 	$(CC) -o gendigits gendigits.o -lm
 
 zaptel.c: tones.h 
+
+prereq: tones.h tor2fw.h
 
 zttool.o: zttool.c zaptel.h
 

Index: tor2.c
===================================================================
RCS file: /usr/cvsroot/zaptel/tor2.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- tor2.c	23 Sep 2003 16:04:45 -0000	1.15
+++ tor2.c	2 Jan 2004 23:28:52 -0000	1.16
@@ -181,7 +181,11 @@
 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_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 @@
 		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 @@
 	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 @@
 	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 @@
 	unsigned long endjif;
 	int i;
 	int tspan;
-	unsigned int flags;
+	unsigned long flags;
 	char *coding;
 	char *framing;
 	char *crcing;
@@ -1078,7 +1082,7 @@
 {
 	int i;
 	int x;
-	long flags;
+	unsigned long flags;
 	int p;
 	int nonzero;
 	int newsyncsrc = 0;			/* Zaptel span number */
@@ -1150,7 +1154,11 @@
 	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 @@
 	  /* 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 @@
 	else
 		/* clear OUTBIT and enable interrupts */
 		tor->mem8[CTLREG] = INTENA | tor->master;
+#ifdef LINUX26
+	return IRQ_RETVAL(1);
+#endif
 }
 
 

Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- zaptel.c	11 Dec 2003 01:30:42 -0000	1.52
+++ zaptel.c	2 Jan 2004 23:28:52 -0000	1.53
@@ -36,6 +36,9 @@
  * $Id$
  */
 
+
+#include "zconfig.h"
+
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/module.h>
@@ -668,7 +671,7 @@
 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 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_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 @@
 {
 	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 @@
 
 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 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 @@
 	
 	struct zt_chan *chan = chans[unit];
 	int	ret;
-	long flags;
+	unsigned long flags;
 
 	  /* do the poll wait */
 	if (chan) {

Index: zaptel.h
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- zaptel.h	30 Oct 2003 23:17:02 -0000	1.24
+++ zaptel.h	2 Jan 2004 23:28:52 -0000	1.25
@@ -31,7 +31,9 @@
 #define _LINUX_ZAPTEL_H
 
 #ifdef __KERNEL__
+#include "zconfig.h"
 #include <linux/config.h>
+#include <linux/version.h>
 #ifdef CONFIG_ZAPATA_NET	
 #include <linux/hdlc.h>
 #endif
@@ -1369,6 +1371,11 @@
 #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 */




More information about the svn-commits mailing list