Ignore:
File:
1 edited

Legend:

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

    rf9b2cb4c r53a309e  
    3535#include <as.h>
    3636#include <stdbool.h>
     37#include <ddf/driver.h>
    3738#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 (state < ARRAY_SIZE(state_names))
     77        if ((size_t)state < ARRAY_SIZE(state_names))
    7878                return state_names[state];
    7979        return "UNKNOWN";
     
    144144{
    145145        dsp_write(dsp, SET_SAMPLING_RATE_OUTPUT);
    146         dsp_write(dsp, rate >> 8);
    147         dsp_write(dsp, rate & 0xff);
    148         ddf_log_verbose("Sampling rate: %hhx:%hhx.", rate >> 8, rate & 0xff);
     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);
    149151}
    150152
     
    159161static inline int setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)
    160162{
    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,
     163        async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev);
     164
     165        return hw_res_dma_channel_setup(sess,
    165166            dsp->dma16_channel, pa, size,
    166167            DMA_MODE_READ | DMA_MODE_AUTO | DMA_MODE_ON_DEMAND);
    167 
    168         async_hangup(sess);
    169         return ret;
    170168}
    171169
     
    202200       
    203201        return ret;
    204 }
    205 
    206 static inline size_t sample_count(pcm_sample_format_t format, size_t byte_count)
    207 {
    208         return byte_count / pcm_sample_format_size(format);
    209202}
    210203
     
    307300
    308301        assert(dsp->buffer.data);
    309         async_sess_t *sess = devman_parent_device_connect(
    310             ddf_dev_get_handle(dsp->sb_dev), IPC_FLAG_BLOCKING);
     302        async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev);
    311303
    312304        // TODO: Assumes DMA 16
    313305        const int remain = hw_res_dma_channel_remain(sess, dsp->dma16_channel);
    314         async_hangup(sess);
    315306        if (remain >= 0) {
    316307                *pos = dsp->buffer.size - remain;
Note: See TracChangeset for help on using the changeset viewer.