diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2013-02-27 09:51:09 +0100 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2013-02-27 09:51:09 +0100 |
commit | 81dd60564f7f4e06b0a0d3bbf81f1ad333c9313e (patch) | |
tree | 40a8009bd5198b094379176bc1b15d8b39a87378 /src | |
parent | b7dc02e8e17a36064bb8da285b57f80a313833c9 (diff) |
Transceiver application uses SETSLOT command to configure slot type
Diffstat (limited to 'src')
-rw-r--r-- | src/host/layer23/src/transceiver/l1ctl.c | 9 | ||||
-rw-r--r-- | src/host/layer23/src/transceiver/l1ctl.h | 3 | ||||
-rw-r--r-- | src/host/layer23/src/transceiver/trx.c | 20 | ||||
-rw-r--r-- | src/host/layer23/src/transceiver/trx.h | 2 |
4 files changed, 25 insertions, 9 deletions
diff --git a/src/host/layer23/src/transceiver/l1ctl.c b/src/host/layer23/src/transceiver/l1ctl.c index 0c66f128..0f7d63d3 100644 --- a/src/host/layer23/src/transceiver/l1ctl.c +++ b/src/host/layer23/src/transceiver/l1ctl.c @@ -113,11 +113,12 @@ l1ctl_tx_fbsb_req(struct l1ctl_link *l1l, int l1ctl_tx_bts_mode(struct l1ctl_link *l1l, - uint8_t enabled, uint8_t bsic, uint16_t band_arfcn, - int gain) + uint8_t enabled, uint8_t *type, uint8_t bsic, + uint16_t band_arfcn, int gain) { struct msgb *msg; struct l1ctl_bts_mode *be; + int i; msg = _l1ctl_alloc(L1CTL_BTS_MODE); if (!msg) @@ -128,6 +129,8 @@ l1ctl_tx_bts_mode(struct l1ctl_link *l1l, be = (struct l1ctl_bts_mode *) msgb_put(msg, sizeof(*be)); be->enabled = enabled; + for (i = 0; i < 8; i++) + be->type[i] = type[i]; be->bsic = bsic; be->band_arfcn = htons(band_arfcn); be->gain = gain; @@ -195,7 +198,7 @@ _l1ctl_rx_bts_burst_nb_ind(struct app_state *as, struct msgb *msg) for (i=0; i<148; i++) data[i] = data[i] ? -127 : 127; - trx_data_ind(as->trx, fn, 0, data, 0.0f); + trx_data_ind(as->trx, fn, bi->tn, data, 0.0f); exit: msgb_free(msg); diff --git a/src/host/layer23/src/transceiver/l1ctl.h b/src/host/layer23/src/transceiver/l1ctl.h index 9856fc2f..74d074b6 100644 --- a/src/host/layer23/src/transceiver/l1ctl.h +++ b/src/host/layer23/src/transceiver/l1ctl.h @@ -39,7 +39,8 @@ int l1ctl_tx_fbsb_req(struct l1ctl_link *l1l, uint16_t arfcn, uint8_t flags, uint16_t timeout, uint8_t sync_info_idx, uint8_t ccch_mode); int l1ctl_tx_bts_mode(struct l1ctl_link *l1l, - uint8_t enabled, uint8_t bsic, uint16_t band_arfcn, int gain); + uint8_t enabled, uint8_t *type, uint8_t bsic, uint16_t band_arfcn, + int gain); int l1ctl_tx_bts_burst_req(struct l1ctl_link *l1l, uint32_t fn, uint8_t tn, struct burst_data *burst); diff --git a/src/host/layer23/src/transceiver/trx.c b/src/host/layer23/src/transceiver/trx.c index ae21344d..e531a298 100644 --- a/src/host/layer23/src/transceiver/trx.c +++ b/src/host/layer23/src/transceiver/trx.c @@ -228,7 +228,8 @@ _trx_ctrl_send_resp(struct trx *trx, const char *cmd, const char *fmt, ...) static int _trx_ctrl_cmd_poweroff(struct trx *trx, const char *cmd, const char *args) { - l1ctl_tx_bts_mode(trx->l1l, 0, 0, 0, 0); + l1ctl_tx_bts_mode(trx->l1l, 0, trx->type, 0, 0, 0); + trx->power = 0; return _trx_ctrl_send_resp(trx, cmd, "%d", 0); } @@ -243,7 +244,8 @@ _trx_ctrl_cmd_poweron(struct trx *trx, const char *cmd, const char *args) "TRX received POWERON when not fully configured\n"); rv = -EINVAL; } else { - rv = l1ctl_tx_bts_mode(trx->l1l, 1, trx->bsic, trx->arfcn, trx->gain); + rv = l1ctl_tx_bts_mode(trx->l1l, 1, trx->type, trx->bsic, trx->arfcn, trx->gain); + trx->power = 1; } return _trx_ctrl_send_resp(trx, cmd, "%d", rv); @@ -286,7 +288,9 @@ _trx_ctrl_cmd_setrxgain(struct trx *trx, const char *cmd, const char *args) trx->gain = db; - l1ctl_tx_bts_mode(trx->l1l, 1, trx->bsic, trx->arfcn, trx->gain); + if (trx->power) + l1ctl_tx_bts_mode(trx->l1l, 1, trx->type, trx->bsic, trx->arfcn, + trx->gain); return _trx_ctrl_send_resp(trx, cmd, "%d %d", 0, db); } @@ -314,9 +318,15 @@ _trx_ctrl_cmd_setslot(struct trx *trx, const char *cmd, const char *args) n = sscanf(args, "%d %d", &tn, &type); - if ((n != 2) || (tn < 0) || (tn > 7) || (type < 0) || (type > 8)) + if ((n != 2) || (tn < 0) || (tn > 7) || (type < 0) || ((type > 8) && (type != 13))) return _trx_ctrl_send_resp(trx, cmd, "%d %d %d", -1, tn, type); + trx->type[tn] = type; + + if (trx->power) + l1ctl_tx_bts_mode(trx->l1l, 1, trx->type, trx->bsic, trx->arfcn, + trx->gain); + return _trx_ctrl_send_resp(trx, cmd, "%d %d", 0, type); } @@ -496,7 +506,7 @@ _trx_data_read_cb(struct osmo_fd *ofd, unsigned int what) data = buf+6; /* Ignore FCCH and SCH completely, they're handled internally */ - if (((fn % 51) % 10) < 2) + if ((trx->type[tn] >> 1) == 2 && ((fn % 51) % 10) < 2) goto skip; /* Detect dummy bursts */ diff --git a/src/host/layer23/src/transceiver/trx.h b/src/host/layer23/src/transceiver/trx.h index 19e02fcf..00f3664a 100644 --- a/src/host/layer23/src/transceiver/trx.h +++ b/src/host/layer23/src/transceiver/trx.h @@ -48,9 +48,11 @@ struct trx { struct l1ctl_link *l1l; /* TRX configuration */ + int power; uint16_t arfcn; uint8_t bsic; int gain; + uint8_t type[8]; }; |