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 fe698d05c395bd43d922fb4a0fa3a8f95b9baffa
Author: Andrzej Kaczmarek <andrzej.kaczma...@codecoup.pl>
AuthorDate: Wed Oct 12 21:42:30 2022 +0200

    hw/ipc_nrf5340: Add note to some APIs
    
    APIs that access IPC channel in general can be used outside callback
    assuming caller takes care that other context on the same MCU does not
    try to write to that IPC channel.
---
 .../ipc_nrf5340/include/ipc_nrf5340/ipc_nrf5340.h  | 35 ++++++++++++++++------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/hw/drivers/ipc_nrf5340/include/ipc_nrf5340/ipc_nrf5340.h 
b/hw/drivers/ipc_nrf5340/include/ipc_nrf5340/ipc_nrf5340.h
index b20ecc5a6..40c61a577 100644
--- a/hw/drivers/ipc_nrf5340/include/ipc_nrf5340/ipc_nrf5340.h
+++ b/hw/drivers/ipc_nrf5340/include/ipc_nrf5340/ipc_nrf5340.h
@@ -87,8 +87,11 @@ int ipc_nrf5340_send(int channel, const void *data, uint16_t 
len);
 int ipc_nrf5340_write(int channel, const void *data, uint16_t len, bool last);
 
 /**
- * Reads data from IPC ring buffer to specified flat buffer. Should be used 
only
- * from ipc_nrf5340_recv_cb context.
+ * Reads data from IPC ring buffer to specified flat buffer.
+ *
+ * Note: this function does not use any kind of locking so it's up to caller
+ *       to make sure it's not used during write from other context as it may
+ *       yield incorrect results.
  *
  * @param channel     IPC channel number to read from
  * @param buf         Buffer to read data to
@@ -99,8 +102,11 @@ int ipc_nrf5340_write(int channel, const void *data, 
uint16_t len, bool last);
 uint16_t ipc_nrf5340_read(int channel, void *buf, uint16_t len);
 
 /**
- * Reads data from IPC ring buffer to specified mbuf. Should be used only
- * from ipc_nrf5340_recv_cb context.
+ * Reads data from IPC ring buffer to specified mbuf.
+ *
+ * Note: this function does not use any kind of locking so it's up to caller
+ *       to make sure it's not used during write from other context as it may
+ *       yield incorrect results.
  *
  * @param channel     IPC channel number to read from
  * @param om          mbuf to read data to
@@ -111,8 +117,11 @@ uint16_t ipc_nrf5340_read(int channel, void *buf, uint16_t 
len);
 uint16_t ipc_nrf5340_read_om(int channel, struct os_mbuf *om, uint16_t len);
 
 /**
- * Returns number of data bytes available in IPC ring buffer. Should be used
- * only from ipc_nrf5340_recv_cb context.
+ * Returns number of data bytes available in IPC ring buffer.
+ *
+ * Note: this function does not use any kind of locking so it's up to caller
+ *       to make sure it's not used during write from other context as it may
+ *       yield incorrect results.
  *
  * @param channel     IPC channel number
  *
@@ -122,7 +131,12 @@ uint16_t ipc_nrf5340_available(int channel);
 
 /**
  * Returns number of continuous data bytes available in IPC ring buffer with
- * pointer to that data. Should be used only from ipc_nrf5340_recv_cb context.
+ * pointer to that data.
+ *
+ * Note: this function does not use any kind of locking so it's up to caller
+ *       to make sure it's not used during write from other context as it may
+ *       yield incorrect results.
+ *
  *
  * @param channel     IPC channel number
  * @param dptr        Pointer to data buffer
@@ -158,8 +172,11 @@ uint16_t ipc_nrf5340_data_available_get(int channel);
 uint16_t ipc_nrf5340_data_free_get(int channel);
 
 /**
- * Consumes data from IPC ring buffer without copying. Should be used only
- * from ipc_nrf5340_recv_cb context.
+ * Consumes data from IPC ring buffer without copying.
+ *
+ * Note: this function does not use any kind of locking so it's up to caller
+ *       to make sure it's not used during write from other context as it may
+ *       yield incorrect results.
  *
  * @param channel     IPC channel number to consume from
  * @param len         Number of bytes to consume

Reply via email to