Skip to content

Commit

Permalink
IIOD: Remove dependency on iio-private.h
Browse files Browse the repository at this point in the history
Re-introduce a few macros that were provided by iio-private.h that are
called from within IIOD.

Starting from now, IIOD can run fully on top of the public libiio API,
without shenanigans.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed May 19, 2021
1 parent 346e41c commit 3c36a0c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 0 additions & 1 deletion iiod/ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "parser.h"
#include "thread-pool.h"
#include "../debug.h"
#include "../iio-private.h"

#include <errno.h>
#include <limits.h>
Expand Down
19 changes: 18 additions & 1 deletion iiod/ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#ifndef __OPS_H__
#define __OPS_H__

#include "../iio-private.h"
#include "queue.h"

#include <endian.h>
#include <errno.h>
#include <iio.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Expand All @@ -38,9 +38,21 @@
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
#endif

#define BIT(x) (1 << (x))
#define BIT_MASK(bit) BIT((bit) % 32)
#define BIT_WORD(bit) ((bit) / 32)
#define TEST_BIT(addr, bit) (!!(*(((uint32_t *) addr) + BIT_WORD(bit)) \
& BIT_MASK(bit)))

struct thread_pool;
extern struct thread_pool *main_thread_pool;

enum iio_attr_type {
IIO_ATTR_TYPE_DEVICE,
IIO_ATTR_TYPE_DEBUG,
IIO_ATTR_TYPE_BUFFER,
};

struct parser_pdata {
struct iio_context *ctx;
bool stop, verbose;
Expand Down Expand Up @@ -69,6 +81,11 @@ struct parser_pdata {

extern bool server_demux; /* Defined in iiod.c */

static inline void *zalloc(size_t size)
{
return calloc(1, size);
}

void interpreter(struct iio_context *ctx, int fd_in, int fd_out, bool verbose,
bool is_socket, bool use_aio, struct thread_pool *pool,
const void *xml_zstd, size_t xml_zstd_len);
Expand Down
1 change: 0 additions & 1 deletion iiod/usbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

#include "../debug.h"
#include "../iio-private.h"
#include "ops.h"
#include "thread-pool.h"

Expand Down

0 comments on commit 3c36a0c

Please sign in to comment.