blob: a2a6459c1231a5a488e8cbb0782ce31c94311b02 [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
17struct ncn8025_settings {
Kévin Redon4be52762019-04-17 01:23:48 +020018 bool rstin; /* Reset signal (true: asserted low) */
19 bool cmdvcc; /* Command VCC pin. Activation sequence Enable (true: active low) */
Harald Weltec3f170d2019-02-24 09:06:59 +010020 bool simpres; /* high: active */
21 bool led; /* high: active */
Harald Welte5af7c8c2019-02-24 23:13:44 +010022 bool interrupt; /* high: active */
Harald Weltec3f170d2019-02-24 09:06:59 +010023 enum ncn8025_sim_clkdiv clkdiv; /* raw 2bit value */
24 enum ncn8025_sim_voltage vsel; /* raw 2bit value */
25};
26
27int ncn8025_set(uint8_t slot, const struct ncn8025_settings *set);
28int ncn8025_get(uint8_t slot, struct ncn8025_settings *set);
Harald Welte5af7c8c2019-02-24 23:13:44 +010029bool ncn8025_interrupt_active(uint8_t slot);
Harald Weltec3f170d2019-02-24 09:06:59 +010030int ncn8025_init(unsigned int slot);
Harald Welte1b9a5b82019-02-24 23:04:45 +010031void ncn8025_dump(const struct ncn8025_settings *set);