Ignore:
File:
1 edited

Legend:

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

    r53a309e rb7fd2a0  
    8989}
    9090
    91 static inline int dsp_read(sb_dsp_t *dsp, uint8_t *data)
     91static inline errno_t dsp_read(sb_dsp_t *dsp, uint8_t *data)
    9292{
    9393        assert(data);
     
    106106}
    107107
    108 static inline int dsp_write(sb_dsp_t *dsp, uint8_t data)
     108static inline errno_t dsp_write(sb_dsp_t *dsp, uint8_t data)
    109109{
    110110        assert(dsp);
     
    159159}
    160160
    161 static inline int setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)
     161static inline errno_t setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)
    162162{
    163163        async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev);
     
    168168}
    169169
    170 static inline int setup_buffer(sb_dsp_t *dsp, size_t size)
     170static inline errno_t setup_buffer(sb_dsp_t *dsp, size_t size)
    171171{
    172172        assert(dsp);
     
    178178        void *buffer = AS_AREA_ANY;
    179179       
    180         int ret = dmamem_map_anonymous(size, DMAMEM_16MiB | 0x0000ffff,
     180        errno_t ret = dmamem_map_anonymous(size, DMAMEM_16MiB | 0x0000ffff,
    181181            AS_AREA_WRITE | AS_AREA_READ, 0, &pa, &buffer);
    182182        if (ret != EOK) {
     
    202202}
    203203
    204 int sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
     204errno_t sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
    205205    int dma8, int dma16)
    206206{
     
    215215        dsp_reset(dsp);
    216216        uint8_t response;
    217         const int ret = dsp_read(dsp, &response);
     217        const errno_t ret = dsp_read(dsp, &response);
    218218        if (ret != EOK) {
    219219                ddf_log_error("Failed to read DSP reset response value.");
     
    290290                return 16535;
    291291        default:
    292                 return ENOTSUP;
    293         }
    294 }
    295 
    296 int sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *pos)
     292                return -1;
     293        }
     294}
     295
     296errno_t sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *pos)
    297297{
    298298        if (dsp->state == DSP_NO_BUFFER)
     
    303303
    304304        // TODO: Assumes DMA 16
    305         const int remain = hw_res_dma_channel_remain(sess, dsp->dma16_channel);
    306         if (remain >= 0) {
     305        size_t remain;
     306        errno_t rc = hw_res_dma_channel_remain(sess, dsp->dma16_channel, &remain);
     307        if (rc == EOK) {
    307308                *pos = dsp->buffer.size - remain;
    308                 return EOK;
    309         }
    310         return remain;
    311 }
    312 
    313 int sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
     309        }
     310        return rc;
     311}
     312
     313errno_t sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
    314314  pcm_sample_format_t *format)
    315315{
    316         int ret = EOK;
     316        errno_t ret = EOK;
    317317        if (*channels == 0 || *channels > 2) {
    318318                *channels = 2;
     
    336336}
    337337
    338 int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session)
     338errno_t sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session)
    339339{
    340340        assert(dsp);
     
    353353}
    354354
    355 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size)
     355errno_t sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size)
    356356{
    357357        assert(dsp);
     
    364364        assert(dsp->buffer.data == NULL);
    365365
    366         const int ret = setup_buffer(dsp, *size);
     366        const errno_t ret = setup_buffer(dsp, *size);
    367367        if (ret == EOK) {
    368368                ddf_log_debug("Providing buffer: %p, %zu B.",
     
    378378}
    379379
    380 int sb_dsp_release_buffer(sb_dsp_t *dsp)
     380errno_t sb_dsp_release_buffer(sb_dsp_t *dsp)
    381381{
    382382        assert(dsp);
     
    392392}
    393393
    394 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
     394errno_t sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
    395395    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
    396396{
     
    441441}
    442442
    443 int sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate)
     443errno_t sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate)
    444444{
    445445        assert(dsp);
     
    471471}
    472472
    473 int sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
     473errno_t sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
    474474    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
    475475{
     
    517517}
    518518
    519 int sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate)
     519errno_t sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate)
    520520{
    521521        assert(dsp);
Note: See TracChangeset for help on using the changeset viewer.