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/21 19:32:38 UTC
[mynewt-core] 02/02: hw/drivers/i2s: Fix nrf5x driver stop
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
commit 01760b74dbb68fe6191df4e04fd7930bc54b5950
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Mon Jun 14 12:53:48 2021 +0200
hw/drivers/i2s: Fix nrf5x driver stop
If i2s device (i2s out) was opened and it
was never used and then close. NRFX assert
would fire.
Now nrfx_i2s_stop is not called from i2s_driver_stop
when it was never started.
---
hw/drivers/i2s/i2s_nrf52/src/i2s_nrf52.c | 8 ++++----
hw/drivers/i2s/i2s_nrfx/src/i2s_nrfx.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/drivers/i2s/i2s_nrf52/src/i2s_nrf52.c b/hw/drivers/i2s/i2s_nrf52/src/i2s_nrf52.c
index fc73b81..df3a498 100644
--- a/hw/drivers/i2s/i2s_nrf52/src/i2s_nrf52.c
+++ b/hw/drivers/i2s/i2s_nrf52/src/i2s_nrf52.c
@@ -155,10 +155,10 @@ i2s_driver_stop(struct i2s *i2s)
{
struct i2s_sample_buffer *buffer;
- nrf52_i2s.running = false;
- nrfx_i2s_stop();
-
- assert(nrf52_i2s.i2s->state == I2S_STATE_STOPPED);
+ if (nrf52_i2s.running) {
+ nrf52_i2s.running = false;
+ nrfx_i2s_stop();
+ }
while (NULL != (buffer = i2s_driver_buffer_get(i2s))) {
i2s_driver_buffer_put(i2s, buffer);
diff --git a/hw/drivers/i2s/i2s_nrfx/src/i2s_nrfx.c b/hw/drivers/i2s/i2s_nrfx/src/i2s_nrfx.c
index e9284dd..751d93c 100644
--- a/hw/drivers/i2s/i2s_nrfx/src/i2s_nrfx.c
+++ b/hw/drivers/i2s/i2s_nrfx/src/i2s_nrfx.c
@@ -170,10 +170,10 @@ i2s_driver_stop(struct i2s *i2s)
{
struct i2s_sample_buffer *buffer;
- i2s_nrfx.running = false;
- nrfx_i2s_stop();
-
- assert(i2s_nrfx.i2s->state == I2S_STATE_STOPPED);
+ if (i2s_nrfx.running) {
+ i2s_nrfx.running = false;
+ nrfx_i2s_stop();
+ }
while (NULL != (buffer = i2s_driver_buffer_get(i2s))) {
i2s_driver_buffer_put(i2s, buffer);