2020-09-04 11:22:12 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 HAW Hamburg
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License v2.1. See the file LICENSE in the top level directory for more
|
|
|
|
* details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup drivers_netdev_ieee802154_submac IEEE802.15.4 SubMAC netdev layer
|
|
|
|
* @ingroup drivers_netdev_api
|
|
|
|
* @experimental This API is experimental and in an early state - expect
|
|
|
|
* changes!
|
|
|
|
|
|
|
|
* @brief This module defines implements the netdev API on top of the
|
|
|
|
* IEEE 802.15.4 radio HAL
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @author José I. Alamos <jose.alamos@haw-hamburg.de>
|
|
|
|
*/
|
|
|
|
#ifndef NET_NETDEV_IEEE802154_SUBMAC_H
|
|
|
|
#define NET_NETDEV_IEEE802154_SUBMAC_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "net/netdev.h"
|
|
|
|
#include "net/netdev/ieee802154.h"
|
|
|
|
#include "net/ieee802154/submac.h"
|
|
|
|
#include "net/ieee802154/radio.h"
|
|
|
|
#include "xtimer.h"
|
|
|
|
|
|
|
|
#include "od.h"
|
|
|
|
#include "event/thread.h"
|
|
|
|
#include "event/callback.h"
|
|
|
|
#include "xtimer.h"
|
|
|
|
|
|
|
|
#define NETDEV_SUBMAC_FLAGS_ACK_TIMEOUT (1 << 0) /**< Flag for ACK Timeout event */
|
2020-11-06 18:12:12 +01:00
|
|
|
#define NETDEV_SUBMAC_FLAGS_TX_DONE (1 << 1) /**< Flag for TX Done event */
|
|
|
|
#define NETDEV_SUBMAC_FLAGS_RX_DONE (1 << 2) /**< Flag for RX Done event */
|
|
|
|
#define NETDEV_SUBMAC_FLAGS_CRC_ERROR (1 << 3) /**< Flag for CRC ERROR event */
|
2021-08-16 14:25:47 +02:00
|
|
|
#define NETDEV_SUBMAC_FLAGS_BH_REQUEST (1 << 4) /**< Flag for Bottom Half request event */
|
2020-09-04 11:22:12 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief IEEE 802.15.4 SubMAC netdev descriptor
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
netdev_ieee802154_t dev; /**< IEEE 802.15.4 netdev descriptor */
|
|
|
|
ieee802154_submac_t submac; /**< IEEE 802.15.4 SubMAC descriptor */
|
|
|
|
xtimer_t ack_timer; /**< xtimer descriptor for the ACK timeout timer */
|
|
|
|
int isr_flags; /**< netdev submac @ref NETDEV_EVENT_ISR flags */
|
2020-10-12 13:47:08 +02:00
|
|
|
int8_t retrans; /**< number of frame retransmissions of the last TX */
|
2021-08-16 14:25:47 +02:00
|
|
|
bool dispatch; /**< whether an event should be dispatched or not */
|
|
|
|
netdev_event_t ev; /**< event to be dispatched */
|
2020-09-04 11:22:12 +02:00
|
|
|
} netdev_ieee802154_submac_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Init the IEEE 802.15.4 SubMAC netdev adoption.
|
|
|
|
*
|
|
|
|
* @param[in] netdev_submac pointer to the netdev submac descriptor.
|
|
|
|
*
|
|
|
|
* @return 0 on success.
|
|
|
|
* @return negative errno on failure.
|
|
|
|
*/
|
2021-06-07 13:35:18 +02:00
|
|
|
int netdev_ieee802154_submac_init(netdev_ieee802154_submac_t *netdev_submac);
|
|
|
|
|
2020-09-04 11:22:12 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* NET_NETDEV_IEEE802154_SUBMAC_H */
|
|
|
|
/** @} */
|