You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/06/17 11:21:48 UTC
[mynewt-core] branch master updated: bus/i2c_nrf5x: Assert on not
supported usage
This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 7091e33 bus/i2c_nrf5x: Assert on not supported usage
7091e33 is described below
commit 7091e33b6135502ba07b132c78851ddb1c8c2123
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Thu Jun 17 11:35:55 2021 +0200
bus/i2c_nrf5x: Assert on not supported usage
Current code return error code when read was called
with BUS_F_NOSTOP flag set.
It seems better to just assert at line where the user can
see why this not working instead of returning error code
where user will have to figure out why I2C lines are dead.
This kind of problem is not something that can be fixed
in runtime by just repeating read it will always fail
until the code is modified not to use such flag.
This change should alert the user that this kind of desired
behavior will not work on this platform.
---
hw/bus/drivers/i2c_nrf52_twim/src/i2c_nrf52_twim.c | 1 +
hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c | 1 +
hw/bus/drivers/i2c_nrf91_twim/src/i2c_nrf91_twim.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/hw/bus/drivers/i2c_nrf52_twim/src/i2c_nrf52_twim.c b/hw/bus/drivers/i2c_nrf52_twim/src/i2c_nrf52_twim.c
index 2e525a3..63c799a 100644
--- a/hw/bus/drivers/i2c_nrf52_twim/src/i2c_nrf52_twim.c
+++ b/hw/bus/drivers/i2c_nrf52_twim/src/i2c_nrf52_twim.c
@@ -464,6 +464,7 @@ bus_i2c_nrf52_twim_read(struct bus_dev *bdev, struct bus_node *bnode,
* XXX we may use PPI to workaround for missing shortcut but it's
* probably not really that useful and not worth the effort.
*/
+ assert(0);
return SYS_ENOTSUP;
}
diff --git a/hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c b/hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c
index ebc97a7..11e3c90 100644
--- a/hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c
+++ b/hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c
@@ -260,6 +260,7 @@ bus_i2c_nrf5340_read(struct bus_dev *bdev, struct bus_node *bnode,
* stop after receiving last byte - return not supported if NOSTOP was
* requested for this read.
*/
+ assert(0);
return SYS_ENOTSUP;
}
diff --git a/hw/bus/drivers/i2c_nrf91_twim/src/i2c_nrf91_twim.c b/hw/bus/drivers/i2c_nrf91_twim/src/i2c_nrf91_twim.c
index 04e78fa..302777b 100644
--- a/hw/bus/drivers/i2c_nrf91_twim/src/i2c_nrf91_twim.c
+++ b/hw/bus/drivers/i2c_nrf91_twim/src/i2c_nrf91_twim.c
@@ -456,6 +456,7 @@ bus_i2c_nrf91_twim_read(struct bus_dev *bdev, struct bus_node *bnode,
* XXX we may use PPI to workaround for missing shortcut but it's
* probably not really that useful and not worth the effort.
*/
+ assert(0);
return SYS_ENOTSUP;
}