ipdbg-la: Adjust to sigrok indentation style
This commit is contained in:
parent
7f4c9a0444
commit
9d2e5483dc
|
@ -21,329 +21,341 @@
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
static const uint32_t ipdbg_org_la_drvopts[] = {
|
static const uint32_t ipdbg_org_la_drvopts[] = {
|
||||||
SR_CONF_LOGIC_ANALYZER,
|
SR_CONF_LOGIC_ANALYZER,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t ipdbg_org_la_scanopts[] = {
|
static const uint32_t ipdbg_org_la_scanopts[] = {
|
||||||
SR_CONF_CONN,
|
SR_CONF_CONN,
|
||||||
SR_CONF_SERIALCOMM,
|
SR_CONF_SERIALCOMM,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t ipdbg_org_la_devopts[] = {
|
static const uint32_t ipdbg_org_la_devopts[] = {
|
||||||
SR_CONF_TRIGGER_MATCH | SR_CONF_LIST| SR_CONF_SET,
|
SR_CONF_TRIGGER_MATCH | SR_CONF_LIST | SR_CONF_SET,
|
||||||
SR_CONF_CAPTURE_RATIO | SR_CONF_GET | SR_CONF_SET,
|
SR_CONF_CAPTURE_RATIO | SR_CONF_GET | SR_CONF_SET,
|
||||||
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET
|
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int32_t ipdbg_org_la_trigger_matches[] = {
|
static const int32_t ipdbg_org_la_trigger_matches[] = {
|
||||||
SR_TRIGGER_ZERO,
|
SR_TRIGGER_ZERO,
|
||||||
SR_TRIGGER_ONE,
|
SR_TRIGGER_ONE,
|
||||||
SR_TRIGGER_RISING,
|
SR_TRIGGER_RISING,
|
||||||
SR_TRIGGER_FALLING,
|
SR_TRIGGER_FALLING,
|
||||||
SR_TRIGGER_EDGE,
|
SR_TRIGGER_EDGE,
|
||||||
};
|
};
|
||||||
|
|
||||||
SR_PRIV struct sr_dev_driver ipdbg_la_driver_info;
|
SR_PRIV struct sr_dev_driver ipdbg_la_driver_info;
|
||||||
|
|
||||||
|
static void ipdbg_org_la_split_addr_port(const char *conn, char **addr,
|
||||||
|
char **port)
|
||||||
static void ipdbg_org_la_split_addr_port(const char *conn, char **addr, char **port)
|
|
||||||
{
|
{
|
||||||
char **strs = g_strsplit(conn, "/", 3);
|
char **strs = g_strsplit(conn, "/", 3);
|
||||||
|
|
||||||
*addr = g_strdup(strs[1]);
|
*addr = g_strdup(strs[1]);
|
||||||
*port = g_strdup(strs[2]);
|
*port = g_strdup(strs[2]);
|
||||||
|
|
||||||
g_strfreev(strs);
|
g_strfreev(strs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc;
|
||||||
GSList *devices;
|
GSList *devices;
|
||||||
|
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
drvc->instances = NULL;
|
drvc->instances = NULL;
|
||||||
const char *conn;
|
const char *conn;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
src = l->data;
|
src = l->data;
|
||||||
switch (src->key) {
|
switch (src->key) {
|
||||||
case SR_CONF_CONN:
|
case SR_CONF_CONN:
|
||||||
conn = g_variant_get_string(src->data, NULL);
|
conn = g_variant_get_string(src->data, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!conn)
|
if (!conn)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
struct ipdbg_org_la_tcp *tcp = ipdbg_org_la_tcp_new();
|
struct ipdbg_org_la_tcp *tcp = ipdbg_org_la_tcp_new();
|
||||||
|
|
||||||
ipdbg_org_la_split_addr_port(conn, &tcp->address, &tcp->port);
|
ipdbg_org_la_split_addr_port(conn, &tcp->address, &tcp->port);
|
||||||
|
|
||||||
if (!tcp->address)
|
if (!tcp->address)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (ipdbg_org_la_tcp_open(tcp) != SR_OK)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if(ipdbg_org_la_tcp_open(tcp) != SR_OK)
|
ipdbg_org_la_send_reset(tcp);
|
||||||
return NULL;
|
ipdbg_org_la_send_reset(tcp);
|
||||||
|
ipdbg_org_la_request_id(tcp);
|
||||||
|
|
||||||
ipdbg_org_la_send_reset(tcp);
|
struct sr_dev_inst *sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
||||||
ipdbg_org_la_send_reset(tcp);
|
if (!sdi) {
|
||||||
ipdbg_org_la_request_id(tcp);
|
sr_err("no possible to allocate sr_dev_inst");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
struct sr_dev_inst *sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
sdi->status = SR_ST_INACTIVE;
|
||||||
if (!sdi){
|
sdi->vendor = g_strdup("ipdbg.org");
|
||||||
sr_err("no possible to allocate sr_dev_inst");
|
sdi->model = g_strdup("Logic Analyzer");
|
||||||
return NULL;
|
sdi->version = g_strdup("v1.0");
|
||||||
}
|
sdi->driver = di;
|
||||||
|
|
||||||
sdi->status = SR_ST_INACTIVE;
|
struct ipdbg_org_la_dev_context *devc = ipdbg_org_la_dev_new();
|
||||||
sdi->vendor = g_strdup("ipdbg.org");
|
sdi->priv = devc;
|
||||||
sdi->model = g_strdup("Logic Analyzer");
|
|
||||||
sdi->version = g_strdup("v1.0");
|
|
||||||
sdi->driver = di;
|
|
||||||
|
|
||||||
struct ipdbg_org_la_dev_context *devc = ipdbg_org_la_dev_new();
|
ipdbg_org_la_get_addrwidth_and_datawidth(tcp, devc);
|
||||||
sdi->priv = devc;
|
|
||||||
|
|
||||||
ipdbg_org_la_get_addrwidth_and_datawidth(tcp, devc);
|
sr_dbg("addr_width = %d, data_width = %d\n", devc->ADDR_WIDTH,
|
||||||
|
devc->DATA_WIDTH);
|
||||||
|
sr_dbg("limit samples = %" PRIu64 "\n", devc->limit_samples_max);
|
||||||
|
|
||||||
sr_dbg("addr_width = %d, data_width = %d\n", devc->ADDR_WIDTH, devc->DATA_WIDTH);
|
for (uint32_t i = 0; i < devc->DATA_WIDTH; i++) {
|
||||||
sr_dbg("limit samples = %" PRIu64 "\n", devc->limit_samples_max);
|
const uint8_t buf_size = 16;
|
||||||
|
char buf[buf_size];
|
||||||
|
snprintf(buf, buf_size, "ch%d", i);
|
||||||
|
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, buf);
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < devc->DATA_WIDTH; i++) {
|
sdi->inst_type = SR_INST_USER;
|
||||||
const uint8_t buf_size = 16;
|
sdi->conn = tcp;
|
||||||
char buf[buf_size];
|
|
||||||
snprintf(buf, buf_size, "ch%d", i);
|
|
||||||
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
sdi->inst_type = SR_INST_USER;
|
ipdbg_org_la_tcp_close(tcp);
|
||||||
sdi->conn = tcp;
|
|
||||||
|
|
||||||
ipdbg_org_la_tcp_close(tcp);
|
devices = g_slist_append(devices, sdi);
|
||||||
|
|
||||||
devices = g_slist_append(devices, sdi);
|
return std_scan_complete(di, devices);
|
||||||
|
|
||||||
return std_scan_complete(di, devices);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_clear(const struct sr_dev_driver *di)
|
static int dev_clear(const struct sr_dev_driver *di)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc = di->context;
|
struct drv_context *drvc = di->context;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
if (drvc) {
|
if (drvc) {
|
||||||
for (l = drvc->instances; l; l = l->next) {
|
for (l = drvc->instances; l; l = l->next) {
|
||||||
sdi = l->data;
|
sdi = l->data;
|
||||||
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
||||||
if (tcp) {
|
if (tcp) {
|
||||||
ipdbg_org_la_tcp_close(tcp);
|
ipdbg_org_la_tcp_close(tcp);
|
||||||
ipdbg_org_la_tcp_free(tcp);
|
ipdbg_org_la_tcp_free(tcp);
|
||||||
g_free(tcp);
|
g_free(tcp);
|
||||||
}
|
}
|
||||||
sdi->conn = NULL;
|
sdi->conn = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return std_dev_clear(di);
|
return std_dev_clear(di);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
|
|
||||||
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
||||||
|
|
||||||
if (!tcp)
|
if (!tcp)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
if (ipdbg_org_la_tcp_open(tcp) != SR_OK)
|
if (ipdbg_org_la_tcp_open(tcp) != SR_OK)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
sdi->status = SR_ST_ACTIVE;
|
sdi->status = SR_ST_ACTIVE;
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_close(struct sr_dev_inst *sdi)
|
static int dev_close(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
// Should be called before a new call to scan()
|
// Should be called before a new call to scan()
|
||||||
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
||||||
|
|
||||||
if (tcp)
|
if (tcp)
|
||||||
ipdbg_org_la_tcp_close(tcp);
|
ipdbg_org_la_tcp_close(tcp);
|
||||||
|
|
||||||
sdi->conn = NULL;
|
sdi->conn = NULL;
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(uint32_t key, GVariant **data,
|
static int config_get(uint32_t key, GVariant **data,
|
||||||
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
|
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
int ret = SR_OK;
|
int ret = SR_OK;
|
||||||
|
|
||||||
(void)cg;
|
(void)cg;
|
||||||
|
|
||||||
struct ipdbg_org_la_dev_context *devc = sdi->priv;
|
struct ipdbg_org_la_dev_context *devc = sdi->priv;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_CAPTURE_RATIO:
|
case SR_CONF_CAPTURE_RATIO:
|
||||||
*data = g_variant_new_uint64(devc->capture_ratio);
|
*data = g_variant_new_uint64(devc->capture_ratio);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
*data = g_variant_new_uint64(devc->limit_samples);
|
*data = g_variant_new_uint64(devc->limit_samples);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = SR_ERR_NA;
|
ret = SR_ERR_NA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(uint32_t key, GVariant *data,
|
static int config_set(uint32_t key, GVariant *data,
|
||||||
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
|
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
int ret = SR_OK;
|
int ret = SR_OK;
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
|
|
||||||
(void)cg;
|
(void)cg;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
struct ipdbg_org_la_dev_context *devc = sdi->priv;
|
struct ipdbg_org_la_dev_context *devc = sdi->priv;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_CAPTURE_RATIO:
|
case SR_CONF_CAPTURE_RATIO:
|
||||||
value = g_variant_get_uint64(data);
|
value = g_variant_get_uint64(data);
|
||||||
if (value <= 100)
|
if (value <= 100)
|
||||||
devc->capture_ratio = value;
|
devc->capture_ratio = value;
|
||||||
else
|
else
|
||||||
ret = SR_ERR;
|
ret = SR_ERR;
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
value = g_variant_get_uint64(data);
|
value = g_variant_get_uint64(data);
|
||||||
if (value <= devc->limit_samples_max)
|
if (value <= devc->limit_samples_max)
|
||||||
devc->limit_samples = value;
|
devc->limit_samples = value;
|
||||||
else
|
else
|
||||||
ret = SR_ERR;
|
ret = SR_ERR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = SR_ERR_NA;
|
ret = SR_ERR_NA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(uint32_t key, GVariant **data,
|
static int config_list(uint32_t key, GVariant **data,
|
||||||
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
|
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
(void)cg;
|
(void)cg;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
||||||
ipdbg_org_la_scanopts, ARRAY_SIZE(ipdbg_org_la_scanopts), sizeof(uint32_t));
|
ipdbg_org_la_scanopts,
|
||||||
break;
|
ARRAY_SIZE
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
(ipdbg_org_la_scanopts),
|
||||||
if (!sdi)
|
sizeof(uint32_t));
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
break;
|
||||||
ipdbg_org_la_drvopts, ARRAY_SIZE(ipdbg_org_la_drvopts), sizeof(uint32_t));
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
else
|
if (!sdi)
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
||||||
ipdbg_org_la_devopts, ARRAY_SIZE(ipdbg_org_la_devopts), sizeof(uint32_t));
|
ipdbg_org_la_drvopts,
|
||||||
break;
|
ARRAY_SIZE
|
||||||
case SR_CONF_TRIGGER_MATCH:
|
(ipdbg_org_la_drvopts),
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
sizeof(uint32_t));
|
||||||
ipdbg_org_la_trigger_matches, ARRAY_SIZE(ipdbg_org_la_trigger_matches), sizeof(int32_t));
|
else
|
||||||
break;
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
|
||||||
default:
|
ipdbg_org_la_devopts,
|
||||||
return SR_ERR_NA;
|
ARRAY_SIZE
|
||||||
}
|
(ipdbg_org_la_devopts),
|
||||||
|
sizeof(uint32_t));
|
||||||
|
break;
|
||||||
|
case SR_CONF_TRIGGER_MATCH:
|
||||||
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
|
ipdbg_org_la_trigger_matches,
|
||||||
|
ARRAY_SIZE
|
||||||
|
(ipdbg_org_la_trigger_matches),
|
||||||
|
sizeof(int32_t));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return SR_ERR_NA;
|
||||||
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
|
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
|
||||||
{
|
{
|
||||||
return std_init(di, sr_ctx);
|
return std_init(di, sr_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSList *dev_list(const struct sr_dev_driver *di)
|
static GSList *dev_list(const struct sr_dev_driver *di)
|
||||||
{
|
{
|
||||||
return ((struct drv_context*)(di->context))->instances;
|
return ((struct drv_context *)(di->context))->instances;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
||||||
struct ipdbg_org_la_dev_context *devc = sdi->priv;
|
struct ipdbg_org_la_dev_context *devc = sdi->priv;
|
||||||
|
|
||||||
ipdbg_org_la_convert_trigger(sdi);
|
ipdbg_org_la_convert_trigger(sdi);
|
||||||
ipdbg_org_la_send_trigger(devc, tcp);
|
ipdbg_org_la_send_trigger(devc, tcp);
|
||||||
ipdbg_org_la_send_delay(devc, tcp);;
|
ipdbg_org_la_send_delay(devc, tcp);
|
||||||
|
|
||||||
/* If the device stops sending for longer than it takes to send a byte,
|
/* If the device stops sending for longer than it takes to send a byte,
|
||||||
* that means it's finished. But wait at least 100 ms to be safe.
|
* that means it's finished. But wait at least 100 ms to be safe.
|
||||||
*/
|
*/
|
||||||
sr_session_source_add(sdi->session, tcp->socket, G_IO_IN, 100,
|
sr_session_source_add(sdi->session, tcp->socket, G_IO_IN, 100,
|
||||||
ipdbg_org_la_receive_data, (struct sr_dev_inst *)sdi);
|
ipdbg_org_la_receive_data, (struct sr_dev_inst *)sdi);
|
||||||
|
|
||||||
ipdbg_org_la_send_start(tcp);
|
ipdbg_org_la_send_start(tcp);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
||||||
struct ipdbg_org_la_dev_context *devc = sdi->priv;
|
struct ipdbg_org_la_dev_context *devc = sdi->priv;
|
||||||
|
|
||||||
uint8_t byte;
|
uint8_t byte;
|
||||||
|
|
||||||
if (devc->num_transfers > 0) {
|
if (devc->num_transfers > 0) {
|
||||||
while (devc->num_transfers < (devc->limit_samples_max * devc->DATA_WIDTH_BYTES)) {
|
while (devc->num_transfers <
|
||||||
ipdbg_org_la_tcp_receive(tcp, &byte);
|
(devc->limit_samples_max * devc->DATA_WIDTH_BYTES)) {
|
||||||
devc->num_transfers++;
|
ipdbg_org_la_tcp_receive(tcp, &byte);
|
||||||
}
|
devc->num_transfers++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ipdbg_org_la_send_reset(tcp);
|
ipdbg_org_la_send_reset(tcp);
|
||||||
ipdbg_org_la_abort_acquisition(sdi);
|
ipdbg_org_la_abort_acquisition(sdi);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV struct sr_dev_driver ipdbg_la_driver_info = {
|
SR_PRIV struct sr_dev_driver ipdbg_la_driver_info = {
|
||||||
.name = "ipdbg-org-la",
|
.name = "ipdbg-org-la",
|
||||||
.longname = "ipdbg.org logic analyzer",
|
.longname = "ipdbg.org logic analyzer",
|
||||||
.api_version = 1,
|
.api_version = 1,
|
||||||
.init = init,
|
.init = init,
|
||||||
.cleanup = std_cleanup,
|
.cleanup = std_cleanup,
|
||||||
.scan = scan,
|
.scan = scan,
|
||||||
.dev_list = dev_list,
|
.dev_list = dev_list,
|
||||||
.dev_clear = dev_clear,
|
.dev_clear = dev_clear,
|
||||||
.config_get = config_get,
|
.config_get = config_get,
|
||||||
.config_set = config_set,
|
.config_set = config_set,
|
||||||
.config_list = config_list,
|
.config_list = config_list,
|
||||||
.dev_open = dev_open,
|
.dev_open = dev_open,
|
||||||
.dev_close = dev_close,
|
.dev_close = dev_close,
|
||||||
.dev_acquisition_start = dev_acquisition_start,
|
.dev_acquisition_start = dev_acquisition_start,
|
||||||
.dev_acquisition_stop = dev_acquisition_stop,
|
.dev_acquisition_stop = dev_acquisition_stop,
|
||||||
.context = NULL,
|
.context = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
SR_REGISTER_DEV_DRIVER(ipdbg_la_driver_info);
|
SR_REGISTER_DEV_DRIVER(ipdbg_la_driver_info);
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
|
||||||
#define BUFFER_SIZE 4
|
#define BUFFER_SIZE 4
|
||||||
|
|
||||||
/* Top-level command opcodes */
|
/* Top-level command opcodes */
|
||||||
|
@ -69,485 +68,497 @@
|
||||||
/* LA subfunction command opcodes */
|
/* LA subfunction command opcodes */
|
||||||
#define CMD_LA_DELAY 0x1F
|
#define CMD_LA_DELAY 0x1F
|
||||||
|
|
||||||
|
|
||||||
SR_PRIV int data_available(struct ipdbg_org_la_tcp *tcp)
|
SR_PRIV int data_available(struct ipdbg_org_la_tcp *tcp)
|
||||||
{
|
{
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
ioctlsocket(tcp->socket, FIONREAD, &bytes_available);
|
ioctlsocket(tcp->socket, FIONREAD, &bytes_available);
|
||||||
#else
|
#else
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (ioctl(tcp->socket, FIONREAD, &status) < 0) { // TIOCMGET
|
if (ioctl(tcp->socket, FIONREAD, &status) < 0) { // TIOCMGET
|
||||||
sr_err("FIONREAD failed: %s\n", strerror(errno));
|
sr_err("FIONREAD failed: %s\n", strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (status < 1) ? 0 : 1;
|
return (status < 1) ? 0 : 1;
|
||||||
#endif // __WIN32__
|
#endif // __WIN32__
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV struct ipdbg_org_la_tcp *ipdbg_org_la_tcp_new(void)
|
SR_PRIV struct ipdbg_org_la_tcp *ipdbg_org_la_tcp_new(void)
|
||||||
{
|
{
|
||||||
struct ipdbg_org_la_tcp *tcp;
|
struct ipdbg_org_la_tcp *tcp;
|
||||||
|
|
||||||
tcp = g_malloc0(sizeof(struct ipdbg_org_la_tcp));
|
tcp = g_malloc0(sizeof(struct ipdbg_org_la_tcp));
|
||||||
|
|
||||||
tcp->address = NULL;
|
tcp->address = NULL;
|
||||||
tcp->port = NULL;
|
tcp->port = NULL;
|
||||||
tcp->socket = -1;
|
tcp->socket = -1;
|
||||||
|
|
||||||
return tcp;
|
return tcp;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV void ipdbg_org_la_tcp_free(struct ipdbg_org_la_tcp *tcp)
|
SR_PRIV void ipdbg_org_la_tcp_free(struct ipdbg_org_la_tcp *tcp)
|
||||||
{
|
{
|
||||||
g_free(tcp->address);
|
g_free(tcp->address);
|
||||||
g_free(tcp->port);
|
g_free(tcp->port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_tcp_open(struct ipdbg_org_la_tcp *tcp)
|
SR_PRIV int ipdbg_org_la_tcp_open(struct ipdbg_org_la_tcp *tcp)
|
||||||
{
|
{
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
struct addrinfo *results, *res;
|
struct addrinfo *results, *res;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_family = AF_UNSPEC;
|
hints.ai_family = AF_UNSPEC;
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
hints.ai_protocol = IPPROTO_TCP;
|
hints.ai_protocol = IPPROTO_TCP;
|
||||||
|
|
||||||
err = getaddrinfo(tcp->address, tcp->port, &hints, &results);
|
err = getaddrinfo(tcp->address, tcp->port, &hints, &results);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
sr_err("Address lookup failed: %s:%s: %s", tcp->address, tcp->port,
|
sr_err("Address lookup failed: %s:%s: %s", tcp->address,
|
||||||
gai_strerror(err));
|
tcp->port, gai_strerror(err));
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (res = results; res; res = res->ai_next) {
|
for (res = results; res; res = res->ai_next) {
|
||||||
if ((tcp->socket = socket(res->ai_family, res->ai_socktype,
|
if ((tcp->socket = socket(res->ai_family, res->ai_socktype,
|
||||||
res->ai_protocol)) < 0)
|
res->ai_protocol)) < 0)
|
||||||
continue;
|
continue;
|
||||||
if (connect(tcp->socket, res->ai_addr, res->ai_addrlen) != 0) {
|
if (connect(tcp->socket, res->ai_addr, res->ai_addrlen) != 0) {
|
||||||
close(tcp->socket);
|
close(tcp->socket);
|
||||||
tcp->socket = -1;
|
tcp->socket = -1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
freeaddrinfo(results);
|
freeaddrinfo(results);
|
||||||
|
|
||||||
if (tcp->socket < 0) {
|
if (tcp->socket < 0) {
|
||||||
sr_err("Failed to connect to %s:%s: %s", tcp->address, tcp->port,
|
sr_err("Failed to connect to %s:%s: %s", tcp->address, tcp->port,
|
||||||
g_strerror(errno));
|
g_strerror(errno));
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_tcp_close(struct ipdbg_org_la_tcp *tcp)
|
SR_PRIV int ipdbg_org_la_tcp_close(struct ipdbg_org_la_tcp *tcp)
|
||||||
{
|
{
|
||||||
int ret = SR_OK;
|
int ret = SR_OK;
|
||||||
|
|
||||||
if (close(tcp->socket) < 0)
|
if (close(tcp->socket) < 0)
|
||||||
ret = SR_ERR;
|
ret = SR_ERR;
|
||||||
|
|
||||||
tcp->socket = -1;
|
tcp->socket = -1;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_tcp_send(struct ipdbg_org_la_tcp *tcp,
|
SR_PRIV int ipdbg_org_la_tcp_send(struct ipdbg_org_la_tcp *tcp,
|
||||||
const uint8_t *buf, size_t len)
|
const uint8_t *buf, size_t len)
|
||||||
{
|
{
|
||||||
int out;
|
int out;
|
||||||
out = send(tcp->socket, (char*)buf, len, 0);
|
out = send(tcp->socket, (char*)buf, len, 0);
|
||||||
|
|
||||||
if (out < 0) {
|
if (out < 0) {
|
||||||
sr_err("Send error: %s", g_strerror(errno));
|
sr_err("Send error: %s", g_strerror(errno));
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out < (int)len)
|
if (out < (int)len)
|
||||||
sr_dbg("Only sent %d/%d bytes of data.", out, (int)len);
|
sr_dbg("Only sent %d/%d bytes of data.", out, (int)len);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_tcp_receive_blocking(struct ipdbg_org_la_tcp *tcp,
|
SR_PRIV int ipdbg_org_la_tcp_receive_blocking(struct ipdbg_org_la_tcp *tcp,
|
||||||
uint8_t *buf, int bufsize)
|
uint8_t *buf, int bufsize)
|
||||||
{
|
{
|
||||||
int received = 0;
|
int received = 0;
|
||||||
|
|
||||||
while (received < bufsize) {
|
while (received < bufsize) {
|
||||||
if (ipdbg_org_la_tcp_receive(tcp, buf) > 0) {
|
if (ipdbg_org_la_tcp_receive(tcp, buf) > 0) {
|
||||||
buf++;
|
buf++;
|
||||||
received++;
|
received++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return received;
|
return received;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_tcp_receive(struct ipdbg_org_la_tcp *tcp, uint8_t *buf)
|
SR_PRIV int ipdbg_org_la_tcp_receive(struct ipdbg_org_la_tcp *tcp,
|
||||||
|
uint8_t *buf)
|
||||||
{
|
{
|
||||||
int received = 0;
|
int received = 0;
|
||||||
|
|
||||||
if (data_available(tcp)) {
|
if (data_available(tcp)) {
|
||||||
while (received < 1) {
|
while (received < 1) {
|
||||||
int len = recv(tcp->socket, buf, 1, 0);
|
int len = recv(tcp->socket, buf, 1, 0);
|
||||||
|
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
sr_err("Receive error: %s", g_strerror(errno));
|
sr_err("Receive error: %s", g_strerror(errno));
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
} else
|
} else
|
||||||
received += len;
|
received += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
return received;
|
return received;
|
||||||
}
|
} else
|
||||||
else
|
return -1;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi)
|
SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct ipdbg_org_la_dev_context *devc;
|
struct ipdbg_org_la_dev_context *devc;
|
||||||
struct sr_trigger *trigger;
|
struct sr_trigger *trigger;
|
||||||
struct sr_trigger_stage *stage;
|
struct sr_trigger_stage *stage;
|
||||||
struct sr_trigger_match *match;
|
struct sr_trigger_match *match;
|
||||||
const GSList *l, *m;
|
const GSList *l, *m;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
devc->num_stages = 0;
|
devc->num_stages = 0;
|
||||||
devc->num_transfers = 0;
|
devc->num_transfers = 0;
|
||||||
devc->raw_sample_buf = NULL;
|
devc->raw_sample_buf = NULL;
|
||||||
|
|
||||||
for (uint64_t i = 0; i < devc->DATA_WIDTH_BYTES; i++) {
|
for (uint64_t i = 0; i < devc->DATA_WIDTH_BYTES; i++) {
|
||||||
devc->trigger_mask[i] = 0;
|
devc->trigger_mask[i] = 0;
|
||||||
devc->trigger_value[i] = 0;
|
devc->trigger_value[i] = 0;
|
||||||
devc->trigger_mask_last[i] = 0;
|
devc->trigger_mask_last[i] = 0;
|
||||||
devc->trigger_value_last[i] = 0;
|
devc->trigger_value_last[i] = 0;
|
||||||
devc->trigger_edge_mask[i] = 0;
|
devc->trigger_edge_mask[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(trigger = sr_session_trigger_get(sdi->session)))
|
if (!(trigger = sr_session_trigger_get(sdi->session)))
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
|
||||||
for (l = trigger->stages; l; l = l->next) {
|
for (l = trigger->stages; l; l = l->next) {
|
||||||
stage = l->data;
|
stage = l->data;
|
||||||
for (m = stage->matches; m; m = m->next) {
|
for (m = stage->matches; m; m = m->next) {
|
||||||
match = m->data;
|
match = m->data;
|
||||||
int byte_idx = match->channel->index / 8;
|
int byte_idx = match->channel->index / 8;
|
||||||
uint8_t match_bit = 1 << (match->channel->index % 8);
|
uint8_t match_bit = 1 << (match->channel->index % 8);
|
||||||
|
|
||||||
if (!match->channel->enabled)
|
if (!match->channel->enabled)
|
||||||
/* Ignore disabled channels with a trigger. */
|
/* Ignore disabled channels with a trigger. */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (match->match == SR_TRIGGER_ONE) {
|
if (match->match == SR_TRIGGER_ONE) {
|
||||||
devc->trigger_value[byte_idx] |= match_bit;
|
devc->trigger_value[byte_idx] |= match_bit;
|
||||||
devc->trigger_mask[byte_idx] |= match_bit;
|
devc->trigger_mask[byte_idx] |= match_bit;
|
||||||
devc->trigger_mask_last[byte_idx] &= ~match_bit;
|
devc->trigger_mask_last[byte_idx] &= ~match_bit;
|
||||||
devc->trigger_edge_mask[byte_idx] &= ~match_bit;
|
devc->trigger_edge_mask[byte_idx] &= ~match_bit;
|
||||||
} else if (match->match == SR_TRIGGER_ZERO) {
|
} else if (match->match == SR_TRIGGER_ZERO) {
|
||||||
devc->trigger_value[byte_idx] &= ~match_bit;
|
devc->trigger_value[byte_idx] &= ~match_bit;
|
||||||
devc->trigger_mask[byte_idx] |= match_bit;
|
devc->trigger_mask[byte_idx] |= match_bit;
|
||||||
devc->trigger_mask_last[byte_idx] &= ~match_bit;
|
devc->trigger_mask_last[byte_idx] &= ~match_bit;
|
||||||
devc->trigger_edge_mask[byte_idx] &= ~match_bit;
|
devc->trigger_edge_mask[byte_idx] &= ~match_bit;
|
||||||
} else if ( match->match == SR_TRIGGER_RISING) {
|
} else if (match->match == SR_TRIGGER_RISING) {
|
||||||
devc->trigger_value[byte_idx] |= match_bit;
|
devc->trigger_value[byte_idx] |= match_bit;
|
||||||
devc->trigger_value_last[byte_idx] &= ~match_bit;
|
devc->trigger_value_last[byte_idx] &=
|
||||||
devc->trigger_mask[byte_idx] |= match_bit;
|
~match_bit;
|
||||||
devc->trigger_mask_last[byte_idx] |= match_bit;
|
devc->trigger_mask[byte_idx] |= match_bit;
|
||||||
devc->trigger_edge_mask[byte_idx] &= ~match_bit;
|
devc->trigger_mask_last[byte_idx] |= match_bit;
|
||||||
} else if (match->match == SR_TRIGGER_FALLING) {
|
devc->trigger_edge_mask[byte_idx] &= ~match_bit;
|
||||||
devc->trigger_value[byte_idx] &= ~match_bit;
|
} else if (match->match == SR_TRIGGER_FALLING) {
|
||||||
devc->trigger_value_last[byte_idx] |= match_bit;
|
devc->trigger_value[byte_idx] &= ~match_bit;
|
||||||
devc->trigger_mask[byte_idx] |= match_bit;
|
devc->trigger_value_last[byte_idx] |= match_bit;
|
||||||
devc->trigger_mask_last[byte_idx] |= match_bit;
|
devc->trigger_mask[byte_idx] |= match_bit;
|
||||||
devc->trigger_edge_mask[byte_idx] &= ~match_bit;
|
devc->trigger_mask_last[byte_idx] |= match_bit;
|
||||||
} else if (match->match == SR_TRIGGER_EDGE) {
|
devc->trigger_edge_mask[byte_idx] &= ~match_bit;
|
||||||
devc->trigger_mask[byte_idx] &= ~match_bit;
|
} else if (match->match == SR_TRIGGER_EDGE) {
|
||||||
devc->trigger_mask_last[byte_idx] &= ~match_bit;
|
devc->trigger_mask[byte_idx] &= ~match_bit;
|
||||||
devc->trigger_edge_mask[byte_idx] |= match_bit;
|
devc->trigger_mask_last[byte_idx] &= ~match_bit;
|
||||||
}
|
devc->trigger_edge_mask[byte_idx] |= match_bit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_receive_data(int fd, int revents, void *cb_data)
|
SR_PRIV int ipdbg_org_la_receive_data(int fd, int revents, void *cb_data)
|
||||||
{
|
{
|
||||||
const struct sr_dev_inst *sdi;
|
const struct sr_dev_inst *sdi;
|
||||||
struct ipdbg_org_la_dev_context *devc;
|
struct ipdbg_org_la_dev_context *devc;
|
||||||
|
|
||||||
(void)fd;
|
(void)fd;
|
||||||
(void)revents;
|
(void)revents;
|
||||||
|
|
||||||
sdi = (const struct sr_dev_inst*)cb_data;
|
sdi = (const struct sr_dev_inst *)cb_data;
|
||||||
if (!sdi)
|
if (!sdi)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!(devc = sdi->priv))
|
if (!(devc = sdi->priv))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_logic logic;
|
struct sr_datafeed_logic logic;
|
||||||
|
|
||||||
if (!devc->raw_sample_buf) {
|
if (!devc->raw_sample_buf) {
|
||||||
devc->raw_sample_buf =
|
devc->raw_sample_buf =
|
||||||
g_try_malloc(devc->limit_samples * devc->DATA_WIDTH_BYTES);
|
g_try_malloc(devc->limit_samples * devc->DATA_WIDTH_BYTES);
|
||||||
if (!devc->raw_sample_buf) {
|
if (!devc->raw_sample_buf) {
|
||||||
sr_warn("Sample buffer malloc failed.");
|
sr_warn("Sample buffer malloc failed.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (devc->num_transfers < (devc->limit_samples_max * devc->DATA_WIDTH_BYTES)) {
|
if (devc->num_transfers <
|
||||||
uint8_t byte;
|
(devc->limit_samples_max * devc->DATA_WIDTH_BYTES)) {
|
||||||
|
uint8_t byte;
|
||||||
|
|
||||||
if (ipdbg_org_la_tcp_receive(tcp, &byte) == 1) {
|
if (ipdbg_org_la_tcp_receive(tcp, &byte) == 1) {
|
||||||
if (devc->num_transfers < (devc->limit_samples * devc->DATA_WIDTH_BYTES))
|
if (devc->num_transfers <
|
||||||
devc->raw_sample_buf[devc->num_transfers] = byte;
|
(devc->limit_samples * devc->DATA_WIDTH_BYTES))
|
||||||
|
devc->raw_sample_buf[devc->num_transfers] = byte;
|
||||||
|
|
||||||
devc->num_transfers++;
|
devc->num_transfers++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (devc->delay_value > 0) {
|
if (devc->delay_value > 0) {
|
||||||
/* There are pre-trigger samples, send those first. */
|
/* There are pre-trigger samples, send those first. */
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = devc->delay_value * devc->DATA_WIDTH_BYTES;
|
logic.length = devc->delay_value * devc->DATA_WIDTH_BYTES;
|
||||||
logic.unitsize = devc->DATA_WIDTH_BYTES;
|
logic.unitsize = devc->DATA_WIDTH_BYTES;
|
||||||
logic.data = devc->raw_sample_buf;
|
logic.data = devc->raw_sample_buf;
|
||||||
sr_session_send(cb_data, &packet);
|
sr_session_send(cb_data, &packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the trigger. */
|
/* Send the trigger. */
|
||||||
packet.type = SR_DF_TRIGGER;
|
packet.type = SR_DF_TRIGGER;
|
||||||
sr_session_send(cb_data, &packet);
|
sr_session_send(cb_data, &packet);
|
||||||
|
|
||||||
/* Send post-trigger samples. */
|
/* Send post-trigger samples. */
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
logic.length = (devc->limit_samples - devc->delay_value) * devc->DATA_WIDTH_BYTES;
|
logic.length = (devc->limit_samples - devc->delay_value) *
|
||||||
logic.unitsize = devc->DATA_WIDTH_BYTES;
|
devc->DATA_WIDTH_BYTES;
|
||||||
logic.data = devc->raw_sample_buf + (devc->delay_value * devc->DATA_WIDTH_BYTES);
|
logic.unitsize = devc->DATA_WIDTH_BYTES;
|
||||||
sr_session_send(cb_data, &packet);
|
logic.data = devc->raw_sample_buf +
|
||||||
|
(devc->delay_value * devc->DATA_WIDTH_BYTES);
|
||||||
|
sr_session_send(cb_data, &packet);
|
||||||
|
|
||||||
g_free(devc->raw_sample_buf);
|
g_free(devc->raw_sample_buf);
|
||||||
devc->raw_sample_buf = NULL;
|
devc->raw_sample_buf = NULL;
|
||||||
|
|
||||||
ipdbg_org_la_abort_acquisition(sdi);
|
ipdbg_org_la_abort_acquisition(sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_send_delay(struct ipdbg_org_la_dev_context *devc,
|
SR_PRIV int ipdbg_org_la_send_delay(struct ipdbg_org_la_dev_context *devc,
|
||||||
struct ipdbg_org_la_tcp *tcp)
|
struct ipdbg_org_la_tcp *tcp)
|
||||||
{
|
{
|
||||||
devc->delay_value = (devc->limit_samples / 100.0) * devc->capture_ratio;
|
devc->delay_value = (devc->limit_samples / 100.0) * devc->capture_ratio;
|
||||||
|
|
||||||
uint8_t buf;
|
uint8_t buf;
|
||||||
buf = CMD_CFG_LA;
|
buf = CMD_CFG_LA;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_LA_DELAY;
|
buf = CMD_LA_DELAY;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
|
|
||||||
uint8_t delay_buf[4] = { devc->delay_value & 0x000000ff,
|
uint8_t delay_buf[4] = { devc->delay_value & 0x000000ff,
|
||||||
(devc->delay_value >> 8) & 0x000000ff,
|
(devc->delay_value >> 8) & 0x000000ff,
|
||||||
(devc->delay_value >> 16) & 0x000000ff,
|
(devc->delay_value >> 16) & 0x000000ff,
|
||||||
(devc->delay_value >> 24) & 0x000000ff};
|
(devc->delay_value >> 24) & 0x000000ff
|
||||||
|
};
|
||||||
|
|
||||||
for (uint64_t i = 0; i < devc->ADDR_WIDTH_BYTES; i++)
|
for (uint64_t i = 0; i < devc->ADDR_WIDTH_BYTES; i++)
|
||||||
send_escaping(tcp, &(delay_buf[devc->ADDR_WIDTH_BYTES-1-i]), 1);
|
send_escaping(tcp, &(delay_buf[devc->ADDR_WIDTH_BYTES - 1 - i]), 1);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_send_trigger(struct ipdbg_org_la_dev_context *devc,
|
SR_PRIV int ipdbg_org_la_send_trigger(struct ipdbg_org_la_dev_context *devc,
|
||||||
struct ipdbg_org_la_tcp *tcp)
|
struct ipdbg_org_la_tcp *tcp)
|
||||||
{
|
{
|
||||||
uint8_t buf;
|
uint8_t buf;
|
||||||
|
|
||||||
/* Mask */
|
/* Mask */
|
||||||
buf = CMD_CFG_TRIGGER;
|
buf = CMD_CFG_TRIGGER;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_TRIG_MASKS;
|
buf = CMD_TRIG_MASKS;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_TRIG_MASK;
|
buf = CMD_TRIG_MASK;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
|
|
||||||
for (size_t i = 0; i < devc->DATA_WIDTH_BYTES; i++)
|
for (size_t i = 0; i < devc->DATA_WIDTH_BYTES; i++)
|
||||||
send_escaping(tcp, devc->trigger_mask + devc->DATA_WIDTH_BYTES - 1 - i, 1);
|
send_escaping(tcp,
|
||||||
|
devc->trigger_mask + devc->DATA_WIDTH_BYTES - 1 - i, 1);
|
||||||
|
|
||||||
/* Value */
|
/* Value */
|
||||||
buf = CMD_CFG_TRIGGER;
|
buf = CMD_CFG_TRIGGER;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_TRIG_MASKS;
|
buf = CMD_TRIG_MASKS;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_TRIG_VALUE;
|
buf = CMD_TRIG_VALUE;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
|
|
||||||
for (size_t i = 0; i < devc->DATA_WIDTH_BYTES; i++)
|
for (size_t i = 0; i < devc->DATA_WIDTH_BYTES; i++)
|
||||||
send_escaping(tcp, devc->trigger_value + devc->DATA_WIDTH_BYTES - 1 - i, 1);
|
send_escaping(tcp,
|
||||||
|
devc->trigger_value + devc->DATA_WIDTH_BYTES - 1 - i, 1);
|
||||||
|
|
||||||
/* Mask_last */
|
/* Mask_last */
|
||||||
buf = CMD_CFG_TRIGGER;
|
buf = CMD_CFG_TRIGGER;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_TRIG_MASKS_LAST;
|
buf = CMD_TRIG_MASKS_LAST;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_TRIG_MASK_LAST;
|
buf = CMD_TRIG_MASK_LAST;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
|
|
||||||
for (size_t i = 0; i < devc->DATA_WIDTH_BYTES; i++)
|
for (size_t i = 0; i < devc->DATA_WIDTH_BYTES; i++)
|
||||||
send_escaping(tcp, devc->trigger_mask_last + devc->DATA_WIDTH_BYTES - 1 - i, 1);
|
send_escaping(tcp,
|
||||||
|
devc->trigger_mask_last + devc->DATA_WIDTH_BYTES - 1 - i, 1);
|
||||||
|
|
||||||
/* Value_last */
|
/* Value_last */
|
||||||
buf = CMD_CFG_TRIGGER;
|
buf = CMD_CFG_TRIGGER;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_TRIG_MASKS_LAST;
|
buf = CMD_TRIG_MASKS_LAST;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_TRIG_VALUE_LAST;
|
buf = CMD_TRIG_VALUE_LAST;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
|
|
||||||
for (size_t i = 0; i < devc->DATA_WIDTH_BYTES; i++)
|
for (size_t i = 0; i < devc->DATA_WIDTH_BYTES; i++)
|
||||||
send_escaping(tcp, devc->trigger_value_last + devc->DATA_WIDTH_BYTES - 1 - i, 1);
|
send_escaping(tcp,
|
||||||
|
devc->trigger_value_last + devc->DATA_WIDTH_BYTES - 1 - i, 1);
|
||||||
|
|
||||||
/* Edge_mask */
|
/* Edge_mask */
|
||||||
buf = CMD_CFG_TRIGGER;
|
buf = CMD_CFG_TRIGGER;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_TRIG_SELECT_EDGE_MASK;
|
buf = CMD_TRIG_SELECT_EDGE_MASK;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
buf = CMD_TRIG_SET_EDGE_MASK;
|
buf = CMD_TRIG_SET_EDGE_MASK;
|
||||||
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
ipdbg_org_la_tcp_send(tcp, &buf, 1);
|
||||||
|
|
||||||
for (size_t i = 0; i < devc->DATA_WIDTH_BYTES; i++)
|
for (size_t i = 0; i < devc->DATA_WIDTH_BYTES; i++)
|
||||||
send_escaping(tcp, devc->trigger_edge_mask + devc->DATA_WIDTH_BYTES - 1 - i, 1);
|
send_escaping(tcp,
|
||||||
|
devc->trigger_edge_mask + devc->DATA_WIDTH_BYTES - 1 - i, 1);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int send_escaping(struct ipdbg_org_la_tcp *tcp, uint8_t *dataToSend, uint32_t length)
|
SR_PRIV int send_escaping(struct ipdbg_org_la_tcp *tcp, uint8_t *dataToSend,
|
||||||
|
uint32_t length)
|
||||||
{
|
{
|
||||||
uint8_t escape = CMD_ESCAPE;
|
uint8_t escape = CMD_ESCAPE;
|
||||||
|
|
||||||
while (length--) {
|
while (length--) {
|
||||||
uint8_t payload = *dataToSend++;
|
uint8_t payload = *dataToSend++;
|
||||||
|
|
||||||
if (payload == (uint8_t)CMD_RESET)
|
if (payload == (uint8_t) CMD_RESET)
|
||||||
if (ipdbg_org_la_tcp_send(tcp, &escape, 1) != SR_OK)
|
if (ipdbg_org_la_tcp_send(tcp, &escape, 1) != SR_OK)
|
||||||
sr_warn("Couldn't send escape");
|
sr_warn("Couldn't send escape");
|
||||||
|
|
||||||
if (payload == (uint8_t)CMD_ESCAPE)
|
if (payload == (uint8_t) CMD_ESCAPE)
|
||||||
if (ipdbg_org_la_tcp_send(tcp, &escape, 1) != SR_OK)
|
if (ipdbg_org_la_tcp_send(tcp, &escape, 1) != SR_OK)
|
||||||
sr_warn("Couldn't send escape");
|
sr_warn("Couldn't send escape");
|
||||||
|
|
||||||
if (ipdbg_org_la_tcp_send(tcp, &payload, 1) != SR_OK)
|
if (ipdbg_org_la_tcp_send(tcp, &payload, 1) != SR_OK)
|
||||||
sr_warn("Couldn't send data");
|
sr_warn("Couldn't send data");
|
||||||
}
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV void ipdbg_org_la_get_addrwidth_and_datawidth(struct ipdbg_org_la_tcp *tcp,
|
SR_PRIV void ipdbg_org_la_get_addrwidth_and_datawidth(
|
||||||
struct ipdbg_org_la_dev_context *devc)
|
struct ipdbg_org_la_tcp *tcp, struct ipdbg_org_la_dev_context *devc)
|
||||||
{
|
{
|
||||||
uint8_t buf[8];
|
uint8_t buf[8];
|
||||||
uint8_t read_cmd = CMD_GET_BUS_WIDTHS;
|
uint8_t read_cmd = CMD_GET_BUS_WIDTHS;
|
||||||
|
|
||||||
if (ipdbg_org_la_tcp_send(tcp, &read_cmd, 1) != SR_OK)
|
if (ipdbg_org_la_tcp_send(tcp, &read_cmd, 1) != SR_OK)
|
||||||
sr_warn("Can't send read command");
|
sr_warn("Can't send read command");
|
||||||
|
|
||||||
if (ipdbg_org_la_tcp_receive_blocking(tcp, buf, 8) != 8)
|
if (ipdbg_org_la_tcp_receive_blocking(tcp, buf, 8) != 8)
|
||||||
sr_warn("Can't get address and data width from device");
|
sr_warn("Can't get address and data width from device");
|
||||||
|
|
||||||
devc->DATA_WIDTH = buf[0] & 0x000000FF;
|
devc->DATA_WIDTH = buf[0] & 0x000000FF;
|
||||||
devc->DATA_WIDTH |= (buf[1] << 8) & 0x0000FF00;
|
devc->DATA_WIDTH |= (buf[1] << 8) & 0x0000FF00;
|
||||||
devc->DATA_WIDTH |= (buf[2] << 16) & 0x00FF0000;
|
devc->DATA_WIDTH |= (buf[2] << 16) & 0x00FF0000;
|
||||||
devc->DATA_WIDTH |= (buf[3] << 24) & 0xFF000000;
|
devc->DATA_WIDTH |= (buf[3] << 24) & 0xFF000000;
|
||||||
|
|
||||||
devc->ADDR_WIDTH = buf[4] & 0x000000FF;
|
devc->ADDR_WIDTH = buf[4] & 0x000000FF;
|
||||||
devc->ADDR_WIDTH |= (buf[5] << 8) & 0x0000FF00;
|
devc->ADDR_WIDTH |= (buf[5] << 8) & 0x0000FF00;
|
||||||
devc->ADDR_WIDTH |= (buf[6] << 16) & 0x00FF0000;
|
devc->ADDR_WIDTH |= (buf[6] << 16) & 0x00FF0000;
|
||||||
devc->ADDR_WIDTH |= (buf[7] << 24) & 0xFF000000;
|
devc->ADDR_WIDTH |= (buf[7] << 24) & 0xFF000000;
|
||||||
|
|
||||||
uint8_t HOST_WORD_SIZE = 8;
|
uint8_t HOST_WORD_SIZE = 8;
|
||||||
|
|
||||||
devc->DATA_WIDTH_BYTES = (devc->DATA_WIDTH + HOST_WORD_SIZE - 1) / HOST_WORD_SIZE;
|
devc->DATA_WIDTH_BYTES =
|
||||||
devc->ADDR_WIDTH_BYTES = (devc->ADDR_WIDTH + HOST_WORD_SIZE - 1) / HOST_WORD_SIZE;
|
(devc->DATA_WIDTH + HOST_WORD_SIZE - 1) / HOST_WORD_SIZE;
|
||||||
devc->limit_samples_max = (0x01 << devc->ADDR_WIDTH);
|
devc->ADDR_WIDTH_BYTES =
|
||||||
devc->limit_samples = devc->limit_samples_max;
|
(devc->ADDR_WIDTH + HOST_WORD_SIZE - 1) / HOST_WORD_SIZE;
|
||||||
|
|
||||||
devc->trigger_mask = g_malloc0(devc->DATA_WIDTH_BYTES);
|
devc->limit_samples_max = (0x01 << devc->ADDR_WIDTH);
|
||||||
devc->trigger_value = g_malloc0(devc->DATA_WIDTH_BYTES);
|
devc->limit_samples = devc->limit_samples_max;
|
||||||
devc->trigger_mask_last = g_malloc0(devc->DATA_WIDTH_BYTES);
|
|
||||||
devc->trigger_value_last = g_malloc0(devc->DATA_WIDTH_BYTES);
|
devc->trigger_mask = g_malloc0(devc->DATA_WIDTH_BYTES);
|
||||||
devc->trigger_edge_mask = g_malloc0(devc->DATA_WIDTH_BYTES);
|
devc->trigger_value = g_malloc0(devc->DATA_WIDTH_BYTES);
|
||||||
|
devc->trigger_mask_last = g_malloc0(devc->DATA_WIDTH_BYTES);
|
||||||
|
devc->trigger_value_last = g_malloc0(devc->DATA_WIDTH_BYTES);
|
||||||
|
devc->trigger_edge_mask = g_malloc0(devc->DATA_WIDTH_BYTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV struct ipdbg_org_la_dev_context *ipdbg_org_la_dev_new(void)
|
SR_PRIV struct ipdbg_org_la_dev_context *ipdbg_org_la_dev_new(void)
|
||||||
{
|
{
|
||||||
struct ipdbg_org_la_dev_context *devc;
|
struct ipdbg_org_la_dev_context *devc;
|
||||||
|
|
||||||
devc = g_malloc0(sizeof(struct ipdbg_org_la_dev_context));
|
devc = g_malloc0(sizeof(struct ipdbg_org_la_dev_context));
|
||||||
devc->capture_ratio = 50;
|
devc->capture_ratio = 50;
|
||||||
|
|
||||||
return devc;
|
return devc;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_send_reset(struct ipdbg_org_la_tcp *tcp)
|
SR_PRIV int ipdbg_org_la_send_reset(struct ipdbg_org_la_tcp *tcp)
|
||||||
{
|
{
|
||||||
uint8_t buf = CMD_RESET;
|
uint8_t buf = CMD_RESET;
|
||||||
if (ipdbg_org_la_tcp_send(tcp, &buf, 1) != SR_OK)
|
if (ipdbg_org_la_tcp_send(tcp, &buf, 1) != SR_OK)
|
||||||
sr_warn("Couldn't send reset");
|
sr_warn("Couldn't send reset");
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_request_id(struct ipdbg_org_la_tcp *tcp)
|
SR_PRIV int ipdbg_org_la_request_id(struct ipdbg_org_la_tcp *tcp)
|
||||||
{
|
{
|
||||||
uint8_t buf = CMD_GET_LA_ID;
|
uint8_t buf = CMD_GET_LA_ID;
|
||||||
if (ipdbg_org_la_tcp_send(tcp, &buf, 1) != SR_OK)
|
if (ipdbg_org_la_tcp_send(tcp, &buf, 1) != SR_OK)
|
||||||
sr_warn("Couldn't send ID request");
|
sr_warn("Couldn't send ID request");
|
||||||
|
|
||||||
char id[4];
|
char id[4];
|
||||||
if (ipdbg_org_la_tcp_receive_blocking(tcp, (uint8_t*)id, 4) != 4)
|
if (ipdbg_org_la_tcp_receive_blocking(tcp, (uint8_t *) id, 4) != 4)
|
||||||
sr_warn("Couldn't read device ID");
|
sr_warn("Couldn't read device ID");
|
||||||
|
|
||||||
if (strncmp(id, "IDBG", 4)) {
|
if (strncmp(id, "IDBG", 4)) {
|
||||||
sr_err("Invalid device ID: expected 'IDBG', got '%c%c%c%c'.",
|
sr_err("Invalid device ID: expected 'IDBG', got '%c%c%c%c'.",
|
||||||
id[0], id[1], id[2], id[3]);
|
id[0], id[1], id[2], id[3]);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV void ipdbg_org_la_abort_acquisition(const struct sr_dev_inst *sdi)
|
SR_PRIV void ipdbg_org_la_abort_acquisition(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
struct ipdbg_org_la_tcp *tcp = sdi->conn;
|
||||||
|
|
||||||
sr_session_source_remove(sdi->session, tcp->socket);
|
sr_session_source_remove(sdi->session, tcp->socket);
|
||||||
|
|
||||||
std_session_send_df_end(sdi);
|
std_session_send_df_end(sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_send_start(struct ipdbg_org_la_tcp *tcp)
|
SR_PRIV int ipdbg_org_la_send_start(struct ipdbg_org_la_tcp *tcp)
|
||||||
{
|
{
|
||||||
uint8_t buf = CMD_START;
|
uint8_t buf = CMD_START;
|
||||||
|
|
||||||
if (ipdbg_org_la_tcp_send(tcp, &buf, 1) != SR_OK)
|
if (ipdbg_org_la_tcp_send(tcp, &buf, 1) != SR_OK)
|
||||||
sr_warn("Couldn't send start");
|
sr_warn("Couldn't send start");
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,33 +27,31 @@
|
||||||
|
|
||||||
#define LOG_PREFIX "ipdbg-org-la"
|
#define LOG_PREFIX "ipdbg-org-la"
|
||||||
|
|
||||||
|
|
||||||
struct ipdbg_org_la_tcp {
|
struct ipdbg_org_la_tcp {
|
||||||
char *address;
|
char *address;
|
||||||
char *port;
|
char *port;
|
||||||
int socket;
|
int socket;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Private, per-device-instance driver context. */
|
/** Private, per-device-instance driver context. */
|
||||||
struct ipdbg_org_la_dev_context
|
struct ipdbg_org_la_dev_context {
|
||||||
{
|
uint32_t DATA_WIDTH;
|
||||||
uint32_t DATA_WIDTH;
|
uint32_t DATA_WIDTH_BYTES;
|
||||||
uint32_t DATA_WIDTH_BYTES;
|
uint32_t ADDR_WIDTH;
|
||||||
uint32_t ADDR_WIDTH;
|
uint32_t ADDR_WIDTH_BYTES;
|
||||||
uint32_t ADDR_WIDTH_BYTES;
|
|
||||||
|
|
||||||
uint64_t limit_samples;
|
uint64_t limit_samples;
|
||||||
uint64_t limit_samples_max;
|
uint64_t limit_samples_max;
|
||||||
uint8_t capture_ratio;
|
uint8_t capture_ratio;
|
||||||
uint8_t *trigger_mask;
|
uint8_t *trigger_mask;
|
||||||
uint8_t *trigger_value;
|
uint8_t *trigger_value;
|
||||||
uint8_t *trigger_mask_last;
|
uint8_t *trigger_mask_last;
|
||||||
uint8_t *trigger_value_last;
|
uint8_t *trigger_value_last;
|
||||||
uint8_t *trigger_edge_mask;
|
uint8_t *trigger_edge_mask;
|
||||||
uint64_t delay_value;
|
uint64_t delay_value;
|
||||||
int num_stages;
|
int num_stages;
|
||||||
uint64_t num_transfers;
|
uint64_t num_transfers;
|
||||||
uint8_t *raw_sample_buf;
|
uint8_t *raw_sample_buf;
|
||||||
};
|
};
|
||||||
|
|
||||||
int data_available(struct ipdbg_org_la_tcp *tcp);
|
int data_available(struct ipdbg_org_la_tcp *tcp);
|
||||||
|
@ -62,22 +60,30 @@ SR_PRIV struct ipdbg_org_la_tcp *ipdbg_org_la_tcp_new(void);
|
||||||
SR_PRIV void ipdbg_org_la_tcp_free(struct ipdbg_org_la_tcp *tcp);
|
SR_PRIV void ipdbg_org_la_tcp_free(struct ipdbg_org_la_tcp *tcp);
|
||||||
SR_PRIV int ipdbg_org_la_tcp_open(struct ipdbg_org_la_tcp *tcp);
|
SR_PRIV int ipdbg_org_la_tcp_open(struct ipdbg_org_la_tcp *tcp);
|
||||||
SR_PRIV int ipdbg_org_la_tcp_close(struct ipdbg_org_la_tcp *tcp);
|
SR_PRIV int ipdbg_org_la_tcp_close(struct ipdbg_org_la_tcp *tcp);
|
||||||
SR_PRIV int ipdbg_org_la_tcp_send(struct ipdbg_org_la_tcp *tcp, const uint8_t *buf, size_t len);
|
SR_PRIV int ipdbg_org_la_tcp_send(struct ipdbg_org_la_tcp *tcp,
|
||||||
SR_PRIV int ipdbg_org_la_tcp_receive_blocking(struct ipdbg_org_la_tcp *tcp, uint8_t *buf, int bufsize);
|
const uint8_t *buf, size_t len);
|
||||||
SR_PRIV int ipdbg_org_la_tcp_receive(struct ipdbg_org_la_tcp *tcp, uint8_t *buf);
|
SR_PRIV int ipdbg_org_la_tcp_receive_blocking(struct ipdbg_org_la_tcp *tcp,
|
||||||
|
uint8_t *buf, int bufsize);
|
||||||
|
SR_PRIV int ipdbg_org_la_tcp_receive(struct ipdbg_org_la_tcp *tcp,
|
||||||
|
uint8_t *buf);
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi);
|
SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi);
|
||||||
|
|
||||||
SR_PRIV struct ipdbg_org_la_dev_context *ipdbg_org_la_dev_new(void);
|
SR_PRIV struct ipdbg_org_la_dev_context *ipdbg_org_la_dev_new(void);
|
||||||
SR_PRIV void ipdbg_org_la_get_addrwidth_and_datawidth(struct ipdbg_org_la_tcp *tcp, struct ipdbg_org_la_dev_context *devc);
|
SR_PRIV void ipdbg_org_la_get_addrwidth_and_datawidth(
|
||||||
SR_PRIV int send_escaping(struct ipdbg_org_la_tcp *tcp, uint8_t *dataToSend, uint32_t length);
|
struct ipdbg_org_la_tcp *tcp, struct ipdbg_org_la_dev_context *devc);
|
||||||
|
SR_PRIV int send_escaping(struct ipdbg_org_la_tcp *tcp, uint8_t *dataToSend,
|
||||||
|
uint32_t length);
|
||||||
SR_PRIV int ipdbg_org_la_send_reset(struct ipdbg_org_la_tcp *tcp);
|
SR_PRIV int ipdbg_org_la_send_reset(struct ipdbg_org_la_tcp *tcp);
|
||||||
SR_PRIV int ipdbg_org_la_request_id(struct ipdbg_org_la_tcp *tcp);
|
SR_PRIV int ipdbg_org_la_request_id(struct ipdbg_org_la_tcp *tcp);
|
||||||
SR_PRIV int ipdbg_org_la_send_start(struct ipdbg_org_la_tcp *tcp);
|
SR_PRIV int ipdbg_org_la_send_start(struct ipdbg_org_la_tcp *tcp);
|
||||||
SR_PRIV int ipdbg_org_la_send_trigger(struct ipdbg_org_la_dev_context *devc, struct ipdbg_org_la_tcp *tcp);
|
SR_PRIV int ipdbg_org_la_send_trigger(struct ipdbg_org_la_dev_context *devc,
|
||||||
SR_PRIV int ipdbg_org_la_send_delay(struct ipdbg_org_la_dev_context *devc, struct ipdbg_org_la_tcp *tcp);
|
struct ipdbg_org_la_tcp *tcp);
|
||||||
|
SR_PRIV int ipdbg_org_la_send_delay(struct ipdbg_org_la_dev_context *devc,
|
||||||
|
struct ipdbg_org_la_tcp *tcp);
|
||||||
SR_PRIV int ipdbg_org_la_receive_data(int fd, int revents, void *cb_data);
|
SR_PRIV int ipdbg_org_la_receive_data(int fd, int revents, void *cb_data);
|
||||||
SR_PRIV void ipdbg_org_la_abort_acquisition(const struct sr_dev_inst *sdi);
|
SR_PRIV void ipdbg_org_la_abort_acquisition(const struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int ipdbg_org_la_tcp_receive_blocking(struct ipdbg_org_la_tcp *tcp, uint8_t *buf, int bufsize);
|
SR_PRIV int ipdbg_org_la_tcp_receive_blocking(struct ipdbg_org_la_tcp *tcp,
|
||||||
|
uint8_t * buf, int bufsize);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue