summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-02-27 09:47:48 +0100
committerSteve Markgraf <steve@steve-m.de>2021-10-23 18:51:19 +0200
commit7f434888287c7921e9242b8d4374ed99e03cc7cc (patch)
treeb8ff3682cbee5ed6bd59dd22fe247d9de4beed16
parent473e2313e9e02e6aed25c84c9fd5ba5852c23bca (diff)
Set slot types for calypso BTS, handle filler table accordingly
Scheduling of NB/AB/SB/FB depends on given slot type by transceiver application.
-rw-r--r--include/l1ctl_proto.h1
-rw-r--r--src/target/firmware/apps/trx/trx.c49
-rw-r--r--src/target/firmware/include/layer1/sync.h1
-rw-r--r--src/target/firmware/layer1/l23_api.c8
-rw-r--r--src/target/firmware/layer1/prim_bts.c6
-rw-r--r--src/target/firmware/layer1/trx_dummy.c5
6 files changed, 52 insertions, 18 deletions
diff --git a/include/l1ctl_proto.h b/include/l1ctl_proto.h
index 2b5a5817..07d5c495 100644
--- a/include/l1ctl_proto.h
+++ b/include/l1ctl_proto.h
@@ -395,6 +395,7 @@ struct l1ctl_tbf_cfg_req {
/* BTS mode: config */
struct l1ctl_bts_mode {
uint8_t enabled;
+ uint8_t type[8];
uint8_t bsic;
uint16_t band_arfcn;
uint8_t gain;
diff --git a/src/target/firmware/apps/trx/trx.c b/src/target/firmware/apps/trx/trx.c
index d48fdbbf..8e5c89f7 100644
--- a/src/target/firmware/apps/trx/trx.c
+++ b/src/target/firmware/apps/trx/trx.c
@@ -27,6 +27,7 @@
#include <defines.h>
#include <asm/system.h>
#include <layer1/trx.h>
+#include <layer1/sync.h>
#include "burst_queue.h"
@@ -35,31 +36,43 @@
BURST_QUEUE_STATIC(g_bq, 8, 512, static)
/* Filler table */
-static struct burst_data fill_tn0[51];
+static struct burst_data fill[8][52];
+static uint8_t fill_size[8];
/* TRX Helpers **************************************************************/
static void
-trx_init_filler(void)
+trx_init_filler(uint8_t tn, uint8_t type)
{
int i;
- for (i=0; i<51; i++) {
- if ((i % 51) == 50)
- fill_tn0[i].type = BURST_DUMMY;
- else if (((i % 51) % 10) == 0)
- fill_tn0[i].type = BURST_FB;
- else if (((i % 51) % 10) == 1)
- fill_tn0[i].type = BURST_SB;
- else
- fill_tn0[i].type = BURST_DUMMY;
+ if ((type >> 1) == 2) {
+ for (i=0; i<51; i++) {
+ if ((i % 51) == 50)
+ fill[tn][i].type = BURST_DUMMY;
+ else if (((i % 51) % 10) == 0)
+ fill[tn][i].type = BURST_FB;
+ else if (((i % 51) % 10) == 1)
+ fill[tn][i].type = BURST_SB;
+ else
+ fill[tn][i].type = BURST_DUMMY;
+ }
+ fill_size[tn] = 51;
+ } else if ((type >> 1) == 3) {
+ for (i=0; i<51; i++)
+ fill[tn][i].type = BURST_DUMMY;
+ fill_size[tn] = 51;
+ } else {
+ for (i=0; i<52; i++)
+ fill[tn][i].type = BURST_DUMMY;
+ fill_size[tn] = 52;
}
}
static void
trx_discarded_burst(struct burst_data *burst,
- int head, uint32_t fn, __unused void *data)
+ int head, uint32_t fn, uint8_t tn, __unused void *data)
{
/* Only TN=0 */
if (head)
@@ -69,7 +82,7 @@ trx_discarded_burst(struct burst_data *burst,
printf("STALE BURST %" PRIu32 "\n", fn);
/* Still copy to the filler table */
- memcpy(&fill_tn0[fn % 51], burst, sizeof(struct burst_data));
+ memcpy(&fill[tn][fn % fill_size[tn]], burst, sizeof(struct burst_data));
}
@@ -78,12 +91,15 @@ trx_discarded_burst(struct burst_data *burst,
void
trx_init(void)
{
+ int i;
+
/* Init burst queue */
bq_reset(&g_bq);
bq_set_discard_fn(&g_bq, trx_discarded_burst, NULL);
/* Init filler table */
- trx_init_filler();
+ for (i = 0; i < 8; i++)
+ trx_init_filler(i, l1s.bts.type[i]);
}
int
@@ -119,12 +135,13 @@ trx_get_burst(uint32_t fn, uint8_t tn, uint8_t *data)
if (burst) {
/* New burst: Copy to fill table & use it */
- memcpy(&fill_tn0[fn % 51], burst, sizeof(struct burst_data));
+ memcpy(&fill[tn][fn % fill_size[tn]], burst,
+ sizeof(struct burst_data));
// printf("O %d %d %p\n", fn, g_bq.used, burst);
} else {
/* No data, just use the one from fill table */
- burst = &fill_tn0[fn % 51];
+ burst = &fill[tn][fn % fill_size[tn]];
}
rc = burst->type;
diff --git a/src/target/firmware/include/layer1/sync.h b/src/target/firmware/include/layer1/sync.h
index bb326117..f4b44140 100644
--- a/src/target/firmware/include/layer1/sync.h
+++ b/src/target/firmware/include/layer1/sync.h
@@ -163,6 +163,7 @@ struct l1s_state {
/* bts mode */
struct {
+ uint8_t type[8];
uint16_t arfcn;
uint8_t bsic;
uint8_t gain;
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index 11b8f1bb..5d1b11bd 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -641,12 +641,18 @@ static int l1ctl_bts_mode(struct msgb *msg)
l1s.tx_power = ms_pwr_ctl_lvl(gsm_arfcn2band(l1s.bts.arfcn), 15);
- printf("BTS MODE: %u %u\n", l1s.bts.bsic, l1s.bts.arfcn);
+ printf("BTS MODE: %u %u {%u}\n", l1s.bts.bsic, l1s.bts.arfcn,
+ bm->type[0]);
l1a_mftask_set(0);
if (bm->enabled) {
+ int i;
+
mframe_enable(MF_TASK_BTS_SYNC);
mframe_enable(MF_TASK_BTS);
+ for (i = 0; i < 8; i++)
+ l1s.bts.type[i] = bm->type[i];
+ trx_init();
l1s.bts.gain = bm->gain;
} else {
mframe_enable(MF_TASK_BCCH_NORM);
diff --git a/src/target/firmware/layer1/prim_bts.c b/src/target/firmware/layer1/prim_bts.c
index 92f455b0..d02fa068 100644
--- a/src/target/firmware/layer1/prim_bts.c
+++ b/src/target/firmware/layer1/prim_bts.c
@@ -251,7 +251,11 @@ l1s_bts_cmd(uint8_t p1, uint8_t p2, uint16_t p3)
t3 = t3 - 1;
/* Select which type of burst */
- if ((t3 >= 14) && (t3 <= 36))
+ if ((l1s.bts.type[0] >> 1) != 2)
+ db->rx[0].cmd = DSP_EXT_RX_CMD_NB;
+ else if ((t3 >= 14) && (t3 <= 36))
+ db->rx[0].cmd = DSP_EXT_RX_CMD_AB;
+ else if ((t3 == 4) || (t3 == 5))
db->rx[0].cmd = DSP_EXT_RX_CMD_AB;
else if ((t3 == 45) || (t3 == 46))
db->rx[0].cmd = DSP_EXT_RX_CMD_AB;
diff --git a/src/target/firmware/layer1/trx_dummy.c b/src/target/firmware/layer1/trx_dummy.c
index 44ca4f17..b5ebc41b 100644
--- a/src/target/firmware/layer1/trx_dummy.c
+++ b/src/target/firmware/layer1/trx_dummy.c
@@ -40,3 +40,8 @@ trx_put_burst(uint32_t fn, uint8_t tn, uint8_t type, uint8_t *data)
{
return 0;
}
+
+void
+trx_init(void)
+{
+}