diff options
author | Eric Wild <ewild@sysmocom.de> | 2020-03-24 17:19:27 +0100 |
---|---|---|
committer | Eric <ewild@sysmocom.de> | 2020-08-25 01:00:03 +0200 |
commit | 1e17c4fb0a77dcee49a7cd566dca7e8f48f6d8e7 (patch) | |
tree | 9e680f91408ff7741fe62d7689ad420c1f48648a /Transceiver52M/device/ipc/ipc_shm.h | |
parent | f9a2f4427277f36b9459cd349512f6ca3230fe9c (diff) |
osmo-trx-ipc
This adds a IPC backend that uses shared memory interface
to communicate with (proprietary) devices.
Requires config file option
dev-args ipc_msock=/path/to/socket
to specify the master socket the ipc backend should connect to.
If UHD is avaialble the ipc-driver-test tool can be used to test the
backend with a uhd device, this was so far only tested with a b2xx.
Change-Id: Ice63d3499026293ade8aad675ff7a883bcdd5756
Diffstat (limited to 'Transceiver52M/device/ipc/ipc_shm.h')
-rw-r--r-- | Transceiver52M/device/ipc/ipc_shm.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Transceiver52M/device/ipc/ipc_shm.h b/Transceiver52M/device/ipc/ipc_shm.h new file mode 100644 index 0000000..348e703 --- /dev/null +++ b/Transceiver52M/device/ipc/ipc_shm.h @@ -0,0 +1,45 @@ +/* +* Copyright 2020 sysmocom - s.f.m.c. GmbH <info@sysmocom.de> +* Author: Eric Wild <ewild@sysmocom.de> +* +* SPDX-License-Identifier: 0BSD +* +* Permission to use, copy, modify, and/or distribute this software for any purpose +* with or without fee is hereby granted.THE SOFTWARE IS PROVIDED "AS IS" AND THE +* AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR +* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE +* USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +#ifndef IPC_SHM_H +#define IPC_SHM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <shm.h> +#include <stdint.h> + +#ifdef __cplusplus +} +#endif + +struct ipc_shm_io { + volatile struct ipc_shm_raw_stream *this_stream; + volatile struct ipc_shm_raw_smpl_buf **volatile buf_ptrs; + uint32_t partial_read_begin_ptr; +}; + +struct ipc_shm_io *ipc_shm_init_consumer(struct ipc_shm_stream *s); +struct ipc_shm_io *ipc_shm_init_producer(struct ipc_shm_stream *s); +void ipc_shm_close(struct ipc_shm_io *r); +int32_t ipc_shm_enqueue(struct ipc_shm_io *r, uint64_t timestamp, uint32_t len_in_sps, uint16_t *data); +int32_t ipc_shm_tryenqueue(struct ipc_shm_io *r, uint64_t timestamp, uint32_t len_in_sps, uint16_t *data); +volatile struct ipc_shm_raw_smpl_buf *ipc_shm_dequeue(struct ipc_shm_io *r); +int32_t ipc_shm_read(struct ipc_shm_io *r, uint16_t *out_buf, uint32_t num_samples, uint64_t *timestamp, + uint32_t timeout_seconds); + +#endif // IPC_SHM_H |