blob: 01ddc97a7b467f2e4e2e18d14bd64bebb6854ce8 [file] [log] [blame]
Harald Weltec3f170d2019-02-24 09:06:59 +01001#pragma once
2#include <stdbool.h>
3
4enum ncn8025_sim_voltage {
5 SIM_VOLT_3V0 = 0,
6 SIM_VOLT_5V0 = 2,
7 SIM_VOLT_1V8 = 3
8};
9
10enum ncn8025_sim_clkdiv {
11 SIM_CLKDIV_1 = 1,
12 SIM_CLKDIV_2 = 3,
13 SIM_CLKDIV_4 = 2,
14 SIM_CLKDIV_8 = 0,
15};
16
Eric Wildb39d8322019-11-27 16:50:28 +010017extern const unsigned int ncn8025_div_val[];
18
Harald Weltec3f170d2019-02-24 09:06:59 +010019struct ncn8025_settings {
Kévin Redon4be52762019-04-17 01:23:48 +020020 bool rstin; /* Reset signal (true: asserted low) */
21 bool cmdvcc; /* Command VCC pin. Activation sequence Enable (true: active low) */
Harald Weltec3f170d2019-02-24 09:06:59 +010022 bool simpres; /* high: active */
23 bool led; /* high: active */
Harald Welte5af7c8c2019-02-24 23:13:44 +010024 bool interrupt; /* high: active */
Harald Weltec3f170d2019-02-24 09:06:59 +010025 enum ncn8025_sim_clkdiv clkdiv; /* raw 2bit value */
26 enum ncn8025_sim_voltage vsel; /* raw 2bit value */
27};
28
29int ncn8025_set(uint8_t slot, const struct ncn8025_settings *set);
30int ncn8025_get(uint8_t slot, struct ncn8025_settings *set);
Harald Welte08ea0622019-05-11 21:14:55 +020031bool ncn8025_interrupt_level(uint8_t slot);
Harald Weltec3f170d2019-02-24 09:06:59 +010032int ncn8025_init(unsigned int slot);
Harald Welte1b9a5b82019-02-24 23:04:45 +010033void ncn8025_dump(const struct ncn8025_settings *set);