pespin has uploaded this change for review.

View Change

rlcmac: Move spec related definitions for general use to types.h

Move types defined by spec not directly/solely intended for the CSN1
encoder/decoder operation to a separate types.h header.
More and more types will be added there which will be used by the data
domain inside and outside the library.

Change-Id: Ib0fdae48fc3e76d701d21644826e5ffd8553fecb
---
M include/osmocom/gprs/rlcmac/Makefile.am
M include/osmocom/gprs/rlcmac/csn1_defs.h
M include/osmocom/gprs/rlcmac/llc_queue.h
M include/osmocom/gprs/rlcmac/rlcmac.h
A include/osmocom/gprs/rlcmac/types.h
M src/rlcmac/Makefile.am
M src/rlcmac/csn1_ts_44_060.c
A src/rlcmac/ts_44_060.c
M src/rlcmac/ts_44_064.c
M tests/rlcmac/ts_44_060_test.c
10 files changed, 72 insertions(+), 44 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/51/31151/1
diff --git a/include/osmocom/gprs/rlcmac/Makefile.am b/include/osmocom/gprs/rlcmac/Makefile.am
index 091882a..e797480 100644
--- a/include/osmocom/gprs/rlcmac/Makefile.am
+++ b/include/osmocom/gprs/rlcmac/Makefile.am
@@ -9,6 +9,7 @@
csn1_defs.h \
rlcmac.h \
rlcmac_prim.h \
+ types.h \
$(NULL)

rlcmacdir = $(includedir)/osmocom/gprs/rlcmac
diff --git a/include/osmocom/gprs/rlcmac/csn1_defs.h b/include/osmocom/gprs/rlcmac/csn1_defs.h
index a68267d..459dde2 100644
--- a/include/osmocom/gprs/rlcmac/csn1_defs.h
+++ b/include/osmocom/gprs/rlcmac/csn1_defs.h
@@ -5404,21 +5404,6 @@
EGPRS_PacketChannelRequestContent_t Content;
} EGPRS_PacketChannelRequest_t;

-typedef enum {
- EGPRS_PKT_CHAN_REQ_ONE_PHASE = 0,
- EGPRS_PKT_CHAN_REQ_SHORT,
- EGPRS_PKT_CHAN_REQ_ONE_PHASE_RED_LATENCY,
- EGPRS_PKT_CHAN_REQ_TWO_PHASE,
- EGPRS_PKT_CHAN_REQ_SIGNALLING,
- EGPRS_PKT_CHAN_REQ_ONE_PHASE_UNACK,
- EGPRS_PKT_CHAN_REQ_DEDICATED_CHANNEL,
- EGPRS_PKT_CHAN_REQ_EMERGENCY_CALL,
- EGPRS_PKT_CHAN_REQ_TWO_PHASE_IPA,
- EGPRS_PKT_CHAN_REQ_SIGNALLING_IPA,
-} EGPRS_PacketChannelRequestType_t;
-
-extern const struct value_string osmo_gprs_rlcmac_egprs_pkt_ch_req_type_names[];
-
int osmo_gprs_rlcmac_decode_uplink(struct bitvec *vector, RlcMacUplink_t *data);
int osmo_gprs_rlcmac_decode_downlink(struct bitvec *vector, RlcMacDownlink_t *data);
int osmo_gprs_rlcmac_encode_downlink(struct bitvec *vector, RlcMacDownlink_t *data);
diff --git a/include/osmocom/gprs/rlcmac/llc_queue.h b/include/osmocom/gprs/rlcmac/llc_queue.h
index 7e941fb..a0a91e4 100644
--- a/include/osmocom/gprs/rlcmac/llc_queue.h
+++ b/include/osmocom/gprs/rlcmac/llc_queue.h
@@ -9,6 +9,7 @@

#include <osmocom/gprs/rlcmac/codel.h>
#include <osmocom/gprs/rlcmac/rlcmac_prim.h>
+#include <osmocom/gprs/rlcmac/types.h>
#include <osmocom/gprs/rlcmac/rlcmac.h>

struct gprs_rlcmac_entity;
diff --git a/include/osmocom/gprs/rlcmac/rlcmac.h b/include/osmocom/gprs/rlcmac/rlcmac.h
index e433a08..d7bfb0a 100644
--- a/include/osmocom/gprs/rlcmac/rlcmac.h
+++ b/include/osmocom/gprs/rlcmac/rlcmac.h
@@ -13,20 +13,6 @@
OSMO_GPRS_RLCMAC_LOCATION_PCU,
};

-/* Section TS 44.064 6.2.3 Service Access Point Identifier (SAPI) */
-enum osmo_gprs_rlcmac_llc_sapi {
- OSMO_GPRS_RLCMAC_LLC_SAPI_GMM = 1,
- OSMO_GPRS_RLCMAC_LLC_SAPI_TOM2 = 2,
- OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP3 = 3,
- OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP5 = 5,
- OSMO_GPRS_RLCMAC_LLC_SAPI_SMS = 7,
- OSMO_GPRS_RLCMAC_LLC_SAPI_TOM8 = 8,
- OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP9 = 9,
- OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP11 = 11,
-};
-
-extern const struct value_string osmo_gprs_rlcmac_llc_sapi_names[];
-
int osmo_gprs_rlcmac_init(enum osmo_gprs_rlcmac_location location);

enum osmo_gprs_rlcmac_log_cat {
diff --git a/include/osmocom/gprs/rlcmac/types.h b/include/osmocom/gprs/rlcmac/types.h
new file mode 100644
index 0000000..e503fb4
--- /dev/null
+++ b/include/osmocom/gprs/rlcmac/types.h
@@ -0,0 +1,30 @@
+/* Types & defines from TS 44.060, TS 44.064 */
+#pragma once
+
+/* TS 44.060 Table 11.2.5a.2 "EGPRS Packet channel request" */
+enum osmo_gprs_rlcmac_egprs_pkt_ch_req_type {
+ OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_ONE_PHASE = 0,
+ OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_SHORT,
+ OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_ONE_PHASE_RED_LATENCY,
+ OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_TWO_PHASE,
+ OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_SIGNALLING,
+ OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_ONE_PHASE_UNACK,
+ OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_DEDICATED_CHANNEL,
+ OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_EMERGENCY_CALL,
+ OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_TWO_PHASE_IPA,
+ OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_SIGNALLING_IPA,
+};
+extern const struct value_string osmo_gprs_rlcmac_egprs_pkt_ch_req_type_names[];
+
+/* TS 44.064 Section 6.2.3 Service Access Point Identifier (SAPI) */
+enum osmo_gprs_rlcmac_llc_sapi {
+ OSMO_GPRS_RLCMAC_LLC_SAPI_GMM = 1,
+ OSMO_GPRS_RLCMAC_LLC_SAPI_TOM2 = 2,
+ OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP3 = 3,
+ OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP5 = 5,
+ OSMO_GPRS_RLCMAC_LLC_SAPI_SMS = 7,
+ OSMO_GPRS_RLCMAC_LLC_SAPI_TOM8 = 8,
+ OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP9 = 9,
+ OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP11 = 11,
+};
+extern const struct value_string osmo_gprs_rlcmac_llc_sapi_names[];
diff --git a/src/rlcmac/Makefile.am b/src/rlcmac/Makefile.am
index 4150f84..676abe0 100644
--- a/src/rlcmac/Makefile.am
+++ b/src/rlcmac/Makefile.am
@@ -30,6 +30,7 @@
llc_queue.c \
rlcmac.c \
rlcmac_prim.c \
+ ts_44_060.c \
ts_44_064.c \
misc.c \
$(NULL)
diff --git a/src/rlcmac/csn1_ts_44_060.c b/src/rlcmac/csn1_ts_44_060.c
index 0ebfbed..5cc9c4b 100644
--- a/src/rlcmac/csn1_ts_44_060.c
+++ b/src/rlcmac/csn1_ts_44_060.c
@@ -5261,20 +5261,6 @@
}
}

-const struct value_string osmo_gprs_rlcmac_egprs_pkt_ch_req_type_names[] = {
- { EGPRS_PKT_CHAN_REQ_ONE_PHASE, "One Phase Access" },
- { EGPRS_PKT_CHAN_REQ_SHORT, "Short Access" },
- { EGPRS_PKT_CHAN_REQ_ONE_PHASE_RED_LATENCY, "One Phase Access (Reduced Latency MS)" },
- { EGPRS_PKT_CHAN_REQ_TWO_PHASE, "Two Phase Access" },
- { EGPRS_PKT_CHAN_REQ_SIGNALLING, "Signalling" },
- { EGPRS_PKT_CHAN_REQ_ONE_PHASE_UNACK, "One Phase Access (RLC unack mode)" },
- { EGPRS_PKT_CHAN_REQ_DEDICATED_CHANNEL, "Dedicated Channel Request" },
- { EGPRS_PKT_CHAN_REQ_EMERGENCY_CALL, "Emergency call" },
- { EGPRS_PKT_CHAN_REQ_TWO_PHASE_IPA, "Two Phase Access (by IPA capable MS)" },
- { EGPRS_PKT_CHAN_REQ_SIGNALLING_IPA, "Signalling (by IPA capable MS)" },
- { 0, NULL }
-};
-
int osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(guint16 ra, EGPRS_PacketChannelRequest_t *req)
{
unsigned readIndex = 0;
diff --git a/src/rlcmac/ts_44_060.c b/src/rlcmac/ts_44_060.c
new file mode 100644
index 0000000..931c262
--- /dev/null
+++ b/src/rlcmac/ts_44_060.c
@@ -0,0 +1,37 @@
+/* GPRS RLC/MAC definitions from TS 44.064 (LLC) */
+/*
+ * (C) 2023 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <osmocom/core/utils.h>
+#include <osmocom/gprs/rlcmac/types.h>
+
+const struct value_string osmo_gprs_rlcmac_egprs_pkt_ch_req_type_names[] = {
+ { OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_ONE_PHASE, "One Phase Access" },
+ { OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_SHORT, "Short Access" },
+ { OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_ONE_PHASE_RED_LATENCY, "One Phase Access (Reduced Latency MS)" },
+ { OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_TWO_PHASE, "Two Phase Access" },
+ { OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_SIGNALLING, "Signalling" },
+ { OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_ONE_PHASE_UNACK, "One Phase Access (RLC unack mode)" },
+ { OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_DEDICATED_CHANNEL, "Dedicated Channel Request" },
+ { OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_EMERGENCY_CALL, "Emergency call" },
+ { OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_TWO_PHASE_IPA, "Two Phase Access (by IPA capable MS)" },
+ { OSMO_GPRS_RLCMAC_EGPRS_PKT_CH_REQ_SIGNALLING_IPA, "Signalling (by IPA capable MS)" },
+ { 0, NULL }
+};
diff --git a/src/rlcmac/ts_44_064.c b/src/rlcmac/ts_44_064.c
index 5ad9af5..e781d24 100644
--- a/src/rlcmac/ts_44_064.c
+++ b/src/rlcmac/ts_44_064.c
@@ -20,7 +20,7 @@
*/

#include <osmocom/core/utils.h>
-#include <osmocom/gprs/rlcmac/rlcmac.h>
+#include <osmocom/gprs/rlcmac/types.h>

const struct value_string osmo_gprs_rlcmac_llc_sapi_names[] = {
{ OSMO_GPRS_RLCMAC_LLC_SAPI_GMM, "GMM" },
diff --git a/tests/rlcmac/ts_44_060_test.c b/tests/rlcmac/ts_44_060_test.c
index 1591102..06342b9 100644
--- a/tests/rlcmac/ts_44_060_test.c
+++ b/tests/rlcmac/ts_44_060_test.c
@@ -24,6 +24,7 @@

#include <osmocom/csn1/csn1.h>
#include <osmocom/gprs/rlcmac/csn1_defs.h>
+#include <osmocom/gprs/rlcmac/types.h>

static void testRlcMacDownlink(void *test_ctx)
{

To view, visit change 31151. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: Ib0fdae48fc3e76d701d21644826e5ffd8553fecb
Gerrit-Change-Number: 31151
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange