diff options
author | Noe Rubinstein <nrubinstein@proformatique.com> | 2010-12-24 15:42:41 +0100 |
---|---|---|
committer | Noe Rubinstein <nrubinstein@proformatique.com> | 2010-12-24 15:42:41 +0100 |
commit | 7dc99874732a1336f62025cdfa8649b1c381b111 (patch) | |
tree | e486c3819136b8a8bf402d27c1e9baa2d33e1b86 /xivovp | |
parent | 85fd3be00b20552f8c8785f93e4dd25fe4669be6 (diff) |
merge xivovp with xilun's change
Diffstat (limited to 'xivovp')
-rw-r--r-- | xivovp/Kbuild | 2 | ||||
-rw-r--r-- | xivovp/base.c | 122 |
2 files changed, 82 insertions, 42 deletions
diff --git a/xivovp/Kbuild b/xivovp/Kbuild index 29991e3..a964926 100644 --- a/xivovp/Kbuild +++ b/xivovp/Kbuild @@ -2,7 +2,7 @@ VP_API ?= /bad__vp_api__not_set KSRC ?= /bad__ksrc__not_set DAHDI_INCLUDE ?= /bad__dahdi_include__not_set -CFLAGS_MODULE += -I$(DAHDI_INCLUDE) +CFLAGS_MODULE += -I$(DAHDI_INCLUDE) -I$(abspath $(src)/../) EXTRA_CFLAGS := -I$(VP_API)/arch/lkm \ -I$(VP_API)/api_lib/vp890_api/ \ diff --git a/xivovp/base.c b/xivovp/base.c index bb54224..01f771a 100644 --- a/xivovp/base.c +++ b/xivovp/base.c @@ -47,6 +47,12 @@ MODULE_PARM_DESC(traces_vanish, | VP_DBG_WARNING \ | VP_DBG_INFO) +static uint init_dbg = VP_DBG_ALL; + +module_param(init_dbg, uint, 0444); +MODULE_PARM_DESC(init_dbg, + "initial VP_API debug mask (default: " __stringify(VP_DBG_ALL) ")"); + enum xivovp_line_type { FXS_LINE = 0, FXO_LINE = 1 }; #define FXS_TIMESLOT (1) @@ -90,23 +96,13 @@ static struct xivovp { } xivovp; #ifdef AUDIO -static void xivovp_receive_and_transmit(void *data) +static void xivovp_txrx(void *data) { (void) data; - xivo_tdm_receive(xivovp.tdm_port, FXS_TIMESLOT, - xivovp.chans[FXS_LINE]->readchunk); - xivo_tdm_receive(xivovp.tdm_port, FXO_TIMESLOT, - xivovp.chans[FXO_LINE]->readchunk); - dahdi_receive(&xivovp.span); dahdi_transmit(&xivovp.span); dahdi_ec_span(&xivovp.span); - - xivo_tdm_transmit(xivovp.tdm_port, FXS_TIMESLOT, - xivovp.chans[FXS_LINE]->writechunk); - xivo_tdm_transmit(xivovp.tdm_port, FXO_TIMESLOT, - xivovp.chans[FXO_LINE]->writechunk); } #endif @@ -542,10 +538,6 @@ span_init(void) static int xivovp_init(void) { -#ifdef AUDIO - int rc; -#endif - init_timer(&xivovp.vp_tick_timer); xivovp.vp_tick_timer.function = vp_tick; xivovp.vp_tick_timer.data = 42; @@ -559,15 +551,6 @@ xivovp_init(void) printk(KERN_ERR "%s: could not get Ve890 TDM port\n", __func__); return -EIO; } - - if ((rc = xivo_tdm_config_port(xivovp.tdm_port, - LE89316_MEGREZ_PROTO_XIVO_CONFIG)) < 0) { - printk(KERN_ERR "%s: xivo_tdm_config_port returned %d\n", - __func__, rc); - xivo_tdm_put_port(xivovp.tdm_port); - xivovp.tdm_port = NULL; - return rc; - } #endif return 0; @@ -589,6 +572,12 @@ vp_init(void) { int rc; VpStatusType vpst; + uint32 debug_select; + + debug_select = init_dbg; + VpSetOption(NULL, NULL, VP_OPTION_ID_DEBUG_SELECT, &debug_select); + debug_select = init_dbg; + VpSetOption(NULL, NULL, VP_OPTION_ID_GLOBAL_DEBUG_SELECT, &debug_select); vpst = VpMakeDeviceObject( VP_DEV_890_SERIES, @@ -657,6 +646,10 @@ vp_init(void) #ifdef AUDIO /* process context */ static void +xivovp_port0_configured_cb(void *data); + +/* process context */ +static void xivovp_port0_started_cb(void *data); #endif @@ -676,11 +669,6 @@ test_evb_ve890_init(void) if (rc < 0) goto err_xivovp_init; - - rc = vp_init(); - if (rc < 0) - goto err_vp_init; - rc = span_init(); if (rc < 0) { printk(KERN_ERR DRV_NAME ": ve890_dahdi_init failed\n"); @@ -688,20 +676,25 @@ test_evb_ve890_init(void) } #ifdef AUDIO - /* UGLY EVIL HACK */ - xivo_tdm_register_port0_started( + /* UGLY EVIL HACK -1 */ + xivo_tdm_register_port0_configured( xivovp.tdm_port, - xivovp_port0_started_cb, + xivovp_port0_configured_cb, NULL); -#endif + + return 0; +#else + rc = vp_init(); + if (rc < 0) + goto err_vp_init; mod_timer(&xivovp.vp_tick_timer, jiffies + VP_TICK_JIFFIES); return 0; - err_dahdi_init: - /* nothing */ err_vp_init: +#endif + err_dahdi_init: xivovp_cleanup(); err_xivovp_init: tlp_spidev_exit(); @@ -710,19 +703,66 @@ test_evb_ve890_init(void) } #ifdef AUDIO +static void +xivovp_port0_configured_cb(void *data) +{ + int rc; + + printk(KERN_ERR "%s START\n", __func__); + + if ((rc = xivo_tdm_config_port(xivovp.tdm_port, + LE89316_MEGREZ_PROTO_XIVO_CONFIG)) < 0) { + printk(KERN_CRIT "%s: xivo_tdm_config_port returned %d\n", + __func__, rc); + goto err_config_port; + } + + rc = vp_init(); + if (rc < 0) + goto err_vp_init; + + /* UGLY EVIL HACK */ + xivo_tdm_register_port0_started( + xivovp.tdm_port, + xivovp_port0_started_cb, + NULL); + + mod_timer(&xivovp.vp_tick_timer, jiffies + VP_TICK_JIFFIES); + + printk(KERN_ERR "%s END\n", __func__); + return; + + err_vp_init: + err_config_port: + xivovp_cleanup(); + tlp_spidev_exit(); +} +#endif + +#ifdef AUDIO /* process context */ static void xivovp_port0_started_cb(void *data) { - struct xivo_tdm_tick_cb_struct tick_cb = { - .tick = xivovp_receive_and_transmit, - .tick_data = NULL, - }; + u8 **readchunk_ptrs[XIVO_TDM_TS_NUM] = { 0 }; + u8 **writechunk_ptrs[XIVO_TDM_TS_NUM] = { 0 }; + + printk(KERN_ERR "%s START\n", __func__); - printk(KERN_ERR "%s\n", __func__); + readchunk_ptrs[FXS_TIMESLOT] = &xivovp.chans[FXS_LINE]->readchunk; + writechunk_ptrs[FXS_TIMESLOT] = &xivovp.chans[FXS_LINE]->writechunk; + + readchunk_ptrs[FXO_TIMESLOT] = &xivovp.chans[FXO_LINE]->readchunk; + writechunk_ptrs[FXO_TIMESLOT] = &xivovp.chans[FXO_LINE]->writechunk; /* XXX */ (void) xivo_tdm_start_chans( - xivovp.tdm_port, TS_MASK, &tick_cb); + xivovp.tdm_port, + readchunk_ptrs, + writechunk_ptrs, + xivovp_txrx, + NULL); + + printk(KERN_ERR "%s END\n", __func__); } #endif |