Changeset b7c080c in mainline
- Timestamp:
- 2012-07-15T18:55:48Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a9aae16e
- Parents:
- 63c34d7
- Location:
- uspace/drv/audio/sb16
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/dsp.c
r63c34d7 rb7c080c 53 53 54 54 #define DSP_RESET_RESPONSE 0xaa 55 #define DSP_RATE_LIMIT 45000 55 56 56 57 #define AUTO_DMA_MODE … … 223 224 } 224 225 226 int sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate, 227 pcm_sample_format_t *format) 228 { 229 int ret = EOK; 230 if (*channels == 0 || *channels > 2) { 231 *channels = 2; 232 ret = ELIMIT; 233 } 234 if (*rate > DSP_RATE_LIMIT) { 235 *rate = DSP_RATE_LIMIT; 236 ret = ELIMIT; 237 } 238 //TODO 8bit DMA supports 8bit formats 239 if (*format != PCM_SAMPLE_SINT16_LE && *format != PCM_SAMPLE_UINT16_LE) { 240 *format = pcm_sample_format_is_signed(*format) ? 241 PCM_SAMPLE_SINT16_LE : PCM_SAMPLE_UINT16_LE; 242 ret = ELIMIT; 243 } 244 return ret; 245 } 246 225 247 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size) 226 248 { … … 283 305 if (channels != 1 && channels != 2) 284 306 return ENOTSUP; 285 if (sampling_rate > 44100)307 if (sampling_rate > DSP_RATE_LIMIT) 286 308 return ENOTSUP; 287 309 // FIXME We only support 16 bit playback … … 351 373 if (channels != 1 && channels != 2) 352 374 return ENOTSUP; 353 if (sampling_rate > 44100)375 if (sampling_rate > DSP_RATE_LIMIT) 354 376 return ENOTSUP; 355 377 // FIXME We only support 16 bit recording -
uspace/drv/audio/sb16/dsp.h
r63c34d7 rb7c080c 73 73 void sb_dsp_interrupt(sb_dsp_t *dsp); 74 74 75 int sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate, 76 pcm_sample_format_t *format); 75 77 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size); 76 78 int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session); -
uspace/drv/audio/sb16/pcm_iface.c
r63c34d7 rb7c080c 46 46 return EOK; 47 47 } 48 48 static int sb_test_format(ddf_fun_t *fun, unsigned *channels, unsigned *rate, 49 pcm_sample_format_t *format) 50 { 51 assert(fun); 52 assert(fun->driver_data); 53 sb_dsp_t *dsp = fun->driver_data; 54 return sb_dsp_test_format(dsp, channels, rate, format); 55 } 49 56 static int sb_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size) 50 57 { … … 108 115 audio_pcm_iface_t sb_pcm_iface = { 109 116 .get_info_str = sb_get_info_str, 117 .test_format = sb_test_format, 110 118 111 119 .get_buffer = sb_get_buffer,
Note:
See TracChangeset
for help on using the changeset viewer.