Changeset b7fd2a0 in mainline for uspace/drv/audio


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

Location:
uspace/drv/audio
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/hdaudio/codec.c

    r36f0738 rb7fd2a0  
    4646#include "stream.h"
    4747
    48 static int hda_ccmd(hda_codec_t *codec, int node, uint32_t vid, uint32_t payload,
     48static errno_t hda_ccmd(hda_codec_t *codec, int node, uint32_t vid, uint32_t payload,
    4949    uint32_t *resp)
    5050{
     
    6666                    (payload & 0xffff);
    6767        }
    68         int rc = hda_cmd(codec->hda, verb, resp);
     68        errno_t rc = hda_cmd(codec->hda, verb, resp);
    6969/*
    7070        if (resp != NULL) {
     
    7878}
    7979
    80 static int hda_get_parameter(hda_codec_t *codec, int node, hda_param_id_t param,
     80static errno_t hda_get_parameter(hda_codec_t *codec, int node, hda_param_id_t param,
    8181    uint32_t *resp)
    8282{
     
    8484}
    8585
    86 static int hda_get_subnc(hda_codec_t *codec, int node, int *startnode,
     86static errno_t hda_get_subnc(hda_codec_t *codec, int node, int *startnode,
    8787    int *nodecount)
    8888{
    89         int rc;
     89        errno_t rc;
    9090        uint32_t resp;
    9191
     
    103103
    104104/** Get Function Group Type */
    105 static int hda_get_fgrp_type(hda_codec_t *codec, int node, bool *unsol,
     105static errno_t hda_get_fgrp_type(hda_codec_t *codec, int node, bool *unsol,
    106106    hda_fgrp_type_t *type)
    107107{
    108         int rc;
     108        errno_t rc;
    109109        uint32_t resp;
    110110
     
    119119}
    120120
    121 static int hda_get_clist_len(hda_codec_t *codec, int node, bool *longform,
     121static errno_t hda_get_clist_len(hda_codec_t *codec, int node, bool *longform,
    122122    int *items)
    123123{
    124         int rc;
     124        errno_t rc;
    125125        uint32_t resp;
    126126
     
    135135}
    136136
    137 static int hda_get_clist_entry(hda_codec_t *codec, int node, int n, uint32_t *resp)
     137static errno_t hda_get_clist_entry(hda_codec_t *codec, int node, int n, uint32_t *resp)
    138138{
    139139        return hda_ccmd(codec, node, hda_clist_entry_get, n, resp);
    140140}
    141141
    142 static int hda_get_eapd_btl_enable(hda_codec_t *codec, int node, uint32_t *resp)
     142static errno_t hda_get_eapd_btl_enable(hda_codec_t *codec, int node, uint32_t *resp)
    143143{
    144144        return hda_ccmd(codec, node, hda_eapd_btl_enable_get, 0, resp);
    145145}
    146146
    147 static int hda_set_eapd_btl_enable(hda_codec_t *codec, int node, uint8_t payload)
     147static errno_t hda_set_eapd_btl_enable(hda_codec_t *codec, int node, uint8_t payload)
    148148{
    149149        return hda_ccmd(codec, node, hda_eapd_btl_enable_set, payload, NULL);
     
    151151
    152152/** Get Suppported PCM Size, Rates */
    153 static int hda_get_supp_rates(hda_codec_t *codec, int node, uint32_t *rates)
     153static errno_t hda_get_supp_rates(hda_codec_t *codec, int node, uint32_t *rates)
    154154{
    155155        return hda_get_parameter(codec, node, hda_supp_rates, rates);
     
    157157
    158158/** Get Suppported Stream Formats */
    159 static int hda_get_supp_formats(hda_codec_t *codec, int node, uint32_t *fmts)
     159static errno_t hda_get_supp_formats(hda_codec_t *codec, int node, uint32_t *fmts)
    160160{
    161161        return hda_get_parameter(codec, node, hda_supp_formats, fmts);
    162162}
    163163
    164 static int hda_set_converter_fmt(hda_codec_t *codec, int node, uint16_t fmt)
     164static errno_t hda_set_converter_fmt(hda_codec_t *codec, int node, uint16_t fmt)
    165165{
    166166        return hda_ccmd(codec, node, hda_converter_fmt_set, fmt, NULL);
    167167}
    168168
    169 static int hda_set_converter_ctl(hda_codec_t *codec, int node, uint8_t stream,
     169static errno_t hda_set_converter_ctl(hda_codec_t *codec, int node, uint8_t stream,
    170170    uint8_t channel)
    171171{
     
    176176}
    177177
    178 static int hda_set_pin_ctl(hda_codec_t *codec, int node, uint8_t pctl)
     178static errno_t hda_set_pin_ctl(hda_codec_t *codec, int node, uint8_t pctl)
    179179{
    180180        return hda_ccmd(codec, node, hda_pin_ctl_set, pctl, NULL);
    181181}
    182182
    183 static int hda_get_pin_ctl(hda_codec_t *codec, int node, uint8_t *pctl)
    184 {
    185         int rc;
     183static errno_t hda_get_pin_ctl(hda_codec_t *codec, int node, uint8_t *pctl)
     184{
     185        errno_t rc;
    186186        uint32_t resp;
    187187
     
    195195
    196196/** Get Audio Widget Capabilities */
    197 static int hda_get_aw_caps(hda_codec_t *codec, int node,
     197static errno_t hda_get_aw_caps(hda_codec_t *codec, int node,
    198198    hda_awidget_type_t *type, uint32_t *caps)
    199199{
    200         int rc;
     200        errno_t rc;
    201201        uint32_t resp;
    202202
     
    212212
    213213/** Get Pin Capabilities */
    214 static int hda_get_pin_caps(hda_codec_t *codec, int node, uint32_t *caps)
     214static errno_t hda_get_pin_caps(hda_codec_t *codec, int node, uint32_t *caps)
    215215{
    216216        return hda_get_parameter(codec, node, hda_pin_caps, caps);
     
    218218
    219219/** Get Power State */
    220 static int hda_get_power_state(hda_codec_t *codec, int node, uint32_t *pstate)
     220static errno_t hda_get_power_state(hda_codec_t *codec, int node, uint32_t *pstate)
    221221{
    222222        return hda_ccmd(codec, node, hda_power_state_get, 0, pstate);
     
    224224
    225225/** Get Configuration Default */
    226 static int hda_get_cfg_def(hda_codec_t *codec, int node, uint32_t *cfgdef)
     226static errno_t hda_get_cfg_def(hda_codec_t *codec, int node, uint32_t *cfgdef)
    227227{
    228228        return hda_ccmd(codec, node, hda_cfg_def_get, 0, cfgdef);
    229229}
    230230
    231 static int hda_get_conn_sel(hda_codec_t *codec, int node, uint32_t *conn)
     231static errno_t hda_get_conn_sel(hda_codec_t *codec, int node, uint32_t *conn)
    232232{
    233233        return hda_ccmd(codec, node, hda_conn_sel_get, 0, conn);
     
    235235
    236236/** Get Amplifier Gain / Mute  */
    237 static int hda_get_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload,
     237static errno_t hda_get_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload,
    238238    uint32_t *resp)
    239239{
    240240//      ddf_msg(LVL_NOTE, "hda_get_amp_gain_mute(codec, %d, %x)",
    241241//          node, payload);
    242         int rc = hda_ccmd(codec, node, hda_amp_gain_mute_get, payload, resp);
     242        errno_t rc = hda_ccmd(codec, node, hda_amp_gain_mute_get, payload, resp);
    243243//      ddf_msg(LVL_NOTE, "hda_get_amp_gain_mute(codec, %d, %x, resp=%x)",
    244244//          node, payload, *resp);
     
    247247
    248248/** Get GP I/O Count */
    249 static int hda_get_gpio_cnt(hda_codec_t *codec, int node, uint32_t *resp)
     249static errno_t hda_get_gpio_cnt(hda_codec_t *codec, int node, uint32_t *resp)
    250250{
    251251        return hda_get_parameter(codec, node, hda_gpio_cnt, resp);
    252252}
    253253
    254 static int hda_set_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload)
     254static errno_t hda_set_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload)
    255255{
    256256//      ddf_msg(LVL_NOTE, "hda_set_amp_gain_mute(codec, %d, %x)",
     
    259259}
    260260
    261 static int hda_set_out_amp_max(hda_codec_t *codec, uint8_t aw)
     261static errno_t hda_set_out_amp_max(hda_codec_t *codec, uint8_t aw)
    262262{
    263263        uint32_t ampcaps;
    264264        uint32_t gmleft, gmright;
    265265        uint32_t offset;
    266         int rc;
     266        errno_t rc;
    267267
    268268        rc = hda_get_parameter(codec, aw,
     
    294294}
    295295
    296 static int hda_set_in_amp_max(hda_codec_t *codec, uint8_t aw)
     296static errno_t hda_set_in_amp_max(hda_codec_t *codec, uint8_t aw)
    297297{
    298298        uint32_t ampcaps;
     
    300300        uint32_t offset;
    301301        int i;
    302         int rc;
     302        errno_t rc;
    303303
    304304        rc = hda_get_parameter(codec, aw,
     
    332332}
    333333
    334 static int hda_clist_dump(hda_codec_t *codec, uint8_t aw)
    335 {
    336         int rc;
     334static errno_t hda_clist_dump(hda_codec_t *codec, uint8_t aw)
     335{
     336        errno_t rc;
    337337        bool longform;
    338338        int len;
     
    394394}
    395395
    396 static int hda_pin_init(hda_codec_t *codec, uint8_t aw)
    397 {
    398         int rc;
     396static errno_t hda_pin_init(hda_codec_t *codec, uint8_t aw)
     397{
     398        errno_t rc;
    399399        uint32_t cfgdef;
    400400        uint32_t pcaps;
     
    471471
    472472/** Init power-control in wiget capable of doing so. */
    473 static int hda_power_ctl_init(hda_codec_t *codec, uint8_t aw)
    474 {
    475         int rc;
     473static errno_t hda_power_ctl_init(hda_codec_t *codec, uint8_t aw)
     474{
     475        errno_t rc;
    476476        uint32_t pwrstate;
    477477
     
    491491{
    492492        hda_codec_t *codec;
    493         int rc;
     493        errno_t rc;
    494494        int sfg, nfg;
    495495        int saw, naw;
     
    639639}
    640640
    641 int hda_out_converter_setup(hda_codec_t *codec, hda_stream_t *stream)
    642 {
    643         int rc;
     641errno_t hda_out_converter_setup(hda_codec_t *codec, hda_stream_t *stream)
     642{
     643        errno_t rc;
    644644        int out_aw;
    645645        int i;
     
    666666}
    667667
    668 int hda_in_converter_setup(hda_codec_t *codec, hda_stream_t *stream)
    669 {
    670         int rc;
     668errno_t hda_in_converter_setup(hda_codec_t *codec, hda_stream_t *stream)
     669{
     670        errno_t rc;
    671671
    672672        /* Configure converter */
  • uspace/drv/audio/hdaudio/codec.h

    r36f0738 rb7fd2a0  
    5252extern hda_codec_t *hda_codec_init(hda_t *, uint8_t);
    5353extern void hda_codec_fini(hda_codec_t *);
    54 extern int hda_out_converter_setup(hda_codec_t *, hda_stream_t *);
    55 extern int hda_in_converter_setup(hda_codec_t *, hda_stream_t *);
     54extern errno_t hda_out_converter_setup(hda_codec_t *, hda_stream_t *);
     55extern errno_t hda_in_converter_setup(hda_codec_t *, hda_stream_t *);
    5656
    5757#endif
  • uspace/drv/audio/hdaudio/hdactl.c

    r36f0738 rb7fd2a0  
    6464 * to read as 0.
    6565 */
    66 static int hda_ctl_reg16_set_reset(uint16_t *reg, uint16_t mask)
     66static errno_t hda_ctl_reg16_set_reset(uint16_t *reg, uint16_t mask)
    6767{
    6868        uint16_t val;
     
    116116 *
    117117 */
    118 static int hda_rb_size_select(uint8_t sizecap, uint8_t *selsz)
     118static errno_t hda_rb_size_select(uint8_t sizecap, uint8_t *selsz)
    119119{
    120120        int i;
     
    146146
    147147/** Initialize the CORB */
    148 static int hda_corb_init(hda_t *hda)
     148static errno_t hda_corb_init(hda_t *hda)
    149149{
    150150        uint8_t ctl;
     
    152152        uint8_t sizecap;
    153153        uint8_t selsz;
    154         int rc;
     154        errno_t rc;
    155155
    156156        ddf_msg(LVL_NOTE, "hda_corb_init()");
     
    237237
    238238/** Initialize the RIRB */
    239 static int hda_rirb_init(hda_t *hda)
     239static errno_t hda_rirb_init(hda_t *hda)
    240240{
    241241        uint8_t ctl;
     
    243243        uint8_t sizecap;
    244244        uint8_t selsz;
    245         int rc;
     245        errno_t rc;
    246246
    247247        ddf_msg(LVL_NOTE, "hda_rirb_init()");
     
    372372
    373373/** Write to CORB */
    374 static int hda_corb_write(hda_t *hda, uint32_t *data, size_t count)
     374static errno_t hda_corb_write(hda_t *hda, uint32_t *data, size_t count)
    375375{
    376376        size_t avail;
     
    414414}
    415415
    416 static int hda_rirb_read(hda_t *hda, hda_rirb_entry_t *data)
     416static errno_t hda_rirb_read(hda_t *hda, hda_rirb_entry_t *data)
    417417{
    418418        size_t wp;
     
    436436}
    437437
    438 static int hda_solrb_read(hda_t *hda, hda_rirb_entry_t *data, size_t count)
     438static errno_t hda_solrb_read(hda_t *hda, hda_rirb_entry_t *data, size_t count)
    439439{
    440440        hda_rirb_entry_t resp;
     
    490490        uint32_t intctl;
    491491        int cnt;
    492         int rc;
     492        errno_t rc;
    493493
    494494        ctl = calloc(1, sizeof(hda_ctl_t));
     
    615615}
    616616
    617 int hda_cmd(hda_t *hda, uint32_t verb, uint32_t *resp)
    618 {
    619         int rc;
     617errno_t hda_cmd(hda_t *hda, uint32_t verb, uint32_t *resp)
     618{
     619        errno_t rc;
    620620        hda_rirb_entry_t rentry;
    621621
     
    639639{
    640640        hda_rirb_entry_t resp;
    641         int rc;
     641        errno_t rc;
    642642
    643643        while (true) {
  • uspace/drv/audio/hdaudio/hdactl.h

    r36f0738 rb7fd2a0  
    7878extern void hda_ctl_fini(hda_ctl_t *);
    7979extern void hda_ctl_interrupt(hda_ctl_t *);
    80 extern int hda_cmd(hda_t *, uint32_t, uint32_t *);
     80extern errno_t hda_cmd(hda_t *, uint32_t, uint32_t *);
    8181extern void hda_ctl_dump_info(hda_ctl_t *);
    8282
  • uspace/drv/audio/hdaudio/hdaudio.c

    r36f0738 rb7fd2a0  
    5252#define NAME "hdaudio"
    5353
    54 static int hda_dev_add(ddf_dev_t *dev);
    55 static int hda_dev_remove(ddf_dev_t *dev);
    56 static int hda_dev_gone(ddf_dev_t *dev);
    57 static int hda_fun_online(ddf_fun_t *fun);
    58 static int hda_fun_offline(ddf_fun_t *fun);
     54static errno_t hda_dev_add(ddf_dev_t *dev);
     55static errno_t hda_dev_remove(ddf_dev_t *dev);
     56static errno_t hda_dev_gone(ddf_dev_t *dev);
     57static errno_t hda_fun_online(ddf_fun_t *fun);
     58static errno_t hda_fun_offline(ddf_fun_t *fun);
    5959
    6060static void hdaudio_interrupt(ipc_call_t *, ddf_dev_t *);
     
    148148};
    149149
    150 static int hda_dev_add(ddf_dev_t *dev)
     150static errno_t hda_dev_add(ddf_dev_t *dev)
    151151{
    152152        ddf_fun_t *fun_pcm = NULL;
     
    160160        int i;
    161161        void *regs = NULL;
    162         int rc;
     162        errno_t rc;
    163163
    164164        ddf_msg(LVL_NOTE, "hda_dev_add()");
     
    318318}
    319319
    320 static int hda_dev_remove(ddf_dev_t *dev)
     320static errno_t hda_dev_remove(ddf_dev_t *dev)
    321321{
    322322        hda_t *hda = (hda_t *)ddf_dev_data_get(dev);
    323         int rc;
     323        errno_t rc;
    324324
    325325        ddf_msg(LVL_DEBUG, "hda_dev_remove(%p)", dev);
     
    340340}
    341341
    342 static int hda_dev_gone(ddf_dev_t *dev)
     342static errno_t hda_dev_gone(ddf_dev_t *dev)
    343343{
    344344        hda_t *hda = (hda_t *)ddf_dev_data_get(dev);
    345         int rc;
     345        errno_t rc;
    346346
    347347        ddf_msg(LVL_DEBUG, "hda_dev_remove(%p)", dev);
     
    356356}
    357357
    358 static int hda_fun_online(ddf_fun_t *fun)
     358static errno_t hda_fun_online(ddf_fun_t *fun)
    359359{
    360360        ddf_msg(LVL_DEBUG, "hda_fun_online()");
     
    362362}
    363363
    364 static int hda_fun_offline(ddf_fun_t *fun)
     364static errno_t hda_fun_offline(ddf_fun_t *fun)
    365365{
    366366        ddf_msg(LVL_DEBUG, "hda_fun_offline()");
  • uspace/drv/audio/hdaudio/pcm_iface.c

    r36f0738 rb7fd2a0  
    4747#include "stream.h"
    4848
    49 static int hda_get_info_str(ddf_fun_t *, const char **);
     49static errno_t hda_get_info_str(ddf_fun_t *, const char **);
    5050static unsigned hda_query_cap(ddf_fun_t *, audio_cap_t);
    51 static int hda_test_format(ddf_fun_t *, unsigned *, unsigned *,
     51static errno_t hda_test_format(ddf_fun_t *, unsigned *, unsigned *,
    5252    pcm_sample_format_t *);
    53 static int hda_get_buffer(ddf_fun_t *, void **, size_t *);
    54 static int hda_get_buffer_position(ddf_fun_t *, size_t *);
    55 static int hda_set_event_session(ddf_fun_t *, async_sess_t *);
     53static errno_t hda_get_buffer(ddf_fun_t *, void **, size_t *);
     54static errno_t hda_get_buffer_position(ddf_fun_t *, size_t *);
     55static errno_t hda_set_event_session(ddf_fun_t *, async_sess_t *);
    5656static async_sess_t *hda_get_event_session(ddf_fun_t *);
    57 static int hda_release_buffer(ddf_fun_t *);
    58 static int hda_start_playback(ddf_fun_t *, unsigned, unsigned, unsigned,
     57static errno_t hda_release_buffer(ddf_fun_t *);
     58static errno_t hda_start_playback(ddf_fun_t *, unsigned, unsigned, unsigned,
    5959    pcm_sample_format_t);
    60 static int hda_stop_playback(ddf_fun_t *, bool);
    61 static int hda_start_capture(ddf_fun_t *, unsigned, unsigned, unsigned,
     60static errno_t hda_stop_playback(ddf_fun_t *, bool);
     61static errno_t hda_start_capture(ddf_fun_t *, unsigned, unsigned, unsigned,
    6262    pcm_sample_format_t);
    63 static int hda_stop_capture(ddf_fun_t *, bool);
     63static errno_t hda_stop_capture(ddf_fun_t *, bool);
    6464
    6565audio_pcm_iface_t hda_pcm_iface = {
     
    9090}
    9191
    92 static int hda_get_info_str(ddf_fun_t *fun, const char **name)
     92static errno_t hda_get_info_str(ddf_fun_t *fun, const char **name)
    9393{
    9494        ddf_msg(LVL_NOTE, "hda_get_info_str()");
     
    124124}
    125125
    126 static int hda_test_format(ddf_fun_t *fun, unsigned *channels,
     126static errno_t hda_test_format(ddf_fun_t *fun, unsigned *channels,
    127127    unsigned *rate, pcm_sample_format_t *format)
    128128{
    129         int rc = EOK;
     129        errno_t rc = EOK;
    130130
    131131        ddf_msg(LVL_NOTE, "hda_test_format(%u, %u, %d)\n",
     
    150150}
    151151
    152 static int hda_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
    153 {
    154         hda_t *hda = fun_to_hda(fun);
    155         int rc;
     152static errno_t hda_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
     153{
     154        hda_t *hda = fun_to_hda(fun);
     155        errno_t rc;
    156156
    157157        hda_lock(hda);
     
    183183}
    184184
    185 static int hda_get_buffer_position(ddf_fun_t *fun, size_t *pos)
     185static errno_t hda_get_buffer_position(ddf_fun_t *fun, size_t *pos)
    186186{
    187187        ddf_msg(LVL_NOTE, "hda_get_buffer_position()");
     
    189189}
    190190
    191 static int hda_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
     191static errno_t hda_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
    192192{
    193193        hda_t *hda = fun_to_hda(fun);
     
    215215}
    216216
    217 static int hda_release_buffer(ddf_fun_t *fun)
     217static errno_t hda_release_buffer(ddf_fun_t *fun)
    218218{
    219219        hda_t *hda = fun_to_hda(fun);
     
    234234}
    235235
    236 static int hda_start_playback(ddf_fun_t *fun, unsigned frames,
     236static errno_t hda_start_playback(ddf_fun_t *fun, unsigned frames,
    237237    unsigned channels, unsigned rate, pcm_sample_format_t format)
    238238{
    239239        hda_t *hda = fun_to_hda(fun);
    240         int rc;
     240        errno_t rc;
    241241
    242242        ddf_msg(LVL_NOTE, "hda_start_playback()");
     
    275275}
    276276
    277 static int hda_stop_playback(ddf_fun_t *fun, bool immediate)
     277static errno_t hda_stop_playback(ddf_fun_t *fun, bool immediate)
    278278{
    279279        hda_t *hda = fun_to_hda(fun);
     
    293293}
    294294
    295 static int hda_start_capture(ddf_fun_t *fun, unsigned frames, unsigned channels,
     295static errno_t hda_start_capture(ddf_fun_t *fun, unsigned frames, unsigned channels,
    296296    unsigned rate, pcm_sample_format_t format)
    297297{
    298298        hda_t *hda = fun_to_hda(fun);
    299         int rc;
     299        errno_t rc;
    300300
    301301        ddf_msg(LVL_NOTE, "hda_start_capture()");
     
    334334}
    335335
    336 static int hda_stop_capture(ddf_fun_t *fun, bool immediate)
     336static errno_t hda_stop_capture(ddf_fun_t *fun, bool immediate)
    337337{
    338338        hda_t *hda = fun_to_hda(fun);
  • uspace/drv/audio/hdaudio/stream.c

    r36f0738 rb7fd2a0  
    4949#include "stream.h"
    5050
    51 int hda_stream_buffers_alloc(hda_t *hda, hda_stream_buffers_t **rbufs)
     51errno_t hda_stream_buffers_alloc(hda_t *hda, hda_stream_buffers_t **rbufs)
    5252{
    5353        void *bdl;
     
    5757        size_t i;
    5858//      size_t j, k;
    59         int rc;
     59        errno_t rc;
    6060
    6161        bufs = calloc(1, sizeof(hda_stream_buffers_t));
  • uspace/drv/audio/hdaudio/stream.h

    r36f0738 rb7fd2a0  
    7777} hda_stream_t;
    7878
    79 extern int hda_stream_buffers_alloc(hda_t *, hda_stream_buffers_t **);
     79extern errno_t hda_stream_buffers_alloc(hda_t *, hda_stream_buffers_t **);
    8080extern void hda_stream_buffers_free(hda_stream_buffers_t *);
    8181extern hda_stream_t *hda_stream_create(hda_t *, hda_stream_dir_t,
  • uspace/drv/audio/sb16/dsp.c

    r36f0738 rb7fd2a0  
    8989}
    9090
    91 static inline int dsp_read(sb_dsp_t *dsp, uint8_t *data)
     91static inline errno_t dsp_read(sb_dsp_t *dsp, uint8_t *data)
    9292{
    9393        assert(data);
     
    106106}
    107107
    108 static inline int dsp_write(sb_dsp_t *dsp, uint8_t data)
     108static inline errno_t dsp_write(sb_dsp_t *dsp, uint8_t data)
    109109{
    110110        assert(dsp);
     
    159159}
    160160
    161 static inline int setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)
     161static inline errno_t setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)
    162162{
    163163        async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev);
     
    168168}
    169169
    170 static inline int setup_buffer(sb_dsp_t *dsp, size_t size)
     170static inline errno_t setup_buffer(sb_dsp_t *dsp, size_t size)
    171171{
    172172        assert(dsp);
     
    178178        void *buffer = AS_AREA_ANY;
    179179       
    180         int ret = dmamem_map_anonymous(size, DMAMEM_16MiB | 0x0000ffff,
     180        errno_t ret = dmamem_map_anonymous(size, DMAMEM_16MiB | 0x0000ffff,
    181181            AS_AREA_WRITE | AS_AREA_READ, 0, &pa, &buffer);
    182182        if (ret != EOK) {
     
    202202}
    203203
    204 int sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
     204errno_t sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
    205205    int dma8, int dma16)
    206206{
     
    215215        dsp_reset(dsp);
    216216        uint8_t response;
    217         const int ret = dsp_read(dsp, &response);
     217        const errno_t ret = dsp_read(dsp, &response);
    218218        if (ret != EOK) {
    219219                ddf_log_error("Failed to read DSP reset response value.");
     
    294294}
    295295
    296 int sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *pos)
     296errno_t sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *pos)
    297297{
    298298        if (dsp->state == DSP_NO_BUFFER)
     
    304304        // TODO: Assumes DMA 16
    305305        size_t remain;
    306         int rc = hw_res_dma_channel_remain(sess, dsp->dma16_channel, &remain);
     306        errno_t rc = hw_res_dma_channel_remain(sess, dsp->dma16_channel, &remain);
    307307        if (rc == EOK) {
    308308                *pos = dsp->buffer.size - remain;
     
    311311}
    312312
    313 int sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
     313errno_t sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
    314314  pcm_sample_format_t *format)
    315315{
    316         int ret = EOK;
     316        errno_t ret = EOK;
    317317        if (*channels == 0 || *channels > 2) {
    318318                *channels = 2;
     
    336336}
    337337
    338 int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session)
     338errno_t sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session)
    339339{
    340340        assert(dsp);
     
    353353}
    354354
    355 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size)
     355errno_t sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size)
    356356{
    357357        assert(dsp);
     
    364364        assert(dsp->buffer.data == NULL);
    365365
    366         const int ret = setup_buffer(dsp, *size);
     366        const errno_t ret = setup_buffer(dsp, *size);
    367367        if (ret == EOK) {
    368368                ddf_log_debug("Providing buffer: %p, %zu B.",
     
    378378}
    379379
    380 int sb_dsp_release_buffer(sb_dsp_t *dsp)
     380errno_t sb_dsp_release_buffer(sb_dsp_t *dsp)
    381381{
    382382        assert(dsp);
     
    392392}
    393393
    394 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
     394errno_t sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
    395395    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
    396396{
     
    441441}
    442442
    443 int sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate)
     443errno_t sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate)
    444444{
    445445        assert(dsp);
     
    471471}
    472472
    473 int sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
     473errno_t sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
    474474    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
    475475{
     
    517517}
    518518
    519 int sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate)
     519errno_t sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate)
    520520{
    521521        assert(dsp);
  • uspace/drv/audio/sb16/dsp.h

    r36f0738 rb7fd2a0  
    7676} sb_dsp_t;
    7777
    78 int sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
     78errno_t sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
    7979    int dma8, int dma16);
    8080void sb_dsp_interrupt(sb_dsp_t *dsp);
    8181unsigned sb_dsp_query_cap(sb_dsp_t *dsp, audio_cap_t cap);
    82 int sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *size);
    83 int sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
     82errno_t sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *size);
     83errno_t sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
    8484  pcm_sample_format_t *format);
    85 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size);
    86 int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session);
     85errno_t sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size);
     86errno_t sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session);
    8787async_sess_t * sb_dsp_get_event_session(sb_dsp_t *dsp);
    88 int sb_dsp_release_buffer(sb_dsp_t *dsp);
    89 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
     88errno_t sb_dsp_release_buffer(sb_dsp_t *dsp);
     89errno_t sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
    9090    unsigned channels, unsigned sample_rate, pcm_sample_format_t format);
    91 int sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate);
    92 int sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
     91errno_t sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate);
     92errno_t sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
    9393    unsigned channels, unsigned sample_rate, pcm_sample_format_t format);
    94 int sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate);
     94errno_t sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate);
    9595
    9696#endif
  • uspace/drv/audio/sb16/main.c

    r36f0738 rb7fd2a0  
    4747#define NAME "sb16"
    4848
    49 static int sb_add_device(ddf_dev_t *device);
    50 static int sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
     49static errno_t sb_add_device(ddf_dev_t *device);
     50static errno_t sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
    5151    addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16);
    52 static int sb_enable_interrupt(ddf_dev_t *device, int irq);
     52static errno_t sb_enable_interrupt(ddf_dev_t *device, int irq);
    5353
    5454static driver_ops_t sb_driver_ops = {
     
    8787 * @return Error code.
    8888 */
    89 static int sb_add_device(ddf_dev_t *device)
     89static errno_t sb_add_device(ddf_dev_t *device)
    9090{
    9191        bool handler_regd = false;
     
    9696
    9797        sb16_t *soft_state = ddf_dev_data_alloc(device, sizeof(sb16_t));
    98         int rc = soft_state ? EOK : ENOMEM;
     98        errno_t rc = soft_state ? EOK : ENOMEM;
    9999        if (rc != EOK) {
    100100                ddf_log_error("Failed to allocate sb16 structure.");
     
    173173}
    174174
    175 static int sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
     175static errno_t sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
    176176    addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16)
    177177{
     
    184184        hw_res_list_parsed_t hw_res;
    185185        hw_res_list_parsed_init(&hw_res);
    186         const int ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
     186        const errno_t ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
    187187        if (ret != EOK) {
    188188                return ret;
     
    241241}
    242242
    243 static int sb_enable_interrupt(ddf_dev_t *device, int irq)
     243static errno_t sb_enable_interrupt(ddf_dev_t *device, int irq)
    244244{
    245245        async_sess_t *parent_sess = ddf_dev_parent_sess_get(device);
  • uspace/drv/audio/sb16/mixer.c

    r36f0738 rb7fd2a0  
    123123}
    124124
    125 int sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type)
     125errno_t sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type)
    126126{
    127127        assert(mixer);
     
    149149}
    150150
    151 int sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned item,
     151errno_t sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned item,
    152152    const char** name, unsigned *levels)
    153153{
     
    171171 * @return Error code.
    172172 */
    173 int sb_mixer_get_control_item_value(const sb_mixer_t *mixer, unsigned item,
     173errno_t sb_mixer_get_control_item_value(const sb_mixer_t *mixer, unsigned item,
    174174    unsigned *value)
    175175{
     
    194194 * @return Error code.
    195195 */
    196 int sb_mixer_set_control_item_value(const sb_mixer_t *mixer, unsigned item,
     196errno_t sb_mixer_set_control_item_value(const sb_mixer_t *mixer, unsigned item,
    197197    unsigned value)
    198198{
  • uspace/drv/audio/sb16/mixer.h

    r36f0738 rb7fd2a0  
    5151
    5252const char * sb_mixer_type_str(sb_mixer_type_t type);
    53 int sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type);
     53errno_t sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type);
    5454int sb_mixer_get_control_item_count(const sb_mixer_t *mixer);
    55 int sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned index,
     55errno_t sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned index,
    5656    const char **name, unsigned *levels);
    57 int sb_mixer_get_control_item_value(const sb_mixer_t *mixer, unsigned index,
     57errno_t sb_mixer_get_control_item_value(const sb_mixer_t *mixer, unsigned index,
    5858    unsigned *value);
    59 int sb_mixer_set_control_item_value(const sb_mixer_t *mixer, unsigned index,
     59errno_t sb_mixer_set_control_item_value(const sb_mixer_t *mixer, unsigned index,
    6060    unsigned value);
    6161#endif
  • uspace/drv/audio/sb16/mixer_iface.c

    r36f0738 rb7fd2a0  
    4646}
    4747
    48 static int sb_get_info(ddf_fun_t *fun, const char** name, unsigned *items)
     48static errno_t sb_get_info(ddf_fun_t *fun, const char** name, unsigned *items)
    4949{
    5050        sb_mixer_t *mixer = fun_to_mixer(fun);
     
    5858}
    5959
    60 static int sb_get_item_info(ddf_fun_t *fun, unsigned item, const char** name,
     60static errno_t sb_get_item_info(ddf_fun_t *fun, unsigned item, const char** name,
    6161    unsigned *max_level)
    6262{
     
    6565}
    6666
    67 static int sb_set_item_level(ddf_fun_t *fun, unsigned item, unsigned value)
     67static errno_t sb_set_item_level(ddf_fun_t *fun, unsigned item, unsigned value)
    6868{
    6969        sb_mixer_t *mixer = fun_to_mixer(fun);
     
    7171}
    7272
    73 static int sb_get_item_level(ddf_fun_t *fun, unsigned item, unsigned *value)
     73static errno_t sb_get_item_level(ddf_fun_t *fun, unsigned item, unsigned *value)
    7474{
    7575        sb_mixer_t *mixer = fun_to_mixer(fun);
  • uspace/drv/audio/sb16/pcm_iface.c

    r36f0738 rb7fd2a0  
    4747}
    4848
    49 static int sb_get_info_str(ddf_fun_t *fun, const char** name)
     49static errno_t sb_get_info_str(ddf_fun_t *fun, const char** name)
    5050{
    5151        if (name)
     
    5959}
    6060
    61 static int sb_test_format(ddf_fun_t *fun, unsigned *channels, unsigned *rate,
     61static errno_t sb_test_format(ddf_fun_t *fun, unsigned *channels, unsigned *rate,
    6262    pcm_sample_format_t *format)
    6363{
    6464        return sb_dsp_test_format(fun_to_dsp(fun), channels, rate, format);
    6565}
    66 static int sb_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
     66static errno_t sb_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
    6767{
    6868        return sb_dsp_get_buffer(fun_to_dsp(fun), buffer, size);
    6969}
    7070
    71 static int sb_get_buffer_position(ddf_fun_t *fun, size_t *size)
     71static errno_t sb_get_buffer_position(ddf_fun_t *fun, size_t *size)
    7272{
    7373        return sb_dsp_get_buffer_position(fun_to_dsp(fun), size);
    7474}
    7575
    76 static int sb_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
     76static errno_t sb_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
    7777{
    7878        return sb_dsp_set_event_session(fun_to_dsp(fun), sess);
     
    8484}
    8585
    86 static int sb_release_buffer(ddf_fun_t *fun)
     86static errno_t sb_release_buffer(ddf_fun_t *fun)
    8787{
    8888        return sb_dsp_release_buffer(fun_to_dsp(fun));
    8989}
    9090
    91 static int sb_start_playback(ddf_fun_t *fun, unsigned frames,
     91static errno_t sb_start_playback(ddf_fun_t *fun, unsigned frames,
    9292    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
    9393{
     
    9696}
    9797
    98 static int sb_stop_playback(ddf_fun_t *fun, bool immediate)
     98static errno_t sb_stop_playback(ddf_fun_t *fun, bool immediate)
    9999{
    100100        return sb_dsp_stop_playback(fun_to_dsp(fun), immediate);
    101101}
    102102
    103 static int sb_start_capture(ddf_fun_t *fun, unsigned frames,
     103static errno_t sb_start_capture(ddf_fun_t *fun, unsigned frames,
    104104    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
    105105{
     
    108108}
    109109
    110 static int sb_stop_capture(ddf_fun_t *fun, bool immediate)
     110static errno_t sb_stop_capture(ddf_fun_t *fun, bool immediate)
    111111{
    112112        return sb_dsp_stop_capture(fun_to_dsp(fun), immediate);
  • uspace/drv/audio/sb16/sb16.c

    r36f0738 rb7fd2a0  
    9494}
    9595
    96 int sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8,
     96errno_t sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8,
    9797    int dma16)
    9898{
     
    100100
    101101        /* Setup registers */
    102         int ret = pio_enable_range(regs, (void **) &sb->regs);
     102        errno_t ret = pio_enable_range(regs, (void **) &sb->regs);
    103103        if (ret != EOK)
    104104                return ret;
     
    179179}
    180180
    181 int sb16_init_mpu(sb16_t *sb, addr_range_t *regs)
     181errno_t sb16_init_mpu(sb16_t *sb, addr_range_t *regs)
    182182{
    183183        sb->mpu_regs = NULL;
  • uspace/drv/audio/sb16/sb16.h

    r36f0738 rb7fd2a0  
    5353size_t sb16_irq_code_size(void);
    5454void sb16_irq_code(addr_range_t *regs, int dma8, int dma16, irq_cmd_t cmds[], irq_pio_range_t ranges[]);
    55 int sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8, int dma16);
    56 int sb16_init_mpu(sb16_t *sb, addr_range_t *regs);
     55errno_t sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8, int dma16);
     56errno_t sb16_init_mpu(sb16_t *sb, addr_range_t *regs);
    5757void sb16_interrupt(sb16_t *sb);
    5858
Note: See TracChangeset for help on using the changeset viewer.