Change in osmo-ccid-firmware[master]: debug code to measure uart timing using the CAN header

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Nov 28 15:23:44 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/16278 )

Change subject: debug code to measure uart timing using the CAN header
......................................................................

debug code to measure uart timing using the CAN header

Change-Id: I5f2c174076b5599dcb56f887330de27f470aeffc
---
M ccid_common/iso7816_fsm.c
M sysmoOCTSIM/hpl/sercom/hpl_sercom.c
M sysmoOCTSIM/main.c
3 files changed, 37 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c
index 98c32d3..031f6b0 100644
--- a/ccid_common/iso7816_fsm.c
+++ b/ccid_common/iso7816_fsm.c
@@ -1134,6 +1134,7 @@
 	}
 }
 
+#include <hal_gpio.h>
 static void tpdu_s_tx_hdr_action(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
 	OSMO_ASSERT(fi->fsm == &tpdu_fsm);
@@ -1173,6 +1174,12 @@
 		} else if (byte == tpduh->ins) {
 			if (tfp->is_command) {
 				/* transmit all remaining bytes */
+#if 0
+// rx -> tx delay
+				gpio_set_pin_level(PIN_PB12, true);
+				delay_us(1);
+				gpio_set_pin_level(PIN_PB12, false);
+#endif
 				card_uart_tx(ip->uart, msgb_l2(tfp->tpdu), msgb_l2len(tfp->tpdu), true);
 				osmo_fsm_inst_state_chg(fi, TPDU_S_TX_REMAINING, 0, 0);
 			} else {
diff --git a/sysmoOCTSIM/hpl/sercom/hpl_sercom.c b/sysmoOCTSIM/hpl/sercom/hpl_sercom.c
index f235115..272fb07 100644
--- a/sysmoOCTSIM/hpl/sercom/hpl_sercom.c
+++ b/sysmoOCTSIM/hpl/sercom/hpl_sercom.c
@@ -577,7 +577,7 @@
 		hri_sercomusart_write_INTEN_ERROR_bit(device->hw, state);
 	}
 }
-
+#include <hal_gpio.h>
 /**
  * \internal Sercom interrupt handler
  *
@@ -591,6 +591,12 @@
 		hri_sercomusart_clear_INTEN_DRE_bit(hw);
 		device->usart_cb.tx_byte_sent(device);
 	} else if (hri_sercomusart_get_interrupt_TXC_bit(hw) && hri_sercomusart_get_INTEN_TXC_bit(hw)) {
+#if 0
+// tx byte last edge <-> txc irq delay
+				gpio_set_pin_level(PIN_PB12, true);
+				delay_us(1);
+				gpio_set_pin_level(PIN_PB12, false);
+#endif
 		hri_sercomusart_clear_INTEN_TXC_bit(hw);
 		device->usart_cb.tx_done_cb(device);
 	} else if (hri_sercomusart_get_interrupt_RXC_bit(hw)) {
@@ -600,8 +606,20 @@
 			hri_sercomusart_clear_STATUS_reg(hw, SERCOM_USART_STATUS_MASK);
 			return;
 		}
+#if 0
+// rx byte last edge <-> rxc irq delay
+				gpio_set_pin_level(PIN_PB12, true);
+				delay_us(1);
+				gpio_set_pin_level(PIN_PB12, false);
+#endif
 
 		device->usart_cb.rx_done_cb(device, hri_sercomusart_read_DATA_reg(hw));
+#if 0
+// rx byte last edge <-> rxc irq end delay
+				gpio_set_pin_level(PIN_PB12, true);
+				delay_us(1);
+				gpio_set_pin_level(PIN_PB12, false);
+#endif
 	} else if (hri_sercomusart_get_interrupt_ERROR_bit(hw)) {
 		uint32_t status;
 
diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index a1b84b7..54616af 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -506,6 +506,17 @@
 	}
 	submit_next_out();
 	CRITICAL_SECTION_LEAVE()
+#if 0
+	/* CAN_RX */
+	gpio_set_pin_function(PIN_PB12, GPIO_PIN_FUNCTION_OFF);
+	gpio_set_pin_direction(PIN_PB12, GPIO_DIRECTION_OUT);
+	gpio_set_pin_level(PIN_PB12, false);
+
+	/* CAN_TX */
+	gpio_set_pin_function(PIN_PB13, GPIO_PIN_FUNCTION_OFF);
+	gpio_set_pin_direction(PIN_PB13, GPIO_DIRECTION_OUT);
+	gpio_set_pin_level(PIN_PB13, false);
+#endif
 
 //	command_print_prompt();
 	while (true) { // main loop

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/16278
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: I5f2c174076b5599dcb56f887330de27f470aeffc
Gerrit-Change-Number: 16278
Gerrit-PatchSet: 4
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191128/e13cc4aa/attachment.htm>


More information about the gerrit-log mailing list