Changeset 6233c4e in mainline


Ignore:
Timestamp:
2011-10-24T21:50:31Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88dcd19
Parents:
0b4f060
Message:

sb16: Prettify debug output.

Add mode to string conversion.

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

Legend:

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

    r0b4f060 r6233c4e  
    4343#include "dsp.h"
    4444
    45 #define PLAYBACK_16BIT 0x10
    46 #define PLAYBACK_STEREO 0x20
    47 
    4845#define BUFFER_SIZE (PAGE_SIZE / 4)
    4946#define PLAY_BLOCK_SIZE (BUFFER_SIZE / 2)
     
    145142static inline size_t sample_count(uint8_t mode, size_t byte_count)
    146143{
    147         if (mode & PLAYBACK_16BIT) {
     144        if (mode & DSP_MODE_16BIT) {
    148145                return byte_count / 2;
    149146        }
     
    279276        dsp->playing.mode = 0;
    280277        if (sample_size == 16)
    281                 dsp->playing.mode |= PLAYBACK_16BIT;
     278                dsp->playing.mode |= DSP_MODE_16BIT;
    282279        if (channels == 2)
    283                 dsp->playing.mode |= PLAYBACK_STEREO;
     280                dsp->playing.mode |= DSP_MODE_STEREO;
    284281
    285282        const size_t samples = sample_count(dsp->playing.mode, play_size);
    286283
    287         ddf_log_debug("Playing sound(%hhx): %zu(%zu) bytes => %zu samples.\n",
    288             dsp->playing.mode, play_size, size, samples);
     284        ddf_log_debug("Playing %s sound: %zu(%zu) bytes => %zu samples.\n",
     285            mode_to_str(dsp->playing.mode), play_size, size, samples);
    289286
    290287        memcpy(dsp->buffer.data, dsp->playing.data, copy_size);
  • uspace/drv/audio/sb16/dsp_commands.h

    r0b4f060 r6233c4e  
    162162        DMA_16B_EXIT = 0xd9, /* Ends DMA transfer and terminates I/O process */
    163163} dsp_command_t;
     164/*----------------------------------------------------------------------------*/
     165#define DSP_MODE_16BIT 0x10
     166#define DSP_MODE_STEREO 0x20
     167
     168static inline const char * mode_to_str(uint8_t mode)
     169{
     170        if (mode & 0xcf)
     171                return "unknown";
     172        static const char * names[] = {
     173                "unsigned mono (8bit)",
     174                "signed mono (16bit)",
     175                "unsigned stereo (8bit)",
     176                "signed stereo (16bit)",
     177        };
     178        return names[mode >> 4];
     179}
    164180
    165181#endif
Note: See TracChangeset for help on using the changeset viewer.