Commit a6a3d20d authored by Federico Vaga's avatar Federico Vaga

kernel: take into account time-tag size when checking overflow

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 7da3fcd4
...@@ -422,15 +422,16 @@ static inline int zfat_overflow_detection(struct zio_ti *ti, unsigned int addr, ...@@ -422,15 +422,16 @@ static inline int zfat_overflow_detection(struct zio_ti *ti, unsigned int addr,
/* /*
* +1 because of the trigger samples, which is not counted as * +1 because of the trigger samples, which is not counted as
* post-sample by the ADC * post-sample by the ADC
* +2 because of the timetag at the end
*/ */
shot_size = ((pre_t + post_t + 1) * ti->cset->ssize) * FA100M14B4C_NCHAN; shot_size = ((pre_t + post_t + 1 + 2) * ti->cset->ssize) * FA100M14B4C_NCHAN;
if ( (shot_size * nshot_t) >= FA100M14B4C_MAX_ACQ_BYTE ) { if ( (shot_size * nshot_t) > FA100M14B4C_MAX_ACQ_BYTE ) {
dev_err(&ti->head.dev, "Cannot acquire, dev memory overflow\n"); dev_err(&ti->head.dev, "Cannot acquire, dev memory overflow\n");
return -ENOMEM; return -ENOMEM;
} }
/* in case of multi shot, each shot cannot exceed the dpram size */ /* in case of multi shot, each shot cannot exceed the dpram size */
if ( (nshot_t > 1) && if ( (nshot_t > 1) &&
(shot_size >= FA100M14B4C_MAX_MSHOT_ACQ_BYTE) ) { (shot_size > FA100M14B4C_MAX_MSHOT_ACQ_BYTE) ) {
dev_err(&ti->head.dev, "Cannot acquire such amount of samples " dev_err(&ti->head.dev, "Cannot acquire such amount of samples "
"(shot_size: %d pre-samp:%d post-samp:%d) in multi shot mode." "(shot_size: %d pre-samp:%d post-samp:%d) in multi shot mode."
"dev memory overflow\n", "dev memory overflow\n",
......
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