Skip to content

Commit 6660aee

Browse files
authored
Merge pull request #4742 from BsAtHome/hal64_streamer-sampler
hal: Update streamer/sampler to use 64-bit accesses
2 parents 5f9e072 + 3e7a81d commit 6660aee

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎src/hal/components/sampler.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static void sample(void *arg, long period)
157157

158158
/* are we enabled? */
159159
if (!hal_get_bool(samp->enable)) {
160-
hal_set_si32(samp->curr_depth, hal_stream_depth(&samp->fifo));
160+
hal_set_sint(samp->curr_depth, hal_stream_depth(&samp->fifo));
161161
hal_set_bool(samp->full, !hal_stream_writable(&samp->fifo));
162162
return;
163163
}
@@ -178,12 +178,12 @@ static void sample(void *arg, long period)
178178
if ( hal_stream_write(&samp->fifo, data) < 0) {
179179
/* fifo is full, data is lost */
180180
/* log the overrun */
181-
hal_set_si32(samp->overruns, hal_get_si32(samp->overruns) + 1);
181+
hal_set_sint(samp->overruns, hal_get_sint(samp->overruns) + 1);
182182
hal_set_bool(samp->full, 1);
183-
hal_set_si32(samp->curr_depth, hal_stream_maxdepth(&samp->fifo));
183+
hal_set_sint(samp->curr_depth, hal_stream_maxdepth(&samp->fifo));
184184
} else {
185185
hal_set_bool(samp->full, 0);
186-
hal_set_si32(samp->curr_depth, hal_stream_depth(&samp->fifo));
186+
hal_set_sint(samp->curr_depth, hal_stream_depth(&samp->fifo));
187187
}
188188
}
189189

@@ -207,17 +207,17 @@ static int init_sampler(int num, sampler_t *str)
207207
rtapi_print_msg(RTAPI_MSG_ERR, "SAMPLER: ERROR: 'enable' pin export failed\n");
208208
return -EIO;
209209
}
210-
retval = hal_pin_new_si32(comp_id, HAL_OUT, &str->curr_depth, 0, "%s%d.curr-depth", strbase, num);
210+
retval = hal_pin_new_sint(comp_id, HAL_OUT, &str->curr_depth, 0, "%s%d.curr-depth", strbase, num);
211211
if (retval != 0 ) {
212212
rtapi_print_msg(RTAPI_MSG_ERR, "SAMPLER: ERROR: 'curr_depth' pin export failed\n");
213213
return -EIO;
214214
}
215-
retval = hal_pin_new_si32(comp_id, HAL_IO, &str->overruns, 0, "%s%d.overruns", strbase, num);
215+
retval = hal_pin_new_sint(comp_id, HAL_IO, &str->overruns, 0, "%s%d.overruns", strbase, num);
216216
if (retval != 0 ) {
217217
rtapi_print_msg(RTAPI_MSG_ERR, "SAMPLER: ERROR: 'overruns' parameter export failed\n");
218218
return -EIO;
219219
}
220-
retval = hal_pin_new_si32(comp_id, HAL_IO, &str->sample_num, 0, "%s%d.sample-num", strbase, num);
220+
retval = hal_pin_new_sint(comp_id, HAL_IO, &str->sample_num, 0, "%s%d.sample-num", strbase, num);
221221
if (retval != 0 ) {
222222
rtapi_print_msg(RTAPI_MSG_ERR, "SAMPLER: ERROR: 'sample-num' parameter export failed\n");
223223
return -EIO;

‎src/hal/components/streamer.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static void update(void *arg, long period)
176176
/* are we enabled? - generate doclock if enabled and right mode */
177177
if (hal_get_bool(str->enable)) {
178178
doclk = 1;
179-
switch (hal_get_si32(str->clock_mode)) {
179+
switch (hal_get_sint(str->clock_mode)) {
180180
/* clock-mode 0 means do clock if enabled */
181181
case 0:
182182
break;
@@ -204,19 +204,19 @@ static void update(void *arg, long period)
204204
}
205205
/* point at user/RT fifo in other shmem */
206206
int depth = hal_stream_depth(&str->fifo);
207-
hal_set_si32(str->curr_depth, depth);
207+
hal_set_sint(str->curr_depth, depth);
208208
hal_set_bool(str->empty, depth == 0);
209209
if(!doclk)
210210
return; /* done - output pins retain current values */
211211
if(depth == 0) {
212212
/* increase underrun only for valid clock*/
213-
hal_set_si32(str->underruns, hal_get_si32(str->underruns) + 1);
213+
hal_set_sint(str->underruns, hal_get_sint(str->underruns) + 1);
214214
return;
215215
}
216216
union hal_stream_data data[HAL_STREAM_MAX_PINS];
217217
if(hal_stream_read(&str->fifo, data, NULL) < 0) {
218218
/* should not happen (single reader invariant) */
219-
hal_set_si32(str->underruns, hal_get_si32(str->underruns) + 1);
219+
hal_set_sint(str->underruns, hal_get_sint(str->underruns) + 1);
220220
return;
221221
}
222222
int num_pins = hal_stream_element_count(&str->fifo);
@@ -248,12 +248,12 @@ static int init_streamer(int num, streamer_t *str)
248248
rtapi_print_msg(RTAPI_MSG_ERR, "STREAMER: ERROR: 'enable' pin export failed\n");
249249
return -EIO;
250250
}
251-
retval = hal_pin_new_si32(comp_id, HAL_OUT, &str->curr_depth, 0, "%s%d.curr-depth", strbase, num);
251+
retval = hal_pin_new_sint(comp_id, HAL_OUT, &str->curr_depth, 0, "%s%d.curr-depth", strbase, num);
252252
if (retval != 0 ) {
253253
rtapi_print_msg(RTAPI_MSG_ERR, "STREAMER: ERROR: 'curr_depth' pin export failed\n");
254254
return -EIO;
255255
}
256-
retval = hal_pin_new_si32(comp_id, HAL_IO, &str->underruns, 0, "%s%d.underruns", strbase, num);
256+
retval = hal_pin_new_sint(comp_id, HAL_IO, &str->underruns, 0, "%s%d.underruns", strbase, num);
257257
if (retval != 0 ) {
258258
rtapi_print_msg(RTAPI_MSG_ERR, "STREAMER: ERROR: 'underruns' pin export failed\n");
259259
return -EIO;
@@ -263,7 +263,7 @@ static int init_streamer(int num, streamer_t *str)
263263
rtapi_print_msg(RTAPI_MSG_ERR, "STREAMER: ERROR: 'clock' pin export failed\n");
264264
return -EIO;
265265
}
266-
retval = hal_pin_new_si32(comp_id, HAL_IN, &str->clock_mode, 0, "%s%d.clock-mode", strbase, num);
266+
retval = hal_pin_new_sint(comp_id, HAL_IN, &str->clock_mode, 0, "%s%d.clock-mode", strbase, num);
267267
if (retval != 0 ) {
268268
rtapi_print_msg(RTAPI_MSG_ERR, "STREAMER: ERROR: 'clock_mode' pin export failed\n");
269269
return -EIO;

0 commit comments

Comments
 (0)