aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-07-14 11:35:17 +0200
committerHarald Welte <laforge@gnumonks.org>2016-07-16 21:00:00 +0000
commitedb57e7709c130a664fb2d9f807d96d0e283c675 (patch)
tree1949401974deb3f71e146b416e7be29415ec231b
parent4a62dbbfa9260cd0c079f043b57f9adaedfad38e (diff)
Add function to check TA validity
Check if given Timing Advance is valid according to 3GPP TS 44.018 § 10.5.2.40. Change-Id: I5cb6149d6e36fda8cb3f557e4d6d3a724da805a5 Related: OS#1545
-rw-r--r--include/osmocom/gsm/protocol/gsm_04_08.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index e442c7f9..7efd7e87 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -947,6 +947,16 @@ static inline uint8_t gsm48_hdr_trans_id(const struct gsm48_hdr *hdr)
return (hdr->proto_discr & 0xf0) >> 4;
}
+/*! \brief Check if TA is valid according to 3GPP TS 44.018 § 10.5.2.40
+ * \param[in] ta Timing Advance value
+ * \returns true if ta is valid, false otherwise
+ * Note: Rules for GSM400 band are ignored as it's not implemented in practice.
+ */
+static inline bool gsm48_ta_is_valid(uint8_t ta)
+{
+ return (ta < 64);
+}
+
static inline uint8_t gsm48_hdr_trans_id_flip_ti(const struct gsm48_hdr *hdr)
{
return gsm48_hdr_trans_id(hdr) ^ 0x08;