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