Support for sysmoOCTSIM NCN8025/SX1503 control
This adds an I2C bit-banging layer, defines the four busses on the
sysmoOCTSIM and adds some high-level functions to control the NCN8025
for each SIM slot.
Change-Id: Ic5287cf80d2be2070c504e9d40f7c6fc0d37d8b9
diff --git a/sysmoOCTSIM/ncn8025.h b/sysmoOCTSIM/ncn8025.h
new file mode 100644
index 0000000..a392c5d
--- /dev/null
+++ b/sysmoOCTSIM/ncn8025.h
@@ -0,0 +1,28 @@
+#pragma once
+#include <stdbool.h>
+
+enum ncn8025_sim_voltage {
+ SIM_VOLT_3V0 = 0,
+ SIM_VOLT_5V0 = 2,
+ SIM_VOLT_1V8 = 3
+};
+
+enum ncn8025_sim_clkdiv {
+ SIM_CLKDIV_1 = 1,
+ SIM_CLKDIV_2 = 3,
+ SIM_CLKDIV_4 = 2,
+ SIM_CLKDIV_8 = 0,
+};
+
+struct ncn8025_settings {
+ bool rstin; /* high: active */
+ bool cmdvcc; /* high: active */
+ bool simpres; /* high: active */
+ bool led; /* 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);
+int ncn8025_init(unsigned int slot);