Changeset eb0ef51 in mainline


Ignore:
Timestamp:
2013-04-10T21:41:10Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
876f5561
Parents:
5b77efc
Message:

libdrv: few more comments

use ARRAY_SIZE macro

Location:
uspace/lib/drv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_audio_pcm.c

    r5b77efc reb0ef51  
    3636#include <ddf/log.h>
    3737#include <errno.h>
     38#include <macros.h>
    3839#include <str.h>
    3940#include <as.h>
     
    5859} audio_pcm_iface_funcs_t;
    5960
     61/**
     62 * Get human readable capability name.
     63 * @param cap audio capability.
     64 * @return Valid string
     65 */
    6066const char *audio_pcm_cap_str(audio_cap_t cap)
    6167{
     
    6975                [AUDIO_CAP_INTERRUPT_MAX_FRAMES] = "MAXIMUM FRAGMENT SIZE",
    7076        };
    71         if (cap > (sizeof(caps) / sizeof(*caps)))
     77        if (cap >= ARRAY_SIZE(caps))
    7278                return "UNKNOWN CAP";
    7379        return caps[cap];
     
    7581}
    7682
     83/**
     84 * Get human readable event name.
     85 * @param event Audio device event
     86 * @return Valid string
     87 */
    7788const char *audio_pcm_event_str(pcm_event_t event)
    7889{
     
    8596                [PCM_EVENT_CAPTURE_TERMINATED] = "CAPTURE TERMINATED",
    8697        };
    87         if (event > (sizeof(events) / sizeof(*events)))
     98        if (event >= ARRAY_SIZE(events))
    8899                return "UNKNOWN EVENT";
    89100        return events[event];
     
    123134        return session;
    124135}
     136
    125137/**
    126138 * Open audio session with device identified by location service string.
  • uspace/lib/drv/include/audio_pcm_iface.h

    r5b77efc reb0ef51  
    4545
    4646typedef enum {
     47        /** Device is capable of audio capture */
    4748        AUDIO_CAP_CAPTURE,
     49        /** Device is capable of audio playback */
    4850        AUDIO_CAP_PLAYBACK,
     51        /** Maximum size of device buffer */
    4952        AUDIO_CAP_MAX_BUFFER,
     53        /** Device is capable of providing accurate buffer position info */
    5054        AUDIO_CAP_BUFFER_POS,
     55        /** Device is capable of event based playback or capture */
    5156        AUDIO_CAP_INTERRUPT,
     57        /** Minimal size of playback/record fragment */
    5258        AUDIO_CAP_INTERRUPT_MIN_FRAMES,
     59        /** Maximum size of playback/record fragment */
    5360        AUDIO_CAP_INTERRUPT_MAX_FRAMES,
    5461} audio_cap_t;
Note: See TracChangeset for help on using the changeset viewer.