ieee802154_submac.h
1 /*
2  * Copyright (C) 2020 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
9 #pragma once
10 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "net/netdev.h"
30 #include "net/netdev/ieee802154.h"
31 #include "net/ieee802154/submac.h"
32 #include "net/ieee802154/radio.h"
33 #include "ztimer.h"
34 
35 #include "od.h"
36 #include "event/thread.h"
37 #include "event/callback.h"
38 
39 #define NETDEV_SUBMAC_FLAGS_ACK_TIMEOUT (1 << 0)
40 #define NETDEV_SUBMAC_FLAGS_TX_DONE (1 << 1)
41 #define NETDEV_SUBMAC_FLAGS_RX_DONE (1 << 2)
42 #define NETDEV_SUBMAC_FLAGS_CRC_ERROR (1 << 3)
43 #define NETDEV_SUBMAC_FLAGS_BH_REQUEST (1 << 4)
48 typedef struct {
52  int isr_flags;
53  int bytes_tx;
54  int8_t retrans;
55  bool dispatch;
58 
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
Provides a callback-with-argument event type.
Definitions for netdev common IEEE 802.15.4 code.
Definitions low-level network driver interface.
netdev_event_t
Possible event types that are send from the device driver to the upper layer.
Definition: netdev.h:234
int netdev_ieee802154_submac_init(netdev_ieee802154_submac_t *netdev_submac)
Init the IEEE 802.15.4 SubMAC netdev adoption.
IEEE 802.15.4 SubMAC descriptor.
Definition: submac.h:191
IEEE 802.15.4 SubMAC netdev descriptor.
netdev_event_t ev
event to be dispatched
int bytes_tx
size of the sent frame or tx error
bool dispatch
whether an event should be dispatched or not
ztimer_t ack_timer
ztimer descriptor for the ACK timeout timer
int8_t retrans
number of frame retransmissions of the last TX
netdev_ieee802154_t dev
IEEE 802.15.4 netdev descriptor.
int isr_flags
netdev submac NETDEV_EVENT_ISR flags
ieee802154_submac_t submac
IEEE 802.15.4 SubMAC descriptor.
Extended structure to hold IEEE 802.15.4 driver state.
Definition: ieee802154.h:100
ztimer structure
Definition: ztimer.h:319
Provides utility functions for event handler threads.
ztimer API