Merged in merlin17/nuttx/develop (pull request #426)

drivers/wireless/ieee802154: Moved radios to individual sub-directories

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Anthony Merlino 2017-07-03 11:33:25 +00:00 committed by Gregory Nutt
commit 74ca74a910
10 changed files with 3118 additions and 2302 deletions

View File

@ -11,10 +11,14 @@ config IEEE802154_MRF24J40
---help---
This selection enables support for the Microchip MRF24J40 device.
source drivers/wireless/ieee802154/mrf24j40/Kconfig
config IEEE802154_AT86RF233
bool "ATMEL RF233 IEEE 802.15.4 transceiver"
default n
---help---
This selection enables support for the Atmel RF233 device.
source drivers/wireless/ieee802154/at86rf23x/Kconfig
endif # DRIVERS_IEEE802154

View File

@ -1,7 +1,7 @@
############################################################################
# drivers/ieee802154/Make.defs
#
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -41,15 +41,10 @@ ifeq ($(CONFIG_DRIVERS_IEEE802154),y)
# Include IEEE 802.15.4 drivers into the build
ifeq ($(CONFIG_IEEE802154_MRF24J40),y)
CSRCS += mrf24j40.c
endif
include wireless$(DELIM)ieee802154$(DELIM)mrf24j40$(DELIM)Make.defs
include wireless$(DELIM)ieee802154$(DELIM)at86rf23x$(DELIM)Make.defs
ifeq ($(CONFIG_IEEE802154_AT86RF233),y)
CSRCS += at86rf23x.c
endif
# Include IEEE 802.15.4 build support
# Include common IEEE 802.15.4 build support
DEPPATH += --dep-path wireless$(DELIM)ieee802154
VPATH += :wireless$(DELIM)ieee802154

View File

@ -0,0 +1,8 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if IEEE802154_AT86RF233
endif # IEEE802154_AT86RF233

View File

@ -0,0 +1,48 @@
############################################################################
# drivers/ieee802154/at86rf23x/Make.defs
#
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
# Include AT86RF23x drivers into the build
ifeq ($(CONFIG_IEEE802154_AT86RF233),y)
CSRCS += at86rf23x.c
# Include AT86RF23x build support
DEPPATH += --dep-path wireless$(DELIM)ieee802154$(DELIM)at86rf23x
VPATH += :wireless$(DELIM)ieee802154$(DELIM)at86rf23x
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)wireless$(DELIM)ieee802154$(DELIM)at86rf23x}
endif # CONFIG_IEEE802154_AT86RF233

View File

@ -1,5 +1,5 @@
/****************************************************************************
* drivers/wireless/ieee802154/at86rf23x.c
* drivers/wireless/ieee802154/at86rf23x/at86rf23x.c
*
* Copyright (C) 2016 Matt Poppe. All rights reserved.
* Author: Matt Poppe <matt@poppe.me>
@ -993,115 +993,226 @@ static int at86rf23x_gettxpower(FAR struct ieee802154_radio_s *ieee,
/* Right now we only get negative values */
reg = at86rf23x_getreg(dev->spi, RF23X_REG_TXPWR);
switch (reg)
{
case RF23X_TXPWR_POS_4:
case RF23X_TXPWR_POS_4:
*txpwr = 0;
break;
case RF23X_TXPWR_POS_3_7:
*txpwr = 0;
case RF23X_TXPWR_POS_3_7:
*txpwr =
0;
break;
case RF23X_TXPWR_POS_3_4:
case RF23X_TXPWR_POS_3_4:
*txpwr = 0;
break;
case RF23X_TXPWR_POS_3:
*txpwr = 0;
case RF23X_TXPWR_POS_3:
*txpwr =
0;
break;
case RF23X_TXPWR_POS_2_5:
case RF23X_
TXPWR_POS_2_5:
*txpwr = 0;
break;
case RF23X_TXPWR_POS_2:
*txpwr = 0;
break;
case RF23X_TXPWR_POS_1:
*txpwr = 0;
break;
case RF23X_TXPWR_POS_1:
*txpwr = 0;
case RF23X_TXPWR_0:
*txpwr =
0;
break;
case RF23X_TXPWR_0:
*txpwr = 0;
break;
case RF23X_TXPWR_NEG_1:
*txpwr = 1000;
break;
case RF23X_TXPWR_NEG_2:
case RF23X_TXPWR_NE
G_2:
*txpwr = 2000;
break;
case RF23X_TXPWR_NEG_3:
*txpwr = 3000;
*txpwr = 3000;
break;
case RF23X_TXPWR_NEG_4:
*txpwr = 4000;
break;
*txpwr = 4000;
break;
case RF23X_TXPWR_NEG_6:
*txpwr = 6000;
break;
case RF23X_TXPWR_NEG_8:
*txpwr = 8000;
break;
case RF23X_TXPWR_NEG_12:
ca
se RF23X_TXPWR_NEG_12:
*txpwr = 12000;
break;
case RF23X_TXPWR_NEG_17:
*txpwr = 17000;
break;
*txpwr = 17
000;
break;
}
return OK;
}
/****************************************************************************
/****
************************************************************************
* Name: at86rf23x_setcca
*
* Description:
* Configures if energy detection is used or carrier sense. The base
* measurement is configured here as well
*
*
****************************************************************************/
static int at86rf23x_setcca(FAR struct ieee802154_radio_s *ieee,
*
*************************************************************************
***/
static
int at86rf23x_setcca(FAR struct ieee802154_radio_s *ieee,
FAR struct ieee802154_cca_s *cca)
{
FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee;
/* TODO: This doesn't fit the RF233 completely come back to this */
if (!cca->use_ed && !cca->use_cs)
{
return -EINVAL;
}
if (cca->use_cs && cca->csth > 0x0f)
{
return -EINVAL;
}
if (cca->use_ed)
{
{
at86rf23x_setregbits(dev->spi, RF23X_CCA_BITS_MODE, RF23X_CCA_MODE_ED);
}
if (cca->use_cs)
if (cca->use_cs)
{
at86rf23x_setregbits(dev->spi, RF23X_CCA_BITS_MODE, RF23X_CCA_MODE_CS);
at86rf23x_setregbits(dev->spi, RF23X_CCA_BITS_MODE, RF23X_CCA
_MODE_CS);
}
memcpy(&dev->cca, cca, sizeof(struct ieee802154_cca_s));
memcpy(&dev->cca, cca, sizeof(struct ieee802154
_cca_s));
return OK;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* drivers/wireless/ieee802154/at86rf23x.c
* drivers/wireless/ieee802154/at86rf23x/at86rf23x.h
*
* Copyright (C) 2016 Matt Poppe. All rights reserved.
* Author: Matt Poppe <matt@poppe.me>
@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef __DRIVERS_WIRELESS_IEEE802154_AT86RF23X_H
#define __DRIVERS_WIRELESS_IEEE802154_AT86RF23X_H
#ifndef __DRIVERS_WIRELESS_IEEE802154_AT86RF23X_AT86RF23X_H
#define __DRIVERS_WIRELESS_IEEE802154_AT86RF23X_AT86RF23X_H
/****************************************************************************
* Pre-processor Definitions
@ -218,4 +218,4 @@
#define RF23X_IRQ_MASK_DEFAULT (RF23X_IRQ_MASK_TRX_END)
#endif /* __DRIVERS_WIRELESS_IEEE802154_AT86RF23X_H */
#endif /* __DRIVERS_WIRELESS_IEEE802154_AT86RF23X_AT86RF23X_H */

View File

@ -0,0 +1,8 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if IEEE802154_MRF24J40
endif # IEEE802154_MRF24J40

View File

@ -0,0 +1,48 @@
############################################################################
# drivers/ieee802154/mrf24j40/Make.defs
#
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
ifeq ($(CONFIG_IEEE802154_MRF24J40),y)
# Include MRF24J40 files into the build
CSRCS += mrf24j40.c
# Include MRF24J40 build support
DEPPATH += --dep-path wireless$(DELIM)ieee802154$(DELIM)mrf24j40
VPATH += :wireless$(DELIM)ieee802154$(DELIM)mrf24j40
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)wireless$(DELIM)ieee802154$(DELIM)mrf24j40}
endif # CONFIG_IEEE802154_MRF24J40

View File

@ -1,5 +1,5 @@
/****************************************************************************
* drivers/wireless/ieee802154/mrf24j40.h
* drivers/wireless/ieee802154/mrf24j40/mrf24j40.h
*
* Copyright (C) 2015-2016 Sebastien Lorquet. All rights reserved.
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef __DRIVERS_WIRELESS_IEEE802154_MRF24J40_H
#define __DRIVERS_WIRELESS_IEEE802154_MRF24J40_H
#ifndef __DRIVERS_WIRELESS_IEEE802154_MRF24J40_MRF24J40_H
#define __DRIVERS_WIRELESS_IEEE802154_MRF24J40_MRF24J40_H
/* MRF24J40 Registers *******************************************************/
@ -286,4 +286,353 @@
#define MRF24J40_RXFLUSH_SHIFT_WAKEPAD 5
#define MRF24J40_RXFLUSH_SHIFT_WAKEPOL 6
#endif /* __DRIVERS_WIRELESS_IEEE802154_MRF24J40_H */
#endif /* __DRIVERS_WIRELESS_IEEE802154_MRF24J40_MRF24J40_H */