1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/lwip: add device acquire/release

This commit is contained in:
Jose Alamos 2022-08-19 19:42:45 +02:00
parent 0b5f270b15
commit 705fd8d691
No known key found for this signature in database
GPG Key ID: F483EB800EF89DD9

View File

@ -33,8 +33,42 @@ extern "C" {
typedef struct {
netif_t common_netif; /**< network interface descriptor */
struct netif lwip_netif; /**< lwIP interface data */
rmutex_t lock; /**< lock for the interface */
} lwip_netif_t;
/**
* @brief Init the LWIP netif network device lock.
*
* @param[in] netif pointer to the LWIP network interface
*/
static inline void lwip_netif_dev_lock_init(struct netif *netif)
{
lwip_netif_t *compat_netif = container_of(netif, lwip_netif_t, lwip_netif);
rmutex_init(&compat_netif->lock);
}
/**
* @brief Acquire the LWIP netif network device.
*
* @param[out] netif pointer to the LWIP network interface
*/
static inline void lwip_netif_dev_acquire(struct netif *netif)
{
lwip_netif_t *compat_netif = container_of(netif, lwip_netif_t, lwip_netif);
rmutex_lock(&compat_netif->lock);
}
/**
* @brief Release the LWIP netif network device.
*
* @param[out] netif pointer to the LWIP network interface
*/
static inline void lwip_netif_dev_release(struct netif *netif)
{
lwip_netif_t *compat_netif = container_of(netif, lwip_netif_t, lwip_netif);
rmutex_unlock(&compat_netif->lock);
}
#ifdef __cplusplus
}
#endif