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
diff --git a/src/gsm/i460_mux.c b/src/gsm/i460_mux.c
index 3b2a589..320e781 100644
--- a/src/gsm/i460_mux.c
+++ b/src/gsm/i460_mux.c
@@ -69,14 +69,14 @@
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 @@
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 @@
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))