Change in osmo-ccid-firmware[master]: relax the timeouts

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/.

Hoernchen gerrit-no-reply at lists.osmocom.org
Thu Jul 30 21:23:36 UTC 2020


Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/19472 )


Change subject: relax the timeouts
......................................................................

relax the timeouts

High baud rates lead to incredibly small wait times that are infeasible
as long as software timers are being used, but this is not really a
problem - they can just be increased to a reasonable value.
At the end of the day the timers need to take the latency of the
firmware into account, and timeouts only occur on powerup with wrong
voltages/dead cards, or in rare error cases.
The actual timeout value does therefore not really matter that much.

Change-Id: Icb733f2d46f45c1a7dcd2abe6bc292bd41d6b9c2
---
M ccid_common/cuart.c
1 file changed, 9 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/72/19472/1

diff --git a/ccid_common/cuart.c b/ccid_common/cuart.c
index 1d777f9..7094a86 100644
--- a/ccid_common/cuart.c
+++ b/ccid_common/cuart.c
@@ -52,9 +52,16 @@
 	if(!cuart->current_wtime_byte)
 		return;
 
+	int etu_in_us = get_etu_in_us(cuart) + 1;
+	cuart->wtime_etu = cuart->wtime_etu ? cuart->wtime_etu : 1;
+
 	/* timemout is wtime * ETU + expected number of bytes * (12ETU+1 slack)ETU */
-	usecs = get_etu_in_us(cuart) * cuart->wtime_etu +
-			get_etu_in_us(cuart) * cuart->current_wtime_byte * (12+1);
+	usecs = etu_in_us * cuart->wtime_etu +
+			etu_in_us * cuart->current_wtime_byte * (12+1);
+
+	/* limit lower wait time to reasonable value */
+	usecs = usecs < 300000 ? 300000 : usecs;
+
 	if (usecs > 1000000) {
 		secs = usecs / 1000000;
 		usecs = usecs % 1000000;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/19472
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: Icb733f2d46f45c1a7dcd2abe6bc292bd41d6b9c2
Gerrit-Change-Number: 19472
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200730/d037782e/attachment.htm>


More information about the gerrit-log mailing list