mux: add mux interface
Add mux_init_reg interface with different mux modes for GPIO, UART, SPI, I2C, PWM, AIO. Signed-off-by: Le Jin <le.jin@siemens.com> Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com>
This commit is contained in:
committed by
Tom Ingleby
parent
046bdd0adb
commit
307a6f3bdd
@@ -201,6 +201,12 @@ mraa_uart_init(int index)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (plat->adv_func->mux_init_reg) {
|
||||
if(plat->adv_func->mux_init_reg(pos, MUX_REGISTER_MODE_UART) != MRAA_SUCCESS) {
|
||||
syslog(LOG_ERR, "uart%i: init: failed to setup mux register for RX pin", index);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pos = plat->uart_dev[index].tx;
|
||||
@@ -211,6 +217,12 @@ mraa_uart_init(int index)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (plat->adv_func->mux_init_reg) {
|
||||
if(plat->adv_func->mux_init_reg(pos, MUX_REGISTER_MODE_UART) != MRAA_SUCCESS) {
|
||||
syslog(LOG_ERR, "uart%i: init: failed to setup mux register for TX pin", index);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,12 +618,24 @@ mraa_uart_set_flowcontrol(mraa_uart_context dev, mraa_boolean_t xonxoff, mraa_bo
|
||||
return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
if (plat->adv_func->mux_init_reg) {
|
||||
if(plat->adv_func->mux_init_reg(pos_cts, MUX_REGISTER_MODE_UART) != MRAA_SUCCESS) {
|
||||
syslog(LOG_ERR, "uart%i: init: failed to setup mux register for CTS pin", dev->index);
|
||||
return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
if (plat->pins[pos_rts].uart.mux_total > 0) {
|
||||
if (mraa_setup_mux_mapped(plat->pins[pos_rts].uart) != MRAA_SUCCESS) {
|
||||
syslog(LOG_ERR, "uart%i: init: failed to setup muxes for RTS pin", dev->index);
|
||||
return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
if (plat->adv_func->mux_init_reg) {
|
||||
if(plat->adv_func->mux_init_reg(pos_rts, MUX_REGISTER_MODE_UART) != MRAA_SUCCESS) {
|
||||
syslog(LOG_ERR, "uart%i: init: failed to setup mux register for RTS pin", dev->index);
|
||||
return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user