1 /* 2 * Copyright (c) 2020 PHYTEC Messtechnik GmbH 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef __TEST_MODBUS_H__ 8 #define __TEST_MODBUS_H__ 9 10 #include <zephyr/drivers/uart.h> 11 #include <zephyr/ztest.h> 12 #include <zephyr/modbus/modbus.h> 13 14 #define MB_TEST_BAUDRATE_LOW 9600 15 #define MB_TEST_BAUDRATE_HIGH 115200 16 #define MB_TEST_PARITY UART_CFG_PARITY_NONE 17 #define MB_TEST_RESPONSE_TO 50000 18 #define MB_TEST_NODE_ADDR 0x01 19 #define MB_TEST_FP_OFFSET 5000 20 21 /* 22 * Integration platform for this test is FRDM-K64F. 23 * The board must be prepared accordingly: 24 * UART3(PTC16)-RX <-> UART2(PTD3)-TX pins and 25 * UART3(PTC17)-TX <-> UART2(PTD2)-RX pins have to be connected. 26 */ 27 28 uint8_t test_get_client_iface(void); 29 uint8_t test_get_server_iface(void); 30 31 void test_server_setup_low_none(void); 32 void test_server_setup_low_odd(void); 33 void test_server_setup_high_even(void); 34 void test_server_setup_ascii(void); 35 void test_server_setup_raw(void); 36 void test_server_disable(void); 37 38 void test_client_setup_low_none(void); 39 void test_client_setup_low_odd(void); 40 void test_client_setup_high_even(void); 41 void test_client_setup_ascii(void); 42 void test_client_setup_raw(void); 43 void test_coil_wr_rd(void); 44 void test_di_rd(void); 45 void test_input_reg(void); 46 void test_holding_reg(void); 47 void test_diagnostic(void); 48 void test_client_disable(void); 49 50 int client_raw_cb(const int iface, const struct modbus_adu *adu, 51 void *user_data); 52 int server_raw_cb(const int iface, const struct modbus_adu *adu, 53 void *user_data); 54 55 #endif /* __TEST_MODBUS_H__ */ 56