Changes in uspace/drv/audio/sb16/dsp.c [53a309e:f9b2cb4c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/dsp.c
r53a309e rf9b2cb4c 35 35 #include <as.h> 36 36 #include <stdbool.h> 37 #include <ddf/driver.h>38 37 #include <ddi.h> 38 #include <devman.h> 39 39 #include <device/hw_res.h> 40 40 #include <libarch/ddi.h> … … 75 75 [DSP_NO_BUFFER] = "NO BUFFER", 76 76 }; 77 if ( (size_t)state < ARRAY_SIZE(state_names))77 if (state < ARRAY_SIZE(state_names)) 78 78 return state_names[state]; 79 79 return "UNKNOWN"; … … 144 144 { 145 145 dsp_write(dsp, SET_SAMPLING_RATE_OUTPUT); 146 uint8_t rate_lo = rate & 0xff; 147 uint8_t rate_hi = rate >> 8; 148 dsp_write(dsp, rate_hi); 149 dsp_write(dsp, rate_lo); 150 ddf_log_verbose("Sampling rate: %hhx:%hhx.", rate_hi, rate_lo); 146 dsp_write(dsp, rate >> 8); 147 dsp_write(dsp, rate & 0xff); 148 ddf_log_verbose("Sampling rate: %hhx:%hhx.", rate >> 8, rate & 0xff); 151 149 } 152 150 … … 161 159 static inline int setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size) 162 160 { 163 async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev); 164 165 return hw_res_dma_channel_setup(sess, 161 async_sess_t *sess = devman_parent_device_connect( 162 ddf_dev_get_handle(dsp->sb_dev), IPC_FLAG_BLOCKING); 163 164 const int ret = hw_res_dma_channel_setup(sess, 166 165 dsp->dma16_channel, pa, size, 167 166 DMA_MODE_READ | DMA_MODE_AUTO | DMA_MODE_ON_DEMAND); 167 168 async_hangup(sess); 169 return ret; 168 170 } 169 171 … … 200 202 201 203 return ret; 204 } 205 206 static inline size_t sample_count(pcm_sample_format_t format, size_t byte_count) 207 { 208 return byte_count / pcm_sample_format_size(format); 202 209 } 203 210 … … 300 307 301 308 assert(dsp->buffer.data); 302 async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev); 309 async_sess_t *sess = devman_parent_device_connect( 310 ddf_dev_get_handle(dsp->sb_dev), IPC_FLAG_BLOCKING); 303 311 304 312 // TODO: Assumes DMA 16 305 313 const int remain = hw_res_dma_channel_remain(sess, dsp->dma16_channel); 314 async_hangup(sess); 306 315 if (remain >= 0) { 307 316 *pos = dsp->buffer.size - remain;
Note:
See TracChangeset
for help on using the changeset viewer.