async_read.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Takuo Yonezawa <Yonezawa-T2@mail.dnp.co.jp>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for
6  * more details.
7  */
8 
18 #ifndef ASYNC_READ_H
19 #define ASYNC_READ_H
20 
21 #include <stdlib.h>
22 #include <poll.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
31 #ifndef ASYNC_READ_NUMOF
32 #define ASYNC_READ_NUMOF 2
33 #endif
34 
38 typedef void (*native_async_read_callback_t)(int fd, void *arg);
39 
43 typedef struct {
44  pid_t child_pid;
46  void *arg;
47  struct pollfd *fd;
48 } async_read_t;
49 
55 void native_async_read_setup(void);
56 
62 void native_async_read_cleanup(void);
63 
71 void native_async_read_continue(int fd);
72 
81 void native_async_read_add_handler(int fd, void *arg, native_async_read_callback_t handler);
82 
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* ASYNC_READ_H */
98 
async_read_t::fd
struct pollfd * fd
sysfs gpio fd
Definition: async_read.h:47
native_async_read_continue
void native_async_read_continue(int fd)
resume monitoring of file descriptors
async_read_t::child_pid
pid_t child_pid
PID of the interrupt listener.
Definition: async_read.h:44
native_async_read_callback_t
void(* native_async_read_callback_t)(int fd, void *arg)
asynchronus read callback type
Definition: async_read.h:38
native_async_read_setup
void native_async_read_setup(void)
initialize asynchronus read system
native_async_read_add_handler
void native_async_read_add_handler(int fd, void *arg, native_async_read_callback_t handler)
start monitoring of file descriptor
async_read_t::arg
void * arg
Argument ptr for the callback.
Definition: async_read.h:46
async_read_t::cb
native_async_read_callback_t cb
Interrupt callback function.
Definition: async_read.h:45
native_async_read_cleanup
void native_async_read_cleanup(void)
shutdown asynchronus read system
async_read_t
Interrupt callback information structure.
Definition: async_read.h:43
native_async_read_add_int_handler
void native_async_read_add_int_handler(int fd, void *arg, native_async_read_callback_t handler)
start monitoring of file descriptor as interrupt