aboutsummaryrefslogtreecommitdiffstats
path: root/os/lib/src
diff options
context:
space:
mode:
Diffstat (limited to 'os/lib/src')
-rw-r--r--os/lib/src/chfactory.c5
-rw-r--r--os/lib/src/chpipes.c4
2 files changed, 6 insertions, 3 deletions
diff --git a/os/lib/src/chfactory.c b/os/lib/src/chfactory.c
index 149f673d8..a40984ac4 100644
--- a/os/lib/src/chfactory.c
+++ b/os/lib/src/chfactory.c
@@ -271,6 +271,9 @@ void _factory_init(void) {
#if CH_CFG_FACTORY_OBJ_FIFOS == TRUE
dyn_list_init(&ch_factory.fifo_list);
#endif
+#if CH_CFG_FACTORY_PIPES == TRUE
+ dyn_list_init(&ch_factory.pipe_list);
+#endif
}
#if (CH_CFG_FACTORY_OBJECTS_REGISTRY == TRUE) || defined(__DOXIGEN__)
@@ -775,7 +778,7 @@ dyn_pipe_t *chFactoryFindPipe(const char *name) {
F_LOCK();
- dpp = (dyn_pipe_t *)dyn_find_object(name, &ch_factory.fifo_list);
+ dpp = (dyn_pipe_t *)dyn_find_object(name, &ch_factory.pipe_list);
F_UNLOCK();
diff --git a/os/lib/src/chpipes.c b/os/lib/src/chpipes.c
index 34c8870fb..8057fdab8 100644
--- a/os/lib/src/chpipes.c
+++ b/os/lib/src/chpipes.c
@@ -138,8 +138,8 @@ static size_t pipe_read(pipe_t *pp, uint8_t *bp, size_t n) {
size_t s1, s2;
/* Number of bytes that can be read in a single atomic operation.*/
- if (n > chPipeGetFreeCount(pp)) {
- n = chPipeGetFreeCount(pp);
+ if (n > chPipeGetUsedCount(pp)) {
+ n = chPipeGetUsedCount(pp);
}
/* Number of bytes before buffer limit.*/