• Takashi Sakamoto's avatar
    ALSA: firewire-lib: add helper functions as interfaces between packet... · 20e44577
    Takashi Sakamoto authored
    ALSA: firewire-lib: add helper functions as interfaces between packet streaming layer and data block processing layer
    
    ALSA PCM framework uses PCM buffer with a concept of 'period' to
    synchronize userspace operations to hardware for nearly-realtime
    processing. Each driver implements snd_pcm_period_elapsed() to tell across
    of the period boundary to ALSA PCM middleware. To call the function, some
    drivers utilize hardware interrupt handlers, the others count handled PCM
    frames.
    
    Drivers for sound units on IEEE 1394 bus are the latter. They use two
    buffers; PCM buffer and DMA buffer for IEEE 1394 isochronous packet. PCM
    frames are copied between these two buffers and 'amdtp_stream' structure
    counts the handled PCM frames. Then, snd_pcm_period_elapsed() is called if
    required.
    
    Essentially, packet streaming layer should not be responsible for PCM
    frame processing. The PCM frame processing should be handled in each data
    block processing layer as a result of handling data blocks. Although, PCM
    frame counting is a common work for all of protocols which ALSA firewire
    stack is going to support.
    
    This commit adds two new helper functions as interfaces between packet
    streaming layer to data block processing layer. In future, each data block
    processing layer implements these functions. The packet streaming layer
    calls data block processing layer per packet by calling the functions. The
    data block processing layer processes data blocks and PCM frames, and
    returns the number of processed PCM frames. Then the packet streaming layer
    calculates handled PCM frames and calls snd_pcm_period_elapsed().
    Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    20e44577
amdtp.c 30.7 KB