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


Ignore:
Timestamp:
2011-11-14T12:38:50Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1269160
Parents:
1b93658
Message:

sb16: Switch to new ISA bus provided DMA controller access.

File:
1 edited

Legend:

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

    r1b93658 rc885a21  
    3333 */
    3434
     35#include <devman.h>
     36#include <device/hw_res.h>
    3537#include <libarch/ddi.h>
    3638#include <libarch/barrier.h>
    3739#include <str_error.h>
     40#include <bool.h>
    3841
    3942#include "dma.h"
    40 #include "dma_controller.h"
    4143#include "ddf_log.h"
    4244#include "dsp_commands.h"
     
    5153
    5254#define DSP_RESET_RESPONSE 0xaa
    53 #define SB_DMA_CHAN_16 5
    54 #define SB_DMA_CHAN_8 1
    5555
    5656#define AUTO_DMA_MODE
     
    105105}
    106106/*----------------------------------------------------------------------------*/
     107static inline int sb_setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)
     108{
     109        async_sess_t *sess = devman_parent_device_connect(EXCHANGE_ATOMIC,
     110            dsp->sb_dev->handle, IPC_FLAG_BLOCKING);
     111        if (!sess)
     112                return ENOMEM;
     113
     114        const int ret = hw_res_dma_channel_setup(sess,
     115            dsp->dma16_channel, pa, size,
     116            DMA_MODE_READ | DMA_MODE_AUTO | DMA_MODE_ON_DEMAND);
     117        async_hangup(sess);
     118        return ret;
     119}
     120/*----------------------------------------------------------------------------*/
    107121static inline int sb_setup_buffer(sb_dsp_t *dsp)
    108122{
     
    117131        assert(pa < (1 << 25));
    118132        /* Set 16 bit channel */
    119         const int ret = dma_setup_channel(SB_DMA_CHAN_16, pa, BUFFER_SIZE,
    120             DMA_MODE_READ | DMA_MODE_AUTO | DMA_MODE_ON_DEMAND);
     133        const int ret = sb_setup_dma(dsp, pa, BUFFER_SIZE);
    121134        if (ret == EOK) {
    122135                dsp->buffer.data = buffer;
     
    148161}
    149162/*----------------------------------------------------------------------------*/
    150 int sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs)
     163int sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
     164    int dma8, int dma16)
    151165{
    152166        assert(dsp);
    153167        dsp->regs = regs;
     168        dsp->dma8_channel = dma8;
     169        dsp->dma16_channel = dma16;
     170        dsp->sb_dev = dev;
    154171        sb_dsp_reset(dsp);
    155172        /* "DSP takes about 100 microseconds to initialize itself" */
Note: See TracChangeset for help on using the changeset viewer.