1 /* 2 * Copyright (c) 2023 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #ifndef _NRF_HW_MODEL_UART_BACKEND_IF_H 7 #define _NRF_HW_MODEL_UART_BACKEND_IF_H 8 9 #include "bs_types.h" 10 #include <stdint.h> 11 #include "NHW_config.h" 12 #include "NHW_UART.h" 13 14 #ifdef __cplusplus 15 extern "C"{ 16 #endif 17 18 /* Interface backends export to main UART module */ 19 20 typedef void (*tx_byte_ft)(uint inst, uint8_t data); 21 typedef void (*RTS_pin_toggle_ft)(uint inst, bool new_level); 22 typedef void (*uart_enable_notify_ft)(uint inst, uint8_t tx_enabled, uint8_t rx_enabled); 23 24 struct backend_if { 25 tx_byte_ft tx_byte_f; /* Note this is called at the beginning of the byte frame*/ 26 RTS_pin_toggle_ft RTS_pin_toggle_f; 27 uart_enable_notify_ft uart_enable_notify_f; 28 }; 29 30 /* Interface UART module exposes to backends */ 31 void nhw_UARTE_digest_Rx_byte(uint inst, uint8_t byte); 32 bs_time_t nhw_uarte_one_byte_time(uint inst); 33 void nhw_UARTE_CTS_lowered(uint inst); 34 void nhw_UARTE_CTS_raised(uint inst); 35 36 void nhw_UARTE_backend_register(uint inst, struct backend_if *backend); 37 38 #ifdef __cplusplus 39 } 40 #endif 41 42 #endif /* _NRF_HW_MODEL_UART_BACKEND_IF_H */ 43 44