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
This commit is contained in:
Shaun Ruffell 2011-10-20 20:51:49 +00:00
parent 4231523c2f
commit f02b476fee
2 changed files with 16 additions and 5 deletions

View File

@ -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)

View File

@ -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);