Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,15 @@ ifneq (,$(filter vtimer,$(USEMODULE)))
USEMODULE += timex
endif
endif

ifneq (,$(filter net_if,$(USEMODULE)))
ifeq (,$(filter transceiver,$(USEMODULE)))
USEMODULE += transceiver
endif
endif

ifneq (,$(filter shell_commands,$(USEMODULE)))
ifneq (,$(filter net_if,$(USEMODULE)))
USEMODULE += net_help
endif
endif
3 changes: 3 additions & 0 deletions sys/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ endif
ifneq (,$(filter vtimer,$(USEMODULE)))
DIRS += vtimer
endif
ifneq (,$(filter net_if,$(USEMODULE)))
DIRS += net/link_layer/net_if
endif
ifneq (,$(filter destiny,$(USEMODULE)))
DIRS += net/transport_layer/destiny
endif
Expand Down
4 changes: 4 additions & 0 deletions sys/auto_init/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
MODULE = auto_init

ifneq (,$(filter net_if,$(USEMODULE)))
INCLUDES += -I$(RIOTBASE)/sys/net/include/
endif

include $(RIOTBASE)/Makefile.base
39 changes: 39 additions & 0 deletions sys/auto_init/auto_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
#include "destiny.h"
#endif

#ifdef MODULE_NET_IF
#include "net_if.h"
#include "transceiver.h"
#endif

#define ENABLE_DEBUG (0)
#include "debug.h"

Expand Down Expand Up @@ -97,6 +102,40 @@ void auto_init(void)
DEBUG("Auto init mci module.\n");
MCI_initialize();
#endif
#ifdef MODULE_NET_IF
DEBUG("Auto init net_if module.\n");
transceiver_type_t transceivers = 0;
#ifdef MODULE_AT86RF231
transceivers |= TRANSCEIVER_AT86RF231;
#endif
#ifdef MODULE_CC1020
transceivers |= TRANSCEIVER_CC1020;
#endif
#if MODULE_CC110X || MODULE_CC110X_NG
transceivers |= TRANSCEIVER_CC1100;
#endif
#ifdef MODULE_CC2420
transceivers |= TRANSCEIVER_CC2420;
#endif
#ifdef MODULE_MC1322X
transceivers |= TRANSCEIVER_MC1322X;
#endif
#ifdef MODULE_NATIVENET
transceivers |= TRANSCEIVER_NATIVE;
#endif
net_if_init();

if (transceivers != 0) {
transceiver_init(transceivers);
transceiver_start();
int iface = net_if_init_interface(0, transceivers);

if (iface >= 0) {
DEBUG("Interface %d initialized\n", iface);
}
}

#endif
#ifdef MODULE_PROFILING
extern void profiling_init(void);
profiling_init();
Expand Down
7 changes: 7 additions & 0 deletions sys/include/transceiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@
*/
typedef uint16_t transceiver_type_t;

/**
* @brief Data type to represent the transceiver's EUI-64.
*/
typedef uint64_t transceiver_eui64_t;

/**
* @brief Message types for transceiver interface
*/
Expand All @@ -129,6 +134,8 @@ enum transceiver_msg_type_t {
SET_CHANNEL, ///< Set a new channel
GET_ADDRESS, ///< Get the radio address
SET_ADDRESS, ///< Set the radio address
GET_LONG_ADDR, ///< Get the long radio address, if existing
SET_LONG_ADDR, ///< Set the long radio address, if supported by hardware
SET_MONITOR, ///< Set transceiver to monitor mode (disable address checking)
GET_PAN, ///< Get current pan
SET_PAN, ///< Set a new pan
Expand Down
18 changes: 18 additions & 0 deletions sys/net/include/ieee802154_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#define IEEE_802154_SHORT_ADDR_M 2
#define IEEE_802154_LONG_ADDR_M 3

#define IEEE_802154_SHORT_MCAST_ADDR (0xffff)
#define IEEE_802154_LONG_MCAST_ADDR {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
0xff, 0xff}}

#define IEEE_802154_PAN_ID 0x1234

typedef struct __attribute__((packed)) {
Expand All @@ -62,6 +66,20 @@ typedef struct __attribute__((packed)) {
uint8_t payload_len;
} ieee802154_frame_t;

/**
* Structure to represent an IEEE 802.15.4 packet for the transceiver.
*/
typedef struct __attribute__(( packed )) {
/* @{ */
uint8_t processing; /** < internal processing state */
uint8_t length; /** < the length of the frame of the frame including fcs*/
ieee802154_frame_t frame; /** < the ieee802154 frame */
int8_t rssi; /** < the rssi value */
uint8_t crc; /** < 1 if crc was successfull, 0 otherwise */
uint8_t lqi; /** < the link quality indicator */
/* @} */
} ieee802154_packet_t;

uint8_t ieee802154_frame_init(ieee802154_frame_t *frame, uint8_t *buf);
uint8_t ieee802154_frame_get_hdr_len(ieee802154_frame_t *frame);
uint8_t ieee802154_frame_read(uint8_t *buf, ieee802154_frame_t *frame, uint8_t len);
Expand Down
9 changes: 9 additions & 0 deletions sys/net/include/net_help.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@
(((uint32_t) (a) & 0x00ff0000) >> 8) | \
(((uint32_t) (a) & 0x0000ff00) << 8) | \
(((uint32_t) (a) & 0x000000ff) << 24))
#define HTONLL(a) ((((uint64_t) (a) & 0xff00000000000000) >> 56) | \
(((uint64_t) (a) & 0x00ff000000000000) >> 40) | \
(((uint64_t) (a) & 0x0000ff0000000000) >> 24) | \
(((uint64_t) (a) & 0x000000ff00000000) >> 8) | \
(((uint64_t) (a) & 0x00000000ff000000) << 8) | \
(((uint64_t) (a) & 0x0000000000ff0000) << 24) | \
(((uint64_t) (a) & 0x000000000000ff00) << 40) | \
(((uint64_t) (a) & 0x00000000000000ff) << 56))
#define NTOHS HTONS
#define NTOHL HTONL
#define NTOHLL HTONLL

#define CMP_IPV6_ADDR(a, b) (memcmp(a, b, 16))

Expand Down
Loading