[svn-commits] tzafrir: branch tzafrir/xpp_1.2 r1551 - in /team/tzafrir/xpp_1.2/xpp: ./ utils/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat Nov 4 02:53:25 MST 2006


Author: tzafrir
Date: Sat Nov  4 03:53:23 2006
New Revision: 1551

URL: http://svn.digium.com/view/zaptel?rev=1551&view=rev
Log:
Merging xpp driver release 1.2 (rev. 2569). 
 * Should build well. Almost final.
 * genzaptelconf: Also work when zap_autoreg=0
 * README.Astribank updated for rev. 1.2.

Modified:
    team/tzafrir/xpp_1.2/xpp/   (props changed)
    team/tzafrir/xpp_1.2/xpp/Makefile
    team/tzafrir/xpp_1.2/xpp/README.Astribank
    team/tzafrir/xpp_1.2/xpp/calibrate_slics   (props changed)
    team/tzafrir/xpp_1.2/xpp/card_fxo.c
    team/tzafrir/xpp_1.2/xpp/card_fxo.h
    team/tzafrir/xpp_1.2/xpp/card_fxs.c
    team/tzafrir/xpp_1.2/xpp/card_fxs.h
    team/tzafrir/xpp_1.2/xpp/card_global.c
    team/tzafrir/xpp_1.2/xpp/init_card_3_23   (props changed)
    team/tzafrir/xpp_1.2/xpp/init_card_4_23   (props changed)
    team/tzafrir/xpp_1.2/xpp/utils/   (props changed)
    team/tzafrir/xpp_1.2/xpp/utils/Makefile
    team/tzafrir/xpp_1.2/xpp/utils/adj_clock.8   (contents, props changed)
    team/tzafrir/xpp_1.2/xpp/utils/adj_clock.c   (props changed)
    team/tzafrir/xpp_1.2/xpp/utils/genzaptelconf
    team/tzafrir/xpp_1.2/xpp/utils/print_modes.c   (props changed)
    team/tzafrir/xpp_1.2/xpp/xbus-core.c
    team/tzafrir/xpp_1.2/xpp/xbus-core.h
    team/tzafrir/xpp_1.2/xpp/xpp_usb.c
    team/tzafrir/xpp_1.2/xpp/xpp_zap.c
    team/tzafrir/xpp_1.2/xpp/xpp_zap.h
    team/tzafrir/xpp_1.2/xpp/xproto.c
    team/tzafrir/xpp_1.2/xpp/xproto.h

Propchange: team/tzafrir/xpp_1.2/xpp/
------------------------------------------------------------------------------
--- svk:merge (added)
+++ svk:merge Sat Nov  4 03:53:23 2006
@@ -1,0 +1,1 @@
+283159da-0705-0410-b60c-f2062b4bb6ad:/components/xpp-zaptel/trunk/xpp:2600

Propchange: team/tzafrir/xpp_1.2/xpp/
------------------------------------------------------------------------------
    svn:executable = calibrate_slics

Modified: team/tzafrir/xpp_1.2/xpp/Makefile
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/Makefile?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/Makefile (original)
+++ team/tzafrir/xpp_1.2/xpp/Makefile Sat Nov  4 03:53:23 2006
@@ -1,13 +1,10 @@
-EXTRA_CFLAGS	= -I$(SUBDIRS) -DDEBUG -DPOLL_DIGITAL_INPUTS -DWITH_ECHO_SUPPRESSION # -DSOFT_RING
+EXTRA_CFLAGS	= -g3 -I$(SUBDIRS) -DDEBUG -DPOLL_DIGITAL_INPUTS -DWITH_ECHO_SUPPRESSION # -DSOFT_RING
 
 obj-m		+= xpp.o xpd_fxs.o xpd_fxo.o
 
 # Build only supported modules
 ifneq	(,$(filter y m,$(CONFIG_USB)))
 obj-m		+= xpp_usb.o
-endif
-ifneq	(,$(filter y m,$(CONFIG_ZAPATA_BRI_DCHANS)))
-obj-m		+= xpd_bri.o
 endif
 
 xpp-y		+= xbus-core.o xpp_zap.o xproto.o card_global.o

Modified: team/tzafrir/xpp_1.2/xpp/README.Astribank
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/README.Astribank?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/README.Astribank (original)
+++ team/tzafrir/xpp_1.2/xpp/README.Astribank Sat Nov  4 03:53:23 2006
@@ -28,7 +28,7 @@
 apart from the standard 'make install' in the zaptel directory, 
 run:
 
-  make -C xpp/utils CONFIG_USB=y HOSTCC=gcc install
+  make -C xpp/utils install
 
 Alternatively, do the following manually:
 
@@ -48,6 +48,16 @@
   /etc/hotplug/usb/xpp_fxloader load
 
 to load firmware.
+
+The FXS calibration script requires the perl module Time::HiRes. This
+modules is already packaged for most distributions including Debian, Fedora,
+RedHat and CentOS. To test for the existance of this module run:
+  perl -MTime::HiRes -e ''
+
+This should run cleanly (without output) if the module exists and issue
+a long error message otherwise. At least in RedHat, CentOS and Fedora-2
+until Fedora-5 it is in a package named perl-Time-HiRes. In Debian and
+Fedora-6 it is bundled with perl.
 
 
 DEVICE STARTUP:
@@ -68,7 +78,7 @@
 A funny way to call an Astribank device.
 
 XPD:
-This is basically a subunit of the Astribank. It will be registered to
+This is basically a logical unit of the Astribank. It will be registered to
 Zaptel as a single span. This will basically be 8 analog channels.
 
 
@@ -130,8 +140,8 @@
 xpd_fxo in the modules list (the output of lsmod).
 
 After the module xpp is loaded, you'll also be able to see the directory
-/proc/xpp . For any unit discovered there you will see a directory
-/prc/xpp/XBUS-n (where n is a number: typically 0). Once subunit have
+/proc/xpp . For any Astribank discovered there you will see a directory
+/prc/xpp/XBUS-n (where n is a number: typically 0). Once a unit have
 been discovered you'll see subdirectories: /proc/xpp/XBUS-n/XPD-m (where
 m may be another number: 0, 1 ,etc).
 
@@ -162,9 +172,9 @@
 may not have been loaded yet at this stage (when the command 'modprobe
 xpp_usb' returns).
 
-At this point the xpp driver asks the box what units it has. According to
-the answers it gets, it will figure what xpd_* modules it will need, and
-modprobe for them. At some earlier version of the driver this has
+At this point the xpp driver asks the box what logical units it has.
+According to the answers it gets, it will figure what xpd_* modules it will
+need, and modprobe for them. At some earlier version of the driver this has
 required some special modprobe.conf setup, but this is no longer
 the case.
 
@@ -185,7 +195,7 @@
 
 Registering With Zaptel:
 """""""""""""""""""""""
-Now we finally got to the "lights party" part: the lights in a subunit
+Now we finally got to the "lights party" part: the lights in a unit
 (XPD) get lit before it registers with Zaptel and are turned off after
 that.
 
@@ -327,9 +337,9 @@
 want to set their registration order manually using zt_registration in 
 the /proc interface.
 
-initialize_registers (xpd_fxs)
-The script that is run to initilize registers of the device. The default is 
-/usr/share/zaptel/initialize_registers . 
+initdir: (xpp)
+This is the directory containing the initialization scripts.
+The default is /usr/share/zaptel .
 Setting this value could be useful if that location is inconvenient for you.
 
 print_dbg: (all modules)

Propchange: team/tzafrir/xpp_1.2/xpp/calibrate_slics
------------------------------------------------------------------------------
--- svn:executable (original)
+++ svn:executable Sat Nov  4 03:53:23 2006
@@ -1,1 +1,1 @@
-*
+Y

Propchange: team/tzafrir/xpp_1.2/xpp/calibrate_slics
------------------------------------------------------------------------------
    (empty)

Modified: team/tzafrir/xpp_1.2/xpp/card_fxo.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/card_fxo.c?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/card_fxo.c (original)
+++ team/tzafrir/xpp_1.2/xpp/card_fxo.c Sat Nov  4 03:53:23 2006
@@ -65,13 +65,13 @@
 
 /*---------------- FXO Protocol Commands ----------------------------------*/
 
-static /* 0x0F */ DECLARE_CMD(FXO, CHAN_ENABLE, lineno_t chan, bool on);
+static /* 0x0F */ DECLARE_CMD(FXO, XPD_STATE, bool on);
 static /* 0x0F */ DECLARE_CMD(FXO, CHAN_CID, lineno_t chan);
 static /* 0x0F */ DECLARE_CMD(FXO, RING, lineno_t chan, bool on);
 static /* 0x0F */ DECLARE_CMD(FXO, RELAY_OUT, byte which, bool on);
 
 static bool fxo_packet_is_valid(xpacket_t *pack);
-static void fxo_packet_dump(xpacket_t *pack);
+static void fxo_packet_dump(const char *msg, xpacket_t *pack);
 static int proc_fxo_info_read(char *page, char **start, off_t off, int count, int *eof, void *data);
 static int proc_xpd_register_read(char *page, char **start, off_t off, int count, int *eof, void *data);
 static int proc_xpd_register_write(struct file *file, const char __user *buffer, unsigned long count, void *data);
@@ -535,14 +535,14 @@
 	return ret;
 }
 
-static /* 0x0F */ HOSTCMD(FXO, CHAN_ENABLE, lineno_t chan, bool on)
+static /* 0x0F */ HOSTCMD(FXO, XPD_STATE, bool on)
 {
 	int	ret = 0;
 	int	i;
 
 	BUG_ON(!xbus);
 	BUG_ON(!xpd);
-	DBG("%s/%s/%d: %s\n", xbus->busname, xpd->xpdname, chan, (on) ? "on" : "off");
+	DBG("%s/%s: %s\n", xbus->busname, xpd->xpdname, (on) ? "on" : "off");
 	if(on) {
 		for_each_line(xpd, i) {
 			MARK_LED(xpd, i, LED_GREEN, LED_ON);
@@ -725,7 +725,7 @@
 
 		.RING		= XPROTO_CALLER(FXO, RING),
 		.RELAY_OUT	= XPROTO_CALLER(FXO, RELAY_OUT),
-		.CHAN_ENABLE	= XPROTO_CALLER(FXO, CHAN_ENABLE),
+		.XPD_STATE	= XPROTO_CALLER(FXO, XPD_STATE),
 		.CHAN_CID	= XPROTO_CALLER(FXO, CHAN_CID),
 
 		.SYNC_SOURCE	= XPROTO_CALLER(GLOBAL, SYNC_SOURCE),
@@ -744,9 +744,9 @@
 	return xe != NULL;
 }
 
-static void fxo_packet_dump(xpacket_t *pack)
-{
-	DBG("\n");
+static void fxo_packet_dump(const char *msg, xpacket_t *pack)
+{
+	DBG("%s\n", msg);
 }
 
 /*------------------------- DAA Handling --------------------------*/

Modified: team/tzafrir/xpp_1.2/xpp/card_fxo.h
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/card_fxo.h?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/card_fxo.h (original)
+++ team/tzafrir/xpp_1.2/xpp/card_fxo.h Sat Nov  4 03:53:23 2006
@@ -28,7 +28,7 @@
 	XPROTO_NAME(FXO, SIG_CHANGED)		= 0x06,
 /**/
 	XPROTO_NAME(FXO, DAA_WRITE)		= 0x0F,	/* Write to DAA */
-	XPROTO_NAME(FXO, CHAN_ENABLE)		= 0x0F,	/* Write to DAA */
+	XPROTO_NAME(FXO, XPD_STATE)		= 0x0F,	/* Write to DAA */
 	XPROTO_NAME(FXO, CHAN_CID)		= 0x0F,	/* Write to DAA */
 	XPROTO_NAME(FXO, RING)			= 0x0F,	/* Write to DAA */
 	XPROTO_NAME(FXO, LED)			= 0x0F,	/* Write to DAA */

Modified: team/tzafrir/xpp_1.2/xpp/card_fxs.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/card_fxs.c?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/card_fxs.c (original)
+++ team/tzafrir/xpp_1.2/xpp/card_fxs.c Sat Nov  4 03:53:23 2006
@@ -71,13 +71,13 @@
 
 /*---------------- FXS Protocol Commands ----------------------------------*/
 
-static /* 0x0F */ DECLARE_CMD(FXS, CHAN_ENABLE, lineno_t chan, bool on);
+static /* 0x0F */ DECLARE_CMD(FXS, XPD_STATE, bool on);
 static /* 0x0F */ DECLARE_CMD(FXS, CHAN_CID, lineno_t chan);
 static /* 0x0F */ DECLARE_CMD(FXS, RING, lineno_t chan, bool on);
 static /* 0x0F */ DECLARE_CMD(FXS, RELAY_OUT, byte which, bool on);
 
 static bool fxs_packet_is_valid(xpacket_t *pack);
-static void fxs_packet_dump(xpacket_t *pack);
+static void fxs_packet_dump(const char *msg, xpacket_t *pack);
 static int proc_fxs_info_read(char *page, char **start, off_t off, int count, int *eof, void *data);
 static int proc_xpd_register_read(char *page, char **start, off_t off, int count, int *eof, void *data);
 static int proc_xpd_register_write(struct file *file, const char __user *buffer, unsigned long count, void *data);
@@ -514,7 +514,7 @@
 	return ret;
 }
 
-static /* 0x0F */ HOSTCMD(FXS, CHAN_ENABLE, lineno_t chan, bool on)
+static /* 0x0F */ HOSTCMD(FXS, XPD_STATE, bool on)
 {
 	int		ret = 0;
 	int		i;
@@ -526,8 +526,8 @@
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	spin_lock_irqsave(&xpd->lock, flags);
-	DBG("%s/%s/%d: %s\n", xbus->busname, xpd->xpdname, chan, (on) ? "on" : "off");
-	ret = SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, 0x40, value);
+	DBG("%s/%s: %s\n", xbus->busname, xpd->xpdname, (on) ? "on" : "off");
+	ret = SLIC_DIRECT_REQUEST(xbus, xpd, ALL_CHANS, SLIC_WRITE, 0x40, value);
 	for_each_line(xpd, i)
 		xpd->lasttxhook[i] = value;
 	if(on) {
@@ -724,7 +724,7 @@
 
 		.RING		= XPROTO_CALLER(FXS, RING),
 		.RELAY_OUT	= XPROTO_CALLER(FXS, RELAY_OUT),
-		.CHAN_ENABLE	= XPROTO_CALLER(FXS, CHAN_ENABLE),
+		.XPD_STATE	= XPROTO_CALLER(FXS, XPD_STATE),
 		.CHAN_CID	= XPROTO_CALLER(FXS, CHAN_CID),
 
 		.SYNC_SOURCE	= XPROTO_CALLER(GLOBAL, SYNC_SOURCE),
@@ -743,9 +743,9 @@
 	return xe != NULL;
 }
 
-static void fxs_packet_dump(xpacket_t *pack)
-{
-	DBG("\n");
+static void fxs_packet_dump(const char *msg, xpacket_t *pack)
+{
+	DBG("%s\n", msg);
 }
 
 /*------------------------- SLIC Handling --------------------------*/

Modified: team/tzafrir/xpp_1.2/xpp/card_fxs.h
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/card_fxs.h?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/card_fxs.h (original)
+++ team/tzafrir/xpp_1.2/xpp/card_fxs.h Sat Nov  4 03:53:23 2006
@@ -27,7 +27,7 @@
 enum fxs_opcodes {
 	XPROTO_NAME(FXS, SIG_CHANGED)		= 0x06,
 /**/
-	XPROTO_NAME(FXS, CHAN_ENABLE)		= 0x0F,	/* Write to SLIC */
+	XPROTO_NAME(FXS, XPD_STATE)		= 0x0F,	/* Write to SLIC */
 	XPROTO_NAME(FXS, CHAN_POWER)		= 0x0F,	/* Write to SLIC */
 	XPROTO_NAME(FXS, CHAN_CID)		= 0x0F,	/* Write to SLIC */
 	XPROTO_NAME(FXS, RING)			= 0x0F,	/* Write to SLIC */

Modified: team/tzafrir/xpp_1.2/xpp/card_global.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/card_global.c?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/card_global.c (original)
+++ team/tzafrir/xpp_1.2/xpp/card_global.c Sat Nov  4 03:53:23 2006
@@ -30,6 +30,15 @@
 static const char rcsid[] = "$Id$";
 
 DEF_PARM(charp,initdir, "/usr/share/zaptel", "The directory of card initialization scripts");
+/*
+ * BRI: Temporary software workaround for firmware limitation:
+ *      - The BRI firmware count PCM channel number globally across subunits.
+ *      - The module parameter 'bri_pcmshift' enables us to cheat and shift
+ *        each B-channel, 4 bits for each subsequent subunit.
+ *      - Eventually, this should be fixed in the firmware, otherwise we won't
+ *        handle PRI (all the space we have is 32bits).
+ */
+DEF_PARM(bool,bri_pcmshift, 1, "TESTING: shift bri PCM bits by subunit number");
 
 extern	int print_dbg;
 static bool pcm_valid(xpd_t *xpd, xpacket_t *pack);
@@ -37,7 +46,7 @@
 /*---------------- GLOBAL Protocol Commands -------------------------------*/
 
 static bool global_packet_is_valid(xpacket_t *pack);
-static void global_packet_dump(xpacket_t *pack);
+static void global_packet_dump(const char *msg, xpacket_t *pack);
 
 /*---------------- GLOBAL: HOST COMMANDS ----------------------------------*/
 
@@ -68,9 +77,6 @@
 	BUG_ON(!xbus);
 	BUG_ON(!xpd);
 	lines &= ~xpd->no_pcm;
-//	if(lines == 0)
-//		return 0;
-
 	/*
 	 * FIXME: Workaround a bug in sync code of the Astribank.
 	 *        Send dummy PCM for sync.
@@ -87,6 +93,10 @@
 			pcm += ZT_CHUNKSIZE;
 		}
 		buf += ZT_CHUNKSIZE;
+	}
+	if(bri_pcmshift) {	/* workaround for pcm problem in BRI */
+		lines = lines << (xpd->addr.subunit * 4);
+		RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, lines) = lines;
 	}
 	pack->datalen = sizeof(xpp_line_t) + (pcm - start_pcm);
 	packet_send(xbus, pack);
@@ -178,6 +188,10 @@
 	}
 	// DBG("lines=0x%04X\n", lines);
 
+	if(bri_pcmshift) {	/* workaround for pcm problem in BRI */
+		lines = (lines >> (xpd->addr.subunit * 4)) & 0x7;
+		RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, lines) = lines;
+	}
 	if(!pcm_valid(xpd, pack)) {
 		return -EPROTO;
 	}
@@ -246,6 +260,7 @@
 			break;
 		default:
 			NOTICE("%s/%s: %s UNKNOWN CODE = 0x%X\n", xbus->busname, xpdname, cmd->name, errorcode);
+			dump_packet("PACKET", pack, 1);
 	}
 	/*
 	 * FIXME: Should implement an error recovery plan
@@ -277,9 +292,9 @@
 	return xe != NULL;
 }
 
-static void global_packet_dump(xpacket_t *pack)
-{
-	DBG("\n");
+static void global_packet_dump(const char *msg, xpacket_t *pack)
+{
+	DBG("%s\n", msg);
 }
 
 static bool pcm_valid(xpd_t *xpd, xpacket_t *pack)
@@ -299,6 +314,7 @@
 		XPD_COUNTER(xpd, RECV_ERRORS)++;
 		if((rate_limit++ % 1000) <= 10) {
 			ERR("BAD PCM REPLY: pack->datalen=%d, count=%d\n", pack->datalen, count);
+			dump_packet("BAD PCM REPLY", pack, 1);
 		}
 		return 0;
 	}
@@ -314,6 +330,8 @@
 	xbus_t	*xbus;
 	char	busstr[MAX_ENV_STR];
 	char	xpdstr[MAX_ENV_STR];
+	char	unitstr[MAX_ENV_STR];
+	char	subunitstr[MAX_ENV_STR];
 	char	typestr[MAX_ENV_STR];
 	char	revstr[MAX_ENV_STR];
 	char	init_card[MAX_PATH_STR];
@@ -324,6 +342,8 @@
 	char	*envp[] = {
 		busstr,
 		xpdstr,
+		unitstr,
+		subunitstr,
 		typestr,
 		revstr,
 		NULL
@@ -331,20 +351,14 @@
 
 	BUG_ON(!xpd);
 	xbus = xpd->xbus;
-	/*
-	 * Initialize only the first subunit as the others are controled
-	 * by the same chip
-	 */
-	if(xpd->addr.subunit != 0) {
-		DBG("%s/%s: Skipping subunit %d\n", xbus->busname, xpd->xpdname, xpd->addr.subunit);
-		return 0;
-	}
 	if(!initdir || !initdir[0]) {
 		NOTICE("%s/%s: Missing initdir parameter\n", xbus->busname, xpd->xpdname);
 		return -EINVAL;
 	}
 	snprintf(busstr, MAX_ENV_STR, "XPD_BUS=%s", xbus->busname);
 	snprintf(xpdstr, MAX_ENV_STR, "XPD_NAME=%s", xpd->xpdname);
+	snprintf(unitstr, MAX_ENV_STR, "XPD_UNIT=%d", xpd->addr.unit);
+	snprintf(subunitstr, MAX_ENV_STR, "XPD_SUBUNIT=%d", xpd->addr.subunit);
 	snprintf(typestr, MAX_ENV_STR, "XPD_TYPE=%d", xpd->type);
 	snprintf(revstr, MAX_ENV_STR, "XPD_REVISION=%d", xpd->revision);
 	if(snprintf(init_card, MAX_PATH_STR, "%s/init_card_%d_%d",
@@ -360,14 +374,27 @@
 	DBG("%s/%s: running '%s' for type=%d revision=%d\n",
 			xbus->busname, xpd->xpdname, init_card, xpd->type, xpd->revision);
 	ret = call_usermodehelper(init_card, argv, envp, 1);
-	if(ret != 0) {
-		ERR("%s/%s: Failed running '%s' (errno %d, sig=%d)\n",
-				xbus->busname, xpd->xpdname, init_card,
-				((unsigned)ret >> 8) & 0xFF, ret & 0xFF);
+	/*
+	 * Carefully report results
+	 */
+	if(ret == 0)
+		DBG("%s/%s: '%s' finished OK\n", xbus->busname, xpd->xpdname, init_card);
+	else if(ret < 0) {
+		ERR("%s/%s: Failed running '%s' (errno %d)\n",
+				xbus->busname, xpd->xpdname, init_card, ret);
+	} else {
+		byte	exitval = ((unsigned)ret >> 8) & 0xFF;
+		byte	sigval = ret & 0xFF;
+
+		if(!exitval) {
+			ERR("%s/%s: '%s' killed by signal %d\n",
+					xbus->busname, xpd->xpdname, init_card, sigval);
+		} else {
+			ERR("%s/%s: '%s' aborted with exitval %d\n",
+					xbus->busname, xpd->xpdname, init_card, exitval);
+		}
 		ret = -EINVAL;
 	}
-	DBG("%s/%s: '%s' returned %d\n",
-			xbus->busname, xpd->xpdname, init_card, ret);
 	up_read(&xbus->in_use);
 	return ret;
 }

Propchange: team/tzafrir/xpp_1.2/xpp/utils/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Nov  4 03:53:23 2006
@@ -1,3 +1,4 @@
+adj_clock
 fpga_load
 test_parse
 libhexfile.*

Modified: team/tzafrir/xpp_1.2/xpp/utils/Makefile
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/utils/Makefile?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/utils/Makefile (original)
+++ team/tzafrir/xpp_1.2/xpp/utils/Makefile Sat Nov  4 03:53:23 2006
@@ -13,25 +13,35 @@
 XPD_INIT_DATA	= $(XPD_FIRMWARE) init_fxo_modes
 XPD_INIT	= $(wildcard ../init_card_?_*) ../calibrate_slics
 
-WCTDM=../../wctdm.c
+# Variables that should be defined above, but need sane defaults:
+# FIXME: Are those values really sane?
+HOSTCC		?= $(CC)
+CONFIG_USB	?= y
+DRIVER_DIR	?= ../..
+
+WCTDM=$(DRIVER_DIR)/wctdm.c
 
 CFLAGS		= -g -Wall $(EXTRA_CFLAGS)
 
 TARGETS	= init_fxo_modes print_modes adj_clock
+PROG_INSTALL	= genzaptelconf adj_clock
+MAN_INSTALL	= genzaptelconf.8 adj_clock.8
 ifneq	(,$(filter y m,$(CONFIG_USB)))
 TARGETS	+= libhexfile.a fpga_load test_parse
+PROG_INSTALL	+= fpga_load
+MAN_INSTALL	+= fpga_load.8
 endif
 
 all: $(TARGETS)
 
 install: all
 	$(INSTALL) -d $(DESTDIR)$(BINDIR)
-	$(INSTALL) genzaptelconf fpga_load adj_clock $(DESTDIR)$(BINDIR)/
+	$(INSTALL) $(PROG_INSTALL) $(DESTDIR)$(BINDIR)/
 	$(INSTALL) -d $(DESTDIR)$(DATADIR)
 	$(INSTALL_DATA) $(XPD_INIT_DATA) $(DESTDIR)$(DATADIR)/
 	$(INSTALL) $(XPD_INIT) $(DESTDIR)$(DATADIR)/
 	$(INSTALL) -d $(DESTDIR)$(MANDIR)
-	$(INSTALL_DATA) fpga_load.8 genzaptelconf.8 adj_clock.8 $(DESTDIR)$(MANDIR)/
+	$(INSTALL_DATA) $(MAN_INSTALL) $(DESTDIR)$(MANDIR)/
 	$(INSTALL) -d $(DESTDIR)$(HOTPLUG_USB_DIR)
 	$(INSTALL_DATA) xpp_fxloader.usermap $(DESTDIR)$(HOTPLUG_USB_DIR)/
 	$(INSTALL) xpp_fxloader $(DESTDIR)$(HOTPLUG_USB_DIR)/

Modified: team/tzafrir/xpp_1.2/xpp/utils/adj_clock.8
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/utils/adj_clock.8?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/utils/adj_clock.8 (original)
+++ team/tzafrir/xpp_1.2/xpp/utils/adj_clock.8 Sat Nov  4 03:53:23 2006
@@ -1,4 +1,4 @@
-." $Id$
+." $Id:$
 .TH adj_clock 8 "2006-10-18" 
 .SH "NAME" 
 adj_clock \(em Synchronize system clock to zaptel clock

Propchange: team/tzafrir/xpp_1.2/xpp/utils/adj_clock.8
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Nov  4 03:53:23 2006
@@ -1,1 +1,1 @@
-Author Date Id Revision
+Author Date Id Revision==== ORIGINAL VERSION Property svn:keywords of utils/adj_clock.8 116263086052120

Propchange: team/tzafrir/xpp_1.2/xpp/utils/adj_clock.c
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Nov  4 03:53:23 2006
@@ -1,1 +1,1 @@
-Author Date Id Revision
+Author Date Id Revision==== ORIGINAL VERSION Property svn:keywords of utils/adj_clock.c 116263091371678

Modified: team/tzafrir/xpp_1.2/xpp/utils/genzaptelconf
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/utils/genzaptelconf?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/utils/genzaptelconf (original)
+++ team/tzafrir/xpp_1.2/xpp/utils/genzaptelconf Sat Nov  4 03:53:23 2006
@@ -54,6 +54,8 @@
 # for others. Note that if an Astribank is not detected, the script 
 # will set this to "no", so you can safely leave it as "yes".
 set_immediate=yes
+# Set fxs_immediate to 'yes' to make all FXS lines answer immediately.
+fxs_immediate=no
 
 ZAPCONF_FILE=${ZAPCONF_FILE:-/etc/zaptel.conf}
 ZAPCONF_FILE_SYSTEM=$ZAPCONF_FILE
@@ -346,7 +348,8 @@
 
 		if [ "$set_immediate" = 'yes' ]
 		then
-			if [ "$astbank_type" = 'input' ]
+			if [ "$astbank_type" = 'input' ] || \
+				( [ "$fxs_immediate" = 'yes' ] && [ "$sig" = "fxo" ] )
 			then echo 'immediate=yes'                      >> $zapata_file
 			else echo 'immediate=no'                       >> $zapata_file
 			fi
@@ -454,16 +457,7 @@
 
 # sleep a while until the xpp modules fully register
 wait_for_xpp() {
-	case "`uname -r`" in
-	2.6.8*)
-		autoreg="/sys/module/xpp/zap_autoreg"
-		;;
-	*)
-		autoreg="/sys/module/xpp/parameters/zap_autoreg"
-		;;
-	esac
-	if [ -d /proc/xpp ] && \
-	   [ "`cat $autoreg`" = 'Y' ]
+	if [ -d /proc/xpp ]
 	then
 		# wait for the XPDs to register:
 		# TODO: improve error reporting and produce a messagee here

Propchange: team/tzafrir/xpp_1.2/xpp/utils/print_modes.c
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Nov  4 03:53:23 2006
@@ -1,1 +1,1 @@
-Author Date Id Revision
+Author Id Date Revision

Modified: team/tzafrir/xpp_1.2/xpp/xbus-core.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/xbus-core.c?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/xbus-core.c (original)
+++ team/tzafrir/xpp_1.2/xpp/xbus-core.c Sat Nov  4 03:53:23 2006
@@ -55,7 +55,6 @@
 
 /* Command line parameters */
 extern int print_dbg;
-extern int max_queue_len;
 
 /* Forward declarations */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
@@ -131,105 +130,6 @@
 	atomic_dec(&xbus->packet_counter);
 	//DBG("Decremented packet_counter of bus %s (freed packet) to %d\n", 
 	//		xbus->busname, atomic_read(&xbus->packet_counter));
-}
-
-/*------------------------- Packet Queues --------------------------*/
-void init_xbus_packet_queue(packet_queue_t *q, const char name[])
-{
-	INIT_LIST_HEAD(&q->head);
-	spin_lock_init(&q->lock);
-	q->count = 0;
-	q->worst_count = 0;
-	q->overflows = 0;
-	snprintf(q->qname, XPD_NAMELEN, "%s", name);
-}
-
-#if 0
-/*
- * Assume the queue is locked
- */
-void __dump_packet_queue(const char *msg, packet_queue_t *q)
-{
-	xpacket_t *tmp;
-
-	list_for_each_entry(tmp, &q->head, list) {
-		dump_packet(msg, tmp);
-	}
-}
-#endif
-
-void drain_xbus_packet_queue(xbus_t *xbus, packet_queue_t *q)
-{
-	unsigned long	flags;
-	xpacket_t	*pack;
-	xpacket_t	*next;
-
-	spin_lock_irqsave(&q->lock, flags);
-	DBG("queue=%s count=%d\n", q->qname, q->count);
-	DBG("     total packets count=%d\n", atomic_read(&xpacket_count));
-	list_for_each_entry_safe(pack, next, &q->head, list) {
-		list_del(&pack->list);
-		q->count--;
-		xbus->ops->packet_free(xbus, pack);
-	}
-	if(q->count != 0)
-		ERR("drain_xbus_packet_queue: queue %s still has %d packets\n",
-				q->qname, q->count);
-	spin_unlock_irqrestore(&q->lock, flags);
-}
-
-void xbus_enqueue_packet(xbus_t *xbus, packet_queue_t *q, xpacket_t *pack)
-{
-	unsigned long	flags;
-
-	spin_lock_irqsave(&q->lock, flags);
-
-	if(q->count >= max_queue_len) {
-		static unsigned long	last_notice = 0;	// rate limit
-
-		if((jiffies - last_notice) < HZ) {
-			NOTICE("xbus_enqueue_packet: dropping packet (queue len = %d, max=%d)\n",
-				q->count, max_queue_len);
-			last_notice = jiffies;
-		}
-		q->overflows++;
-		xbus->ops->packet_free(xbus, pack);
-		goto out;
-	}
-	list_add_tail(&pack->list, &q->head);
-	q->count++;
-
-	if(q->count > q->worst_count)
-		q->worst_count = q->count;
-
-	if(q->count < max_queue_len/100 && q->worst_count > q->count)	// Decay worst_count
-		q->worst_count--;
-
-	// dump_packet("ENQUEUED", pack, print_dbg);
-out:
-	spin_unlock_irqrestore(&q->lock, flags);
-}
-
-xpacket_t *xbus_dequeue_packet(packet_queue_t *q)
-{
-	unsigned long	flags;
-	struct list_head	*p;
-	xpacket_t	*pack = NULL;
-
-	spin_lock_irqsave(&q->lock, flags);
-
-	if(list_empty(&q->head)) {
-		// DBG("LIST EMPTY (count=%d)\n", q->count);
-		goto out;
-	}
-	p = q->head.next;
-	list_del(p);
-	q->count--;
-	pack = list_entry(p, xpacket_t, list);
-	// dump_packet("DEQUEUED", pack, print_dbg);
-out:
-	spin_unlock_irqrestore(&q->lock, flags);
-	return pack;
 }
 
 

Modified: team/tzafrir/xpp_1.2/xpp/xbus-core.h
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/xbus-core.h?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/xbus-core.h (original)
+++ team/tzafrir/xpp_1.2/xpp/xbus-core.h Sat Nov  4 03:53:23 2006
@@ -33,12 +33,6 @@
 xpacket_t *xbus_packet_new(xbus_t *xbus, gfp_t flags);
 void xbus_packet_free(xbus_t *xbus, xpacket_t *p);
 
-/* packet queues */
-void init_xbus_packet_queue(packet_queue_t *q, const char name[]);
-void drain_xbus_packet_queue(xbus_t *xbus, packet_queue_t *q);
-void xbus_enqueue_packet(xbus_t *xbus, packet_queue_t *q, xpacket_t *pack);
-xpacket_t *xbus_dequeue_packet(packet_queue_t *q);
-
 /* XBUS handling */
 xbus_t	*xbus_of(int xbus_num);
 xpd_t	*xpd_of(xbus_t *xbus, int xpd_num);

Modified: team/tzafrir/xpp_1.2/xpp/xpp_usb.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/xpp_usb.c?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/xpp_usb.c (original)
+++ team/tzafrir/xpp_1.2/xpp/xpp_usb.c Sat Nov  4 03:53:23 2006
@@ -278,7 +278,7 @@
 #endif
 			return;
 		}
-#if 1
+#if 0
 	} else if(pack->content.opcode == XPROTO_NAME(FXS, REGISTER_REPLY)) {
 			return;
 #endif

Modified: team/tzafrir/xpp_1.2/xpp/xpp_zap.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/xpp_zap.c?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/xpp_zap.c (original)
+++ team/tzafrir/xpp_1.2/xpp/xpp_zap.c Sat Nov  4 03:53:23 2006
@@ -64,9 +64,9 @@
 static unsigned int		xpp_last_jiffies = 0;
 
 DEF_PARM(int, print_dbg, 0, "Print DBG statements");
-DEF_PARM(int, max_queue_len, MAX_QUEUE_LEN, "Maximum Queue Length.");
 DEF_PARM(bool, zap_autoreg, 1, "Register spans automatically (1) or not (0)");
 DEF_PARM(bool, prefmaster, 1, "Do we want to be zaptel preferred sync master");
+// DEF_ARRAY(int, pcmtx, 4, 0, "Forced PCM values to transmit");
 
 #include "zap_debug.h"
 #ifdef	XPP_EC_CHUNK
@@ -342,10 +342,10 @@
 	if(CALL_XMETHOD(card_init, xbus, xpd) < 0)
 		goto err;
 	// Turn off all channels
-	CALL_XMETHOD(CHAN_ENABLE, xbus, xpd, ALL_CHANS, 0);
+	CALL_XMETHOD(XPD_STATE, xbus, xpd, 0);
 	xpd->card_present = 1;
 	// Turn on all channels
-	CALL_XMETHOD(CHAN_ENABLE, xbus, xpd, ALL_CHANS, 1);
+	CALL_XMETHOD(XPD_STATE, xbus, xpd, 1);
 
 	if(zap_autoreg)
 		zaptel_register_xpd(xpd);
@@ -442,7 +442,7 @@
 				continue;
 			if(IS_SET(xpd->digital_signalling, i))
 				continue;
-#if 1
+#if 0
 			rp = chans[i].readchunk;
 			wp = chans[i].writechunk;
 #else
@@ -937,7 +937,8 @@
 		if(IS_SET(xpd->offhook, i) || IS_SET(xpd->cid_on, i) || digital_telephony) {
 	
 			memcpy((u_char *)w, chans[i].writechunk, ZT_CHUNKSIZE);
-			// fill_beep((u_char *)w, 5);
+			// fill_beep((u_char *)w, xpd->addr.subunit, 2);
+			// memset((u_char *)w, pcmtx[xpd->addr.subunit % 4], ZT_CHUNKSIZE);
 		}
 	}
 //	if(xpd->offhook != 0 || sync_master != xpd) {
@@ -949,21 +950,30 @@
 	spin_unlock_irqrestore(&xpd->lock, flags);
 }
 
-void fill_beep(u_char *buf, int duration)
-{
-	int which = (jiffies/(duration*HZ)) & 0x3;
+void fill_beep(u_char *buf, int num, int duration)
+{
+	bool	alternate = (duration) ? (jiffies/(duration*HZ)) & 0x1 : 0;
+	int	which;
+	u_char	*snd;
 
 	/*
 	 * debug tones
 	 */
 	static u_char beep[] = {
-//		0x7F, 0xBE, 0xD8, 0xBE, 0x80, 0x41, 0x24, 0x41,	/* Dima */
-//		0x67, 0x67, 0x67, 0x67, 0x67, 0x67, 0x67, 0x67,	/* silence */
-//		0x67, 0x90, 0x89, 0x90, 0xFF, 0x10, 0x09, 0x10,	/* Izzy */
-//		0x67, 0xCD, 0xC5, 0xCD, 0xFF, 0x49, 0x41, 0x49,	/* Dima 2 */
+		0x7F, 0xBE, 0xD8, 0xBE, 0x80, 0x41, 0x24, 0x41,	/* Dima */
+		0x67, 0x90, 0x89, 0x90, 0xFF, 0x10, 0x09, 0x10,	/* Izzy */
+	};
+	static u_char beep_alt[] = {
 		0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,	/* silence */
 	};
-	memcpy(buf, &beep[(which*8) % ARRAY_SIZE(beep)], ZT_CHUNKSIZE);
+	if(alternate) {
+		which = num % ARRAY_SIZE(beep_alt);
+		snd = &beep_alt[which];
+	} else {
+		which = num % ARRAY_SIZE(beep);
+		snd = &beep[which];
+	}
+	memcpy(buf, snd, ZT_CHUNKSIZE);
 }
 
 #ifdef	XPP_EC_CHUNK
@@ -1020,7 +1030,7 @@
 			continue;
 		if(IS_SET(xpd->offhook, i) || IS_SET(xpd->cid_on, i) || digital_telephony) {
 			// memset((u_char *)readchunk, 0x5A, ZT_CHUNKSIZE);	// DEBUG
-			// fill_beep((u_char *)readchunk, 1);	// DEBUG: BEEP
+			// fill_beep((u_char *)readchunk, 1, 1);	// DEBUG: BEEP
 			memcpy(chans[i].readchunk, (u_char *)readchunk, ZT_CHUNKSIZE);
 		} else {
 			memset(chans[i].readchunk, 0x7F, ZT_CHUNKSIZE);	// SILENCE
@@ -1444,6 +1454,11 @@
 #else
 	INFO("FEATURE: %s (without XPP_EC_CHUNK)\n", THIS_MODULE->name);
 #endif
+#ifdef CONFIG_ZAPATA_BRI_DCHANS
+	INFO("FEATURE: %s (with BRISTUFF support)\n", THIS_MODULE->name);
+#else
+	INFO("FEATURE: %s (without BRISTUFF support)\n", THIS_MODULE->name);
+#endif
 
 #ifdef CONFIG_PROC_FS
 	xpp_proc_toplevel = proc_mkdir(PROC_DIR, NULL);

Modified: team/tzafrir/xpp_1.2/xpp/xpp_zap.h
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/xpp_zap.h?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/xpp_zap.h (original)
+++ team/tzafrir/xpp_1.2/xpp/xpp_zap.h Sat Nov  4 03:53:23 2006
@@ -34,7 +34,7 @@
 void update_xpd_status(xpd_t *xpd, int alarm_flag);
 void update_zap_ring(xpd_t *xpd, int pos, bool on);
 void update_line_status(xpd_t *xpd, int pos, bool good);
-void fill_beep(u_char *buf, int duration);
+void fill_beep(u_char *buf, int num, int duration);
 void xpp_tick(unsigned long param);
 int xpp_open(struct zt_chan *chan);
 int xpp_close(struct zt_chan *chan);

Modified: team/tzafrir/xpp_1.2/xpp/xproto.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/xproto.c?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/xproto.c (original)
+++ team/tzafrir/xpp_1.2/xpp/xproto.c Sat Nov  4 03:53:23 2006
@@ -335,7 +335,7 @@
 	// CHECK_XOP(card_ioctl);	// optional method -- call after testing
 	CHECK_XOP(SYNC_SOURCE);
 	CHECK_XOP(PCM_WRITE);
-	CHECK_XOP(CHAN_ENABLE);
+	CHECK_XOP(XPD_STATE);
 	CHECK_XOP(CHAN_CID);
 	CHECK_XOP(RING);
 	CHECK_XOP(RELAY_OUT);

Modified: team/tzafrir/xpp_1.2/xpp/xproto.h
URL: http://svn.digium.com/view/zaptel/team/tzafrir/xpp_1.2/xpp/xproto.h?rev=1551&r1=1550&r2=1551&view=diff
==============================================================================
--- team/tzafrir/xpp_1.2/xpp/xproto.h (original)
+++ team/tzafrir/xpp_1.2/xpp/xproto.h Sat Nov  4 03:53:23 2006
@@ -213,7 +213,7 @@
 	int (*SYNC_SOURCE)(xbus_t *xbus, xpd_t *xpd, bool setit, bool is_master);
 	int (*PCM_WRITE)(xbus_t *xbus, xpd_t *xpd, xpp_line_t offhook,  volatile byte *buf);
 
-	int (*CHAN_ENABLE)(xbus_t *xbus, xpd_t *xpd, lineno_t chan, bool on);
+	int (*XPD_STATE)(xbus_t *xbus, xpd_t *xpd, bool on);
 	int (*CHAN_CID)(xbus_t *xbus, xpd_t *xpd, lineno_t chan);
 	int (*RING)(xbus_t *xbus, xpd_t *xpd, lineno_t chan, bool on);
 	int (*RELAY_OUT)(xbus_t *xbus, xpd_t *xpd, byte which, bool on);
@@ -233,7 +233,7 @@
 	xpd_type_t	type;
 	const char	*name;
 	bool (*packet_is_valid)(xpacket_t *pack);
-	void (*packet_dump)(xpacket_t *pack);
+	void (*packet_dump)(const char *msg, xpacket_t *pack);
 };
 
 #include "card_global.h"



More information about the svn-commits mailing list