blob: 373cf4a301e80f5a9e44a820625404941f5c1c55 [file] [log] [blame]
Harald Welte54bd94d2009-01-05 19:00:01 +00001#ifndef _SUBCH_DEMUX_H
2#define _SUBCH_DEMUX_H
3/* A E1 sub-channel demultiplexer with TRAU frame sync */
4
5/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24#include <sys/types.h>
25
26#define NR_SUBCH 4
27#define TRAU_FRAME_SIZE 40
28#define TRAU_FRAME_BITS (TRAU_FRAME_SIZE*8)
29
30struct subch {
31 u_int8_t out_bitbuf[TRAU_FRAME_BITS];
32 u_int8_t out_idx; /* next bit to be written in out_bitbuf */
33};
34
35struct subch_demux {
36 u_int8_t chan_activ;
37 struct subch subch[NR_SUBCH];
38 int (*out_cb)(struct subch_demux *dmx, int ch, u_int8_t *data, int len,
39 void *);
40 void *data;
41};
42
Harald Weltece281c02009-01-05 20:14:14 +000043int subch_demux_init(struct subch_demux *dmx);
Harald Welte54bd94d2009-01-05 19:00:01 +000044int subch_demux_in(struct subch_demux *dmx, u_int8_t *data, int len);
45int subch_demux_activate(struct subch_demux *dmx, int subch);
46int subch_demux_deactivate(struct subch_demux *dmx, int subch);
47#endif /* _SUBCH_DEMUX_H */