-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers/kw41zrf: Transceiver driver for the KW41Z radio
This is the radio found in NXP Kinetis KW41Z, KW21Z. Only 802.15.4 mode is implemented (KW41Z also supports BLE on the same transceiver). The driver uses vendor supplied initialization code for the low level XCVR hardware, these files were imported from KSDK 2.2.0 (framework_5.3.5)
- Loading branch information
1 parent
8c94a16
commit a20490c
Showing
25 changed files
with
7,123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
/* | ||
* Copyright (C) 2017 SKF AB | ||
* | ||
* 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_kw41zrf KW41Z radio-driver | ||
* @ingroup drivers_netdev | ||
* @brief Device driver for the NXP KW41Z, KW21Z in-cpu transceiver | ||
* @{ | ||
* | ||
* @file | ||
* @brief Interface definition for the kw41zrf driver | ||
* | ||
* @author Joakim Nohlgård <joakim.nohlgard@eistec.se> | ||
*/ | ||
|
||
#ifndef KW41ZRF_H | ||
#define KW41ZRF_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "mutex.h" | ||
#include "board.h" | ||
#include "net/netdev.h" | ||
#include "net/netdev/ieee802154.h" | ||
#include "net/gnrc/nettype.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Maximum packet length | ||
*/ | ||
#define KW41ZRF_MAX_PKT_LENGTH (IEEE802154_FRAME_LEN_MAX) | ||
|
||
/** | ||
* @brief Default channel used after initialization | ||
* | ||
* @{ | ||
*/ | ||
#ifndef KW41ZRF_DEFAULT_CHANNEL | ||
#define KW41ZRF_DEFAULT_CHANNEL (IEEE802154_DEFAULT_CHANNEL) | ||
#endif | ||
/** @} */ | ||
|
||
/** | ||
* @brief Allowed range of channels | ||
* | ||
* @{ | ||
*/ | ||
#define KW41ZRF_MIN_CHANNEL (11U) | ||
#define KW41ZRF_MAX_CHANNEL (26U) | ||
/** @} */ | ||
|
||
/** | ||
* @brief Default TX_POWER in dbm used after initialization | ||
*/ | ||
#define KW41ZRF_DEFAULT_TX_POWER (IEEE802154_DEFAULT_TXPOWER) | ||
|
||
/** | ||
* @brief Maximum output power of the kw41z device in dBm | ||
*/ | ||
#define KW41ZRF_OUTPUT_POWER_MAX (4) | ||
|
||
/** | ||
* @brief Minimum output power of the kw41z device in dBm | ||
*/ | ||
#define KW41ZRF_OUTPUT_POWER_MIN (-19) | ||
|
||
/** | ||
* @brief ISR callback function type | ||
*/ | ||
typedef void (*kw41zrf_cb_t)(void *arg); | ||
|
||
/** | ||
* @brief Device descriptor for KW41ZRF radio devices | ||
* | ||
* @extends netdev_ieee802154_t | ||
*/ | ||
typedef struct { | ||
netdev_ieee802154_t netdev; /**< netdev parent struct */ | ||
/** | ||
* @name device specific fields | ||
* @{ | ||
*/ | ||
thread_t *thread; /**< Network driver thread, for providing feedback from IRQ handler */ | ||
uint32_t tx_warmup_time; /**< TX warmup time, in event timer ticks */ | ||
uint32_t rx_warmup_time; /**< RX warmup time, in event timer ticks */ | ||
uint32_t rf_osc_en_idle; /**< RF_OSC_EN bits setting when RF module is in standby */ | ||
int16_t tx_power; /**< The current tx-power setting of the device */ | ||
uint8_t flags; /**< Internal driver option flags */ | ||
uint8_t max_retrans; /**< Maximum number of frame retransmissions | ||
* when no Ack frame is received (macMaxFrameRetries) */ | ||
uint8_t csma_max_backoffs; /**< Maximum number of CSMA backoffs when | ||
* waiting for channel clear (macMaxCsmaBackoffs) */ | ||
uint8_t csma_min_be; /**< Minimum backoff exponent (macMinBe) */ | ||
uint8_t csma_max_be; /**< Maximum backoff exponent (macMaxBe) */ | ||
uint8_t idle_seq; /**< state to return to after sending */ | ||
uint8_t cca_result; /**< Used for passing CCA result from ISR to user */ | ||
uint8_t csma_be; /**< Counter used internally by send implementation */ | ||
uint8_t csma_num_backoffs; /**< Counter used internally by send implementation */ | ||
uint8_t num_retrans; /**< Counter used internally by send implementation */ | ||
uint8_t pm_blocked; /**< true if we have blocked a low power mode in the CPU */ | ||
uint8_t recv_blocked; /**< blocks moving to XCVSEQ_RECEIVE to prevent | ||
* overwriting the RX buffer before the higher | ||
* layers have copied it to system RAM */ | ||
/** @} */ | ||
} kw41zrf_t; | ||
|
||
/** | ||
* @brief Setup an KW41ZRF based device state | ||
* | ||
* @param[out] dev device descriptor | ||
*/ | ||
void kw41zrf_setup(kw41zrf_t *dev); | ||
|
||
/** | ||
* @brief Initialize the given KW41ZRF device | ||
* | ||
* @param[out] dev device descriptor | ||
* @param[in] cb irq callback | ||
* | ||
* @return 0 on success | ||
* @return <0 on error | ||
*/ | ||
int kw41zrf_init(kw41zrf_t *dev, kw41zrf_cb_t cb); | ||
|
||
/** | ||
* @brief Reset radio hardware and restore default settings | ||
* | ||
* @param[in] dev device to reset | ||
* | ||
* @return 0 on success | ||
* @return <0 on initialization failure | ||
*/ | ||
int kw41zrf_reset(kw41zrf_t *dev); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* KW41ZRF_H */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Use vendor-supplied low level XCVR hardware initialization | ||
DIRS += vendor/XCVR/MKW41Z4 | ||
|
||
include $(RIOTBASE)/Makefile.base |
Oops, something went wrong.