xref: /aosp_15_r20/external/tinyalsa_new/src/pcm_io.h (revision 02e95f1a335b55495d41ca67eaf42361f13704fa)
1*02e95f1aSMarcin Radomski /* pcm_io.h
2*02e95f1aSMarcin Radomski ** Copyright (c) 2019, The Linux Foundation.
3*02e95f1aSMarcin Radomski **
4*02e95f1aSMarcin Radomski ** Redistribution and use in source and binary forms, with or without
5*02e95f1aSMarcin Radomski ** modification, are permitted provided that the following conditions are
6*02e95f1aSMarcin Radomski ** met:
7*02e95f1aSMarcin Radomski **   * Redistributions of source code must retain the above copyright
8*02e95f1aSMarcin Radomski **     notice, this list of conditions and the following disclaimer.
9*02e95f1aSMarcin Radomski **   * Redistributions in binary form must reproduce the above
10*02e95f1aSMarcin Radomski **     copyright notice, this list of conditions and the following
11*02e95f1aSMarcin Radomski **     disclaimer in the documentation and/or other materials provided
12*02e95f1aSMarcin Radomski **     with the distribution.
13*02e95f1aSMarcin Radomski **   * Neither the name of The Linux Foundation nor the names of its
14*02e95f1aSMarcin Radomski **     contributors may be used to endorse or promote products derived
15*02e95f1aSMarcin Radomski **     from this software without specific prior written permission.
16*02e95f1aSMarcin Radomski **
17*02e95f1aSMarcin Radomski ** THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18*02e95f1aSMarcin Radomski ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19*02e95f1aSMarcin Radomski ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20*02e95f1aSMarcin Radomski ** ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21*02e95f1aSMarcin Radomski ** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22*02e95f1aSMarcin Radomski ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23*02e95f1aSMarcin Radomski ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24*02e95f1aSMarcin Radomski ** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25*02e95f1aSMarcin Radomski ** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26*02e95f1aSMarcin Radomski ** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27*02e95f1aSMarcin Radomski ** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*02e95f1aSMarcin Radomski **/
29*02e95f1aSMarcin Radomski 
30*02e95f1aSMarcin Radomski #ifndef TINYALSA_SRC_PCM_IO_H
31*02e95f1aSMarcin Radomski #define TINYALSA_SRC_PCM_IO_H
32*02e95f1aSMarcin Radomski 
33*02e95f1aSMarcin Radomski #include <poll.h>
34*02e95f1aSMarcin Radomski #include <sound/asound.h>
35*02e95f1aSMarcin Radomski 
36*02e95f1aSMarcin Radomski struct snd_node;
37*02e95f1aSMarcin Radomski 
38*02e95f1aSMarcin Radomski struct pcm_ops {
39*02e95f1aSMarcin Radomski     int (*open) (unsigned int card, unsigned int device,
40*02e95f1aSMarcin Radomski                  unsigned int flags, void **data, struct snd_node *node);
41*02e95f1aSMarcin Radomski     void (*close) (void *data);
42*02e95f1aSMarcin Radomski     int (*ioctl) (void *data, unsigned int cmd, ...);
43*02e95f1aSMarcin Radomski     void *(*mmap) (void *data, void *addr, size_t length, int prot, int flags,
44*02e95f1aSMarcin Radomski                    off_t offset);
45*02e95f1aSMarcin Radomski     int (*munmap) (void *data, void *addr, size_t length);
46*02e95f1aSMarcin Radomski     int (*poll) (void *data, struct pollfd *pfd, nfds_t nfds, int timeout);
47*02e95f1aSMarcin Radomski };
48*02e95f1aSMarcin Radomski 
49*02e95f1aSMarcin Radomski extern const struct pcm_ops hw_ops;
50*02e95f1aSMarcin Radomski extern const struct pcm_ops plug_ops;
51*02e95f1aSMarcin Radomski 
52*02e95f1aSMarcin Radomski #endif /* TINYALSA_SRC_PCM_IO_H */
53