Changes in uspace/drv/audio/sb16/dsp.c [b7fd2a0:53a309e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/dsp.c
rb7fd2a0 r53a309e 89 89 } 90 90 91 static inline errno_t dsp_read(sb_dsp_t *dsp, uint8_t *data)91 static inline int dsp_read(sb_dsp_t *dsp, uint8_t *data) 92 92 { 93 93 assert(data); … … 106 106 } 107 107 108 static inline errno_t dsp_write(sb_dsp_t *dsp, uint8_t data)108 static inline int dsp_write(sb_dsp_t *dsp, uint8_t data) 109 109 { 110 110 assert(dsp); … … 159 159 } 160 160 161 static inline errno_t setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)161 static inline int setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size) 162 162 { 163 163 async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev); … … 168 168 } 169 169 170 static inline errno_t setup_buffer(sb_dsp_t *dsp, size_t size)170 static inline int setup_buffer(sb_dsp_t *dsp, size_t size) 171 171 { 172 172 assert(dsp); … … 178 178 void *buffer = AS_AREA_ANY; 179 179 180 errno_t ret = dmamem_map_anonymous(size, DMAMEM_16MiB | 0x0000ffff,180 int ret = dmamem_map_anonymous(size, DMAMEM_16MiB | 0x0000ffff, 181 181 AS_AREA_WRITE | AS_AREA_READ, 0, &pa, &buffer); 182 182 if (ret != EOK) { … … 202 202 } 203 203 204 errno_t sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,204 int sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev, 205 205 int dma8, int dma16) 206 206 { … … 215 215 dsp_reset(dsp); 216 216 uint8_t response; 217 const errno_t ret = dsp_read(dsp, &response);217 const int ret = dsp_read(dsp, &response); 218 218 if (ret != EOK) { 219 219 ddf_log_error("Failed to read DSP reset response value."); … … 290 290 return 16535; 291 291 default: 292 return -1;293 } 294 } 295 296 errno_t sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *pos)292 return ENOTSUP; 293 } 294 } 295 296 int sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *pos) 297 297 { 298 298 if (dsp->state == DSP_NO_BUFFER) … … 303 303 304 304 // TODO: Assumes DMA 16 305 size_t remain; 306 errno_t rc = hw_res_dma_channel_remain(sess, dsp->dma16_channel, &remain); 307 if (rc == EOK) { 305 const int remain = hw_res_dma_channel_remain(sess, dsp->dma16_channel); 306 if (remain >= 0) { 308 307 *pos = dsp->buffer.size - remain; 309 } 310 return rc; 311 } 312 313 errno_t sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate, 308 return EOK; 309 } 310 return remain; 311 } 312 313 int sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate, 314 314 pcm_sample_format_t *format) 315 315 { 316 errno_t ret = EOK;316 int ret = EOK; 317 317 if (*channels == 0 || *channels > 2) { 318 318 *channels = 2; … … 336 336 } 337 337 338 errno_t sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session)338 int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session) 339 339 { 340 340 assert(dsp); … … 353 353 } 354 354 355 errno_t sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size)355 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size) 356 356 { 357 357 assert(dsp); … … 364 364 assert(dsp->buffer.data == NULL); 365 365 366 const errno_t ret = setup_buffer(dsp, *size);366 const int ret = setup_buffer(dsp, *size); 367 367 if (ret == EOK) { 368 368 ddf_log_debug("Providing buffer: %p, %zu B.", … … 378 378 } 379 379 380 errno_t sb_dsp_release_buffer(sb_dsp_t *dsp)380 int sb_dsp_release_buffer(sb_dsp_t *dsp) 381 381 { 382 382 assert(dsp); … … 392 392 } 393 393 394 errno_t sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,394 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames, 395 395 unsigned channels, unsigned sampling_rate, pcm_sample_format_t format) 396 396 { … … 441 441 } 442 442 443 errno_t sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate)443 int sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate) 444 444 { 445 445 assert(dsp); … … 471 471 } 472 472 473 errno_t sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,473 int sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames, 474 474 unsigned channels, unsigned sampling_rate, pcm_sample_format_t format) 475 475 { … … 517 517 } 518 518 519 errno_t sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate)519 int sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate) 520 520 { 521 521 assert(dsp);
Note:
See TracChangeset
for help on using the changeset viewer.