diff options
Diffstat (limited to 'drivers/dahdi/zaphfc/fifo.h')
-rw-r--r-- | drivers/dahdi/zaphfc/fifo.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/dahdi/zaphfc/fifo.h b/drivers/dahdi/zaphfc/fifo.h index 08edb1e..1866f30 100644 --- a/drivers/dahdi/zaphfc/fifo.h +++ b/drivers/dahdi/zaphfc/fifo.h @@ -1,10 +1,10 @@ /* - * zaphfc.c - Zaptel driver for HFC-S PCI A based ISDN BRI cards + * fifo.h - Dahdi driver for HFC-S PCI A based ISDN BRI cards * * Copyright (C) 2004 Daniele Orlandi * Copyright (C) 2002, 2003, 2004, Junghanns.NET GmbH * - * Daniele "Vihai" Orlandi <daniele@orlandi.com> + * Daniele "Vihai" Orlandi <daniele@orlandi.com> * * Major rewrite of the driver made by * Klaus-Peter Junghanns <kpj@junghanns.net> @@ -41,7 +41,9 @@ static inline u16 *Z2_F2(struct hfc_chan_simplex *chan) static inline u16 Z_inc(struct hfc_chan_simplex *chan, u16 z, u16 inc) { - // declared as u32 in order to manage overflows + /* + * declared as u32 in order to manage overflows + */ u32 newz = z + inc; if (newz > chan->z_max) newz -= chan->fifo_size; @@ -51,7 +53,9 @@ static inline u16 Z_inc(struct hfc_chan_simplex *chan, u16 z, u16 inc) static inline u8 F_inc(struct hfc_chan_simplex *chan, u8 f, u8 inc) { - // declared as u16 in order to manage overflows + /* + * declared as u16 in order to manage overflows + */ u16 newf = f + inc; if (newf > chan->f_max) newf -= chan->f_num; @@ -61,15 +65,18 @@ static inline u8 F_inc(struct hfc_chan_simplex *chan, u8 f, u8 inc) static inline u16 hfc_fifo_used_rx(struct hfc_chan_simplex *chan) { - return (*Z1_F2(chan) - *Z2_F2(chan) + chan->fifo_size) % chan->fifo_size; + return (*Z1_F2(chan) - *Z2_F2(chan) + + chan->fifo_size) % chan->fifo_size; } static inline u16 hfc_fifo_get_frame_size(struct hfc_chan_simplex *chan) { - // This +1 is needed because in frame mode the available bytes are Z2-Z1+1 - // while in transparent mode I wouldn't consider the byte pointed by Z2 to - // be available, otherwise, the FIFO would always contain one byte, even - // when Z1==Z2 + /* + * This +1 is needed because in frame mode the available bytes are Z2-Z1+1 + * while in transparent mode I wouldn't consider the byte pointed by Z2 to + * be available, otherwise, the FIFO would always contain one byte, even + * when Z1==Z2 + */ return hfc_fifo_used_rx(chan) + 1; } @@ -81,12 +88,13 @@ static inline u8 hfc_fifo_u8(struct hfc_chan_simplex *chan, u16 z) static inline u16 hfc_fifo_used_tx(struct hfc_chan_simplex *chan) { - return (*Z1_F1(chan) - *Z2_F1(chan) + chan->fifo_size) % chan->fifo_size; + return (*Z1_F1(chan) - *Z2_F1(chan) + + chan->fifo_size) % chan->fifo_size; } static inline u16 hfc_fifo_free_rx(struct hfc_chan_simplex *chan) { - u16 free_bytes=*Z2_F1(chan) - *Z1_F1(chan); + u16 free_bytes = *Z2_F1(chan) - *Z1_F1(chan); if (free_bytes > 0) return free_bytes; @@ -96,7 +104,7 @@ static inline u16 hfc_fifo_free_rx(struct hfc_chan_simplex *chan) static inline u16 hfc_fifo_free_tx(struct hfc_chan_simplex *chan) { - u16 free_bytes=*Z2_F1(chan) - *Z1_F1(chan); + u16 free_bytes = *Z2_F1(chan) - *Z1_F1(chan); if (free_bytes > 0) return free_bytes; |