Merged in merlin17/nuttx/ieee802154 (pull request #336)
wireless/ieee802154: Lots of little fixes and changes to get everything to build Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
commit
b52de42d16
@ -67,10 +67,6 @@
|
|||||||
# error Wireless support requires CONFIG_DRIVERS_WIRELESS
|
# error Wireless support requires CONFIG_DRIVERS_WIRELESS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_IEEE802154_DEV
|
|
||||||
# error IEEE802.15.4 radio character device required (CONFIG_IEEE802154_DEV)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(CONFIG_CLICKER2_STM32_MB1_BEE) && \
|
#if !defined(CONFIG_CLICKER2_STM32_MB1_BEE) && \
|
||||||
!defined(CONFIG_CLICKER2_STM32_MB2_BEE)
|
!defined(CONFIG_CLICKER2_STM32_MB2_BEE)
|
||||||
# error Only the Mikroe BEE board is supported
|
# error Only the Mikroe BEE board is supported
|
||||||
|
@ -56,6 +56,8 @@
|
|||||||
#include <nuttx/fs/fs.h>
|
#include <nuttx/fs/fs.h>
|
||||||
#include <nuttx/spi/spi.h>
|
#include <nuttx/spi/spi.h>
|
||||||
|
|
||||||
|
#include <nuttx/drivers/iob.h>
|
||||||
|
|
||||||
#include <nuttx/wireless/ieee802154/mrf24j40.h>
|
#include <nuttx/wireless/ieee802154/mrf24j40.h>
|
||||||
#include <nuttx/wireless/ieee802154/ieee802154_radio.h>
|
#include <nuttx/wireless/ieee802154/ieee802154_radio.h>
|
||||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||||
@ -221,8 +223,7 @@ static int mrf24j40_bind(FAR struct ieee802154_radio_s *radio,
|
|||||||
FAR struct ieee802154_radiocb_s *radiocb);
|
FAR struct ieee802154_radiocb_s *radiocb);
|
||||||
static int mrf24j40_ioctl(FAR struct ieee802154_radio_s *radio, int cmd,
|
static int mrf24j40_ioctl(FAR struct ieee802154_radio_s *radio, int cmd,
|
||||||
unsigned long arg);
|
unsigned long arg);
|
||||||
static int mrf24j40_rxenable(FAR struct ieee802154_radio_s *radio,
|
static int mrf24j40_rxenable(FAR struct ieee802154_radio_s *radio);
|
||||||
bool state, FAR struct ieee802154_packet_s *packet);
|
|
||||||
static int mrf24j40_transmit(FAR struct ieee802154_radio_s *radio,
|
static int mrf24j40_transmit(FAR struct ieee802154_radio_s *radio,
|
||||||
FAR uint8_t *buf, uint16_t buf_len);
|
FAR uint8_t *buf, uint16_t buf_len);
|
||||||
static int mrf24j40_txnotify_csma(FAR struct ieee802154_radio_s *radio);
|
static int mrf24j40_txnotify_csma(FAR struct ieee802154_radio_s *radio);
|
||||||
@ -324,7 +325,7 @@ static int mrf24j40_txnotify_csma(FAR struct ieee802154_radio_s *radio)
|
|||||||
static void mrf24j40_dopoll_csma(FAR void *arg)
|
static void mrf24j40_dopoll_csma(FAR void *arg)
|
||||||
{
|
{
|
||||||
FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)arg;
|
FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)arg;
|
||||||
int ret = 0;
|
int len = 0;
|
||||||
|
|
||||||
/* Need to get exlusive access to the device so that we can use the copy
|
/* Need to get exlusive access to the device so that we can use the copy
|
||||||
* buffer.
|
* buffer.
|
||||||
@ -338,9 +339,9 @@ static void mrf24j40_dopoll_csma(FAR void *arg)
|
|||||||
{
|
{
|
||||||
/* need to somehow allow for a handle to be passed */
|
/* need to somehow allow for a handle to be passed */
|
||||||
|
|
||||||
ret = dev->radiocb->poll_csma(dev->radiocb, &dev->csma_desc.pub,
|
len = dev->radiocb->poll_csma(dev->radiocb, &dev->csma_desc.pub,
|
||||||
&dev->tx_buf[0]);
|
&dev->tx_buf[0]);
|
||||||
if (ret > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
/* Now the txdesc is in use */
|
/* Now the txdesc is in use */
|
||||||
|
|
||||||
@ -348,8 +349,7 @@ static void mrf24j40_dopoll_csma(FAR void *arg)
|
|||||||
|
|
||||||
/* Setup the transaction on the device in the CSMA FIFO */
|
/* Setup the transaction on the device in the CSMA FIFO */
|
||||||
|
|
||||||
mrf24j40_csma_setup(dev, &dev->tx_buf[0],
|
mrf24j40_csma_setup(dev, &dev->tx_buf[0], len);
|
||||||
dev->csma_desc.pub.psdu_length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ static void mrf24j40_dopoll_gts(FAR void *arg)
|
|||||||
{
|
{
|
||||||
FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)arg;
|
FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)arg;
|
||||||
int gts = 0;
|
int gts = 0;
|
||||||
int ret = 0;
|
int len = 0;
|
||||||
|
|
||||||
/* Need to get exclusive access to the device so that we can use the copy
|
/* Need to get exclusive access to the device so that we can use the copy
|
||||||
* buffer.
|
* buffer.
|
||||||
@ -431,9 +431,9 @@ static void mrf24j40_dopoll_gts(FAR void *arg)
|
|||||||
{
|
{
|
||||||
if (!dev->gts_desc[gts].busy)
|
if (!dev->gts_desc[gts].busy)
|
||||||
{
|
{
|
||||||
ret = dev->radiocb->poll_gts(dev->radiocb, &dev->gts_desc[gts].pub,
|
len = dev->radiocb->poll_gts(dev->radiocb, &dev->gts_desc[gts].pub,
|
||||||
&dev->tx_buf[0]);
|
&dev->tx_buf[0]);
|
||||||
if (ret > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
/* Now the txdesc is in use */
|
/* Now the txdesc is in use */
|
||||||
|
|
||||||
@ -441,8 +441,7 @@ static void mrf24j40_dopoll_gts(FAR void *arg)
|
|||||||
|
|
||||||
/* Setup the transaction on the device in the open GTS FIFO */
|
/* Setup the transaction on the device in the open GTS FIFO */
|
||||||
|
|
||||||
mrf24j40_gts_setup(dev, gts, &dev->tx_buf[0],
|
mrf24j40_gts_setup(dev, gts, &dev->tx_buf[0], len);
|
||||||
dev->gts_desc[gts].pub.psdu_length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1583,27 +1582,18 @@ static void mrf24j40_irqwork_txgts(FAR struct mrf24j40_radio_s *dev,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int mrf24j40_rxenable(FAR struct ieee802154_radio_s *radio, bool state,
|
static int mrf24j40_rxenable(FAR struct ieee802154_radio_s *radio)
|
||||||
FAR struct ieee802154_packet_s *packet)
|
|
||||||
{
|
{
|
||||||
FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)radio;
|
FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)radio;
|
||||||
uint8_t reg;
|
uint8_t reg;
|
||||||
|
|
||||||
if (state)
|
mrf24j40_pacontrol(dev, MRF24J40_PA_AUTO);
|
||||||
{
|
|
||||||
mrf24j40_pacontrol(dev, MRF24J40_PA_AUTO);
|
|
||||||
radio->rxbuf = packet;
|
|
||||||
|
|
||||||
/* Enable rx int */
|
/* Enable rx int */
|
||||||
|
|
||||||
reg = mrf24j40_getreg(dev->spi, MRF24J40_INTCON);
|
reg = mrf24j40_getreg(dev->spi, MRF24J40_INTCON);
|
||||||
reg &= ~MRF24J40_INTCON_RXIE;
|
reg &= ~MRF24J40_INTCON_RXIE;
|
||||||
mrf24j40_setreg(dev->spi, MRF24J40_INTCON, reg);
|
mrf24j40_setreg(dev->spi, MRF24J40_INTCON, reg);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
radio->rxbuf = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -1619,7 +1609,7 @@ static int mrf24j40_rxenable(FAR struct ieee802154_radio_s *radio, bool state,
|
|||||||
static void mrf24j40_irqwork_rx(FAR struct mrf24j40_radio_s *dev)
|
static void mrf24j40_irqwork_rx(FAR struct mrf24j40_radio_s *dev)
|
||||||
{
|
{
|
||||||
FAR struct iob_s *iob;
|
FAR struct iob_s *iob;
|
||||||
struct ieee802154_txdesc_s rxdesc;
|
struct ieee802154_rxdesc_s rxdesc;
|
||||||
uint32_t addr;
|
uint32_t addr;
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
uint8_t reg;
|
uint8_t reg;
|
||||||
@ -1636,7 +1626,6 @@ static void mrf24j40_irqwork_rx(FAR struct mrf24j40_radio_s *dev)
|
|||||||
|
|
||||||
mrf24j40_setreg(dev->spi, MRF24J40_BBREG1, MRF24J40_BBREG1_RXDECINV);
|
mrf24j40_setreg(dev->spi, MRF24J40_BBREG1, MRF24J40_BBREG1_RXDECINV);
|
||||||
|
|
||||||
|
|
||||||
/* Allocate an IOB to put the packet in */
|
/* Allocate an IOB to put the packet in */
|
||||||
|
|
||||||
iob = iob_alloc(true);
|
iob = iob_alloc(true);
|
||||||
@ -1675,7 +1664,8 @@ static void mrf24j40_irqwork_rx(FAR struct mrf24j40_radio_s *dev)
|
|||||||
|
|
||||||
/* Callback the receiver in the next highest layer */
|
/* Callback the receiver in the next highest layer */
|
||||||
|
|
||||||
dev->radiocb->rx_frame(dev->radiocb, &rxdesc, iob);
|
dev->radiocb->rxframe(dev->radiocb,
|
||||||
|
(FAR const struct ieee802154_rxdesc_s *)&rxdesc, iob);
|
||||||
|
|
||||||
/* Enable reception of next packet by flushing the fifo.
|
/* Enable reception of next packet by flushing the fifo.
|
||||||
* This is an MRF24J40 errata (no. 1).
|
* This is an MRF24J40 errata (no. 1).
|
||||||
@ -1831,16 +1821,6 @@ FAR struct ieee802154_radio_s *mrf24j40_init(FAR struct spi_dev_s *spi,
|
|||||||
|
|
||||||
dev->radio.ops = &mrf24j40_devops;
|
dev->radio.ops = &mrf24j40_devops;
|
||||||
|
|
||||||
/* Initialize semaphores */
|
|
||||||
|
|
||||||
sem_init(&dev->radio.rxsem, 0, 0);
|
|
||||||
|
|
||||||
/* These semaphores are all used for signaling and, hence, should
|
|
||||||
* not have priority inheritance enabled.
|
|
||||||
*/
|
|
||||||
|
|
||||||
sem_setprotocol(&dev->radio.rxsem, SEM_PRIO_NONE);
|
|
||||||
|
|
||||||
dev->lower = lower;
|
dev->lower = lower;
|
||||||
dev->spi = spi;
|
dev->spi = spi;
|
||||||
|
|
||||||
|
@ -55,6 +55,8 @@
|
|||||||
# include <net/if.h>
|
# include <net/if.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <nuttx/wireless/ieee802154/ieee802154_radio.h>
|
||||||
|
|
||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -553,45 +555,7 @@ struct ieee802154_data_req_s
|
|||||||
|
|
||||||
struct ieee802154_data_conf_s
|
struct ieee802154_data_conf_s
|
||||||
{
|
{
|
||||||
uint8_t msdu_handle; /* Handle assoc. with MSDU */
|
IEEE802154_TXDESC_FIELDS
|
||||||
|
|
||||||
/* The time, in symbols, at which the data were transmitted */
|
|
||||||
|
|
||||||
uint32_t timestamp;
|
|
||||||
|
|
||||||
enum ieee802154_status_e status; /* The status of the MSDU transmission */
|
|
||||||
|
|
||||||
#ifdef CONFIG_IEEE802154_RANGING
|
|
||||||
bool rng_rcvd; /* Ranging indicated by MSDU */
|
|
||||||
|
|
||||||
/* A count of the time units corresponding to an RMARKER at the antenna at
|
|
||||||
* the beginning of the ranging exchange
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint32_t rng_counter_start;
|
|
||||||
|
|
||||||
/* A count of the time units corresponding to an RMARKER at the antenna at
|
|
||||||
* end of the ranging exchange
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint32_t rng_counter_stop;
|
|
||||||
|
|
||||||
/* A count of the time units in a message exchange over which the tracking
|
|
||||||
* offset was measured
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint34_t rng_tracking_interval;
|
|
||||||
|
|
||||||
/* A count of the time units slipped or advanced by the radio tracking
|
|
||||||
* system over the course of the entire tracking interval
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint32_t rng_offset;
|
|
||||||
|
|
||||||
/* The Figure of Merit (FoM) characterizing the ranging measurement */
|
|
||||||
|
|
||||||
uint8_t rng_fom;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -1111,7 +1075,6 @@ struct ieee802154_rxenable_conf_s
|
|||||||
|
|
||||||
struct ieee802154_scan_req_s
|
struct ieee802154_scan_req_s
|
||||||
{
|
{
|
||||||
|
|
||||||
enum ieee802154_scantype_e type;
|
enum ieee802154_scantype_e type;
|
||||||
uint8_t duration;
|
uint8_t duration;
|
||||||
uint8_t ch_page;
|
uint8_t ch_page;
|
||||||
@ -1406,13 +1369,13 @@ enum ieee802154_macnotify_e
|
|||||||
|
|
||||||
struct ieee802154_maccb_s
|
struct ieee802154_maccb_s
|
||||||
{
|
{
|
||||||
CODE void (*mlme_notify) (FAR struct ieee802154_maccb_s *maccb,
|
CODE void (*mlme_notify) (FAR const struct ieee802154_maccb_s *maccb,
|
||||||
enum ieee802154_macnotify_e notif,
|
enum ieee802154_macnotify_e notif,
|
||||||
FAR union ieee802154_mlme_notify_u *arg);
|
FAR const union ieee802154_mlme_notify_u *arg);
|
||||||
|
|
||||||
CODE void (*mcps_notify) (FAR struct ieee802154_maccb_s *maccb,
|
CODE void (*mcps_notify) (FAR const struct ieee802154_maccb_s *maccb,
|
||||||
enum ieee802154_macnotify_e notif,
|
enum ieee802154_macnotify_e notif,
|
||||||
FAR union ieee802154_mcps_notify_u *arg);
|
FAR const union ieee802154_mcps_notify_u *arg);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -158,12 +158,30 @@ struct ieee802154_netradio_s
|
|||||||
|
|
||||||
/* IEEE802.15.4 Radio Interface Operations **********************************/
|
/* IEEE802.15.4 Radio Interface Operations **********************************/
|
||||||
|
|
||||||
|
/* This is a work-around to allow the MAC upper layer have a struct with
|
||||||
|
* identical members but with a different name. */
|
||||||
|
|
||||||
|
#ifdef CONFIG_IEEE802154_RANGING
|
||||||
|
#define IEEE802154_TXDESC_FIELDS \
|
||||||
|
uint8_t handle; \
|
||||||
|
uint32_t timestamp; \
|
||||||
|
uint8_t status;
|
||||||
|
#else
|
||||||
|
#define IEEE802154_TXDESC_FIELDS \
|
||||||
|
uint8_t handle; \
|
||||||
|
uint32_t timestamp; \
|
||||||
|
uint8_t status;
|
||||||
|
bool rng_rcvd; \
|
||||||
|
uint32_t rng_counter_start; \
|
||||||
|
uint32_t rng_counter_stop; \
|
||||||
|
uint32_t rng_tracking_interval; \
|
||||||
|
uint32_t rng_offset;\
|
||||||
|
uint8_t rng_fom;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct ieee802154_txdesc_s
|
struct ieee802154_txdesc_s
|
||||||
{
|
{
|
||||||
uint8_t psdu_handle; /* The psdu handle identifying the transaction */
|
IEEE802154_TXDESC_FIELDS
|
||||||
uint16_t psdu_length; /* The length of the PSDU */
|
|
||||||
uint8_t status; /* The status of the transaction. This is set by the
|
|
||||||
* radio layer prior to calling txdone_csma */
|
|
||||||
|
|
||||||
/* TODO: Add slotting information for GTS transactions */
|
/* TODO: Add slotting information for GTS transactions */
|
||||||
};
|
};
|
||||||
@ -176,13 +194,13 @@ struct ieee802154_rxdesc_s
|
|||||||
|
|
||||||
struct ieee802154_radiocb_s
|
struct ieee802154_radiocb_s
|
||||||
{
|
{
|
||||||
CODE int (*poll_csma) (FAR struct ieee802154_radiocb_s *radiocb,
|
CODE int (*poll_csma) (FAR const struct ieee802154_radiocb_s *radiocb,
|
||||||
FAR struct ieee802154_txdesc_s *tx_desc, FAR uint8_t *buf);
|
FAR struct ieee802154_txdesc_s *tx_desc, FAR uint8_t *buf);
|
||||||
CODE int (*poll_gts) (FAR struct ieee802154_radiocb_s *radiocb,
|
CODE int (*poll_gts) (FAR const struct ieee802154_radiocb_s *radiocb,
|
||||||
FAR struct ieee802154_txdesc_s *tx_desc, FAR uint8_t *buf);
|
FAR struct ieee802154_txdesc_s *tx_desc, FAR uint8_t *buf);
|
||||||
CODE int (*txdone) (FAR struct ieee802154_radiocb_s *radiocb,
|
CODE void (*txdone) (FAR const struct ieee802154_radiocb_s *radiocb,
|
||||||
FAR const struct ieee802154_txdesc_s *tx_desc);
|
FAR const struct ieee802154_txdesc_s *tx_desc);
|
||||||
CODE int (*rx_frame) (FAR struct ieee802154_radiocb_s *radiocb,
|
CODE void (*rxframe) (FAR const struct ieee802154_radiocb_s *radiocb,
|
||||||
FAR const struct ieee8021254_rxdesc_s *rx_desc,
|
FAR const struct ieee8021254_rxdesc_s *rx_desc,
|
||||||
FAR struct iob_s *frame);
|
FAR struct iob_s *frame);
|
||||||
};
|
};
|
||||||
@ -195,8 +213,7 @@ struct ieee802154_radioops_s
|
|||||||
FAR struct ieee802154_radiocb_s *radiocb);
|
FAR struct ieee802154_radiocb_s *radiocb);
|
||||||
CODE int (*ioctl)(FAR struct ieee802154_radio_s *radio, int cmd,
|
CODE int (*ioctl)(FAR struct ieee802154_radio_s *radio, int cmd,
|
||||||
unsigned long arg);
|
unsigned long arg);
|
||||||
CODE int (*rxenable)(FAR struct ieee802154_radio_s *radio, bool state,
|
CODE int (*rxenable)(FAR struct ieee802154_radio_s *radio);
|
||||||
FAR struct ieee802154_packet_s *packet);
|
|
||||||
CODE int (*txnotify_csma)(FAR struct ieee802154_radio_s *radio);
|
CODE int (*txnotify_csma)(FAR struct ieee802154_radio_s *radio);
|
||||||
CODE int (*txnotify_gts)(FAR struct ieee802154_radio_s *radio);
|
CODE int (*txnotify_gts)(FAR struct ieee802154_radio_s *radio);
|
||||||
};
|
};
|
||||||
|
@ -6,13 +6,14 @@
|
|||||||
config WIRELESS_IEEE802154
|
config WIRELESS_IEEE802154
|
||||||
bool "IEEE 802.15.4 Wireless Support"
|
bool "IEEE 802.15.4 Wireless Support"
|
||||||
default n
|
default n
|
||||||
|
select DRIVERS_IOB
|
||||||
---help---
|
---help---
|
||||||
Enables support for the IEEE 802.14.5 Wireless library.
|
Enables support for the IEEE 802.14.5 Wireless library.
|
||||||
|
|
||||||
if WIRELESS_IEEE802154
|
if WIRELESS_IEEE802154
|
||||||
|
|
||||||
config IEEE802154_MAC
|
menuconfig IEEE802154_MAC
|
||||||
bool "Generic Media Access Control layer for 802.15.4 radios"
|
bool "Generic Media Access Control (MAC) layer for 802.15.4 radios"
|
||||||
default n
|
default n
|
||||||
depends on WIRELESS_IEEE802154
|
depends on WIRELESS_IEEE802154
|
||||||
---help---
|
---help---
|
||||||
@ -21,6 +22,8 @@ config IEEE802154_MAC
|
|||||||
such as 6lowpan. It is not required to use 802.15.4 radios,
|
such as 6lowpan. It is not required to use 802.15.4 radios,
|
||||||
but is strongly suggested to ensure exchange of valid frames.
|
but is strongly suggested to ensure exchange of valid frames.
|
||||||
|
|
||||||
|
if IEEE802154_MAC
|
||||||
|
|
||||||
config IEEE802154_MAC_DEV
|
config IEEE802154_MAC_DEV
|
||||||
bool "Character driver for IEEE 802.15.4 MAC layer"
|
bool "Character driver for IEEE 802.15.4 MAC layer"
|
||||||
default n
|
default n
|
||||||
@ -29,6 +32,34 @@ config IEEE802154_MAC_DEV
|
|||||||
Enable the device driver to expose the IEEE 802.15.4 MAC layer
|
Enable the device driver to expose the IEEE 802.15.4 MAC layer
|
||||||
access to user space as IOCTLs
|
access to user space as IOCTLs
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "IEEE 802.15.4 work queue"
|
||||||
|
default MAC802154_LPWORK if SCHED_LPWORK
|
||||||
|
default MAC802154_HPWORK if !SCHED_LPWORK && SCHED_HPWORK
|
||||||
|
depends on SCHED_WORKQUEUE
|
||||||
|
---help---
|
||||||
|
Work queue support is required to use the IEEE 802.15.4 MAC layer.
|
||||||
|
If the low priority work queue is available, then it should be used by
|
||||||
|
the driver.
|
||||||
|
|
||||||
|
config MAC802154_HPWORK
|
||||||
|
bool "High priority"
|
||||||
|
depends on SCHED_HPWORK
|
||||||
|
|
||||||
|
config MAC802154_LPWORK
|
||||||
|
bool "Low priority"
|
||||||
|
depends on SCHED_LPWORK
|
||||||
|
|
||||||
|
endchoice # Work queue
|
||||||
|
|
||||||
|
config IEEE802154_NTXDESC
|
||||||
|
int "Number or TX descriptors"
|
||||||
|
default 3
|
||||||
|
---help---
|
||||||
|
Configured number of Tx descriptors. Default: 3
|
||||||
|
|
||||||
|
endif # IEEE802154_MAC
|
||||||
|
|
||||||
config IEEE802154_DEV
|
config IEEE802154_DEV
|
||||||
bool "Debug character driver for ieee802.15.4 radio interfaces"
|
bool "Debug character driver for ieee802.15.4 radio interfaces"
|
||||||
default n
|
default n
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -120,7 +120,7 @@ int mac802154_req_data(MACHANDLE mac, FAR struct ieee802154_data_req_s *req);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_req_purge(MACHANDLE mac, uint8_t handle);
|
int mac802154_req_purge(MACHANDLE mac, FAR struct ieee802154_purge_req_s *req);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_req_associate
|
* Name: mac802154_req_associate
|
||||||
@ -162,7 +162,7 @@ int mac802154_req_disassociate(MACHANDLE mac,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_req_get(MACHANDLE mac, enum ieee802154_pib_attr_e attr);
|
int mac802154_req_get(MACHANDLE mac, FAR struct ieee802154_get_req_s *req);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_req_gts
|
* Name: mac802154_req_gts
|
||||||
@ -175,7 +175,7 @@ int mac802154_req_get(MACHANDLE mac, enum ieee802154_pib_attr_e attr);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_req_gts(MACHANDLE mac, FAR uint8_t *characteristics);
|
int mac802154_req_gts(MACHANDLE mac, FAR struct ieee802154_gts_req_s *req);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_req_reset
|
* Name: mac802154_req_reset
|
||||||
@ -187,7 +187,7 @@ int mac802154_req_gts(MACHANDLE mac, FAR uint8_t *characteristics);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_req_reset(MACHANDLE mac, bool setdefaults);
|
int mac802154_req_reset(MACHANDLE mac, FAR struct ieee802154_reset_req_s *req);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_req_rxenable
|
* Name: mac802154_req_rxenable
|
||||||
@ -200,8 +200,8 @@ int mac802154_req_reset(MACHANDLE mac, bool setdefaults);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_req_rxenable(MACHANDLE mac, bool deferrable, int ontime,
|
int mac802154_req_rxenable(MACHANDLE mac,
|
||||||
int duration);
|
FAR struct ieee802154_rxenable_req_s *req);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_req_scan
|
* Name: mac802154_req_scan
|
||||||
@ -218,8 +218,7 @@ int mac802154_req_rxenable(MACHANDLE mac, bool deferrable, int ontime,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_req_scan(MACHANDLE mac, uint8_t type, uint32_t channels,
|
int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req);
|
||||||
int duration);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_req_set
|
* Name: mac802154_req_set
|
||||||
@ -231,8 +230,7 @@ int mac802154_req_scan(MACHANDLE mac, uint8_t type, uint32_t channels,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_req_set(MACHANDLE mac, int attribute, FAR uint8_t *value,
|
int mac802154_req_set(MACHANDLE mac, FAR struct ieee802154_set_req_s *req);
|
||||||
int valuelen);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_req_start
|
* Name: mac802154_req_start
|
||||||
@ -244,9 +242,7 @@ int mac802154_req_set(MACHANDLE mac, int attribute, FAR uint8_t *value,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_req_start(MACHANDLE mac, uint16_t panid, int channel,
|
int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req);
|
||||||
uint8_t bo, uint8_t fo, bool coord, bool batext,
|
|
||||||
bool realign);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_req_sync
|
* Name: mac802154_req_sync
|
||||||
@ -259,7 +255,7 @@ int mac802154_req_start(MACHANDLE mac, uint16_t panid, int channel,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_req_sync(MACHANDLE mac, int channel, bool track);
|
int mac802154_req_sync(MACHANDLE mac, FAR struct ieee802154_sync_req_s *req);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_req_poll
|
* Name: mac802154_req_poll
|
||||||
@ -272,7 +268,7 @@ int mac802154_req_sync(MACHANDLE mac, int channel, bool track);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_req_poll(MACHANDLE mac, FAR uint8_t *coordaddr);
|
int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_rsp_associate
|
* Name: mac802154_rsp_associate
|
||||||
@ -283,8 +279,8 @@ int mac802154_req_poll(MACHANDLE mac, FAR uint8_t *coordaddr);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_rsp_associate(MACHANDLE mac, uint8_t eadr, uint16_t saddr,
|
int mac802154_rsp_associate(MACHANDLE mac,
|
||||||
int status);
|
FAR struct ieee802154_assoc_resp_s *resp);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: mac802154_rsp_orphan
|
* Name: mac802154_rsp_orphan
|
||||||
@ -295,8 +291,8 @@ int mac802154_rsp_associate(MACHANDLE mac, uint8_t eadr, uint16_t saddr,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mac802154_rsp_orphan(MACHANDLE mac, FAR uint8_t *orphanaddr,
|
int mac802154_rsp_orphan(MACHANDLE mac,
|
||||||
uint16_t saddr, bool associated);
|
FAR struct ieee802154_orphan_resp_s *resp);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -139,6 +139,14 @@ struct mac802154_chardevice_s
|
|||||||
static inline int mac802154dev_takesem(sem_t *sem);
|
static inline int mac802154dev_takesem(sem_t *sem);
|
||||||
#define mac802154dev_givesem(s) sem_post(s);
|
#define mac802154dev_givesem(s) sem_post(s);
|
||||||
|
|
||||||
|
static void mac802154dev_mlme_notify(FAR const struct ieee802154_maccb_s *maccb,
|
||||||
|
enum ieee802154_macnotify_e notif,
|
||||||
|
FAR const union ieee802154_mlme_notify_u *arg);
|
||||||
|
|
||||||
|
static void mac802154dev_mcps_notify(FAR const struct ieee802154_maccb_s *maccb,
|
||||||
|
enum ieee802154_macnotify_e notif,
|
||||||
|
FAR const union ieee802154_mcps_notify_u *arg);
|
||||||
|
|
||||||
static int mac802154dev_open(FAR struct file *filep);
|
static int mac802154dev_open(FAR struct file *filep);
|
||||||
static int mac802154dev_close(FAR struct file *filep);
|
static int mac802154dev_close(FAR struct file *filep);
|
||||||
static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer,
|
static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer,
|
||||||
@ -151,7 +159,7 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd,
|
|||||||
/* MAC callback helpers */
|
/* MAC callback helpers */
|
||||||
|
|
||||||
static void mac802154dev_conf_data(FAR struct mac802154_chardevice_s *dev,
|
static void mac802154dev_conf_data(FAR struct mac802154_chardevice_s *dev,
|
||||||
FAR struct ieee802154_data_conf_s *conf);
|
FAR const struct ieee802154_data_conf_s *conf);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@ -591,9 +599,9 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mac802154dev_mlme_notify(FAR struct ieee802154_maccb_s *maccb,
|
static void mac802154dev_mlme_notify(FAR const struct ieee802154_maccb_s *maccb,
|
||||||
enum ieee802154_macnotify_e notif,
|
enum ieee802154_macnotify_e notif,
|
||||||
FAR union ieee802154_mlme_notify_u *arg)
|
FAR const union ieee802154_mlme_notify_u *arg)
|
||||||
{
|
{
|
||||||
FAR struct mac802154dev_callback_s *cb =
|
FAR struct mac802154dev_callback_s *cb =
|
||||||
(FAR struct mac802154dev_callback_s *)maccb;
|
(FAR struct mac802154dev_callback_s *)maccb;
|
||||||
@ -610,9 +618,9 @@ static void mac802154dev_mlme_notify(FAR struct ieee802154_maccb_s *maccb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mac802154dev_mcps_notify(FAR struct ieee802154_maccb_s *maccb,
|
static void mac802154dev_mcps_notify(FAR const struct ieee802154_maccb_s *maccb,
|
||||||
enum ieee802154_macnotify_e notif,
|
enum ieee802154_macnotify_e notif,
|
||||||
FAR union ieee802154_mcps_notify_u *arg)
|
FAR const union ieee802154_mcps_notify_u *arg)
|
||||||
{
|
{
|
||||||
FAR struct mac802154dev_callback_s *cb =
|
FAR struct mac802154dev_callback_s *cb =
|
||||||
(FAR struct mac802154dev_callback_s *)maccb;
|
(FAR struct mac802154dev_callback_s *)maccb;
|
||||||
@ -634,7 +642,7 @@ static void mac802154dev_mcps_notify(FAR struct ieee802154_maccb_s *maccb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void mac802154dev_conf_data(FAR struct mac802154_chardevice_s *dev,
|
static void mac802154dev_conf_data(FAR struct mac802154_chardevice_s *dev,
|
||||||
FAR struct ieee802154_data_conf_s *conf)
|
FAR const struct ieee802154_data_conf_s *conf)
|
||||||
{
|
{
|
||||||
FAR struct mac802154dev_dwait_s *curr;
|
FAR struct mac802154dev_dwait_s *curr;
|
||||||
FAR struct mac802154dev_dwait_s *prev;
|
FAR struct mac802154dev_dwait_s *prev;
|
||||||
@ -647,7 +655,7 @@ static void mac802154dev_conf_data(FAR struct mac802154_chardevice_s *dev,
|
|||||||
/* Search to see if there is a dwait pending for this transaction */
|
/* Search to see if there is a dwait pending for this transaction */
|
||||||
|
|
||||||
for (prev = NULL, curr = dev->md_dwait;
|
for (prev = NULL, curr = dev->md_dwait;
|
||||||
curr && curr->mw_handle != conf->msdu_handle;
|
curr && curr->mw_handle != conf->handle;
|
||||||
prev = curr, curr = curr->mw_flink);
|
prev = curr, curr = curr->mw_flink);
|
||||||
|
|
||||||
/* If a dwait is found */
|
/* If a dwait is found */
|
||||||
@ -669,7 +677,7 @@ static void mac802154dev_conf_data(FAR struct mac802154_chardevice_s *dev,
|
|||||||
|
|
||||||
/* Copy the transmission status into the dwait struct */
|
/* Copy the transmission status into the dwait struct */
|
||||||
|
|
||||||
curr->mw_status = conf->msdu_handle;
|
curr->mw_status = conf->status;
|
||||||
|
|
||||||
/* Wake the thread waiting for the data transmission */
|
/* Wake the thread waiting for the data transmission */
|
||||||
|
|
||||||
|
@ -254,13 +254,13 @@ static ssize_t radio802154dev_read(FAR struct file *filep, FAR char *buffer, siz
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dev->child->ops->rxenable(dev->child, 1, buf);
|
#warning Receive needs to be redone!
|
||||||
#if 0
|
#if 0
|
||||||
|
ret = dev->child->ops->rxenable(dev->child, 1, buf);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* if no packet is received, this will produce -EAGAIN
|
/* if no packet is received, this will produce -EAGAIN
|
||||||
* The user is responsible for sleeping until sth arrives
|
* The user is responsible for sleeping until sth arrives
|
||||||
@ -282,6 +282,8 @@ static ssize_t radio802154dev_read(FAR struct file *filep, FAR char *buffer, siz
|
|||||||
dev->child->ops->rxenable(dev->child, 0, NULL);
|
dev->child->ops->rxenable(dev->child, 0, NULL);
|
||||||
ret = buf->len;
|
ret = buf->len;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user