sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
ieee802154.h
Go to the documentation of this file.
1
6
7/*
8 * Copyright (c) 2018 Simon Goldschmidt.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * 3. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31 * OF SUCH DAMAGE.
32 *
33 * This file is part of the lwIP TCP/IP stack.
34 *
35 * Author: Simon Goldschmidt <goldsimon@gmx.de>
36 *
37 */
38#ifndef LWIP_HDR_NETIF_IEEE802154_H
39#define LWIP_HDR_NETIF_IEEE802154_H
40
41#include "lwip/opt.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47#ifdef PACK_STRUCT_USE_INCLUDES
48# include "arch/bpstruct.h"
49#endif
50PACK_STRUCT_BEGIN
57 PACK_STRUCT_FIELD(u16_t frame_control);
59 PACK_STRUCT_FLD_8(u8_t sequence_number);
61 PACK_STRUCT_FIELD(u16_t destination_pan_id);
63 PACK_STRUCT_FLD_8(u8_t destination_address[8]);
66 PACK_STRUCT_FIELD(u16_t source_pan_id);
68 PACK_STRUCT_FLD_8(u8_t source_address[8]);
69 /* The rest is variable */
70} PACK_STRUCT_STRUCT;
71PACK_STRUCT_END
72#ifdef PACK_STRUCT_USE_INCLUDES
73# include "arch/epstruct.h"
74#endif
75
76/* Addressing modes (2 bits) */
77#define IEEE_802154_ADDR_MODE_NO_ADDR 0x00 /* PAN ID and address fields are not present */
78#define IEEE_802154_ADDR_MODE_RESERVED 0x01 /* Reserved */
79#define IEEE_802154_ADDR_MODE_SHORT 0x02 /* Address field contains a short address (16 bit) */
80#define IEEE_802154_ADDR_MODE_EXT 0x03 /* Address field contains an extended address (64 bit) */
81
82/* IEEE 802.15.4 Frame Control definitions (2 bytes; see IEEE 802.15.4-2015 ch. 7.2.1) */
83#define IEEE_802154_FC_FT_MASK 0x0007 /* bits 0..2: Frame Type */
84#define IEEE_802154_FC_FT_BEACON 0x00
85#define IEEE_802154_FC_FT_DATA 0x01
86#define IEEE_802154_FC_FT_ACK 0x02
87#define IEEE_802154_FC_FT_MAC_CMD 0x03
88#define IEEE_802154_FC_FT_RESERVED 0x04
89#define IEEE_802154_FC_FT_MULTIPURPOSE 0x05
90#define IEEE_802154_FC_FT_FRAG 0x06
91#define IEEE_802154_FC_FT_EXT 0x07
92#define IEEE_802154_FC_SEC_EN 0x0008 /* bit 3: Security Enabled */
93#define IEEE_802154_FC_FRAME_PEND 0x0010 /* bit 4: Frame Pending */
94#define IEEE_802154_FC_ACK_REQ 0x0020 /* bit 5: AR (ACK required) */
95#define IEEE_802154_FC_PANID_COMPR 0x0040 /* bit 6: PAN ID Compression (src and dst are equal, src PAN ID omitted) */
96#define IEEE_802154_FC_RESERVED 0x0080
97#define IEEE_802154_FC_SEQNO_SUPPR 0x0100 /* bit 8: Sequence Number Suppression */
98#define IEEE_802154_FC_IE_PRESENT 0x0200 /* bit 9: IE Present */
99#define IEEE_802154_FC_DST_ADDR_MODE_MASK 0x0c00 /* bits 10..11: Destination Addressing Mode */
100#define IEEE_802154_FC_DST_ADDR_MODE_NO_ADDR (IEEE_802154_ADDR_MODE_NO_ADDR << 10)
101#define IEEE_802154_FC_DST_ADDR_MODE_SHORT (IEEE_802154_ADDR_MODE_SHORT << 10)
102#define IEEE_802154_FC_DST_ADDR_MODE_EXT (IEEE_802154_ADDR_MODE_EXT << 10)
103#define IEEE_802154_FC_FRAME_VERSION_MASK 0x3000 /* bits 12..13: Frame Version */
104#define IEEE_802154_FC_FRAME_VERSION_GET(x) (((x) & IEEE_802154_FC_FRAME_VERSION_MASK) >> 12)
105#define IEEE_802154_FC_SRC_ADDR_MODE_MASK 0xc000 /* bits 14..15: Source Addressing Mode */
106#define IEEE_802154_FC_SRC_ADDR_MODE_SHORT (IEEE_802154_ADDR_MODE_SHORT << 14)
107#define IEEE_802154_FC_SRC_ADDR_MODE_EXT (IEEE_802154_ADDR_MODE_EXT << 14)
108
109#ifdef __cplusplus
110}
111#endif
112
113#endif /* LWIP_HDR_NETIF_IEEE802154_H */
PACK_STRUCT_FLD_8(u8_t source_address[8])
PACK_STRUCT_FLD_8(u8_t sequence_number)
PACK_STRUCT_FIELD(u16_t frame_control)
PACK_STRUCT_FIELD(u16_t destination_pan_id)
PACK_STRUCT_FIELD(u16_t source_pan_id)
PACK_STRUCT_FLD_8(u8_t destination_address[8])