Changeset 124f9bd in mainline
- Timestamp:
- 2012-07-05T20:52:36Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e941bf8
- Parents:
- 4bec78f
- Location:
- uspace/drv/audio/sb16
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/dsp.c
r4bec78f r124f9bd 120 120 uint8_t *buffer = dma_create_buffer24(size); 121 121 if (buffer == NULL) { 122 ddf_log_error("Failed to allocate buffer.\n");122 ddf_log_error("Failed to allocate DMA buffer."); 123 123 return ENOMEM; 124 124 } … … 133 133 bzero(dsp->buffer.data, dsp->buffer.size); 134 134 } else { 135 ddf_log_error("Failed to setup DMA16 channel %s.\n",135 ddf_log_error("Failed to setup DMA16 channel: %s.", 136 136 str_error(ret)); 137 137 dma_destroy_buffer(buffer); … … 171 171 const int ret = sb_dsp_read(dsp, &response); 172 172 if (ret != EOK) { 173 ddf_log_error("Failed to read DSP reset response value. \n");173 ddf_log_error("Failed to read DSP reset response value."); 174 174 return ret; 175 175 } 176 176 if (response != DSP_RESET_RESPONSE) { 177 ddf_log_error("Invalid DSP reset response: %x. \n", response);177 ddf_log_error("Invalid DSP reset response: %x.", response); 178 178 return EIO; 179 179 } … … 191 191 assert(dsp); 192 192 if (dsp->event_exchange) { 193 ddf_log_verbose("Sending interrupt event."); 193 194 async_msg_0(dsp->event_exchange, IPC_FIRST_USER_METHOD); 194 195 } else { … … 214 215 215 216 const int ret = sb_setup_buffer(dsp, *size); 216 ddf_log_debug("Providing buffer(%u): %p, %zu B.\n", 217 BUFFER_ID, dsp->buffer.data, dsp->buffer.size); 218 219 if (ret == EOK && buffer) 220 *buffer = dsp->buffer.data; 221 if (ret == EOK && size) 222 *size = dsp->buffer.size; 223 if (ret == EOK && id) 224 *id = BUFFER_ID; 217 if (ret == EOK) { 218 ddf_log_debug("Providing buffer(%u): %p, %zu B.", 219 BUFFER_ID, dsp->buffer.data, dsp->buffer.size); 220 221 if (buffer) 222 *buffer = dsp->buffer.data; 223 if (size) 224 *size = dsp->buffer.size; 225 if (id) 226 *id = BUFFER_ID; 227 } 225 228 return ret; 226 229 } … … 235 238 return EBUSY; 236 239 dsp->event_session = session; 240 ddf_log_debug("Set event session."); 237 241 return EOK; 238 242 } … … 250 254 async_hangup(dsp->event_session); 251 255 dsp->event_session = NULL; 256 ddf_log_debug("DSP buffer released."); 252 257 return EOK; 253 258 } … … 269 274 /* Check supported parameters */ 270 275 ddf_log_debug("Starting playback on buffer(%u): rate: %u, size: %u, " 271 " channels: %u, signed: %s. \n", id, sampling_rate, sample_size,276 " channels: %u, signed: %s.", id, sampling_rate, sample_size, 272 277 channels, sign ? "YES" : "NO" ); 273 278 if (id != BUFFER_ID) … … 288 293 sb_dsp_write(dsp, sampling_rate & 0xff); 289 294 290 ddf_log_debug("Sampling rate: %hhx:%hhx. \n",295 ddf_log_debug("Sampling rate: %hhx:%hhx.", 291 296 sampling_rate >> 8, sampling_rate & 0xff); 292 297 -
uspace/drv/audio/sb16/main.c
r4bec78f r124f9bd 103 103 sb16_t *soft_state = ddf_dev_data_alloc(device, sizeof(sb16_t)); 104 104 int ret = soft_state ? EOK : ENOMEM; 105 CHECK_RET_RETURN(ret, "Failed to allocate sb16 structure. \n");105 CHECK_RET_RETURN(ret, "Failed to allocate sb16 structure."); 106 106 107 107 uintptr_t sb_regs = 0, mpu_regs = 0; … … 111 111 ret = sb_get_res(device, &sb_regs, &sb_regs_size, &mpu_regs, 112 112 &mpu_regs_size, &irq, &dma8, &dma16); 113 CHECK_RET_RETURN(ret, 114 "Failed to get resources: %s.\n", str_error(ret)); 113 CHECK_RET_RETURN(ret, "Failed to get resources: %s.", str_error(ret)); 115 114 116 115 const size_t irq_cmd_count = sb16_irq_code_size(); … … 128 127 ret = register_interrupt_handler(device, irq, irq_handler, &irq_code); 129 128 CHECK_RET_RETURN(ret, 130 "Failed to register irq handler: %s. \n", str_error(ret));129 "Failed to register irq handler: %s.", str_error(ret)); 131 130 132 131 #define CHECK_RET_UNREG_DEST_RETURN(ret, msg...) \ … … 138 137 139 138 ret = sb_enable_interrupts(device); 140 CHECK_RET_UNREG_DEST_RETURN(ret, "Failed to enable interrupts: %s. \n",139 CHECK_RET_UNREG_DEST_RETURN(ret, "Failed to enable interrupts: %s.", 141 140 str_error(ret)); 142 141 … … 144 143 soft_state, (void*)sb_regs, sb_regs_size, device, dma8, dma16); 145 144 CHECK_RET_UNREG_DEST_RETURN(ret, 146 "Failed to init sb16 driver: %s. \n", str_error(ret));145 "Failed to init sb16 driver: %s.", str_error(ret)); 147 146 148 147 ret = sb16_init_mpu(soft_state, (void*)mpu_regs, mpu_regs_size); … … 154 153 if (ret != EOK) 155 154 ddf_log_error( 156 "Failed to bind midi function: %s. \n",155 "Failed to bind midi function: %s.", 157 156 str_error(ret)); 158 157 } else { 159 ddf_log_error("Failed to create midi function. \n");158 ddf_log_error("Failed to create midi function."); 160 159 } 161 160 } else { 162 ddf_log_warning("Failed to init mpu driver: %s. \n", str_error(ret));161 ddf_log_warning("Failed to init mpu driver: %s.", str_error(ret)); 163 162 } 164 163 -
uspace/drv/audio/sb16/mixer.c
r4bec78f r124f9bd 168 168 pio_write_8(®s->mixer_address, MIXER_PNP_DMA_ADDRESS); 169 169 const uint8_t dma = pio_read_8(®s->mixer_data); 170 ddf_log_debug("SB16 setup with IRQ 0x%hhx and DMA 0x%hhx. \n", irq, dma);170 ddf_log_debug("SB16 setup with IRQ 0x%hhx and DMA 0x%hhx.", irq, dma); 171 171 return EOK; 172 172 } … … 238 238 value |= level << chan->shift; 239 239 pio_write_8(&mixer->regs->mixer_data, value); 240 ddf_log_note("Channel %s %s volume set to: %u. \n",240 ddf_log_note("Channel %s %s volume set to: %u.", 241 241 volume_table[mixer->type].table[index].description, 242 242 chan->name, level); -
uspace/drv/audio/sb16/sb16.c
r4bec78f r124f9bd 99 99 if (ret != EOK) 100 100 return ret; 101 ddf_log_debug("PIO registers at %p accessible. \n", sb->regs);101 ddf_log_debug("PIO registers at %p accessible.", sb->regs); 102 102 103 103 /* Initialize DSP */ 104 104 ddf_fun_t *dsp_fun = ddf_fun_create(dev, fun_exposed, "dsp"); 105 105 if (!dsp_fun) { 106 ddf_log_error("Failed to create dsp function. \n");106 ddf_log_error("Failed to create dsp function."); 107 107 return ENOMEM; 108 108 } … … 110 110 ret = sb_dsp_init(&sb->dsp, sb->regs, dev, dma8, dma16); 111 111 if (ret != EOK) { 112 ddf_log_error("Failed to initialize SB DSP: %s. \n",112 ddf_log_error("Failed to initialize SB DSP: %s.", 113 113 str_error(ret)); 114 114 return ret; … … 116 116 dsp_fun->driver_data = &sb->dsp; 117 117 dsp_fun->ops = &sb_pcm_ops; 118 ddf_log_note("Sound blaster DSP (%x.%x) initialized. \n",118 ddf_log_note("Sound blaster DSP (%x.%x) initialized.", 119 119 sb->dsp.version.major, sb->dsp.version.minor); 120 120 … … 122 122 if (ret != EOK) { 123 123 ddf_log_error( 124 "Failed to bind DSP function: %s. \n", str_error(ret));124 "Failed to bind DSP function: %s.", str_error(ret)); 125 125 dsp_fun->driver_data = NULL; 126 126 ddf_fun_destroy(dsp_fun); … … 134 134 ddf_fun_t *mixer_fun = ddf_fun_create(dev, fun_exposed, "mixer"); 135 135 if (!mixer_fun) { 136 ddf_log_error("Failed to create mixer function. \n");136 ddf_log_error("Failed to create mixer function."); 137 137 ddf_fun_unbind(dsp_fun); 138 138 dsp_fun->driver_data = NULL; … … 142 142 ret = sb_mixer_init(&sb->mixer, sb->regs, mixer_type); 143 143 if (ret != EOK) { 144 ddf_log_error("Failed to initialize SB mixer: %s. \n",144 ddf_log_error("Failed to initialize SB mixer: %s.", 145 145 str_error(ret)); 146 146 ddf_fun_unbind(dsp_fun); … … 151 151 } 152 152 153 ddf_log_note("Initialized mixer: %s. \n",153 ddf_log_note("Initialized mixer: %s.", 154 154 sb_mixer_type_str(sb->mixer.type)); 155 155 mixer_fun->driver_data = &sb->mixer; … … 159 159 if (ret != EOK) { 160 160 ddf_log_error( 161 "Failed to bind mixer function: %s. \n", str_error(ret));161 "Failed to bind mixer function: %s.", str_error(ret)); 162 162 mixer_fun->driver_data = NULL; 163 163 ddf_fun_destroy(mixer_fun); … … 192 192 } 193 193 } else { 194 ddf_log_debug("SB16 interrupt. \n");194 ddf_log_debug("SB16 interrupt."); 195 195 } 196 196 sb_dsp_interrupt(&sb->dsp);
Note:
See TracChangeset
for help on using the changeset viewer.