diff options
author | Max <msuraev@sysmocom.de> | 2016-05-10 17:17:05 +0200 |
---|---|---|
committer | Holger Freyther <holger@freyther.de> | 2016-05-12 15:56:39 +0000 |
commit | fe65fa7e36a400d362666e2c5bd0f289d45aa56a (patch) | |
tree | 315d126375c8ef493c955385c5de404ebdafef74 /src | |
parent | 3d79240fb41270d58f9c33508e11f0c215951cc9 (diff) |
Set DTX in Cell Options
* rename field of struct gsm48_cell_options to better match the spec
* add comments with spec references
* add function for setting DTX in cell options struct
* add necessary enum type
Change-Id: I5a8924f57669c951b2e51b663d95f1d360062a54
Reviewed-on: https://gerrit.osmocom.org/39
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/gsm48.c | 46 | ||||
-rw-r--r-- | src/gsm/libosmogsm.map | 2 |
2 files changed, 47 insertions, 1 deletions
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index ab626050..8a46f769 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -25,7 +25,7 @@ #include <stdint.h> #include <stdio.h> #include <string.h> - +#include <stdbool.h> #include <arpa/inet.h> #include <osmocom/core/utils.h> @@ -358,6 +358,50 @@ int gsm48_decode_lai(struct gsm48_loc_area_id *lai, uint16_t *mcc, return 0; } +/*! \brief Set DTX mode in Cell Options IE (3GPP TS 44.018) + * \param[in] op Cell Options structure in which DTX parameters will be set + * \param[in] full Mode for full-rate channels + * \param[in] half Mode for half-rate channels + * \param[in] is_bcch Indicates if we should use 10.5.2.3.1 instead of + * 10.5.2.3a.2 + * + * There is no space for separate DTX settings for Full and Half rate channels + * in BCCH - in this case full setting is used for both and half parameter is + * ignored. + */ +void gsm48_set_dtx(struct gsm48_cell_options *op, enum gsm48_dtx_mode full, + enum gsm48_dtx_mode half, bool is_bcch) +{ + if (is_bcch) { + switch (full) { + case GSM48_DTX_MAY_BE_USED: + op->dtx = 0; + return; + case GSM48_DTX_SHALL_BE_USED: + op->dtx = 1; + return; + case GSM48_DTX_SHALL_NOT_BE_USED: + op->dtx = 2; + return; + } + } else { + switch (full) { + case GSM48_DTX_MAY_BE_USED: + op->dtx = (half == GSM48_DTX_SHALL_BE_USED) ? 3 : 0; + op->d = (half == GSM48_DTX_SHALL_NOT_BE_USED) ? 0 : 1; + return; + case GSM48_DTX_SHALL_BE_USED: + op->dtx = (half == GSM48_DTX_MAY_BE_USED) ? 3 : 1; + op->d = (half == GSM48_DTX_SHALL_BE_USED) ? 1 : 0; + return; + case GSM48_DTX_SHALL_NOT_BE_USED: + op->dtx = 2; + op->d = (half == GSM48_DTX_SHALL_BE_USED) ? 1 : 0; + return; + } + } +} + int gsm48_generate_mid_from_tmsi(uint8_t *buf, uint32_t tmsi) { uint32_t tmsi_be = htonl(tmsi); diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index e0d9dcbd..834e5d66 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -162,6 +162,8 @@ gsm48_mm_att_tlvdef; gsm48_number_of_paging_subchannels; gsm48_parse_ra; gsm48_rr_att_tlvdef; +gsm48_set_dtx; +gsm48_dtx_mode; gsm48_mi_type_name; gsm48_mcc_mnc_to_bcd; gsm48_mcc_mnc_from_bcd; |