test test test

Dependencies:   mbed

Committer:
mohamedmoawya
Date:
Mon May 25 19:06:11 2020 +0000
Revision:
0:e4c5e6ec922e
snake game tteest

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mohamedmoawya 0:e4c5e6ec922e 1 /* mbed Microcontroller Library
mohamedmoawya 0:e4c5e6ec922e 2 * Copyright (c) 2017 ARM Limited
mohamedmoawya 0:e4c5e6ec922e 3 *
mohamedmoawya 0:e4c5e6ec922e 4 * Licensed under the Apache License, Version 2.0 (the "License");
mohamedmoawya 0:e4c5e6ec922e 5 * you may not use this file except in compliance with the License.
mohamedmoawya 0:e4c5e6ec922e 6 * You may obtain a copy of the License at
mohamedmoawya 0:e4c5e6ec922e 7 *
mohamedmoawya 0:e4c5e6ec922e 8 * http://www.apache.org/licenses/LICENSE-2.0
mohamedmoawya 0:e4c5e6ec922e 9 *
mohamedmoawya 0:e4c5e6ec922e 10 * Unless required by applicable law or agreed to in writing, software
mohamedmoawya 0:e4c5e6ec922e 11 * distributed under the License is distributed on an "AS IS" BASIS,
mohamedmoawya 0:e4c5e6ec922e 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mohamedmoawya 0:e4c5e6ec922e 13 * See the License for the specific language governing permissions and
mohamedmoawya 0:e4c5e6ec922e 14 * limitations under the License.
mohamedmoawya 0:e4c5e6ec922e 15 */
mohamedmoawya 0:e4c5e6ec922e 16 #ifndef MBED_POLL_H
mohamedmoawya 0:e4c5e6ec922e 17 #define MBED_POLL_H
mohamedmoawya 0:e4c5e6ec922e 18
mohamedmoawya 0:e4c5e6ec922e 19 #define POLLIN 0x0001 ///< Data may be read without blocking
mohamedmoawya 0:e4c5e6ec922e 20 #define POLLOUT 0x0010 ///< Data may be written without blocking
mohamedmoawya 0:e4c5e6ec922e 21 #define POLLERR 0x1000 ///< An error has occurred on the device or stream
mohamedmoawya 0:e4c5e6ec922e 22 #define POLLHUP 0x2000 ///< The device has been disconnected
mohamedmoawya 0:e4c5e6ec922e 23 #define POLLNVAL 0x4000 ///< The specified file handle value is invalid
mohamedmoawya 0:e4c5e6ec922e 24
mohamedmoawya 0:e4c5e6ec922e 25 namespace mbed {
mohamedmoawya 0:e4c5e6ec922e 26
mohamedmoawya 0:e4c5e6ec922e 27 class FileHandle;
mohamedmoawya 0:e4c5e6ec922e 28
mohamedmoawya 0:e4c5e6ec922e 29 /** \addtogroup platform */
mohamedmoawya 0:e4c5e6ec922e 30 /** @{*/
mohamedmoawya 0:e4c5e6ec922e 31 /**
mohamedmoawya 0:e4c5e6ec922e 32 * \defgroup platform_poll poll functions
mohamedmoawya 0:e4c5e6ec922e 33 * @{
mohamedmoawya 0:e4c5e6ec922e 34 */
mohamedmoawya 0:e4c5e6ec922e 35
mohamedmoawya 0:e4c5e6ec922e 36 struct pollfh {
mohamedmoawya 0:e4c5e6ec922e 37 FileHandle *fh;
mohamedmoawya 0:e4c5e6ec922e 38 short events;
mohamedmoawya 0:e4c5e6ec922e 39 short revents;
mohamedmoawya 0:e4c5e6ec922e 40 };
mohamedmoawya 0:e4c5e6ec922e 41
mohamedmoawya 0:e4c5e6ec922e 42 /** A mechanism to multiplex input/output over a set of file handles(file descriptors).
mohamedmoawya 0:e4c5e6ec922e 43 * For every file handle provided, poll() examines it for any events registered for that particular
mohamedmoawya 0:e4c5e6ec922e 44 * file handle.
mohamedmoawya 0:e4c5e6ec922e 45 *
mohamedmoawya 0:e4c5e6ec922e 46 * @param fhs an array of PollFh struct carrying a FileHandle and bitmasks of events
mohamedmoawya 0:e4c5e6ec922e 47 * @param nfhs number of file handles
mohamedmoawya 0:e4c5e6ec922e 48 * @param timeout timer value to timeout or -1 for loop forever
mohamedmoawya 0:e4c5e6ec922e 49 *
mohamedmoawya 0:e4c5e6ec922e 50 * @return number of file handles selected (for which revents is non-zero). 0 if timed out with nothing selected. -1 for error.
mohamedmoawya 0:e4c5e6ec922e 51 */
mohamedmoawya 0:e4c5e6ec922e 52 int poll(pollfh fhs[], unsigned nfhs, int timeout);
mohamedmoawya 0:e4c5e6ec922e 53
mohamedmoawya 0:e4c5e6ec922e 54 /**@}*/
mohamedmoawya 0:e4c5e6ec922e 55
mohamedmoawya 0:e4c5e6ec922e 56 /**@}*/
mohamedmoawya 0:e4c5e6ec922e 57
mohamedmoawya 0:e4c5e6ec922e 58 } // namespace mbed
mohamedmoawya 0:e4c5e6ec922e 59
mohamedmoawya 0:e4c5e6ec922e 60 #endif //MBED_POLL_H