Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset b497018 in mainline for uspace/drv/audio/sb16/dsp.c


Ignore:
Timestamp:
2012-07-15T15:13:34Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial
Children:
2cc5c835
Parents:
44d1311
Message:

Drop id parameter from audio_pcm interface.

Independent buffer should have separate nodes.

File:
1 edited

Legend:

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

    r44d1311 rb497018  
    4646#include "dsp.h"
    4747
    48 #define BUFFER_ID 1
    4948#define MAX_BUFFER_SIZE (PAGE_SIZE)
    5049
     
    221220}
    222221
    223 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size, unsigned *id)
     222int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size)
    224223{
    225224        assert(dsp);
     
    233232        const int ret = sb_setup_buffer(dsp, *size);
    234233        if (ret == EOK) {
    235                 ddf_log_debug("Providing buffer(%u): %p, %zu B.",
    236                     BUFFER_ID, dsp->buffer.data, dsp->buffer.size);
     234                ddf_log_debug("Providing buffer: %p, %zu B.",
     235                    dsp->buffer.data, dsp->buffer.size);
    237236
    238237                if (buffer)
     
    240239                if (size)
    241240                        *size = dsp->buffer.size;
    242                 if (id)
    243                         *id = BUFFER_ID;
    244241        }
    245242        return ret;
    246243}
    247244
    248 int sb_dsp_set_event_session(sb_dsp_t *dsp, unsigned id, async_sess_t *session)
     245int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session)
    249246{
    250247        assert(dsp);
    251248        assert(session);
    252         if (id != BUFFER_ID)
    253                 return ENOENT;
    254249        if (dsp->event_session)
    255250                return EBUSY;
     
    259254}
    260255
    261 int sb_dsp_release_buffer(sb_dsp_t *dsp, unsigned id)
    262 {
    263         assert(dsp);
    264         if (id != BUFFER_ID)
    265                 return ENOENT;
     256int sb_dsp_release_buffer(sb_dsp_t *dsp)
     257{
     258        assert(dsp);
    266259        sb_clear_buffer(dsp);
    267260        async_exchange_end(dsp->event_exchange);
     
    274267}
    275268
    276 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned id, unsigned parts,
     269int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned parts,
    277270    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
    278271{
     
    289282
    290283        /* Check supported parameters */
    291         ddf_log_debug("Requested playback on buffer \"%u\" (%u parts): %uHz, "
    292             "%s, %u channel(s).", id, parts, sampling_rate,
    293             pcm_sample_format_str(format), channels);
    294         if (id != BUFFER_ID)
    295                 return ENOENT;
     284        ddf_log_debug("Requested playback (%u parts): %uHz, %s, %u channel(s).",
     285            parts, sampling_rate, pcm_sample_format_str(format), channels);
    296286        if (channels != 1 && channels != 2)
    297287                return ENOTSUP;
     
    338328}
    339329
    340 int sb_dsp_stop_playback(sb_dsp_t *dsp, unsigned id)
    341 {
    342         assert(dsp);
    343         if (id != BUFFER_ID)
    344                 return ENOENT;
     330int sb_dsp_stop_playback(sb_dsp_t *dsp)
     331{
     332        assert(dsp);
    345333        sb_dsp_write(dsp, DMA_16B_EXIT);
    346         ddf_log_debug("Stopping playback on buffer %u.", id);
     334        ddf_log_debug("Stopping playback on buffer.");
    347335        async_msg_0(dsp->event_exchange, PCM_EVENT_PLAYBACK_TERMINATED);
    348336        async_exchange_end(dsp->event_exchange);
     
    351339}
    352340
    353 int sb_dsp_start_record(sb_dsp_t *dsp, unsigned id, unsigned parts,
     341int sb_dsp_start_record(sb_dsp_t *dsp, unsigned parts,
    354342    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
    355343{
     
    366354
    367355        /* Check supported parameters */
    368         ddf_log_debug("Requested recording on buffer \"%u\" (%u parts): %uHz, "
    369             "%s, %u channel(s).", id, parts, sampling_rate,
    370             pcm_sample_format_str(format), channels);
    371         if (id != BUFFER_ID)
    372                 return ENOENT;
     356        ddf_log_debug("Requested record (%u parts): %uHz, %s, %u channel(s).",
     357            parts, sampling_rate, pcm_sample_format_str(format), channels);
    373358        if (channels != 1 && channels != 2)
    374359                return ENOTSUP;
     
    414399}
    415400
    416 int sb_dsp_stop_record(sb_dsp_t *dsp, unsigned id)
    417 {
    418         assert(dsp);
    419         if (id != BUFFER_ID)
    420                 return ENOENT;
     401int sb_dsp_stop_record(sb_dsp_t *dsp)
     402{
     403        assert(dsp);
    421404        sb_dsp_write(dsp, DMA_16B_EXIT);
    422         ddf_log_debug("Stopping playback on buffer %u.", id);
     405        ddf_log_debug("Stopped recording");
    423406        async_msg_0(dsp->event_exchange, PCM_EVENT_RECORDING_TERMINATED);
    424407        async_exchange_end(dsp->event_exchange);
Note: See TracChangeset for help on using the changeset viewer.