diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2013-01-16 23:06:59 +0100 |
---|---|---|
committer | Steve Markgraf <steve@steve-m.de> | 2021-10-23 18:51:19 +0200 |
commit | ccff6bbe562b9b2f085aa01faf7a6dff2f8ccf66 (patch) | |
tree | 953b745129ed91edf0b37cb5bc2bd4689d6597f4 | |
parent | e6e5025c9c56411df95b5a0181b4389cf78ebd8d (diff) |
fw/l1/l23_api: Wire the L1CTL to the internal TRX interface & prim_bts
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r-- | src/target/firmware/layer1/l23_api.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c index da57cc27..b45f735a 100644 --- a/src/target/firmware/layer1/l23_api.c +++ b/src/target/firmware/layer1/l23_api.c @@ -22,6 +22,7 @@ #define DEBUG +#include <errno.h> #include <stdint.h> #include <stdio.h> #include <string.h> @@ -41,6 +42,7 @@ #include <layer1/prim.h> #include <layer1/tpu_window.h> #include <layer1/sched_gsmtime.h> +#include <layer1/trx.h> #include <abb/twl3025.h> #include <rf/trf6151.h> @@ -624,6 +626,45 @@ static void l1ctl_sim_req(struct msgb *msg) sim_apdu(len, data); } +static int l1ctl_bts_mode(struct msgb *msg) +{ + struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data; + struct l1ctl_bts_mode *bm = (struct l1ctl_bts_mode *) l1h->data; + + if (msg->len < (sizeof(*l1h) + sizeof(*bm))) { + printf("l1ctl_bts_mode: Short message. %u\n", msg->len); + return -EINVAL; + } + + l1s.bts.bsic = bm->bsic; + l1s.bts.arfcn = ntohs(bm->band_arfcn); + + 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); + + if (bm->enabled) { + mframe_enable(MF_TASK_BTS); + } else { + mframe_disable(MF_TASK_BTS); + } + + return 0; +} + +static int l1ctl_bts_burst_req(struct msgb *msg) +{ + struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data; + struct l1ctl_bts_burst_req *br = (struct l1ctl_bts_burst_req *) l1h->data; + + if (msg->len < sizeof(*l1h) + sizeof(*br)) { + printf("l1ctl_bts_burst_req: Short message. %u\n", msg->len); + return -EINVAL; + } + + return trx_put_burst(ntohl(br->fn), br->tn, br->type, br->data); +} + static struct llist_head l23_rx_queue = LLIST_HEAD_INIT(l23_rx_queue); /* callback from SERCOMM when L2 sends a message to L1 */ @@ -715,6 +756,12 @@ void l1a_l23_handler(void) case L1CTL_SIM_REQ: l1ctl_sim_req(msg); break; + case L1CTL_BTS_MODE: + l1ctl_bts_mode(msg); + break; + case L1CTL_BTS_BURST_REQ: + l1ctl_bts_burst_req(msg); + break; } exit_msgbfree: |