This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/19070 ) Change subject: move flib_buf_bits() from DAHDI to shared flip.c ...................................................................... move flib_buf_bits() from DAHDI to shared flip.c Change-Id: I8c6dc3eea921a73ebe65540aad0f0c0584d47e5a --- M src/Makefile.am A src/flip.c A src/flip.h M src/input/dahdi.c M src/input/e1d.c 5 files changed, 36 insertions(+), 27 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/70/19070/1 diff --git a/src/Makefile.am b/src/Makefile.am index 4254428..dae7e6e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,6 +16,7 @@ libosmoabis_la_SOURCES = init.c \ e1_input.c \ e1_input_vty.c \ + flip.c \ ipa_proxy.c \ subchan_demux.c \ trau_frame.c \ diff --git a/src/flip.c b/src/flip.c new file mode 100644 index 0000000..502503d --- /dev/null +++ b/src/flip.c @@ -0,0 +1,28 @@ +#include "flip.h" + +static uint8_t flip_table[256]; + +void init_flip_bits(void) +{ + int i,k; + + for (i = 0 ; i < 256 ; i++) { + uint8_t sample = 0 ; + for (k = 0; k<8; k++) { + if ( i & 1 << k ) sample |= 0x80 >> k; + } + flip_table[i] = sample; + } +} + +uint8_t *flip_buf_bits (uint8_t *buf , int len) +{ + int i; + uint8_t * start = buf; + + for (i = 0 ; i < len; i++) { + buf[i] = flip_table[(uint8_t)buf[i]]; + } + + return start; +} diff --git a/src/flip.h b/src/flip.h new file mode 100644 index 0000000..29b0178 --- /dev/null +++ b/src/flip.h @@ -0,0 +1,5 @@ +#pragma once +#include <stdint.h> + +void init_flip_bits(void); +uint8_t *flip_buf_bits(uint8_t *buf, int len); diff --git a/src/input/dahdi.c b/src/input/dahdi.c index 075b7ff..80a4042 100644 --- a/src/input/dahdi.c +++ b/src/input/dahdi.c @@ -25,6 +25,7 @@ */ #include "config.h" +#include "flip.h" #include <stdio.h> #include <unistd.h> @@ -311,33 +312,6 @@ static int invertbits = 1; -static uint8_t flip_table[256]; - -static void init_flip_bits(void) -{ - int i,k; - - for (i = 0 ; i < 256 ; i++) { - uint8_t sample = 0 ; - for (k = 0; k<8; k++) { - if ( i & 1 << k ) sample |= 0x80 >> k; - } - flip_table[i] = sample; - } -} - -static uint8_t * flip_buf_bits ( uint8_t * buf , int len) -{ - int i; - uint8_t * start = buf; - - for (i = 0 ; i < len; i++) { - buf[i] = flip_table[(uint8_t)buf[i]]; - } - - return start; -} - #define D_BCHAN_TX_GRAN 160 /* write to a B channel TS */ static int handle_tsX_write(struct osmo_fd *bfd) diff --git a/src/input/e1d.c b/src/input/e1d.c index 627fc52..f23f631 100644 --- a/src/input/e1d.c +++ b/src/input/e1d.c @@ -23,6 +23,7 @@ */ #include "config.h" +#include "flip.h" #ifdef HAVE_E1D -- To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/19070 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-abis Gerrit-Branch: master Gerrit-Change-Id: I8c6dc3eea921a73ebe65540aad0f0c0584d47e5a Gerrit-Change-Number: 19070 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200630/c185b307/attachment.htm>