Changeset 9808edd in mainline
- Timestamp:
- 2011-12-05T00:53:38Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46117de0
- Parents:
- e44385d
- Location:
- uspace/drv/audio/sb16
- Files:
-
- 1 added
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/Makefile
re44385d r9808edd 38 38 39 39 SOURCES = \ 40 beep16.c \41 40 dsp.c \ 42 41 main.c \ 43 42 mixer.c \ 44 43 mixer_iface.c \ 44 pcm_iface.c \ 45 45 sb16.c 46 46 -
uspace/drv/audio/sb16/main.c
re44385d r9808edd 123 123 "Failed to register irq handler: %s.\n", str_error(ret)); 124 124 125 126 ddf_fun_t *dsp_fun = NULL;127 125 #define CHECK_RET_UNREG_DEST_RETURN(ret, msg...) \ 128 126 if (ret != EOK) { \ 129 127 ddf_log_error(msg); \ 130 if (dsp_fun) \131 ddf_fun_destroy(dsp_fun); \132 128 unregister_interrupt_handler(device, irq); \ 133 129 return ret; \ … … 137 133 CHECK_RET_UNREG_DEST_RETURN(ret, "Failed to enable interrupts: %s.\n", 138 134 str_error(ret)); 139 140 dsp_fun = ddf_fun_create(device, fun_exposed, "dsp");141 ret = dsp_fun ? EOK : ENOMEM;142 CHECK_RET_UNREG_DEST_RETURN(ret, "Failed to create dsp function.");143 135 144 136 ret = sb16_init_sb16( … … 146 138 CHECK_RET_UNREG_DEST_RETURN(ret, 147 139 "Failed to init sb16 driver: %s.\n", str_error(ret)); 148 149 ret = ddf_fun_bind(dsp_fun);150 CHECK_RET_UNREG_DEST_RETURN(ret,151 "Failed to bind dsp function: %s.\n", str_error(ret));152 153 /* Everything's OK assign driver_data. */154 dsp_fun->driver_data = soft_state;155 140 156 141 ret = sb16_init_mpu(soft_state, (void*)mpu_regs, mpu_regs_size); -
uspace/drv/audio/sb16/sb16.c
re44385d r9808edd 30 30 #include <str_error.h> 31 31 #include <audio_mixer_iface.h> 32 #include <audio_pcm_buffer_iface.h> 32 33 33 34 #include "beep.h" … … 38 39 39 40 extern audio_mixer_iface_t sb_mixer_iface; 41 extern audio_pcm_buffer_iface_t sb_pcm_iface; 40 42 41 43 static ddf_dev_ops_t sb_mixer_ops = { 42 44 .interfaces[AUDIO_MIXER_IFACE] = &sb_mixer_iface, 45 }; 46 47 static ddf_dev_ops_t sb_pcm_ops = { 48 .interfaces[AUDIO_PCM_BUFFER_IFACE] = &sb_pcm_iface, 43 49 }; 44 50 … … 95 101 96 102 /* Initialize DSP */ 103 ddf_fun_t *dsp_fun = ddf_fun_create(dev, fun_exposed, "dsp"); 104 if (!dsp_fun) { 105 ddf_log_error("Failed to create dsp function.\n"); 106 return ENOMEM; 107 } 108 97 109 ret = sb_dsp_init(&sb->dsp, sb->regs, dev, dma8, dma16); 98 110 if (ret != EOK) { … … 101 113 return ret; 102 114 } 115 dsp_fun->driver_data = &sb->dsp; 116 dsp_fun->ops = &sb_pcm_ops; 103 117 ddf_log_note("Sound blaster DSP (%x.%x) initialized.\n", 104 118 sb->dsp.version.major, sb->dsp.version.minor); 119 120 ret = ddf_fun_bind(dsp_fun); 121 if (ret != EOK) { 122 ddf_log_error( 123 "Failed to bind DSP function: %s.\n", str_error(ret)); 124 dsp_fun->driver_data = NULL; 125 ddf_fun_destroy(dsp_fun); 126 return ret; 127 } 105 128 106 129 /* Initialize mixer */ … … 111 134 if (!mixer_fun) { 112 135 ddf_log_error("Failed to create mixer function.\n"); 136 ddf_fun_unbind(dsp_fun); 137 dsp_fun->driver_data = NULL; 138 ddf_fun_destroy(dsp_fun); 113 139 return ENOMEM; 114 140 } … … 117 143 ddf_log_error("Failed to initialize SB mixer: %s.\n", 118 144 str_error(ret)); 145 ddf_fun_unbind(dsp_fun); 146 dsp_fun->driver_data = NULL; 147 ddf_fun_destroy(dsp_fun); 148 ddf_fun_destroy(mixer_fun); 119 149 return ret; 120 150 } … … 131 161 mixer_fun->driver_data = NULL; 132 162 ddf_fun_destroy(mixer_fun); 163 164 ddf_fun_unbind(dsp_fun); 165 dsp_fun->driver_data = NULL; 166 ddf_fun_destroy(dsp_fun); 133 167 return ret; 134 168 } 135 136 ddf_log_note("Playing startup sound.\n");137 sb_dsp_play(&sb->dsp, beep, beep_size, 44100, channels, 16);138 169 139 170 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.