@ -212,13 +212,24 @@ static struct modbus_iface_param client_param = {
@@ -212,13 +212,24 @@ static struct modbus_iface_param client_param = {
} ,
} ;
/*
* This test performed on hardware requires two UART controllers
* on the board ( with RX / TX lines connected crosswise ) .
* The exact mapping is not required , we assume that both controllers
* have similar capabilities and use the instance with index 0
* as interface for the client .
*/
# if DT_NODE_EXISTS(DT_INST(0, zephyr_modbus_serial))
static const char rtu_iface_name [ ] = { DEVICE_DT_NAME ( DT_INST ( 0 , zephyr_modbus_serial ) ) } ;
# else
static const char rtu_iface_name [ ] = " " ;
# endif
void test_client_setup_low_none ( void )
{
int err ;
const char iface_name [ ] = { DT_PROP_OR ( DT_INST ( 0 , zephyr_modbus_serial ) ,
label , " " ) } ;
client_iface = modbus_iface_get_by_name ( iface_name ) ;
client_iface = modbus_iface_get_by_name ( rtu_iface_name ) ;
client_param . mode = MODBUS_MODE_RTU ;
client_param . serial . baud = MB_TEST_BAUDRATE_LOW ;
client_param . serial . parity = UART_CFG_PARITY_NONE ;
@ -231,10 +242,8 @@ void test_client_setup_low_none(void)
@@ -231,10 +242,8 @@ void test_client_setup_low_none(void)
void test_client_setup_low_odd ( void )
{
int err ;
const char iface_name [ ] = { DT_PROP_OR ( DT_INST ( 0 , zephyr_modbus_serial ) ,
label , " " ) } ;
client_iface = modbus_iface_get_by_name ( iface_name ) ;
client_iface = modbus_iface_get_by_name ( rtu_iface_name ) ;
client_param . mode = MODBUS_MODE_RTU ;
client_param . serial . baud = MB_TEST_BAUDRATE_LOW ;
client_param . serial . parity = UART_CFG_PARITY_ODD ;
@ -247,10 +256,8 @@ void test_client_setup_low_odd(void)
@@ -247,10 +256,8 @@ void test_client_setup_low_odd(void)
void test_client_setup_high_even ( void )
{
int err ;
const char iface_name [ ] = { DT_PROP_OR ( DT_INST ( 0 , zephyr_modbus_serial ) ,
label , " " ) } ;
client_iface = modbus_iface_get_by_name ( iface_name ) ;
client_iface = modbus_iface_get_by_name ( rtu_iface_name ) ;
client_param . mode = MODBUS_MODE_RTU ;
client_param . serial . baud = MB_TEST_BAUDRATE_HIGH ;
client_param . serial . parity = UART_CFG_PARITY_EVEN ;
@ -263,10 +270,8 @@ void test_client_setup_high_even(void)
@@ -263,10 +270,8 @@ void test_client_setup_high_even(void)
void test_client_setup_ascii ( void )
{
int err ;
const char iface_name [ ] = { DT_PROP_OR ( DT_INST ( 0 , zephyr_modbus_serial ) ,
label , " " ) } ;
client_iface = modbus_iface_get_by_name ( iface_name ) ;
client_iface = modbus_iface_get_by_name ( rtu_iface_name ) ;
client_param . mode = MODBUS_MODE_ASCII ;
client_param . serial . baud = MB_TEST_BAUDRATE_HIGH ;
client_param . serial . parity = UART_CFG_PARITY_EVEN ;