Change in simtrace2[master]: card_emu: Rename fi to Fi and di to Di

laforge gerrit-no-reply at lists.osmocom.org
Tue Apr 6 00:18:10 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/23638 )


Change subject: card_emu: Rename fi to Fi and di to Di
......................................................................

card_emu: Rename fi to Fi and di to Di

As we will soon introduce the distinction between Fi and F, we should
use uppercase letters, as lower-case 'f' is defined in ISO7816-3 as
the frequency, which is different from the upper-case 'F'.

Change-Id: Iaede621551520576e9b9af878fa46fbc88e59c2a
---
M firmware/libcommon/source/card_emu.c
1 file changed, 14 insertions(+), 15 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/38/23638/1

diff --git a/firmware/libcommon/source/card_emu.c b/firmware/libcommon/source/card_emu.c
index 5ab6cab..5feb157 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -155,8 +155,8 @@
 	bool clocked;	/*< if clock is active ( true = active, false = inactive) */
 
 	/* timing parameters, from PTS */
-	uint8_t fi;
-	uint8_t di;
+	uint8_t Fi;
+	uint8_t Di;
 	uint8_t wi;
 
 	uint8_t tc_chan;	/* TC channel number */
@@ -361,10 +361,10 @@
 {
 	int rc;
 
-	rc = compute_fidi_ratio(ch->fi, ch->di);
+	rc = compute_fidi_ratio(ch->Fi, ch->Di);
 	if (rc > 0 && rc < 0x400) {
 		TRACE_INFO("%u: computed Fi(%u) Di(%u) ratio: %d\r\n",
-			    ch->num, ch->fi, ch->di, rc);
+			    ch->num, ch->Fi, ch->Di, rc);
 		/* make sure UART uses new F/D ratio */
 		card_emu_uart_update_fidi(ch->uart_chan, rc);
 		/* notify ETU timer about this */
@@ -395,8 +395,8 @@
 		break;
 	case ISO_S_WAIT_ATR:
 		/* Reset to initial Fi / Di ratio */
-		ch->fi = 1;
-		ch->di = 1;
+		ch->Fi = 1;
+		ch->Di = 1;
 		emu_update_fidi(ch);
 		/* the ATR should only be sent 400 to 40k clock cycles after the RESET.
 		 * we use the tc_etu mechanism to wait this time.
@@ -490,7 +490,7 @@
 			}
 		}
 		/* update waiting time (see ISO 7816-3 10.2) */
-		ch->waiting_time = ch->wi * 960 * ch->fi;
+		ch->waiting_time = ch->wi * 960 * ch->Fi;
 		tc_etu_set_wtime(ch->tc_chan, ch->waiting_time);
 		/* go to next state */
 		card_set_state(ch, ISO_S_WAIT_TPDU);
@@ -626,10 +626,9 @@
 	case PTS_S_WAIT_RESP_PTS1:
 		byte = ch->pts.resp[_PTS1];
 		/* This must be TA1 */
-		ch->fi = byte >> 4;
-		ch->di = byte & 0xf;
-		TRACE_DEBUG("%u: found Fi=%u Di=%u\r\n", ch->num,
-			    ch->fi, ch->di);
+		ch->Fi = byte >> 4;
+		ch->Di = byte & 0xf;
+		TRACE_DEBUG("%u: found Fi=%u Di=%u\r\n", ch->num, ch->Fi, ch->Di);
 		break;
 	case PTS_S_WAIT_RESP_PTS2:
 		byte = ch->pts.resp[_PTS2];
@@ -1025,8 +1024,8 @@
 	if (ch->in_reset)
 		sts->flags |= CEMU_STATUS_F_RESET_ACTIVE;
 	/* FIXME: voltage + card insert */
-	sts->fi = ch->fi;
-	sts->di = ch->di;
+	sts->fi = ch->Fi;
+	sts->di = ch->Di;
 	sts->wi = ch->wi;
 	sts->waiting_time = ch->waiting_time;
 
@@ -1232,8 +1231,8 @@
 	ch->in_reset = in_reset;
 	ch->clocked = clocked;
 
-	ch->fi = 0;
-	ch->di = 1;
+	ch->Fi = 0;
+	ch->Di = 1;
 	ch->wi = ISO7816_3_DEFAULT_WI;
 
 	ch->tc_chan = tc_chan;

-- 
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23638
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Iaede621551520576e9b9af878fa46fbc88e59c2a
Gerrit-Change-Number: 23638
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210406/238a3943/attachment.htm>


More information about the gerrit-log mailing list