You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2018/11/19 17:07:53 UTC

[mynewt-core] 06/07: add logs

This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch dma_i2c_new_api
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 13a1c69c76edd16a7964953967ae76bb2ce32c73
Author: Vipul Rahane <vi...@runtime.io>
AuthorDate: Wed Oct 24 20:00:17 2018 -0700

    add logs
---
 hw/mcu/nordic/nrf52xxx/src/hal_i2c.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c b/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
index 5a81e86..c2c5e71 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
@@ -391,13 +391,15 @@ hal_i2c_handle_transact_start(struct nrf52_hal_i2c *i2c, uint8_t op,
     return 0;
 }
 
+os_time_t g_start;
+
 static int
 hal_i2c_handle_transact_end(NRF_TWIM_Type *regs, uint8_t op, uint32_t start,
                             os_time_t abs_timo, uint8_t last_op)
 {
     int rc;
     volatile uint32_t *evt;
-    os_time_t now;
+    os_time_t now = 0;
 
     while(1) {
         /*
@@ -432,6 +434,10 @@ hal_i2c_handle_transact_end(NRF_TWIM_Type *regs, uint8_t op, uint32_t start,
         }
     }
 
+    g_start = os_cputime_get32() - g_start;
+
+    console_printf("t:%lu r:%u\n", g_start, op);
+
     return 0;
 err:
     return rc;
@@ -510,6 +516,8 @@ hal_i2c_handle_errors(struct nrf52_hal_i2c *i2c, int rc, os_time_t abs_timo)
     return rc;
 }
 
+os_time_t g_start;
+
 /* Perform I2C master writes using TWIM/EasyDMA */
 int
 hal_i2c_master_write(uint8_t i2c_num, struct hal_i2c_master_data *pdata,
@@ -521,6 +529,7 @@ hal_i2c_master_write(uint8_t i2c_num, struct hal_i2c_master_data *pdata,
     struct nrf52_hal_i2c *i2c;
 
     start = os_time_get();
+    g_start = os_cputime_get32();
 
     /* Resolve the I2C bus */
     rc = hal_i2c_resolve(i2c_num, &i2c);
@@ -595,6 +604,7 @@ hal_i2c_master_read(uint8_t i2c_num, struct hal_i2c_master_data *pdata,
     struct nrf52_hal_i2c *i2c;
 
     start = os_time_get();
+    g_start = os_cputime_get32();
 
     /* Resolve the I2C bus */
     rc = hal_i2c_resolve(i2c_num, &i2c);