Change in osmo-ccid-firmware[master]: ncn8025: Add support for reading SIMx_INT status

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

Kévin Redon gerrit-no-reply at lists.osmocom.org
Wed Feb 27 13:48:43 UTC 2019


Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/13038 )

Change subject: ncn8025: Add support for reading SIMx_INT status
......................................................................

ncn8025: Add support for reading SIMx_INT status

Change-Id: Iab9edc1214bb22ee304daa834fd9e2376d42c97c
---
M sysmoOCTSIM/ncn8025.c
M sysmoOCTSIM/ncn8025.h
2 files changed, 22 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Kévin Redon: Looks good to me, approved



diff --git a/sysmoOCTSIM/ncn8025.c b/sysmoOCTSIM/ncn8025.c
index 5f9b03d..61509bc 100644
--- a/sysmoOCTSIM/ncn8025.c
+++ b/sysmoOCTSIM/ncn8025.c
@@ -11,6 +11,7 @@
 #include <stdio.h>
 #include <utils_assert.h>
 #include <utils.h>
+#include "atmel_start_pins.h"
 #include "octsim_i2c.h"
 #include "ncn8025.h"
 
@@ -86,6 +87,20 @@
 		return 0x03;
 }
 
+static const uint8_t slot2int_pin(unsigned int slot)
+{
+	static const uint8_t slot2pin[8] = { SIM0_INT, SIM1_INT, SIM2_INT, SIM3_INT,
+					     SIM4_INT, SIM5_INT, SIM6_INT, SIM7_INT };
+	ASSERT(slot < ARRAY_SIZE(slot2pin));
+	return slot2pin[slot];
+}
+
+bool ncn8025_interrupt_active(uint8_t slot)
+{
+	uint8_t pin = slot2int_pin(slot);
+	return !gpio_get_pin_level(pin);
+}
+
 
 /*! Set a given NCN8025 as described in 'set'.
  *  \param[in] slot Slot number (0..7)
@@ -111,7 +126,9 @@
 	rc = i2c_read_reg(adap, SX1503_ADDR, reg);
 	if (rc < 0)
 		return rc;
-	return ncn8025_decode(rc, set);
+	rc = ncn8025_decode(rc, set);
+	set->interrupt = ncn8025_interrupt_active(slot);
+	return rc;
 }
 
 /*! default settings we use at start-up: powered off, in reset, slowest clock, 3V */
@@ -156,6 +173,8 @@
 		printf(", RST");
 	if (set->cmdvcc)
 		printf(", VCC");
+	if (set->interrupt)
+		printf(", INT");
 	if (set->simpres)
 		printf(", SIMPRES");
 	if (set->led)
diff --git a/sysmoOCTSIM/ncn8025.h b/sysmoOCTSIM/ncn8025.h
index 79e8b60..89b7f86 100644
--- a/sysmoOCTSIM/ncn8025.h
+++ b/sysmoOCTSIM/ncn8025.h
@@ -19,11 +19,13 @@
 	bool cmdvcc;	/* high: active */
 	bool simpres;	/* high: active */
 	bool led;	/* high: active */
+	bool interrupt;	/* high: active */
 	enum ncn8025_sim_clkdiv clkdiv;	/* raw 2bit value */
 	enum ncn8025_sim_voltage vsel;	/* raw 2bit value */
 };
 
 int ncn8025_set(uint8_t slot, const struct ncn8025_settings *set);
 int ncn8025_get(uint8_t slot, struct ncn8025_settings *set);
+bool ncn8025_interrupt_active(uint8_t slot);
 int ncn8025_init(unsigned int slot);
 void ncn8025_dump(const struct ncn8025_settings *set);

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

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iab9edc1214bb22ee304daa834fd9e2376d42c97c
Gerrit-Change-Number: 13038
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Kévin Redon <kredon at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190227/adff4b45/attachment.htm>


More information about the gerrit-log mailing list