aboutsummaryrefslogtreecommitdiffstats
path: root/include/openbsc/subchan_demux.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-01-05 19:00:01 +0000
committerHarald Welte <laforge@gnumonks.org>2009-01-05 19:00:01 +0000
commit54bd94d8b7cde19a40adebecf6e36a69400ca55c (patch)
tree3f62f1358e76998c0b06b88117d3b4d30c60cbdd /include/openbsc/subchan_demux.h
parentca362a602864c44389566824f16f6dde60f894ea (diff)
add (untested) 16kbit E1 sub-channel demux with TRAU frame sync
Diffstat (limited to 'include/openbsc/subchan_demux.h')
-rw-r--r--include/openbsc/subchan_demux.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/openbsc/subchan_demux.h b/include/openbsc/subchan_demux.h
new file mode 100644
index 000000000..024e94c78
--- /dev/null
+++ b/include/openbsc/subchan_demux.h
@@ -0,0 +1,46 @@
+#ifndef _SUBCH_DEMUX_H
+#define _SUBCH_DEMUX_H
+/* A E1 sub-channel demultiplexer with TRAU frame sync */
+
+/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <sys/types.h>
+
+#define NR_SUBCH 4
+#define TRAU_FRAME_SIZE 40
+#define TRAU_FRAME_BITS (TRAU_FRAME_SIZE*8)
+
+struct subch {
+ u_int8_t out_bitbuf[TRAU_FRAME_BITS];
+ u_int8_t out_idx; /* next bit to be written in out_bitbuf */
+};
+
+struct subch_demux {
+ u_int8_t chan_activ;
+ struct subch subch[NR_SUBCH];
+ int (*out_cb)(struct subch_demux *dmx, int ch, u_int8_t *data, int len,
+ void *);
+ void *data;
+};
+
+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);
+#endif /* _SUBCH_DEMUX_H */