Merged in merlin17/nuttx/ieee802154 (pull request #304)
wireless/ieee802154: Removes ieee802154.h and makes other minor changes Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
commit
4836534894
@ -56,7 +56,7 @@
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
#include <nuttx/wireless/ieee802154/at86rf23x.h>
|
||||
#include <nuttx/wireless/ieee802154/ieee802154.h>
|
||||
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_radio.h>
|
||||
|
||||
#include "at86rf23x.h"
|
||||
|
@ -1099,7 +1099,7 @@ static int mrf24j40_transmit(FAR struct ieee802154_radio_s *ieee,
|
||||
hlen += 2 + 8; /* Destination PAN + extaddr */
|
||||
}
|
||||
|
||||
if (!(frame_ctrl & IEEE802154_FRAMECTRL_INTRA))
|
||||
if (!(frame_ctrl & IEEE802154_FRAMECTRL_PANIDCOMP))
|
||||
{
|
||||
hlen += 2; /* No PAN compression, source PAN is different from dest PAN */
|
||||
}
|
||||
|
@ -1,112 +0,0 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/wireless/ieee802154/ieee802154.h
|
||||
*
|
||||
* Copyright (C) 2014-2016 Sebastien Lorquet. All rights reserved.
|
||||
* Copyright (C) 2017 Verge Inc. All rights reserved.
|
||||
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
|
||||
* Author: Anthony Merlino <anthony@vergeaero.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_WIRELESS_IEEE802154_IEEE802154_H
|
||||
#define __INCLUDE_NUTTX_WIRELESS_IEEE802154_IEEE802154_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct ieee802154_packet_s
|
||||
{
|
||||
uint8_t len;
|
||||
uint8_t data[127];
|
||||
uint8_t lqi;
|
||||
uint8_t rssi;
|
||||
};
|
||||
|
||||
/* IEEE 802.15.4 Device address
|
||||
* The addresses in ieee802154 have several formats:
|
||||
* No address : [none]
|
||||
* Short address + PAN id : PPPP/SSSS
|
||||
* Extended address + PAN id : PPPP/LLLLLLLLLLLLLLLL
|
||||
*/
|
||||
|
||||
enum ieee802154_addr_mode_e
|
||||
{
|
||||
IEEE802154_ADDRMODE_NONE = 0,
|
||||
IEEE802154_ADDRMODE_SHORT = 2,
|
||||
IEEE802154_ADDRMODE_EXTENDED
|
||||
};
|
||||
|
||||
struct ieee802154_addr_s
|
||||
{
|
||||
enum ieee802154_addr_mode_e ia_mode; /* Address mode. Short or Extended */
|
||||
uint16_t ia_panid; /* PAN identifier, can be IEEE802154_PAN_UNSPEC */
|
||||
union
|
||||
{
|
||||
uint16_t _ia_saddr; /* short address */
|
||||
uint8_t _ia_eaddr[8]; /* extended address */
|
||||
} ia_addr;
|
||||
|
||||
#define ia_saddr ia_addr._ia_saddr
|
||||
#define ia_eaddr ia_addr._ia_eaddr
|
||||
};
|
||||
|
||||
#define IEEE802154_ADDRSTRLEN 22 /* (2*2+1+8*2, PPPP/EEEEEEEEEEEEEEEE) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_WIRELESS_IEEE802154_IEEE802154_H*/
|
@ -46,7 +46,6 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/wireless/ieee802154/ieee802154.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -123,23 +122,23 @@
|
||||
* Seee IEEE 802.15.4/2011 5.2.1.1 page 57
|
||||
*/
|
||||
|
||||
#define IEEE802154_FRAMECTRL_FTYPE 0x0007 /* Frame type, bits 0-2 */
|
||||
#define IEEE802154_FRAMECTRL_SEC 0x0008 /* Security Enabled, bit 3 */
|
||||
#define IEEE802154_FRAMECTRL_PEND 0x0010 /* Frame pending, bit 4 */
|
||||
#define IEEE802154_FRAMECTRL_ACKREQ 0x0020 /* Acknowledge request, bit 5 */
|
||||
#define IEEE802154_FRAMECTRL_INTRA 0x0040 /* Intra PAN, bit 6 */
|
||||
#define IEEE802154_FRAMECTRL_DADDR 0x0C00 /* Dest addressing mode, bits 10-11 */
|
||||
#define IEEE802154_FRAMECTRL_VERSION 0x3000 /* Source addressing mode, bits 12-13 */
|
||||
#define IEEE802154_FRAMECTRL_SADDR 0xC000 /* Source addressing mode, bits 14-15 */
|
||||
#define IEEE802154_FRAMECTRL_FTYPE 0x0007 /* Frame type, bits 0-2 */
|
||||
#define IEEE802154_FRAMECTRL_SEC 0x0008 /* Security Enabled, bit 3 */
|
||||
#define IEEE802154_FRAMECTRL_PEND 0x0010 /* Frame pending, bit 4 */
|
||||
#define IEEE802154_FRAMECTRL_ACKREQ 0x0020 /* Acknowledge request, bit 5 */
|
||||
#define IEEE802154_FRAMECTRL_PANIDCOMP 0x0040 /* PAN ID Compression, bit 6 */
|
||||
#define IEEE802154_FRAMECTRL_DADDR 0x0C00 /* Dest addressing mode, bits 10-11 */
|
||||
#define IEEE802154_FRAMECTRL_VERSION 0x3000 /* Source addressing mode, bits 12-13 */
|
||||
#define IEEE802154_FRAMECTRL_SADDR 0xC000 /* Source addressing mode, bits 14-15 */
|
||||
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_FTYPE 0 /* Frame type, bits 0-2 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_SEC 3 /* Security Enabled, bit 3 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_PEND 4 /* Frame pending, bit 4 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_ACKREQ 5 /* Acknowledge request, bit 5 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_INTRA 6 /* Intra PAN, bit 6 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_DADDR 10 /* Dest addressing mode, bits 10-11 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_VERSION 12 /* Source addressing mode, bits 12-13 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_SADDR 14 /* Source addressing mode, bits 14-15 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_FTYPE 0 /* Frame type, bits 0-2 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_SEC 3 /* Security Enabled, bit 3 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_PEND 4 /* Frame pending, bit 4 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_ACKREQ 5 /* Acknowledge request, bit 5 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_PANIDCOMP 6 /* PAN ID Compression, bit 6 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_DADDR 10 /* Dest addressing mode, bits 10-11 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_VERSION 12 /* Source addressing mode, bits 12-13 */
|
||||
#define IEEE802154_FRAMECTRL_SHIFT_SADDR 14 /* Source addressing mode, bits 14-15 */
|
||||
|
||||
/* IEEE 802.15.4 PHY constants */
|
||||
|
||||
@ -238,6 +237,87 @@ enum
|
||||
IEEE802154_macSecurityMode
|
||||
};
|
||||
|
||||
/* IEEE 802.15.4 Device address
|
||||
* The addresses in ieee802154 have several formats:
|
||||
* No address : [none]
|
||||
* Short address + PAN id : PPPP/SSSS
|
||||
* Extended address + PAN id : PPPP/LLLLLLLLLLLLLLLL
|
||||
*/
|
||||
|
||||
enum ieee802154_addr_mode_e
|
||||
{
|
||||
IEEE802154_ADDRMODE_NONE = 0,
|
||||
IEEE802154_ADDRMODE_SHORT = 2,
|
||||
IEEE802154_ADDRMODE_EXTENDED
|
||||
};
|
||||
|
||||
struct ieee802154_addr_s
|
||||
{
|
||||
enum ieee802154_addr_mode_e ia_mode; /* Address mode. Short or Extended */
|
||||
uint16_t ia_panid; /* PAN identifier, can be IEEE802154_PAN_UNSPEC */
|
||||
union
|
||||
{
|
||||
uint16_t _ia_saddr; /* short address */
|
||||
uint8_t _ia_eaddr[8]; /* extended address */
|
||||
} ia_addr;
|
||||
|
||||
#define ia_saddr ia_addr._ia_saddr
|
||||
#define ia_eaddr ia_addr._ia_eaddr
|
||||
};
|
||||
|
||||
#define IEEE802154_ADDRSTRLEN 22 /* (2*2+1+8*2, PPPP/EEEEEEEEEEEEEEEE) */
|
||||
|
||||
struct ieee802154_framecontrol_s
|
||||
{
|
||||
/* Frame type
|
||||
*
|
||||
* Should be a value from: ieee802154_frametype_e
|
||||
*
|
||||
* Bits 0-1
|
||||
*/
|
||||
|
||||
uint16_t frame_type : 3;
|
||||
|
||||
uint16_t security_en : 1; /* Security Enabled flag, bit 3 */
|
||||
uint16_t frame_pending : 1; /* Frame Pending flag, bit 4 */
|
||||
uint16_t ack_req : 1; /* Acknowledge Request flag, bit 5 */
|
||||
uint16_t panid_comp : 1; /* PAN ID Compression flag, bit 6 */
|
||||
uint16_t reserved : 3; /* Reserved, bits 7-9 */
|
||||
|
||||
/* Destination Addressing Mode
|
||||
*
|
||||
* Should be a value from: ieee802154_addr_mode_e
|
||||
*
|
||||
* Bits 10-11
|
||||
*/
|
||||
|
||||
uint16_t dest_addr_mode : 2;
|
||||
|
||||
uint16_t frame_version : 2; /* Frame Version, bits 12-13 */
|
||||
|
||||
/* Source Addressing Mode
|
||||
*
|
||||
* Should be a value from: ieee802154_addr_mode_e
|
||||
*
|
||||
* Bits 14-15
|
||||
*/
|
||||
|
||||
uint16_t src_addr_mode : 2;
|
||||
};
|
||||
|
||||
struct ieee802154_frame_s
|
||||
{
|
||||
struct ieee802154_framecontrol_s frame_control;
|
||||
uint8_t seq_num;
|
||||
struct ieee802154_addr_s dest_addr;
|
||||
struct ieee802154_addr_s src_addr;
|
||||
#ifdef CONFIG_IEEE802154_SECURITY
|
||||
struct ieee802154_auxsec_s aux_sec_hdr;
|
||||
#endif
|
||||
void *payload;
|
||||
uint16_t fcs;
|
||||
};
|
||||
|
||||
struct ieee802154_capability_info_s
|
||||
{
|
||||
uint8_t reserved_0 : 1; /* Reserved */
|
||||
@ -679,4 +759,4 @@ FAR struct ieee802154_mac_s *
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_WIRELESS_IEEE802154_MRF24J40_H */
|
||||
#endif /* __INCLUDE_NUTTX_WIRELESS_IEEE802154_IEEE802154_MAC_H */
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <semaphore.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/wireless/ieee802154/ieee802154.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -106,6 +105,14 @@ struct ieee802154_cca_s
|
||||
uint8_t csth; /* Carrier sense threshold for CCA */
|
||||
};
|
||||
|
||||
struct ieee802154_packet_s
|
||||
{
|
||||
uint8_t len;
|
||||
uint8_t data[127];
|
||||
uint8_t lqi;
|
||||
uint8_t rssi;
|
||||
};
|
||||
|
||||
struct ieee802154_radio_s;
|
||||
|
||||
struct ieee802154_radioops_s
|
||||
|
@ -77,7 +77,7 @@ struct ieee802154_privmac_s
|
||||
/* 0x4F */ uint32_t macMinBE : 2;
|
||||
/* 0x4D */ uint32_t macGTSPermit : 1;
|
||||
/* 0x51 */ uint32_t macPromiscuousMode : 1;
|
||||
/* 0x52 */ uint32_t macRxOnWhenIdle : 1;
|
||||
/* 0x52 */ uint32_t macRxOnWhenIdle : 1;
|
||||
uint32_t macPad : 3;
|
||||
/* 0x48 */ uint32_t macBeaconTxTime : 24;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user