aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-08-02 11:54:56 +0200
committerHarald Welte <laforge@osmocom.org>2020-08-02 11:57:55 +0200
commitb3b474d8ade2c28ab8b0e3021dea87fae19b333c (patch)
tree455e341bfd152ff031633639f21da7b277c37c34 /src/gsm
parenteb8240d56422b23a6aa2ba62ad57c9dee19047d1 (diff)
i460: pass more context to call-back functions
When calling a user-provided call-back function for the i460 mux or demux, always pass a pointer to the osmo_i460_subchan the callback relates to. This way, the user can walk the i460 data structures to obtain information about which mux/demux instances is calling. Change-Id: Id842c72ce371a67fe5df6694e195c281aaf607ab
Diffstat (limited to 'src/gsm')
-rw-r--r--src/gsm/i460_mux.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gsm/i460_mux.c b/src/gsm/i460_mux.c
index 3b2a589f..320e781b 100644
--- a/src/gsm/i460_mux.c
+++ b/src/gsm/i460_mux.c
@@ -69,14 +69,14 @@ static void demux_subchan_append_bit(struct osmo_i460_subchan *schan, uint8_t bi
if (demux->out_idx >= demux->out_bitbuf_size) {
if (demux->out_cb_bits)
- demux->out_cb_bits(demux->user_data, demux->out_bitbuf, demux->out_idx);
+ demux->out_cb_bits(schan, demux->user_data, demux->out_bitbuf, demux->out_idx);
else {
/* pack bits into bytes */
OSMO_ASSERT((demux->out_idx % 8) == 0);
unsigned int num_bytes = demux->out_idx / 8;
uint8_t bytes[num_bytes];
osmo_ubit2pbit(bytes, demux->out_bitbuf, demux->out_idx);
- demux->out_cb_bytes(demux->user_data, bytes, num_bytes);
+ demux->out_cb_bytes(schan, demux->user_data, bytes, num_bytes);
}
demux->out_idx = 0;
}
@@ -137,11 +137,11 @@ void osmo_i460_demux_in(struct osmo_i460_timeslot *ts, const uint8_t *data, size
schan = &ts->schan[0];
demux = &schan->demux;
if (demux->out_cb_bytes)
- demux->out_cb_bytes(demux->user_data, data, data_len);
+ demux->out_cb_bytes(schan, demux->user_data, data, data_len);
else {
ubit_t bits[data_len*8];
osmo_pbit2ubit(bits, data, data_len*8);
- demux->out_cb_bits(demux->user_data, bits, data_len*8);
+ demux->out_cb_bits(schan, demux->user_data, bits, data_len*8);
}
return;
}
@@ -178,7 +178,7 @@ static ubit_t mux_schan_provide_bit(struct osmo_i460_subchan *schan)
if (llist_empty(&mux->tx_queue)) {
/* User code now has a last chance to put something into the queue. */
if (mux->in_cb_queue_empty)
- mux->in_cb_queue_empty(mux->user_data);
+ mux->in_cb_queue_empty(schan, mux->user_data);
/* If the queue is still empty, return idle bits */
if (llist_empty(&mux->tx_queue))