diff options
-rw-r--r-- | include/l1ctl_proto.h | 17 | ||||
-rw-r--r-- | src/host/layer23/include/osmocom/bb/common/l1ctl.h | 3 | ||||
-rw-r--r-- | src/host/layer23/include/osmocom/bb/common/osmocom_data.h | 6 | ||||
-rw-r--r-- | src/host/layer23/src/common/l1ctl.c | 47 |
4 files changed, 72 insertions, 1 deletions
diff --git a/include/l1ctl_proto.h b/include/l1ctl_proto.h index 80687a1a..f2880eb5 100644 --- a/include/l1ctl_proto.h +++ b/include/l1ctl_proto.h @@ -49,6 +49,8 @@ enum { L1CTL_CRYPTO_REQ, L1CTL_SIM_REQ, L1CTL_SIM_CONF, + L1CTL_TCH_MODE_REQ, + L1CTL_TCH_MODE_CONF, }; enum ccch_mode { @@ -107,6 +109,12 @@ struct l1ctl_ccch_mode_conf { uint8_t padding[3]; } __attribute__((packed)); +/* TCH mode was changed */ +struct l1ctl_tch_mode_conf { + uint8_t tch_mode; /* enum tch_mode */ + uint8_t padding[3]; +} __attribute__((packed)); + /* data on the CCCH was found. This is following the header */ struct l1ctl_data_ind { uint8_t data[23]; @@ -156,6 +164,15 @@ struct l1ctl_ccch_mode_req { uint8_t padding[3]; } __attribute__((packed)); +/* + * msg for TCH_MODE_REQ + * the l1_info_ul header is in front + */ +struct l1ctl_tch_mode_req { + uint8_t tch_mode; /* enum gsm48_chan_mode */ + uint8_t padding[3]; +} __attribute__((packed)); + /* the l1_info_ul header is in front */ struct l1ctl_rach_req { uint8_t ra; diff --git a/src/host/layer23/include/osmocom/bb/common/l1ctl.h b/src/host/layer23/include/osmocom/bb/common/l1ctl.h index 189df898..20e9481c 100644 --- a/src/host/layer23/include/osmocom/bb/common/l1ctl.h +++ b/src/host/layer23/include/osmocom/bb/common/l1ctl.h @@ -46,6 +46,9 @@ int l1ctl_tx_fbsb_req(struct osmocom_ms *ms, uint16_t arfcn, /* Transmit CCCH_MODE_REQ */ int l1ctl_tx_ccch_mode_req(struct osmocom_ms *ms, uint8_t ccch_mode); +/* Transmit TCH_MODE_REQ */ +int l1ctl_tx_tch_mode_req(struct osmocom_ms *ms, uint8_t tch_mode); + /* Transmit ECHO_REQ */ int l1ctl_tx_echo_req(struct osmocom_ms *ms, unsigned int len); diff --git a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h index ce08994f..a20b177f 100644 --- a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h +++ b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h @@ -75,6 +75,7 @@ enum osmobb_meas_sig { S_L1CTL_PM_RES, S_L1CTL_PM_DONE, S_L1CTL_CCCH_MODE_CONF, + S_L1CTL_TCH_MODE_CONF, }; struct osmobb_fbsb_res { @@ -94,4 +95,9 @@ struct osmobb_ccch_mode_conf { uint8_t ccch_mode; }; +struct osmobb_tch_mode_conf { + struct osmocom_ms *ms; + uint8_t tch_mode; +}; + #endif diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c index 86ff59bf..66643635 100644 --- a/src/host/layer23/src/common/l1ctl.c +++ b/src/host/layer23/src/common/l1ctl.c @@ -302,6 +302,24 @@ int l1ctl_tx_ccch_mode_req(struct osmocom_ms *ms, uint8_t ccch_mode) return osmo_send_l1(ms, msg); } +/* Transmit L1CTL_TCH_MODE_REQ */ +int l1ctl_tx_tch_mode_req(struct osmocom_ms *ms, uint8_t tch_mode) +{ + struct msgb *msg; + struct l1ctl_tch_mode_req *req; + + printf("TCH Mode Req\n"); + + msg = osmo_l1_alloc(L1CTL_TCH_MODE_REQ); + if (!msg) + return -1; + + req = (struct l1ctl_tch_mode_req *) msgb_put(msg, sizeof(*req)); + req->tch_mode = tch_mode; + + return osmo_send_l1(ms, msg); +} + /* Transmit L1CTL_PARAM_REQ */ int l1ctl_tx_param_req(struct osmocom_ms *ms, uint8_t ta, uint8_t tx_power) { @@ -622,7 +640,7 @@ static int rx_l1_pm_conf(struct osmocom_ms *ms, struct msgb *msg) return 0; } -/* Receive L1CTL_MODE_CONF */ +/* Receive L1CTL_CCCH_MODE_CONF */ static int rx_l1_ccch_mode_conf(struct osmocom_ms *ms, struct msgb *msg) { struct osmobb_ccch_mode_conf mc; @@ -645,6 +663,29 @@ static int rx_l1_ccch_mode_conf(struct osmocom_ms *ms, struct msgb *msg) return 0; } +/* Receive L1CTL_TCH_MODE_CONF */ +static int rx_l1_tch_mode_conf(struct osmocom_ms *ms, struct msgb *msg) +{ + struct osmobb_tch_mode_conf mc; + struct l1ctl_tch_mode_conf *conf; + + if (msgb_l3len(msg) < sizeof(*conf)) { + LOGP(DL1C, LOGL_ERROR, "MODE CONF: MSG too short %u\n", + msgb_l3len(msg)); + return -1; + } + + conf = (struct l1ctl_tch_mode_conf *) msg->l1h; + + printf("mode=%u\n", conf->tch_mode); + + mc.tch_mode = conf->tch_mode; + mc.ms = ms; + dispatch_signal(SS_L1CTL, S_L1CTL_TCH_MODE_CONF, &mc); + + return 0; +} + /* Receive incoming data from L1 using L1CTL format */ int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg) { @@ -694,6 +735,10 @@ int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg) rc = rx_l1_ccch_mode_conf(ms, msg); msgb_free(msg); break; + case L1CTL_TCH_MODE_CONF: + rc = rx_l1_tch_mode_conf(ms, msg); + msgb_free(msg); + break; case L1CTL_SIM_CONF: rc = rx_l1_sim_conf(ms, msg); break; |