wbokslag has uploaded this change for review.

View Change

keep track of which block of a downlink burst is being processed

tp_sap_udata_ind now accepts a parameter designating from which block
(first or second) of the downlink burst the bits originate (not
applicable for all downlink burst types). In some cases, the upper mac
needs this information, see ETSI EN 300 392-7 clause 6.4.1

Change-Id: I5ff316a773906328e19c3530b09d7412f9c731ec
---
M src/conv_enc_test.c
M src/lower_mac/tetra_lower_mac.c
M src/phy/tetra_burst.c
M src/phy/tetra_burst.h
M src/tetra_prim.h
5 files changed, 19 insertions(+), 13 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/91/28891/1
diff --git a/src/conv_enc_test.c b/src/conv_enc_test.c
index aa921fa..c5924ce 100644
--- a/src/conv_enc_test.c
+++ b/src/conv_enc_test.c
@@ -45,7 +45,7 @@
static unsigned int num_crc_err;

/* incoming TP-SAP UNITDATA.ind from PHY into lower MAC */
-void tp_sap_udata_ind(enum tp_sap_data_type type, const uint8_t *bits, unsigned int len, void *priv)
+void tp_sap_udata_ind(enum tp_sap_data_type type, int blk_num, const uint8_t *bits, unsigned int len, void *priv)
{
}

diff --git a/src/lower_mac/tetra_lower_mac.c b/src/lower_mac/tetra_lower_mac.c
index d6f9e41..ca1b72e 100644
--- a/src/lower_mac/tetra_lower_mac.c
+++ b/src/lower_mac/tetra_lower_mac.c
@@ -53,7 +53,7 @@
static const struct tetra_blk_param tetra_blk_param[] = {
[TPSAP_T_SB1] = {
.name = "SB1",
- .type345_bits = 120,
+ .type345_bits = 120,
.type2_bits = 80,
.type1_bits = 60,
.interleave_a = 11,
@@ -138,7 +138,7 @@
}

/* incoming TP-SAP UNITDATA.ind from PHY into lower MAC */
-void tp_sap_udata_ind(enum tp_sap_data_type type, const uint8_t *bits, unsigned int len, void *priv)
+void tp_sap_udata_ind(enum tp_sap_data_type type, int blk_num, const uint8_t *bits, unsigned int len, void *priv)
{
/* various intermediary buffers */
uint8_t type4[512];
@@ -216,7 +216,6 @@

/* Write it */
fwrite(block, sizeof(int16_t), 690, f);
-
fclose(f);

/* Write used ssi */
@@ -260,6 +259,9 @@
osmo_ubit_dump(type2, tbp->type1_bits));
}

+ /* Set whether BLK1 or BLK2 in downlink burst (or 0 if not applicable) */
+ tup->blk_num = blk_num;
+
msg->l1h = msgb_put(msg, tbp->type1_bits);
memcpy(msg->l1h, type2, tbp->type1_bits);

diff --git a/src/phy/tetra_burst.c b/src/phy/tetra_burst.c
index c791ee0..80a438a 100644
--- a/src/phy/tetra_burst.c
+++ b/src/phy/tetra_burst.c
@@ -347,18 +347,18 @@
case TETRA_TRAIN_SYNC:
/* Split SB1, SB2 and Broadcast Block */
/* send three parts of the burst via TP-SAP into lower MAC */
- tp_sap_udata_ind(TPSAP_T_SB1, burst+SB_BLK1_OFFSET, SB_BLK1_BITS, priv);
- tp_sap_udata_ind(TPSAP_T_BBK, burst+SB_BBK_OFFSET, SB_BBK_BITS, priv);
- tp_sap_udata_ind(TPSAP_T_SB2, burst+SB_BLK2_OFFSET, SB_BLK2_BITS, priv);
+ tp_sap_udata_ind(TPSAP_T_SB1, BLK_1, burst+SB_BLK1_OFFSET, SB_BLK1_BITS, priv);
+ tp_sap_udata_ind(TPSAP_T_BBK, 0, burst+SB_BBK_OFFSET, SB_BBK_BITS, priv);
+ tp_sap_udata_ind(TPSAP_T_SB2, BLK_2, burst+SB_BLK2_OFFSET, SB_BLK2_BITS, priv);
break;
case TETRA_TRAIN_NORM_2:
/* re-combine the broadcast block */
memcpy(bbk_buf, burst+NDB_BBK1_OFFSET, NDB_BBK1_BITS);
memcpy(bbk_buf+NDB_BBK1_BITS, burst+NDB_BBK2_OFFSET, NDB_BBK2_BITS);
/* send three parts of the burst via TP-SAP into lower MAC */
- tp_sap_udata_ind(TPSAP_T_BBK, bbk_buf, NDB_BBK_BITS, priv);
- tp_sap_udata_ind(TPSAP_T_NDB, burst+NDB_BLK1_OFFSET, NDB_BLK_BITS, priv);
- tp_sap_udata_ind(TPSAP_T_NDB, burst+NDB_BLK2_OFFSET, NDB_BLK_BITS, priv);
+ tp_sap_udata_ind(TPSAP_T_BBK, 0, bbk_buf, NDB_BBK_BITS, priv);
+ tp_sap_udata_ind(TPSAP_T_NDB, BLK_1, burst+NDB_BLK1_OFFSET, NDB_BLK_BITS, priv);
+ tp_sap_udata_ind(TPSAP_T_NDB, BLK_2, burst+NDB_BLK2_OFFSET, NDB_BLK_BITS, priv);
break;
case TETRA_TRAIN_NORM_1:
/* re-combine the broadcast block */
@@ -368,8 +368,8 @@
memcpy(ndbf_buf, burst+NDB_BLK1_OFFSET, NDB_BLK_BITS);
memcpy(ndbf_buf+NDB_BLK_BITS, burst+NDB_BLK2_OFFSET, NDB_BLK_BITS);
/* send two parts of the burst via TP-SAP into lower MAC */
- tp_sap_udata_ind(TPSAP_T_BBK, bbk_buf, NDB_BBK_BITS, priv);
- tp_sap_udata_ind(TPSAP_T_SCH_F, ndbf_buf, 2*NDB_BLK_BITS, priv);
+ tp_sap_udata_ind(TPSAP_T_BBK, 0, bbk_buf, NDB_BBK_BITS, priv);
+ tp_sap_udata_ind(TPSAP_T_SCH_F, 0, ndbf_buf, 2*NDB_BLK_BITS, priv);
break;
case TETRA_TRAIN_NORM_3:
case TETRA_TRAIN_EXT:
diff --git a/src/phy/tetra_burst.h b/src/phy/tetra_burst.h
index 8feb09c..0230c88 100644
--- a/src/phy/tetra_burst.h
+++ b/src/phy/tetra_burst.h
@@ -3,6 +3,9 @@

#include <stdint.h>

+#define BLK_1 1
+#define BLK_2 2
+
enum tp_sap_data_type {
TPSAP_T_SB1,
TPSAP_T_SB2,
@@ -12,7 +15,7 @@
TPSAP_T_SCH_F,
};

-extern void tp_sap_udata_ind(enum tp_sap_data_type type, const uint8_t *bits, unsigned int len, void *priv);
+extern void tp_sap_udata_ind(enum tp_sap_data_type type, int blk_num, const uint8_t *bits, unsigned int len, void *priv);

/* 9.4.4.2.6 Synchronization continuous downlink burst */
int build_sync_c_d_burst(uint8_t *buf, const uint8_t *sb, const uint8_t *bb, const uint8_t *bkn);
diff --git a/src/tetra_prim.h b/src/tetra_prim.h
index 8913187..918abd7 100644
--- a/src/tetra_prim.h
+++ b/src/tetra_prim.h
@@ -28,6 +28,7 @@
int crc_ok; /* was the CRC verified OK? */
uint32_t scrambling_code; /* which scrambling code was used */
struct tetra_tdma_time tdma_time;/* TDMA timestamp */
+ int blk_num; /* Indicates whether BLK1 or BLK2 in the downlink burst */
//uint8_t mac_block[412]; /* maximum num of bits in a non-QAM chan */
};


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

Gerrit-Project: osmo-tetra
Gerrit-Branch: master
Gerrit-Change-Id: I5ff316a773906328e19c3530b09d7412f9c731ec
Gerrit-Change-Number: 28891
Gerrit-PatchSet: 1
Gerrit-Owner: wbokslag <w.bokslag@midnightblue.nl>
Gerrit-MessageType: newchange