[zaptel-commits] mattf: branch 1.4 r3242 - in /branches/1.4: ./ wctc4xxp/base.c
SVN commits to the Zaptel project
zaptel-commits at lists.digium.com
Wed Nov 21 16:51:26 CST 2007
Author: mattf
Date: Wed Nov 21 16:51:25 2007
New Revision: 3242
URL: http://svn.digium.com/view/zaptel?view=rev&rev=3242
Log:
Merged revisions 3241 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.2
........
r3241 | mattf | 2007-11-21 16:45:32 -0600 (Wed, 21 Nov 2007) | 1 line
Transcoder driver updates. Fixes G.723 no audio issues with latest drivers
........
Modified:
branches/1.4/ (props changed)
branches/1.4/wctc4xxp/base.c
Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Modified: branches/1.4/wctc4xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wctc4xxp/base.c?view=diff&rev=3242&r1=3241&r2=3242
==============================================================================
--- branches/1.4/wctc4xxp/base.c (original)
+++ branches/1.4/wctc4xxp/base.c Wed Nov 21 16:51:25 2007
@@ -313,12 +313,7 @@
else { \
ret = wcdte_waitfor_csmencaps(wc, RCV_CSMENCAPS, 0); \
if (wc->dsp_crashed) \
- { \
- printk("Aborting zt_send_cmd()\n"); \
return 1; \
- } \
- if ((ret == 2) && (wc->last_command_sent == 0x0010)) \
- printk("Detected timeout on 0x0010\n"); \
} \
if (ret == 1) \
return(1); \
@@ -444,12 +439,9 @@
static char *mode;
static int debug_packets = 0;
-static int wcdte_create_channel(struct wcdte *wc, int part1_id, int part2_id, unsigned int *dte_chan1, unsigned int *dte_chan2);
-static int wcdte_open_channel(struct wcdte *wc, int simple, int complicated, int part1_id, int part2_id, int chan1, int chan2);
+static int wcdte_create_channel(struct wcdte *wc, int simple, int complicated, int part1_id, int part2_id, unsigned int *dte_chan1, unsigned int *dte_chan2);
static int wcdte_destroy_channel(struct wcdte *wc, unsigned int chan1, unsigned int chan2);
-static int wcdte_close_channel(struct wcdte *wc, unsigned int chan1, unsigned int chan2);
static int __wcdte_setup_channels(struct wcdte *wc);
-static void wcdte_release(struct wcdte *wc);
static int __dump_descriptors(struct wcdte *wc)
{
@@ -702,34 +694,17 @@
int i = 0;
int res = 0;
unsigned int ipchksum, ndx;
-
switch(op) {
- case ZT_TCOP_ALLOCATE:
+ case ZT_TCOP_ALLOCATE:
down(&wc->chansem);
- if (ztc->chan_built == 0) {
- if (ztc->built_fmts == (zth->dstfmt | zth->srcfmt)) {
- ztc->chan_built = 1;
- st->ssrc += 1;
- } else {
- /* If channel is built for the wrong codecs, teardown and rebuild */
- if (st->encoder == 1) {
- if (st->chan_in_num != 999) {
- wcdte_close_channel(wc, st->chan_in_num, st->chan_out_num);
- wcdte_destroy_channel(wc, st->chan_in_num, st->chan_out_num);
- }
- wcdte_create_channel(wc, st->timeslot_in_num, st->timeslot_out_num, &(st->chan_in_num), &(st->chan_out_num));
- wcdte_open_channel(wc, wcdte_zapfmt_to_dtefmt(zth->srcfmt), wcdte_zapfmt_to_dtefmt(zth->dstfmt),
- st->timeslot_in_num, st->timeslot_out_num, st->chan_in_num, st->chan_out_num);
- } else {
- if (st->chan_in_num != 999) {
- wcdte_close_channel(wc, st->chan_out_num, st->chan_in_num);
- wcdte_destroy_channel(wc, st->chan_out_num, st->chan_in_num);
- }
- wcdte_create_channel(wc, st->timeslot_out_num, st->timeslot_in_num, &(st->chan_out_num), &(st->chan_in_num));
- wcdte_open_channel(wc, wcdte_zapfmt_to_dtefmt(zth->srcfmt), wcdte_zapfmt_to_dtefmt(zth->dstfmt),
- st->timeslot_out_num, st->timeslot_in_num, st->chan_out_num, st->chan_in_num);
- }
- }
+ if (ztc->chan_built == 0)
+ {
+ if (st->encoder == 1)
+ wcdte_create_channel(wc, wcdte_zapfmt_to_dtefmt(zth->srcfmt), wcdte_zapfmt_to_dtefmt(zth->dstfmt),
+ st->timeslot_in_num, st->timeslot_out_num, &(st->chan_in_num), &(st->chan_out_num));
+ else
+ wcdte_create_channel(wc, wcdte_zapfmt_to_dtefmt(zth->dstfmt), wcdte_zapfmt_to_dtefmt(zth->srcfmt),
+ st->timeslot_out_num, st->timeslot_in_num, &(st->chan_out_num), &(st->chan_in_num));
/* Mark this channel as built */
ztc->chan_built = 1;
ztc->built_fmts = zth->dstfmt | zth->srcfmt;
@@ -740,9 +715,9 @@
compl_ztc = &(wc->udecode->channels[ndx]);
else
compl_ztc = &(wc->uencode->channels[ndx]);
- compl_st = compl_ztc->pvt;
compl_ztc->chan_built = 1;
compl_ztc->built_fmts = zth->dstfmt | zth->srcfmt;
+ compl_st = compl_ztc->pvt;
compl_st->chan_in_num = st->chan_out_num;
compl_st->chan_out_num = st->chan_in_num;
}
@@ -757,15 +732,28 @@
else
compl_ztc = &(wc->uencode->channels[ndx]);
+ /* If the channel complement (other half of the encoder/decoder pair) is not being used... */
if ((compl_ztc->flags & ZT_TC_FLAG_BUSY) == 0)
- {
+ {
+ if (st->encoder == 1)
+ wcdte_destroy_channel(wc, st->chan_in_num, st->chan_out_num);
+ else
+ wcdte_destroy_channel(wc, st->chan_out_num, st->chan_in_num);
+
/* Mark this channel as not built */
ztc->chan_built = 0;
-
+ ztc->built_fmts = 0;
+ st->chan_in_num = 999;
+ st->chan_out_num = 999;
+
/* Mark the channel complement as not built */
compl_ztc->chan_built = 0;
- }
-
+ compl_ztc->built_fmts = 0;
+ compl_st = compl_ztc->pvt;
+ compl_st->chan_in_num = 999;
+ compl_st->chan_out_num = 999;
+ }
+ st->dte_seqno_rcv = 0;
up(&wc->chansem);
break;
case ZT_TCOP_TRANSCODE:
@@ -1114,6 +1102,9 @@
}
+
+
+
/* static inline int wcdte_check_descriptor(struct wcdte *wc) */
static int wcdte_check_descriptor(struct wcdte *wc)
{
@@ -1529,30 +1520,10 @@
return(0);
}
-
-static int wcdte_create_channel(struct wcdte *wc, int part1_id, int part2_id, unsigned int *dte_chan1, unsigned int *dte_chan2)
-{
+static int wcdte_create_channel(struct wcdte *wc, int simple, int complicated, int part1_id, int part2_id, unsigned int *dte_chan1, unsigned int *dte_chan2)
+{
+ int length = 0;
unsigned char chan1, chan2;
-
- /* Create complex channel */
- zt_send_cmd(wc, CMD_MSG_CREATE_CHANNEL(wc->seq_num++, part1_id), CMD_MSG_CREATE_CHANNEL_LEN, 0x0010);
- zt_send_cmd(wc, CMD_MSG_QUERY_CHANNEL(wc->seq_num++, part1_id), CMD_MSG_QUERY_CHANNEL_LEN, 0x0010);
- chan1 = wc->last_rparm1;
-
- /* Create simple channel */
- zt_send_cmd(wc, CMD_MSG_CREATE_CHANNEL(wc->seq_num++, part2_id), CMD_MSG_CREATE_CHANNEL_LEN, 0x0010);
- zt_send_cmd(wc, CMD_MSG_QUERY_CHANNEL(wc->seq_num++, part2_id), CMD_MSG_QUERY_CHANNEL_LEN, 0x0010);
- chan2 = wc->last_rparm1;
-
- *dte_chan1 = chan1;
- *dte_chan2 = chan2;
-
- return 0;
-}
-
-static int wcdte_open_channel(struct wcdte *wc, int simple, int complicated, int part1_id, int part2_id, int chan1, int chan2)
-{
- int length = 0;
struct zt_transcoder_channel *ztc1, *ztc2;
struct dte_state *st1, *st2;
if(complicated == DTE_FORMAT_G729A)
@@ -1560,15 +1531,20 @@
else if (complicated == DTE_FORMAT_G723_1)
length = G723_LENGTH;
+ /* Create complex channel */
+ zt_send_cmd(wc, CMD_MSG_CREATE_CHANNEL(wc->seq_num++, part1_id), CMD_MSG_CREATE_CHANNEL_LEN, 0x0010);
+ zt_send_cmd(wc, CMD_MSG_QUERY_CHANNEL(wc->seq_num++, part1_id), CMD_MSG_QUERY_CHANNEL_LEN, 0x0010);
+ chan1 = wc->last_rparm1;
+
+ /* Create simple channel */
+ zt_send_cmd(wc, CMD_MSG_CREATE_CHANNEL(wc->seq_num++, part2_id), CMD_MSG_CREATE_CHANNEL_LEN, 0x0010);
+ zt_send_cmd(wc, CMD_MSG_QUERY_CHANNEL(wc->seq_num++, part2_id), CMD_MSG_QUERY_CHANNEL_LEN, 0x0010);
+ chan2 = wc->last_rparm1;
+
ztc1 = &(wc->uencode->channels[part1_id/2]);
ztc2 = &(wc->udecode->channels[part2_id/2]);
st1 = ztc1->pvt;
st2 = ztc2->pvt;
-
- if (force_alert) {
- printk("Sending FORCE ALERT\n");
- zt_send_cmd(wc, CMD_MSG_FORCE_ALERT(wc->seq_num++), CMD_MSG_FORCE_ALERT_LEN, 0xFFFF);
- }
/* Configure complex channel */
zt_send_cmd(wc, CMD_MSG_SET_IP_HDR_CHANNEL(st1->cmd_seqno++, chan1, part2_id, part1_id), CMD_MSG_SET_IP_HDR_CHANNEL_LEN, 0x9000);
@@ -1591,19 +1567,13 @@
zt_send_cmd(wc, CMD_MSG_VOIP_VOPENA(st1->cmd_seqno++, chan1, complicated), CMD_MSG_VOIP_VOPENA_LEN, 0x8000);
zt_send_cmd(wc, CMD_MSG_VOIP_VOPENA(st2->cmd_seqno++, chan2, simple), CMD_MSG_VOIP_VOPENA_LEN, 0x8000);
- return 0;
+ *dte_chan1 = chan1;
+ *dte_chan2 = chan2;
+
+ return 1;
}
static int wcdte_destroy_channel(struct wcdte *wc, unsigned int chan1, unsigned int chan2)
-{
- /* Remove the channels */
- zt_send_cmd(wc, CMD_MSG_DESTROY_CHANNEL(wc->seq_num++, chan1), CMD_MSG_DESTROY_CHANNEL_LEN, 0x0011);
- zt_send_cmd(wc, CMD_MSG_DESTROY_CHANNEL(wc->seq_num++, chan2), CMD_MSG_DESTROY_CHANNEL_LEN, 0x0011);
-
- return 0;
-}
-
-static int wcdte_close_channel(struct wcdte *wc, unsigned int chan1, unsigned int chan2)
{
struct zt_transcoder_channel *ztc1, *ztc2;
struct dte_state *st1, *st2;
@@ -1620,7 +1590,11 @@
/* Disconnect the channels */
zt_send_cmd(wc, CMD_MSG_TRANS_CONNECT(wc->seq_num++, 0, chan1, chan2, 0, 0), CMD_MSG_TRANS_CONNECT_LEN, 0x9322);
- return 0;
+ /* Remove the channels */
+ zt_send_cmd(wc, CMD_MSG_DESTROY_CHANNEL(wc->seq_num++, chan1), CMD_MSG_DESTROY_CHANNEL_LEN, 0x0011);
+ zt_send_cmd(wc, CMD_MSG_DESTROY_CHANNEL(wc->seq_num++, chan2), CMD_MSG_DESTROY_CHANNEL_LEN, 0x0011);
+
+ return 1;
}
More information about the zaptel-commits
mailing list