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