Implement a very crude busy-wait based select() mechanism for consol input.
--HG-- branch : dtrg-videocore rename : plat/rpi/include/ack/config.h => plat/rpi/include/sys/select.h rename : plat/rpi/libsys/time.c => plat/rpi/libsys/select.c
This commit is contained in:
13
plat/rpi/include/sys/select.h
Normal file
13
plat/rpi/include/sys/select.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Raspberry Pi support library for the ACK
|
||||
* © 2013 David Given
|
||||
* This file is redistributable under the terms of the 3-clause BSD license.
|
||||
* See the file 'Copying' in the root of the distribution for the full text.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SELECT_H
|
||||
#define _SYS_SELECT_H
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#endif
|
||||
@@ -90,4 +90,16 @@ typedef void (*sighandler_t)(int);
|
||||
extern sighandler_t signal(int signum, sighandler_t handler);
|
||||
extern int raise(int signum);
|
||||
|
||||
/* Select */
|
||||
|
||||
typedef uint32_t fd_set;
|
||||
|
||||
extern int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
|
||||
#define FD_ZERO(set) do { *set = 0; } while (0)
|
||||
#define FD_SET(fd, set) do { *set |= (1<<fd); } while (0);
|
||||
#define FD_CLR(fd, set) do { *set &= ~(1<<fd); } while (0);
|
||||
#define FD_ISSET(fd, set) (*set | (1<<fd))
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user