The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
158:1c57384330a6
mbed library release version 165

Who changed what in which revision?

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