You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2018/11/29 21:08:36 UTC
[mynewt-core] 06/14: hw/bus: Allow to configure default transaction
timeout
This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit c8b234543d2a6c6dc1fba4475136bc7513676234
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Nov 26 14:50:30 2018 +0100
hw/bus: Allow to configure default transaction timeout
This is used when using simple transaction APIs which do not specify
timeouts explicitly.
---
hw/bus/include/bus/bus.h | 11 ++++++++---
hw/bus/syscfg.yml | 5 +++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/hw/bus/include/bus/bus.h b/hw/bus/include/bus/bus.h
index dbccd7b..9158570 100644
--- a/hw/bus/include/bus/bus.h
+++ b/hw/bus/include/bus/bus.h
@@ -119,7 +119,9 @@ bus_node_write_read_transact(struct os_dev *node, const void *wbuf,
static inline int
bus_node_simple_read(struct os_dev *node, void *buf, uint16_t length)
{
- return bus_node_read(node, buf, length, OS_TIMEOUT_NEVER, BUS_F_NONE);
+ return bus_node_read(node, buf, length,
+ os_time_ms_to_ticks32(MYNEWT_VAL(BUS_DEFAULT_TRANSACTION_TIMEOUT_MS)),
+ BUS_F_NONE);
}
/**
@@ -136,7 +138,9 @@ bus_node_simple_read(struct os_dev *node, void *buf, uint16_t length)
static inline int
bus_node_simple_write(struct os_dev *node, const void *buf, uint16_t length)
{
- return bus_node_write(node, buf, length, OS_TIMEOUT_NEVER, BUS_F_NONE);
+ return bus_node_write(node, buf, length,
+ os_time_ms_to_ticks32(MYNEWT_VAL(BUS_DEFAULT_TRANSACTION_TIMEOUT_MS)),
+ BUS_F_NONE);
}
/**
@@ -159,7 +163,8 @@ bus_node_simple_write_read_transact(struct os_dev *node, const void *wbuf,
uint16_t rlength)
{
return bus_node_write_read_transact(node, wbuf, wlength, rbuf, rlength,
- OS_TIMEOUT_NEVER, BUS_F_NONE);
+ os_time_ms_to_ticks32(MYNEWT_VAL(BUS_DEFAULT_TRANSACTION_TIMEOUT_MS)),
+ BUS_F_NONE);
}
/**
diff --git a/hw/bus/syscfg.yml b/hw/bus/syscfg.yml
index be0d133..7a19cde 100644
--- a/hw/bus/syscfg.yml
+++ b/hw/bus/syscfg.yml
@@ -26,6 +26,11 @@ syscfg.defs:
description: >
Default timeout for locking the bus. This can be overriden per-node.
value: 1000
+ BUS_DEFAULT_TRANSACTION_TIMEOUT_MS:
+ description: >
+ Default timeout for transaction on bus. This is used for simple
+ transaction APIs (i.e. without timeout set explicitly)
+ value: 10
BUS_DEBUG_OS_DEV:
description: >