Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 1 | /* |
| 2 | * e1.h |
| 3 | * |
| 4 | * Copyright (C) 2019-2020 Sylvain Munaut <tnt@246tNt.com> |
| 5 | * SPDX-License-Identifier: GPL-3.0-or-later |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | |
Harald Welte | 9469e04 | 2020-12-15 23:09:40 +0100 | [diff] [blame] | 10 | void e1_init(uint16_t rx_cr, uint16_t tx_cr); |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 11 | void e1_poll(void); |
| 12 | void e1_debug_print(bool data); |
| 13 | |
Harald Welte | 6add0aa | 2020-12-16 00:02:11 +0100 | [diff] [blame] | 14 | void e1_tx_config(uint16_t cr); |
| 15 | void e1_rx_config(uint16_t cr); |
| 16 | |
Harald Welte | 805f2cf | 2020-12-14 17:31:03 +0100 | [diff] [blame] | 17 | #define E1_ERR_F_ALIGN_ERR 0x01 |
| 18 | #define E1_ERR_F_LOS 0x02 |
| 19 | |
| 20 | struct e1_error_count { |
| 21 | uint16_t crc; |
| 22 | uint16_t align; |
| 23 | uint16_t ovfl; |
| 24 | uint16_t unfl; |
| 25 | uint8_t flags; |
| 26 | }; |
| 27 | |
| 28 | const struct e1_error_count *e1_get_error_count(void); |
| 29 | |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 30 | volatile uint8_t *e1_data_ptr(int mf, int frame, int ts); |
| 31 | unsigned int e1_data_ofs(int mf, int frame, int ts); |
Harald Welte | 5276567 | 2020-12-15 18:35:42 +0100 | [diff] [blame] | 32 | |
| 33 | enum e1_platform_led { |
| 34 | E1P_LED_GREEN = 0, |
| 35 | E1P_LED_YELLOW = 1, |
| 36 | }; |
| 37 | |
| 38 | enum e1_platform_led_state { |
| 39 | E1P_LED_ST_OFF = 0, |
| 40 | E1P_LED_ST_ON = 1, |
| 41 | E1P_LED_ST_BLINK = 2, |
| 42 | E1P_LED_ST_BLINK_FAST = 3 |
| 43 | }; |
| 44 | |
| 45 | /* external function provided by the platform; used by E1 driver to control LEDs */ |
| 46 | extern void e1_platform_led_set(uint8_t port, enum e1_platform_led led, |
| 47 | enum e1_platform_led_state state); |