demo : repair dso single

This commit is contained in:
yunyaobaihong 2023-05-16 16:31:41 +08:00
parent fd706b63bc
commit e505135e65
3 changed files with 263 additions and 190 deletions

View File

@ -1273,7 +1273,7 @@ namespace pv
bool is_rand = rand_mode == "random";
_action_loop->setVisible(is_rand);
if (!is_rand){
if (!is_rand && mode == LOGIC){
_sample_rate.setEnabled(false);
_sample_count.setEnabled(false);
}

View File

@ -49,10 +49,11 @@
#define BUFSIZE 512*1024
#define DSO_BUFSIZE 10*1024
static struct DEMO_channels channel_modes_f[] = {
static struct DEMO_channels channel_modes[] = {
// LA Stream
{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)"},
//updata
// DAQ
{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;
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 waittime = packet_time - packet_elapsed;
@ -81,22 +106,18 @@ static int delay_time()
{
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);
int last_packet_len = post_data_len - (logic->length / enabled_probe_num);
last_packet_len = (vdev->total_samples/8) - last_packet_len;
logic->length = last_packet_len * enabled_probe_num;
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;
enabled_probe_num = 0;
@ -108,11 +129,9 @@ static int reset_enabled_probe_num(struct sr_dev_inst *sdi)
enabled_probe_num++;
}
}
return SR_OK;
}
static int init_pattern_mode_list()
static void init_pattern_mode_list()
{
int i;
if(pattern_logic_count != 1)
@ -121,7 +140,7 @@ static int init_pattern_mode_list()
{
if(pattern_strings_logic[i] != NULL)
{
g_free(pattern_strings_logic[i]);
g_safe_free(pattern_strings_logic[i]);
pattern_strings_logic[i] =NULL;
}
}
@ -132,7 +151,7 @@ static int init_pattern_mode_list()
{
if(pattern_strings_dso[i] != NULL)
{
g_free(pattern_strings_dso[i]);
g_safe_free(pattern_strings_dso[i]);
pattern_strings_dso[i] =NULL;
}
}
@ -143,7 +162,7 @@ static int init_pattern_mode_list()
{
if(pattern_strings_analog[i] != NULL)
{
g_free(pattern_strings_analog[i]);
g_safe_free(pattern_strings_analog[i]);
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;
}
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;
char dir_str[500];
@ -253,7 +272,7 @@ static int get_pattern_mode_from_file(uint8_t device_mode)
pattern_analog_count = index;
}
static int scan_dsl_file(struct sr_dev_inst *sdi)
static void scan_dsl_file(struct sr_dev_inst *sdi)
{
init_pattern_mode_list();
@ -363,12 +382,12 @@ static void adjust_samplerate(struct sr_dev_inst *sdi)
vdev->samplerates_max_index = ARRAY_SIZE(samplerates) - 1;
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_min_index = 0;
while (samplerates[vdev->samplerates_min_index] <
channel_modes_f[cur_mode].min_samplerate)
channel_modes[cur_mode].min_samplerate)
vdev->samplerates_min_index++;
assert(vdev->samplerates_max_index >= vdev->samplerates_min_index);
@ -381,18 +400,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 probe_count[LOGIC_MAX_PROBE_NUM] = {0};
uint8_t probe_status[LOGIC_MAX_PROBE_NUM] = {LOGIC_HIGH_LEVEL};
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++)
{
@ -456,7 +471,7 @@ static GSList *hw_scan(GSList *options)
supported_Demo[0].model,
supported_Demo[0].model_version);
if (!sdi) {
g_free(vdev);
g_safe_free(vdev);
sr_err("Device instance creation failed.");
return NULL;
}
@ -532,12 +547,15 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
{
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;
}
init_analog_random_data(vdev);
vdev->logic_buf_len = SR_MB(1);
vdev->logic_buf_len = LOGIC_BUF_LEN;
packet_interval = g_timer_new();
run_time = g_timer_new();
@ -569,7 +587,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
for (i = 0; i < SESSION_MAX_CHANNEL_COUNT; i++){
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;
}
else{
@ -1101,6 +1119,7 @@ static int hw_dev_acquisition_start(struct sr_dev_inst *sdi,
packet_time = LOGIC_MIN_PACKET_TIME(vdev->samplerate);
}
if(sample_generator == PATTERN_RANDOM)
{
init_random_data(vdev,sdi);
@ -1114,9 +1133,21 @@ static int hw_dev_acquisition_start(struct sr_dev_inst *sdi,
else if(sdi->mode == DSO)
{
vdiv_change = TRUE;
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);
total_num = 0;
sr_session_source_add(-1, 0, 0, receive_data_dso, sdi);
}
else if(sdi->mode == ANALOG)
@ -1137,9 +1168,10 @@ static int hw_dev_acquisition_start(struct sr_dev_inst *sdi,
}
packet_time = ANALOG_PACKET_TIME(ANALOG_PACKET_NUM_PER_SEC);
}
if(sample_generator != PATTERN_RANDOM)
vdev->analog_buf_len = 0;
vdev->analog_read_pos = 0;
sr_session_source_add(-1, 0, 0, receive_data_analog, sdi);
}
@ -1240,8 +1272,8 @@ static int receive_data_logic(int fd, int revents, const struct sr_dev_inst *sdi
int index = enabled_probe_num * 8;
random = floor(random/index)*index;
logic.data = vdev->logic_buf + random;
delay_time();
ds_data_forward(sdi, &packet);
delay_time();
}
if (bToEnd || revents == -1)
@ -1348,7 +1380,7 @@ static int receive_data_logic_decoder(int fd, int revents, const struct sr_dev_i
{
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_read_positions[ch_index] = 0;
@ -1430,7 +1462,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++){
// Release the old buffer.
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;
}
@ -1515,6 +1547,7 @@ static int receive_data_logic_decoder(int fd, int revents, const struct sr_dev_i
delay_time();
ds_data_forward(sdi, &packet);
pack_buffer->post_len = 0;
}
@ -1636,7 +1669,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;
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);
if (pack_buffer->post_buf == NULL)
@ -1654,7 +1687,7 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
{
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_read_positions[ch_index] = 0;
@ -1676,7 +1709,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++)
{
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
*(uint8_t*)(pack_buffer->post_buf + i) = *(uint8_t*)(pack_buffer->post_buf + i -1);
}
@ -1736,7 +1769,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++){
// Release the old buffer.
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;
}
@ -1818,6 +1851,11 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
if(sample_generator!= PATTERN_RANDOM)
{
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++)
{
if(i%2 == 0)
@ -1843,7 +1881,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);
}
g_free(tmp_buf);
g_safe_free(tmp_buf);
}
for(int i = 0 ; i < pack_buffer->post_buf_len; i++)
@ -1863,26 +1901,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);
if(temp_val>128)
if(temp_val > DSO_MID_VAL)
{
val = temp_val - 128;
tem = val * 1000 / vdiv;
tem = 128 + tem;
if(tem >= 255)
temp_val = 255;
val = temp_val - DSO_MID_VAL;
tem = val * DSO_DEFAULT_VDIV / vdiv;
if(tem >= DSO_MID_VAL)
temp_val = DSO_MIN_VAL;
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;
tem = val * 1000 / vdiv;
tem = 128 - tem;
val = DSO_MID_VAL - temp_val;
tem = val * DSO_DEFAULT_VDIV / vdiv;
if(tem == 0)
temp_val = 1;
if(tem >= DSO_MID_VAL)
temp_val = DSO_MAX_VAL;
else
temp_val = tem;
temp_val = DSO_MID_VAL - tem;
}
*((uint8_t*)pack_buffer->post_buf + i) = temp_val;
}
@ -1894,7 +1930,9 @@ 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_elapsed = g_timer_elapsed(run_time, NULL);
if (total_time_elapsed < total_time&&!instant)
if(!instant)
{
if (total_time_elapsed < total_time)
{
gdouble percent = total_time_elapsed / total_time;
int buf_len = percent* DSO_PACKET_LEN;
@ -1917,7 +1955,6 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
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);
}
@ -1931,7 +1968,22 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
pack_buffer->post_len = DSO_PACKET_LEN;
}
if (pack_buffer->post_len >= byte_align * chan_num)
}
else
{
if(DSO_PACKET_LEN >post_data_len)
{
pack_buffer->post_len = packet_len;
post_data_len += packet_len;
}
else
{
bToEnd = 1;
instant = FALSE;
}
}
if (pack_buffer->post_len >= byte_align * chan_num && !bToEnd)
{
packet.type = SR_DF_DSO;
packet.payload = &dso;
@ -1940,6 +1992,9 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
dso.unit = SR_UNIT_VOLT;
dso.mqflags = SR_MQFLAG_AC;
dso.num_samples = pack_buffer->post_len / chan_num;
if (instant)
dso.data = pack_buffer->post_buf+post_data_len;
else
dso.data = pack_buffer->post_buf;
delay_time();
@ -1948,12 +2003,6 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
ds_data_forward(sdi, &packet);
}
if(instant)
{
bToEnd = 1;
instant = FALSE;
}
if (bToEnd || revents == -1)
{
packet.type = SR_DF_END;
@ -1990,22 +2039,16 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
g_timer_start(packet_interval);
if(load_data)
{
if(sample_generator != PATTERN_RANDOM)
{
void* analog_data = g_try_malloc0(ANALOG_DATA_LEN_PER_CYCLE);
if(analog_data == NULL)
{
sr_err("%s:cant' malloc",__func__);
sr_err("%s:analog_data malloc failed",__func__);
return SR_ERR_MALLOC;
}
if(sample_generator == PATTERN_RANDOM)
{
for(int i = 0 ; i < ANALOG_DATA_LEN_PER_CYCLE ;i++)
{
*(uint8_t*)(analog_data + i) = ANALOG_RANDOM_DATA;
}
}
else
{
snprintf(file_name, sizeof(file_name)-1, "%s-%d/%d", "A",
0, 0);
@ -2029,7 +2072,6 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
send_error_packet(sdi, vdev, &packet);
return FALSE;
}
}
uint64_t total_buf_len = ANALOG_CYCLE_RATIO * vdev->total_samples * ANALOG_PROBE_NUM;
if(total_buf_len % ANALOG_DATA_LEN_PER_CYCLE != 0)
@ -2039,12 +2081,13 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
if(vdev->analog_buf != NULL)
{
g_free(vdev->analog_buf);
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;
@ -2068,24 +2111,23 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
uint8_t temp_value = *((uint8_t*)analog_data + i);
if(temp_value > 128){
val = temp_value - 128;
if(temp_value > ANALOG_MID_VAL){
val = temp_value - ANALOG_MID_VAL;
tem = val * ANALOG_DEFAULT_VDIV / vdiv;
tem = 128 + tem;
if(tem >= 255)
temp_value = 255;
if(tem >= ANALOG_MID_VAL)
temp_value = ANALOG_MIN_VAL;
else
temp_value = tem;
temp_value = ANALOG_MID_VAL + tem;
}
else if(temp_value < 128 && temp_value != 0)
else if(temp_value < ANALOG_MID_VAL)
{
val = 128 - temp_value;
val = ANALOG_MID_VAL - temp_value;
tem = val * ANALOG_DEFAULT_VDIV / vdiv;
tem = 128 - tem;
if(tem == 0)
temp_value = 1;
if(tem >= ANALOG_MID_VAL)
temp_value = ANALOG_MAX_VAL;
else
temp_value = tem;
temp_value = ANALOG_MID_VAL - tem;
}
for(int j = 0 ; j <per_block_after_expend ;j++)
@ -2102,13 +2144,19 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
}
}
g_safe_free(analog_data);
}
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 )
{
buf = g_try_malloc0(packet_len);
//用memcpy估计会更好
uint64_t back_len = vdev->analog_buf_len - vdev->analog_read_pos;
for (int i = 0; i < back_len; i++)
{
@ -2126,7 +2174,7 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
}
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;
}
@ -2141,8 +2189,8 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
analog.data = buf;
delay_time();
ds_data_forward(sdi, &packet);
g_safe_free(buf);
return TRUE;
}
@ -2439,7 +2487,7 @@ static int load_virtual_device_session(struct sr_dev_inst *sdi)
g_strfreev(sections);
g_key_file_free(kf);
g_free(metafile);
g_safe_free(metafile);
}
return SR_OK;

View File

@ -261,10 +261,17 @@ static const uint64_t samplerates[] = {
#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_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_LEN 20000
#define DSO_RANDOM_DATA rand()%120 +68
#define DSO_BUF_LEN SR_MB(1)
#define ANALOG_PROBE_NUM 2
#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_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 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_DATA_LEN_PER_CYCLE 206
#define ANALOG_RANDOM_DATA rand()%40 +110
#define ANALOG_PROBE_NUM 2
#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)))
@ -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,
};
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 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_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 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);