Changeset aae11d0 in mainline for uspace/drv/audio/sb16/pcm_iface.c


Ignore:
Timestamp:
2012-08-20T14:25:15Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c04ff9f
Parents:
6f57933
Message:

b16: Use helper function for fun→driver_data conversion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/sb16/pcm_iface.c

    r6f57933 raae11d0  
    4040#include "dsp.h"
    4141
     42static inline sb_dsp_t * fun_to_dsp(ddf_fun_t *fun)
     43{
     44        assert(fun);
     45        assert(fun->driver_data);
     46        return fun->driver_data;
     47}
     48
    4249static int sb_get_info_str(ddf_fun_t *fun, const char** name)
    4350{
     
    4956static unsigned sb_query_cap(ddf_fun_t *fun, audio_cap_t cap)
    5057{
    51         assert(fun);
    52         assert(fun->driver_data);
    53         sb_dsp_t *dsp = fun->driver_data;
    54         return sb_dsp_query_cap(dsp, cap);
     58        return sb_dsp_query_cap(fun_to_dsp(fun), cap);
    5559}
    5660
     
    5862    pcm_sample_format_t *format)
    5963{
    60         assert(fun);
    61         assert(fun->driver_data);
    62         sb_dsp_t *dsp = fun->driver_data;
    63         return sb_dsp_test_format(dsp, channels, rate, format);
     64        return sb_dsp_test_format(fun_to_dsp(fun), channels, rate, format);
    6465}
    6566static int sb_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
    6667{
    67         assert(fun);
    68         assert(fun->driver_data);
    69         sb_dsp_t *dsp = fun->driver_data;
    70         return sb_dsp_get_buffer(dsp, buffer, size);
     68        return sb_dsp_get_buffer(fun_to_dsp(fun), buffer, size);
    7169}
    7270
    7371static int sb_get_buffer_position(ddf_fun_t *fun, size_t *size)
    7472{
    75         assert(fun);
    76         assert(fun->driver_data);
    77         sb_dsp_t *dsp = fun->driver_data;
    78         return sb_dsp_get_buffer_position(dsp, size);
     73        return sb_dsp_get_buffer_position(fun_to_dsp(fun), size);
    7974}
    8075
    8176static int sb_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
    8277{
    83         assert(fun);
    84         assert(fun->driver_data);
    85         sb_dsp_t *dsp = fun->driver_data;
    86         return sb_dsp_set_event_session(dsp, sess);
     78        return sb_dsp_set_event_session(fun_to_dsp(fun), sess);
    8779}
    8880
    8981static async_sess_t * sb_get_event_session(ddf_fun_t *fun)
    9082{
    91         assert(fun);
    92         assert(fun->driver_data);
    93         sb_dsp_t *dsp = fun->driver_data;
    94         return sb_dsp_get_event_session(dsp);
     83        return sb_dsp_get_event_session(fun_to_dsp(fun));
    9584}
    9685
    9786static int sb_release_buffer(ddf_fun_t *fun)
    9887{
    99         assert(fun);
    100         assert(fun->driver_data);
    101         sb_dsp_t *dsp = fun->driver_data;
    102         return sb_dsp_release_buffer(dsp);
     88        return sb_dsp_release_buffer(fun_to_dsp(fun));
    10389}
    10490
     
    10692    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
    10793{
    108         assert(fun);
    109         assert(fun->driver_data);
    110         sb_dsp_t *dsp = fun->driver_data;
    11194        return sb_dsp_start_playback(
    112             dsp, frames, channels, sample_rate, format);
     95            fun_to_dsp(fun), frames, channels, sample_rate, format);
    11396}
    11497
    11598static int sb_stop_playback(ddf_fun_t *fun)
    11699{
    117         assert(fun);
    118         assert(fun->driver_data);
    119         sb_dsp_t *dsp = fun->driver_data;
    120         return sb_dsp_stop_playback(dsp);
     100        return sb_dsp_stop_playback(fun_to_dsp(fun));
    121101}
    122102
     
    124104    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
    125105{
    126         assert(fun);
    127         assert(fun->driver_data);
    128         sb_dsp_t *dsp = fun->driver_data;
    129106        return sb_dsp_start_capture(
    130             dsp, frames, channels, sample_rate, format);
     107            fun_to_dsp(fun), frames, channels, sample_rate, format);
    131108}
    132109
    133110static int sb_stop_capture(ddf_fun_t *fun)
    134111{
    135         assert(fun);
    136         assert(fun->driver_data);
    137         sb_dsp_t *dsp = fun->driver_data;
    138         return sb_dsp_stop_capture(dsp);
     112        return sb_dsp_stop_capture(fun_to_dsp(fun));
    139113}
    140114
Note: See TracChangeset for help on using the changeset viewer.