Ignore:
File:
1 edited

Legend:

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

    r53a309e rf9b2cb4c  
    3535#include <as.h>
    3636#include <stdbool.h>
    37 #include <ddf/driver.h>
    3837#include <ddi.h>
     38#include <devman.h>
    3939#include <device/hw_res.h>
    4040#include <libarch/ddi.h>
     
    7575                [DSP_NO_BUFFER] = "NO BUFFER",
    7676        };
    77         if ((size_t)state < ARRAY_SIZE(state_names))
     77        if (state < ARRAY_SIZE(state_names))
    7878                return state_names[state];
    7979        return "UNKNOWN";
     
    144144{
    145145        dsp_write(dsp, SET_SAMPLING_RATE_OUTPUT);
    146         uint8_t rate_lo = rate & 0xff;
    147         uint8_t rate_hi = rate >> 8;
    148         dsp_write(dsp, rate_hi);
    149         dsp_write(dsp, rate_lo);
    150         ddf_log_verbose("Sampling rate: %hhx:%hhx.", rate_hi, rate_lo);
     146        dsp_write(dsp, rate >> 8);
     147        dsp_write(dsp, rate & 0xff);
     148        ddf_log_verbose("Sampling rate: %hhx:%hhx.", rate >> 8, rate & 0xff);
    151149}
    152150
     
    161159static inline int setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)
    162160{
    163         async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev);
    164 
    165         return hw_res_dma_channel_setup(sess,
     161        async_sess_t *sess = devman_parent_device_connect(
     162            ddf_dev_get_handle(dsp->sb_dev), IPC_FLAG_BLOCKING);
     163
     164        const int ret = hw_res_dma_channel_setup(sess,
    166165            dsp->dma16_channel, pa, size,
    167166            DMA_MODE_READ | DMA_MODE_AUTO | DMA_MODE_ON_DEMAND);
     167
     168        async_hangup(sess);
     169        return ret;
    168170}
    169171
     
    200202       
    201203        return ret;
     204}
     205
     206static inline size_t sample_count(pcm_sample_format_t format, size_t byte_count)
     207{
     208        return byte_count / pcm_sample_format_size(format);
    202209}
    203210
     
    300307
    301308        assert(dsp->buffer.data);
    302         async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev);
     309        async_sess_t *sess = devman_parent_device_connect(
     310            ddf_dev_get_handle(dsp->sb_dev), IPC_FLAG_BLOCKING);
    303311
    304312        // TODO: Assumes DMA 16
    305313        const int remain = hw_res_dma_channel_remain(sess, dsp->dma16_channel);
     314        async_hangup(sess);
    306315        if (remain >= 0) {
    307316                *pos = dsp->buffer.size - remain;
Note: See TracChangeset for help on using the changeset viewer.