soft_uart: add osmo_soft_uart_{get,set}_name()

Change-Id: Iabf29f42d876035481011fa8e8a51c0590fe63b8
Related: OS#4396
This commit is contained in:
Vadim Yanitskiy 2023-11-29 23:58:10 +07:00 committed by laforge
parent 84611881c9
commit 59afb8f14c
3 changed files with 22 additions and 0 deletions

View File

@ -87,6 +87,10 @@ struct osmo_soft_uart *osmo_soft_uart_alloc(void *ctx, const char *name,
const struct osmo_soft_uart_cfg *cfg);
void osmo_soft_uart_free(struct osmo_soft_uart *suart);
int osmo_soft_uart_configure(struct osmo_soft_uart *suart, const struct osmo_soft_uart_cfg *cfg);
const char *osmo_soft_uart_get_name(const struct osmo_soft_uart *suart);
void osmo_soft_uart_set_name(struct osmo_soft_uart *suart, const char *name);
int osmo_soft_uart_set_rx(struct osmo_soft_uart *suart, bool enable);
int osmo_soft_uart_set_tx(struct osmo_soft_uart *suart, bool enable);

View File

@ -444,6 +444,8 @@ osmo_soft_uart_default_cfg;
osmo_soft_uart_alloc;
osmo_soft_uart_free;
osmo_soft_uart_configure;
osmo_soft_uart_get_name;
osmo_soft_uart_set_name;
osmo_soft_uart_set_rx;
osmo_soft_uart_set_tx;
osmo_soft_uart_rx_ubits;

View File

@ -396,6 +396,22 @@ int osmo_soft_uart_configure(struct osmo_soft_uart *suart, const struct osmo_sof
return 0;
}
/*! Get a name for the given soft-UART instance.
* \param[in] suart soft-UART instance to get the name from.
* \returns name of the given soft-UART instance. */
const char *osmo_soft_uart_get_name(const struct osmo_soft_uart *suart)
{
return suart->name;
}
/*! Set a new name for the given soft-UART instance.
* \param[in] suart soft-UART instance to set the name for.
* \param[in] name the new name. */
void osmo_soft_uart_set_name(struct osmo_soft_uart *suart, const char *name)
{
osmo_talloc_replace_string(suart, (char **)&suart->name, name);
}
/*! Enable/disable receiver of the given soft-UART.
* \param[in] suart soft-UART instance to be re-configured.
* \param[in] enable enable/disable state of the receiver.