mirror of https://gerrit.osmocom.org/libosmocore
soft_uart: add osmo_soft_uart_free()
Change-Id: I2fdcf6116144d8f16cf4167c37cfa7215d16337f Related: OS#4396
This commit is contained in:
parent
dc023cfc2e
commit
877cfed3b2
|
@ -75,6 +75,7 @@ struct osmo_soft_uart_cfg {
|
|||
struct osmo_soft_uart;
|
||||
|
||||
struct osmo_soft_uart *osmo_soft_uart_alloc(void *ctx, const char *name);
|
||||
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);
|
||||
int osmo_soft_uart_enable(struct osmo_soft_uart *suart, bool rx, bool tx);
|
||||
|
||||
|
|
|
@ -440,6 +440,7 @@ osmo_sock_set_priority;
|
|||
osmo_sock_unix_init;
|
||||
osmo_sock_unix_init_ofd;
|
||||
osmo_soft_uart_alloc;
|
||||
osmo_soft_uart_free;
|
||||
osmo_soft_uart_configure;
|
||||
osmo_soft_uart_enable;
|
||||
osmo_soft_uart_rx_ubits;
|
||||
|
|
|
@ -220,6 +220,20 @@ struct osmo_soft_uart *osmo_soft_uart_alloc(void *ctx, const char *name)
|
|||
return suart;
|
||||
}
|
||||
|
||||
/*! Release memory taken by the given soft-UART.
|
||||
* \param[in] suart soft-UART instance to be free()d. */
|
||||
void osmo_soft_uart_free(struct osmo_soft_uart *suart)
|
||||
{
|
||||
if (suart == NULL)
|
||||
return;
|
||||
|
||||
osmo_timer_del(&suart->rx.timer);
|
||||
msgb_free(suart->rx.msg);
|
||||
|
||||
talloc_free((void *)suart->name);
|
||||
talloc_free(suart);
|
||||
}
|
||||
|
||||
/*! change soft-UART configuration to user-provided config */
|
||||
int osmo_soft_uart_configure(struct osmo_soft_uart *suart, const struct osmo_soft_uart_cfg *cfg)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue