mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-02-02 13:52:55 +08:00
Merge pull request #626 from yunyaobaihong/demo
demo:pattern mode load data
This commit is contained in:
commit
a692cd36b9
@ -610,6 +610,9 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
|
|||||||
vdev->logic_buf = NULL;
|
vdev->logic_buf = NULL;
|
||||||
sdi->status = SR_ST_ACTIVE;
|
sdi->status = SR_ST_ACTIVE;
|
||||||
|
|
||||||
|
ch_mode = DEMO_LOGIC125x16;
|
||||||
|
logic_index = LOGIC125x16;
|
||||||
|
|
||||||
if(vdev->logic_buf != NULL)
|
if(vdev->logic_buf != NULL)
|
||||||
{
|
{
|
||||||
g_safe_free(vdev->logic_buf);
|
g_safe_free(vdev->logic_buf);
|
||||||
@ -904,11 +907,29 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
|||||||
break;
|
break;
|
||||||
case SR_CONF_PATTERN_MODE:
|
case SR_CONF_PATTERN_MODE:
|
||||||
stropt = g_variant_get_string(data, NULL);
|
stropt = g_variant_get_string(data, NULL);
|
||||||
|
uint8_t tmp_sample_generator = sample_generator;
|
||||||
sample_generator = get_pattern_mode_index_by_string(sdi->mode , stropt);
|
sample_generator = get_pattern_mode_index_by_string(sdi->mode , stropt);
|
||||||
if(SR_OK != reset_dsl_path(sdi,sdi->mode,sample_generator))
|
if(SR_OK != reset_dsl_path(sdi,sdi->mode,sample_generator))
|
||||||
{
|
{
|
||||||
sample_generator = PATTERN_RANDOM;
|
sample_generator = PATTERN_RANDOM;
|
||||||
}
|
}
|
||||||
|
if(sdi->mode == LOGIC)
|
||||||
|
{
|
||||||
|
if(sample_generator == PATTERN_RANDOM)
|
||||||
|
{
|
||||||
|
if(!channel_mode_change && tmp_sample_generator != sample_generator)
|
||||||
|
{
|
||||||
|
ch_mode = DEMO_LOGIC125x16;
|
||||||
|
logic_index = LOGIC125x16;
|
||||||
|
load_virtual_device_session(sdi);
|
||||||
|
}
|
||||||
|
channel_mode_change = FALSE;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
load_virtual_device_session(sdi);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
sr_dbg("%s: setting pattern to %d",
|
sr_dbg("%s: setting pattern to %d",
|
||||||
__func__, sample_generator);
|
__func__, sample_generator);
|
||||||
break;
|
break;
|
||||||
@ -1054,8 +1075,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
|||||||
{
|
{
|
||||||
logic_index = i;
|
logic_index = i;
|
||||||
ch_mode = nv;
|
ch_mode = nv;
|
||||||
logic_adjust_probe(sdi,logic_channel_modes[i].num);
|
load_virtual_device_session(sdi);
|
||||||
logic_adjust_samplerate(vdev);
|
channel_mode_change = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2611,10 +2632,10 @@ static int load_virtual_device_session(struct sr_dev_inst *sdi)
|
|||||||
{
|
{
|
||||||
vdev->samplerate = LOGIC_DEFAULT_SAMPLERATE;
|
vdev->samplerate = LOGIC_DEFAULT_SAMPLERATE;
|
||||||
vdev->total_samples = LOGIC_DEFAULT_TOTAL_SAMPLES;
|
vdev->total_samples = LOGIC_DEFAULT_TOTAL_SAMPLES;
|
||||||
vdev->num_probes = LOGIC_DEFAULT_NUM_PROBE;
|
vdev->num_probes = logic_channel_modes[logic_index].num;
|
||||||
sr_dev_probes_free(sdi);
|
sr_dev_probes_free(sdi);
|
||||||
|
|
||||||
for (int i = 0; i < LOGIC_DEFAULT_NUM_PROBE; i++)
|
for (int i = 0; i < vdev->num_probes; i++)
|
||||||
{
|
{
|
||||||
probe_name = probe_names[i];
|
probe_name = probe_names[i];
|
||||||
if (!(probe = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, probe_name)))
|
if (!(probe = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, probe_name)))
|
||||||
@ -2625,9 +2646,6 @@ static int load_virtual_device_session(struct sr_dev_inst *sdi)
|
|||||||
}
|
}
|
||||||
sdi->channels = g_slist_append(sdi->channels, probe);
|
sdi->channels = g_slist_append(sdi->channels, probe);
|
||||||
}
|
}
|
||||||
//updata
|
|
||||||
ch_mode = DEMO_LOGIC125x16;
|
|
||||||
logic_index = LOGIC125x16;
|
|
||||||
logic_adjust_samplerate(sdi->priv);
|
logic_adjust_samplerate(sdi->priv);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -81,9 +81,10 @@ static uint64_t total_num = 0;
|
|||||||
static uint64_t logci_cur_packet_num = 0;
|
static uint64_t logci_cur_packet_num = 0;
|
||||||
static uint64_t logic_total_packet_num = 0;
|
static uint64_t logic_total_packet_num = 0;
|
||||||
static uint8_t logic_data_status = 0;
|
static uint8_t logic_data_status = 0;
|
||||||
|
static gboolean channel_mode_change = FALSE;
|
||||||
|
|
||||||
static enum DEMO_LOGIC_CHANNEL_ID ch_mode = DEMO_LOGIC125x16;
|
static enum DEMO_LOGIC_CHANNEL_ID ch_mode;
|
||||||
static enum DEMO_LOGIC_CHANNEL_INDEX logic_index = LOGIC125x16;
|
static enum DEMO_LOGIC_CHANNEL_INDEX logic_index;
|
||||||
|
|
||||||
struct session_packet_buffer;
|
struct session_packet_buffer;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user