[layer23] Added support for changing TCH mode via L1CTL messages

This commit is contained in:
Andreas.Eversberg 2010-09-26 17:06:06 +00:00
parent 88a578f6c9
commit 602dcf4d0d
4 changed files with 72 additions and 1 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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;