From c86c8924bf1f9e23f8e4e70401feedbaedb47920 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Mon, 4 Apr 2011 16:25:23 +0000 Subject: dahdi: Add in-hardirq versions of the dahdi_receive/transmit/ec_span. Since cli/sti are expensive instructions, if the board drivers are calling receive/transmit/ec_span from interrupt context all local interrupts do not need to be disabled. The board drivers all still use the normal dahdi_receive and dahdi_transmit. _dahdi_receive and _dahdi_transmit are the "in-hardirq" versions of those functions. Signed-off-by: Shaun Ruffell Acked-by: Michael Spiceland Acked-by: Kinsey Moore git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9884 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- include/dahdi/kernel.h | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index c289429..5b04918 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -1048,12 +1048,32 @@ int dahdi_dynamic_register_driver(struct dahdi_dynamic_driver *driver); /*! \brief Unregister a dynamic driver */ void dahdi_dynamic_unregister_driver(struct dahdi_dynamic_driver *driver); +int _dahdi_receive(struct dahdi_span *span); + /*! Receive on a span. The DAHDI interface will handle all the calculations for all member channels of the span, pulling the data from the readchunk buffer */ -int dahdi_receive(struct dahdi_span *span); +static inline int dahdi_receive(struct dahdi_span *span) +{ + unsigned long flags; + int ret; + local_irq_save(flags); + ret = _dahdi_receive(span); + local_irq_restore(flags); + return ret; +} + +int _dahdi_transmit(struct dahdi_span *span); /*! Prepare writechunk buffers on all channels for this span */ -int dahdi_transmit(struct dahdi_span *span); +static inline int dahdi_transmit(struct dahdi_span *span) +{ + unsigned long flags; + int ret; + local_irq_save(flags); + ret = _dahdi_transmit(span); + local_irq_restore(flags); + return ret; +} /*! Abort the buffer currently being receive with event "event" */ void dahdi_hdlc_abort(struct dahdi_chan *ss, int event); @@ -1122,9 +1142,26 @@ struct dahdi_tone *dahdi_mf_tone(const struct dahdi_chan *chan, char digit, int as possible. ECHO CANCELLATION IS NO LONGER AUTOMATICALLY DONE AT THE DAHDI LEVEL. dahdi_ec_chunk will not echo cancel if it should not be doing so. rxchunk is modified in-place */ +void _dahdi_ec_chunk(struct dahdi_chan *chan, unsigned char *rxchunk, + const unsigned char *txchunk); -void dahdi_ec_chunk(struct dahdi_chan *chan, unsigned char *rxchunk, const unsigned char *txchunk); -void dahdi_ec_span(struct dahdi_span *span); +static inline void dahdi_ec_chunk(struct dahdi_chan *ss, unsigned char *rxchunk, + const unsigned char *txchunk) +{ + unsigned long flags; + local_irq_save(flags); + _dahdi_ec_chunk(ss, rxchunk, txchunk); + local_irq_restore(flags); +} + +void _dahdi_ec_span(struct dahdi_span *span); +static inline void dahdi_ec_span(struct dahdi_span *span) +{ + unsigned long flags; + local_irq_save(flags); + _dahdi_ec_span(span); + local_irq_restore(flags); +} extern struct file_operations *dahdi_transcode_fops; -- cgit v1.2.3