Skip to content

Commit 6ddfd97

Browse files
Martin Lendersmiri64
authored andcommitted
sys: transceiver: Provide an adapter to basic_net module
Since basic_net is aimed to replace tranceiver one day, but porting efforts usally take a while, this commit aims to provide access via transceiver as we are used to for radio/network drivers that already implement basic_net (e. g. uart_net in RIOT-OS#1454).
1 parent fd5cd9b commit 6ddfd97

File tree

4 files changed

+559
-11
lines changed

4 files changed

+559
-11
lines changed

sys/include/transceiver.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
#define TRANSCEIVER_MC1322X (0x08) ///< MC1322X transceivers
134134
#define TRANSCEIVER_NATIVE (0x10) ///< NATIVE transceivers
135135
#define TRANSCEIVER_AT86RF231 (0x20) ///< AT86RF231 transceivers
136+
#define TRANSCEIVER_BASIC_NET (0x30) ///< basic_net compatible L* layers
136137

137138
/**
138139
* @brief Data type for transceiver specification
@@ -146,6 +147,10 @@ typedef uint64_t transceiver_eui64_t;
146147

147148
/**
148149
* @brief Message types for transceiver interface
150+
*
151+
* @note **ATTENTION:** Packages received from a basic_net layer are neither
152+
* of type radio_packet_t nor ieee802154_packet_t as they normally are
153+
* (depending on the radio), but basic_net_rcv_pkt_t!
149154
*/
150155
enum transceiver_msg_type_t {
151156
/* Message types for driver <-> transceiver communication */

sys/net/include/basic_net.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,22 @@ typedef struct {
261261
} basic_net_reg_t;
262262

263263

264+
#ifdef MODULE_TRANSCEIVER
265+
/**
266+
* @brief PID for a basic_net layer, when used with the transceiver module.
267+
*
268+
* @detail This variable is only needed, iff this definitions are used with
269+
* the transceiver module in legacy applications. Needs to be set
270+
* externaly (e. g. the layer, that uses basic_net). Guard it against
271+
* other layers using basic_net with the transceiver with
272+
* the macro `HAS_BASIC_NET_PID`, the transceiver module will check
273+
* if it is there and only than allow adapter capabilities. Since
274+
* only one basic_net layer can be used with this hack, it is
275+
* advised to let only layers below network layer use this.
276+
*/
277+
extern kernel_pid_t basic_net_pid;
278+
#endif /* MODULE_TRANSCEIVER */
279+
264280
#ifdef MODULE_BASIC_NET /* Only include if module basic_net is compiled */
265281
/**
266282
* @brief Sends a command to a protocol's control thread.

sys/transceiver/Makefile

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
ifneq (,$(filter cc2420,$(USEMODULE)))
2-
INCLUDES += -I$(RIOTBASE)/sys/net/include
3-
endif
4-
5-
ifneq (,$(filter at86rf231,$(USEMODULE)))
6-
INCLUDES += -I$(RIOTBASE)/sys/net/include
7-
endif
8-
9-
ifneq (,$(filter mc1322x,$(USEMODULE)))
10-
INCLUDES += -I$(RIOTBASE)/sys/net/include
11-
endif
1+
INCLUDES += -I$(RIOTBASE)/sys/net/include
122

133
include $(RIOTBASE)/Makefile.base

0 commit comments

Comments
 (0)