summaryrefslogtreecommitdiff
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
parentd3319b733d4f59b75d03299358ac68fc702d6274 (diff)
misc
-rw-r--r--tdm/xivo_tdm.c45
-rw-r--r--tdm/xivo_tdm_api.h2
-rw-r--r--xivovp/base.c40
3 files changed, 71 insertions, 16 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);
}
diff --git a/tdm/xivo_tdm_api.h b/tdm/xivo_tdm_api.h
index e9f5206..49cc115 100644
--- a/tdm/xivo_tdm_api.h
+++ b/tdm/xivo_tdm_api.h
@@ -7,6 +7,8 @@
/* XXX matches with ICP_HSSDRV_PORT_LE89316_MEGREZ_PROTO_XIVO_CONFIG */
#define LE89316_MEGREZ_PROTO_XIVO_CONFIG (5)
+#define LE89316_ASYNC_MEGREZ_PROTO_XIVO_CONFIG (6)
+
/* fixed: */
#define XIVO_TDM_TS_NUM (32)
diff --git a/xivovp/base.c b/xivovp/base.c
index 9036cc8..684639f 100644
--- a/xivovp/base.c
+++ b/xivovp/base.c
@@ -1,12 +1,15 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/errno.h>
+#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/compiler.h>
#include <linux/stringify.h>
#include <dahdi/kernel.h>
+#include <gpio/gpio.h>
+
#ifdef AUDIO
#include <tdm/xivo_tdm_api.h>
@@ -53,9 +56,13 @@ static int alawoverride = 1; /* It's named like that in every DAHDI driver
except I prefer it to be 1 so the name
doesn't make much sense. */
static int reverse_polarity = false;
+static int wait_port0 = false;
+static uint reset_gpio = 21;
module_param(init_dbg, uint, 0444);
+module_param(reset_gpio, uint, 0444);
module_param(traces_vanish, int, 0444);
+module_param(wait_port0, int, 0444);
module_param(alawoverride, int, 0600);
module_param(reverse_polarity, int, 0600);
@@ -116,6 +123,17 @@ static void xivovp_txrx(void *data)
}
#endif
+void reset_ve890(void)
+{
+ gpio_set_direction(reset_gpio, GPIO_OUTPUT);
+ gpio_set_to_gpio(reset_gpio);
+ gpio_set_level(reset_gpio, GPIO_HIGH);
+ msleep(1);
+ gpio_set_level(reset_gpio, GPIO_LOW);
+ msleep(1);
+ gpio_set_level(reset_gpio, GPIO_HIGH);
+}
+
/* Returns the xivovp_line which line is the same as the VpLineCtxType */
static struct xivovp_line* xivovp_line_from_ctx(VpLineCtxType* line_ctx)
{
@@ -736,7 +754,6 @@ vp_init(void)
} else {
printk(KERN_INFO DRV_NAME ": VpMakeLineObject (FXO) done.\n");
}
-#endif
vpst = VpInitDevice(
&xivovp.dev_ctx,
@@ -779,6 +796,8 @@ test_evb_ve890_init(void)
int rc;
printk(KERN_INFO DRV_NAME ": entering %s\n", __func__);
+ reset_ve890();
+
rc = tlp_spidev_init();
if (rc < 0) {
printk(KERN_ERR DRV_NAME ": tlp_spidev_init failed (%d)\n", rc);
@@ -796,11 +815,16 @@ test_evb_ve890_init(void)
}
#ifdef AUDIO
- /* UGLY EVIL HACK -1 */
- xivo_tdm_register_port0_configured(
- xivovp.tdm_port,
- xivovp_port0_configured_cb,
- NULL);
+ if(wait_port0)
+ /* UGLY EVIL HACK -1 */
+ xivo_tdm_register_port0_configured(
+ xivovp.tdm_port,
+ xivovp_port0_configured_cb,
+ NULL);
+ else {
+ xivovp_port0_configured_cb(NULL);
+ xivovp_port0_started_cb(NULL);
+ }
return 0;
#else
@@ -832,9 +856,11 @@ xivovp_port0_configured_cb(void *data)
printk(KERN_ERR "%s START\n", __func__);
if ((rc = xivo_tdm_config_port(xivovp.tdm_port,
- LE89316_MEGREZ_PROTO_XIVO_CONFIG)) < 0) {
+ LE89316_ASYNC_MEGREZ_PROTO_XIVO_CONFIG))
+ < 0) {
printk(KERN_CRIT "%s: xivo_tdm_config_port returned %d\n",
__func__, rc);
+ msleep(999);
goto err_config_port;
}