From 6b9d1341109e01d45edc17f91abbd1c71b3d8b57 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 2 Sep 2017 12:40:56 +0000 Subject: PAL synchronous API. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10528 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/hal_pal.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'os/hal/src') 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 */ /** @} */ -- cgit v1.2.3