From f02b476fee4a020f98482d25a79ce6f8ab020da9 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 20 Oct 2011 20:51:49 +0000 Subject: [PATCH] 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 --- drivers/dahdi/wctdm24xxp/base.c | 5 ----- include/dahdi/kernel.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 8fac337..51fea10 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -4401,11 +4401,6 @@ static const struct dahdi_span_ops wctdm24xxp_digital_span_ops = { #endif }; -static inline bool dahdi_is_digital_span(const struct dahdi_span *s) -{ - return (s->linecompat > 0); -} - static struct wctdm_chan * wctdm_init_chan(struct wctdm *wc, struct wctdm_span *s, int chanoffset, int channo, unsigned int card_position) 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);