diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-09-02 12:40:56 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-09-02 12:40:56 +0000 |
commit | 6b9d1341109e01d45edc17f91abbd1c71b3d8b57 (patch) | |
tree | 3756f4d16b970ca9ed514cdcff4d3af0cd478694 /os/hal/src | |
parent | dec89f7333a6cdd598ceaf10ce510064ba8863f8 (diff) | |
download | ChibiOS-6b9d1341109e01d45edc17f91abbd1c71b3d8b57.tar.gz ChibiOS-6b9d1341109e01d45edc17f91abbd1c71b3d8b57.tar.bz2 ChibiOS-6b9d1341109e01d45edc17f91abbd1c71b3d8b57.zip |
PAL synchronous API.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10528 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src')
-rw-r--r-- | os/hal/src/hal_pal.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/os/hal/src/hal_pal.c b/os/hal/src/hal_pal.c index 0be77ad70..850c3506b 100644 --- a/os/hal/src/hal_pal.c +++ b/os/hal/src/hal_pal.c @@ -117,6 +117,46 @@ void palSetBusMode(IOBus *bus, iomode_t mode) { palSetGroupMode(bus->portid, bus->mask, bus->offset, mode);
}
+#if defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
+/**
+ * @brief Waits for an edge on the specified port/pad.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ * @returns The operation state.
+ * @retval MSG_OK if an edge has been detected.
+ * @retval MSG_TIMEOUT if a timeout occurred before an edge cound be detected.
+ * @retval MSG_RESET if the event has been disabled while the thread was
+ * waiting for an edge.
+ *
+ * @sclass
+ */
+msg_t palWaitPadTimeoutS(ioportid_t port, iopadid_t pad, systime_t timeout) {
+
+ palevent_t *pep = pal_lld_get_pad_event(port, pad);
+ return osalThreadEnqueueTimeoutS(&pep->threads, timeout);
+}
+
+/**
+ * @brief Waits for an edge on the specified line.
+ *
+ * @param[in] line line identifier
+ * @param[in] timeout operation timeout
+ * @returns The operation state.
+ * @retval MSG_OK if an edge has been detected.
+ * @retval MSG_TIMEOUT if a timeout occurred before an edge cound be detected.
+ * @retval MSG_RESET if the event has been disabled while the thread was
+ * waiting for an edge.
+ *
+ * @sclass
+ */
+msg_t palWaitLineTimeoutS(ioline_t line, systime_t timeout) {
+
+ palevent_t *pep = pal_lld_get_line_event(line);
+ return osalThreadEnqueueTimeoutS(&pep->threads, timeout);
+}
+#endif /* defined(PAL_USE_WAIT) */
+
#endif /* HAL_USE_PAL == TRUE */
/** @} */
|