From f29b8df6261e72d9a426d6d8c175a896931654e2 Mon Sep 17 00:00:00 2001 From: Rohit kumar Date: Wed, 19 Aug 2020 15:19:33 +0530 Subject: tinyalsa: add plugin support for mmap/poll ops --- src/pcm_hw.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/pcm_hw.c') diff --git a/src/pcm_hw.c b/src/pcm_hw.c index e25cdae..38b2e83 100644 --- a/src/pcm_hw.c +++ b/src/pcm_hw.c @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -77,6 +78,25 @@ static int pcm_hw_ioctl(void *data, unsigned int cmd, ...) return ioctl(hw_data->fd, cmd, arg); } +static int pcm_hw_poll(void *data __attribute__((unused)), + struct pollfd *pfd, nfds_t nfds, int timeout) +{ + return poll(pfd, nfds, timeout); +} + +static void *pcm_hw_mmap(void *data, void *addr, size_t length, int prot, + int flags, off_t offset) +{ + struct pcm_hw_data *hw_data = data; + + return mmap(addr, length, prot, flags, hw_data->fd, offset); +} + +static int pcm_hw_munmap(void *data __attribute__((unused)), void *addr, size_t length) +{ + return munmap(addr, length); +} + static int pcm_hw_open(unsigned int card, unsigned int device, unsigned int flags, void **data, struct snd_node *node) { @@ -115,5 +135,8 @@ const struct pcm_ops hw_ops = { .open = pcm_hw_open, .close = pcm_hw_close, .ioctl = pcm_hw_ioctl, + .mmap = pcm_hw_mmap, + .munmap = pcm_hw_munmap, + .poll = pcm_hw_poll, }; -- cgit v1.2.3