3232#include "net/netdev/ieee802154.h"
3333#include "net/gnrc/nettype.h"
3434#include "thread.h"
35+ #include "net/ieee802154/radio.h"
3536
3637#ifdef __cplusplus
3738extern "C" {
@@ -107,6 +108,7 @@ typedef struct kw2xrf_params {
107108 spi_clk_t spi_clk ; /**< SPI clock speed to use */
108109 gpio_t cs_pin ; /**< GPIO pin connected to chip select */
109110 gpio_t int_pin ; /**< GPIO pin connected to the interrupt pin */
111+ gpio_t rst_pin ; /**< GPIO pin connected to RST_B */
110112} kw2xrf_params_t ;
111113
112114/**
@@ -115,13 +117,12 @@ typedef struct kw2xrf_params {
115117 * @extends netdev_ieee802154_t
116118 */
117119typedef struct {
118- netdev_ieee802154_t netdev ; /**< netdev parent struct */
119120 /**
120121 * @brief device specific fields
121122 * @{
122123 */
123124 thread_t * thread ; /**< Network driver thread, for providing feedback from IRQ handler */
124- kw2xrf_params_t params ; /**< parameters for initialization */
125+ const kw2xrf_params_t * params ; /**< parameters for initialization */
125126 uint8_t buf [KW2XRF_MAX_PKT_LENGTH ]; /**< Buffer for incoming or outgoing packets */
126127 uint8_t state ; /**< current state of the radio */
127128 uint8_t tx_frame_len ; /**< length of the current TX frame */
@@ -130,6 +131,13 @@ typedef struct {
130131 this is required to know when to
131132 return to @ref kw2xrf_t::idle_state */
132133 int16_t tx_power ; /**< The current tx-power setting of the device */
134+ bool ack_requested ; /**< ACK was requested for last frame */
135+ bool ch_clear ; /**< CCA indicated channel clear */
136+ bool waiting_for_cca ; /**< Indicate whether CCA is still ongoing */
137+ bool tx_done ; /**< Indicate whether TX completed */
138+ bool ack_rcvd ; /**< Indicate if ACK was received for last transmission */
139+ bool cca_before_tx ; /**< true if CCA shall be performed before TX */
140+ bool tx_cca_pending ; /**< true a manual CCA was started and a TX should be triggered on channel clear indication */
133141 /** @} */
134142} kw2xrf_t ;
135143
@@ -146,12 +154,16 @@ void kw2xrf_setup(kw2xrf_t *dev, const kw2xrf_params_t *params, uint8_t index);
146154/**
147155 * @brief Initialize the given KW2XRF device
148156 * @param[out] dev device descriptor
149- * @param[in] cb irq callback
157+ * @param[in] params parameters for device initialization
158+ * @param[in] hal pointer to IEEE 802.15.4 Radio HAL descriptor
159+ * @param[in] cb isr callback
160+ * @param[in] ctx context pointer handed to isr
150161 *
151162 * @return 0 on success
152163 * @return <0 on error
153164 */
154- int kw2xrf_init (kw2xrf_t * dev , gpio_cb_t cb );
165+ int kw2xrf_init (kw2xrf_t * dev , const kw2xrf_params_t * params , ieee802154_dev_t * hal ,
166+ gpio_cb_t cb , void * ctx );
155167
156168/**
157169 * @brief Configure radio with default values
@@ -160,6 +172,13 @@ int kw2xrf_init(kw2xrf_t *dev, gpio_cb_t cb);
160172 */
161173void kw2xrf_reset_phy (kw2xrf_t * dev );
162174
175+ /**
176+ * @brief IRQ Handler for the KW2XRF device
177+ *
178+ * @param[in] dev pointer to the IEEE 802.15.4 Radio HAL descriptor
179+ */
180+ void kw2xrf_radio_hal_irq_handler (void * dev );
181+
163182#ifdef __cplusplus
164183}
165184#endif
0 commit comments