[zaptel-commits] tzafrir: branch tzafrir/patches r2816 - in /team/tzafrir/patches: ./ hpec/ xp...
SVN commits to the Zaptel project
zaptel-commits at lists.digium.com
Fri Aug 3 20:02:20 CDT 2007
Author: tzafrir
Date: Fri Aug 3 20:02:19 2007
New Revision: 2816
URL: http://svn.digium.com/view/zaptel?view=rev&rev=2816
Log:
Merged revisions 2802,2806-2807,2809,2812 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.4
................
r2802 | qwell | 2007-07-30 20:23:49 +0300 (Mon, 30 Jul 2007) | 10 lines
Merged revisions 2251 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.2
........
r2251 | kpfleming | 2007-02-28 14:44:28 -0600 (Wed, 28 Feb 2007) | 2 lines
allow the HPEC to work even if echotraining has been requested (the HPEC doesn't do echotraining, but it shouldn't fail just because the user asked for it)
........
................
r2806 | jdixon | 2007-07-31 23:41:30 +0300 (Tue, 31 Jul 2007) | 2 lines
Much newer and improved version of pciradio driver
................
r2807 | jdixon | 2007-08-01 03:15:57 +0300 (Wed, 01 Aug 2007) | 2 lines
Merged back in some changes I wasnt aware of
................
r2809 | qwell | 2007-08-01 23:21:32 +0300 (Wed, 01 Aug 2007) | 10 lines
Merged revisions 2808 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.2
........
r2808 | qwell | 2007-08-01 15:21:04 -0500 (Wed, 01 Aug 2007) | 2 lines
Per Matt Fredrickson, we don't want to use GFP_KERNEL while holding a spinlock.
........
................
r2812 | tzafrir | 2007-08-02 01:41:21 +0300 (Thu, 02 Aug 2007) | 15 lines
xpp.r4415:
* Show Astribank 6+2 as 6/2 channels and not 8/8 channels.
- Added as a "subtype" to the device type (r4391).
* Fixed a panic in BRI span shutdown method (r4393).
* Changes to debug macros.
* Add proper sysfs support (r4406)
- A bus on whuch all of the Astribanks reside.
- Replaces useless sysfs code that existed in the module.
- Currently used to set the sync source automatically at device
adition / removal.
* BRI: We do need the T1 timer in NT. If it gets into G2 state (rr4407).
Merged revisions 2811 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.2
................
Added:
team/tzafrir/patches/xpp/utils/astribank_hook
- copied unchanged from r2812, branches/1.4/xpp/utils/astribank_hook
team/tzafrir/patches/xpp/xbus-sysfs.c
- copied unchanged from r2812, branches/1.4/xpp/xbus-sysfs.c
Modified:
team/tzafrir/patches/ (props changed)
team/tzafrir/patches/hpec/hpec_zaptel.h
team/tzafrir/patches/pciradio.c
team/tzafrir/patches/xpp/.version
team/tzafrir/patches/xpp/ChangeLog
team/tzafrir/patches/xpp/Makefile
team/tzafrir/patches/xpp/card_bri.c
team/tzafrir/patches/xpp/card_fxo.c
team/tzafrir/patches/xpp/card_fxs.c
team/tzafrir/patches/xpp/card_global.h
team/tzafrir/patches/xpp/firmwares/FPGA_1141.hex
team/tzafrir/patches/xpp/firmwares/FPGA_1151.hex
team/tzafrir/patches/xpp/firmwares/FPGA_FXS.hex
team/tzafrir/patches/xpp/utils/Makefile
team/tzafrir/patches/xpp/utils/xpp.rules
team/tzafrir/patches/xpp/utils/xpp_fxloader
team/tzafrir/patches/xpp/xbus-core.c
team/tzafrir/patches/xpp/xbus-core.h
team/tzafrir/patches/xpp/xpd.h
team/tzafrir/patches/xpp/xpp_usb.c
team/tzafrir/patches/xpp/xpp_zap.c
team/tzafrir/patches/xpp/xpp_zap.h
team/tzafrir/patches/xpp/xproto.c
team/tzafrir/patches/xpp/xproto.h
team/tzafrir/patches/xpp/zap_debug.h
team/tzafrir/patches/zaptel-base.c
Propchange: team/tzafrir/patches/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/tzafrir/patches/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Aug 3 20:02:19 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-2797
+/branches/1.4:1-2814
Modified: team/tzafrir/patches/hpec/hpec_zaptel.h
URL: http://svn.digium.com/view/zaptel/team/tzafrir/patches/hpec/hpec_zaptel.h?view=diff&rev=2816&r1=2815&r2=2816
==============================================================================
--- team/tzafrir/patches/hpec/hpec_zaptel.h (original)
+++ team/tzafrir/patches/hpec/hpec_zaptel.h Fri Aug 3 20:02:19 2007
@@ -103,7 +103,7 @@
static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
{
- return 0;
+ return 1;
}
DECLARE_MUTEX(license_lock);
Modified: team/tzafrir/patches/pciradio.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/patches/pciradio.c?view=diff&rev=2816&r1=2815&r2=2816
==============================================================================
--- team/tzafrir/patches/pciradio.c (original)
+++ team/tzafrir/patches/pciradio.c Fri Aug 3 20:02:19 2007
@@ -6,7 +6,7 @@
* Based on previous works, designs, and archetectures conceived and
* written by Jim Dixon <jim at lambdatel.com>.
*
- * Copyright (C) 2001-2004 Jim Dixon / Zapata Telephony.
+ * Copyright (C) 2001-2007 Jim Dixon / Zapata Telephony.
*
* All rights reserved.
*
@@ -105,6 +105,11 @@
#define NUM_CHANS 4
#define RAD_GOTRX_DEBOUNCE_TIME 75
+#define RAD_CTCSS_ACQUIRE_TIME 10
+#define RAD_CTCSS_TALKOFF_TIME 1000
+
+#define ZT_RADPAR_CTCSSACQUIRETIME 18 /* DEBUG only, this belongs in zaptel.h */
+#define ZT_RADPAR_CTCSSTALKOFFTIME 19 /* DEBUG only, this belongs in zaptel.h */
/*
* MX828 Commands
@@ -157,7 +162,7 @@
int freeregion;
int nchans;
spinlock_t lock;
- spinlock_t remotelock;
+ int remote_locked;
unsigned char rxbuf[SERIAL_BUFLEN];
unsigned short rxindex;
unsigned long srxtimer;
@@ -174,12 +179,17 @@
unsigned char saudio_status[NUM_CHANS];
char gotcor[NUM_CHANS];
char gotct[NUM_CHANS];
+ char newctcssstate[NUM_CHANS];
+ char ctcssstate[NUM_CHANS];
char gotrx[NUM_CHANS];
char gotrx1[NUM_CHANS];
char gottx[NUM_CHANS];
char lasttx[NUM_CHANS];
int gotrxtimer[NUM_CHANS];
+ int ctcsstimer[NUM_CHANS];
int debouncetime[NUM_CHANS];
+ int ctcssacquiretime[NUM_CHANS];
+ int ctcsstalkofftime[NUM_CHANS];
int bursttime[NUM_CHANS];
int bursttimer[NUM_CHANS];
unsigned char remmode[NUM_CHANS];
@@ -474,19 +484,29 @@
void rbi_out(struct pciradio *rad, int n, unsigned char *rbicmd)
{
+unsigned long flags;
int x;
DECLARE_WAIT_QUEUE_HEAD(mywait);
- spin_lock(&rad->remotelock);
- while(__pciradio_getcreg(rad,0xc) & 2) interruptible_sleep_on_timeout(&mywait,2);
+ for(;;)
+ {
+ spin_lock_irqsave(&rad->lock,flags);
+ x = rad->remote_locked || (__pciradio_getcreg(rad,0xc) & 2);
+ if (!x) rad->remote_locked = 1;
+ spin_unlock_irqrestore(&rad->lock,flags);
+ if (x) interruptible_sleep_on_timeout(&mywait,2);
+ else break;
+ }
+ spin_lock_irqsave(&rad->lock,flags);
/* enable and address RBI serializer */
__pciradio_setcreg(rad,0xf,rad->pfsave | (n << 4) | 0x40);
/* output commands */
for(x = 0; x < 5; x++) __pciradio_setcreg(rad,0xc,rbicmd[x]);
/* output it */
__pciradio_setcreg(rad,0xb,1);
- spin_unlock(&rad->remotelock);
+ rad->remote_locked = 0;
+ spin_unlock_irqrestore(&rad->lock,flags);
return;
}
@@ -539,7 +559,7 @@
static void _do_encdec(struct pciradio *rad)
{
int i,n;
-unsigned char byte1 = 0, byte2 = 0;
+unsigned char byte1 = 0,byte2 = 0;
/* return doing nothing if busy */
if ((rad->encdec.lastcmd + 2) > jiffies) return;
@@ -712,6 +732,14 @@
static void pciradio_stop_dma(struct pciradio *rad);
static void pciradio_reset_serial(struct pciradio *rad);
static void pciradio_restart_dma(struct pciradio *rad);
+
+#ifdef LEAVE_THIS_COMMENTED_OUT
+#ifdef LINUX26
+static irqreturn_t pciradio_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+#else
+static void pciradio_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+#endif
+#endif
ZAP_IRQ_HANDLER(pciradio_interrupt)
{
@@ -810,13 +838,27 @@
gotctcss = gotslowctcss = ((byteuio & mask) != 0);
}
rad->gotct[x] = gotslowctcss;
- if ((rad->radmode[x] & RADMODE_IGNORECT) || (!ctcss))
+ if ((rad->radmode[x] & RADMODE_IGNORECT) ||
+ ((!(rad->radmode[x] & RADMODE_EXTTONE)) && (!ctcss)))
{
gotctcss = 1;
gotslowctcss = 1;
rad->present_code[x] = 0;
}
- gotrx = gotcor && gotctcss;
+ if(rad->newctcssstate[x] != gotctcss){
+ rad->newctcssstate[x] = gotctcss;
+ if(rad->newctcssstate[x])
+ rad->ctcsstimer[x]=rad->ctcssacquiretime[x];
+ else
+ rad->ctcsstimer[x]=rad->ctcsstalkofftime[x];
+ }
+ else{
+ if(!rad->ctcsstimer[x])
+ rad->ctcssstate[x] = rad->newctcssstate[x];
+ else
+ rad->ctcsstimer[x]--;
+ }
+ gotrx = gotcor && rad->ctcssstate[x];
if (gotrx != rad->gotrx[x])
{
rad->gotrxtimer[x] = rad->debouncetime[x];
@@ -902,7 +944,7 @@
}
}
}
-/* process serial if any */
+ /* process serial if any */
/* send byte if there is one in buffer to send */
if (rad->txlen && (rad->txlen != rad->txindex))
{
@@ -926,6 +968,14 @@
}
pciradio_receiveprep(rad, ints);
pciradio_transmitprep(rad, ints);
+ i = 0;
+ for(x = 0; x < 4; x++)
+ {
+ if (rad->gottx[x]) i |= (1 << (x * 2));
+ if (rad->gotrx[x]) i |= (2 << (x * 2));
+ }
+ /* output LED's */
+ __pciradio_setcreg(rad, 9, i);
}
#ifdef LINUX26
return IRQ_RETVAL(1);
@@ -1012,6 +1062,15 @@
case ZT_RADPAR_DEBOUNCETIME:
stack.p.data = rad->debouncetime[chan->chanpos - 1];
break;
+
+ case ZT_RADPAR_CTCSSACQUIRETIME:
+ stack.p.data = rad->ctcssacquiretime[chan->chanpos - 1];
+ break;
+
+ case ZT_RADPAR_CTCSSTALKOFFTIME:
+ stack.p.data = rad->ctcsstalkofftime[chan->chanpos - 1];
+ break;
+
case ZT_RADPAR_BURSTTIME:
stack.p.data = rad->bursttime[chan->chanpos - 1];
break;
@@ -1168,6 +1227,15 @@
case ZT_RADPAR_DEBOUNCETIME:
rad->debouncetime[chan->chanpos - 1] = stack.p.data;
break;
+
+ case ZT_RADPAR_CTCSSACQUIRETIME:
+ rad->ctcssacquiretime[chan->chanpos - 1] = stack.p.data;
+ break;
+
+ case ZT_RADPAR_CTCSSTALKOFFTIME:
+ rad->ctcsstalkofftime[chan->chanpos - 1] = stack.p.data;
+ break;
+
case ZT_RADPAR_BURSTTIME:
rad->bursttime[chan->chanpos - 1] = stack.p.data;
break;
@@ -1178,7 +1246,6 @@
if (stack.p.data & 1) byte1 |= (1 << (chan->chanpos - 1));
if (stack.p.data & 2) byte1 |= (1 << (chan->chanpos + 3));
__pciradio_setcreg(rad,8,byte1);
- spin_unlock_irqrestore(&rad->lock,flags);
break;
case ZT_RADPAR_UIOMODE:
byte1 = __pciradio_getcreg(rad,0xe);
@@ -1187,7 +1254,6 @@
if (stack.p.data & 1) byte1 |= (1 << (chan->chanpos - 1));
if (stack.p.data & 2) byte1 |= (1 << (chan->chanpos + 3));
__pciradio_setcreg(rad,0xe,byte1);
- spin_unlock_irqrestore(&rad->lock,flags);
break;
case ZT_RADPAR_REMMODE:
rad->remmode[chan->chanpos - 1] = stack.p.data;
@@ -1222,7 +1288,20 @@
spin_lock_irqsave(&rad->lock,flags);
break;
}
- /* set UIOA and UIOB for output */
+ spin_unlock_irqrestore(&rad->lock,flags);
+ for(;;)
+ {
+ int x;
+
+ spin_lock_irqsave(&rad->lock,flags);
+ x = rad->remote_locked || (__pciradio_getcreg(rad,0xc) & 2);
+ if (!x) rad->remote_locked = 1;
+ spin_unlock_irqrestore(&rad->lock,flags);
+ if (x) interruptible_sleep_on_timeout(&mywait,2);
+ else break;
+ }
+ spin_lock_irqsave(&rad->lock,flags);
+ /* set UIOA for input and UIOB for output */
byte1 = __pciradio_getcreg(rad,0xe);
mask = 1 << (chan->chanpos + 3); /* B an output */
byte2 = byte1 & (~mask);
@@ -1231,16 +1310,19 @@
byte1 = __pciradio_getcreg(rad,8);
byte2 = byte1 | mask;
byte2 |= 1 << (chan->chanpos - 1);
+ byte2 |= 1 << (chan->chanpos + 3);
__pciradio_setcreg(rad,8,byte2);
spin_unlock_irqrestore(&rad->lock,flags);
- if (byte1 != byte2)
- interruptible_sleep_on_timeout(&mywait,100);
+ if (byte1 != byte2)
+ interruptible_sleep_on_timeout(&mywait,3);
while (jiffies < rad->lastremcmd + 10)
interruptible_sleep_on_timeout(&mywait,10);
rad->lastremcmd = jiffies;
- spin_lock(&rad->remotelock);
- while(__pciradio_getcreg(rad,0xc) & 2) interruptible_sleep_on_timeout(&mywait,2);
- spin_unlock(&rad->remotelock);
+ for(;;)
+ {
+ if (!(__pciradio_getcreg(rad,0xc) & 2)) break;
+ interruptible_sleep_on_timeout(&mywait,2);
+ }
spin_lock_irqsave(&rad->lock,flags);
/* enable and address async serializer */
__pciradio_setcreg(rad,0xf,rad->pfsave | ((chan->chanpos - 1) << 4) | 0x80);
@@ -1258,7 +1340,7 @@
if ((rad->rxindex < stack.p.data) &&
(rad->srxtimer < SRX_TIMEOUT) &&
((rad->remmode[chan->chanpos - 1] == ZT_RADPAR_REM_SERIAL) ||
- (!strchr((char *) rad->rxbuf,'\r'))))
+ (!strchr((char *)rad->rxbuf,'\r'))))
{
spin_unlock_irqrestore(&rad->lock,flags);
interruptible_sleep_on_timeout(&mywait,2);
@@ -1273,8 +1355,24 @@
stack.p.index = rad->rxindex;
break;
}
+ /* wait for done only if in SERIAL_ASCII mode */
+ if (rad->remmode[chan->chanpos - 1] == ZT_RADPAR_REM_SERIAL_ASCII)
+ {
+ /* wait for TX to be done if not already */
+ while(rad->txlen && (rad->txindex < rad->txlen))
+ {
+ spin_unlock_irqrestore(&rad->lock,flags);
+ interruptible_sleep_on_timeout(&mywait,2);
+ spin_lock_irqsave(&rad->lock,flags);
+ }
+ /* disable and un-address async serializer */
+ __pciradio_setcreg(rad,0xf,rad->pfsave);
+ }
+ rad->remote_locked = 0;
+ spin_unlock_irqrestore(&rad->lock,flags);
+ if (rad->remmode[chan->chanpos - 1] == ZT_RADPAR_REM_SERIAL_ASCII)
+ interruptible_sleep_on_timeout(&mywait,100);
if (copy_to_user((struct zt_radio_stat *)data,&stack.p,sizeof(struct zt_radio_param))) return -EFAULT;
- spin_unlock_irqrestore(&rad->lock,flags);
return 0;
default:
spin_unlock_irqrestore(&rad->lock,flags);
@@ -1388,7 +1486,7 @@
printk("pciradio: Can't set tx state to %d\n", txsig);
break;
}
- if (debug)
+ if (debug)
printk("pciradio: Setting Radio hook state to %d on chan %d\n", txsig, chan->chanpos);
return 0;
}
@@ -1407,6 +1505,8 @@
rad->chans[x].chanpos = x+1;
rad->chans[x].pvt = rad;
rad->debouncetime[x] = RAD_GOTRX_DEBOUNCE_TIME;
+ rad->ctcssacquiretime[x] = RAD_CTCSS_ACQUIRE_TIME;
+ rad->ctcsstalkofftime[x] = RAD_CTCSS_TALKOFF_TIME;
}
rad->span.chans = rad->chans;
rad->span.channels = rad->nchans;
@@ -1525,20 +1625,21 @@
wait_just_a_bit(HZ/4);
- rad->pasave = 0;
- __pciradio_setcreg(rad,0xa,rad->pasave);
-
- __pciradio_setcreg(rad,8,0);
- __pciradio_setcreg(rad,9,0x55);
- __pciradio_setcreg(rad,0xe,0);
- rad->pfsave = 0;
- __pciradio_setcreg(rad,0xf,rad->pfsave);
/* Back to normal, with automatic DMA wrap around */
outb(0x30 | 0x01, rad->ioaddr + RAD_CNTL);
/* Configure serial port for MSB->LSB operation */
outb(0xc1, rad->ioaddr + RAD_SERCTL); /* DEBUG set double dlck to 0 SR */
+
+ rad->pasave = 0;
+ __pciradio_setcreg(rad,0xa,rad->pasave);
+
+ __pciradio_setcreg(rad,0xf,rad->pfsave);
+ __pciradio_setcreg(rad,8,0xff);
+ __pciradio_setcreg(rad,0xe,0xff);
+ __pciradio_setcreg(rad,9,0);
+ rad->pfsave = 0;
/* Delay FSC by 0 so it's properly aligned */
outb(/* 1 */ 0, rad->ioaddr + RAD_FSCDELAY);
@@ -1648,7 +1749,6 @@
ifaces[x] = rad;
memset(rad, 0, sizeof(struct pciradio));
spin_lock_init(&rad->lock);
- spin_lock_init(&rad->remotelock);
rad->nchans = 4;
rad->ioaddr = pci_resource_start(pdev, 0);
rad->dev = pdev;
@@ -1676,6 +1776,9 @@
/* Set Reset Low */
x=inb(rad->ioaddr + RAD_CNTL);
outb((~0x1)&x, rad->ioaddr + RAD_CNTL);
+ outb(x, rad->ioaddr + RAD_CNTL);
+ __pciradio_setcreg(rad,8,0xff);
+ __pciradio_setcreg(rad,0xe,0xff);
/* Free Resources */
free_irq(pdev->irq, rad);
if (rad->freeregion)
@@ -1697,6 +1800,9 @@
/* Set Reset Low */
x=inb(rad->ioaddr + RAD_CNTL);
outb((~0x1)&x, rad->ioaddr + RAD_CNTL);
+ outb(x, rad->ioaddr + RAD_CNTL);
+ __pciradio_setcreg(rad,8,0xff);
+ __pciradio_setcreg(rad,0xe,0xff);
/* Free Resources */
free_irq(pdev->irq, rad);
if (rad->freeregion)
@@ -1760,7 +1866,13 @@
free_irq(pdev->irq, rad);
/* Reset PCI chip and registers */
- outb(0x3e, rad->ioaddr + RAD_CNTL);
+ outb(0x3e, rad->ioaddr + RAD_CNTL);
+
+ /* Clear Reset Line */
+ outb(0x3f, rad->ioaddr + RAD_CNTL);
+
+ __pciradio_setcreg(rad,8,0xff);
+ __pciradio_setcreg(rad,0xe,0xff);
/* Release span, possibly delayed */
if (!rad->usecount)
Modified: team/tzafrir/patches/xpp/.version
URL: http://svn.digium.com/view/zaptel/team/tzafrir/patches/xpp/.version?view=diff&rev=2816&r1=2815&r2=2816
==============================================================================
--- team/tzafrir/patches/xpp/.version (original)
+++ team/tzafrir/patches/xpp/.version Fri Aug 3 20:02:19 2007
@@ -1,1 +1,1 @@
-trunk-r4372
+trunk-r4415
Modified: team/tzafrir/patches/xpp/ChangeLog
URL: http://svn.digium.com/view/zaptel/team/tzafrir/patches/xpp/ChangeLog?view=diff&rev=2816&r1=2815&r2=2816
==============================================================================
--- team/tzafrir/patches/xpp/ChangeLog (original)
+++ team/tzafrir/patches/xpp/ChangeLog Fri Aug 3 20:02:19 2007
@@ -1,3 +1,15 @@
+Thu Jul 30 2007 Oron Peled <oron at actcom.co.il> - xpp.r4415
+ * Show Astribank 6+2 as 6/2 channels and not 8/8 channels.
+ - Added as a "subtype" to the device type (r4391).
+ * Fixed a panic in BRI span shutdown method (r4393).
+ * Changes to debug macros.
+ * Add proper sysfs support (r4406)
+ - A bus on whuch all of the Astribanks reside.
+ - Replaces useless sysfs code that existed in the module.
+ - Currently used to set the sync source automatically at device
+ adition / removal.
+ * BRI: We do need the T1 timer in NT. If it gets into G2 state (rr4407).
+
Thu Jul 12 2007 Oron Peled <oron at actcom.co.il> - xpp.r4372
* Update to zaptel-1.2.18 and zaptel-1.4.3 (r4308 onward)
* Fix a critical race with zaptel synchronization (r4362)
Modified: team/tzafrir/patches/xpp/Makefile
URL: http://svn.digium.com/view/zaptel/team/tzafrir/patches/xpp/Makefile?view=diff&rev=2816&r1=2815&r2=2816
==============================================================================
--- team/tzafrir/patches/xpp/Makefile (original)
+++ team/tzafrir/patches/xpp/Makefile Fri Aug 3 20:02:19 2007
@@ -5,7 +5,6 @@
-DDEBUG \
-DPOLL_DIGITAL_INPUTS \
-DWITH_ECHO_SUPPRESSION \
- -DPROTOCOL_DEBUG \
-DWITH_METERING \
-DDEBUG_PCMTX \
-DPROTOCOL_DEBUG \
@@ -28,7 +27,7 @@
obj-m += xpd_bri.o
endif
-xpp-y += xbus-core.o xpp_zap.o xproto.o card_global.o
+xpp-y += xbus-core.o xbus-sysfs.o xpp_zap.o xproto.o card_global.o
xpd_fxs-y += card_fxs.o
xpd_fxo-y += card_fxo.o
xpd_bri-y += card_bri.o
Modified: team/tzafrir/patches/xpp/card_bri.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/patches/xpp/card_bri.c?view=diff&rev=2816&r1=2815&r2=2816
==============================================================================
--- team/tzafrir/patches/xpp/card_bri.c (original)
+++ team/tzafrir/patches/xpp/card_bri.c Fri Aug 3 20:02:19 2007
@@ -258,13 +258,12 @@
char debug_buf[DEBUG_BUF_SIZE + 1];
int i;
int n = 0;
- xbus_t *xbus = xpd->xbus;
debug_buf[0] = '\0';
for(i = 0; i < len && n < DEBUG_BUF_SIZE; i++)
n += snprintf(&debug_buf[n], DEBUG_BUF_SIZE - n, "%02X ", buf[i]);
- DBG("%s/%s: %s[0..%d]: %s%s\n", xbus->busname, xpd->xpdname, msg,
- len-1, debug_buf, (n >= DEBUG_BUF_SIZE)?"...":"");
+ XPD_DBG(xpd, "%s[0..%d]: %s%s\n", msg, len-1, debug_buf,
+ (n >= DEBUG_BUF_SIZE)?"...":"");
}
static void dump_dchan_packet(xpd_t *xpd, bool transmit, byte *buf, int len)
@@ -292,7 +291,7 @@
else if(IS_SET(buf[0], 7) && IS_SET(buf[0], 6))
ftype = 'U'; /* Unnumbered */
else
- NOTICE("Unknown frame type 0x%X\n", buf[0]);
+ XPD_NOTICE(xpd, "Unknown frame type 0x%X\n", buf[0]);
snprintf(msgbuf, MAX_PROC_WRITE, "D-Chan %s = (%c) ", direction, ftype);
} else {
@@ -311,8 +310,7 @@
if(priv->layer1_up == up)
return;
priv->layer1_up = up;
- DBG("%s/%s: STATE CHANGE: Layer1 %s\n", xpd->xbus->busname, xpd->xpdname,
- (up)?"UP":"DOWN");
+ XPD_DBG(xpd, "STATE CHANGE: Layer1 %s\n", (up)?"UP":"DOWN");
}
static void dchan_state(xpd_t *xpd, bool up)
@@ -325,12 +323,10 @@
if(priv->dchan_alive == up)
return;
if(up) {
- DBG("%s/%s: STATE CHANGE: D-Channel RUNNING\n",
- xpd->xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "STATE CHANGE: D-Channel RUNNING\n");
priv->dchan_alive = 1;
} else {
- DBG("%s/%s: STATE CHANGE: D-Channel STOPPED\n",
- xpd->xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "STATE CHANGE: D-Channel STOPPED\n");
priv->dchan_rx_counter = priv->dchan_tx_counter = priv->dchan_rx_drops = 0;
priv->dchan_alive = 0;
priv->dchan_alive_ticks = 0;
@@ -346,33 +342,32 @@
priv = xpd->priv;
BUG_ON(!priv);
xbus = xpd->xbus;
- DBG("%s/%s: %s\n", xbus->busname, xpd->xpdname, (on)?"ON":"OFF");
+ XPD_DBG(xpd, "%s\n", (on)?"ON":"OFF");
switch(xpd->type) {
case XPD_TYPE_BRI_TE:
if(on) {
- DBG("%s/%s: HFC_L1_ACTIVATE_TE\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "HFC_L1_ACTIVATE_TE\n");
set_bit(HFC_L1_ACTIVATING, &priv->l1_flags);
write_state_register(xpd, STA_ACTIVATE);
priv->t3 = HFC_TIMER_T3;
} else {
- DBG("%s/%s: HFC_L1_FORCE_DEACTIVATE_TE\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "HFC_L1_FORCE_DEACTIVATE_TE\n");
write_state_register(xpd, STA_DEACTIVATE);
}
break;
case XPD_TYPE_BRI_NT:
if(on) {
- DBG("%s/%s: HFC_L1_ACTIVATE_NT\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "HFC_L1_ACTIVATE_NT\n");
priv->t1 = TIMER_T1_MAX;
set_bit(HFC_L1_ACTIVATING, &priv->l1_flags);
write_state_register(xpd, STA_ACTIVATE | V_SU_SET_G2_G3);
} else {
- DBG("%s/%s: HFC_L1_DEACTIVATE_NT\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "HFC_L1_DEACTIVATE_NT\n");
write_state_register(xpd, STA_DEACTIVATE);
}
break;
default:
- ERR("%s: %s/%s: Bad xpd type %d\n", __FUNCTION__,
- xbus->busname, xpd->xpdname, xpd->type);
+ XPD_ERR(xpd, "%s: Bad xpd type %d\n", __FUNCTION__, xpd->type);
BUG();
}
}
@@ -413,7 +408,7 @@
static int rate_limit;
if((rate_limit++ % 1000) == 0)
- DBG("%s/%s: D-Chan unused\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "D-Chan unused\n");
dchan->bytes2receive = 0;
dchan->bytes2transmit = 0;
goto out;
@@ -421,7 +416,7 @@
dchan_buf = dchan->readchunk;
idx = priv->dchan_r_idx;
if(idx + len >= DCHAN_BUFSIZE) {
- ERR("%s/%s: D-Chan RX overflow: %d\n", xbus->busname, xpd->xpdname, idx);
+ XPD_ERR(xpd, "D-Chan RX overflow: %d\n", idx);
dump_hex_buf(xpd, " current packet", src, len);
dump_hex_buf(xpd, " dchan_buf", dchan_buf, idx);
ret = -ENOSPC;
@@ -436,15 +431,14 @@
if(!eoframe)
goto out;
if(idx < 4) {
- NOTICE("%s/%s: D-Chan RX short frame (idx=%d)\n", xbus->busname, xpd->xpdname, idx);
+ XPD_NOTICE(xpd, "D-Chan RX short frame (idx=%d)\n", idx);
dump_hex_buf(xpd, "D-Chan RX: current packet", src, len);
dump_hex_buf(xpd, "D-Chan RX: chan_buf", dchan_buf, idx);
ret = -EPROTO;
goto drop;
}
if(dchan_buf[idx-1]) {
- NOTICE("%s/%s: D-Chan RX Bad checksum: [%02X:%02X=%02X] (%d)\n",
- xbus->busname, xpd->xpdname,
+ XPD_NOTICE(xpd, "D-Chan RX Bad checksum: [%02X:%02X=%02X] (%d)\n",
dchan_buf[idx-3], dchan_buf[idx-2], dchan_buf[idx-1], dchan_buf[idx-1]);
dump_hex_buf(xpd, "D-Chan RX: current packet", src, len);
dump_hex_buf(xpd, "D-Chan RX: chan_buf", dchan_buf, idx);
@@ -484,7 +478,7 @@
* eoftx==0: Stop sending us D-channel packets.
*/
if(len > MULTIBYTE_MAX_LEN) {
- ERR("%s: len=%d is too long. dropping.\n", __FUNCTION__, len);
+ XPD_ERR(xpd, "%s: len=%d is too long. dropping.\n", __FUNCTION__, len);
return -EINVAL;
}
XFRAME_NEW(xframe, pack, xbus, BRI, REGISTER_REQUEST, xpd->xbus_idx);
@@ -495,7 +489,7 @@
if(len > 0) {
memcpy(REG_XDATA(reg_cmd), (byte *)buf, len);
} else {
- DBG("Magic Packet (eoftx=%d)\n", eoftx);
+ XPD_DBG(xpd, "Magic Packet (eoftx=%d)\n", eoftx);
}
#ifdef XPP_DEBUGFS
xbus_log(xbus, xpd, 1, reg_cmd, sizeof(reg_cmd_t)); /* 1 = TX */
@@ -505,7 +499,7 @@
#endif
ret = send_cmd_frame(xbus, xframe);
if(ret < 0)
- NOTICE("%s: %s: failed sending xframe\n", __FUNCTION__, xbus->busname);
+ XPD_NOTICE(xpd, "%s: failed sending xframe\n", __FUNCTION__);
return ret;
}
@@ -529,7 +523,7 @@
/* timer expired ? */
if (--priv->t3 == 0) {
if ((rate_limit % 1003) >= 5)
- DBG("%s/%s: T3 expired\n", xpd->xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "T3 expired\n");
priv->t3 = HFC_TIMER_OFF;
clear_bit(HFC_L1_ACTIVATING, &priv->l1_flags);
xpd_activation(xpd, 0); /* Deactivate TE */
@@ -539,7 +533,7 @@
/* timer expired ? */
if (--priv->t4 == 0) {
if ((rate_limit % 1003) >= 5)
- DBG("%s/%s: T4 expired\n", xpd->xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "T4 expired\n");
priv->t4 = HFC_TIMER_OFF;
}
}
@@ -557,11 +551,11 @@
if(len <= 0)
return 0; /* Nothing to transmit on D channel */
if(len > MULTIBYTE_MAX_LEN) {
- ERR("%s: len=%d. need to split. Unimplemented.\n", __FUNCTION__, len);
+ XPD_ERR(xpd, "%s: len=%d. need to split. Unimplemented.\n", __FUNCTION__, len);
return -EINVAL;
}
if(!test_bit(HFC_L1_ACTIVATED, &priv->l1_flags) && !test_bit(HFC_L1_ACTIVATING, &priv->l1_flags)) {
- DBG("%s/%s: Kick D-Channel transmiter\n", xpd->xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "Kick D-Channel transmiter\n");
xpd_activation(xpd, 1);
return 0;
}
@@ -573,8 +567,7 @@
priv->txframe_begin = 0;
ret = send_bri_multibyte(xpd, priv->dchan_tbuf, len, eoframe);
if(ret < 0)
- NOTICE("%s/%s: %s: failed sending xframe\n",
- __FUNCTION__, xpd->xbus->busname, xpd->xpdname);
+ XPD_NOTICE(xpd, "%s: failed sending xframe\n", __FUNCTION__);
if(eoframe)
priv->dchan_tx_counter++;
priv->dchan_notx_ticks = 0;
@@ -583,13 +576,12 @@
/*---------------- BRI: Methods -------------------------------------------*/
-static xpd_t *BRI_card_new(xbus_t *xbus, int unit, int subunit, const xproto_table_t *proto_table, byte revision)
+static xpd_t *BRI_card_new(xbus_t *xbus, int unit, int subunit, const xproto_table_t *proto_table, byte subtype, byte revision)
{
xpd_t *xpd = NULL;
int channels = min(3, CHANNELS_PERXPD);
- DBG("\n");
-
+ XBUS_DBG(xbus, "\n");
xpd = xpd_alloc(sizeof(struct BRI_priv_data), proto_table, channels);
if(!xpd)
return NULL;
@@ -605,15 +597,15 @@
BUG_ON(!xpd);
priv = xpd->priv;
- DBG("%s/%s\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "\n");
#ifdef CONFIG_PROC_FS
if(priv->regfile) {
- DBG("Removing registers file for %s/%s\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "Removing registers file\n");
priv->regfile->data = NULL;
remove_proc_entry(PROC_REGISTER_FNAME, xpd->proc_xpd_dir);
}
if(priv->bri_info) {
- DBG("Removing xpd BRI_INFO file %s/%s\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "Removing xpd BRI_INFO file\n");
remove_proc_entry(PROC_BRI_INFO_FNAME, xpd->proc_xpd_dir);
}
#endif
@@ -624,23 +616,22 @@
struct BRI_priv_data *priv;
int ret = 0;
- DBG("\n");
-
BUG_ON(!xpd);
+ XPD_DBG(xpd, "\n");
priv = xpd->priv;
#ifdef CONFIG_PROC_FS
- DBG("Creating BRI_INFO file for %s/%s\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "Creating BRI_INFO file\n");
priv->bri_info = create_proc_read_entry(PROC_BRI_INFO_FNAME, 0444, xpd->proc_xpd_dir, proc_bri_info_read, xpd);
if(!priv->bri_info) {
- ERR("Failed to create proc '%s' for %s/%s\n", PROC_BRI_INFO_FNAME, xbus->busname, xpd->xpdname);
+ XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_BRI_INFO_FNAME);
ret = -ENOENT;
goto err;
}
priv->bri_info->owner = THIS_MODULE;
- DBG("Creating registers file for %s/%s\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "Creating registers file\n");
priv->regfile = create_proc_entry(PROC_REGISTER_FNAME, 0644, xpd->proc_xpd_dir);
if(!priv->regfile) {
- ERR("Failed to create proc file for registers of %s/%s\n", xbus->busname, xpd->xpdname);
+ XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_REGISTER_FNAME);
goto err;
}
priv->regfile->owner = THIS_MODULE;
@@ -657,13 +648,12 @@
* Force HOST sync *before* sending PCM
*/
CALL_PROTO(GLOBAL, SYNC_SOURCE, xbus, NULL, SYNC_MODE_HOST, 0);
- DBG("done: %s/%s\n", xbus->busname, xpd->xpdname);
-
+ XPD_DBG(xpd, "done\n");
priv->initialized = 1;
return 0;
err:
clean_proc(xbus, xpd);
- ERR("%s/%s: Failed initializing registers (%d)\n", xbus->busname, xpd->xpdname, ret);
+ XPD_ERR(xpd, "Failed initializing registers (%d)\n", ret);
return ret;
}
@@ -673,7 +663,7 @@
BUG_ON(!xpd);
priv = xpd->priv;
- DBG("%s/%s\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "\n");
clean_proc(xbus, xpd);
return 0;
}
@@ -691,7 +681,7 @@
xbus = xpd->xbus;
priv = xpd->priv;
BUG_ON(!xbus);
- DBG("%s/%s: %s\n", xbus->busname, xpd->xpdname, (on)?"on":"off");
+ XPD_DBG(xpd, "%s\n", (on)?"on":"off");
if(!on) {
/* Nothing to do yet */
return 0;
@@ -702,7 +692,7 @@
for_each_line(xpd, i) {
struct zt_chan *cur_chan = &xpd->chans[i];
- DBG("setting BRI channel %d\n", i);
+ XPD_DBG(xpd, "setting BRI channel %d\n", i);
snprintf(cur_chan->name, MAX_CHANNAME, "XPP_%s/%02d/%1d%1d/%d",
xpd->xproto->name, xbus->num,
xpd->addr.unit, xpd->addr.subunit, i);
@@ -766,13 +756,13 @@
xbus = xpd->xbus;
priv = xpd->priv;
BUG_ON(!xbus);
- DBG("%s/%s: %s\n", xbus->busname, xpd->xpdname, (on)?"on":"off");
+ XPD_DBG(xpd, "%s\n", (on)?"on":"off");
return(0);
}
int BRI_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig)
{
- DBG("%s/%s/%d: %s\n", xbus->busname, xpd->xpdname, pos, txsig2str(txsig));
+ LINE_DBG(xpd, pos, "%s\n", txsig2str(txsig));
return 0;
}
@@ -857,7 +847,7 @@
if(!priv->initialized)
return 0;
if(poll_interval != 0 && (priv->tick_counter % poll_interval) == 0) {
- // DBG("%d\n", priv->tick_counter);
+ // XPD_DBG(xpd, "%d\n", priv->tick_counter);
priv->poll_counter++;
CALL_PROTO(BRI, REGISTER_REQUEST, xbus, xpd, 0, 0, 0, A_SU_RD_STA, 0, 0, 0);
}
@@ -878,32 +868,24 @@
/* Detect Layer1 disconnect */
if(priv->reg30_good && priv->reg30_ticks > poll_interval * REG30_LOST) {
/* No reply for 1/2 a second */
- ERR("%s/%s: Lost state tracking for %d ticks\n",
- xbus->busname, xpd->xpdname, priv->reg30_ticks);
+ XPD_ERR(xpd, "Lost state tracking for %d ticks\n", priv->reg30_ticks);
priv->reg30_good = 0;
layer1_state(xpd, 0);
dchan_state(xpd, 0);
}
handle_leds(xbus, xpd);
tx_dchan(xpd);
-#if 0
- /*
- Currently not used -- do we want to shut down NT if it wasn't
- responding? For how long?
- */
-
/* Detect T1 timer expiry on NT */
if(IS_NT(xpd)) {
if (priv->t1 > HFC_TIMER_OFF) {
if (--priv->t1 == 0) {
- DBG("%s/%s: T1 Expired. Kick NT\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "T1 Expired. Kick NT\n");
priv->t1 = HFC_TIMER_OFF;
clear_bit(HFC_L1_ACTIVATING, &priv->l1_flags);
write_state_register(xpd, STA_DEACTIVATE);
}
}
}
-#endif
priv->tick_counter++;
priv->reg30_ticks++;
return 0;
@@ -948,8 +930,7 @@
/* E1's can enable CRC checking */
if (lc->lineconfig & ZT_CONFIG_CRC4)
crcstr = "CRC4";
- DBG("%s/%s[%s]: span=%d (%s) lbo=%d lineconfig=%s/%s/%s (0x%X) sync=%d\n",
- xpd->xbus->busname, xpd->xpdname,
+ XPD_DBG(xpd, "[%s]: span=%d (%s) lbo=%d lineconfig=%s/%s/%s (0x%X) sync=%d\n",
IS_NT(xpd)?"NT":"TE",
lc->span,
lc->name,
@@ -990,7 +971,11 @@
BUG_ON(!xpd);
priv = xpd->priv;
BUG_ON(!priv);
- DBG("%s/%s: STARTUP\n", xpd->xbus->busname, xpd->xpdname);
+ if(!xpd->xbus->hardware_exists) {
+ XPD_DBG(xpd, "Startup called by zaptel. No Hardware. Ignored\n");
+ return -ENODEV;
+ }
+ XPD_DBG(xpd, "STARTUP\n");
// Turn on all channels
CALL_XMETHOD(XPD_STATE, xpd->xbus, xpd, 1);
write_state_register(xpd, 0); /* Enable L1 state machine */
@@ -1021,7 +1006,11 @@
BUG_ON(!xpd);
priv = xpd->priv;
BUG_ON(!priv);
- DBG("%s/%s: SHUTDOWN\n", xpd->xbus->busname, xpd->xpdname);
+ if(!xpd->xbus->hardware_exists) {
+ XPD_DBG(xpd, "Shutdown called by zaptel. No Hardware. Ignored\n");
+ return -ENODEV;
+ }
+ XPD_DBG(xpd, "SHUTDOWN\n");
// Turn off all channels
CALL_XMETHOD(XPD_STATE, xpd->xbus, xpd, 0);
if(IS_NT(xpd))
@@ -1134,8 +1123,7 @@
}
XFRAME_NEW(xframe, pack, xbus, BRI, REGISTER_REQUEST, xpd->xbus_idx);
#if 0
- DBG("%s/%s/%d: %c%c R%02X S%02X %02X %02X\n",
- xbus->busname, xpd->xpdname, chipsel,
+ LINE_DBG(xpd, chipsel, "%c%c R%02X S%02X %02X %02X\n",
(writing)?'W':'R',
(do_subreg)?'S':'D',
regnum, subreg, data_low, data_high);
@@ -1156,20 +1144,20 @@
/* 0x0F */ HOSTCMD(BRI, XPD_STATE, bool on)
{
BUG_ON(!xpd);
- DBG("%s/%s: %s\n", xbus->busname, xpd->xpdname, (on)?"ON":"OFF");
+ XPD_DBG(xpd, "%s\n", (on)?"ON":"OFF");
xpd_activation(xpd, on);
return 0;
}
/* 0x0F */ HOSTCMD(BRI, RING, lineno_t chan, bool on)
{
- ERR("%s: Unsupported\n", __FUNCTION__);
+ XPD_ERR(xpd, "%s: Unsupported\n", __FUNCTION__);
return -ENOSYS;
}
/* 0x0F */ HOSTCMD(BRI, RELAY_OUT, byte which, bool on)
{
- ERR("%s: Unsupported\n", __FUNCTION__);
+ XPD_ERR(xpd, "%s: Unsupported\n", __FUNCTION__);
return -ENOSYS;
}
@@ -1185,8 +1173,7 @@
priv = xpd->priv;
BUG_ON(!priv);
#if 0
- DBG("%s/%s: %s -> %d\n",
- xbus->busname, xpd->xpdname,
+ XPD_DBG(xpd, "%s -> %d\n",
(which_led)?"RED":"GREEN",
to_led_state);
#endif
@@ -1204,7 +1191,7 @@
{
int ret;
- DBG("%s/%s: value = 0x%02X\n", xpd->xbus->busname, xpd->xpdname, value);
+ XPD_DBG(xpd, "value = 0x%02X\n", value);
ret = CALL_PROTO(BRI, REGISTER_REQUEST, xpd->xbus, xpd,
0, /* chipsel */
1, /* writing */
@@ -1229,8 +1216,7 @@
BUG_ON(!priv);
xbus = xpd->xbus;
if(!priv->initialized) {
- ERR("%s/%s: %s called on uninitialized AB\n",
- xbus->busname, xpd->xpdname, __FUNCTION__);
+ XPD_ERR(xpd, "%s called on uninitialized AB\n", __FUNCTION__);
return;
}
new_state.reg = reg_x30;
@@ -1265,33 +1251,31 @@
if (priv->state_register.bits.v_su_sta == new_state.bits.v_su_sta)
return; /* same same */
DBG("%02X ---> %02X\n", priv->state_register.reg, reg_x30);
- DBG("%s/%s: %s%i\n", xbus->busname, xpd->xpdname,
- IS_NT(xpd)?"G":"F",
- new_state.bits.v_su_sta);
+ XPD_DBG(xpd, "%s%i\n", IS_NT(xpd)?"G":"F", new_state.bits.v_su_sta);
if(!IS_NT(xpd)) {
/* disable T3 ? */
if ((new_state.bits.v_su_sta <= ST_TE_DEACTIVATED) || (new_state.bits.v_su_sta >= ST_TE_ACTIVATED)) {
- DBG("%s/%s: Disable T3 ?\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "Disable T3 ?\n");
priv->t3 = HFC_TIMER_OFF;
}
switch (new_state.bits.v_su_sta) {
case ST_TE_DEACTIVATED: /* F3 */
- DBG("%s/%s: State ST_TE_DEACTIVATED (F3)\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "State ST_TE_DEACTIVATED (F3)\n");
if (test_and_clear_bit(HFC_L1_ACTIVATED, &priv->l1_flags))
priv->t4 = HFC_TIMER_T4;
break;
case ST_TE_SIGWAIT: /* F4 */
- DBG("%s/%s: State ST_TE_SIGWAIT (F4)\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "State ST_TE_SIGWAIT (F4)\n");
break;
case ST_TE_IDENT: /* F5 */
- DBG("%s/%s: State ST_TE_IDENT (F5)\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "State ST_TE_IDENT (F5)\n");
break;
case ST_TE_SYNCED: /* F6 */
- DBG("%s/%s: State ST_TE_SYNCED (F6)\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "State ST_TE_SYNCED (F6)\n");
break;
case ST_TE_ACTIVATED: /* F7 */
- DBG("%s/%s: State ST_TE_ACTIVATED (F7)\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "State ST_TE_ACTIVATED (F7)\n");
if (priv->t4 > HFC_TIMER_OFF)
priv->t4 = HFC_TIMER_OFF;
clear_bit(HFC_L1_ACTIVATING, &priv->l1_flags);
@@ -1300,42 +1284,41 @@
break;
case ST_TE_LOST_FRAMING: /* F8 */
- DBG("%s/%s: State ST_TE_LOST_FRAMING (F8)\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "State ST_TE_LOST_FRAMING (F8)\n");
priv->t4 = HFC_TIMER_OFF;
break;
default:
- NOTICE("%s/%s: Bad TE state: %d\n", xbus->busname, xpd->xpdname, new_state.bits.v_su_sta);
+ XPD_NOTICE(xpd, "Bad TE state: %d\n", new_state.bits.v_su_sta);
break;
}
} else if(IS_NT(xpd)) {
switch (new_state.bits.v_su_sta) {
case ST_NT_DEACTIVATED: /* G1 */
- DBG("%s/%s: State ST_NT_DEACTIVATED (G1)\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "State ST_NT_DEACTIVATED (G1)\n");
clear_bit(HFC_L1_ACTIVATED, &priv->l1_flags);
priv->t1 = HFC_TIMER_OFF;
break;
case ST_NT_ACTIVATING: /* G2 */
- DBG("%s/%s: State ST_NT_ACTIVATING (G2)\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "State ST_NT_ACTIVATING (G2)\n");
xpd_activation(xpd, 1);
break;
case ST_NT_ACTIVATED: /* G3 */
- DBG("%s/%s: State ST_NT_ACTIVATED (G3)\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "State ST_NT_ACTIVATED (G3)\n");
clear_bit(HFC_L1_ACTIVATING, &priv->l1_flags);
set_bit(HFC_L1_ACTIVATED, &priv->l1_flags);
priv->t1 = HFC_TIMER_OFF;
break;
case ST_NT_DEACTIVTING: /* G4 */
- DBG("%s/%s: State ST_NT_DEACTIVTING (G4)\n", xbus->busname, xpd->xpdname);
+ XPD_DBG(xpd, "State ST_NT_DEACTIVTING (G4)\n");
priv->t1 = HFC_TIMER_OFF;
break;
default:
- NOTICE("%s/%s: Bad NT state: %d\n", xbus->busname, xpd->xpdname, new_state.bits.v_su_sta);
+ XPD_NOTICE(xpd, "Bad NT state: %d\n", new_state.bits.v_su_sta);
break;
}
} else
- ERR("%s: %s/%s: Unknown xpd type %d\n", __FUNCTION__,
- xpd->xbus->busname, xpd->xpdname, xpd->type);
+ XPD_ERR(xpd, "%s: Unknown xpd type %d\n", __FUNCTION__, xpd->type);
priv->state_register.reg = new_state.reg;
}
@@ -1347,9 +1330,9 @@
int ret;
if(!xpd) {
- NOTICE("%s: received %s for non-existing %s(%1d%1d)\n",
+ XBUS_NOTICE(xbus, "%s: received %s for non-existing unit (%1d%1d)\n",
__FUNCTION__, cmd->name,
- xbus->busname, pack->addr.unit, pack->addr.subunit);
+ pack->addr.unit, pack->addr.subunit);
return -EPROTO;
}
spin_lock_irqsave(&xpd->lock, flags);
@@ -1357,25 +1340,24 @@
BUG_ON(!priv);
#if 0
if(REG_FIELD(info, do_subreg)) {
- DBG("REGISTER_REPLY: %s/%s: RS %02X %02X %02X\n",
- xbus->busname, xpd->xpdname, REG_FIELD(info, regnum), REG_FIELD(info, subreg), REG_FIELD(info, data_low));
+ XPD_DBG(xpd, "REGISTER_REPLY: RS %02X %02X %02X\n",
+ REG_FIELD(info, regnum), REG_FIELD(info, subreg), REG_FIELD(info, data_low));
} else {
if (REG_FIELD(info, regnum) != A_SU_RD_STA)
- DBG("REGISTER_REPLY: %s/%s: RD %02X %02X\n",
- xbus->busname, xpd->xpdname, REG_FIELD(info, regnum), REG_FIELD(info, data_low));
+ XPD_DBG(xpd, "REGISTER_REPLY: RD %02X %02X\n",
+ REG_FIELD(info, regnum), REG_FIELD(info, data_low));
}
#endif
if(info->multibyte) {
#if 0
- DBG("%s/%s: Got Multibyte: %d bytes, eoframe: %d\n",
- xbus->busname, xpd->xpdname,
+ XPD_DBG(xpd, "Got Multibyte: %d bytes, eoframe: %d\n",
info->bytes, info->eoframe);
#endif
ret = rx_dchan(xpd, info);
if (ret < 0) {
priv->dchan_rx_drops++;
if(atomic_read(&xpd->open_counter) > 0)
- NOTICE("%s/%s: Multibyte Drop: errno=%d\n", xbus->busname, xpd->xpdname, ret);
+ XPD_NOTICE(xpd, "Multibyte Drop: errno=%d\n", ret);
}
goto end;
}
@@ -1644,7 +1626,7 @@
BUG_ON(!xpd);
xbus = xpd->xbus;
if(!down_read_trylock(&xbus->in_use)) {
- DBG("Dropped packet. %s is in_use\n", xbus->busname);
+ XBUS_DBG(xbus, "Dropped packet. Is in_use\n");
return -EBUSY;
}
priv = xpd->priv;
@@ -1740,7 +1722,7 @@
{
DBG("\n");
- INFO("%s revision %s\n", THIS_MODULE->name, XPP_VERSION);
+ INFO("revision %s\n", XPP_VERSION);
xproto_register(&PROTO_TABLE(BRI_NT));
xproto_register(&PROTO_TABLE(BRI_TE));
return 0;
Modified: team/tzafrir/patches/xpp/card_fxo.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/patches/xpp/card_fxo.c?view=diff&rev=2816&r1=2815&r2=2816
==============================================================================
--- team/tzafrir/patches/xpp/card_fxo.c (original)
[... 6694 lines stripped ...]
More information about the zaptel-commits
mailing list