Changeset ed3f8d5 in mainline
- Timestamp:
- 2011-11-30T21:58:26Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5c62b5f
- Parents:
- 413225d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/dsp.c
r413225d red3f8d5 56 56 #define AUTO_DMA_MODE 57 57 58 #ifdef AUTO_DMA_MODE59 #undef AUTO_DMA_MODE60 #define AUTO_DMA_MODE true61 #else62 #define AUTO_DMA_MODE false63 #endif64 65 58 static inline int sb_dsp_read(sb_dsp_t *dsp, uint8_t *data) 66 59 { … … 198 191 199 192 if (remain_size == 0) { 193 #ifdef AUTO_DMA_MODE 194 sb_dsp_write(dsp, DMA_16B_EXIT); 195 #endif 200 196 ddf_log_note("Nothing more to play"); 201 if (AUTO_DMA_MODE) {202 sb_dsp_write(dsp, DMA_16B_EXIT);203 }204 197 sb_clear_buffer(dsp); 205 198 return; … … 220 213 return; 221 214 } 215 /* Copy new data */ 222 216 memcpy(dsp->buffer.position, dsp->playing.position, PLAY_BLOCK_SIZE); 223 217 write_barrier(); 218 /* Adjust position */ 224 219 dsp->playing.position += PLAY_BLOCK_SIZE; 225 220 dsp->buffer.position += PLAY_BLOCK_SIZE; … … 227 222 if (dsp->buffer.position == (dsp->buffer.data + dsp->buffer.size)) 228 223 dsp->buffer.position = dsp->buffer.data; 229 if (!AUTO_DMA_MODE) { 230 sb_dsp_write(dsp, SINGLE_DMA_16B_DA_FIFO); 231 sb_dsp_write(dsp, dsp->playing.mode); 232 sb_dsp_write(dsp, (PLAY_BLOCK_SIZE - 1) & 0xff); 233 sb_dsp_write(dsp, (PLAY_BLOCK_SIZE - 1) >> 8); 234 } 224 #ifndef AUTO_DMA_MODE 225 const size_t samples = sample_count(dsp->playing.mode, PLAY_BLOCK_SIZE); 226 sb_dsp_write(dsp, SINGLE_DMA_16B_DA_FIFO); 227 sb_dsp_write(dsp, dsp->playing.mode); 228 sb_dsp_write(dsp, (samples - 1) & 0xff); 229 sb_dsp_write(dsp, (samples - 1) >> 8); 230 #endif 235 231 236 232 } … … 270 266 return ret; 271 267 268 const size_t copy_size = size < BUFFER_SIZE ? size : BUFFER_SIZE; 272 269 const size_t play_size = 273 270 size < PLAY_BLOCK_SIZE ? size : PLAY_BLOCK_SIZE; 274 const size_t copy_size =275 size < BUFFER_SIZE ? size : BUFFER_SIZE;276 271 277 272 dsp->playing.data = data; … … 279 274 dsp->playing.size = size; 280 275 dsp->playing.mode = 0; 276 281 277 if (sample_size == 16) 282 278 dsp->playing.mode |= DSP_MODE_16BIT; … … 299 295 sampling_rate >> 8, sampling_rate & 0xff); 300 296 301 if (!AUTO_DMA_MODE || play_size == size) { 297 #ifdef AUTO_DMA_MODE 298 if (play_size < size) { 299 sb_dsp_write(dsp, AUTO_DMA_16B_DA_FIFO); 300 } else { 302 301 sb_dsp_write(dsp, SINGLE_DMA_16B_DA_FIFO); 303 } else { 304 sb_dsp_write(dsp, AUTO_DMA_16B_DA_FIFO); 305 } 302 } 303 #else 304 sb_dsp_write(dsp, SINGLE_DMA_16B_DA_FIFO); 305 #endif 306 306 307 sb_dsp_write(dsp, dsp->playing.mode); 307 308 sb_dsp_write(dsp, (samples - 1) & 0xff);
Note:
See TracChangeset
for help on using the changeset viewer.