From ccc215c8d2d79c305e183bdebd383f0906364ea5 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 20 Oct 2011 20:51:49 +0000 Subject: 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 Acked-by: Michael Spiceland Acked-by: Russ Meyerriecks git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10227 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- include/dahdi/kernel.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include') 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); -- cgit v1.2.3