summaryrefslogtreecommitdiff
path: root/xpp/xbus-pcm.c
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-05-13 20:01:23 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-05-13 20:01:23 +0000
commit8eeb67728cc1db4007233f862c61376a094c9d41 (patch)
tree7db845e07d7a01a47427e8817aba6715251f0841 /xpp/xbus-pcm.c
parentaee310d11e62a33c09bf7db1d034db8986155fae (diff)
xpp r5723: Includes, among others:
* New firmware protocol version: 3.0 . * New numbers for the device types: (e.g. in card_init* scripts) - FXS: 1 (was: 3) - FXO: 2 (was: 4) - BRI: 3 (was: 6 for TE, 7 for NT) - PRI: 4 (was: 9) * Init scripts of FXS and FXO modules are now written in Perl as well (be sure to have File::Basename, e.g: perl-modules in Debian). * calibrate_slics merged into init_card_1_30 . * Module parameter print_dbg replaced with debug . Same meaning. * init_fxo_modes removed: content moved into init_card_2_30, verified at build time. * Code tested with sparse. Most warnings were fixed. * Set ZT_SIG_DACS for the bchans in the PRI and BRI modules to not get ignored by ztscan. * Handle null config_desc we get from some crazy USB controllers. * genzaptelconf: Fix reporting of empty slots in list mode. * xpp_blink can now blink a single analog port. * "slics" has been renamed "chipregs". * Fixed a small typo in fpga_load(8). * Fixed bashism in xpp_fxloader. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@4264 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xbus-pcm.c')
-rw-r--r--xpp/xbus-pcm.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/xpp/xbus-pcm.c b/xpp/xbus-pcm.c
index b2dad35..6155f35 100644
--- a/xpp/xbus-pcm.c
+++ b/xpp/xbus-pcm.c
@@ -35,21 +35,21 @@
static const char rcsid[] = "$Id$";
-extern int print_dbg;
+extern int debug;
#ifdef XPP_EC_CHUNK
#include "supress/ec_xpp.h"
DEF_PARM_BOOL(xpp_ec, 0, 0444, "Do we use our own (1) or Zaptel's (0) echo canceller");
#endif
#ifdef OPTIMIZE_CHANMUTE
-DEF_PARM_BOOL(optimize_chanmute, 1, 0644, "Optimize by muting inactive channels");
+static DEF_PARM_BOOL(optimize_chanmute, 1, 0644, "Optimize by muting inactive channels");
#endif
-DEF_PARM(int, disable_pcm, 0, 0644, "Disable all PCM transmissions");
+static DEF_PARM(int, disable_pcm, 0, 0644, "Disable all PCM transmissions");
#ifdef DEBUG_PCMTX
DEF_PARM(int, pcmtx, -1, 0644, "Forced PCM value to transmit (negative to disable)");
DEF_PARM(int, pcmtx_chan, 0, 0644, "channel to force PCM value");
#endif
-DEF_PARM_BOOL(disable_pll_sync, 0, 0644, "Disable automatic adjustment of AB clocks");
+static DEF_PARM_BOOL(disable_pll_sync, 0, 0644, "Disable automatic adjustment of AB clocks");
static xbus_t *syncer; /* current syncer */
static atomic_t xpp_tick_counter = ATOMIC_INIT(0);
@@ -263,10 +263,10 @@ static void xpp_drift_step(xbus_t *xbus, const struct timeval *tv)
const char *sync_mode_name(enum sync_mode mode)
{
static const char *sync_mode_names[] = {
- [SYNC_MODE_AB] "AB",
- [SYNC_MODE_NONE] "NONE",
- [SYNC_MODE_PLL] "PLL",
- [SYNC_MODE_QUERY] "QUERY",
+ [SYNC_MODE_AB] = "AB",
+ [SYNC_MODE_NONE] = "NONE",
+ [SYNC_MODE_PLL] = "PLL",
+ [SYNC_MODE_QUERY] = "QUERY",
};
if(mode >= ARRAY_SIZE(sync_mode_names))
return NULL;
@@ -287,7 +287,7 @@ static void xpp_set_syncer(xbus_t *xbus, bool on)
(syncer) ? syncer->busname : "NO-SYNC");
}
-void xbus_command_timer(unsigned long param)
+static void xbus_command_timer(unsigned long param)
{
xbus_t *xbus = (xbus_t *)param;
struct timeval now;
@@ -309,10 +309,8 @@ void xbus_set_command_timer(xbus_t *xbus, bool on)
xbus->command_timer.data = (unsigned long)xbus;
xbus->command_timer.expires = jiffies + 1;
add_timer(&xbus->command_timer);
- xbus->self_ticking = 0;
}
} else if(timer_pending(&xbus->command_timer)) {
- xbus->self_ticking = 1;
XBUS_DBG(SYNC, xbus, "del_timer\n");
del_timer(&xbus->command_timer);
}
@@ -337,18 +335,21 @@ void got_new_syncer(xbus_t *xbus, enum sync_mode mode, int drift)
case SYNC_MODE_AB:
xbus->sync_mode = mode;
xbus_set_command_timer(xbus, 0);
+ xbus->self_ticking = 1;
xpp_set_syncer(xbus, 1);
global_ticker = xbus;
break;
case SYNC_MODE_PLL:
xbus->sync_mode = mode;
xbus_set_command_timer(xbus, 0);
+ xbus->self_ticking = 1;
xpp_set_syncer(xbus, 0);
global_ticker = xbus;
break;
case SYNC_MODE_NONE: /* lost sync source */
xbus->sync_mode = mode;
xbus_set_command_timer(xbus, 1);
+ xbus->self_ticking = 0;
xpp_set_syncer(xbus, 0);
break;
case SYNC_MODE_QUERY: /* ignore */
@@ -377,7 +378,13 @@ static void reset_sync_counters(void)
if(!xbus)
continue;
- if (TRANSPORT_RUNNING(xbus)) {
+ /*
+ * Don't send to non self_ticking Astribanks:
+ * - Maybe they didn't finish initialization
+ * - Or maybe they didn't answer us in the first place
+ (e.g: wrong firmware version, etc).
+ */
+ if (TRANSPORT_RUNNING(xbus) && xbus->self_ticking) {
if(XBUS_GET(xbus)) {
/* Reset sync LEDs once in a while */
CALL_PROTO(GLOBAL, RESET_SYNC_COUNTERS, xbus, NULL);
@@ -581,6 +588,7 @@ void __pcm_recompute(xpd_t *xpd, xpp_line_t pcm_mask)
int i;
int line_count = 0;
+ XPD_DBG(SIGNAL, xpd, "pcm_mask=0x%X\n", pcm_mask);
/* Add/remove all the trivial cases */
pcm_mask |= xpd->offhook;
pcm_mask |= xpd->cid_on;
@@ -799,8 +807,8 @@ static inline void pcm_frame_out(xbus_t *xbus, xframe_t *xframe)
}
spin_unlock_irqrestore(&xbus->lock, flags);
/* OK, really send it */
- if(print_dbg & DBG_PCM )
- dump_xframe("TX_XFRAME_PCM", xbus, xframe, print_dbg);
+ if(debug & DBG_PCM )
+ dump_xframe("TX_XFRAME_PCM", xbus, xframe, debug);
send_pcm_frame(xbus, xframe);
XBUS_COUNTER(xbus, TX_XFRAME_PCM)++;
return;
@@ -891,8 +899,8 @@ static int copy_pcm_tospan(xbus_t *xbus, xframe_t *xframe)
byte *p;
int ret = -EPROTO; /* Assume error */
- if(print_dbg & DBG_PCM)
- dump_xframe("RX_XFRAME_PCM", xbus, xframe, print_dbg);
+ if(debug & DBG_PCM)
+ dump_xframe("RX_XFRAME_PCM", xbus, xframe, debug);
/* handle content */
p = xframe->packets;
@@ -911,7 +919,7 @@ static int copy_pcm_tospan(xbus_t *xbus, xframe_t *xframe)
XBUS_NOTICE(xbus,
"%s: Non-PCM packet within a PCM xframe. (%d)\n",
__FUNCTION__, rate_limit);
- dump_xframe("In PCM xframe", xbus, xframe, print_dbg);
+ dump_xframe("In PCM xframe", xbus, xframe, debug);
}
goto out;
}
@@ -923,7 +931,7 @@ static int copy_pcm_tospan(xbus_t *xbus, xframe_t *xframe)
XBUS_NOTICE(xbus,
"%s: Invalid packet length %d. (%d)\n",
__FUNCTION__, len, rate_limit);
- dump_xframe("BAD LENGTH", xbus, xframe, print_dbg);
+ dump_xframe("BAD LENGTH", xbus, xframe, debug);
}
goto out;
}
@@ -933,7 +941,7 @@ static int copy_pcm_tospan(xbus_t *xbus, xframe_t *xframe)
if((rate_limit++ % 1003) == 0) {
notify_bad_xpd(__FUNCTION__, xbus, XPACKET_ADDR(pack), "RECEIVE PCM");
- dump_xframe("Unknown XPD addr", xbus, xframe, print_dbg);
+ dump_xframe("Unknown XPD addr", xbus, xframe, debug);
}
goto out;
}
@@ -1114,7 +1122,7 @@ void xframe_receive_pcm(xbus_t *xbus, xframe_t *xframe)
}
#ifdef CONFIG_PROC_FS
-int proc_sync_read(char *page, char **start, off_t off, int count, int *eof, void *data)
+static int proc_sync_read(char *page, char **start, off_t off, int count, int *eof, void *data)
{
int len = 0;
struct timeval now;