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


Ignore:
Timestamp:
2011-10-21T19:01:15Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f14e6ea
Parents:
9f351c8
Message:

sb16: Setup both channels (8/16 bit) to the same buffer and set channel mode.

File:
1 edited

Legend:

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

    r9f351c8 r7257eea6  
    9999
    100100        const uintptr_t pa = addr_to_phys(buffer);
     101        /* Set 16 bit channel */
    101102        const int ret = dma_setup_channel(SB_DMA_CHAN_16, pa, PAGE_SIZE);
    102103        if (ret == EOK) {
     
    104105                dsp->buffer.buffer_position = buffer;
    105106                dsp->buffer.buffer_size = PAGE_SIZE;
     107                dma_prepare_channel(SB_DMA_CHAN_16, false, true, BLOCK_DMA);
     108                /* Set 8bit channel */
     109                const int ret = dma_setup_channel(SB_DMA_CHAN_8, pa, PAGE_SIZE);
     110                if (ret == EOK) {
     111                        dma_prepare_channel(
     112                            SB_DMA_CHAN_8, false, true, BLOCK_DMA);
     113                }
    106114        } else {
    107115                ddf_log_error("Failed to setup DMA buffer %s.\n",
     
    110118        }
    111119        return ret;
     120}
     121/*----------------------------------------------------------------------------*/
     122static inline void sb_clear_buffer(sb_dsp_t *dsp)
     123{
     124        free24(dsp->buffer.buffer_data);
     125        dsp->buffer.buffer_data = NULL;
     126        dsp->buffer.buffer_position = NULL;
     127        dsp->buffer.buffer_size = 0;
    112128}
    113129/*----------------------------------------------------------------------------*/
     
    155171/*----------------------------------------------------------------------------*/
    156172int sb_dsp_play(sb_dsp_t *dsp, const uint8_t *data, size_t size,
    157     unsigned sampling_rate, unsigned channels, unsigned bit_depth)
     173    uint16_t sampling_rate, unsigned channels, unsigned bit_depth)
    158174{
    159175        assert(dsp);
Note: See TracChangeset for help on using the changeset viewer.