Commit Graph

2050 Commits

Author SHA1 Message Date
Harald Welte 3f066dde8f Update L3 protocol discriminator definitions
Change-Id: Ia699d3494b93b7f88c36338e4960b35c42a29b9c
2017-06-09 08:49:13 +00:00
Harald Welte 6789ba35a6 osmo_{fr,hr}_check_sid(): Use const input argument
Change-Id: If779cce63f06a18d4f3b0cb3d6dd7a99aa52a646
2017-06-09 08:17:38 +00:00
Jean-Francois Dionne 43058efa93 Fix wrongful GSM FR codec SID frame detection in DTX.
Based on ETSI TS 101 318 section 5.1.2 the 95 bits SID code word
is not detected correctly due to a wrongful offset in the bits
location indexes.

Change-Id: I45d98c6edf267f313883503a65385190ffbc65ca
2017-06-09 08:14:18 +00:00
Harald Welte 3851e8ea7a introduce proper test case for GSM FR detection
our code is actually wrong, so let's skip the test until the fix is
applied in a follow-up patch.

Change-Id: I710c7871f959671deb3d18ab9062588f3056fd7c
2017-06-09 08:10:03 +00:00
Vadim Yanitskiy 0d49f47aeb core/conv: do not mix up AVX and SSE code
According to GCC's wiki:

If you specify command-line switches such as -msse, the compiler
could use the extended instruction sets even if the built-ins are
not used explicitly in the program. For this reason, applications
that perform run-time CPU detection must compile separate files
for each supported architecture, using the appropriate flags. In
particular, the file containing the CPU detection code should be
compiled without these options.

So, this change introduces a separate Viterbi implementation,
which is almost the same as previous one, but is being compiled
with -mavx2. This implementation will be only used by CPUs with
both SSE and AVX support:

SSE3 and AVX2: viterbi_sse_avx.c
SSE3 only: viterbi_sse.c
Generic: viterbi_generic.c

Change-Id: I042cc76258df7e4c6c90a73af3d0a6e75999b2b0
2017-05-29 14:07:25 +00:00
Vadim Yanitskiy b51d51b29c core/conv: rename viterbi_gen.c to viterbi_generic.c
Let's avoid confusion with generated files which have
ending with _gen.* as well.

Change-Id: I3ecd8f9e73c05236f2cdc186f58b3d0ba552283f
2017-05-29 20:15:34 +07:00
Pau Espin 75989e677d socket: Add osmo_sock_init2_ofd() function
Will be used by osmo-bts-trx

Change-Id: I3c655a4af64fb80497a5aaa811cce8005dba9cd9
2017-05-26 12:56:07 +02:00
blobb cd8e7a46b6 Introduce build script for arm-none-eabi cross-compilations
This is a necessary step to use libosmocore-arm dep in OsmocomBB.

After this patch is submitted the "./contrib/jenkins.sh" line in
libosmocore jenkins jobs [1][2] needs to be replaced with:

  if [[ "$JOB_NAME" == *"arch=arm-none-eabi,label=linux_amd64_debian8"* ]]
  then
    ./contrib/jenkins-arm.sh
  else
    # (FreeBSD && debian8)_amd64 builds
    ./contrib/jenkins.sh
  fi

Furthermore, the "arch" matrix-build axis has to be created,
holding "arm-none-eabi" and "amd64". Following combination filter 
is necessary to skip cross-compilations on FreeBSD buildslave:

  !(arch=="arm-none-eabi" && label=="FreeBSD_amd64")

[1] https://jenkins.osmocom.org/jenkins/job/libosmocore/
[2] https://jenkins.osmocom.org/jenkins/job/libosmocore-gerrit/

Change-Id: I0db83ad2c94ada65c00fd1bcf867830dec80085d
2017-05-26 09:05:11 +00:00
blobb 2d899a0157 Revert "Introduce build script for arm-none-eabi cross-compilations"
"--enable-sanitize" does not work on jenkins build slave (debian8), although it worked out locally for me.

Following patch will introduce corrected arm build script without "--enable-sanitize" option:

https://gerrit.osmocom.org/#/c/2742/  

This reverts commit ba58167e1b.

Change-Id: I644114679db1394e75ff12b0203ae8e568aff82c
2017-05-26 08:38:27 +00:00
blobb ba58167e1b Introduce build script for arm-none-eabi cross-compilations
This is a necessary step to use libosmocore-arm dep in OsmocomBB.

After this patch is submitted the "./contrib/jenkins.sh" line in
libosmocore jenkins jobs [1][2] needs to be replaced with:

  if [[ "$JOB_NAME" == *"arch=arm-none-eabi,label=linux_amd64_debian8"* ]]
  then
    ./contrib/jenkins-arm.sh
  else
    # (FreeBSD && debian8)_amd64 builds
    ./contrib/jenkins.sh
  fi

Furthermore, the "arch" matrix-build axis has to be created,
holding "arm-none-eabi". Following combination filter is
necessary to skip cross-compilations on FreeBSD buildslave:

  !(arch=="arm-none-eabi" && label=="FreeBSD_amd64")

[1] https://jenkins.osmocom.org/jenkins/job/libosmocore/
[2] https://jenkins.osmocom.org/jenkins/job/libosmocore-gerrit/

Change-Id: I9e07fb9e60830dbd585f22d9c658c46252ce399f
2017-05-25 00:06:07 +00:00
Max 54ca30c8d3 Add human-readable names for signal_ns
Change-Id: Id664355eb8305fb287e4dae0800fb20dc2f9b8cd
Related: SYS#3610
2017-05-24 22:13:14 +00:00
Max c8cf820595 Distinguish between unsupported and invalid MCS
Previously MCS0 was incorrectly set for some of type1 header values
while according to 3GPP TS 44.060 it can only be set for type3. Fix
this:

* use EGPRS_MCS* constants instead of magic values
* do not set MCS0 for reserved bits values in EGPRS header type1
* return different error codes for invalid and unsupported MCS as well
  as for other decoding errors

Note: there's no need to adjust tests because MCS0 decoding is not
supported but it's better to explicitly distinguish between unsupported
and invalid values nevertheless.

Change-Id: Id665d5c0cf50efa18b1bcbf4f17359418a380f9e
Related: OS#1524
2017-05-24 22:12:56 +00:00
Tom Tsou 34e228a9bc core/conv: add x86 SSE support for Viterbi decoder
Fast convolutional decoding is provided through x86 intrinsic based
SSE operations. SSE3, found on virtually all modern x86 processors,
is the minimal requirement. SSE4.1 and AVX2 are used if available.

Also, the original code was extended with runtime SIMD detection,
so only supported extensions will be used by target CPU. It makes
the library more partable, what is very important for binary
packages distribution. Runtime SIMD detection is currently
implemented through the __builtin_cpu_supports call.

Change-Id: I1da6d71ed0564f1d684f3a836e998d09de5f0351
2017-05-24 22:04:53 +00:00
Vadim Yanitskiy b6c8dda5e3 tests/Makefile.am: do not test disabled features
Compiling tests for disabled features breaks build.

Change-Id: Iebcc24b493092a5a8e3561d7642a0b4608a8beae
2017-05-18 23:59:02 +03:00
Harald Welte 1d604d8be4 src/select.c: Don't #include <sys/select.h> if it doesn't exist
We have to #include <sys/select.h> inside the block protected by
HAVE_SYS_SELECT_H, otherwise it will fail on (embedded) builds where
that file doesn't exist, such as the arm-none-eabi target on Debian
stable and Ubuntu 16.04.

Change-Id: I82a2dcbc55b6ee0e914881c5e09b80506c5de4f2
2017-05-17 15:32:35 +01:00
Harald Welte 898ffefde4 add libpseudotalloc as super-simplistic talloc replacement
In tightly embedded builds (--enable-embedded), we want the ability to
replace talloc with a very simple heap allocator to avoid the complexity
of talloc without modifying all our code that assumes talloc.

This will break the hierarchical notion of the allocator, but
libosmo{core,gsm,coding,codec} don't rely on that anyway.

Change-Id: Ie341034076f242a813f081919dd09d845775ad35
2017-05-17 15:15:52 +01:00
Harald Welte 7f24c155f5 gitignore: Update with new *_gen.c files and generic 'tags'
Change-Id: I6e9df474b4d93e6e20c6d19ac9ffab5b7b959143
2017-05-17 15:15:09 +01:00
Harald Welte 7711713b7a sercomm: More API documentation
Change-Id: I5d5002ceedd10e10d772693478f4f9cab6b1290a
2017-05-17 15:15:09 +01:00
Harald Welte 799bef5cf6 sercomm: Better integration of driver interface
We cannot assume a certain UART API like uart_baudrate() which only
exists in OsmocomBB.  Rather, use generic function prototypes
(sercomm_drv_*) which are to be provided by the application /
environment to the sercomm core.

Change-Id: I01ea3067baf1791000c1a7d537ccce496a1ab1ee
2017-05-17 15:15:09 +01:00
Harald Welte a362ee90b4 add sercomm unit test
Change-Id: I9e2e7fcda28e7c6844d5faa09e02acf537cea44d
2017-05-17 15:15:09 +01:00
Harald Welte 7af6d22a4e sercomm: Include in libosmocore Makefile
Change-Id: If9d50d634381f43b2c67b97fea36a462a66e4559
2017-05-17 15:15:09 +01:00
Harald Welte fe71ee9d99 src/panic.c: Remove unneeded #include of gsm_utils.h
Change-Id: I25cea5d3a4a900550e8f18c2bea392e642bfb191
2017-05-17 15:15:09 +01:00
Harald Welte df8e89f066 sercomm: Rename sercomm_lock() to sercomm_drv_lock()
The user of the code is supposed to provide a "driver" implementing
those calls according to the specific target architecture/hardware.
This only applies to non-host (i.e. embedded) builds

Change-Id: I9a6848f23b70fc32f4de10149d857374f76f000d
2017-05-17 15:15:09 +01:00
Harald Welte 1d640889df sercomm: remove unrequired helper functions
osmo_sercomm_{bind,get}_uart() are not really needed anymore, as
sercomm_inst is public and thus the user can access the uart_id member
directly.

Change-Id: I6d57709c3764036046202f16a26c9eb87426c8d1
2017-05-17 15:15:09 +01:00
Harald Welte 8a4eb837ab sercomm: Move HDLC related defines into C file
Those values are not relevant to the sercomm user, only to the
implementation and thus can remain inside sercomm.c

Change-Id: I5700a45985b7c119c6338932171aae62ee4e2d22
2017-05-17 15:15:09 +01:00
Harald Welte ea3d3ba595 sercomm: Add doxygen-style documentation to public API
Change-Id: I2d8b11905692920d328262836420f01305be489e
2017-05-17 15:15:09 +01:00
Harald Welte 1a97e2c962 sercomm: include header file from osmocom/core
Change-Id: Iff5ff3a51d7781bcfb3aff0839b733bc7a71b7e5
2017-05-17 10:46:40 +00:00
Harald Welte f6adcd7dd6 sercomm: make rx msg size configurable per instance
Change-Id: I835506e26e83232e1e7290c0da04d389c8d7fb40
2017-05-17 10:46:40 +00:00
Harald Welte 1358836282 sercomm: introduce osmo_ naming prefix in struct and function names
Change-Id: If4e22f182a47b72b1fe43146716a4fbccceb62e6
2017-05-17 10:46:40 +00:00
Harald Welte cc95f4b06d sercomm: Enable multiple instances of 'sercomm'
Rather than having one global instance, let's permit multiple instances
of sercomm to co-exist, with all API functions extended by the instance
as first argument.

Change-Id: I0f3b53f464b119d65747bcb0be0af2d631e1cc05
2017-05-17 10:46:39 +00:00
Harald Welte c68af6a64b Import sercomm.c from osmocom-bb
This imports the file src/target/firmware/comm/sercomm.c from
osmocom-bb.git without introducing any modifications.  It will not even
be built yet, as Makefile integration is intentionally left until it has
been adapted to work inside libosmocore.

Change-Id: I9ee199381c7b5986a9540d124836cdddd0f66c86
2017-05-17 10:46:39 +00:00
Vadim Yanitskiy 1cd9991cf6 utils/osmo-sim-test.c: strip unused variables
Change-Id: Id577d9df5a814ad5aa00e1d04c4790d75d17ad7e
2017-05-17 10:15:09 +00:00
Vadim Yanitskiy 4c3e4ea305 gsm/gsm0411_smr.c: strip unused variable
Change-Id: I53f69913907588c45a9661c4e86e1bfb57a2418f
2017-05-17 10:15:09 +00:00
Philipp Maier 18d49d694f l1sap: Add frame-number to measurement indication struct
The distribution of the channel measurement calculations over
multiple timeslots (continous calculation) requires to keep
track of the frame number in struct info_meas_ind_param

Change-Id: I8c783b4a92ae2c3cc5d17936a146eb49d47eac37
2017-05-17 09:08:15 +00:00
Harald Welte 0047602435 timer: use timerclear() rather than explicit tv_set = tv_usec = 0
Change-Id: I2735fc8d19fd68ef2c14a31e83cb396dc2e05587
2017-05-15 19:00:43 +02:00
Harald Welte 67bdd80a96 stats: Disable stats*.c on embedded targets
Change-Id: I6beb4fcc394ed7d3f8dd7a097b6e998245ecf401
2017-05-15 19:00:40 +02:00
Vadim Yanitskiy ac9e2d8aa5 gsm/tlv.h: fix copy-paste error
Change-Id: Id52ddd8358fd4af1ecc71142deb09f1e237021f3
2017-05-15 12:51:15 +00:00
Vadim Yanitskiy 35b54d12bb fsm_test.c: fix unreachable check
Change-Id: Ic3d5da00f7ece6dbcd4c999187a5748c9331e60f
2017-05-15 12:51:15 +00:00
Harald Welte a5bb2b9586 strrb: Add missing #include to talloc.h
The strrb.c code uses talloc API without using the proper #include.

Change-Id: I4ac485324f40545339d8df6884f1dea319a23648
2017-05-15 13:42:03 +02:00
Harald Welte 20725b9eea gsm0808 + ipa: fix compilation on systems without sys/socket.h
Change-Id: I60f5d4982cd96ab29f9924ec11b46bf56fbfc346
2017-05-15 13:42:03 +02:00
Harald Welte bfe62e5781 libosmogb: Convert to use new endian conversion helpers
Change-Id: I5ed17702cd9487e1cab6bae39802aa11fb6a37b0
2017-05-15 13:42:03 +02:00
Harald Welte 50ef73377c tlv: Add tlvp_val{16,32}be() to get TLV values in unaligned host byte order
Change-Id: I3749e1e4974742bc8c32722e0e998775b5394829
2017-05-15 13:42:03 +02:00
Harald Welte 95871dadbd use osmo_{htonl,htons,ntohl,ntohs}() functions all over libosmocore
This gets us one step closer to fixing the embedded build

Change-Id: I3fc2639b6ade9ab138766987eceab7ec9498fdc7
2017-05-15 13:42:03 +02:00
Harald Welte 3318c657de introduce byteswap.h with osmo_{htonl,ntohl,htons,ntohs}
We need to have an architecture-independend way of endian conversion /
byte swapping functions which will also work on embedded (bare iron)
builds.   Let's introduce osmocom/core/bytesawp.h for this purpose.

Change-Id: Ibc0cc1e36d4ed63a35cf8ceff3af0f26e5ac7a3d
2017-05-15 13:42:00 +02:00
Harald Welte 054667fe15 endian.h: Make it work on 'bare iron' builds (and possibly more platforms)
We can use __BYTE_ORDER__ which seems to be defined by both gcc and
clang/llvm.

Change-Id: Id6821c99e88242126d9697099b1dd92c6212526a
2017-05-15 13:01:01 +02:00
Harald Welte b93ce5afec src/logging.c: Fix EMBEDDED build
We don't enable/build _file_output in EMBEDDED builds, so we shouldn'r
refer to that symbol.

Change-Id: I491aa8ee9d20a96cbb2814700475afe03eb99c9e
2017-05-15 13:01:01 +02:00
Vadim Yanitskiy 391d8746d0 kasumi_test.c: fix incomplete check
Previously the 'passed' variable in test_expansion() was being
overwritten on every call of _compare_mem(), so only the result
of last call influenced the test result.

Change-Id: Ibf3ab453c20c7eeec234b95bfe14b497c572c35f
2017-05-14 20:27:22 +03:00
Max 91dd219b99 Make EARFCN size calculation more robust
* add osmo_earfcn_bit_size_ext() function which allows to specify how many
  EARFCNs we should skip when estimating required bit size for SI2quater
* make old osmo_earfcn_bit_size() into wrapper over newly added function
  and mark it as deprecated

This is necessary to properly estimate necessary space for EARFCNs when
they are spread over several SI2q messages with different index.

Change-Id: I92e12e91605bdab9916a3f665705287572434f74
Related: RT#8792
2017-05-14 08:51:26 +00:00
Daniel Willmann 6959e3c110 gsm_04_08: Add missing GSM cause value
Table 10.5.157 in 10.5.6.6 of 3GPP TS 04.08 is badly formatted. The first
value 0x19 "LLC or SNDCP failure" is in the same line as the heading and has
not been included in the struct_value so far.

Table 10.5.157 in 10.5.6.6 of 3GPP TS 24.008 fixes this formatting issue and
also defines two more values 0x08 and 0x18 which are now added to the struct
value_string.

Change-Id: I5bcc52f739ff0677011d024448afcc2a54869638
2017-05-12 13:53:12 +00:00
Vadim Yanitskiy 13f4762827 configure.ac: fix build on systems without SIMD support
HAVE_AVX2, HAVE_SSE3 and HAVE_SSE4_1 were never defined if CPU
architecture doesn't match the (86*|x86_64*|amd64*) condition.

Change-Id: If0c3128f9768f95c1f5f955db242e71c81384c6c
2017-05-11 15:20:03 +00:00