]> sigrok.org Git - libsigrok.git/blame - src/hardware/ipdbg-logic-analyser/protocol.h
ipdbg-la: More style fixes
[libsigrok.git] / src / hardware / ipdbg-logic-analyser / protocol.h
CommitLineData
a4210e18
EK
1/*
2 * This file is part of the libsigrok project.
3 *
4 * Copyright (C) 2016 danselmi <da@da>
5 *
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.
10 *
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.
15 *
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/>.
18 */
19
20#ifndef LIBSIGROK_HARDWARE_IPDBG_ORG_LA_PROTOCOL_H
21#define LIBSIGROK_HARDWARE_IPDBG_ORG_LA_PROTOCOL_H
22
23#include <stdint.h>
24#include <glib.h>
25#include <libsigrok/libsigrok.h>
26#include "libsigrok-internal.h"
27
28#define LOG_PREFIX "ipdbg-org-la"
29
30
31struct ipdbg_org_la_tcp {
2f15f5bf
EK
32 char *address;
33 char *port;
34 int socket;
a4210e18
EK
35};
36
37/** Private, per-device-instance driver context. */
38struct ipdbg_org_la_dev_context
39{
7f4c9a04
SA
40 uint32_t DATA_WIDTH;
41 uint32_t DATA_WIDTH_BYTES;
42 uint32_t ADDR_WIDTH;
43 uint32_t ADDR_WIDTH_BYTES;
a4210e18 44
38e7493d 45 uint64_t limit_samples;
7f4c9a04
SA
46 uint64_t limit_samples_max;
47 uint8_t capture_ratio;
48 uint8_t *trigger_mask;
49 uint8_t *trigger_value;
50 uint8_t *trigger_mask_last;
51 uint8_t *trigger_value_last;
52 uint8_t *trigger_edge_mask;
53 uint64_t delay_value;
b8fa29a1 54 int num_stages;
7f4c9a04
SA
55 uint64_t num_transfers;
56 uint8_t *raw_sample_buf;
a4210e18
EK
57};
58
7f4c9a04
SA
59int data_available(struct ipdbg_org_la_tcp *tcp);
60
61SR_PRIV struct ipdbg_org_la_tcp *ipdbg_org_la_tcp_new(void);
62SR_PRIV void ipdbg_org_la_tcp_free(struct ipdbg_org_la_tcp *tcp);
a4210e18
EK
63SR_PRIV int ipdbg_org_la_tcp_open(struct ipdbg_org_la_tcp *tcp);
64SR_PRIV int ipdbg_org_la_tcp_close(struct ipdbg_org_la_tcp *tcp);
a4210e18 65SR_PRIV int ipdbg_org_la_tcp_send(struct ipdbg_org_la_tcp *tcp, const uint8_t *buf, size_t len);
7f4c9a04 66SR_PRIV int ipdbg_org_la_tcp_receive_blocking(struct ipdbg_org_la_tcp *tcp, uint8_t *buf, int bufsize);
b51288e3 67SR_PRIV int ipdbg_org_la_tcp_receive(struct ipdbg_org_la_tcp *tcp, uint8_t *buf);
a4210e18 68
7f4c9a04
SA
69SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi);
70
a4210e18
EK
71SR_PRIV struct ipdbg_org_la_dev_context *ipdbg_org_la_dev_new(void);
72SR_PRIV void ipdbg_org_la_get_addrwidth_and_datawidth(struct ipdbg_org_la_tcp *tcp, struct ipdbg_org_la_dev_context *devc);
7f4c9a04
SA
73SR_PRIV int send_escaping(struct ipdbg_org_la_tcp *tcp, uint8_t *dataToSend, uint32_t length);
74SR_PRIV int ipdbg_org_la_send_reset(struct ipdbg_org_la_tcp *tcp);
75SR_PRIV int ipdbg_org_la_request_id(struct ipdbg_org_la_tcp *tcp);
76SR_PRIV int ipdbg_org_la_send_start(struct ipdbg_org_la_tcp *tcp);
77SR_PRIV int ipdbg_org_la_send_trigger(struct ipdbg_org_la_dev_context *devc, struct ipdbg_org_la_tcp *tcp);
78SR_PRIV int ipdbg_org_la_send_delay(struct ipdbg_org_la_dev_context *devc, struct ipdbg_org_la_tcp *tcp);
a4210e18
EK
79SR_PRIV int ipdbg_org_la_receive_data(int fd, int revents, void *cb_data);
80SR_PRIV void ipdbg_org_la_abort_acquisition(const struct sr_dev_inst *sdi);
b51288e3 81SR_PRIV int ipdbg_org_la_tcp_receive_blocking(struct ipdbg_org_la_tcp *tcp, uint8_t *buf, int bufsize);
a4210e18
EK
82
83#endif