2 * This file is part of the libsigrok project.
4 * Copyright (C) 2016 danselmi <da@da>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef LIBSIGROK_HARDWARE_IPDBG_ORG_LA_PROTOCOL_H
21 #define LIBSIGROK_HARDWARE_IPDBG_ORG_LA_PROTOCOL_H
25 #include <libsigrok/libsigrok.h>
26 #include "libsigrok-internal.h"
28 #define LOG_PREFIX "ipdbg-org-la"
31 struct ipdbg_org_la_tcp {
35 //char length_buf[BUFFER_SIZE];
36 //int length_bytes_read;
37 //int response_length;
38 //int response_bytes_read;
41 /** Private, per-device-instance driver context. */
42 struct ipdbg_org_la_dev_context
47 int ADDR_WIDTH_BYTES ;
49 unsigned int limit_samples;
50 unsigned int limit_samples_max;
54 char *trigger_mask_last;
55 char *trigger_value_last;
56 unsigned int delay_value;
57 int num_stages; //always 0
58 unsigned int num_transfers;
59 unsigned char *raw_sample_buf;
62 SR_PRIV struct ipdbg_org_la_tcp *ipdbg_org_la_new_tcp(void);
63 SR_PRIV int ipdbg_org_la_tcp_open(struct ipdbg_org_la_tcp *tcp);
64 SR_PRIV int ipdbg_org_la_tcp_close(struct ipdbg_org_la_tcp *tcp);
65 SR_PRIV void ipdbg_org_la_tcp_free(struct ipdbg_org_la_tcp *tcp);
66 SR_PRIV int ipdbg_org_la_tcp_send(struct ipdbg_org_la_tcp *tcp, const uint8_t *buf, size_t len);
67 SR_PRIV int ipdbg_org_la_tcp_receive(struct ipdbg_org_la_tcp *tcp, uint8_t *buf, int bufsize);
69 SR_PRIV struct ipdbg_org_la_dev_context *ipdbg_org_la_dev_new(void);
70 SR_PRIV void ipdbg_org_la_get_addrwidth_and_datawidth(struct ipdbg_org_la_tcp *tcp, struct ipdbg_org_la_dev_context *devc);
71 SR_PRIV int ipdbg_org_la_sendReset(struct ipdbg_org_la_tcp *tcp);
72 SR_PRIV int ipdbg_org_la_requestID(struct ipdbg_org_la_tcp *tcp);
73 SR_PRIV int ipdbg_org_la_sendStart(struct ipdbg_org_la_tcp *tcp);
74 SR_PRIV int ipdbg_org_la_sendTrigger(struct ipdbg_org_la_dev_context *devc, struct ipdbg_org_la_tcp *tcp);
75 SR_PRIV int ipdbg_org_la_sendDelay(struct ipdbg_org_la_dev_context *devc, struct ipdbg_org_la_tcp *tcp);
76 SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi);
77 SR_PRIV int ipdbg_org_la_receive_data(int fd, int revents, void *cb_data);
78 SR_PRIV void ipdbg_org_la_abort_acquisition(const struct sr_dev_inst *sdi);