Changeset ff396ea in mainline


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

sb16: Interval of 0 frames disables interrupts reporting.

Don't use fifo in single transfers.

Location:
uspace/drv/audio/sb16
Files:
2 edited

Legend:

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

    rb881226 rff396ea  
    167167        dsp->sb_dev = dev;
    168168        dsp->status = DSP_STOPPED;
     169        dsp->ignore_interrupts = false;
    169170        sb_dsp_reset(dsp);
    170171        /* "DSP takes about 100 microseconds to initialize itself" */
     
    192193{
    193194        assert(dsp);
     195
     196#ifndef AUTO_DMA_MODE
     197        if (dsp->status == DSP_PLAYBACK) {
     198                sb_dsp_write(dsp, SINGLE_DMA_16B_DA);
     199                sb_dsp_write(dsp, dsp->active.mode);
     200                sb_dsp_write(dsp, (dsp->active.samples - 1) & 0xff);
     201                sb_dsp_write(dsp, (dsp->active.samples - 1) >> 8);
     202        }
     203
     204        if (dsp->status == DSP_RECORDING) {
     205                sb_dsp_write(dsp, SINGLE_DMA_16B_AD);
     206                sb_dsp_write(dsp, dsp->active.mode);
     207                sb_dsp_write(dsp, (dsp->active.samples - 1) & 0xff);
     208                sb_dsp_write(dsp, (dsp->active.samples - 1) >> 8);
     209        }
     210#endif
     211
     212        if (dsp->ignore_interrupts)
     213                return;
     214
    194215        dsp->active.frame_count +=
    195216            dsp->active.samples / ((dsp->active.mode & DSP_MODE_STEREO) ? 2 : 1);
     
    215236                ddf_log_warning("Interrupt with no event consumer.");
    216237        }
    217 #ifndef AUTO_DMA_MODE
    218         if (dsp->active.playing)
    219                 sb_dsp_write(dsp, SINGLE_DMA_16B_DA);
    220         else
    221                 sb_dsp_write(dsp, SINGLE_DMA_16B_AD);
    222 
    223         sb_dsp_write(dsp, dsp->active.mode);
    224         sb_dsp_write(dsp, (dsp->active.samples - 1) & 0xff);
    225         sb_dsp_write(dsp, (dsp->active.samples - 1) >> 8);
    226 #endif
    227238}
    228239
     
    333344                return ENOTSUP;
    334345
    335         dsp->event_exchange = async_exchange_begin(dsp->event_session);
    336         if (!dsp->event_exchange)
    337                 return ENOMEM;
     346        /* Client requested regular interrupts */
     347        if (frames) {
     348                dsp->event_exchange = async_exchange_begin(dsp->event_session);
     349                if (!dsp->event_exchange)
     350                        return ENOMEM;
     351                dsp->ignore_interrupts = false;
     352        }
    338353
    339354        const bool sign = (format == PCM_SAMPLE_SINT16_LE);
     
    349364        sb_dsp_write(dsp, AUTO_DMA_16B_DA_FIFO);
    350365#else
    351         sb_dsp_write(dsp, SINGLE_DMA_16B_DA_FIFO);
     366        sb_dsp_write(dsp, SINGLE_DMA_16B_DA);
    352367#endif
    353368
     
    401416                return ENOTSUP;
    402417
    403         dsp->event_exchange = async_exchange_begin(dsp->event_session);
    404         if (!dsp->event_exchange)
    405                 return ENOMEM;
     418        /* client requested regular interrupts */
     419        if (frames) {
     420                dsp->event_exchange = async_exchange_begin(dsp->event_session);
     421                if (!dsp->event_exchange)
     422                        return ENOMEM;
     423                dsp->ignore_interrupts = false;
     424        }
    406425
    407426        const bool sign = (format == PCM_SAMPLE_SINT16_LE);
     
    417436        sb_dsp_write(dsp, AUTO_DMA_16B_AD_FIFO);
    418437#else
    419         sb_dsp_write(dsp, SINGLE_DMA_16B_AD_FIFO);
     438        sb_dsp_write(dsp, SINGLE_DMA_16B_AD);
    420439#endif
    421440
  • uspace/drv/audio/sb16/dsp.h

    rb881226 rff396ea  
    4747        int dma8_channel;
    4848        int dma16_channel;
     49        bool ignore_interrupts;
    4950        struct {
    5051                uint8_t major;
Note: See TracChangeset for help on using the changeset viewer.