mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
mbed_poll.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2017 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #ifndef MBED_POLL_H 00018 #define MBED_POLL_H 00019 00020 #define POLLIN 0x0001 ///< Data may be read without blocking 00021 #define POLLOUT 0x0010 ///< Data may be written without blocking 00022 #define POLLERR 0x1000 ///< An error has occurred on the device or stream 00023 #define POLLHUP 0x2000 ///< The device has been disconnected 00024 #define POLLNVAL 0x4000 ///< The specified file handle value is invalid 00025 00026 namespace mbed { 00027 00028 class FileHandle; 00029 00030 /** \addtogroup platform */ 00031 /** @{*/ 00032 /** 00033 * \defgroup platform_poll poll functions 00034 * @{ 00035 */ 00036 00037 struct pollfh { 00038 FileHandle *fh; 00039 short events; 00040 short revents; 00041 }; 00042 00043 /** A mechanism to multiplex input/output over a set of file handles(file descriptors). 00044 * For every file handle provided, poll() examines it for any events registered for that particular 00045 * file handle. 00046 * 00047 * @param fhs an array of PollFh struct carrying a FileHandle and bitmasks of events 00048 * @param nfhs number of file handles 00049 * @param timeout timer value to timeout or -1 for loop forever 00050 * 00051 * @return number of file handles selected (for which revents is non-zero). 0 if timed out with nothing selected. -1 for error. 00052 */ 00053 int poll(pollfh fhs[], unsigned nfhs, int timeout); 00054 00055 /**@}*/ 00056 00057 /**@}*/ 00058 00059 } // namespace mbed 00060 00061 #endif //MBED_POLL_H
Generated on Tue Jul 12 2022 20:41:15 by 1.7.2