mirror of https://gerrit.osmocom.org/osmo-tetra
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
This commit is contained in:
parent
3fba49ead4
commit
d5bfc8e74a
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ struct tetra_blk_param {
|
|||
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 @@ struct tetra_tmvsap_prim *tmvsap_prim_alloc(uint16_t prim, uint8_t op)
|
|||
}
|
||||
|
||||
/* 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 @@ void tp_sap_udata_ind(enum tp_sap_data_type type, const uint8_t *bits, unsigned
|
|||
|
||||
/* Write it */
|
||||
fwrite(block, sizeof(int16_t), 690, f);
|
||||
|
||||
fclose(f);
|
||||
|
||||
/* Write used ssi */
|
||||
|
@ -260,6 +259,9 @@ void tp_sap_udata_ind(enum tp_sap_data_type type, const uint8_t *bits, unsigned
|
|||
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);
|
||||
|
||||
|
|
|
@ -347,18 +347,18 @@ void tetra_burst_rx_cb(const uint8_t *burst, unsigned int len, enum tetra_train_
|
|||
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 @@ void tetra_burst_rx_cb(const uint8_t *burst, unsigned int len, enum tetra_train_
|
|||
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:
|
||||
|
|
|
@ -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 @@ enum tp_sap_data_type {
|
|||
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);
|
||||
|
|
|
@ -28,6 +28,7 @@ struct tmv_unitdata_param {
|
|||
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 */
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue