diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2010-06-21 22:10:07 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-06-24 18:57:28 +0200 |
commit | f92038e7c0597602c665ccf947779597e5691bbb (patch) | |
tree | 623f16c22fcffd71425a8f86b04706388dc068e4 /src/target/firmware | |
parent | 16cd41e8093fc3c5781375fd32fc6da25306cae3 (diff) |
layer1: Introduce a decicated channel state in l1s
We also make sure to set it properly during a DED EST REQ.
The state is currently unused tough.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/target/firmware')
-rw-r--r-- | src/target/firmware/include/layer1/sync.h | 28 | ||||
-rw-r--r-- | src/target/firmware/layer1/l23_api.c | 35 |
2 files changed, 62 insertions, 1 deletions
diff --git a/src/target/firmware/include/layer1/sync.h b/src/target/firmware/include/layer1/sync.h index 137ea9f8..760b44ce 100644 --- a/src/target/firmware/include/layer1/sync.h +++ b/src/target/firmware/include/layer1/sync.h @@ -90,6 +90,34 @@ struct l1s_state { struct { uint8_t ra; } rach; + + struct { + enum { + GSM_DCHAN_NONE = 0, + GSM_DCHAN_SDCCH_4, + GSM_DCHAN_SDCCH_8, + GSM_DCHAN_TCH_H, + GSM_DCHAN_TCH_F, + GSM_DCHAN_UNKNOWN, + } type; + + uint8_t scn; + uint8_t tsc; + uint8_t tn; + uint8_t h; + + union { + struct { + uint16_t arfcn; + } h0; + struct { + uint8_t hsn; + uint8_t maio; + uint8_t n; + uint16_t ma[64]; + } h1; + }; + } dedicated; }; extern struct l1s_state l1s; diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c index 0edc1ad0..4b673e64 100644 --- a/src/target/firmware/layer1/l23_api.c +++ b/src/target/firmware/layer1/l23_api.c @@ -24,6 +24,7 @@ #include <stdint.h> #include <stdio.h> +#include <string.h> #include <debug.h> #include <byteorder.h> @@ -79,6 +80,22 @@ static enum mframe_task chan_nr2mf_task(uint8_t chan_nr) return 0; } +static int chan_nr2dchan_type(uint8_t chan_nr) +{ + uint8_t cbits = chan_nr >> 3; + + if (cbits == 0x01) { + return GSM_DCHAN_TCH_F; + } else if ((cbits & 0x1e) == 0x02) { + return GSM_DCHAN_TCH_H; + } else if ((cbits & 0x1c) == 0x04) { + return GSM_DCHAN_SDCCH_4; + } else if ((cbits & 0x18) == 0x08) { + return GSM_DCHAN_SDCCH_8; + } + return GSM_DCHAN_UNKNOWN; +} + struct msgb *l1ctl_msgb_alloc(uint8_t msg_type) { struct msgb *msg; @@ -168,7 +185,23 @@ static void l1ctl_rx_dm_est_req(struct msgb *msg) return; } - /* FIXME: set TSC of ded chan according to est_req.tsc */ + /* configure dedicated channel state */ + l1s.dedicated.type = chan_nr2dchan_type(ul->chan_nr); + l1s.dedicated.tsc = est_req->tsc; + l1s.dedicated.tn = ul->chan_nr & 0x7; + l1s.dedicated.h = est_req->h; + + if (est_req->h) { + int i; + l1s.dedicated.h1.hsn = est_req->h1.hsn; + l1s.dedicated.h1.maio = est_req->h1.maio; + l1s.dedicated.h1.n = est_req->h1.n; + for (i=0; i<est_req->h1.n; i++) + l1s.dedicated.h1.ma[i] = ntohs(est_req->h1.ma[i]); + } else { + l1s.dedicated.h0.arfcn = ntohs(est_req->h0.band_arfcn); + } + /* figure out which MF tasks to enable */ l1a_mftask_set(1 << chan_nr2mf_task(ul->chan_nr)); } |