-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
isrpipe: split isrpipe_read_timeout to isolate xtimer dependency
This defines a new 'isrpipe_read_timeout' that should be used when using the timeout based function of isrpipe. This fix the implicit dependency to 'xtimer' that is only needed for the '_timeout' functions. It prevents 'stdio_uart' that uses 'isrpipe' to need to depend on xtimer. This was silently solved at link time for most platforms but not for the 'esp32' for example. 'drivers/at' needed to be updated at the same time to follow the api change.
- Loading branch information
Showing
8 changed files
with
86 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de> | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
*/ | ||
|
||
/** | ||
* @defgroup isr_pipe ISR Pipe | ||
* @ingroup sys | ||
* @brief ISR -> userspace pipe with timeout | ||
* | ||
* @{ | ||
* @file | ||
* @brief isrpipe read timeout Interface | ||
* | ||
* @author Kaspar Schleiser <kaspar@schleiser.de> | ||
* | ||
*/ | ||
|
||
#ifndef ISRPIPE_READ_TIMEOUT_H | ||
#define ISRPIPE_READ_TIMEOUT_H | ||
|
||
#include "isrpipe.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Read data from isrpipe (with timeout, blocking) | ||
* | ||
* Currently, the timeout parameter is applied on every underlying read, which | ||
* might be *per single byte*. | ||
* | ||
* @note This function might return less than @p count bytes | ||
* | ||
* @param[in] isrpipe isrpipe object to operate on | ||
* @param[in] buf buffer to write to | ||
* @param[in] count number of bytes to read | ||
* @param[in] timeout timeout in microseconds | ||
* | ||
* @returns number of bytes read | ||
* @returns -ETIMEDOUT on timeout | ||
*/ | ||
int isrpipe_read_timeout(isrpipe_t *isrpipe, char *buf, size_t count, uint32_t timeout); | ||
|
||
/** | ||
* @brief Read data from isrpipe (with timeout, blocking, wait until all read) | ||
* | ||
* This function is like @ref isrpipe_read_timeout, but will only return on | ||
* timeout or when @p count bytes have been received. | ||
* | ||
* @param[in] isrpipe isrpipe object to operate on | ||
* @param[in] buf buffer to write to | ||
* @param[in] count number of bytes to read | ||
* @param[in] timeout timeout in microseconds | ||
* | ||
* @returns number of bytes read | ||
* @returns -ETIMEDOUT on timeout | ||
*/ | ||
int isrpipe_read_all_timeout(isrpipe_t *isrpipe, char *buf, size_t count, uint32_t timeout); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
/** @} */ | ||
#endif /* ISRPIPE_READ_TIMEOUT_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
MODULE = isrpipe_read_timeout | ||
|
||
include $(RIOTBASE)/Makefile.base |