2017-02-06 19:42:34 +08:00
|
|
|
/* ieee802154_nrf5.h - nRF5 802.15.4 driver */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Nordic Semiconductor ASA
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
#ifndef __IEEE802154_NRF5_H__
|
|
|
|
#define __IEEE802154_NRF5_H__
|
|
|
|
|
|
|
|
#include <sections.h>
|
|
|
|
#include <atomic.h>
|
|
|
|
|
|
|
|
#define NRF5_FCS_LENGTH (2)
|
|
|
|
#define NRF5_PSDU_LENGTH (125)
|
|
|
|
#define NRF5_PHR_LENGTH (1)
|
|
|
|
|
|
|
|
struct nrf5_802154_data {
|
|
|
|
/* Pointer to the network interface. */
|
|
|
|
struct net_if *iface;
|
|
|
|
/* Pointer to a received frame. */
|
2017-04-21 22:27:50 +08:00
|
|
|
u8_t *rx_psdu;
|
2017-02-06 19:42:34 +08:00
|
|
|
/* TX buffer. First byte is PHR (length), remaining bytes are
|
|
|
|
* MPDU data.
|
|
|
|
*/
|
2017-04-21 22:27:50 +08:00
|
|
|
u8_t tx_psdu[NRF5_PHR_LENGTH + NRF5_PSDU_LENGTH];
|
2017-02-06 19:42:34 +08:00
|
|
|
/* 802.15.4 HW address. */
|
2017-04-21 22:27:50 +08:00
|
|
|
u8_t mac[8];
|
2017-02-06 19:42:34 +08:00
|
|
|
/* RX thread stack. */
|
|
|
|
char __stack rx_stack[CONFIG_IEEE802154_NRF5_RX_STACK_SIZE];
|
|
|
|
|
|
|
|
/* CCA complete sempahore. Unlocked when CCA is complete. */
|
|
|
|
struct k_sem cca_wait;
|
|
|
|
/* RX synchronization semaphore. Unlocked when frame has been
|
|
|
|
* received.
|
|
|
|
*/
|
|
|
|
struct k_sem rx_wait;
|
|
|
|
/* TX synchronization semaphore. Unlocked when frame has been
|
|
|
|
* sent or CCA failed.
|
|
|
|
*/
|
|
|
|
struct k_sem tx_wait;
|
|
|
|
/* TX result. Set to 1 on success, 0 otherwise. */
|
|
|
|
bool tx_success;
|
|
|
|
|
|
|
|
/* CCA channel energy. Unit as per 802.15.4-2006 specification. */
|
2017-04-21 22:27:50 +08:00
|
|
|
s8_t channel_ed;
|
2017-02-06 19:42:34 +08:00
|
|
|
|
|
|
|
/* TX power, in dBm, to be used when sending a frame. */
|
2017-04-21 22:27:50 +08:00
|
|
|
s8_t txpower;
|
2017-02-06 19:42:34 +08:00
|
|
|
/* 802.15.4 channel to be used when sending a frame. */
|
2017-04-21 22:27:50 +08:00
|
|
|
u8_t channel;
|
2017-02-06 19:42:34 +08:00
|
|
|
|
|
|
|
/* Last received frame LQI value. */
|
2017-04-21 22:27:50 +08:00
|
|
|
u8_t lqi;
|
2017-02-06 19:42:34 +08:00
|
|
|
/* Last received frame RSSI value. */
|
2017-04-21 22:27:50 +08:00
|
|
|
s8_t rssi;
|
2017-02-06 19:42:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __IEEE802154_NRF5_H__ */
|