summaryrefslogtreecommitdiff
path: root/tdm/xivo_tdm.c
diff options
context:
space:
mode:
authorNoe Rubinstein <nrubinstein@proformatique.com>2011-01-13 12:15:50 +0100
committerNoe Rubinstein <nrubinstein@proformatique.com>2011-01-20 18:33:00 +0100
commita23ecd92a42a4b378e2d53d6c69dccb4b180392f (patch)
tree07bc0234c9a9a4e20442d88d29e53383d74a05c7 /tdm/xivo_tdm.c
parentd3319b733d4f59b75d03299358ac68fc702d6274 (diff)
misc
Diffstat (limited to 'tdm/xivo_tdm.c')
-rw-r--r--tdm/xivo_tdm.c45
1 files changed, 36 insertions, 9 deletions
diff --git a/tdm/xivo_tdm.c b/tdm/xivo_tdm.c
index 718ce6e..ebd77fe 100644
--- a/tdm/xivo_tdm.c
+++ b/tdm/xivo_tdm.c
@@ -15,6 +15,11 @@
#include <asm/page.h>
+/* GRUIK HACK UGLY grrrr: */
+#undef REF_0_0
+#define REF_1_1
+
+
#define DBG_TRACE_ISR
// #undef DBG_TRACE_ISR
@@ -64,6 +69,15 @@ MODULE_PARM_DESC(dump_count, "number of traces to emit "
MODULE_LICENSE("GPL");
+#if defined(REF_0_0) && defined(REF_1_1)
+# error don't define both REF_0_0 and REF_1_1
+#endif
+
+#if !defined(REF_0_0) && !defined(REF_1_1)
+# error please define one of REF_0_0 or REF_1_1
+#endif
+
+
/* can be tuned */
#define MIN_HSS_PORTS_WANTED (2)
#define MIN_HSS_CHANS_WANTED (10)
@@ -708,7 +722,7 @@ static inline u8 *local_rxq_data_tail(unsigned port, unsigned ts)
static inline u8 *local_txq_data_head(unsigned port, unsigned ts)
{
- const unsigned head = xivo_tdm_ports[port].rx_data_cpt[ts].head
+ const unsigned head = xivo_tdm_ports[port].tx_data_cpt[ts].head
& DATA_QUEUE_MASK;
return xivo_tdm_ports[port].data_zone
+ (ts * DATA_CH_SIZE)
@@ -767,7 +781,7 @@ static int xivo_tdm_port_txrx(
int ts;
u32 ts_tx_enqueue = 0;
- if (!(xivo_tdm_ports[port].ts_started & (1u << port))) // XXX hack
+ if (!(xivo_tdm_ports[port].ts_started & (1u << port))) // XXX hack ref channel
return 0;
for (ts = 0; ts < XIVO_TDM_TS_NUM; ts++) {
@@ -882,7 +896,7 @@ static int xivo_tdm_port_txrx(
} while (unlikely(suppl_sync-- > 0));
}
- // XXX hack:
+ // XXX hack ref channel:
return (int)local_rxq_level(port, port) - 1 > 0;
}
@@ -890,7 +904,6 @@ static int xivo_tdm_port_txrx(
void xivo_tdm_trigger_handler(void)
{
int port, ts, tick;
- int again;
IxQMgrQueue * const vrxq_info =
&ixQMgrQueues[local_rx_ixQ[LOCAL_VOICE_RX_Q]];
#ifdef DBG_TRACE_ISR
@@ -952,7 +965,7 @@ void xivo_tdm_trigger_handler(void)
#endif
xivo_tdm_ports[port].rx_data_cpt[ts].head++;
xivo_tdm_ports[port].rx_data_cpt[ts].tail += full;
- xivo_tdm_ports[port].err += (full & ~(port ^ ts)); // XXX hack
+ xivo_tdm_ports[port].err += (full & ~(port ^ ts)); // XXX hack ref channel
} else {
invalid_channels++;
}
@@ -969,24 +982,38 @@ void xivo_tdm_trigger_handler(void)
xivo_tdm_save_our_counters();
#undef RXQ_EMPTY
- if (!(xivo_tdm_ports[0].ts_started & 1)) // XXX big hack
+// XXX big hack
+#if defined(REF_0_0)
+ if (!(xivo_tdm_ports[0].ts_started & 1))
+#elif defined(REF_1_1)
+ if (!(xivo_tdm_ports[1].ts_started & 2))
+#endif
{
ref_ts_not_started++;
return;
}
+#if defined(REF_0_0)
tick = (int)local_rxq_level(0, 0);
+#elif defined(REF_1_1)
+ tick = (int)local_rxq_level(1, 1);
+#endif
+
if (tick < 0) tick = 0;
if (tick > 4) tick = 4;
levels[tick]++;
do {
- again = 0;
- tick = (int)local_rxq_level(0, 0) - 1; // XXX ultimate hack
+// XXX ultimate fucking big hack:
+#if defined(REF_0_0)
+ tick = (int)local_rxq_level(0, 0) - 1;
+#elif defined(REF_1_1)
+ tick = (int)local_rxq_level(1, 1) - 1;
+#endif
if (tick <= 0)
return;
for (port = 0; port < MIN_HSS_PORTS_WANTED; port++)
- again = xivo_tdm_port_txrx(port, tick);
+ xivo_tdm_port_txrx(port, tick);
} while (1);
}