mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

Committer:
be_bryan
Date:
Mon Dec 11 17:54:04 2017 +0000
Revision:
0:b74591d5ab33
motor ++

Who changed what in which revision?

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