add initializer function for subchan_demux

This commit is contained in:
Harald Welte 2009-01-05 20:14:14 +00:00
parent 418f5a4e25
commit ce281c0772
2 changed files with 14 additions and 0 deletions

View File

@ -40,6 +40,7 @@ struct subch_demux {
void *data;
};
int subch_demux_init(struct subch_demux *dmx);
int subch_demux_in(struct subch_demux *dmx, u_int8_t *data, int len);
int subch_demux_activate(struct subch_demux *dmx, int subch);
int subch_demux_deactivate(struct subch_demux *dmx, int subch);

View File

@ -92,6 +92,19 @@ static void resync_to_here(struct subch *sch)
sch->out_idx = SYNC_HDR_BITS;
}
int subch_demux_init(struct subch_demux *dmx)
{
int i;
dmx->chan_activ = 0;
for (i = 0; i < NR_SUBCH; i++) {
struct subch *sch = &dmx->subch[i];
sch->out_idx = 0;
memset(sch->out_bitbuf, 0xff, sizeof(sch->out_bitbuf));
}
return 0;
}
/* input some arbitrary (modulo 4) number of bytes of a 64k E1 channel,
* split it into the 16k subchannels */
int subch_demux_in(struct subch_demux *dmx, u_int8_t *data, int len)