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