Changeset bde691c in mainline


Ignore:
Timestamp:
2011-09-26T15:24:48Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bf38143
Parents:
050d4fa
Message:

sb16: Add sb_ prefix to mixer functions and types.

Location:
uspace/drv/audio/sb16
Files:
3 edited

Legend:

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

    r050d4fa rbde691c  
    8989};
    9090
    91 static void mixer_max_master_levels(sb_mixer_t *mixer)
     91static void sb_mixer_max_master_levels(sb_mixer_t *mixer)
    9292{
    9393        assert(mixer);
    9494        /* Set Master to maximum */
    95         if (!mixer_get_control_item_count(mixer))
     95        if (!sb_mixer_get_control_item_count(mixer))
    9696                return;
    9797        unsigned levels = 0, channels = 0, current_level;
    9898        const char *name = NULL;
    99         mixer_get_control_item_info(mixer, 0, &name, &channels, &levels);
     99        sb_mixer_get_control_item_info(mixer, 0, &name, &channels, &levels);
    100100        unsigned channel = 0;
    101101        for (;channel < channels; ++channel) {
    102102                current_level =
    103                     mixer_get_volume_level(mixer, 0, channel);
     103                    sb_mixer_get_volume_level(mixer, 0, channel);
    104104                ddf_log_note("Setting %s channel %d to %d (%d).\n",
    105105                    name, channel, levels - 1, current_level);
    106106
    107                 mixer_set_volume_level(mixer, 0, channel, levels - 1);
     107                sb_mixer_set_volume_level(mixer, 0, channel, levels - 1);
    108108
    109109                current_level =
    110                     mixer_get_volume_level(mixer, 0, channel);
     110                    sb_mixer_get_volume_level(mixer, 0, channel);
    111111                ddf_log_note("%s channel %d set to %d.\n",
    112112                    name, channel, current_level);
     
    115115}
    116116/*----------------------------------------------------------------------------*/
    117 const char * mixer_type_str(mixer_type_t type)
     117const char * sb_mixer_type_str(sb_mixer_type_t type)
    118118{
    119119        static const char * names[] = {
     
    126126}
    127127/*----------------------------------------------------------------------------*/
    128 int mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, mixer_type_t type)
     128int sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type)
    129129{
    130130        assert(mixer);
     
    137137                pio_write_8(&regs->mixer_address, CT_MIXER_RESET_ADDRESS);
    138138                pio_write_8(&regs->mixer_data, 1);
    139                 mixer_max_master_levels(mixer);
     139                sb_mixer_max_master_levels(mixer);
    140140        }
    141141        return EOK;
    142142}
    143143/*----------------------------------------------------------------------------*/
    144 int mixer_get_control_item_count(const sb_mixer_t *mixer)
     144int sb_mixer_get_control_item_count(const sb_mixer_t *mixer)
    145145{
    146146        assert(mixer);
     
    148148}
    149149/*----------------------------------------------------------------------------*/
    150 int mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned index,
     150int sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned index,
    151151    const char** name, unsigned *channels, unsigned *levels)
    152152{
     
    164164}
    165165/*----------------------------------------------------------------------------*/
    166 int mixer_set_volume_level(const sb_mixer_t *mixer,
     166int sb_mixer_set_volume_level(const sb_mixer_t *mixer,
    167167    unsigned index, unsigned channel, unsigned level)
    168168{
     
    194194}
    195195/*----------------------------------------------------------------------------*/
    196 unsigned mixer_get_volume_level(const sb_mixer_t *mixer, unsigned index,
     196unsigned sb_mixer_get_volume_level(const sb_mixer_t *mixer, unsigned index,
    197197    unsigned channel)
    198198{
  • uspace/drv/audio/sb16/mixer.h

    r050d4fa rbde691c  
    4343        SB_MIXER_CT1745,
    4444        SB_MIXER_UNKNOWN,
    45 } mixer_type_t;
     45} sb_mixer_type_t;
    4646
    4747typedef struct sb_mixer {
    4848        sb16_regs_t *regs;
    49         mixer_type_t type;
     49        sb_mixer_type_t type;
    5050} sb_mixer_t;
    5151
    52 const char * mixer_type_str(mixer_type_t type);
    53 int mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, mixer_type_t type);
    54 int mixer_get_control_item_count(const sb_mixer_t *mixer);
    55 int mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned index,
     52const char * sb_mixer_type_str(sb_mixer_type_t type);
     53int sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type);
     54int sb_mixer_get_control_item_count(const sb_mixer_t *mixer);
     55int sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned index,
    5656    const char** name, unsigned *channels, unsigned *levels);
    57 int mixer_set_volume_level(const sb_mixer_t *mixer,
     57int sb_mixer_set_volume_level(const sb_mixer_t *mixer,
    5858    unsigned item, unsigned channel, unsigned level);
    59 unsigned mixer_get_volume_level(const sb_mixer_t *mixer,
     59unsigned sb_mixer_get_volume_level(const sb_mixer_t *mixer,
    6060    unsigned item, unsigned channel);
    6161#endif
  • uspace/drv/audio/sb16/sb16.c

    r050d4fa rbde691c  
    4141    { .cmdcount = 1, .cmds = (irq_cmd_t*)irq_cmds };
    4242
    43 static mixer_type_t mixer_type_by_dsp_version(unsigned major, unsigned minor)
     43static inline sb_mixer_type_t sb_mixer_type_by_dsp_version(
     44    unsigned major, unsigned minor)
    4445{
    4546        switch (major)
     
    9192
    9293        /* Initialize mixer */
    93         const mixer_type_t mixer_type = mixer_type_by_dsp_version(
     94        const sb_mixer_type_t mixer_type = sb_mixer_type_by_dsp_version(
    9495            drv->dsp_version.major, drv->dsp_version.minor);
    9596
    96         ret = mixer_init(&drv->mixer, drv->regs, mixer_type);
     97        ret = sb_mixer_init(&drv->mixer, drv->regs, mixer_type);
    9798        if (ret != EOK) {
    9899                ddf_log_error("Failed to initialize SB mixer: %s.\n",
     
    101102        }
    102103        ddf_log_note("Initialized mixer: %s.\n",
    103             mixer_type_str(drv->mixer.type));
     104            sb_mixer_type_str(drv->mixer.type));
    104105
    105106        return EOK;
Note: See TracChangeset for help on using the changeset viewer.