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:
David Given
2013-06-09 22:16:30 +01:00
parent bbd4b46850
commit eaf4339cd6
6 changed files with 107 additions and 1 deletions

View 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

View File

@@ -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