diff options
author | Harald Welte <laforge@gnumonks.org> | 2009-01-05 20:14:14 +0000 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2009-01-05 20:14:14 +0000 |
commit | ce281c07723864ee8b7bdf846eba45798440382e (patch) | |
tree | 22352d1dddf909acb79ce9034d8bf0102115c9cd | |
parent | 418f5a4e2562a54fae2aa02c0c9c4c082515b773 (diff) |
add initializer function for subchan_demux
-rw-r--r-- | include/openbsc/subchan_demux.h | 1 | ||||
-rw-r--r-- | src/subchan_demux.c | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/openbsc/subchan_demux.h b/include/openbsc/subchan_demux.h index 024e94c78..373cf4a30 100644 --- a/include/openbsc/subchan_demux.h +++ b/include/openbsc/subchan_demux.h @@ -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); diff --git a/src/subchan_demux.c b/src/subchan_demux.c index 34a5af010..da1b09072 100644 --- a/src/subchan_demux.c +++ b/src/subchan_demux.c @@ -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) |