X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fchronovu-la%2Fprotocol.c;h=c2f31a2032a9f6467e99988c67d261f9c7b94ac3;hb=HEAD;hp=a4689fa3b2140cd5a2a8e05fa29efe112fb300a1;hpb=9e9dba7b41bdd87d4ce442bc9bf6507518e97000;p=libsigrok.git diff --git a/src/hardware/chronovu-la/protocol.c b/src/hardware/chronovu-la/protocol.c index a4689fa3..ae8f427a 100644 --- a/src/hardware/chronovu-la/protocol.c +++ b/src/hardware/chronovu-la/protocol.c @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ #include @@ -203,7 +202,7 @@ static int close_usb_reset_sequencer(struct dev_context *devc) sr_dbg("Purging buffers, resetting+closing FTDI device."); /* Log errors, but ignore them (i.e., don't abort). */ - if ((ret = ftdi_usb_purge_buffers(devc->ftdic)) < 0) + if ((ret = PURGE_FTDI_BOTH(devc->ftdic)) < 0) sr_err("Failed to purge FTDI buffers (%d): %s.", ret, ftdi_get_error_string(devc->ftdic)); if ((ret = ftdi_usb_reset(devc->ftdic)) < 0) @@ -301,6 +300,11 @@ SR_PRIV int cv_convert_trigger(const struct sr_dev_inst *sdi) || match->match == SR_TRIGGER_RISING) devc->trigger_pattern |= channel_bit; + /* LA8 and LA16 support state triggering. */ + if (match->match == SR_TRIGGER_ONE + || match->match == SR_TRIGGER_ZERO) + devc->trigger_mask |= channel_bit; + /* LA16 (but not LA8) supports edge triggering. */ if ((devc->prof->model == CHRONOVU_LA16)) { if (match->match == SR_TRIGGER_RISING @@ -401,16 +405,19 @@ SR_PRIV int cv_read_block(struct dev_context *devc) return SR_OK; } -SR_PRIV void cv_send_block_to_session_bus(struct dev_context *devc, int block) +SR_PRIV void cv_send_block_to_session_bus(const struct sr_dev_inst *sdi, int block) { int i, idx; uint8_t sample, expected_sample, tmp8; struct sr_datafeed_packet packet; struct sr_datafeed_logic logic; int trigger_point; /* Relative trigger point (in this block). */ + struct dev_context *devc; /* Note: Caller ensures devc/devc->ftdic != NULL and block > 0. */ + devc = sdi->priv; + /* TODO: Implement/test proper trigger support for the LA16. */ /* Check if we can find the trigger condition in this block. */ @@ -458,7 +465,7 @@ SR_PRIV void cv_send_block_to_session_bus(struct dev_context *devc, int block) logic.length = BS; logic.unitsize = devc->prof->num_channels / 8; logic.data = devc->final_buf + (block * BS); - sr_session_send(devc->cb_data, &packet); + sr_session_send(sdi, &packet); return; } @@ -481,15 +488,13 @@ SR_PRIV void cv_send_block_to_session_bus(struct dev_context *devc, int block) logic.length = trigger_point; logic.unitsize = devc->prof->num_channels / 8; logic.data = devc->final_buf + (block * BS); - sr_session_send(devc->cb_data, &packet); + sr_session_send(sdi, &packet); } /* Send the SR_DF_TRIGGER packet to the session bus. */ sr_spew("Sending SR_DF_TRIGGER packet, sample = %d.", (block * BS) + trigger_point); - packet.type = SR_DF_TRIGGER; - packet.payload = NULL; - sr_session_send(devc->cb_data, &packet); + std_session_send_df_trigger(sdi); /* If at least one sample is located after the trigger... */ if (trigger_point < (BS - 1)) { @@ -502,6 +507,6 @@ SR_PRIV void cv_send_block_to_session_bus(struct dev_context *devc, int block) logic.length = BS - trigger_point; logic.unitsize = devc->prof->num_channels / 8; logic.data = devc->final_buf + (block * BS) + trigger_point; - sr_session_send(devc->cb_data, &packet); + sr_session_send(sdi, &packet); } }