Changeset c885a21 in mainline for uspace/drv/audio/sb16/dsp.c
- Timestamp:
- 2011-11-14T12:38:50Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1269160
- Parents:
- 1b93658
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/dsp.c
r1b93658 rc885a21 33 33 */ 34 34 35 #include <devman.h> 36 #include <device/hw_res.h> 35 37 #include <libarch/ddi.h> 36 38 #include <libarch/barrier.h> 37 39 #include <str_error.h> 40 #include <bool.h> 38 41 39 42 #include "dma.h" 40 #include "dma_controller.h"41 43 #include "ddf_log.h" 42 44 #include "dsp_commands.h" … … 51 53 52 54 #define DSP_RESET_RESPONSE 0xaa 53 #define SB_DMA_CHAN_16 554 #define SB_DMA_CHAN_8 155 55 56 56 #define AUTO_DMA_MODE … … 105 105 } 106 106 /*----------------------------------------------------------------------------*/ 107 static inline int sb_setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size) 108 { 109 async_sess_t *sess = devman_parent_device_connect(EXCHANGE_ATOMIC, 110 dsp->sb_dev->handle, IPC_FLAG_BLOCKING); 111 if (!sess) 112 return ENOMEM; 113 114 const int ret = hw_res_dma_channel_setup(sess, 115 dsp->dma16_channel, pa, size, 116 DMA_MODE_READ | DMA_MODE_AUTO | DMA_MODE_ON_DEMAND); 117 async_hangup(sess); 118 return ret; 119 } 120 /*----------------------------------------------------------------------------*/ 107 121 static inline int sb_setup_buffer(sb_dsp_t *dsp) 108 122 { … … 117 131 assert(pa < (1 << 25)); 118 132 /* Set 16 bit channel */ 119 const int ret = dma_setup_channel(SB_DMA_CHAN_16, pa, BUFFER_SIZE, 120 DMA_MODE_READ | DMA_MODE_AUTO | DMA_MODE_ON_DEMAND); 133 const int ret = sb_setup_dma(dsp, pa, BUFFER_SIZE); 121 134 if (ret == EOK) { 122 135 dsp->buffer.data = buffer; … … 148 161 } 149 162 /*----------------------------------------------------------------------------*/ 150 int sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs) 163 int sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev, 164 int dma8, int dma16) 151 165 { 152 166 assert(dsp); 153 167 dsp->regs = regs; 168 dsp->dma8_channel = dma8; 169 dsp->dma16_channel = dma16; 170 dsp->sb_dev = dev; 154 171 sb_dsp_reset(dsp); 155 172 /* "DSP takes about 100 microseconds to initialize itself" */
Note:
See TracChangeset
for help on using the changeset viewer.