1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00

Update to 1.4.11. The port is much less tested and complete as the previous

1.4.6, but we have no choice since new asterisk depends on this version.

Submitted by:	Oleksandr Tymoshenko <gonzo@bluezbox.com>
This commit is contained in:
Maxim Sobolev 2008-12-09 07:57:16 +00:00
parent 93efe30a94
commit 7e53ba4e34
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=224019
13 changed files with 16 additions and 304 deletions

View File

@ -6,10 +6,9 @@
#
PORTNAME= zaptel
PORTVERSION= 1.4.6
PORTREVISION= 7
PORTVERSION= 1.4.11
CATEGORIES= misc kld
MASTER_SITES= http://www.pbxpress.com/~gonzo/
MASTER_SITES= http://people.freebsd.org/~gonzo/zaptel/
DISTNAME= ${PORTNAME}-bsd-${PORTVERSION}
MAINTAINER= sobomax@FreeBSD.org
@ -25,14 +24,9 @@ MAKE_ENV= KMODDIR=${PREFIX}/lib/zaptel
SUB_FILES= pkg-message
USE_RC_SUBR= zaptel
.include <bsd.port.pre.mk>
WRKSRC= ${WRKDIR}/${PORTNAME}-bsd
.if ${ARCH} == "amd64"
PLIST_SUB+= WITH_TAU32="@comment "
.else
PLIST_SUB+= WITH_TAU32=""
MAKE_ARGS+= WITH_TAU32="yes"
.endif
.include <bsd.port.pre.mk>
pre-everything::
@if [ ! -f /usr/src/sys/Makefile ]; then \
@ -43,8 +37,8 @@ pre-everything::
post-patch:
@${REINPLACE_CMD} -e "s|<getopt.h>|<unistd.h>|g" \
${WRKSRC}/test/ztmonitor.c ${WRKSRC}/test/zttool.c \
${WRKSRC}/ztcfg/ztcfg.c
${WRKSRC}/tools/ztmonitor.c ${WRKSRC}/tools/zttool.c \
${WRKSRC}/tools/ztcfg.c ${WRKSRC}/tools/zttest.c
pre-su-install:
@${MKDIR} ${PREFIX}/lib/zaptel

View File

@ -1,3 +1,3 @@
MD5 (zaptel-bsd-1.4.6.tar.gz) = ca6a29a6eef536aa472a1f9168580dc5
SHA256 (zaptel-bsd-1.4.6.tar.gz) = ff693908afc1c54123aa8499f1fe839648846dc741f9251947b1d7f06ef3f3e9
SIZE (zaptel-bsd-1.4.6.tar.gz) = 1028724
MD5 (zaptel-bsd-1.4.11.tar.gz) = 447fdd46eeb58e6ef886329a22a75e74
SHA256 (zaptel-bsd-1.4.11.tar.gz) = c43664b3774c65ad1f1dbda87b5e4d397a0baec4b2c6204ac85390da39b94f3a
SIZE (zaptel-bsd-1.4.11.tar.gz) = 349707

View File

@ -1,12 +0,0 @@
$FreeBSD$
--- Makefile.orig
+++ Makefile
@@ -1,5 +1,5 @@
# $Id: Makefile 840 2004-06-16 15:23:08Z gonzo $
-HWMODULES=zaptel tools oct612x qozap zaphfc wcfxs wcfxo wct1xxp wcte11xp wcte12xp wct4xxp ztdummy
+HWMODULES=zaptel tools qozap zaphfc wcfxs wcfxo wct1xxp wcte11xp wcte12xp wct4xxp ztdummy
USERLAND=ztcfg test
.if defined(WITH_TAU32)
HWMODULES+=tau32pci

View File

@ -1,14 +0,0 @@
$FreeBSD$
--- test/Makefile.orig
+++ test/Makefile
@@ -1,7 +1,7 @@
# $Id: Makefile 856 2004-06-22 13:40:16Z gonzo $
LOCALBASE?=/usr/local
-CFLAGS+=-I.. -I../ztcfg -I${LOCALBASE}/include
+CFLAGS+=-I.. -I../zaptel -I../ztcfg -I${LOCALBASE}/include
PREFIX?=/usr/local
BSD_INSTALL_PROGRAM?=${INSTALL} -o root -g wheel -m 755 -s

View File

@ -1,20 +0,0 @@
--- tools/fxotune.c.orig Thu Jan 4 02:13:23 2007
+++ tools/fxotune.c Wed Feb 6 11:43:10 2008
@@ -320,7 +320,7 @@
mycoefs.coef7 = mycoef7;
mycoefs.coef8 = mycoef8;
- snprintf(completezappath, sizeof(completezappath), "%s/%d", zappath, myzap);
+ snprintf(completezappath, sizeof(completezappath), "%s/channel%d", zappath, myzap);
fd = open(completezappath, O_RDWR);
if (fd < 0) {
@@ -356,7 +356,7 @@
}
for (i = 0; i < 252; i++) {
- snprintf(zapdev, sizeof(zapdev), "%s/%d", zappath, i+1);
+ snprintf(zapdev, sizeof(zapdev), "%s/channel%d", zappath, i+1);
fd = open(zapdev, O_RDWR);
if (fd < 0) {

View File

@ -1,50 +0,0 @@
$FreeBSD$
--- zaptel/zaptel.c.orig 2007-01-26 09:51:48.000000000 +0100
+++ zaptel/zaptel.c 2008-03-31 15:44:58.000000000 +0200
@@ -254,7 +254,11 @@
while (1) {
if (kthread_must_exit) {
wakeup(cookie);
+#if (__FreeBSD_version >= 800002)
+ kthread_exit();
+#else
kthread_exit(0);
+#endif
}
ZAP_LOCK(toselwakeup_lock);
@@ -396,7 +400,7 @@
int schluffen(void *q)
{
- int rc = tsleep(q, PZERO | PCATCH, "schluffen", 0);
+ int rc = tsleep(q, PZERO | PCATCH, "schluffen", 10);
switch(rc)
{
case EINTR:
@@ -675,7 +679,11 @@
/* Free dev_info, if exist */
if(dev->si_drv2) free(dev->si_drv2, M_ZAP);
dev->si_drv2 = NULL;
+#if (__FreeBSD_version >= 700050)
+ destroy_dev_sched(dev);
+#else
destroy_dev(dev);
+#endif
return res;
}
@@ -1254,7 +1262,11 @@
ZAP_LOCK_INIT(toselwakeup_lock, "toselwakeup_lock");
kthread_must_exit = 0;
+#if (__FreeBSD_version >= 800002)
+ if (kproc_create(selwakeup_thread_handler, (void *)toselwakeup, &kthread, 0, 0, "zt_selwakeup_thread"))
+#else
if (kthread_create(selwakeup_thread_handler, (void *)toselwakeup, &kthread, 0, 0, "zt_selwakeup_thread"))
+#endif
{
printf("Failed to create kthread\n");
}

View File

@ -1,23 +0,0 @@
$FreeBSD$
--- zaptel/zt_chan.c
+++ zaptel/zt_chan.c
@@ -1267,7 +1267,7 @@
struct zt_chan *chan;
int channo = 0;
int res;
- int flags;
+ unsigned long flags;
chan = (struct zt_chan *) (dev->si_drv1);
@@ -1282,7 +1282,7 @@
return EINVAL;
if (channo > ZT_MAX_CHANNELS)
return EINVAL;
- flags = (int)dev->si_drv1;
+ flags = (unsigned long)dev->si_drv1;
res = zt_specchan_open(dev, channo, 0);
if (!res) {
/* Setup the pointer for future stuff */

View File

@ -1,23 +0,0 @@
$FreeBSD$
--- zaptel/zt_zone.c
+++ zaptel/zt_zone.c
@@ -326,7 +326,7 @@
int x;
int space;
int res;
- int addr;
+ unsigned long addr;
/* XXX Unnecessary XXX */
memset(samples, 0, sizeof(samples));
@@ -334,7 +334,7 @@
memset(next, 0, sizeof(next));
memset(&th, 0, sizeof(th));
- bcopy((void *)data, &addr, 4);
+ bcopy((void *)data, &addr, sizeof(addr));
data = addr;
if(copyin( (caddr_t)addr, &th, sizeof(th)))
printf("copyin failed\n");

View File

@ -1,14 +0,0 @@
$FreeBSD$
--- ztcfg/Makefile
+++ ztcfg/Makefile
@@ -3,7 +3,7 @@
LOCALBASE?=/usr/local
PREFIX?=/usr/local
CFLAGS+=-I. -I../zaptel -I${LOCALBASE}/include -DUSE_LOCAL_INCLUDE=1 \
- -DPREFIX=\"${PREFIX}\"
+ -DPREFIX=\"${PREFIX}\" -fPIC
INSTALL=/usr/bin/install
BSD_INSTALL_PROGRAM?=${INSTALL} -o root -g wheel -m 755 -s
BSD_INSTALL_DATA?=${INSTALL} -o root -g wheel -m 644

View File

@ -1,112 +0,0 @@
--- ztdummy/ztdummy.c.orig Mon Jul 30 15:11:25 2007
+++ ztdummy/ztdummy.c Mon Jul 30 15:11:32 2007
@@ -22,6 +22,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
+ * Rewritten to use the time of day clock (which should be ntp synced
+ * for this to work perfectly) by David G. Lawrence <dg@dglawrence.com>.
+ * July 27th, 2007.
+ *
*/
#include <sys/cdefs.h>
@@ -45,26 +49,82 @@
MALLOC_DEFINE(M_ZTD, "ztdummy", "ztdummy interface data structures");
+#ifndef timersub
+#define timersub(tvp, uvp, vvp) \
+ do { \
+ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
+ (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
+ if ((vvp)->tv_usec < 0) { \
+ (vvp)->tv_sec--; \
+ (vvp)->tv_usec += 1000000; \
+ } \
+ } while (0)
+#endif
static struct callout_handle ztdummy_timer_handle = CALLOUT_HANDLE_INITIALIZER(&ztdummy_timer_handle);
static struct ztdummy *ztd;
static int debug = 0;
+static struct timeval basetime, curtime, sleeptime;
static __inline void ztdummy_timer(void* arg )
{
- int i,j;
+ int i, ticks;
- j = max(1, 1000/hz);
-
- for(i=0; i < j; i++) {
+loop:
+ for (i = 0; i < hz / 100; i++) {
zt_receive(&ztd->span);
zt_transmit(&ztd->span);
}
-
- ztdummy_timer_handle = timeout(ztdummy_timer, NULL, hz/1000);
+fixtime:
+ microtime(&curtime);
+
+ /*
+ * Sleep until the next 10ms boundry.
+ */
+ basetime.tv_usec += 10000;
+ if (basetime.tv_usec >= 1000000) {
+ basetime.tv_sec++;
+ basetime.tv_usec -= 1000000;
+ }
+ timersub(&basetime, &curtime, &sleeptime);
+
+ /*
+ * Detect if we've gotten behind and need to start our processing
+ * immediately.
+ */
+ if (sleeptime.tv_sec < 0 || sleeptime.tv_usec == 0) {
+ /*
+ * Limit how far we can get behind to something reasonable (1 sec)
+ * so that we don't go nuts when something (ntp or admin) sets the
+ * clock forward by a large amount.
+ */
+ if (sleeptime.tv_sec < -1) {
+ basetime.tv_sec = curtime.tv_sec;
+ basetime.tv_usec = curtime.tv_usec;
+ goto fixtime;
+ }
+ goto loop;
+ }
+ /*
+ * Detect if something is messing with the system clock by
+ * checking that the sleep time is no more than 20ms and
+ * resetting our base time if it is. This case will occur if
+ * the system clock has been reset to an earlier time.
+ */
+ if (sleeptime.tv_sec > 0 || sleeptime.tv_usec > 20000) {
+ basetime.tv_sec = curtime.tv_sec;
+ basetime.tv_usec = curtime.tv_usec;
+ goto fixtime;
+ }
+
+ ticks = sleeptime.tv_usec * hz / 1000000;
+ if (ticks == 0)
+ goto loop;
+
+ ztdummy_timer_handle = timeout(ztdummy_timer, NULL, ticks);
}
static int ztdummy_initialize(struct ztdummy *ztd)
@@ -102,7 +162,8 @@
return -ENODEV;
}
- ztdummy_timer_handle = timeout(ztdummy_timer, NULL, hz/1000);
+ microtime(&basetime);
+ ztdummy_timer_handle = timeout(ztdummy_timer, NULL, 1);
if (debug)
printf("ztdummy: init() finished\n");

View File

@ -12,17 +12,4 @@ To unload it:
# %%PREFIX%%/etc/rc.d/zaptel stop
It'll also load the driver automatically when the system is started.
Report problems to Alexander Timoshenko <gonzo@pbxpress.com>. Please note that
it is still "work in progress" so that your bug reports are welcome and will
help to improve quality of the drivers.
Great thanks to all companies and individuals who made this driver happen,
including but not limited to, John Todd, Chris Coleman, Alexander Timoshenko,
PBXpress, Inc, Max Khon, LF.net, Luigi Rizzo, Dinesh Nair, Yuri Saltikov and
others contributors.
Thanks and enjoy!
-Maxim
-------------------------------------------------------------------------------

View File

@ -28,7 +28,7 @@ load_rc_config $name
: ${zaptel_enable="NO"}
: ${zaptel_kmod_load="zaptel.ko qozap.ko tau32pci.ko wcfxo.ko wcfxs.ko wct1xxp.ko wct4xxp.ko wcte11xp.ko wcte12xp.ko"}
: ${zaptel_kmod_load="zaptel.ko wctdm.ko wctdm24xxp.ko wct1xxp.ko wct4xxp.ko wcte11xp.ko wcte12xp.ko"}
# Reverse list
zaptel_kmod_unload=""
for kmod in ${zaptel_kmod_load}

View File

@ -1,7 +1,10 @@
bin/fxo_test
bin/fxotune
bin/fxstest
bin/wct4xxp-diag
bin/ztcfg
bin/ztmonitor
bin/ztscan
bin/ztspeed
bin/zttest
bin/zttool
etc/zaptel.conf.sample
@ -9,15 +12,11 @@ include/zaptel/tonezone.h
include/zaptel/zaptel.h
lib/libtonezone.a
lib/zaptel/linker.hints
lib/zaptel/qozap.ko
%%WITH_TAU32%%lib/zaptel/tau32pci.ko
lib/zaptel/wcfxo.ko
lib/zaptel/wcfxs.ko
lib/zaptel/wct1xxp.ko
lib/zaptel/wct4xxp.ko
lib/zaptel/wctdm.ko
lib/zaptel/wctdm24xxp.ko
lib/zaptel/wcte11xp.ko
lib/zaptel/wcte12xp.ko
lib/zaptel/zaphfc.ko
lib/zaptel/zaptel.ko
lib/zaptel/ztdummy.ko
@dirrm lib/zaptel