lynxis lazus has uploaded this change for review. (
https://gerrit.osmocom.org/c/simtrace2/+/36441?usp=email )
Change subject: cardemu: add support for inverted sim presence pins
......................................................................
cardemu: add support for inverted sim presence pins
Add a define PIN_SET_USIM1_PRES_INVERTED to support
boards which has the usim presence pin inverted.
When defined the pin will be inverted by the firmware.
Related: SYS#6754
Change-Id: I33325f763b56b297762a3fb6fe6baa7b0354de3c
---
M firmware/libcommon/source/mode_cardemu.c
1 file changed, 24 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/41/36441/1
diff --git a/firmware/libcommon/source/mode_cardemu.c
b/firmware/libcommon/source/mode_cardemu.c
index a05840e..a232222 100644
--- a/firmware/libcommon/source/mode_cardemu.c
+++ b/firmware/libcommon/source/mode_cardemu.c
@@ -80,6 +80,7 @@
uint8_t ep_in;
uint8_t ep_int;
const Pin pin_insert;
+ bool pin_insert_inverted;
#ifdef DETECT_VCC_BY_ADC
uint32_t vcc_uv;
#endif
@@ -113,7 +114,10 @@
.ep_int = SIMTRACE_CARDEM_USB_EP_USIM1_INT,
#ifdef PIN_SET_USIM1_PRES
.pin_insert = PIN_SET_USIM1_PRES,
-#endif
+#ifdef PIN_SET_USIM1_PRES_INVERTED
+ .pin_insert_inverted = 1,
+#endif /* PIN_SET_USIM1_PRES_INVERTED */
+#endif /* PIN_SET_USIM1_PRES */
},
#ifdef CARDEMU_SECOND_UART
{
@@ -128,7 +132,10 @@
.ep_int = SIMTRACE_CARDEM_USB_EP_USIM2_INT,
#ifdef PIN_SET_USIM2_PRES
.pin_insert = PIN_SET_USIM2_PRES,
-#endif
+#ifdef PIN_SET_USIM2_PRES_INVERTED
+ .pin_insert_inverted = 1,
+#endif /* PIN_SET_USIM2_PRES_INVERTED */
+#endif /* PIN_SET_USIM2_PRES */
},
#endif
};
@@ -708,7 +715,7 @@
return;
}
- if (card_insert)
+ if (card_insert ^ ci->pin_insert_inverted)
PIO_Set(&ci->pin_insert);
else
PIO_Clear(&ci->pin_insert);
--
To view, visit
https://gerrit.osmocom.org/c/simtrace2/+/36441?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I33325f763b56b297762a3fb6fe6baa7b0354de3c
Gerrit-Change-Number: 36441
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-MessageType: newchange