Harald Welte | c3f170d | 2019-02-24 09:06:59 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | #include <stdbool.h> |
| 3 | |
| 4 | enum ncn8025_sim_voltage { |
| 5 | SIM_VOLT_3V0 = 0, |
| 6 | SIM_VOLT_5V0 = 2, |
| 7 | SIM_VOLT_1V8 = 3 |
| 8 | }; |
| 9 | |
| 10 | enum 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 | |
| 17 | struct ncn8025_settings { |
Kévin Redon | 4be5276 | 2019-04-17 01:23:48 +0200 | [diff] [blame] | 18 | bool rstin; /* Reset signal (true: asserted low) */ |
| 19 | bool cmdvcc; /* Command VCC pin. Activation sequence Enable (true: active low) */ |
Harald Welte | c3f170d | 2019-02-24 09:06:59 +0100 | [diff] [blame] | 20 | bool simpres; /* high: active */ |
| 21 | bool led; /* high: active */ |
Harald Welte | 5af7c8c | 2019-02-24 23:13:44 +0100 | [diff] [blame] | 22 | bool interrupt; /* high: active */ |
Harald Welte | c3f170d | 2019-02-24 09:06:59 +0100 | [diff] [blame] | 23 | enum ncn8025_sim_clkdiv clkdiv; /* raw 2bit value */ |
| 24 | enum ncn8025_sim_voltage vsel; /* raw 2bit value */ |
| 25 | }; |
| 26 | |
| 27 | int ncn8025_set(uint8_t slot, const struct ncn8025_settings *set); |
| 28 | int ncn8025_get(uint8_t slot, struct ncn8025_settings *set); |
Harald Welte | 5af7c8c | 2019-02-24 23:13:44 +0100 | [diff] [blame] | 29 | bool ncn8025_interrupt_active(uint8_t slot); |
Harald Welte | c3f170d | 2019-02-24 09:06:59 +0100 | [diff] [blame] | 30 | int ncn8025_init(unsigned int slot); |
Harald Welte | 1b9a5b8 | 2019-02-24 23:04:45 +0100 | [diff] [blame] | 31 | void ncn8025_dump(const struct ncn8025_settings *set); |