Changeset 3bacee1 in mainline for uspace/drv/audio/sb16


Ignore:
Timestamp:
2018-04-12T16:27:17Z (8 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3cf22f9
Parents:
76d0981d
git-author:
Jiri Svoboda <jiri@…> (2018-04-11 19:25:33)
git-committer:
Jiri Svoboda <jiri@…> (2018-04-12 16:27:17)
Message:

Make ccheck-fix again and commit more good files.

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

Legend:

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

    r76d0981d r3bacee1  
    6363#define AUTO_DMA_MODE
    6464
    65 static inline const char * dsp_state_to_str(dsp_state_t state)
    66 {
    67         static const char* state_names[] = {
     65static inline const char *dsp_state_to_str(dsp_state_t state)
     66{
     67        static const char *state_names[] = {
    6868                [DSP_PLAYBACK_ACTIVE_EVENTS] = "PLAYBACK w/ EVENTS",
    6969                [DSP_CAPTURE_ACTIVE_EVENTS] = "CAPTURE w/ EVENTS",
     
    240240            dsp->active.samples / ((dsp->active.mode & DSP_MODE_STEREO) ? 2 : 1);
    241241
    242         switch (dsp->state)
    243         {
     242        switch (dsp->state) {
    244243        case DSP_PLAYBACK_ACTIVE_EVENTS:
    245244                dsp_report_event(dsp, PCM_EVENT_FRAMES_PLAYED);
     
    277276{
    278277        ddf_log_verbose("Querying cap %s", audio_pcm_cap_str(cap));
    279         switch(cap) {
     278        switch (cap) {
    280279        case AUDIO_CAP_CAPTURE:
    281280        case AUDIO_CAP_PLAYBACK:
     
    312311
    313312errno_t sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
    314   pcm_sample_format_t *format)
     313    pcm_sample_format_t *format)
    315314{
    316315        errno_t ret = EOK;
     
    346345}
    347346
    348 async_sess_t * sb_dsp_get_event_session(sb_dsp_t *dsp)
     347async_sess_t *sb_dsp_get_event_session(sb_dsp_t *dsp)
    349348{
    350349        assert(dsp);
     
    416415        }
    417416
    418         dsp->active.mode = 0
    419             | (pcm_sample_format_is_signed(format) ? DSP_MODE_SIGNED : 0)
    420             | (channels == 2 ? DSP_MODE_STEREO : 0);
     417        dsp->active.mode = 0 |
     418            (pcm_sample_format_is_signed(format) ? DSP_MODE_SIGNED : 0) |
     419            (channels == 2 ? DSP_MODE_STEREO : 0);
    421420        dsp->active.samples = frames * channels;
    422421        dsp->active.frame_count = 0;
     
    446445        if ((dsp->state == DSP_PLAYBACK_NOEVENTS ||
    447446            dsp->state == DSP_PLAYBACK_ACTIVE_EVENTS) &&
    448             immediate)
    449         {
     447            immediate) {
    450448                dsp_write(dsp, DMA_16B_PAUSE);
    451449                dsp_reset(dsp);
     
    459457                return EOK;
    460458        }
    461         if (dsp->state == DSP_PLAYBACK_ACTIVE_EVENTS)
    462         {
     459        if (dsp->state == DSP_PLAYBACK_ACTIVE_EVENTS) {
    463460                /* Stop after current fragment */
    464461                assert(!immediate);
     
    494491        }
    495492
    496         dsp->active.mode = 0
    497             | (pcm_sample_format_is_signed(format) ? DSP_MODE_SIGNED : 0)
    498             | (channels == 2 ? DSP_MODE_STEREO : 0);
     493        dsp->active.mode = 0 |
     494            (pcm_sample_format_is_signed(format) ? DSP_MODE_SIGNED : 0) |
     495            (channels == 2 ? DSP_MODE_STEREO : 0);
    499496        dsp->active.samples = frames * channels;
    500497        dsp->active.frame_count = 0;
     
    522519        if ((dsp->state == DSP_CAPTURE_NOEVENTS ||
    523520            dsp->state == DSP_CAPTURE_ACTIVE_EVENTS) &&
    524             immediate)
    525         {
     521            immediate) {
    526522                dsp_write(dsp, DMA_16B_PAUSE);
    527523                dsp_reset(dsp);
     
    535531                return EOK;
    536532        }
    537         if (dsp->state == DSP_CAPTURE_ACTIVE_EVENTS)
    538         {
     533        if (dsp->state == DSP_CAPTURE_ACTIVE_EVENTS) {
    539534                /* Stop after current fragment */
    540535                assert(!immediate);
  • uspace/drv/audio/sb16/main.c

    r76d0981d r3bacee1  
    7171int main(int argc, char *argv[])
    7272{
    73         printf(NAME": HelenOS SB16 audio driver.\n");
     73        printf(NAME ": HelenOS SB16 audio driver.\n");
    7474        ddf_log_init(NAME);
    7575        return ddf_driver_main(&sb_driver);
     
    191191        /* 1x IRQ, 1-2x DMA(8,16), 1-2x IO (MPU is separate). */
    192192        if (hw_res.irqs.count != 1 ||
    193            (hw_res.io_ranges.count != 1 && hw_res.io_ranges.count != 2) ||
    194            (hw_res.dma_channels.count != 1 && hw_res.dma_channels.count != 2)) {
     193            (hw_res.io_ranges.count != 1 && hw_res.io_ranges.count != 2) ||
     194            (hw_res.dma_channels.count != 1 && hw_res.dma_channels.count != 2)) {
    195195                hw_res_list_parsed_clean(&hw_res);
    196196                return EINVAL;
     
    229229        } else {
    230230                const int sb =
    231                     (hw_res.io_ranges.ranges[0].size >= sizeof(sb16_regs_t))
    232                         ? 0 : 1;
     231                    (hw_res.io_ranges.ranges[0].size >= sizeof(sb16_regs_t)) ?
     232                    0 : 1;
    233233                const int mpu = 1 - sb;
    234234                if (pp_sb_regs && *pp_sb_regs)
  • uspace/drv/audio/sb16/mixer.c

    r76d0981d r3bacee1  
    9898        [SB_MIXER_UNKNOWN] = { NULL, 0 },
    9999        [SB_MIXER_CT1335] = {
    100             channels_table_ct1335,
    101             ARRAY_SIZE(channels_table_ct1335),
     100                channels_table_ct1335,
     101                ARRAY_SIZE(channels_table_ct1335),
    102102        },
    103103        [SB_MIXER_CT1345] = {
    104             channels_table_ct1345,
    105             ARRAY_SIZE(channels_table_ct1345),
     104                channels_table_ct1345,
     105                ARRAY_SIZE(channels_table_ct1345),
    106106        },
    107107        [SB_MIXER_CT1745] = {
    108             channels_table_ct1745,
    109             ARRAY_SIZE(channels_table_ct1745),
     108                channels_table_ct1745,
     109                ARRAY_SIZE(channels_table_ct1745),
    110110        },
    111111};
    112112
    113 const char * sb_mixer_type_str(sb_mixer_type_t type)
     113const char *sb_mixer_type_str(sb_mixer_type_t type)
    114114{
    115115        static const char *names[] = {
     
    150150
    151151errno_t sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned item,
    152     const char** name, unsigned *levels)
     152    const char **name, unsigned *levels)
    153153{
    154154        assert(mixer);
     
    182182        const channel_t *chan = &volume_table[mixer->type].table[item];
    183183        pio_write_8(&mixer->regs->mixer_address, chan->address);
    184         *value = (pio_read_8(&mixer->regs->mixer_data) >> chan->shift)
    185             & (chan->volume_levels - 1);
     184        *value = (pio_read_8(&mixer->regs->mixer_data) >> chan->shift) &
     185            (chan->volume_levels - 1);
    186186        return EOK;
    187187}
Note: See TracChangeset for help on using the changeset viewer.