@@ -39,7 +39,7 @@ static const char *hameg_scpi_dialect[] = {
39
39
[SCPI_CMD_SET_COUPLING ] = ":CHAN%d:COUP %s" ,
40
40
[SCPI_CMD_GET_SAMPLE_RATE ] = ":ACQ:SRAT?" ,
41
41
[SCPI_CMD_GET_ANALOG_DATA ] = ":FORM:BORD %s;" \
42
- ":FORM REAL,32;:CHAN%d:DATA?" ,
42
+ ":FORM REAL,32;:CHAN%d:DATA:POIN MAX;:CHAN%d:DATA ?" ,
43
43
[SCPI_CMD_GET_VERTICAL_SCALE ] = ":CHAN%d:SCAL?" ,
44
44
[SCPI_CMD_SET_VERTICAL_SCALE ] = ":CHAN%d:SCAL %s" ,
45
45
[SCPI_CMD_GET_DIG_POD_STATE ] = ":POD%d:STAT?" ,
@@ -81,7 +81,7 @@ static const char *rohde_schwarz_log_not_pod_scpi_dialect[] = {
81
81
[SCPI_CMD_SET_COUPLING ] = ":CHAN%d:COUP %s" ,
82
82
[SCPI_CMD_GET_SAMPLE_RATE ] = ":ACQ:SRAT?" ,
83
83
[SCPI_CMD_GET_ANALOG_DATA ] = ":FORM:BORD %s;" \
84
- ":FORM REAL,32;:CHAN%d:DATA?" ,
84
+ ":FORM REAL,32;:CHAN%d:DATA:POIN MAX;:CHAN%d:DATA ?" ,
85
85
[SCPI_CMD_GET_VERTICAL_SCALE ] = ":CHAN%d:SCAL?" ,
86
86
[SCPI_CMD_SET_VERTICAL_SCALE ] = ":CHAN%d:SCAL %s" ,
87
87
[SCPI_CMD_GET_DIG_POD_STATE ] = ":LOG%d:STAT?" ,
@@ -612,6 +612,9 @@ static struct scope_config scope_models[] = {
612
612
.num_ydivs = 8 ,
613
613
614
614
.scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
615
+
616
+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
617
+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT ,
615
618
},
616
619
{
617
620
.name = {"RTB2004" , NULL },
@@ -652,6 +655,9 @@ static struct scope_config scope_models[] = {
652
655
.num_ydivs = 8 ,
653
656
654
657
.scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
658
+
659
+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
660
+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT ,
655
661
},
656
662
{
657
663
.name = {"RTM3002" , NULL },
@@ -692,6 +698,9 @@ static struct scope_config scope_models[] = {
692
698
.num_ydivs = 8 ,
693
699
694
700
.scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
701
+
702
+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
703
+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT ,
695
704
},
696
705
{
697
706
.name = {"RTM3004" , NULL },
@@ -732,6 +741,9 @@ static struct scope_config scope_models[] = {
732
741
.num_ydivs = 8 ,
733
742
734
743
.scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
744
+
745
+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
746
+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT ,
735
747
},
736
748
{
737
749
.name = {"RTA4004" , NULL },
@@ -772,6 +784,9 @@ static struct scope_config scope_models[] = {
772
784
.num_ydivs = 8 ,
773
785
774
786
.scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
787
+
788
+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
789
+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT ,
775
790
},
776
791
{
777
792
.name = {"RTH1002" , NULL },
@@ -812,6 +827,10 @@ static struct scope_config scope_models[] = {
812
827
.num_ydivs = 8 ,
813
828
814
829
.scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
830
+
831
+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
832
+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT
833
+ | INTERN_NO_POD_STATE_SET_SUPPORT ,
815
834
},
816
835
{
817
836
.name = {"RTH1004" , NULL },
@@ -852,6 +871,10 @@ static struct scope_config scope_models[] = {
852
871
.num_ydivs = 8 ,
853
872
854
873
.scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
874
+
875
+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
876
+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT
877
+ | INTERN_NO_POD_STATE_SET_SUPPORT ,
855
878
},
856
879
};
857
880
@@ -871,8 +894,19 @@ static void scope_state_dump(const struct scope_config *config,
871
894
}
872
895
873
896
for (i = 0 ; i < config -> digital_channels ; i ++ ) {
874
- sr_info ("State of digital channel %d -> %s" , i ,
875
- state -> digital_channels [i ] ? "On" : "Off" );
897
+ if (!(config -> internal_flags & INTERN_NO_LOGIC_STATE_GET_SUPPORT ))
898
+ {
899
+ sr_info ("State of digital channel %d -> %s" , i ,
900
+ state -> digital_channels [i ] ? "On" : "Off" );
901
+ }
902
+ else if (!(config -> internal_flags & INTERN_NO_POD_STATE_GET_SUPPORT ))
903
+ {
904
+ sr_info ("State of digital channel %d -> %s" , i ,
905
+ state -> digital_pods [i / DIGITAL_CHANNELS_PER_POD ].state ? "On" : "Off" );
906
+ }
907
+ else {
908
+ sr_info ("State of digital channel %d -> On" , i );
909
+ }
876
910
}
877
911
878
912
for (i = 0 ; i < config -> digital_pods ; i ++ ) {
@@ -1058,13 +1092,27 @@ static int digital_channel_state_get(struct sr_dev_inst *sdi,
1058
1092
struct sr_scpi_dev_inst * scpi = sdi -> conn ;
1059
1093
1060
1094
for (i = 0 ; i < config -> digital_channels ; i ++ ) {
1061
- g_snprintf (command , sizeof (command ),
1062
- (* config -> scpi_dialect )[SCPI_CMD_GET_DIG_CHAN_STATE ],
1063
- i );
1095
+ if (!(config -> internal_flags & INTERN_NO_LOGIC_STATE_GET_SUPPORT )) {
1096
+ g_snprintf (command , sizeof (command ),
1097
+ (* config -> scpi_dialect )[SCPI_CMD_GET_DIG_CHAN_STATE ],
1098
+ i );
1064
1099
1065
- if (sr_scpi_get_bool (scpi , command ,
1066
- & state -> digital_channels [i ]) != SR_OK )
1067
- return SR_ERR ;
1100
+ if (sr_scpi_get_bool (scpi , command ,
1101
+ & state -> digital_channels [i ]) != SR_OK )
1102
+ return SR_ERR ;
1103
+ }
1104
+ else if (!(config -> internal_flags & INTERN_NO_POD_STATE_GET_SUPPORT )) {
1105
+ g_snprintf (command , sizeof (command ),
1106
+ (* config -> scpi_dialect )[SCPI_CMD_GET_DIG_POD_STATE ],
1107
+ i / DIGITAL_CHANNELS_PER_POD );
1108
+
1109
+ if (sr_scpi_get_bool (scpi , command ,
1110
+ & state -> digital_channels [i ]) != SR_OK )
1111
+ return SR_ERR ;
1112
+ }
1113
+ else {
1114
+ state -> digital_channels [i ] = TRUE;
1115
+ }
1068
1116
1069
1117
ch = get_channel_by_index_and_type (sdi -> channels , i , SR_CHANNEL_LOGIC );
1070
1118
if (ch )
@@ -1518,13 +1566,13 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
1518
1566
1519
1567
packet .type = SR_DF_ANALOG ;
1520
1568
1569
+ sr_analog_init (& analog , & encoding , & meaning , & spec , 2 );
1521
1570
analog .data = data -> data ;
1522
1571
analog .num_samples = data -> len / sizeof (float );
1523
1572
/* Truncate acquisition if a smaller number of samples has been requested. */
1524
1573
if (devc -> samples_limit > 0 && analog .num_samples > devc -> samples_limit )
1525
1574
analog .num_samples = devc -> samples_limit ;
1526
1575
/* TODO: Use proper 'digits' value for this device (and its modes). */
1527
- sr_analog_init (& analog , & encoding , & meaning , & spec , 2 );
1528
1576
encoding .is_signed = TRUE;
1529
1577
if (state -> analog_channels [ch -> index ].probe_unit == 'V' ) {
1530
1578
meaning .mq = SR_MQ_VOLTAGE ;
@@ -1536,7 +1584,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
1536
1584
meaning .channels = g_slist_append (NULL , ch );
1537
1585
packet .payload = & analog ;
1538
1586
sr_session_send (sdi , & packet );
1539
- devc -> num_samples = data -> len / sizeof ( float ) ;
1587
+ devc -> num_samples += analog . num_samples ;
1540
1588
g_slist_free (meaning .channels );
1541
1589
g_byte_array_free (data , TRUE);
1542
1590
data = NULL ;
@@ -1613,7 +1661,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
1613
1661
* number of frames or after the specified number of samples, or
1614
1662
* continue reception by starting over at the first enabled channel.
1615
1663
*/
1616
- if (++ devc -> num_frames >= devc -> frame_limit || devc -> num_samples >= devc -> samples_limit ) {
1664
+ if (( devc -> frame_limit && ++ devc -> num_frames >= devc -> frame_limit ) || devc -> num_samples >= devc -> samples_limit ) {
1617
1665
sr_dev_acquisition_stop (sdi );
1618
1666
hmo_cleanup_logic_data (devc );
1619
1667
} else {
0 commit comments