Changeset 9bd4615 in mainline
- Timestamp:
- 2014-07-20T13:31:50Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 54a1ca7
- Parents:
- 350274a
- Location:
- uspace/drv/audio/sb16
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/mixer_iface.c
r350274a r9bd4615 33 33 */ 34 34 35 #include <ddf/driver.h> 35 36 #include <errno.h> 36 37 #include <audio_mixer_iface.h> 37 38 38 39 #include "mixer.h" 40 #include "sb16.h" 41 42 static sb_mixer_t *fun_to_mixer(ddf_fun_t *fun) 43 { 44 sb16_t *sb = (sb16_t *)ddf_dev_data_get(ddf_fun_get_dev(fun)); 45 return &sb->mixer; 46 } 39 47 40 48 static int sb_get_info(ddf_fun_t *fun, const char** name, unsigned *items) 41 49 { 42 assert(fun); 43 const sb_mixer_t *mixer = ddf_fun_data_get(fun); 44 assert(mixer); 50 sb_mixer_t *mixer = fun_to_mixer(fun); 51 45 52 if (name) 46 53 *name = sb_mixer_type_str(mixer->type); … … 54 61 unsigned *max_level) 55 62 { 56 assert(fun); 57 const sb_mixer_t *mixer = ddf_fun_data_get(fun); 58 assert(mixer); 59 return 60 sb_mixer_get_control_item_info(mixer, item, name, max_level); 63 sb_mixer_t *mixer = fun_to_mixer(fun); 64 return sb_mixer_get_control_item_info(mixer, item, name, max_level); 61 65 } 62 66 63 67 static int sb_set_item_level(ddf_fun_t *fun, unsigned item, unsigned value) 64 68 { 65 assert(fun); 66 const sb_mixer_t *mixer = ddf_fun_data_get(fun); 67 assert(mixer); 69 sb_mixer_t *mixer = fun_to_mixer(fun); 68 70 return sb_mixer_set_control_item_value(mixer, item, value); 69 71 } … … 71 73 static int sb_get_item_level(ddf_fun_t *fun, unsigned item, unsigned *value) 72 74 { 73 assert(fun); 74 const sb_mixer_t *mixer = ddf_fun_data_get(fun); 75 assert(mixer); 75 sb_mixer_t *mixer = fun_to_mixer(fun); 76 76 return sb_mixer_get_control_item_value(mixer, item, value); 77 77 } -
uspace/drv/audio/sb16/pcm_iface.c
r350274a r9bd4615 39 39 40 40 #include "dsp.h" 41 #include "sb16.h" 41 42 42 static inline sb_dsp_t * 43 static inline sb_dsp_t *fun_to_dsp(ddf_fun_t *fun) 43 44 { 44 assert(fun); 45 sb_dsp_t *dsp = ddf_fun_data_get(fun); 46 assert(dsp); 47 return dsp; 45 sb16_t *sb = (sb16_t *)ddf_dev_data_get(ddf_fun_get_dev(fun)); 46 return &sb->dsp; 48 47 } 49 48 -
uspace/drv/audio/sb16/sb16.c
r350274a r9bd4615 27 27 */ 28 28 29 #define _DDF_DATA_IMPLANT30 31 29 #include <errno.h> 32 30 #include <str_error.h> … … 121 119 return ret; 122 120 } 123 //TODO remove data implant 124 ddf_fun_data_implant(dsp_fun, &sb->dsp); 121 125 122 ddf_fun_set_ops(dsp_fun, &sb_pcm_ops); 126 123 ddf_log_note("Sound blaster DSP (%x.%x) initialized.", … … 131 128 ddf_log_error( 132 129 "Failed to bind PCM function: %s.", str_error(ret)); 133 // TODO implanted data134 130 ddf_fun_destroy(dsp_fun); 135 131 return ret; … … 141 137 str_error(ret)); 142 138 ddf_fun_unbind(dsp_fun); 143 // TODO implanted data144 139 ddf_fun_destroy(dsp_fun); 145 140 return ret; … … 154 149 ddf_log_error("Failed to create mixer function."); 155 150 ddf_fun_unbind(dsp_fun); 156 // TODO implanted data157 151 ddf_fun_destroy(dsp_fun); 158 152 return ENOMEM; … … 163 157 str_error(ret)); 164 158 ddf_fun_unbind(dsp_fun); 165 // TODO implanted data166 159 ddf_fun_destroy(dsp_fun); 167 160 ddf_fun_destroy(mixer_fun); … … 171 164 ddf_log_note("Initialized mixer: %s.", 172 165 sb_mixer_type_str(sb->mixer.type)); 173 ddf_fun_data_implant(mixer_fun, &sb->mixer);174 166 ddf_fun_set_ops(mixer_fun, &sb_mixer_ops); 175 167 … … 178 170 ddf_log_error( 179 171 "Failed to bind mixer function: %s.", str_error(ret)); 180 // TODO implanted data181 172 ddf_fun_destroy(mixer_fun); 182 183 ddf_fun_unbind(dsp_fun); 184 // TODO implanted data 173 ddf_fun_unbind(dsp_fun); 185 174 ddf_fun_destroy(dsp_fun); 186 175 return ret;
Note:
See TracChangeset
for help on using the changeset viewer.