drivers/ieee802154: Added RAW mode support to nRF5 radio driver
Change-Id: Ib327032458d5098f0ee4f01ae719f23a856901c1 Signed-off-by: Wojciech Bober <wojciech.bober@nordicsemi.no>
This commit is contained in:
parent
07b8e4cb01
commit
162f25bc30
|
@ -1,12 +1,30 @@
|
|||
# Kconfig.nrf5 - Nordic Semiconductor nRF5 802.15.4 configuration options
|
||||
#
|
||||
|
||||
menuconfig IEEE802154_NRF5
|
||||
bool "nRF52 series IEEE 802.15.4 Driver support"
|
||||
choice IEEE802154_NRF5_DRIVER_SUPPORT
|
||||
prompt "nRF52 series IEEE 802.15.4 Driver support"
|
||||
depends on NETWORKING && SOC_NRF52840
|
||||
default IEEE802154_NRF5_DISABLED
|
||||
|
||||
config IEEE802154_NRF5_DISABLED
|
||||
bool "Driver disabled"
|
||||
|
||||
config IEEE802154_NRF5
|
||||
bool "Regular mode"
|
||||
select NET_L2_IEEE802154
|
||||
select HAS_NORDIC_DRIVERS
|
||||
default n
|
||||
|
||||
config IEEE802154_NRF5_RAW
|
||||
bool "RAW mode"
|
||||
select NET_L2_RAW_CHANNEL
|
||||
select HAS_NORDIC_DRIVERS
|
||||
help
|
||||
Enable IEEE802154_CC2520 driver with RAW channel
|
||||
|
||||
The CC2520 driver with RAW channel allows to export radio interface
|
||||
over USB making an USB 802.15.4 dongle.
|
||||
|
||||
endchoice
|
||||
|
||||
if IEEE802154_NRF5 || IEEE802154_NRF5_RAW
|
||||
|
||||
|
|
|
@ -4,3 +4,4 @@ obj-$(CONFIG_IEEE802154_UPIPE) += ieee802154_uart_pipe.o
|
|||
obj-$(CONFIG_IEEE802154_MCR20A) += ieee802154_mcr20a.o
|
||||
obj-$(CONFIG_IEEE802154_MCR20A_RAW) += ieee802154_mcr20a.o
|
||||
obj-$(CONFIG_IEEE802154_NRF5) += ieee802154_nrf5.o
|
||||
obj-$(CONFIG_IEEE802154_NRF5_RAW) += ieee802154_nrf5.o
|
||||
|
|
|
@ -77,6 +77,13 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
|
|||
goto out;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IEEE802154_NRF5_RAW)
|
||||
/**
|
||||
* Reserve 1 byte for length
|
||||
*/
|
||||
net_nbuf_set_ll_reserve(buf, 1);
|
||||
#endif
|
||||
|
||||
pkt_buf = net_nbuf_get_frag(buf, K_NO_WAIT);
|
||||
if (!pkt_buf) {
|
||||
SYS_LOG_ERR("No pkt_buf available");
|
||||
|
@ -85,10 +92,15 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
|
|||
|
||||
net_buf_frag_insert(buf, pkt_buf);
|
||||
|
||||
/* rx_mpdu contains length, psdu, [fcs], lqi
|
||||
* FCS filed (2 bytes) is not present if CRC is enabled
|
||||
/* rx_mpdu contains length, psdu, fcs|lqi
|
||||
* The last 2 bytes contain LQI or FCS, depending if
|
||||
* automatic CRC handling is enabled or not, respectively.
|
||||
*/
|
||||
#if defined(CONFIG_IEEE802154_NRF5_RAW)
|
||||
pkt_len = nrf5_radio->rx_psdu[0];
|
||||
#else
|
||||
pkt_len = nrf5_radio->rx_psdu[0] - NRF5_FCS_LENGTH;
|
||||
#endif
|
||||
|
||||
/* Skip length (first byte) and copy the payload */
|
||||
memcpy(pkt_buf->data, nrf5_radio->rx_psdu + 1, pkt_len);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
obj-$(CONFIG_IEEE802154_NRF5) += nrf_drv_radio802154.o
|
||||
ifeq ($(or $(CONFIG_IEEE802154_NRF5),$(CONFIG_IEEE802154_NRF5_RAW)),y)
|
||||
obj-y += nrf_drv_radio802154.o
|
||||
|
||||
ifeq ($(CONFIG_IEEE802154_NRF5),y)
|
||||
# A common prefix used for placing radio buffer in a named
|
||||
# memory section.
|
||||
KBUILD_CFLAGS += -DRADIO_SECTION_PREFIX="\".top_of_image_ram\""
|
||||
|
|
Loading…
Reference in a new issue