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

2019-02-27 Thread Kévin Redon
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 
 #include 
 #include 
+#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 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Kévin Redon 


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

2019-02-26 Thread Kévin Redon
Kévin Redon has posted comments on this change. ( 
https://gerrit.osmocom.org/13038 )

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


Patch Set 3: Code-Review+2


--
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: comment
Gerrit-Change-Id: Iab9edc1214bb22ee304daa834fd9e2376d42c97c
Gerrit-Change-Number: 13038
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Kévin Redon 
Gerrit-Comment-Date: Tue, 26 Feb 2019 18:12:44 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


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

2019-02-24 Thread Harald Welte
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/13038

to look at the new patch set (#2).

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/38/13038/2
--
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: newpatchset
Gerrit-Change-Id: Iab9edc1214bb22ee304daa834fd9e2376d42c97c
Gerrit-Change-Number: 13038
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


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

2019-02-24 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
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, 20 insertions(+), 0 deletions(-)



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

diff --git a/sysmoOCTSIM/ncn8025.c b/sysmoOCTSIM/ncn8025.c
index 5f9b03d..950acb4 100644
--- a/sysmoOCTSIM/ncn8025.c
+++ b/sysmoOCTSIM/ncn8025.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#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,6 +126,7 @@
rc = i2c_read_reg(adap, SX1503_ADDR, reg);
if (rc < 0)
return rc;
+   set->interrupt = ncn8025_interrupt_active(slot);
return ncn8025_decode(rc, set);
 }

@@ -156,6 +172,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: newchange
Gerrit-Change-Id: Iab9edc1214bb22ee304daa834fd9e2376d42c97c
Gerrit-Change-Number: 13038
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte