ipdbg-la: revers order of trigger settings
This commit is contained in:
parent
a54144c0bd
commit
2f15f5bfec
|
@ -126,7 +126,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
sr_err("limit samples = %d\n", devc->limit_samples_max);
|
sr_err("limit samples = %d\n", devc->limit_samples_max);
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
for (int i = 0; i < devc->DATA_WIDTH; i++)
|
for (unsigned int i = 0; i < devc->DATA_WIDTH; i++)
|
||||||
{
|
{
|
||||||
snprintf(buff, bufSize, "ch%d", i);
|
snprintf(buff, bufSize, "ch%d", i);
|
||||||
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, buff);
|
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, buff);
|
||||||
|
|
|
@ -39,21 +39,27 @@
|
||||||
|
|
||||||
|
|
||||||
#define Start 0xFE
|
#define Start 0xFE
|
||||||
#define reset 0xAB
|
#define reset 0xEE
|
||||||
#define IPDBG_LA_ID 0xBB
|
#define IPDBG_LA_ID 0xBB
|
||||||
#define Escape 0x55
|
#define Escape 0x55
|
||||||
|
|
||||||
|
|
||||||
/* Command opcodes */
|
/* Command opcodes */
|
||||||
#define set_trigger 0x00
|
#define set_trigger 0x00
|
||||||
|
|
||||||
#define Trigger 0xF0
|
#define Trigger 0xF0
|
||||||
#define LA 0x0F
|
#define LA 0x0F
|
||||||
|
|
||||||
#define Masks 0xF1
|
#define Masks 0xF1
|
||||||
#define Mask 0xF3
|
#define Mask 0xF3
|
||||||
|
|
||||||
#define Value 0xF7
|
#define Value 0xF7
|
||||||
|
|
||||||
#define Last_Masks 0xF9
|
#define Last_Masks 0xF9
|
||||||
#define Mask_last 0xFB
|
#define Mask_last 0xFB
|
||||||
|
|
||||||
#define Value_last 0xFF
|
#define Value_last 0xFF
|
||||||
|
|
||||||
#define delay 0x1F
|
#define delay 0x1F
|
||||||
#define K_Mauslesen 0xAA
|
#define K_Mauslesen 0xAA
|
||||||
|
|
||||||
|
@ -118,7 +124,6 @@ SR_PRIV int ipdbg_org_la_tcp_open(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, 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) {
|
||||||
|
@ -139,7 +144,6 @@ SR_PRIV int ipdbg_org_la_tcp_receive(struct ipdbg_org_la_tcp *tcp, uint8_t *buf,
|
||||||
|
|
||||||
while(received < bufsize)
|
while(received < bufsize)
|
||||||
{
|
{
|
||||||
|
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = recv(tcp->socket, (char*)(buf+received), bufsize-received, 0);
|
len = recv(tcp->socket, (char*)(buf+received), bufsize-received, 0);
|
||||||
|
@ -187,37 +191,19 @@ SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi)
|
||||||
devc->num_stages = 0;
|
devc->num_stages = 0;
|
||||||
devc->num_transfers = 0;
|
devc->num_transfers = 0;
|
||||||
devc->raw_sample_buf = NULL; /// name convert_trigger to init acquisition...
|
devc->raw_sample_buf = NULL; /// name convert_trigger to init acquisition...
|
||||||
for (int i = 0; i < devc->DATA_WIDTH_BYTES; i++) // Hier werden die Trigger-Variabeln 0 gesetzt!
|
for (unsigned int i = 0; i < devc->DATA_WIDTH_BYTES; i++) // Hier werden die Trigger-Variabeln 0 gesetzt!
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
//sr_err("\nDATA_WITH_BYTES:%i\n",devc->DATA_WIDTH_BYTES);
|
|
||||||
|
|
||||||
// devc->trigger_value[0] = 0x00;
|
|
||||||
// devc->trigger_value_last[0] = 0xff;
|
|
||||||
// devc->trigger_mask[0] = 0xff;
|
|
||||||
// devc->trigger_mask_last[0] = 0xff;
|
|
||||||
|
|
||||||
|
|
||||||
if (!(trigger = sr_session_trigger_get(sdi->session))) //
|
if (!(trigger = sr_session_trigger_get(sdi->session))) //
|
||||||
{
|
{
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
devc->num_stages = g_slist_length(trigger->stages);
|
|
||||||
if (devc->num_stages != devc->DATA_WIDTH_BYTES)
|
|
||||||
{
|
|
||||||
|
|
||||||
sr_err("\nThis device only supports %d trigger stages.",
|
|
||||||
devc->DATA_WIDTH_BYTES);
|
|
||||||
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (l = trigger->stages; l; l = l->next)
|
for (l = trigger->stages; l; l = l->next)
|
||||||
{
|
{
|
||||||
stage = l->data;
|
stage = l->data;
|
||||||
|
@ -271,11 +257,6 @@ SR_PRIV int ipdbg_org_la_convert_trigger(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sr_err("\n VAL LAST:%x\n",devc->trigger_value_last[0]);
|
|
||||||
// sr_err("\n VAL:%x\n",devc->trigger_value[0]);
|
|
||||||
// sr_err("\n MASK:%x\n",devc->trigger_mask[0]);
|
|
||||||
// sr_err("\n MASK LAST:%x\n",devc->trigger_mask_last[0]);
|
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,12 +372,10 @@ SR_PRIV int ipdbg_org_la_receive_data(int fd, int revents, void *cb_data)
|
||||||
|
|
||||||
SR_PRIV int ipdbg_org_la_sendDelay(struct ipdbg_org_la_dev_context *devc, struct ipdbg_org_la_tcp *tcp)
|
SR_PRIV int ipdbg_org_la_sendDelay(struct ipdbg_org_la_dev_context *devc, struct ipdbg_org_la_tcp *tcp)
|
||||||
{
|
{
|
||||||
//sr_warn("delay");
|
|
||||||
|
|
||||||
int maxSample;
|
int maxSample;
|
||||||
|
|
||||||
maxSample = //0x1 << (devc->ADDR_WIDTH);
|
maxSample = devc->limit_samples;
|
||||||
devc->limit_samples;
|
|
||||||
|
|
||||||
devc->delay_value = (maxSample/100.0) * devc->capture_ratio;
|
devc->delay_value = (maxSample/100.0) * devc->capture_ratio;
|
||||||
uint8_t Befehl[1];
|
uint8_t Befehl[1];
|
||||||
|
@ -413,9 +392,8 @@ SR_PRIV int ipdbg_org_la_sendDelay(struct ipdbg_org_la_dev_context *devc, struct
|
||||||
(devc->delay_value >> 16) & 0x000000ff,
|
(devc->delay_value >> 16) & 0x000000ff,
|
||||||
(devc->delay_value >> 24) & 0x000000ff};
|
(devc->delay_value >> 24) & 0x000000ff};
|
||||||
|
|
||||||
sendEscaping(tcp, buf, devc->ADDR_WIDTH_BYTES);
|
for(size_t i = 0 ; i < devc->ADDR_WIDTH_BYTES ; ++i)
|
||||||
|
sendEscaping(tcp, &(buf[devc->ADDR_WIDTH_BYTES-1-i]), 1);
|
||||||
//sr_warn("send delay_value: 0x%.2x", devc->delay_value);
|
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -431,9 +409,8 @@ SR_PRIV int ipdbg_org_la_sendTrigger(struct ipdbg_org_la_dev_context *devc, stru
|
||||||
buf[0] = Mask;
|
buf[0] = Mask;
|
||||||
ipdbg_org_la_tcp_send(tcp, buf, 1);
|
ipdbg_org_la_tcp_send(tcp, buf, 1);
|
||||||
|
|
||||||
sendEscaping(tcp, devc->trigger_mask, devc->DATA_WIDTH_BYTES);
|
for(size_t k = 0 ; k < devc->DATA_WIDTH_BYTES ; ++k)
|
||||||
|
sendEscaping(tcp, devc->trigger_mask + devc->DATA_WIDTH_BYTES -1-k, 1);
|
||||||
//sr_warn("send trigger_mask: %x", devc->trigger_mask[0]);
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////Value////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////Value////////////////////////////////////////////////////////////
|
||||||
|
@ -445,10 +422,8 @@ SR_PRIV int ipdbg_org_la_sendTrigger(struct ipdbg_org_la_dev_context *devc, stru
|
||||||
ipdbg_org_la_tcp_send(tcp, buf, 1);
|
ipdbg_org_la_tcp_send(tcp, buf, 1);
|
||||||
|
|
||||||
|
|
||||||
sendEscaping(tcp, devc->trigger_value, devc->DATA_WIDTH_BYTES);
|
for(size_t k = 0 ; k < devc->DATA_WIDTH_BYTES ; ++k)
|
||||||
|
sendEscaping(tcp, devc->trigger_value + devc->DATA_WIDTH_BYTES -1-k, 1);
|
||||||
//sr_warn("send trigger_value: 0x%.2x", devc->trigger_value[0]);
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////Mask_last////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////Mask_last////////////////////////////////////////////////////////////
|
||||||
buf[0] = Trigger;
|
buf[0] = Trigger;
|
||||||
|
@ -459,10 +434,8 @@ SR_PRIV int ipdbg_org_la_sendTrigger(struct ipdbg_org_la_dev_context *devc, stru
|
||||||
ipdbg_org_la_tcp_send(tcp, buf, 1);
|
ipdbg_org_la_tcp_send(tcp, buf, 1);
|
||||||
|
|
||||||
|
|
||||||
sendEscaping(tcp, devc->trigger_mask_last, devc->DATA_WIDTH_BYTES);
|
for(size_t k = 0 ; k < devc->DATA_WIDTH_BYTES ; ++k)
|
||||||
|
sendEscaping(tcp, devc->trigger_mask_last + devc->DATA_WIDTH_BYTES -1-k, 1);
|
||||||
|
|
||||||
//sr_warn("send trigger_mask_last: 0x%.2x", devc->trigger_mask_last[0]);
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////Value_last////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////Value_last////////////////////////////////////////////////////////////
|
||||||
|
@ -474,17 +447,14 @@ SR_PRIV int ipdbg_org_la_sendTrigger(struct ipdbg_org_la_dev_context *devc, stru
|
||||||
ipdbg_org_la_tcp_send(tcp, buf, 1);
|
ipdbg_org_la_tcp_send(tcp, buf, 1);
|
||||||
|
|
||||||
|
|
||||||
sendEscaping(tcp, devc->trigger_value_last, devc->DATA_WIDTH_BYTES);
|
for(size_t k = 0 ; k < devc->DATA_WIDTH_BYTES ; ++k)
|
||||||
|
sendEscaping(tcp, devc->trigger_value_last + devc->DATA_WIDTH_BYTES -1-k, 1);
|
||||||
|
|
||||||
//sr_warn("send trigger_value_last: 0x%.2x", devc->trigger_value_last[0]);
|
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int sendEscaping(struct ipdbg_org_la_tcp *tcp, char *dataToSend, int length)
|
SR_PRIV int sendEscaping(struct ipdbg_org_la_tcp *tcp, char *dataToSend, int length)
|
||||||
{
|
{
|
||||||
|
|
||||||
while(length--)
|
while(length--)
|
||||||
{
|
{
|
||||||
uint8_t payload = *dataToSend++;
|
uint8_t payload = *dataToSend++;
|
||||||
|
|
|
@ -32,19 +32,15 @@ struct ipdbg_org_la_tcp {
|
||||||
char *address;
|
char *address;
|
||||||
char *port;
|
char *port;
|
||||||
int socket;
|
int socket;
|
||||||
//char length_buf[BUFFER_SIZE];
|
|
||||||
//int length_bytes_read;
|
|
||||||
//int response_length;
|
|
||||||
//int response_bytes_read;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Private, per-device-instance driver context. */
|
/** Private, per-device-instance driver context. */
|
||||||
struct ipdbg_org_la_dev_context
|
struct ipdbg_org_la_dev_context
|
||||||
{
|
{
|
||||||
int DATA_WIDTH;
|
unsigned int DATA_WIDTH;
|
||||||
int DATA_WIDTH_BYTES;
|
unsigned int DATA_WIDTH_BYTES;
|
||||||
int ADDR_WIDTH;
|
unsigned int ADDR_WIDTH;
|
||||||
int ADDR_WIDTH_BYTES ;
|
unsigned int ADDR_WIDTH_BYTES ;
|
||||||
|
|
||||||
unsigned int limit_samples;
|
unsigned int limit_samples;
|
||||||
unsigned int limit_samples_max;
|
unsigned int limit_samples_max;
|
||||||
|
|
Loading…
Reference in New Issue