summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* socket: Add osmo_sock_init2_ofd() functionPau Espin Pedrol2017-05-261-0/+23
| | | | | | Will be used by osmo-bts-trx Change-Id: I3c655a4af64fb80497a5aaa811cce8005dba9cd9
* Add human-readable names for signal_nsMax2017-05-242-0/+11
| | | | | Change-Id: Id664355eb8305fb287e4dae0800fb20dc2f9b8cd Related: SYS#3610
* Distinguish between unsupported and invalid MCSMax2017-05-242-59/+63
| | | | | | | | | | | | | | | | | | 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
* core/conv: add x86 SSE support for Viterbi decoderTom Tsou2017-05-244-10/+748
| | | | | | | | | | | | | | 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
* src/select.c: Don't #include <sys/select.h> if it doesn't existHarald Welte2017-05-171-1/+1
| | | | | | | | | 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
* add libpseudotalloc as super-simplistic talloc replacementHarald Welte2017-05-177-0/+134
| | | | | | | | | | | 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
* sercomm: More API documentationHarald Welte2017-05-171-4/+35
| | | | Change-Id: I5d5002ceedd10e10d772693478f4f9cab6b1290a
* sercomm: Better integration of driver interfaceHarald Welte2017-05-171-28/+17
| | | | | | | | | 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
* sercomm: Include in libosmocore MakefileHarald Welte2017-05-172-4/+4
| | | | Change-Id: If9d50d634381f43b2c67b97fea36a462a66e4559
* src/panic.c: Remove unneeded #include of gsm_utils.hHarald Welte2017-05-171-1/+0
| | | | Change-Id: I25cea5d3a4a900550e8f18c2bea392e642bfb191
* sercomm: Rename sercomm_lock() to sercomm_drv_lock()Harald Welte2017-05-171-18/+15
| | | | | | | | 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
* sercomm: remove unrequired helper functionsHarald Welte2017-05-171-13/+0
| | | | | | | | 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
* sercomm: Move HDLC related defines into C fileHarald Welte2017-05-171-0/+7
| | | | | | | Those values are not relevant to the sercomm user, only to the implementation and thus can remain inside sercomm.c Change-Id: I5700a45985b7c119c6338932171aae62ee4e2d22
* sercomm: Add doxygen-style documentation to public APIHarald Welte2017-05-171-3/+13
| | | | Change-Id: I2d8b11905692920d328262836420f01305be489e
* sercomm: include header file from osmocom/coreHarald Welte2017-05-171-2/+1
| | | | Change-Id: Iff5ff3a51d7781bcfb3aff0839b733bc7a71b7e5
* sercomm: make rx msg size configurable per instanceHarald Welte2017-05-171-4/+6
| | | | Change-Id: I835506e26e83232e1e7290c0da04d389c8d7fb40
* sercomm: introduce osmo_ naming prefix in struct and function namesHarald Welte2017-05-171-14/+14
| | | | Change-Id: If4e22f182a47b72b1fe43146716a4fbccceb62e6
* sercomm: Enable multiple instances of 'sercomm'Harald Welte2017-05-171-93/+70
| | | | | | | | 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
* Import sercomm.c from osmocom-bbHarald Welte2017-05-171-0/+343
| | | | | | | | | 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
* gsm/gsm0411_smr.c: strip unused variableVadim Yanitskiy2017-05-171-2/+1
| | | | Change-Id: I53f69913907588c45a9661c4e86e1bfb57a2418f
* timer: use timerclear() rather than explicit tv_set = tv_usec = 0Harald Welte2017-05-151-2/+1
| | | | Change-Id: I2735fc8d19fd68ef2c14a31e83cb396dc2e05587
* stats: Disable stats*.c on embedded targetsHarald Welte2017-05-152-0/+18
| | | | Change-Id: I6beb4fcc394ed7d3f8dd7a097b6e998245ecf401
* strrb: Add missing #include to talloc.hHarald Welte2017-05-151-0/+1
| | | | | | The strrb.c code uses talloc API without using the proper #include. Change-Id: I4ac485324f40545339d8df6884f1dea319a23648
* gsm0808 + ipa: fix compilation on systems without sys/socket.hHarald Welte2017-05-152-3/+15
| | | | Change-Id: I60f5d4982cd96ab29f9924ec11b46bf56fbfc346
* libosmogb: Convert to use new endian conversion helpersHarald Welte2017-05-156-96/+91
| | | | Change-Id: I5ed17702cd9487e1cab6bae39802aa11fb6a37b0
* use osmo_{htonl,htons,ntohl,ntohs}() functions all over libosmocoreHarald Welte2017-05-1510-34/+31
| | | | | | This gets us one step closer to fixing the embedded build Change-Id: I3fc2639b6ade9ab138766987eceab7ec9498fdc7
* src/logging.c: Fix EMBEDDED buildHarald Welte2017-05-151-1/+1
| | | | | | | We don't enable/build _file_output in EMBEDDED builds, so we shouldn'r refer to that symbol. Change-Id: I491aa8ee9d20a96cbb2814700475afe03eb99c9e
* Make EARFCN size calculation more robustMax2017-05-142-6/+22
| | | | | | | | | | | | | * 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
* gsm_04_08: Add missing GSM cause valueDaniel Willmann2017-05-121-0/+3
| | | | | | | | | | | | 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
* doc: fix incorrect return value descriptionMax2017-05-101-1/+1
| | | | | Change-Id: Ieba009273f911bc4217122a6346220aeb29e8bc4 Related: OS#1614
* timer: add osmo_timer_setup()Pablo Neira Ayuso2017-05-099-16/+21
| | | | | | | | | | | | | | | Add a new function timer function to set up the timer, similar to what we have in the Linux kernel. This patch also converts existing opencoded timer setup in the libosmocore tree as initial client of this new function. This patch implicitly removes function callback passed by reference that defeat compile time type validation. Compile-tested only, but I ran make check that reports success when testing timer infrastructure. Change-Id: I2fa49972ecaab3748b25168b26d92034e9145666
* vty: cleanup logging functionsMax2017-05-092-14/+15
| | | | | | | | | | | | * remove unused parameter from logging_vty_add_cmds() * mark log level descriptors static * change internal static function int check_log_to_target() to more appropriate bool should_log_to_target() * deprecate log_vty_command_*() from public API as it should only be used by logging_vty_add_cmds() Change-Id: I0e9ddd7ba3ce211302d99a3494eb408907a2916e Related: OS#71
* gprs: add value strings for NS PDU typeMax2017-05-092-2/+27
| | | | | | | | Add value strings for Service Control PDUs according to 3GPP TS 48.016 §9 and use them for logging. Change-Id: I0ea3a45f35d68619d4cfa9735ef77abd9f9f0d58 Related: SYS#3610
* Simplify ctrl cmd lookupMax2017-05-082-32/+25
| | | | | | | Replace if-else ladder & gotos with single switch statement & explicit return to make reading code easier. Change-Id: Ida1b389b571c60c26813cd29e61b3e4423c5df0f
* gsm0808: fix control flow issuePhilipp Maier2017-05-081-3/+2
| | | | | | | | | | | | | | | | | | Coverity Scan reported a control flow issue in line 206: CID 166898: Control flow issues (DEADCODE) The second branch of the if statement can not be reached. The purpose of the second if branch was to filter out zero length elements if the header states that it is a non extended speech codec type. This makes no sense, since the header needs at least one byte. This patch removes the second if branch, zero length elements are catched by the already existing zero length check at the beginning of the function Change-Id: I89751fc0d598734c64ef1fdced75b7c4fa77c616
* core/conv: strip unused memalign() callVadim Yanitskiy2017-05-071-10/+1
| | | | | | | | | The alligned memory allocation is only required for SSE, which is currently unsupported. Moreover, it's better to use dedicated _mm_malloc() and _mm_free() from xmmintrin.h instead, which are introduced by Intel specifically for SIMD computations. Change-Id: Ide764d1c643527323334ef14335be7f8915f7622
* Fix broken ctrl commandsMax2017-05-031-1/+2
| | | | | | | | | | | Recent changes to libosmoctrl resulted in ctrl comands being broken because local lookup helper returned incorrect value for ROOT_NODE. Note: although this commit seems to fix it for me, I'm still not sure how the logic behind lookup function return values work. Would be nice to get it documented. Change-Id: Iddd20602047ebd9be1b668593f5dfa6f1d3e8369
* Add SW Description (de)marshallingMax2017-04-282-0/+160
| | | | | | | | | | | | | | | | * data structure representing 3GPP TS 52.021 §9.4.62 SW Description * function to serialize it into msgb * function to deserialize it from buffer * functions to extract/estimate buffer size for SW Description * test harness (partially taken from OpenBSC) There are several similar functions to deal with SW Description in OpenBSC, there's also need to use similar functionality in OsmoBTS. Hence it's better to put the code into common library with proper tests and documentation. Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Related: OS#1614
* Uninitialized variable in ipa_ccm_make_id_resp_from_req()Harald Welte2017-04-271-0/+2
| | | | | | | | | | We are allocating a buffer on the stack without initializing it, and then passing it into ipa_ccm_make_id_resp(). There is no real danger from this, as the buffer is only uninitialized if num_ies is 0, but let's memset() it for good style Change-Id: If5761a47b8cba73ddcc02a88cfa5c87c1970c04e Fixes: coverity CID#167040
* control_if: Don't use magic number '5' when allocating vectorHarald Welte2017-04-271-1/+1
| | | | | | We have a proper constant for this (_LAST_CTRL_NODE), so let's use it. Change-Id: I46275e644166156cb665da70d2964008f1c6cd88
* control_if: Add control interface commands for FSMsHarald Welte2017-04-273-1/+180
| | | | | | | | | This allows programmatic access to introspection of FSM instances, which is quite handy from e.g. external test cases: Send a message to the code, then use the CTRL interface to check if that message has triggered the right kind of state transition. Change-Id: I0f80340ee9c61c88962fdd6764a6098a844d0d1e
* control_if: Add helper function for 'local execution' of control commandHarald Welte2017-04-271-0/+28
| | | | | | | | Sometimes (particularly when testing), we may want to parse+execute an arbitrary control command simply form a string buffer, rather than from a msgb. Let's add a helper for that. Change-Id: Iaca748e0d942bb2a1ee7c2776b37485e1439eb0c
* control_if: Add API to initialize control interface without TCP port bindHarald Welte2017-04-261-27/+63
| | | | | | | When executing test cases, we don't want to bind to a local TCP port, as we cannot make assumptions as to which ports are actually free. Change-Id: I5717f9dd92d1f143f069cecd4b4c8ba3d03b25f8
* ctrl: Allow installation of additional node lookup helpersHarald Welte2017-04-261-0/+41
| | | | | | | | | | | | The existing code assumes that the main application knows about all control command nodes and can thus present one lookup function. As libraries are getting their own control interface handling, this is too restrictive, and we need a way how library code can dynamically register more node lookup helpers. We can now do this by means of a ctrl_lookup_register() function. Change-Id: Ib69908d1c57f5bb721d5496e3b4a5258fca450e3
* fix spelling in API docu, command reply, logging, descriptionsThorsten Alteholz2017-04-235-5/+5
| | | | | | sections: ctrl, gb, gsm, vty Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70
* fsm: Re-set fsm_inst->T to 0 after timer expirationHarald Welte2017-04-161-1/+4
| | | | | | | | | | If the user starts the FSM timer with a given timer number during fsm_inst_state_chg() with a timeout, we should remove that "T" number after timer expiration. Otherwise it might be confusing if e.g. the VTY interface shows FSM instances with a certain timer number assigned, but that timer is not actually running anymore. Change-Id: I71167ec1000dc4c6954d851d3b92f6bf12984925
* osmo_fsm: Lookup functions to find FSM Instance by name or IDHarald Welte2017-04-161-0/+24
| | | | | | | Introduce two lookup helper functions to resolve a fsm_instance based on the FSM and name or ID. Also, add related test cases. Change-Id: I707f3ed2795c28a924e64adc612d378c21baa815
* ipa: Introduce helpers to encode IPA CCM ID RESPONSEHarald Welte2017-04-152-1/+120
| | | | | | | | | | The ipa.c file already contained code to parse an ID RESPONSE into the 'struct ipaccess_unit', but it didn't so far contain code to put together an ID RESPONSE packet based on that structure. Let's change that with ipa_ccm_make_id_resp() and a helper wrapper ipa_ccm_make_id_resp_from_req(). Change-Id: Icbcd8827a75fd5f3393351c1ca372de85275ad35
* core/conv: implement optimized Viterbi decoderTom Tsou2017-04-114-1/+806
| | | | | | | | | | | | | | | | | | | | Add a separate, faster convolution decoding implementation for rates up to N=4 and constraint lengths of K=5 and K=7, which covers the most GSM code uses. The decoding algorithm exploits the symmetric structure of the Viterbi add-compare-select (ACS) operation - commonly known as the ACS butterfly. This shift-register optimization can be found in the well-known text by Dave Forney. Forney, G.D., "The Viterbi Algorithm," Proc. of the IEEE, March 1973. Implementation is non-architecture specific and improves performance on x86 as well as ARM processors. Existing API is unchanged with optimized code being called internally for supported codes. The original code was relicensed under GPLv2-or-later with permission of copyright holder - Tom Tsou. Change-Id: I74d355274b4176a7d924f91ef3c96912ce338fb2
* Add osmo_sock_init2() function, allowing both BIND *and* CONNECTHarald Welte2017-04-091-33/+187
| | | | | | | | | The old osmo_sock_init() function allows only either a bind (for a server socket), or a connect (for a client socket), but not both together. So there's no way to have a client socket that is bound to a specific local IP and/or port, which is needed for some use cases. Change-Id: Idab124bcca47872f55311a82d6818aed590965e6