A library implementing IEEE 802.15.4 PHY functionality for the MCR20A transceiver. The PHY sublayer provides two services: the PHY data service and the PHY management service interfacing to the PHY sublayer management entity (PLME) service access point (SAP) (known as PLME-SAP). The PHY data service enables the transmission and reception of PHY protocol data units (PSDUs) over the media (radio).

Fork of fsl_phy_mcr20a by Freescale

The Freescale PHY Layer deals with the physical burst which is to be sent and/or received. It performs modulation and demodulation, transmitter and receiver switching, fragmentation, scrambling, interleaving, and error correction coding. The communication to the upper protocol layers is carried out through the Layer 1 Interface.

The PHY Layer is capable of executing the following sequences:

  • I (Idle)
  • R (Receive Sequence conditionally followed by a TxAck)
  • T (Transmit Sequence)
  • C (Standalone CCA)
  • CCCA (Continuous CCA)
  • TR (Transmit/Receive Sequence - transmit unconditionally followed by either an R or RxAck)

In addition to these sequences the PHY Layer also integrates a packet processor which determines whether the packet is MAC-compliant, and if it is, whether it is addressed to the end device. Another feature of the packet processor is Source Address Matching which can be viewed as an extension of packet filtering; however its function is very specific to its intended application (data-polling and indirect queue management by a PAN Coordinator).

Documentation

MCR20A PHY Reference Manual

Committer:
andreikovacs
Date:
Tue Aug 18 12:41:42 2015 +0000
Revision:
0:764779eedf2d
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andreikovacs 0:764779eedf2d 1 /*!
andreikovacs 0:764779eedf2d 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
andreikovacs 0:764779eedf2d 3 * All rights reserved.
andreikovacs 0:764779eedf2d 4 *
andreikovacs 0:764779eedf2d 5 * \file PhyTypes.h
andreikovacs 0:764779eedf2d 6 *
andreikovacs 0:764779eedf2d 7 * Redistribution and use in source and binary forms, with or without modification,
andreikovacs 0:764779eedf2d 8 * are permitted provided that the following conditions are met:
andreikovacs 0:764779eedf2d 9 *
andreikovacs 0:764779eedf2d 10 * o Redistributions of source code must retain the above copyright notice, this list
andreikovacs 0:764779eedf2d 11 * of conditions and the following disclaimer.
andreikovacs 0:764779eedf2d 12 *
andreikovacs 0:764779eedf2d 13 * o Redistributions in binary form must reproduce the above copyright notice, this
andreikovacs 0:764779eedf2d 14 * list of conditions and the following disclaimer in the documentation and/or
andreikovacs 0:764779eedf2d 15 * other materials provided with the distribution.
andreikovacs 0:764779eedf2d 16 *
andreikovacs 0:764779eedf2d 17 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
andreikovacs 0:764779eedf2d 18 * contributors may be used to endorse or promote products derived from this
andreikovacs 0:764779eedf2d 19 * software without specific prior written permission.
andreikovacs 0:764779eedf2d 20 *
andreikovacs 0:764779eedf2d 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
andreikovacs 0:764779eedf2d 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
andreikovacs 0:764779eedf2d 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
andreikovacs 0:764779eedf2d 24 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
andreikovacs 0:764779eedf2d 25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
andreikovacs 0:764779eedf2d 26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
andreikovacs 0:764779eedf2d 27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
andreikovacs 0:764779eedf2d 28 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
andreikovacs 0:764779eedf2d 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
andreikovacs 0:764779eedf2d 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
andreikovacs 0:764779eedf2d 31 */
andreikovacs 0:764779eedf2d 32
andreikovacs 0:764779eedf2d 33 #ifndef _PHY_TYPES_H
andreikovacs 0:764779eedf2d 34 #define _PHY_TYPES_H
andreikovacs 0:764779eedf2d 35
andreikovacs 0:764779eedf2d 36
andreikovacs 0:764779eedf2d 37 /************************************************************************************
andreikovacs 0:764779eedf2d 38 *************************************************************************************
andreikovacs 0:764779eedf2d 39 * Include
andreikovacs 0:764779eedf2d 40 *************************************************************************************
andreikovacs 0:764779eedf2d 41 ************************************************************************************/
andreikovacs 0:764779eedf2d 42
andreikovacs 0:764779eedf2d 43 /************************************************************************************
andreikovacs 0:764779eedf2d 44 *************************************************************************************
andreikovacs 0:764779eedf2d 45 * Public macros
andreikovacs 0:764779eedf2d 46 *************************************************************************************
andreikovacs 0:764779eedf2d 47 ************************************************************************************/
andreikovacs 0:764779eedf2d 48
andreikovacs 0:764779eedf2d 49 /* WARNING!!! Only one frequency can be declared at a time! */
andreikovacs 0:764779eedf2d 50 #ifdef gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 51 #ifndef gFreqBand_470__510MHz_d
andreikovacs 0:764779eedf2d 52 #define gFreqBand_470__510MHz_d 0
andreikovacs 0:764779eedf2d 53 #endif
andreikovacs 0:764779eedf2d 54
andreikovacs 0:764779eedf2d 55 #ifndef gFreqBand_779__787MHz_d
andreikovacs 0:764779eedf2d 56 #define gFreqBand_779__787MHz_d 0
andreikovacs 0:764779eedf2d 57 #endif
andreikovacs 0:764779eedf2d 58
andreikovacs 0:764779eedf2d 59 #ifndef gFreqBand_863__870MHz_d
andreikovacs 0:764779eedf2d 60 #define gFreqBand_863__870MHz_d 0
andreikovacs 0:764779eedf2d 61 #endif
andreikovacs 0:764779eedf2d 62
andreikovacs 0:764779eedf2d 63 #ifndef gFreqBand_902__928MHz_d
andreikovacs 0:764779eedf2d 64 #define gFreqBand_902__928MHz_d 0
andreikovacs 0:764779eedf2d 65 #endif
andreikovacs 0:764779eedf2d 66
andreikovacs 0:764779eedf2d 67 #ifndef gFreqBand_920__928MHz_d
andreikovacs 0:764779eedf2d 68 #define gFreqBand_920__928MHz_d 1
andreikovacs 0:764779eedf2d 69 #endif
andreikovacs 0:764779eedf2d 70
andreikovacs 0:764779eedf2d 71 #ifndef gFreqBand_863__876MHz_d
andreikovacs 0:764779eedf2d 72 #define gFreqBand_863__876MHz_d 0
andreikovacs 0:764779eedf2d 73 #endif
andreikovacs 0:764779eedf2d 74
andreikovacs 0:764779eedf2d 75 #ifndef gFreqBand_915__921MHz_d
andreikovacs 0:764779eedf2d 76 #define gFreqBand_915__921MHz_d 0
andreikovacs 0:764779eedf2d 77 #endif
andreikovacs 0:764779eedf2d 78
andreikovacs 0:764779eedf2d 79 #if gFreqBand_470__510MHz_d
andreikovacs 0:764779eedf2d 80 #define gFreqBandId_d gFreq470__510MHz_c
andreikovacs 0:764779eedf2d 81
andreikovacs 0:764779eedf2d 82 #elif gFreqBand_779__787MHz_d
andreikovacs 0:764779eedf2d 83 #define gFreqBandId_d gFreq779__787MHz_c
andreikovacs 0:764779eedf2d 84
andreikovacs 0:764779eedf2d 85 #elif gFreqBand_863__870MHz_d
andreikovacs 0:764779eedf2d 86 #define gFreqBandId_d gFreq863__870MHz_c
andreikovacs 0:764779eedf2d 87
andreikovacs 0:764779eedf2d 88 #elif gFreqBand_902__928MHz_d
andreikovacs 0:764779eedf2d 89 #define gFreqBandId_d gFreq902__928MHz_c
andreikovacs 0:764779eedf2d 90
andreikovacs 0:764779eedf2d 91 #elif gFreqBand_920__928MHz_d
andreikovacs 0:764779eedf2d 92 #define gFreqBandId_d gFreq920__928MHz_c
andreikovacs 0:764779eedf2d 93
andreikovacs 0:764779eedf2d 94 #elif gFreqBand_863__876MHz_d
andreikovacs 0:764779eedf2d 95 #define gFreqBandId_d gFreq863__876MHz_c
andreikovacs 0:764779eedf2d 96
andreikovacs 0:764779eedf2d 97 #elif gFreqBand_915__921MHz_d
andreikovacs 0:764779eedf2d 98 #define gFreqBandId_d gFreq915__921MHz_c
andreikovacs 0:764779eedf2d 99
andreikovacs 0:764779eedf2d 100 #else
andreikovacs 0:764779eedf2d 101 #error "No frequency band declared!!!"
andreikovacs 0:764779eedf2d 102 #endif
andreikovacs 0:764779eedf2d 103 #endif // gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 104
andreikovacs 0:764779eedf2d 105 /// \note MUST REMAIN UNCHANGED:
andreikovacs 0:764779eedf2d 106 #ifdef gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 107 #define gPhySymbolsPerOctet_c 8
andreikovacs 0:764779eedf2d 108 #define gPhyMRFSKPHRLength_c 2 /* [bytes] */
andreikovacs 0:764779eedf2d 109 #if (gFreqBand_863__876MHz_d || gFreqBand_915__921MHz_d)
andreikovacs 0:764779eedf2d 110 #define gPhyFSKPreambleLength_c 8 /* [bytes] */
andreikovacs 0:764779eedf2d 111 #else
andreikovacs 0:764779eedf2d 112 #define gPhyFSKPreambleLength_c 16 /* [bytes] */
andreikovacs 0:764779eedf2d 113 #endif
andreikovacs 0:764779eedf2d 114 #define gPhyMRFSKSFDLength_c 2 /* [bytes] */
andreikovacs 0:764779eedf2d 115 #define gMinPHYPacketSize_c 5
andreikovacs 0:764779eedf2d 116 #define gMaxPHYPacketSize_c 254 /* maximum number of bytes that the PHY can transmit or receive */
andreikovacs 0:764779eedf2d 117 #define gPhyFCSSize_c 2 /* [bytes] */
andreikovacs 0:764779eedf2d 118 #define gCCADurationDefault_c 13 /* [symbols] */
andreikovacs 0:764779eedf2d 119 #define gPhySHRDuration_c (gPhySymbolsPerOctet_c * (gPhyFSKPreambleLength_c + gPhyMRFSKSFDLength_c)) /* [symbols] */
andreikovacs 0:764779eedf2d 120 #define gPhyMaxFrameDuration_c (gPhySHRDuration_c + (gPhyMRFSKPHRLength_c + gMaxPHYPacketSize_c) * gPhySymbolsPerOctet_c) /* [symbols] 802.15.4g page 48 formula */
andreikovacs 0:764779eedf2d 121 #else
andreikovacs 0:764779eedf2d 122 #define gCCATime_c 8 /* [symbols] */
andreikovacs 0:764779eedf2d 123 #define gPhyTurnaroundTime_c 12 /* [symbols] RX-to-TX or TX-to-RX maximum turnaround time (in symbol periods)*/
andreikovacs 0:764779eedf2d 124 #define gMinPHYPacketSize_c 5
andreikovacs 0:764779eedf2d 125 #define gMaxPHYPacketSize_c (127) /* maximum number of bytes that the PHY can transmit or receive */
andreikovacs 0:764779eedf2d 126 #define gPhySHRDuration_c (10) /* [symbols] */
andreikovacs 0:764779eedf2d 127 #define gPhySymbolsPerOctet_c (2)
andreikovacs 0:764779eedf2d 128 #define gPhyFCSSize_c (2) /* [bytes] */
andreikovacs 0:764779eedf2d 129 #define gPhyMaxFrameDuration_c (gPhySHRDuration_c + (gMaxPHYPacketSize_c + 1) * gPhySymbolsPerOctet_c)
andreikovacs 0:764779eedf2d 130 #define gUnitBackoffPeriod_c 20 /* [symbols] */
andreikovacs 0:764779eedf2d 131 #endif // gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 132
andreikovacs 0:764779eedf2d 133 // Phy flags
andreikovacs 0:764779eedf2d 134 #define gPhyFlagRxOnWhenIdle_c (1 << 0)
andreikovacs 0:764779eedf2d 135 #define gPhyFlagFramePending_c (1 << 1)
andreikovacs 0:764779eedf2d 136 #define gPhyFlagIdleRx_c (1 << 2)
andreikovacs 0:764779eedf2d 137 #define gPhyFlagDeferTx_c (1 << 3)
andreikovacs 0:764779eedf2d 138
andreikovacs 0:764779eedf2d 139 #ifdef gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 140 #ifndef gAfcRxTimeout_c
andreikovacs 0:764779eedf2d 141 #define gAfcRxTimeout_c gPhySHRDuration_c /* [symbols] */
andreikovacs 0:764779eedf2d 142 #endif
andreikovacs 0:764779eedf2d 143 #endif
andreikovacs 0:764779eedf2d 144
andreikovacs 0:764779eedf2d 145 /************************************************************************************
andreikovacs 0:764779eedf2d 146 *************************************************************************************
andreikovacs 0:764779eedf2d 147 * Public prototypes
andreikovacs 0:764779eedf2d 148 *************************************************************************************
andreikovacs 0:764779eedf2d 149 ************************************************************************************/
andreikovacs 0:764779eedf2d 150
andreikovacs 0:764779eedf2d 151 /************************************************************************************
andreikovacs 0:764779eedf2d 152 *************************************************************************************
andreikovacs 0:764779eedf2d 153 * Public type definitions
andreikovacs 0:764779eedf2d 154 *************************************************************************************
andreikovacs 0:764779eedf2d 155 ************************************************************************************/
andreikovacs 0:764779eedf2d 156 typedef enum
andreikovacs 0:764779eedf2d 157 {
andreikovacs 0:764779eedf2d 158 gPhyChannelBusy_c = 0x00, /*The CCA attempt has detected a busy channel.*/
andreikovacs 0:764779eedf2d 159 gPhyBusyRx_c = 0x01, /*The transceiver is asked to change its state while receiving.*/
andreikovacs 0:764779eedf2d 160 gPhyBusyTx_c = 0x02, /*The transceiver is asked to change its state while transmitting.*/
andreikovacs 0:764779eedf2d 161 gPhyChannelIdle_c = 0x04, /*The CCA attempt has detected an idle channel.*/
andreikovacs 0:764779eedf2d 162 gPhyInvalidParameter_c = 0x05, /*A SET request was issued with a parameter in the primitive that is out of the valid range.*/
andreikovacs 0:764779eedf2d 163 gPhyRxOn_c = 0x06, /*The transceiver is in the receiver enabled state.*/
andreikovacs 0:764779eedf2d 164 gPhySuccess_c = 0x07, /*A SET/GET, an ED operation, a data request, an indirect queue insert, or a transceiver state change was successful.*/
andreikovacs 0:764779eedf2d 165 gPhyTRxOff_c = 0x08, /*The transceiver is in the transceiver disabled state.*/
andreikovacs 0:764779eedf2d 166 gPhyTxOn_c = 0x09, /*The transceiver is in the transmitter enabled state.*/
andreikovacs 0:764779eedf2d 167 gPhyUnsupportedAttribute_c = 0x0a, /*A SET/GET request was issued with the identifier of an attribute that is not supported.*/
andreikovacs 0:764779eedf2d 168 gPhyReadOnly_c = 0x0b, /*A SET request was issued with the identifier of an attribute that is read-only.*/
andreikovacs 0:764779eedf2d 169 gPhyIndexUsed_c = 0x11, /*The indirect queue insert operation has detected an used index.*/
andreikovacs 0:764779eedf2d 170 gPhyNoAck_c = 0x14, /*No ACK was received for the last transmission.*/
andreikovacs 0:764779eedf2d 171 gPhyFramePending_c = 0x15, /*The ACK of a Data Request frame indicates a pending frame in the coordinator�s indirect TX queue.*/
andreikovacs 0:764779eedf2d 172 gPhyBusy_c = 0xF1, //
andreikovacs 0:764779eedf2d 173 gPhyInvalidPrimitive_c = 0xF2 //
andreikovacs 0:764779eedf2d 174 }phyStatus_t;
andreikovacs 0:764779eedf2d 175
andreikovacs 0:764779eedf2d 176 typedef enum
andreikovacs 0:764779eedf2d 177 {
andreikovacs 0:764779eedf2d 178 gPhySlottedMode_c = 0x0c,
andreikovacs 0:764779eedf2d 179 gPhyUnslottedMode_c = 0x0d
andreikovacs 0:764779eedf2d 180 }phySlottedMode_t;
andreikovacs 0:764779eedf2d 181
andreikovacs 0:764779eedf2d 182 typedef enum
andreikovacs 0:764779eedf2d 183 {
andreikovacs 0:764779eedf2d 184 gPhyEnergyDetectMode_c = 0x00,
andreikovacs 0:764779eedf2d 185 gPhyCCAMode1_c = 0x01,
andreikovacs 0:764779eedf2d 186 gPhyCCAMode2_c = 0x02,
andreikovacs 0:764779eedf2d 187 gPhyCCAMode3_c = 0x03,
andreikovacs 0:764779eedf2d 188 gPhyNoCCABeforeTx_c = 0x04
andreikovacs 0:764779eedf2d 189 }phyCCAType_t;
andreikovacs 0:764779eedf2d 190
andreikovacs 0:764779eedf2d 191 typedef enum
andreikovacs 0:764779eedf2d 192 {
andreikovacs 0:764779eedf2d 193 gPhyContCcaEnabled = 0x00,
andreikovacs 0:764779eedf2d 194 gPhyContCcaDisabled
andreikovacs 0:764779eedf2d 195 }phyContCCAMode_t;
andreikovacs 0:764779eedf2d 196
andreikovacs 0:764779eedf2d 197 typedef enum
andreikovacs 0:764779eedf2d 198 {
andreikovacs 0:764779eedf2d 199 gPhyForceTRxOff_c = 0x03, /*The transceiver is to be switched off immediately.*/
andreikovacs 0:764779eedf2d 200 gPhySetRxOn_c = 0x12, /*The transceiver is to be configured into the receiver enabled state.*/
andreikovacs 0:764779eedf2d 201 gPhySetTRxOff_c = 0x13, /*The transceiver is to be configured into the transceiver disabled state.*/
andreikovacs 0:764779eedf2d 202 }phyState_t;
andreikovacs 0:764779eedf2d 203
andreikovacs 0:764779eedf2d 204 typedef enum
andreikovacs 0:764779eedf2d 205 {
andreikovacs 0:764779eedf2d 206 gPhyRxAckRqd_c = 0x00, /*A receive Ack frame is expected to follow the transmit frame (non-Ack frames are rejected)*/
andreikovacs 0:764779eedf2d 207 gPhyNoAckRqd_c = 0x01, /*An ordinary receive frame (any type of frame) follows the transmit frame*/
andreikovacs 0:764779eedf2d 208 #ifdef gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 209 gPhyEnhancedAckReq = 0x02
andreikovacs 0:764779eedf2d 210 #endif // gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 211 }phyAckRequired_t;
andreikovacs 0:764779eedf2d 212
andreikovacs 0:764779eedf2d 213 typedef enum
andreikovacs 0:764779eedf2d 214 {
andreikovacs 0:764779eedf2d 215 gPhyPibCurrentChannel_c = 0x00, /*The channel currently used.*/
andreikovacs 0:764779eedf2d 216 gPhyPibCurrentPage_c = 0x01, /*The channel page currently used.*/
andreikovacs 0:764779eedf2d 217 gPhyPibTransmitPower_c = 0x02, /*The power used for TX operations.*/
andreikovacs 0:764779eedf2d 218 gPhyPibLongAddress_c = 0x03, /*The MAC long address to be used by the PHY�s source address matching feature.*/
andreikovacs 0:764779eedf2d 219 gPhyPibShortAddress_c = 0x04, /*The MAC short address to be used by the PHY�s source address matching feature.*/
andreikovacs 0:764779eedf2d 220 gPhyPibPanId_c = 0x05, /*The MAC PAN ID to be used by the PHY�s source address matching feature.*/
andreikovacs 0:764779eedf2d 221 gPhyPibPanCoordinator_c = 0x06, /*Indicates if the device is a PAN coordinator or not.*/
andreikovacs 0:764779eedf2d 222 gPhyPibSrcAddrEnable_c = 0x07, /*Enables or disables the PHY�s source address matching feature.*/
andreikovacs 0:764779eedf2d 223 gPhyPibPromiscuousMode_c = 0x08, /*Selects between normal, promiscuous and active promiscuous mode.*/
andreikovacs 0:764779eedf2d 224 gPhyPibAutoAckEnable_c = 0x09, /*Enables or disables automatic transmission of ACK frames.*/
andreikovacs 0:764779eedf2d 225 gPhyPibFrameVersion_c = 0x0A, /*Used in checking for allowed frame versions (0x00 - any version accepted, 0x01 - accept Frame Version 0 packets (2003 compliant), 0x02 - accept Frame Version 1 packets (2006 compliant), 0x03 - accept Frame Version 0 and 1 packets).*/
andreikovacs 0:764779eedf2d 226 gPhyPibFrameEnable_c = 0x0B, /*Used for enabling or disabling reception of MAC frames.*/
andreikovacs 0:764779eedf2d 227 gPhyPibAckFramePending_c = 0x0C, /*Used to copy its contents to the outgoing ACK frame's Frame Pending field as a response to a received Data Request frame with Source Address Matching disabled.*/
andreikovacs 0:764779eedf2d 228 gPhyPibRxOnWhenIdle = 0x0D, /*Enable RX when the radio is IDLE*/
andreikovacs 0:764779eedf2d 229 gPhyPibFrameWaitTime_c = 0x0E, /*The number of symbols the Rx should be on after receiving an ACK with FP=1 */
andreikovacs 0:764779eedf2d 230 gPhyPibDeferTxIfRxBusy_c = 0x0F,
andreikovacs 0:764779eedf2d 231 #ifdef gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 232 gPhyPibPhyModeSupported_c = 0x10,
andreikovacs 0:764779eedf2d 233 gPhyPibCurrentMode_c = 0x11,
andreikovacs 0:764779eedf2d 234 gPhyPibFSKPreambleRepetitions_c = 0x12,
andreikovacs 0:764779eedf2d 235 gPhyPibFSKScramblePSDU_c = 0x13,
andreikovacs 0:764779eedf2d 236 gPhyPibCCADuration_c = 0x14,
andreikovacs 0:764779eedf2d 237 gPhyPibCSLRxEnabled_c = 0x15,
andreikovacs 0:764779eedf2d 238 gPhyPibCSLTxEnabled_c = 0x16,
andreikovacs 0:764779eedf2d 239 gPhyPibFreqBandId_c = 0x17,
andreikovacs 0:764779eedf2d 240 gPhyPibAckWaitDuration_c = 0x18
andreikovacs 0:764779eedf2d 241 #endif // gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 242 }phyPibId_t;
andreikovacs 0:764779eedf2d 243
andreikovacs 0:764779eedf2d 244 typedef struct phyFlags_tag
andreikovacs 0:764779eedf2d 245 {
andreikovacs 0:764779eedf2d 246 union{
andreikovacs 0:764779eedf2d 247 uint32_t mask;
andreikovacs 0:764779eedf2d 248 struct{
andreikovacs 0:764779eedf2d 249 uint32_t rxOnWhenIdle :1;
andreikovacs 0:764779eedf2d 250 uint32_t rxFramePending :1;
andreikovacs 0:764779eedf2d 251 uint32_t idleRx :1;
andreikovacs 0:764779eedf2d 252 #ifdef gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 253 uint32_t slotted :1;
andreikovacs 0:764779eedf2d 254 uint32_t ccaBfrTX :1;
andreikovacs 0:764779eedf2d 255 uint32_t rxAckRqd :1;
andreikovacs 0:764779eedf2d 256 uint32_t autoAck :1;
andreikovacs 0:764779eedf2d 257 uint32_t panCordntr :1;
andreikovacs 0:764779eedf2d 258 uint32_t promiscuous :1;
andreikovacs 0:764779eedf2d 259 uint32_t activePromiscuous :1;
andreikovacs 0:764779eedf2d 260 uint32_t cslRxEnabled :1;
andreikovacs 0:764779eedf2d 261 uint32_t cslTxEnabled :1;
andreikovacs 0:764779eedf2d 262 uint32_t rxEnhAckRqd :1;
andreikovacs 0:764779eedf2d 263 uint32_t ccaEdScan :1; // set for a CCA or ED request
andreikovacs 0:764779eedf2d 264 uint32_t ccaComplete :1; // set when a CCA period is over
andreikovacs 0:764779eedf2d 265 uint32_t waitTurnaroundComplete :1; // set when a Auto ACK send or receive sequence started
andreikovacs 0:764779eedf2d 266 uint32_t reserved :16;
andreikovacs 0:764779eedf2d 267 #else
andreikovacs 0:764779eedf2d 268 uint32_t phyState :3;
andreikovacs 0:764779eedf2d 269 uint32_t reserved :26;
andreikovacs 0:764779eedf2d 270 #endif // gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 271 };
andreikovacs 0:764779eedf2d 272 };
andreikovacs 0:764779eedf2d 273 }phyFlags_t;
andreikovacs 0:764779eedf2d 274
andreikovacs 0:764779eedf2d 275 #define gInvalidTimerId_c (gMaxPhyTimers_c)
andreikovacs 0:764779eedf2d 276
andreikovacs 0:764779eedf2d 277 #ifdef gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 278 #define gPhyTimeShift_c (16) // 16bit hw timer
andreikovacs 0:764779eedf2d 279 #define gPhyTimeMask_c (0x000000000000FFFF)
andreikovacs 0:764779eedf2d 280 #else
andreikovacs 0:764779eedf2d 281 #define gPhyTimeShift_c (24) // 24bit hw timer
andreikovacs 0:764779eedf2d 282 #define gPhyTimeMask_c (0x00FFFFFF)
andreikovacs 0:764779eedf2d 283 #endif
andreikovacs 0:764779eedf2d 284
andreikovacs 0:764779eedf2d 285 typedef uint8_t phyTimeTimerId_t;
andreikovacs 0:764779eedf2d 286 typedef uint64_t phyTimeTimestamp_t;
andreikovacs 0:764779eedf2d 287
andreikovacs 0:764779eedf2d 288 #ifdef gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 289 typedef uint64_t phyTime_t;
andreikovacs 0:764779eedf2d 290 #else
andreikovacs 0:764779eedf2d 291 typedef uint32_t phyTime_t;
andreikovacs 0:764779eedf2d 292 #endif
andreikovacs 0:764779eedf2d 293
andreikovacs 0:764779eedf2d 294 typedef void (*phyTimeCallback_t) ( uint32_t param );
andreikovacs 0:764779eedf2d 295
andreikovacs 0:764779eedf2d 296 typedef enum
andreikovacs 0:764779eedf2d 297 {
andreikovacs 0:764779eedf2d 298 gPhyTimeOk_c = 0x00,
andreikovacs 0:764779eedf2d 299 gPhyTimeAlreadyPassed_c = 0x01,
andreikovacs 0:764779eedf2d 300 gPhyTimeTooClose_c = 0x02,
andreikovacs 0:764779eedf2d 301 gPhyTimeTooMany_c = 0x03,
andreikovacs 0:764779eedf2d 302 gPhyTimeInvalidParameter_c = 0x04,
andreikovacs 0:764779eedf2d 303 gPhyTimeNotFound_c = 0x05,
andreikovacs 0:764779eedf2d 304 gPhyTimeError_c = 0x06
andreikovacs 0:764779eedf2d 305 }phyTimeStatus_t;
andreikovacs 0:764779eedf2d 306
andreikovacs 0:764779eedf2d 307 #ifdef gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 308 typedef struct phyPHR_tag
andreikovacs 0:764779eedf2d 309 {
andreikovacs 0:764779eedf2d 310 union{
andreikovacs 0:764779eedf2d 311 uint16_t mask;
andreikovacs 0:764779eedf2d 312 uint8_t byteAccess[2];
andreikovacs 0:764779eedf2d 313 struct{
andreikovacs 0:764779eedf2d 314 uint8_t modeSwitch :1;
andreikovacs 0:764779eedf2d 315 uint8_t reserved :2;
andreikovacs 0:764779eedf2d 316 uint8_t fcsType :1;
andreikovacs 0:764779eedf2d 317 uint8_t dataWhitening :1;
andreikovacs 0:764779eedf2d 318 uint8_t frameLengthRsvd :3; // Max psdu 254
andreikovacs 0:764779eedf2d 319 uint8_t frameLength;
andreikovacs 0:764779eedf2d 320 };
andreikovacs 0:764779eedf2d 321 };
andreikovacs 0:764779eedf2d 322 }phyPHR_t;
andreikovacs 0:764779eedf2d 323
andreikovacs 0:764779eedf2d 324 typedef enum{
andreikovacs 0:764779eedf2d 325 gPhyMode1_c = 0x00,
andreikovacs 0:764779eedf2d 326 gPhyMode2_c = 0x01,
andreikovacs 0:764779eedf2d 327 gPhyMode3_c = 0x02,
andreikovacs 0:764779eedf2d 328 gPhyMode4_c = 0x03,
andreikovacs 0:764779eedf2d 329 gPhyMode1ARIB_c = 0x04,
andreikovacs 0:764779eedf2d 330 gPhyMode2ARIB_c = 0x05,
andreikovacs 0:764779eedf2d 331 gPhyMode3ARIB_c = 0x06,
andreikovacs 0:764779eedf2d 332 }phyMode_t;
andreikovacs 0:764779eedf2d 333
andreikovacs 0:764779eedf2d 334 //802.15.4g MAC sub-1GHz frequency bands
andreikovacs 0:764779eedf2d 335 typedef enum{
andreikovacs 0:764779eedf2d 336 gFreq470__510MHz_c = 0x02, // 470-510 (China)
andreikovacs 0:764779eedf2d 337 gFreq779__787MHz_c = 0x03, // 779-787 (China)
andreikovacs 0:764779eedf2d 338 gFreq863__870MHz_c = 0x04, // 863-870 (Europe)
andreikovacs 0:764779eedf2d 339 gFreq902__928MHz_c = 0x07, // 902-928 (U.S.)
andreikovacs 0:764779eedf2d 340 gFreq920__928MHz_c = 0x09, // 920-928 (Japan) - Includes ARIB modes
andreikovacs 0:764779eedf2d 341 gFreq863__876MHz_c = 0x0E, // 863-876 (UK) custom mode
andreikovacs 0:764779eedf2d 342 gFreq915__921MHz_c = 0x0F, // 915-921 (UK) custom mode
andreikovacs 0:764779eedf2d 343 }phyFreqBand_t;
andreikovacs 0:764779eedf2d 344
andreikovacs 0:764779eedf2d 345 #ifndef gPhyModeDefault_d
andreikovacs 0:764779eedf2d 346 #define gPhyModeDefault_d gPhyMode1_c
andreikovacs 0:764779eedf2d 347 #endif
andreikovacs 0:764779eedf2d 348
andreikovacs 0:764779eedf2d 349 #endif // gPHY_802_15_4g_d
andreikovacs 0:764779eedf2d 350
andreikovacs 0:764779eedf2d 351 /************************************************************************************
andreikovacs 0:764779eedf2d 352 *************************************************************************************
andreikovacs 0:764779eedf2d 353 * Public memory declarations
andreikovacs 0:764779eedf2d 354 *************************************************************************************
andreikovacs 0:764779eedf2d 355 ************************************************************************************/
andreikovacs 0:764779eedf2d 356
andreikovacs 0:764779eedf2d 357 /************************************************************************************
andreikovacs 0:764779eedf2d 358 *************************************************************************************
andreikovacs 0:764779eedf2d 359 * Public functions
andreikovacs 0:764779eedf2d 360 *************************************************************************************
andreikovacs 0:764779eedf2d 361 ************************************************************************************/
andreikovacs 0:764779eedf2d 362
andreikovacs 0:764779eedf2d 363 #endif /* _PHY_TYPES_H */