Changeset 99cb9bf in mainline for uspace/drv/audio/hdaudio/codec.c


Ignore:
Timestamp:
2014-08-26T08:58:47Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
159c722d
Parents:
93c3163
Message:

Implement more of audio_pcm_iface.

File:
1 edited

Legend:

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

    r93c3163 r99cb9bf  
    259259            codec->out_aw, rates, formats);
    260260
    261         /* XXX Choose appropriate parameters */
    262         uint32_t fmt;
    263         /* 48 kHz, 16-bits, 1 channel */
    264         fmt = fmt_bits_16 << fmt_bits_l;
    265 
    266         /* Create stream */
    267         ddf_msg(LVL_NOTE, "Create stream");
    268         hda_stream_t *stream;
    269         stream = hda_stream_create(hda, sdir_output, fmt);
    270         if (stream == NULL)
    271                 goto error;
    272 
    273         /* Configure converter */
    274 
    275         ddf_msg(LVL_NOTE, "Configure converter format");
    276         rc = hda_set_converter_fmt(codec, codec->out_aw, fmt);
    277         if (rc != EOK)
    278                 goto error;
    279 
    280         ddf_msg(LVL_NOTE, "Configure converter stream, channel");
    281         rc = hda_set_converter_ctl(codec, codec->out_aw, stream->sid, 0);
    282         if (rc != EOK)
    283                 goto error;
    284 
    285         ddf_msg(LVL_NOTE, "Start stream");
    286         hda_stream_start(stream);
    287 
    288261        ddf_msg(LVL_NOTE, "Codec OK");
    289262        return codec;
     
    299272}
    300273
     274int hda_out_converter_setup(hda_codec_t *codec, uint8_t sid)
     275{
     276        int rc;
     277
     278        /* XXX Choose appropriate parameters */
     279        uint32_t fmt;
     280        /* 48 kHz, 16-bits, 1 channel */
     281        fmt = fmt_bits_16 << fmt_bits_l;
     282
     283        /* Configure converter */
     284
     285        ddf_msg(LVL_NOTE, "Configure converter format");
     286        rc = hda_set_converter_fmt(codec, codec->out_aw, fmt);
     287        if (rc != EOK)
     288                goto error;
     289
     290        ddf_msg(LVL_NOTE, "Configure converter stream, channel");
     291        rc = hda_set_converter_ctl(codec, codec->out_aw, sid, 0);
     292        if (rc != EOK)
     293                goto error;
     294
     295        return EOK;
     296error:
     297        return rc;
     298}
     299
    301300/** @}
    302301 */
Note: See TracChangeset for help on using the changeset viewer.