trxcon: implement Ready-to-Receive PHYIF API
This API is going to be used by osmo-trx-ms for inquiring the l1sched about an lchan state before attempting to demodulate a Downlink burst. Change-Id: I9a71b8a59733f4dd908b760c5e23ea3d624afb1a Related: OS#5599
This commit is contained in:
parent
b76c330f6d
commit
a4aac5c355
|
@ -162,6 +162,16 @@ struct l1sched_burst_ind {
|
|||
size_t burst_len;
|
||||
};
|
||||
|
||||
/* Probed lchan is active */
|
||||
#define L1SCHED_PROBE_F_ACTIVE (1 << 0)
|
||||
|
||||
/* RTR (Ready-to-Receive) probe */
|
||||
struct l1sched_probe {
|
||||
uint32_t flags; /* see L1SCHED_PROBE_F_* above */
|
||||
uint32_t fn;
|
||||
uint8_t tn;
|
||||
};
|
||||
|
||||
typedef int l1sched_lchan_rx_func(struct l1sched_lchan_state *lchan,
|
||||
const struct l1sched_burst_ind *bi);
|
||||
|
||||
|
@ -477,6 +487,8 @@ void l1sched_prim_flush_queue(struct llist_head *list);
|
|||
|
||||
int l1sched_handle_rx_burst(struct l1sched_state *sched,
|
||||
struct l1sched_burst_ind *bi);
|
||||
int l1sched_handle_rx_probe(struct l1sched_state *sched,
|
||||
struct l1sched_probe *probe);
|
||||
|
||||
/* Shared declarations for lchan handlers */
|
||||
extern const uint8_t l1sched_nb_training_bits[8][26];
|
||||
|
|
|
@ -75,6 +75,20 @@ struct trxcon_phyif_rts_ind {
|
|||
uint8_t tn;
|
||||
};
|
||||
|
||||
/* RTR.ind - Ready-to-Receive indicaton */
|
||||
struct trxcon_phyif_rtr_ind {
|
||||
uint32_t fn;
|
||||
uint8_t tn;
|
||||
};
|
||||
|
||||
/* The probed lchan is active */
|
||||
#define TRXCON_PHYIF_RTR_F_ACTIVE (1 << 0)
|
||||
|
||||
/* RTR.rsp - Ready-to-Receive response */
|
||||
struct trxcon_phyif_rtr_rsp {
|
||||
uint32_t flags; /* see TRXCON_PHYIF_RTR_F_* above */
|
||||
};
|
||||
|
||||
/* BURST.req - a burst to be transmitted */
|
||||
struct trxcon_phyif_burst_req {
|
||||
uint32_t fn;
|
||||
|
@ -99,6 +113,8 @@ int trxcon_phyif_handle_burst_ind(void *priv, const struct trxcon_phyif_burst_in
|
|||
int trxcon_phyif_handle_clock_ind(void *priv, uint32_t fn);
|
||||
|
||||
int trxcon_phyif_handle_rts_ind(void *priv, const struct trxcon_phyif_rts_ind *rts);
|
||||
int trxcon_phyif_handle_rtr_ind(void *priv, const struct trxcon_phyif_rtr_ind *ind,
|
||||
struct trxcon_phyif_rtr_rsp *rsp);
|
||||
|
||||
int trxcon_phyif_handle_cmd(void *phyif, const struct trxcon_phyif_cmd *cmd);
|
||||
int trxcon_phyif_handle_rsp(void *priv, const struct trxcon_phyif_rsp *rsp);
|
||||
|
|
|
@ -804,6 +804,36 @@ int l1sched_handle_rx_burst(struct l1sched_state *sched,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int l1sched_handle_rx_probe(struct l1sched_state *sched,
|
||||
struct l1sched_probe *probe)
|
||||
{
|
||||
struct l1sched_ts *ts = sched->ts[probe->tn];
|
||||
const struct l1sched_tdma_frame *frame;
|
||||
struct l1sched_lchan_state *lchan;
|
||||
unsigned int offset;
|
||||
|
||||
/* Check whether required timeslot is allocated and configured */
|
||||
if (ts == NULL || ts->mf_layout == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
/* Get frame from multiframe */
|
||||
offset = probe->fn % ts->mf_layout->period;
|
||||
frame = &ts->mf_layout->frames[offset];
|
||||
|
||||
if (l1sched_lchan_desc[frame->dl_chan].rx_fn == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
/* Find the appropriate logical channel */
|
||||
lchan = l1sched_find_lchan(ts, frame->dl_chan);
|
||||
if (lchan == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
if (lchan->active)
|
||||
probe->flags |= L1SCHED_PROBE_F_ACTIVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define MEAS_HIST_FIRST(hist) \
|
||||
(&hist->buf[0])
|
||||
#define MEAS_HIST_LAST(hist) \
|
||||
|
|
|
@ -233,6 +233,25 @@ int trxcon_phyif_handle_rts_ind(void *priv, const struct trxcon_phyif_rts_ind *r
|
|||
return l1sched_handle_burst_req(trxcon->sched, &br);
|
||||
}
|
||||
|
||||
int trxcon_phyif_handle_rtr_ind(void *priv, const struct trxcon_phyif_rtr_ind *ind,
|
||||
struct trxcon_phyif_rtr_rsp *rsp)
|
||||
{
|
||||
struct trxcon_inst *trxcon = priv;
|
||||
struct l1sched_probe probe = {
|
||||
.fn = ind->fn,
|
||||
.tn = ind->tn,
|
||||
};
|
||||
|
||||
l1sched_handle_rx_probe(trxcon->sched, &probe);
|
||||
|
||||
memset(rsp, 0x00, sizeof(*rsp));
|
||||
|
||||
if (probe.flags & L1SCHED_PROBE_F_ACTIVE)
|
||||
rsp->flags |= TRXCON_PHYIF_RTR_F_ACTIVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int trxcon_phyif_handle_burst_ind(void *priv, const struct trxcon_phyif_burst_ind *phybi)
|
||||
{
|
||||
struct trxcon_inst *trxcon = priv;
|
||||
|
|
Loading…
Reference in New Issue