Change in simtrace2[master]: sniffing: decrease USB IRQ prioprity to prevent USART overrun

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jul 4 20:44:21 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9881 )

Change subject: sniffing: decrease USB IRQ prioprity to prevent USART overrun
......................................................................

sniffing: decrease USB IRQ prioprity to prevent USART overrun

Handling the USB message queue is done in an ISR and take quite some time.
This can cause a USART/SIM sniffing buffer overrun, resulting in data loss.
By setting the USB IRQ lower than the USART IRQ, the USB ISR can be
interrupted (for short) and no data gets lost.

Change-Id: I870a0aa8e251bbb53249c54bfcaa45de5b5a9486
---
M firmware/libcommon/source/sniffer.c
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c
index 1b6d5e7..2a7ae5f 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -829,6 +829,10 @@
 	sniff_usart.base->US_RTOR = 9600-12; /* -12 because the timer starts at the end of the 12 ETU frame */
 	/* Enable interrupt to indicate when data has been received or timeout occurred */
 	USART_EnableIt(sniff_usart.base, US_IER_RXRDY | US_IER_TIMEOUT);
+	/* Set USB priority lower than USART to not miss sniffing data (both at 0 per default) */
+	if (NVIC_GetPriority(IRQ_USART_SIM)>=NVIC_GetPriority(UDP_IRQn)) {
+		NVIC_SetPriority(UDP_IRQn, NVIC_GetPriority(IRQ_USART_SIM)+2);
+	}
 	/* Enable interrupt requests for the USART peripheral */
 	NVIC_EnableIRQ(IRQ_USART_SIM);
 

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I870a0aa8e251bbb53249c54bfcaa45de5b5a9486
Gerrit-Change-Number: 9881
Gerrit-PatchSet: 15
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180704/1d6e00ba/attachment.htm>


More information about the gerrit-log mailing list