summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-10-20 20:51:49 +0000
committerShaun Ruffell <sruffell@digium.com>2011-10-20 20:51:49 +0000
commitccc215c8d2d79c305e183bdebd383f0906364ea5 (patch)
tree027ffd5ad564378890bfa460022df7060f643c55 /include
parent1df225349a35063c90eb5a3a28858bce31e9b62b (diff)
dahdi: Add functions for determining spantype (E1/T1) to include/dahdi/kernel.h
Uses the linecompat member to determine what type of span it is. This will allow removing T1/E1 flags from other places where the span type is stored. This function also changes the return value from bool to int for the inlines defined in include/dahdi/kernel.h. This is because not all kernel versions include stdbool.h in the headers and it will conflict with boolean values that are exported via module parameters on some older kernels if dahdi included it globally. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Acked-by: Michael Spiceland <mspiceland@digium.com> Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10227 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'include')
-rw-r--r--include/dahdi/kernel.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index e2403c1..c392e64 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -1101,6 +1101,22 @@ static inline int dahdi_transmit(struct dahdi_span *span)
return ret;
}
+static inline int dahdi_is_digital_span(const struct dahdi_span *s)
+{
+ return (s->linecompat > 0);
+}
+
+static inline int dahdi_is_t1_span(const struct dahdi_span *s)
+{
+ return (s->linecompat & (DAHDI_CONFIG_D4 | DAHDI_CONFIG_ESF |
+ DAHDI_CONFIG_B8ZS)) > 0;
+}
+
+static inline int dahdi_is_e1_span(const struct dahdi_span *s)
+{
+ return dahdi_is_digital_span(s) && !dahdi_is_t1_span(s);
+}
+
/*! Abort the buffer currently being receive with event "event" */
void dahdi_hdlc_abort(struct dahdi_chan *ss, int event);