Changeset 984a9ba in mainline for uspace/lib/drv/generic/remote_audio_mixer.c
- Timestamp:
- 2018-07-05T09:34:09Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63d46341
- Parents:
- 76f566d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_audio_mixer.c
r76f566d r984a9ba 203 203 * SERVER SIDE 204 204 */ 205 static void remote_audio_mixer_get_info(ddf_fun_t *, void *, cap_call_handle_t,ipc_call_t *);206 static void remote_audio_mixer_get_item_info(ddf_fun_t *, void *, cap_call_handle_t,ipc_call_t *);207 static void remote_audio_mixer_get_item_level(ddf_fun_t *, void *, cap_call_handle_t,ipc_call_t *);208 static void remote_audio_mixer_set_item_level(ddf_fun_t *, void *, cap_call_handle_t,ipc_call_t *);205 static void remote_audio_mixer_get_info(ddf_fun_t *, void *, ipc_call_t *); 206 static void remote_audio_mixer_get_item_info(ddf_fun_t *, void *, ipc_call_t *); 207 static void remote_audio_mixer_get_item_level(ddf_fun_t *, void *, ipc_call_t *); 208 static void remote_audio_mixer_set_item_level(ddf_fun_t *, void *, ipc_call_t *); 209 209 210 210 /** Remote audio mixer interface operations. */ … … 222 222 }; 223 223 224 void remote_audio_mixer_get_info( 225 ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call) 224 void remote_audio_mixer_get_info(ddf_fun_t *fun, void *iface, ipc_call_t *icall) 226 225 { 227 226 audio_mixer_iface_t *mixer_iface = iface; 228 227 229 228 if (!mixer_iface->get_info) { 230 async_answer_0( chandle, ENOTSUP);229 async_answer_0(icall, ENOTSUP); 231 230 return; 232 231 } 232 233 233 const char *name = NULL; 234 234 unsigned items = 0; 235 235 const errno_t ret = mixer_iface->get_info(fun, &name, &items); 236 236 const size_t name_size = name ? str_size(name) + 1 : 0; 237 async_answer_2(chandle, ret, name_size, items); 237 async_answer_2(icall, ret, name_size, items); 238 238 239 /* Send the name. */ 239 240 if (ret == EOK && name_size > 0) { 241 ipc_call_t call; 240 242 size_t size; 241 cap_call_handle_t name_id; 242 if (!async_data_read_receive(&name_id, &size)) { 243 async_answer_0(name_id, EPARTY); 243 if (!async_data_read_receive(&call, &size)) { 244 async_answer_0(&call, EPARTY); 244 245 return; 245 246 } 247 246 248 if (size != name_size) { 247 async_answer_0( name_id, ELIMIT);249 async_answer_0(&call, ELIMIT); 248 250 return; 249 251 } 250 async_data_read_finalize(name_id, name, name_size); 251 } 252 } 253 254 void remote_audio_mixer_get_item_info( 255 ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call) 252 253 async_data_read_finalize(&call, name, name_size); 254 } 255 } 256 257 void remote_audio_mixer_get_item_info(ddf_fun_t *fun, void *iface, 258 ipc_call_t *icall) 256 259 { 257 260 audio_mixer_iface_t *mixer_iface = iface; 258 261 259 262 if (!mixer_iface->get_item_info) { 260 async_answer_0( chandle, ENOTSUP);263 async_answer_0(icall, ENOTSUP); 261 264 return; 262 265 } 263 266 264 const unsigned item = DEV_IPC_GET_ARG1(* call);267 const unsigned item = DEV_IPC_GET_ARG1(*icall); 265 268 const char *name = NULL; 266 269 unsigned values = 0; 267 270 const errno_t ret = mixer_iface->get_item_info(fun, item, &name, &values); 268 271 const size_t name_size = name ? str_size(name) + 1 : 0; 269 async_answer_2(chandle, ret, name_size, values); 272 async_answer_2(icall, ret, name_size, values); 273 270 274 /* Send the name. */ 271 275 if (ret == EOK && name_size > 0) { 276 ipc_call_t call; 272 277 size_t size; 273 cap_call_handle_t name_id; 274 if (!async_data_read_receive(&name_id, &size)) { 275 async_answer_0(name_id, EPARTY); 278 if (!async_data_read_receive(&call, &size)) { 279 async_answer_0(&call, EPARTY); 276 280 return; 277 281 } 282 278 283 if (size != name_size) { 279 async_answer_0( name_id, ELIMIT);284 async_answer_0(&call, ELIMIT); 280 285 return; 281 286 } 282 async_data_read_finalize(name_id, name, name_size); 283 } 284 } 285 286 void remote_audio_mixer_set_item_level( 287 ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call) 287 288 async_data_read_finalize(&call, name, name_size); 289 } 290 } 291 292 void remote_audio_mixer_set_item_level(ddf_fun_t *fun, void *iface, 293 ipc_call_t *icall) 288 294 { 289 295 audio_mixer_iface_t *mixer_iface = iface; 290 296 291 297 if (!mixer_iface->set_item_level) { 292 async_answer_0( chandle, ENOTSUP);298 async_answer_0(icall, ENOTSUP); 293 299 return; 294 300 } 295 const unsigned item = DEV_IPC_GET_ARG1(*call); 296 const unsigned value = DEV_IPC_GET_ARG2(*call); 301 302 const unsigned item = DEV_IPC_GET_ARG1(*icall); 303 const unsigned value = DEV_IPC_GET_ARG2(*icall); 297 304 const errno_t ret = mixer_iface->set_item_level(fun, item, value); 298 async_answer_0( chandle, ret);299 } 300 301 void remote_audio_mixer_get_item_level( 302 ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call)305 async_answer_0(icall, ret); 306 } 307 308 void remote_audio_mixer_get_item_level(ddf_fun_t *fun, void *iface, 309 ipc_call_t *icall) 303 310 { 304 311 audio_mixer_iface_t *mixer_iface = iface; 305 312 306 313 if (!mixer_iface->get_item_level) { 307 async_answer_0( chandle, ENOTSUP);314 async_answer_0(icall, ENOTSUP); 308 315 return; 309 316 } 310 const unsigned item = DEV_IPC_GET_ARG1(*call); 317 318 const unsigned item = DEV_IPC_GET_ARG1(*icall); 311 319 unsigned current = 0; 312 320 const errno_t ret = 313 321 mixer_iface->get_item_level(fun, item, ¤t); 314 async_answer_1( chandle, ret, current);322 async_answer_1(icall, ret, current); 315 323 } 316 324
Note:
See TracChangeset
for help on using the changeset viewer.