Commit 45cdf3c4 authored by Federico Vaga's avatar Federico Vaga Committed by Alessandro Rubini

trigger fire: check if trigger is busy

When a trigger fire it is set to STATUS_ON until data_done(); so, one
transfer at time is allowed.
Signed-off-by: 's avatarFederico Vaga <federico.vaga@gmail.com>
Acked-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 3f52809f
......@@ -51,6 +51,14 @@ struct zio_ti {
const struct file_operations *f_op;
};
/* first 4bit are reserved for zio object universal flags */
enum zti_flag_mask {
ZTI_STATUS = 0x10,
ZTI_STATUS_OFF = 0x00, /* trigger is idle */
ZTI_STATUS_ON = 0x10, /* trigger fire and transfer occurs */
};
#define to_zio_ti(_kobj) container_of(_kobj, struct zio_ti, head.kobj)
void zio_fire_trigger(struct zio_ti *ti);
......
......@@ -122,7 +122,7 @@ void zio_generic_data_done(struct zio_cset *cset)
/* We may have a new block ready, or not */
chan->active_block = zbuf->b_op->retr_block(chan->bi);
}
return;
goto out;
}
/* DIR_INPUT */
cset_for_each(cset, chan) {
......@@ -133,6 +133,8 @@ void zio_generic_data_done(struct zio_cset *cset)
if (zbuf->b_op->store_block(bi, block)) /* may fail, no prob */
zbuf->b_op->free_block(bi, block);
}
out:
ti->flags &= (~ZTI_STATUS);
}
EXPORT_SYMBOL(zio_generic_data_done);
......@@ -152,8 +154,6 @@ static void __zio_fire_input_trigger(struct zio_ti *ti)
pr_debug("%s:%d\n", __func__, __LINE__);
/* FIXME: check if a trigger is already pending */
/* Allocate the buffer for the incoming sample, in active channels */
cset_for_each(cset, chan) {
ctrl = zio_alloc_control(GFP_ATOMIC);
......@@ -204,7 +204,10 @@ void zio_fire_trigger(struct zio_ti *ti)
/* If the trigger runs too early, ti->cset is still NULL */
if (!ti->cset)
return;
/* check if previouvs fire is still running*/
if ((ti->flags & ZTI_STATUS) == ZTI_STATUS_ON)
return;
ti->flags |= ZTI_STATUS_ON;
/* Copy the stamp (we are software driven anyways) */
ti->current_ctrl->tstamp.secs = ti->tstamp.tv_sec;
ti->current_ctrl->tstamp.ticks = ti->tstamp.tv_nsec;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment