int snd_pcm_mmap
(snd_pcm_t *handle, int channel, snd_pcm_mmap_control_t **control, void **buffer);
Performs the mmaping and returns control block and data block (buffer) in direction according to the specified channel. Function may be called in SND_PCM_STATUS_READY state, otherwise -EBADFD error is returned. Function returns zero and filled control and buffer pointers if successful, otherwise it returns an error code. This call is allowed only when the subdevice is in the block transfer mode.
The meaning of members from the control structure differs between the interleaved and non-interleaved transfer modes. The non-interleaved mode uses smaller transfer unit - fragment size divide voices. This unit is called as 'voice fragment' in the following text. All members from the control structure (as frag_io, frags, frag_size and number) refer to this unit.
typedef struct { volatile int status; volatile int frag_io; int frags; int frag_size; int voices; volatile unsigned int block; volatile unsigned int expblock; int res[9]; } snd_pcm_mmap_io_status_t; typedef struct { unsigned int number; off_t addr; int voice; volatile char data; volatile char io; char res[2]; } snd_pcm_mmap_fragment_t; typedef struct { snd_pcm_mmap_io_status_t status; snd_pcm_mmap_fragment_t fragments[128]; } snd_pcm_mmap_control_t;
Member | Description |
---|---|
status | Current status (SND_PCM_STATUS_*) for direction. |
frag_io | Fragment or voice fragment number currently processed. |
frags | Count of used fragments or voice fragments. |
frag_size | Size of fragment or voice fragment in bytes. |
voices | Number of voices for non-interleaved transfer or -1 when the interleaved format is used. |
block | Current block number. |
expblock | Expected block number for wakeup. This block number is usually highter than the current block number. The application may use poll or select functions to wait until the transfer of this block is started. |
number | Fragment number. |
addr | Offset in bytes where the fragment or voice fragment begins. |
voice | Voice number assigned to this voice fragment or -1 (interleaved stream). |
data | Fragment or voice fragment contains valid samples (data). |
io | Fragment or voice fragment is processed. |