]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/beaglelogic/protocol.h
output/csv: use intermediate time_t var, silence compiler warning
[libsigrok.git] / src / hardware / beaglelogic / protocol.h
index f2acfeb0151e84da53ae42fb7ab876edb4a4008b..a2af44f2543be96e22c54f7b2810f6ff6410ed9f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the libsigrok project.
  *
- * Copyright (C) 2014 Kumar Abhishek <abhishek@theembeddedkitchen.net>
+ * Copyright (C) 2014-2017 Kumar Abhishek <abhishek@theembeddedkitchen.net>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 
 #include <stdint.h>
 #include <glib.h>
-#include "libsigrok.h"
+#include <libsigrok/libsigrok.h>
 #include "libsigrok-internal.h"
 
 #define LOG_PREFIX "beaglelogic"
 
 #define SAMPLEUNIT_TO_BYTES(x) ((x) == 1 ? 1 : 2)
 
+#define TCP_BUFFER_SIZE         (128 * 1024)
+
 /** Private, per-device-instance driver context. */
 struct dev_context {
-       /* Model-specific information */
        int max_channels;
        uint32_t fw_ver;
 
+       /* Operations */
+       const struct beaglelogic_ops *beaglelogic;
+
+       /* TCP Settings */
+       char *address;
+       char *port;
+       int socket;
+       unsigned int read_timeout;
+       unsigned char *tcp_buffer;
+
        /* Acquisition settings: see beaglelogic.h */
        uint64_t cur_samplerate;
        uint64_t limit_samples;
        uint32_t sampleunit;
        uint32_t triggerflags;
+       uint64_t capture_ratio;
 
        /* Buffers: size of each buffer block and the total buffer area */
        uint32_t bufunitsize;
        uint32_t buffersize;
 
-       /* Operational state */
        int fd;
        GPollFD pollfd;
        int last_error;
@@ -58,13 +69,12 @@ struct dev_context {
        uint32_t offset;
        uint8_t *sample_buf;    /* mmap'd kernel buffer here */
 
-       void *cb_data;
-
        /* Trigger logic */
        struct soft_trigger_logic *stl;
        gboolean trigger_fired;
 };
 
-SR_PRIV int beaglelogic_receive_data(int fd, int revents, void *cb_data);
+SR_PRIV int beaglelogic_native_receive_data(int fd, int revents, void *cb_data);
+SR_PRIV int beaglelogic_tcp_receive_data(int fd, int revents, void *cb_data);
 
 #endif