Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 25c98a8e in mainline for uspace/drv/audio/sb16/sb16.c


Ignore:
Timestamp:
2011-11-25T22:11:00Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
b67968c
Parents:
53a7fda
Message:

sb16: Implement audio mixer interface.

Move mixer fun creation and initialization to sb_init.

File:
1 edited

Legend:

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

    r53a7fda r25c98a8e  
    2929#include <errno.h>
    3030#include <str_error.h>
     31#include <audio_mixer_iface.h>
    3132
    3233#include "beep.h"
     
    3536#include "dsp.h"
    3637#include "sb16.h"
     38
     39extern audio_mixer_iface_t sb_mixer_iface;
     40
     41static ddf_dev_ops_t sb_mixer_ops = {
     42        .interfaces[AUDIO_MIXER_IFACE] = &sb_mixer_iface,
     43};
    3744
    3845/* ISA interrupts should be edge-triggered so there should be no need for
     
    8592            sb->dsp.version.major, sb->dsp.version.minor);
    8693
     94        ddf_fun_t *mixer_fun = ddf_fun_create(dev, fun_exposed, "mixer");
     95        if (!mixer_fun) {
     96                ddf_log_error("Failed to create mixer function.\n");
     97                return ENOMEM;
     98        }
    8799        ret = sb_mixer_init(&sb->mixer, sb->regs, mixer_type);
    88100        if (ret != EOK) {
     
    91103                return ret;
    92104        }
     105
    93106        ddf_log_note("Initialized mixer: %s.\n",
    94107            sb_mixer_type_str(sb->mixer.type));
     108        mixer_fun->driver_data = &sb->mixer;
     109        mixer_fun->ops = &sb_mixer_ops;
     110
     111        ret = ddf_fun_bind(mixer_fun);
     112        if (ret != EOK) {
     113                ddf_log_error(
     114                    "Failed to bind mixer function: %s.\n", str_error(ret));
     115                mixer_fun->driver_data = NULL;
     116                ddf_fun_destroy(mixer_fun);
     117                return ret;
     118        }
    95119
    96120        ddf_log_note("Playing startup sound.\n");
Note: See TracChangeset for help on using the changeset viewer.