sm_io/modules/acq: use helper alignment function

Avoid adding unnecessary padding and simplify the code.
parent 219805fc
...@@ -114,7 +114,7 @@ static int _acq_data_acquire (void *owner, void *args, void *ret) ...@@ -114,7 +114,7 @@ static int _acq_data_acquire (void *owner, void *args, void *ret)
return -ACQ_NUM_CHAN_OOR; return -ACQ_NUM_CHAN_OOR;
} }
/* number of samples required is out of the maximum limit. Maixmum number of samples /* number of samples required is out of the maximum limit. Maixmum number of samples
* in multishot mode is simply the maximum number of samples of the DPRAM. The DPRAM * in multishot mode is simply the maximum number of samples of the DPRAM. The DPRAM
* size is calculated to fit the largest sample in the design, so we are safe. */ * size is calculated to fit the largest sample in the design, so we are safe. */
uint32_t max_samples_multishot = ACQ_CORE_MULTISHOT_MEM_SIZE; uint32_t max_samples_multishot = ACQ_CORE_MULTISHOT_MEM_SIZE;
...@@ -163,11 +163,10 @@ static int _acq_data_acquire (void *owner, void *args, void *ret) ...@@ -163,11 +163,10 @@ static int _acq_data_acquire (void *owner, void *args, void *ret)
* acquisition channel sample size */ * acquisition channel sample size */
uint32_t samples_alignment = uint32_t samples_alignment =
DDR3_PAYLOAD_SIZE/acq->acq_buf[chan].sample_size; DDR3_PAYLOAD_SIZE/acq->acq_buf[chan].sample_size;
uint32_t num_samples_pre_aligned = num_samples_pre + samples_alignment - uint32_t num_samples_pre_aligned = hutils_align_value(num_samples_pre,
(num_samples_pre % samples_alignment); samples_alignment);
uint32_t num_samples_post_aligned = (num_samples_post==0) ? 0 : uint32_t num_samples_post_aligned = hutils_align_value(num_samples_post,
num_samples_post + samples_alignment - samples_alignment);
(num_samples_post % samples_alignment);
/* Set the parameters: number of samples of this channel */ /* Set the parameters: number of samples of this channel */
acq->acq_params[chan].num_samples_pre = num_samples_pre_aligned; acq->acq_params[chan].num_samples_pre = num_samples_pre_aligned;
...@@ -401,8 +400,8 @@ static int _acq_get_data_block (void *owner, void *args, void *ret) ...@@ -401,8 +400,8 @@ static int _acq_get_data_block (void *owner, void *args, void *ret)
* sample_size * sample_size
* */ * */
/* First step if to get the trigger address from the channel. /* First step if to get the trigger address from the channel.
* Even on skip trigger mode, this will contain the address after * Even on skip trigger mode, this will contain the address after
* the last valid sample (end of acquisition address) */ * the last valid sample (end of acquisition address) */
uint32_t acq_core_trig_addr = acq->acq_params[chan].trig_addr; uint32_t acq_core_trig_addr = acq->acq_params[chan].trig_addr;
......
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