aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric <ewild@sysmocom.de>2020-04-12 22:02:02 +0200
committerEric <ewild@sysmocom.de>2020-08-26 17:35:18 +0200
commit62dfcac2f034f9945c6f5c4c8dcec7b25e2ece05 (patch)
treeb7024be9edf2d7d68c3912c908946679cf1ab86b
parentWIP: comments (diff)
downloadOsmoTRX-62dfcac2f034f9945c6f5c4c8dcec7b25e2ece05.tar.xz
OsmoTRX-62dfcac2f034f9945c6f5c4c8dcec7b25e2ece05.zip
ipc: fix shm size calculation
Total size was previously only as large as sizeof(struct ipc_shm_raw_stream) + sizeof(uint32_t)*num_buffers.... Change-Id: I1205b56a4b11bdf32fbdbfb82b67da36965a7981
-rw-r--r--Transceiver52M/device/ipc/shm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Transceiver52M/device/ipc/shm.c b/Transceiver52M/device/ipc/shm.c
index cafb4f2..41de233 100644
--- a/Transceiver52M/device/ipc/shm.c
+++ b/Transceiver52M/device/ipc/shm.c
@@ -110,11 +110,11 @@ unsigned int ipc_shm_encode_region(struct ipc_shm_raw_region *root_raw, uint32_t
if (root_raw)
root_raw->num_chans = num_chans;
for (i = 0; i < num_chans; i++) {
- if (root_raw) {
- root_raw->chan_offset[i] = (start + offset - (uint8_t*)root_raw);
- fprintf(stderr, "encode: channel %d chan_offset[i]=%u\n", i, root_raw->chan_offset[i]);
- offset += ipc_shm_encode_channel(root_raw, (struct ipc_shm_raw_channel *)(start + offset), num_buffers, buffer_size);
- }
+ uint32_t ofs = (start + offset - (uint8_t*)root_raw);
+ if (root_raw)
+ root_raw->chan_offset[i] = (start + offset - (uint8_t*)root_raw);
+ fprintf(stderr, "encode: channel %d chan_offset[i]=%u\n", i, ofs);
+ offset += ipc_shm_encode_channel(root_raw, (struct ipc_shm_raw_channel *)(start + offset), num_buffers, buffer_size);
}
//TODO: pass maximum size and verify we didn't go through
return offset;