Ignore:
Timestamp:
2012-08-19T16:08:14Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1ba95ba
Parents:
d86c9736
Message:

libdrv: Add buffer position query.

Fix cap query:

Close exchange at the end.
Send query number instead of random value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_audio_pcm.c

    rd86c9736 rfa91c0f  
    4949        IPC_M_AUDIO_PCM_GET_BUFFER,
    5050        IPC_M_AUDIO_PCM_RELEASE_BUFFER,
     51        IPC_M_AUDIO_PCM_GET_BUFFER_POS,
    5152        IPC_M_AUDIO_PCM_START_PLAYBACK,
    5253        IPC_M_AUDIO_PCM_STOP_PLAYBACK,
     
    113114                return EINVAL;
    114115        async_exch_t *exch = async_exchange_begin(sess);
    115         sysarg_t value = *val;
     116        sysarg_t value = 0;
    116117        const int ret = async_req_2_1(exch,
    117118            DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_QUERY_CAPS,
    118             value, &value);
     119            cap, &value);
    119120        if (ret == EOK)
    120121                *val = value;
     122        async_exchange_end(exch);
     123        return ret;
     124}
     125
     126int audio_pcm_get_buffer_pos(audio_pcm_sess_t *sess, size_t *pos)
     127{
     128        if (!pos)
     129                return EINVAL;
     130        async_exch_t *exch = async_exchange_begin(sess);
     131        sysarg_t value = 0;;
     132        const int ret = async_req_1_1(exch,
     133            DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
     134            IPC_M_AUDIO_PCM_GET_BUFFER_POS, &value);
     135        if (ret == EOK)
     136                *pos = value;
     137        async_exchange_end(exch);
    121138        return ret;
    122139}
     
    248265static void remote_audio_pcm_get_info_str(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    249266static void remote_audio_pcm_query_caps(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     267static void remote_audio_pcm_get_buffer_pos(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    250268static void remote_audio_pcm_test_format(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    251269static void remote_audio_pcm_get_buffer(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    260278        [IPC_M_AUDIO_PCM_GET_INFO_STR] = remote_audio_pcm_get_info_str,
    261279        [IPC_M_AUDIO_PCM_QUERY_CAPS] = remote_audio_pcm_query_caps,
     280        [IPC_M_AUDIO_PCM_GET_BUFFER_POS] = remote_audio_pcm_get_buffer_pos,
    262281        [IPC_M_AUDIO_PCM_TEST_FORMAT] = remote_audio_pcm_test_format,
    263282        [IPC_M_AUDIO_PCM_GET_BUFFER] = remote_audio_pcm_get_buffer,
     
    315334                async_answer_0(callid, ENOTSUP);
    316335        }
     336}
     337void remote_audio_pcm_get_buffer_pos(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
     338{
     339        const audio_pcm_iface_t *pcm_iface = iface;
     340        size_t pos = 0;
     341        const int ret = pcm_iface->get_buffer_pos ?
     342            pcm_iface->get_buffer_pos(fun, &pos) : ENOTSUP;
     343        async_answer_1(callid, ret, pos);
    317344}
    318345
Note: See TracChangeset for help on using the changeset viewer.