Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of fsl_phy_mcr20a by
MpmInterface.h
00001 /*! 00002 * Copyright (c) 2015, Freescale Semiconductor, Inc. 00003 * All rights reserved. 00004 * 00005 * \file MpmInterface.h 00006 * This is a header file for the Multiple PAN Manager. 00007 * 00008 * Redistribution and use in source and binary forms, with or without modification, 00009 * are permitted provided that the following conditions are met: 00010 * 00011 * o Redistributions of source code must retain the above copyright notice, this list 00012 * of conditions and the following disclaimer. 00013 * 00014 * o Redistributions in binary form must reproduce the above copyright notice, this 00015 * list of conditions and the following disclaimer in the documentation and/or 00016 * other materials provided with the distribution. 00017 * 00018 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its 00019 * contributors may be used to endorse or promote products derived from this 00020 * software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00023 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00024 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00025 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00026 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00027 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00029 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00031 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 */ 00033 00034 #ifndef __MPM_H__ 00035 #define __MPM_H__ 00036 00037 /************************************************************************************ 00038 ************************************************************************************* 00039 * Include 00040 ************************************************************************************* 00041 ************************************************************************************/ 00042 00043 #include "EmbeddedTypes.h " 00044 //#include "fsl_os_abstraction.h" 00045 #include "PhyInterface.h " 00046 00047 /************************************************************************************ 00048 ************************************************************************************* 00049 * Public macros 00050 ************************************************************************************* 00051 ************************************************************************************/ 00052 00053 /* The maximun number of MAC instances that can be registered. 00054 * If set to 0, the MPM is disabled! 00055 */ 00056 #if !defined(gMpmMaxPANs_c) 00057 #define gMpmMaxPANs_c 1 00058 #endif 00059 00060 #define gMpmIncluded_d (gMpmMaxPANs_c > 1) 00061 00062 #define gMpmPhyPanRegSets_c (2) 00063 #define gMpmUseDifferentTxPwrLevel_c (0) 00064 #define gMpmAcquireIsBlocking_d (0) 00065 #define gMpmInvalidRegSet_c (gMpmPhyPanRegSets_c) 00066 00067 /* Dual Pan Dwell settings 00068 +-----------------+---------------------+ 00069 | PRESCALER | RANGE | 00070 | bits [1:0] | bits [7:2] | 00071 +------+----------+---------------------+ 00072 |value | timebase | min - max | 00073 +------+----------+---------------------+ 00074 | 00 | 0.5 ms | 0.5 - 32 ms | 00075 | 01 | 2.5 ms | 2.5 - 160 ms | 00076 | 10 | 10 ms | 10 - 640 ms | 00077 | 11 | 50 ms | 50 - 3.2 seconds | 00078 +------+----------+---------------------+ 00079 */ 00080 00081 /* Dwell Time prescaller (0 to 3) */ 00082 #define mDefaultDualPanDwellPrescaller_c (0x00) // 0,5 ms 00083 #define mDualPanDwellPrescallerMask_c (0x03) 00084 #define mDualPanDwellPrescallerShift_c (0) 00085 00086 /* Dwell Time value (0 to 63) */ 00087 #define mDefaultDualPanDwellTime_c (0x06) 00088 #define mDualPanDwellTimeMask_c (0xFC) 00089 #define mDualPanDwellTimeShift_c (2) 00090 00091 00092 #if (gMpmMaxPANs_c > gMpmPhyPanRegSets_c) 00093 #error The number of PANs exceeds the number of HW registry sets! This feature is not supported yet. 00094 #endif 00095 00096 /* MPM flags */ 00097 #define gMpmFlagPanCoord_c (1 << 0) 00098 #define gMpmFlagPromiscuous_c (1 << 1) 00099 #define gMpmFlagRxOnWhenIdle_c (1 << 2) 00100 00101 /************************************************************************************ 00102 ************************************************************************************* 00103 * Public type definitions 00104 ************************************************************************************* 00105 ************************************************************************************/ 00106 00107 typedef PACKED_STRUCT mpmConfig_tag{ 00108 bool_t autoMode; 00109 uint8_t dwellTime; 00110 uint8_t activeMAC; 00111 }mpmConfig_t; 00112 00113 typedef union panFlags_tag{ 00114 uint16_t all; 00115 struct{ 00116 uint16_t panCoordinator: 1; 00117 uint16_t promiscuous: 1; 00118 uint16_t rxOnWhenIdle: 1; 00119 uint16_t reserved: 13; 00120 }; 00121 }panFlags_t; 00122 00123 typedef struct panInfo_tag{ 00124 uint8_t flags; 00125 uint8_t macInstance; 00126 uint8_t phyRegSet; 00127 int8_t locked; 00128 #if (gMpmMaxPANs_c > gMpmPhyPanRegSets_c) 00129 uint64_t longAddr; 00130 uint16_t shortAddr; 00131 uint16_t panId; 00132 uint8_t channel; 00133 #endif 00134 #if gMpmUseDifferentTxPwrLevel_c 00135 uint8_t pwrLevel; 00136 #endif 00137 }panInfo_t; 00138 00139 #ifdef __cplusplus 00140 extern "C" { 00141 #endif 00142 00143 /************************************************************************************ 00144 ************************************************************************************* 00145 * Public memory declarations 00146 ************************************************************************************* 00147 ************************************************************************************/ 00148 00149 /************************************************************************************ 00150 ************************************************************************************* 00151 * Public functions 00152 ************************************************************************************* 00153 ************************************************************************************/ 00154 #if gMpmIncluded_d 00155 00156 void MPM_Init( void ); 00157 void MPM_SetConfig( mpmConfig_t *pCfg ); 00158 void MPM_GetConfig( mpmConfig_t *pCfg ); 00159 00160 int32_t MPM_GetPanIndex( instanceId_t macInstance ); 00161 uint32_t MPM_GetRegSet(uint8_t panIdx); 00162 uint32_t MPM_GetMacInstanceFromRegSet(uint32_t regSet); 00163 #define MPM_isPanActive( panIdx ) (MPM_GetRegSet(panIdx) != gMpmInvalidRegSet_c) 00164 00165 phyStatus_t MPM_PrepareForTx( instanceId_t macInstance ); 00166 phyStatus_t MPM_PrepareForRx( instanceId_t macInstance ); 00167 phyStatus_t MPM_GetPIB(phyPibId_t pibId, void *pValue, uint8_t panIdx); 00168 phyStatus_t MPM_SetPIB(phyPibId_t pibId, void *pValue, uint8_t panIdx); 00169 00170 #else /* #if gMpmIncluded_d */ 00171 00172 #define MPM_Init() 00173 #define MPM_SetConfig( prescaller, dwellTime ) 00174 00175 #define MPM_GetPanIndex( macInstance ) 0 00176 #define MPM_GetRegSet( panIdx ) 0 00177 #define MPM_GetMacInstanceFromRegSet( regSet ) 0 00178 #define MPM_isPanActive( panIdx ) 1 00179 00180 #define MPM_PrepareForTx( macInstance ) gPhySuccess_c 00181 #define MPM_PrepareForRx( macInstance ) gPhySuccess_c 00182 #define MPM_GetPIB( pibId, pibValue, panIdx ) gPhySuccess_c 00183 #define MPM_SetPIB( pibId, pibValue, panIdx ) gPhySuccess_c 00184 00185 #endif /* #if gMpmIncluded_d */ 00186 00187 phyStatus_t MPM_AcquirePAN( instanceId_t macInstance ); 00188 phyStatus_t MPM_ReleasePAN( instanceId_t macInstance ); 00189 00190 #ifdef __cplusplus 00191 } 00192 #endif 00193 00194 #endif /*__MPM_H__ */
Generated on Fri Jul 15 2022 21:41:17 by
