mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +08:00
Merge pull request #621 from yunyaobaihong/demo
demo:repair dso single and analog random
This commit is contained in:
commit
30fb8ea2d7
@ -49,10 +49,11 @@
|
|||||||
#define BUFSIZE 512*1024
|
#define BUFSIZE 512*1024
|
||||||
#define DSO_BUFSIZE 10*1024
|
#define DSO_BUFSIZE 10*1024
|
||||||
|
|
||||||
static struct DEMO_channels channel_modes_f[] = {
|
static struct DEMO_channels channel_modes[] = {
|
||||||
// LA Stream
|
// LA Stream
|
||||||
{DEMO_LOGIC100x16, LOGIC, SR_CHANNEL_LOGIC, 16, 1, SR_MHZ(1), SR_Mn(1),
|
{DEMO_LOGIC100x16, LOGIC, SR_CHANNEL_LOGIC, 16, 1, SR_MHZ(1), SR_Mn(1),
|
||||||
SR_KHZ(10), SR_MHZ(100), "Use 16 Channels (Max 20MHz)"},
|
SR_KHZ(10), SR_MHZ(100), "Use 16 Channels (Max 20MHz)"},
|
||||||
|
//updata
|
||||||
|
|
||||||
// DAQ
|
// DAQ
|
||||||
{DEMO_ANALOG10x2, ANALOG, SR_CHANNEL_ANALOG, 2, 8, SR_MHZ(1), SR_Mn(1),
|
{DEMO_ANALOG10x2, ANALOG, SR_CHANNEL_ANALOG, 2, 8, SR_MHZ(1), SR_Mn(1),
|
||||||
@ -73,7 +74,31 @@ static struct sr_dev_driver *di = &demo_driver_info;
|
|||||||
|
|
||||||
extern struct ds_trigger *trigger;
|
extern struct ds_trigger *trigger;
|
||||||
|
|
||||||
static int delay_time()
|
static void init_analog_random_data(struct session_vdev * vdev)
|
||||||
|
{
|
||||||
|
if(vdev->analog_buf != NULL)
|
||||||
|
{
|
||||||
|
g_safe_free(vdev->analog_buf);
|
||||||
|
vdev->analog_buf = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
vdev->analog_buf = g_try_malloc0(DSO_BUF_LEN);
|
||||||
|
if (vdev->analog_buf == NULL)
|
||||||
|
{
|
||||||
|
sr_err("%s: vdev->analog_buf malloc failed", __func__);
|
||||||
|
return SR_ERR_MALLOC;
|
||||||
|
}
|
||||||
|
for(int i = 0;i < DSO_BUF_LEN ;i++)
|
||||||
|
{
|
||||||
|
if(i % 2 == 0)
|
||||||
|
*(uint8_t*)(vdev->analog_buf + i) = ANALOG_RANDOM_DATA;
|
||||||
|
else
|
||||||
|
*(uint8_t*)(vdev->analog_buf + i) = *(uint8_t*)(vdev->analog_buf + i -1);
|
||||||
|
}
|
||||||
|
vdev->analog_buf_len = DSO_BUF_LEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void delay_time()
|
||||||
{
|
{
|
||||||
gdouble packet_elapsed = g_timer_elapsed(packet_interval, NULL);
|
gdouble packet_elapsed = g_timer_elapsed(packet_interval, NULL);
|
||||||
gdouble waittime = packet_time - packet_elapsed;
|
gdouble waittime = packet_time - packet_elapsed;
|
||||||
@ -81,22 +106,18 @@ static int delay_time()
|
|||||||
{
|
{
|
||||||
g_usleep(SR_MS(waittime));
|
g_usleep(SR_MS(waittime));
|
||||||
}
|
}
|
||||||
|
|
||||||
return SR_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_last_packet_len(struct sr_datafeed_logic *logic,const struct session_vdev * vdev)
|
static void get_last_packet_len(struct sr_datafeed_logic *logic,const struct session_vdev * vdev)
|
||||||
{
|
{
|
||||||
assert(vdev);
|
assert(vdev);
|
||||||
int last_packet_len = post_data_len - (logic->length / enabled_probe_num);
|
int last_packet_len = post_data_len - (logic->length / enabled_probe_num);
|
||||||
last_packet_len = (vdev->total_samples/8) - last_packet_len;
|
last_packet_len = (vdev->total_samples/8) - last_packet_len;
|
||||||
logic->length = last_packet_len * enabled_probe_num;
|
logic->length = last_packet_len * enabled_probe_num;
|
||||||
post_data_len = vdev->total_samples/8;
|
post_data_len = vdev->total_samples/8;
|
||||||
|
|
||||||
return SR_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reset_enabled_probe_num(struct sr_dev_inst *sdi)
|
static void reset_enabled_probe_num(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_channel *probe;
|
struct sr_channel *probe;
|
||||||
enabled_probe_num = 0;
|
enabled_probe_num = 0;
|
||||||
@ -108,11 +129,9 @@ static int reset_enabled_probe_num(struct sr_dev_inst *sdi)
|
|||||||
enabled_probe_num++;
|
enabled_probe_num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SR_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_pattern_mode_list()
|
static void init_pattern_mode_list()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if(pattern_logic_count != 1)
|
if(pattern_logic_count != 1)
|
||||||
@ -121,7 +140,7 @@ static int init_pattern_mode_list()
|
|||||||
{
|
{
|
||||||
if(pattern_strings_logic[i] != NULL)
|
if(pattern_strings_logic[i] != NULL)
|
||||||
{
|
{
|
||||||
g_free(pattern_strings_logic[i]);
|
g_safe_free(pattern_strings_logic[i]);
|
||||||
pattern_strings_logic[i] =NULL;
|
pattern_strings_logic[i] =NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +151,7 @@ static int init_pattern_mode_list()
|
|||||||
{
|
{
|
||||||
if(pattern_strings_dso[i] != NULL)
|
if(pattern_strings_dso[i] != NULL)
|
||||||
{
|
{
|
||||||
g_free(pattern_strings_dso[i]);
|
g_safe_free(pattern_strings_dso[i]);
|
||||||
pattern_strings_dso[i] =NULL;
|
pattern_strings_dso[i] =NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,7 +162,7 @@ static int init_pattern_mode_list()
|
|||||||
{
|
{
|
||||||
if(pattern_strings_analog[i] != NULL)
|
if(pattern_strings_analog[i] != NULL)
|
||||||
{
|
{
|
||||||
g_free(pattern_strings_analog[i]);
|
g_safe_free(pattern_strings_analog[i]);
|
||||||
pattern_strings_analog[i] =NULL;
|
pattern_strings_analog[i] =NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,7 +218,7 @@ static int get_pattern_mode_index_by_string(uint8_t device_mode , const char* st
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_pattern_mode_from_file(uint8_t device_mode)
|
static void get_pattern_mode_from_file(uint8_t device_mode)
|
||||||
{
|
{
|
||||||
const gchar * filename = NULL;
|
const gchar * filename = NULL;
|
||||||
char dir_str[500];
|
char dir_str[500];
|
||||||
@ -255,7 +274,7 @@ static int get_pattern_mode_from_file(uint8_t device_mode)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scan_dsl_file(struct sr_dev_inst *sdi)
|
static void scan_dsl_file(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
init_pattern_mode_list();
|
init_pattern_mode_list();
|
||||||
|
|
||||||
@ -365,12 +384,12 @@ static void adjust_samplerate(struct sr_dev_inst *sdi)
|
|||||||
|
|
||||||
vdev->samplerates_max_index = ARRAY_SIZE(samplerates) - 1;
|
vdev->samplerates_max_index = ARRAY_SIZE(samplerates) - 1;
|
||||||
while (samplerates[vdev->samplerates_max_index] >
|
while (samplerates[vdev->samplerates_max_index] >
|
||||||
channel_modes_f[cur_mode].max_samplerate)
|
channel_modes[cur_mode].max_samplerate)
|
||||||
vdev->samplerates_max_index--;
|
vdev->samplerates_max_index--;
|
||||||
|
|
||||||
vdev->samplerates_min_index = 0;
|
vdev->samplerates_min_index = 0;
|
||||||
while (samplerates[vdev->samplerates_min_index] <
|
while (samplerates[vdev->samplerates_min_index] <
|
||||||
channel_modes_f[cur_mode].min_samplerate)
|
channel_modes[cur_mode].min_samplerate)
|
||||||
vdev->samplerates_min_index++;
|
vdev->samplerates_min_index++;
|
||||||
|
|
||||||
assert(vdev->samplerates_max_index >= vdev->samplerates_min_index);
|
assert(vdev->samplerates_max_index >= vdev->samplerates_min_index);
|
||||||
@ -383,18 +402,14 @@ static void adjust_samplerate(struct sr_dev_inst *sdi)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_random_data(struct session_vdev * vdev,struct sr_dev_inst *sdi)
|
static void init_random_data(struct session_vdev * vdev,struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
uint8_t random_val;
|
|
||||||
struct sr_channel *probe;
|
|
||||||
GSList *l = NULL;
|
|
||||||
int enabled_probe = 0;
|
|
||||||
int cur_probe = 0;
|
int cur_probe = 0;
|
||||||
int probe_count[LOGIC_MAX_PROBE_NUM] = {0};
|
int probe_count[LOGIC_MAX_PROBE_NUM] = {0};
|
||||||
uint8_t probe_status[LOGIC_MAX_PROBE_NUM] = {LOGIC_HIGH_LEVEL};
|
uint8_t probe_status[LOGIC_MAX_PROBE_NUM] = {LOGIC_HIGH_LEVEL};
|
||||||
|
|
||||||
memset(probe_status,LOGIC_HIGH_LEVEL,16);
|
memset(probe_status,LOGIC_HIGH_LEVEL,16);
|
||||||
memset(vdev->logic_buf,0,SR_MB(1));
|
memset(vdev->logic_buf,0,LOGIC_BUF_LEN);
|
||||||
|
|
||||||
for(int i = 0 ;i < enabled_probe_num;i++)
|
for(int i = 0 ;i < enabled_probe_num;i++)
|
||||||
{
|
{
|
||||||
@ -458,7 +473,7 @@ static GSList *hw_scan(GSList *options)
|
|||||||
supported_Demo[0].model,
|
supported_Demo[0].model,
|
||||||
supported_Demo[0].model_version);
|
supported_Demo[0].model_version);
|
||||||
if (!sdi) {
|
if (!sdi) {
|
||||||
g_free(vdev);
|
g_safe_free(vdev);
|
||||||
sr_err("Device instance creation failed.");
|
sr_err("Device instance creation failed.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -534,12 +549,15 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
|
|||||||
{
|
{
|
||||||
g_safe_free(vdev->logic_buf);
|
g_safe_free(vdev->logic_buf);
|
||||||
}
|
}
|
||||||
if(!(vdev->logic_buf = g_try_malloc0(SR_MB(1))))
|
vdev->logic_buf = g_try_malloc0(LOGIC_BUF_LEN);
|
||||||
|
if(vdev->logic_buf == NULL)
|
||||||
{
|
{
|
||||||
return SR_ERR;
|
sr_err("%s: vdev->logic_buf malloc failed", __func__);
|
||||||
|
return SR_ERR_MALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vdev->logic_buf_len = SR_MB(1);
|
vdev->logic_buf_len = LOGIC_BUF_LEN;
|
||||||
|
|
||||||
packet_interval = g_timer_new();
|
packet_interval = g_timer_new();
|
||||||
run_time = g_timer_new();
|
run_time = g_timer_new();
|
||||||
@ -571,7 +589,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
|
|||||||
|
|
||||||
for (i = 0; i < SESSION_MAX_CHANNEL_COUNT; i++){
|
for (i = 0; i < SESSION_MAX_CHANNEL_COUNT; i++){
|
||||||
if (pack_buf->block_bufs[i] != NULL){
|
if (pack_buf->block_bufs[i] != NULL){
|
||||||
g_free(pack_buf->block_bufs[i]);
|
g_safe_free(pack_buf->block_bufs[i]);
|
||||||
pack_buf->block_bufs[i] = NULL;
|
pack_buf->block_bufs[i] = NULL;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -732,6 +750,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
|||||||
*data = g_variant_new_int16(vdev->num_probes);
|
*data = g_variant_new_int16(vdev->num_probes);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_HAVE_ZERO:
|
case SR_CONF_HAVE_ZERO:
|
||||||
|
*data = g_variant_new_boolean(FALSE);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LOAD_DECODER:
|
case SR_CONF_LOAD_DECODER:
|
||||||
*data = g_variant_new_boolean(sample_generator != PATTERN_RANDOM);
|
*data = g_variant_new_boolean(sample_generator != PATTERN_RANDOM);
|
||||||
@ -1102,6 +1121,7 @@ static int hw_dev_acquisition_start(struct sr_dev_inst *sdi,
|
|||||||
packet_len = LOGIC_MIN_PACKET_LEN;
|
packet_len = LOGIC_MIN_PACKET_LEN;
|
||||||
packet_time = LOGIC_MIN_PACKET_TIME(vdev->samplerate);
|
packet_time = LOGIC_MIN_PACKET_TIME(vdev->samplerate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(sample_generator == PATTERN_RANDOM)
|
if(sample_generator == PATTERN_RANDOM)
|
||||||
{
|
{
|
||||||
@ -1116,9 +1136,21 @@ static int hw_dev_acquisition_start(struct sr_dev_inst *sdi,
|
|||||||
else if(sdi->mode == DSO)
|
else if(sdi->mode == DSO)
|
||||||
{
|
{
|
||||||
vdiv_change = TRUE;
|
vdiv_change = TRUE;
|
||||||
packet_time = DSO_PACKET_TIME;
|
if(instant){
|
||||||
|
post_data_len = 0;
|
||||||
|
|
||||||
|
gdouble total_time = vdev->timebase /(gdouble)SR_SEC(1)*(gdouble)10;
|
||||||
|
uint64_t post_data_per_sec = DSO_PACKET_LEN/total_time;
|
||||||
|
packet_len = 2;
|
||||||
|
uint64_t packet_num = post_data_per_sec/packet_len;
|
||||||
|
packet_time = SEC/(gdouble)packet_num;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
packet_time = DSO_PACKET_TIME;
|
||||||
|
}
|
||||||
|
|
||||||
g_timer_start(run_time);
|
g_timer_start(run_time);
|
||||||
total_num = 0;
|
|
||||||
sr_session_source_add(-1, 0, 0, receive_data_dso, sdi);
|
sr_session_source_add(-1, 0, 0, receive_data_dso, sdi);
|
||||||
}
|
}
|
||||||
else if(sdi->mode == ANALOG)
|
else if(sdi->mode == ANALOG)
|
||||||
@ -1139,9 +1171,11 @@ static int hw_dev_acquisition_start(struct sr_dev_inst *sdi,
|
|||||||
}
|
}
|
||||||
packet_time = ANALOG_PACKET_TIME(ANALOG_PACKET_NUM_PER_SEC);
|
packet_time = ANALOG_PACKET_TIME(ANALOG_PACKET_NUM_PER_SEC);
|
||||||
}
|
}
|
||||||
|
if(sample_generator == PATTERN_RANDOM)
|
||||||
|
init_analog_random_data(vdev);
|
||||||
|
|
||||||
|
vdev->analog_read_pos = 0;
|
||||||
|
|
||||||
vdev->analog_buf_len = 0;
|
|
||||||
vdev->analog_read_pos = 0;
|
|
||||||
sr_session_source_add(-1, 0, 0, receive_data_analog, sdi);
|
sr_session_source_add(-1, 0, 0, receive_data_analog, sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1242,8 +1276,8 @@ static int receive_data_logic(int fd, int revents, const struct sr_dev_inst *sdi
|
|||||||
int index = enabled_probe_num * 8;
|
int index = enabled_probe_num * 8;
|
||||||
random = floor(random/index)*index;
|
random = floor(random/index)*index;
|
||||||
logic.data = vdev->logic_buf + random;
|
logic.data = vdev->logic_buf + random;
|
||||||
delay_time();
|
|
||||||
ds_data_forward(sdi, &packet);
|
ds_data_forward(sdi, &packet);
|
||||||
|
delay_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bToEnd || revents == -1)
|
if (bToEnd || revents == -1)
|
||||||
@ -1350,7 +1384,7 @@ static int receive_data_logic_decoder(int fd, int revents, const struct sr_dev_i
|
|||||||
{
|
{
|
||||||
if(pack_buffer->block_bufs[ch_index] != NULL)
|
if(pack_buffer->block_bufs[ch_index] != NULL)
|
||||||
{
|
{
|
||||||
g_free(pack_buffer->block_bufs[ch_index]);
|
g_safe_free(pack_buffer->block_bufs[ch_index]);
|
||||||
}
|
}
|
||||||
pack_buffer->block_bufs[ch_index] = NULL;
|
pack_buffer->block_bufs[ch_index] = NULL;
|
||||||
pack_buffer->block_read_positions[ch_index] = 0;
|
pack_buffer->block_read_positions[ch_index] = 0;
|
||||||
@ -1432,7 +1466,7 @@ static int receive_data_logic_decoder(int fd, int revents, const struct sr_dev_i
|
|||||||
for (malloc_chan_index = 0; malloc_chan_index < chan_num; malloc_chan_index++){
|
for (malloc_chan_index = 0; malloc_chan_index < chan_num; malloc_chan_index++){
|
||||||
// Release the old buffer.
|
// Release the old buffer.
|
||||||
if (pack_buffer->block_bufs[malloc_chan_index] != NULL){
|
if (pack_buffer->block_bufs[malloc_chan_index] != NULL){
|
||||||
g_free(pack_buffer->block_bufs[malloc_chan_index]);
|
g_safe_free(pack_buffer->block_bufs[malloc_chan_index]);
|
||||||
pack_buffer->block_bufs[malloc_chan_index] = NULL;
|
pack_buffer->block_bufs[malloc_chan_index] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1517,6 +1551,7 @@ static int receive_data_logic_decoder(int fd, int revents, const struct sr_dev_i
|
|||||||
|
|
||||||
delay_time();
|
delay_time();
|
||||||
ds_data_forward(sdi, &packet);
|
ds_data_forward(sdi, &packet);
|
||||||
|
|
||||||
pack_buffer->post_len = 0;
|
pack_buffer->post_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1638,7 +1673,7 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
vdev->packet_buffer->post_buf_len = chan_num * 10000;
|
vdev->packet_buffer->post_buf_len = chan_num * 10000;
|
||||||
if(pack_buffer->post_buf != NULL)
|
if(pack_buffer->post_buf != NULL)
|
||||||
{
|
{
|
||||||
g_free(pack_buffer->post_buf);
|
g_safe_free(pack_buffer->post_buf);
|
||||||
}
|
}
|
||||||
pack_buffer->post_buf = g_try_malloc0(pack_buffer->post_buf_len);
|
pack_buffer->post_buf = g_try_malloc0(pack_buffer->post_buf_len);
|
||||||
if (pack_buffer->post_buf == NULL)
|
if (pack_buffer->post_buf == NULL)
|
||||||
@ -1656,7 +1691,7 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
{
|
{
|
||||||
if(pack_buffer->block_bufs[ch_index] != NULL)
|
if(pack_buffer->block_bufs[ch_index] != NULL)
|
||||||
{
|
{
|
||||||
g_free(pack_buffer->block_bufs[ch_index]);
|
g_safe_free(pack_buffer->block_bufs[ch_index]);
|
||||||
}
|
}
|
||||||
pack_buffer->block_bufs[ch_index] = NULL;
|
pack_buffer->block_bufs[ch_index] = NULL;
|
||||||
pack_buffer->block_read_positions[ch_index] = 0;
|
pack_buffer->block_read_positions[ch_index] = 0;
|
||||||
@ -1678,7 +1713,7 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
for(int i = 0 ; i < pack_buffer->post_buf_len ;i++)
|
for(int i = 0 ; i < pack_buffer->post_buf_len ;i++)
|
||||||
{
|
{
|
||||||
if(i % 2 == 0)
|
if(i % 2 == 0)
|
||||||
*(uint8_t*)(pack_buffer->post_buf + i) = rand()%40 +110;
|
*(uint8_t*)(pack_buffer->post_buf + i) = DSO_RANDOM_DATA;
|
||||||
else
|
else
|
||||||
*(uint8_t*)(pack_buffer->post_buf + i) = *(uint8_t*)(pack_buffer->post_buf + i -1);
|
*(uint8_t*)(pack_buffer->post_buf + i) = *(uint8_t*)(pack_buffer->post_buf + i -1);
|
||||||
}
|
}
|
||||||
@ -1738,7 +1773,7 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
for (malloc_chan_index = 0; malloc_chan_index < chan_num; malloc_chan_index++){
|
for (malloc_chan_index = 0; malloc_chan_index < chan_num; malloc_chan_index++){
|
||||||
// Release the old buffer.
|
// Release the old buffer.
|
||||||
if (pack_buffer->block_bufs[malloc_chan_index] != NULL){
|
if (pack_buffer->block_bufs[malloc_chan_index] != NULL){
|
||||||
g_free(pack_buffer->block_bufs[malloc_chan_index]);
|
g_safe_free(pack_buffer->block_bufs[malloc_chan_index]);
|
||||||
pack_buffer->block_bufs[malloc_chan_index] = NULL;
|
pack_buffer->block_bufs[malloc_chan_index] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1820,6 +1855,11 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
if(sample_generator!= PATTERN_RANDOM)
|
if(sample_generator!= PATTERN_RANDOM)
|
||||||
{
|
{
|
||||||
void* tmp_buf = g_try_malloc0(bit);
|
void* tmp_buf = g_try_malloc0(bit);
|
||||||
|
if(tmp_buf == NULL)
|
||||||
|
{
|
||||||
|
sr_err("%s: tmp_buf malloc failed", __func__);
|
||||||
|
return SR_ERR_MALLOC;
|
||||||
|
}
|
||||||
for(int i = 0 ; i < bit ; i++)
|
for(int i = 0 ; i < bit ; i++)
|
||||||
{
|
{
|
||||||
if(i%2 == 0)
|
if(i%2 == 0)
|
||||||
@ -1845,7 +1885,7 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
memcpy(pack_buffer->post_buf+i*bit,tmp_buf,bit);
|
memcpy(pack_buffer->post_buf+i*bit,tmp_buf,bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(tmp_buf);
|
g_safe_free(tmp_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0 ; i < pack_buffer->post_buf_len; i++)
|
for(int i = 0 ; i < pack_buffer->post_buf_len; i++)
|
||||||
@ -1865,26 +1905,24 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
|
|
||||||
|
|
||||||
uint8_t temp_val = *((uint8_t*)pack_buffer->post_buf + i);
|
uint8_t temp_val = *((uint8_t*)pack_buffer->post_buf + i);
|
||||||
if(temp_val>128)
|
if(temp_val > DSO_MID_VAL)
|
||||||
{
|
{
|
||||||
val = temp_val - 128;
|
val = temp_val - DSO_MID_VAL;
|
||||||
tem = val * 1000 / vdiv;
|
tem = val * DSO_DEFAULT_VDIV / vdiv;
|
||||||
tem = 128 + tem;
|
if(tem >= DSO_MID_VAL)
|
||||||
if(tem >= 255)
|
temp_val = DSO_MIN_VAL;
|
||||||
temp_val = 255;
|
|
||||||
else
|
else
|
||||||
temp_val = tem;
|
temp_val = DSO_MID_VAL + tem;
|
||||||
}
|
}
|
||||||
else if(temp_val < 128 && temp_val != 0)
|
else if(temp_val < DSO_MID_VAL)
|
||||||
{
|
{
|
||||||
val = 128 - temp_val;
|
val = DSO_MID_VAL - temp_val;
|
||||||
tem = val * 1000 / vdiv;
|
tem = val * DSO_DEFAULT_VDIV / vdiv;
|
||||||
tem = 128 - tem;
|
|
||||||
|
|
||||||
if(tem == 0)
|
if(tem >= DSO_MID_VAL)
|
||||||
temp_val = 1;
|
temp_val = DSO_MAX_VAL;
|
||||||
else
|
else
|
||||||
temp_val = tem;
|
temp_val = DSO_MID_VAL - tem;
|
||||||
}
|
}
|
||||||
*((uint8_t*)pack_buffer->post_buf + i) = temp_val;
|
*((uint8_t*)pack_buffer->post_buf + i) = temp_val;
|
||||||
}
|
}
|
||||||
@ -1896,44 +1934,60 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
gdouble total_time = vdev->timebase /(gdouble)SR_SEC(1)*(gdouble)10;
|
gdouble total_time = vdev->timebase /(gdouble)SR_SEC(1)*(gdouble)10;
|
||||||
gdouble total_time_elapsed = g_timer_elapsed(run_time, NULL);
|
gdouble total_time_elapsed = g_timer_elapsed(run_time, NULL);
|
||||||
|
|
||||||
if (total_time_elapsed < total_time&&!instant)
|
if(!instant)
|
||||||
{
|
{
|
||||||
gdouble percent = total_time_elapsed / total_time;
|
if (total_time_elapsed < total_time)
|
||||||
int buf_len = percent* DSO_PACKET_LEN;
|
|
||||||
if(buf_len %2 != 0)
|
|
||||||
buf_len +=1;
|
|
||||||
pack_buffer->post_len = buf_len;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uint8_t top0;
|
|
||||||
uint8_t top1;
|
|
||||||
if(sample_generator == PATTERN_RANDOM)
|
|
||||||
{
|
{
|
||||||
top0 = *((uint8_t*)pack_buffer->post_buf + pack_buffer->post_buf_len -2);
|
gdouble percent = total_time_elapsed / total_time;
|
||||||
top1 = *((uint8_t*)pack_buffer->post_buf + pack_buffer->post_buf_len -1);
|
int buf_len = percent* DSO_PACKET_LEN;
|
||||||
|
if(buf_len %2 != 0)
|
||||||
|
buf_len +=1;
|
||||||
|
pack_buffer->post_len = buf_len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
top0 = *((uint8_t*)pack_buffer->post_buf + get_bit(vdev->timebase) -2);
|
uint8_t top0;
|
||||||
top1 = *((uint8_t*)pack_buffer->post_buf + get_bit(vdev->timebase) -1);
|
uint8_t top1;
|
||||||
|
if(sample_generator == PATTERN_RANDOM)
|
||||||
|
{
|
||||||
|
top0 = *((uint8_t*)pack_buffer->post_buf + pack_buffer->post_buf_len -2);
|
||||||
|
top1 = *((uint8_t*)pack_buffer->post_buf + pack_buffer->post_buf_len -1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
top0 = *((uint8_t*)pack_buffer->post_buf + get_bit(vdev->timebase) -2);
|
||||||
|
top1 = *((uint8_t*)pack_buffer->post_buf + get_bit(vdev->timebase) -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = pack_buffer->post_len -1; i > 1; i -= 2){
|
||||||
|
*((uint8_t*)pack_buffer->post_buf + i) = *((uint8_t*)pack_buffer->post_buf + i - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = pack_buffer->post_len -2; i > 0; i -= 2){
|
||||||
|
*((uint8_t*)pack_buffer->post_buf + i) = *((uint8_t*)pack_buffer->post_buf + i - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
*(uint8_t*)pack_buffer->post_buf = top0;
|
||||||
|
*((uint8_t*)pack_buffer->post_buf + 1)= top1;
|
||||||
|
pack_buffer->post_len = DSO_PACKET_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
for(int i = pack_buffer->post_len -1; i > 1; i -= 2){
|
else
|
||||||
*((uint8_t*)pack_buffer->post_buf + i) = *((uint8_t*)pack_buffer->post_buf + i - 2);
|
{
|
||||||
|
if(DSO_PACKET_LEN >post_data_len)
|
||||||
|
{
|
||||||
|
pack_buffer->post_len = packet_len;
|
||||||
|
post_data_len += packet_len;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
for(int i = pack_buffer->post_len -2; i > 0; i -= 2){
|
{
|
||||||
*((uint8_t*)pack_buffer->post_buf + i) = *((uint8_t*)pack_buffer->post_buf + i - 2);
|
bToEnd = 1;
|
||||||
|
instant = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(uint8_t*)pack_buffer->post_buf = top0;
|
|
||||||
*((uint8_t*)pack_buffer->post_buf + 1)= top1;
|
|
||||||
pack_buffer->post_len = DSO_PACKET_LEN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pack_buffer->post_len >= byte_align * chan_num)
|
if (pack_buffer->post_len >= byte_align * chan_num && !bToEnd)
|
||||||
{
|
{
|
||||||
packet.type = SR_DF_DSO;
|
packet.type = SR_DF_DSO;
|
||||||
packet.payload = &dso;
|
packet.payload = &dso;
|
||||||
@ -1942,20 +1996,17 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
dso.unit = SR_UNIT_VOLT;
|
dso.unit = SR_UNIT_VOLT;
|
||||||
dso.mqflags = SR_MQFLAG_AC;
|
dso.mqflags = SR_MQFLAG_AC;
|
||||||
dso.num_samples = pack_buffer->post_len / chan_num;
|
dso.num_samples = pack_buffer->post_len / chan_num;
|
||||||
dso.data = pack_buffer->post_buf;
|
if (instant)
|
||||||
|
dso.data = pack_buffer->post_buf+post_data_len;
|
||||||
|
else
|
||||||
|
dso.data = pack_buffer->post_buf;
|
||||||
|
|
||||||
delay_time();
|
delay_time();
|
||||||
g_timer_start(packet_interval);
|
g_timer_start(packet_interval);
|
||||||
// Send data back.
|
// Send data back.
|
||||||
ds_data_forward(sdi, &packet);
|
ds_data_forward(sdi, &packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(instant)
|
|
||||||
{
|
|
||||||
bToEnd = 1;
|
|
||||||
instant = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bToEnd || revents == -1)
|
if (bToEnd || revents == -1)
|
||||||
{
|
{
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
@ -1993,21 +2044,17 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
|
|||||||
|
|
||||||
if(load_data)
|
if(load_data)
|
||||||
{
|
{
|
||||||
void* analog_data = g_try_malloc0(ANALOG_DATA_LEN_PER_CYCLE);
|
if(sample_generator != PATTERN_RANDOM)
|
||||||
if(analog_data == NULL)
|
|
||||||
{
|
{
|
||||||
sr_err("%s:cant' malloc",__func__);
|
vdev->analog_buf_len = 0;
|
||||||
return SR_ERR_MALLOC;
|
|
||||||
}
|
void* analog_data = g_try_malloc0(ANALOG_DATA_LEN_PER_CYCLE);
|
||||||
if(sample_generator == PATTERN_RANDOM)
|
if(analog_data == NULL)
|
||||||
{
|
|
||||||
for(int i = 0 ; i < ANALOG_DATA_LEN_PER_CYCLE ;i++)
|
|
||||||
{
|
{
|
||||||
*(uint8_t*)(analog_data + i) = ANALOG_RANDOM_DATA;
|
sr_err("%s:analog_data malloc failed",__func__);
|
||||||
|
return SR_ERR_MALLOC;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf(file_name, sizeof(file_name)-1, "%s-%d/%d", "A",
|
snprintf(file_name, sizeof(file_name)-1, "%s-%d/%d", "A",
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
@ -2031,86 +2078,90 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
|
|||||||
send_error_packet(sdi, vdev, &packet);
|
send_error_packet(sdi, vdev, &packet);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t total_buf_len = ANALOG_CYCLE_RATIO * vdev->total_samples * ANALOG_PROBE_NUM;
|
uint64_t total_buf_len = ANALOG_CYCLE_RATIO * vdev->total_samples * ANALOG_PROBE_NUM;
|
||||||
if(total_buf_len % ANALOG_DATA_LEN_PER_CYCLE != 0)
|
if(total_buf_len % ANALOG_DATA_LEN_PER_CYCLE != 0)
|
||||||
{
|
|
||||||
total_buf_len = total_buf_len / ANALOG_DATA_LEN_PER_CYCLE * ANALOG_DATA_LEN_PER_CYCLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(vdev->analog_buf != NULL)
|
|
||||||
{
|
|
||||||
g_free(vdev->analog_buf);
|
|
||||||
vdev->analog_buf = NULL;
|
|
||||||
}
|
|
||||||
vdev->analog_buf = (g_try_malloc0(total_buf_len));
|
|
||||||
if (vdev->analog_buf == NULL)
|
|
||||||
{
|
|
||||||
return SR_ERR_MALLOC;
|
|
||||||
}
|
|
||||||
vdev->analog_buf_len = total_buf_len;
|
|
||||||
uint64_t per_block_after_expend = total_buf_len / ANALOG_DATA_LEN_PER_CYCLE;
|
|
||||||
|
|
||||||
probe = g_slist_nth(sdi->channels, 0)->data;
|
|
||||||
uint64_t p0_vdiv = probe->vdiv;
|
|
||||||
probe = g_slist_nth(sdi->channels, 1)->data;
|
|
||||||
uint64_t p1_vdiv = probe->vdiv;
|
|
||||||
uint64_t vdiv;
|
|
||||||
uint8_t val = 0;
|
|
||||||
uint16_t tem;
|
|
||||||
uint64_t cur_l = 0;
|
|
||||||
for(int i = 0 ; i < ANALOG_DATA_LEN_PER_CYCLE;i++)
|
|
||||||
{
|
|
||||||
if(i % 2 == 0)
|
|
||||||
vdiv = p0_vdiv;
|
|
||||||
else
|
|
||||||
vdiv = p1_vdiv;
|
|
||||||
tem = 0;
|
|
||||||
|
|
||||||
uint8_t temp_value = *((uint8_t*)analog_data + i);
|
|
||||||
|
|
||||||
if(temp_value > 128){
|
|
||||||
val = temp_value - 128;
|
|
||||||
tem = val * ANALOG_DEFAULT_VDIV / vdiv;
|
|
||||||
tem = 128 + tem;
|
|
||||||
if(tem >= 255)
|
|
||||||
temp_value = 255;
|
|
||||||
else
|
|
||||||
temp_value = tem;
|
|
||||||
}
|
|
||||||
else if(temp_value < 128 && temp_value != 0)
|
|
||||||
{
|
{
|
||||||
val = 128 - temp_value;
|
total_buf_len = total_buf_len / ANALOG_DATA_LEN_PER_CYCLE * ANALOG_DATA_LEN_PER_CYCLE;
|
||||||
tem = val * ANALOG_DEFAULT_VDIV / vdiv;
|
|
||||||
tem = 128 - tem;
|
|
||||||
if(tem == 0)
|
|
||||||
temp_value = 1;
|
|
||||||
else
|
|
||||||
temp_value = tem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int j = 0 ; j <per_block_after_expend ;j++)
|
if(vdev->analog_buf != NULL)
|
||||||
|
{
|
||||||
|
g_safe_free(vdev->analog_buf);
|
||||||
|
vdev->analog_buf = NULL;
|
||||||
|
}
|
||||||
|
vdev->analog_buf = (g_try_malloc0(total_buf_len));
|
||||||
|
if (vdev->analog_buf == NULL)
|
||||||
|
{
|
||||||
|
sr_err("%s: vdev->analog_buf malloc failed", __func__);
|
||||||
|
return SR_ERR_MALLOC;
|
||||||
|
}
|
||||||
|
vdev->analog_buf_len = total_buf_len;
|
||||||
|
uint64_t per_block_after_expend = total_buf_len / ANALOG_DATA_LEN_PER_CYCLE;
|
||||||
|
|
||||||
|
probe = g_slist_nth(sdi->channels, 0)->data;
|
||||||
|
uint64_t p0_vdiv = probe->vdiv;
|
||||||
|
probe = g_slist_nth(sdi->channels, 1)->data;
|
||||||
|
uint64_t p1_vdiv = probe->vdiv;
|
||||||
|
uint64_t vdiv;
|
||||||
|
uint8_t val = 0;
|
||||||
|
uint16_t tem;
|
||||||
|
uint64_t cur_l = 0;
|
||||||
|
for(int i = 0 ; i < ANALOG_DATA_LEN_PER_CYCLE;i++)
|
||||||
{
|
{
|
||||||
if(i % 2 == 0)
|
if(i % 2 == 0)
|
||||||
{
|
vdiv = p0_vdiv;
|
||||||
cur_l = i * per_block_after_expend + j * 2;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
vdiv = p1_vdiv;
|
||||||
cur_l = 1 + (i - 1) * per_block_after_expend + j * 2;
|
tem = 0;
|
||||||
|
|
||||||
|
uint8_t temp_value = *((uint8_t*)analog_data + i);
|
||||||
|
|
||||||
|
if(temp_value > ANALOG_MID_VAL){
|
||||||
|
val = temp_value - ANALOG_MID_VAL;
|
||||||
|
tem = val * ANALOG_DEFAULT_VDIV / vdiv;
|
||||||
|
if(tem >= ANALOG_MID_VAL)
|
||||||
|
temp_value = ANALOG_MIN_VAL;
|
||||||
|
else
|
||||||
|
temp_value = ANALOG_MID_VAL + tem;
|
||||||
|
}
|
||||||
|
else if(temp_value < ANALOG_MID_VAL)
|
||||||
|
{
|
||||||
|
val = ANALOG_MID_VAL - temp_value;
|
||||||
|
tem = val * ANALOG_DEFAULT_VDIV / vdiv;
|
||||||
|
|
||||||
|
if(tem >= ANALOG_MID_VAL)
|
||||||
|
temp_value = ANALOG_MAX_VAL;
|
||||||
|
else
|
||||||
|
temp_value = ANALOG_MID_VAL - tem;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int j = 0 ; j <per_block_after_expend ;j++)
|
||||||
|
{
|
||||||
|
if(i % 2 == 0)
|
||||||
|
{
|
||||||
|
cur_l = i * per_block_after_expend + j * 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cur_l = 1 + (i - 1) * per_block_after_expend + j * 2;
|
||||||
|
}
|
||||||
|
memset(vdev->analog_buf + cur_l,temp_value,1);
|
||||||
}
|
}
|
||||||
memset(vdev->analog_buf + cur_l,temp_value,1);
|
|
||||||
}
|
}
|
||||||
|
g_safe_free(analog_data);
|
||||||
}
|
}
|
||||||
g_safe_free(analog_data);
|
|
||||||
load_data = FALSE;
|
load_data = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* buf;
|
void* buf = g_try_malloc0(packet_len);
|
||||||
|
if(buf == NULL)
|
||||||
|
{
|
||||||
|
sr_err("%s: buf malloc failed", __func__);
|
||||||
|
return SR_ERR_MALLOC;
|
||||||
|
}
|
||||||
if(vdev->analog_read_pos + packet_len >= vdev->analog_buf_len - 1 )
|
if(vdev->analog_read_pos + packet_len >= vdev->analog_buf_len - 1 )
|
||||||
{
|
{
|
||||||
buf = g_try_malloc0(packet_len);
|
|
||||||
uint64_t back_len = vdev->analog_buf_len - vdev->analog_read_pos;
|
uint64_t back_len = vdev->analog_buf_len - vdev->analog_read_pos;
|
||||||
for (int i = 0; i < back_len; i++)
|
for (int i = 0; i < back_len; i++)
|
||||||
{
|
{
|
||||||
@ -2128,7 +2179,7 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buf = (uint8_t*) vdev->analog_buf + vdev->analog_read_pos;
|
memcpy(buf,vdev->analog_buf + vdev->analog_read_pos,packet_len);
|
||||||
vdev->analog_read_pos += packet_len;
|
vdev->analog_read_pos += packet_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2143,8 +2194,8 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
|
|||||||
analog.data = buf;
|
analog.data = buf;
|
||||||
|
|
||||||
delay_time();
|
delay_time();
|
||||||
|
|
||||||
ds_data_forward(sdi, &packet);
|
ds_data_forward(sdi, &packet);
|
||||||
|
g_safe_free(buf);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2441,7 +2492,7 @@ static int load_virtual_device_session(struct sr_dev_inst *sdi)
|
|||||||
|
|
||||||
g_strfreev(sections);
|
g_strfreev(sections);
|
||||||
g_key_file_free(kf);
|
g_key_file_free(kf);
|
||||||
g_free(metafile);
|
g_safe_free(metafile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
@ -261,10 +261,17 @@ static const uint64_t samplerates[] = {
|
|||||||
#define LOGIC_MIN_PACKET_LEN 8
|
#define LOGIC_MIN_PACKET_LEN 8
|
||||||
#define LOGIC_MIN_PACKET_NUM(n) (LOGIC_POST_DATA_PER_SECOND(n))/(LOGIC_MIN_PACKET_LEN)
|
#define LOGIC_MIN_PACKET_NUM(n) (LOGIC_POST_DATA_PER_SECOND(n))/(LOGIC_MIN_PACKET_LEN)
|
||||||
#define LOGIC_MIN_PACKET_TIME(n) ((SEC)/(gdouble)(LOGIC_MIN_PACKET_NUM(n)))
|
#define LOGIC_MIN_PACKET_TIME(n) ((SEC)/(gdouble)(LOGIC_MIN_PACKET_NUM(n)))
|
||||||
|
#define LOGIC_MAX_PACKET_LEN 62500
|
||||||
|
#define LOGIC_MAX_PACKET_NUM(n) (LOGIC_POST_DATA_PER_SECOND(n))/(LOGIC_MAX_PACKET_LEN)
|
||||||
|
#define LOGIC_MAX_PACKET_TIME(n) ((SEC)/(gdouble)(LOGIC_MAX_PACKET_NUM(n)))
|
||||||
|
#define LOGIC_BUF_LEN SR_MB(1)
|
||||||
|
|
||||||
#define DSO_PACKET_NUM_PER_SEC (gdouble)100
|
|
||||||
|
#define DSO_PACKET_NUM_PER_SEC (gdouble)200
|
||||||
#define DSO_PACKET_TIME ((SEC)/(DSO_PACKET_NUM_PER_SEC))
|
#define DSO_PACKET_TIME ((SEC)/(DSO_PACKET_NUM_PER_SEC))
|
||||||
#define DSO_PACKET_LEN 20000
|
#define DSO_PACKET_LEN 20000
|
||||||
|
#define DSO_RANDOM_DATA rand()%120 +68
|
||||||
|
#define DSO_BUF_LEN SR_MB(1)
|
||||||
|
|
||||||
#define ANALOG_PROBE_NUM 2
|
#define ANALOG_PROBE_NUM 2
|
||||||
#define ANALOG_PACKET_NUM_PER_SEC 200
|
#define ANALOG_PACKET_NUM_PER_SEC 200
|
||||||
@ -275,19 +282,31 @@ static const uint64_t samplerates[] = {
|
|||||||
#define ANALOG_MIN_PACKET_NUM(n) ((ANALOG_POST_DATA_PER_SECOND(n))/(ANALOG_MIN_PACKET_LEN))
|
#define ANALOG_MIN_PACKET_NUM(n) ((ANALOG_POST_DATA_PER_SECOND(n))/(ANALOG_MIN_PACKET_LEN))
|
||||||
#define ANALOG_PACKET_ALIGN 2
|
#define ANALOG_PACKET_ALIGN 2
|
||||||
|
|
||||||
#define LOGIC_MAX_PROBE_NUM 16
|
|
||||||
|
|
||||||
#define LOGIC_HIGH_LEVEL 255
|
|
||||||
#define LOGIC_LOW_LEVEL 0
|
|
||||||
#define LOGIC_HW_DEPTH (SR_MHZ(100))
|
#define LOGIC_HW_DEPTH (SR_MHZ(100))
|
||||||
|
|
||||||
|
|
||||||
#define ANALOG_CYCLE_RATIO ((gdouble)(103) / (gdouble)(2048))
|
#define LOGIC_MAX_PROBE_NUM 16
|
||||||
|
#define LOGIC_HIGH_LEVEL 255
|
||||||
|
#define LOGIC_LOW_LEVEL 0
|
||||||
|
|
||||||
|
|
||||||
|
#define DSO_DEFAULT_VDIV 1000
|
||||||
|
#define DSO_MID_VAL 128
|
||||||
|
#define DSO_MAX_VAL 0
|
||||||
|
#define DSO_MIN_VAL 255
|
||||||
|
|
||||||
|
|
||||||
#define ANALOG_HW_DEPTH (SR_MHZ(12.5))
|
#define ANALOG_HW_DEPTH (SR_MHZ(12.5))
|
||||||
#define ANALOG_DATA_LEN_PER_CYCLE 206
|
|
||||||
#define ANALOG_RANDOM_DATA rand()%40 +110
|
|
||||||
#define ANALOG_PROBE_NUM 2
|
|
||||||
#define ANALOG_DEFAULT_VDIV 1000
|
#define ANALOG_DEFAULT_VDIV 1000
|
||||||
|
#define ANALOG_MID_VAL 128
|
||||||
|
#define ANALOG_MAX_VAL 0
|
||||||
|
#define ANALOG_MIN_VAL 255
|
||||||
|
|
||||||
|
#define ANALOG_CYCLE_RATIO ((gdouble)(103) / (gdouble)(2048))
|
||||||
|
#define ANALOG_DATA_LEN_PER_CYCLE 206
|
||||||
|
#define ANALOG_RANDOM_DATA rand()%120 +68
|
||||||
|
#define ANALOG_PROBE_NUM 2
|
||||||
|
|
||||||
#define ANALOG_RETE(n) ((n/SR_HZ(10)))
|
#define ANALOG_RETE(n) ((n/SR_HZ(10)))
|
||||||
|
|
||||||
|
|
||||||
@ -455,27 +474,33 @@ static const int ranx[] = {
|
|||||||
-41, 36, -8, 46, 47, -34, 28, -39, 7, -32, 38, -27, 28, -3, -8, 43, -37, -24, 6, 3,
|
-41, 36, -8, 46, 47, -34, 28, -39, 7, -32, 38, -27, 28, -3, -8, 43, -37, -24, 6, 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int delay_time();
|
static void init_analog_random_data(struct session_vdev * vdev);
|
||||||
|
|
||||||
static int get_last_packet_len(struct sr_datafeed_logic *logic,const struct session_vdev * vdev);
|
static void delay_time();
|
||||||
|
|
||||||
static int reset_enabled_probe_num(struct sr_dev_inst *sdi);
|
static void get_last_packet_len(struct sr_datafeed_logic *logic,const struct session_vdev * vdev);
|
||||||
|
|
||||||
|
static void reset_enabled_probe_num(struct sr_dev_inst *sdi);
|
||||||
|
|
||||||
|
static void init_pattern_mode_list();
|
||||||
|
|
||||||
static int get_bit(uint64_t timebase);
|
static int get_bit(uint64_t timebase);
|
||||||
|
|
||||||
static int reset_dsl_path(struct sr_dev_inst *sdi,uint8_t device_mode ,uint8_t pattern_mode);
|
|
||||||
|
|
||||||
static int get_pattern_mode_index_by_string(uint8_t device_mode , const char* str);
|
static int get_pattern_mode_index_by_string(uint8_t device_mode , const char* str);
|
||||||
|
|
||||||
static int get_pattern_mode_from_file(uint8_t device_mode);
|
static void get_pattern_mode_from_file(uint8_t device_mode);
|
||||||
|
|
||||||
static int init_pattern_mode_list();
|
static void scan_dsl_file(struct sr_dev_inst *sdi);
|
||||||
|
|
||||||
static int scan_dsl_file(struct sr_dev_inst *sdi);
|
static int reset_dsl_path(struct sr_dev_inst *sdi,uint8_t device_mode ,uint8_t pattern_mode);
|
||||||
|
|
||||||
static void adjust_samplerate(struct sr_dev_inst *sdi);
|
static void adjust_samplerate(struct sr_dev_inst *sdi);
|
||||||
|
|
||||||
static int init_random_data(struct session_vdev * vdev,struct sr_dev_inst *sdi);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void init_random_data(struct session_vdev * vdev,struct sr_dev_inst *sdi);
|
||||||
|
|
||||||
static int hw_init(struct sr_context *sr_ctx);
|
static int hw_init(struct sr_context *sr_ctx);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user