diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2013-01-16 23:06:59 +0100 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2013-10-05 19:44:39 +0200 |
commit | e32f79e69ec75c6164bdc13358079c7b5a53007d (patch) | |
tree | 70df12baa9a58fec5b88ba2bc6ab763acda352be /src | |
parent | 1393fa3ea3ba652c2ad3e3ecd206e9ec086a85e7 (diff) |
fw/l1/l23_api: Wire the L1CTL to the internal TRX interface & prim_bts
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src')
-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 49aeb455..342196f8 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> @@ -586,6 +588,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 */ @@ -677,6 +718,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: |