NXP / fsl_phy_mcr20a

Fork of fsl_phy_mcr20a by Freescale

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AspInterface.h Source File

AspInterface.h

00001 /*!
00002 * Copyright (c) 2015, Freescale Semiconductor, Inc.
00003 * All rights reserved.
00004 *
00005 * \file ASP.h
00006 * This is a header file for the ASP module.
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 __ASP_H__
00035 #define __ASP_H__
00036 
00037 /************************************************************************************
00038 *************************************************************************************
00039 * Include
00040 *************************************************************************************
00041 ************************************************************************************/
00042 
00043 #include "EmbeddedTypes.h "
00044 //#include "fsl_os_abstraction.h"
00045 #include "PhyInterface.h "
00046 #include "MpmInterface.h "
00047 
00048 /************************************************************************************
00049 *************************************************************************************
00050 * Public macros
00051 *************************************************************************************
00052 ************************************************************************************/
00053 /* Enable/Disable the ASP module */
00054 #ifndef gAspCapability_d
00055 #ifndef gPHY_802_15_4g_d
00056 #define gAspCapability_d (1)
00057 #else
00058 #define gAspCapability_d (0)
00059 #endif // gPHY_802_15_4g_d
00060 #endif // gAspCapability_d
00061 
00062 #define gAspInterfaceId (0)
00063 
00064 /* Allowed ASP Power Levels */
00065 #define gAspPowerLevel_m40dBm_c (uint8_t)gAspPowerLevel_m40dBm
00066 #define gAspPowerLevel_m38dBm_c (uint8_t)gAspPowerLevel_m38dBm
00067 #define gAspPowerLevel_m36dBm_c (uint8_t)gAspPowerLevel_m36dBm
00068 #define gAspPowerLevel_m34dBm_c (uint8_t)gAspPowerLevel_m34dBm
00069 #define gAspPowerLevel_m32dBm_c (uint8_t)gAspPowerLevel_m32dBm
00070 #define gAspPowerLevel_m30dBm_c (uint8_t)gAspPowerLevel_m30dBm
00071 #define gAspPowerLevel_m28dBm_c (uint8_t)gAspPowerLevel_m28dBm
00072 #define gAspPowerLevel_m26dBm_c (uint8_t)gAspPowerLevel_m26dBm
00073 #define gAspPowerLevel_m24dBm_c (uint8_t)gAspPowerLevel_m24dBm
00074 #define gAspPowerLevel_m22dBm_c (uint8_t)gAspPowerLevel_m22dBm
00075 #define gAspPowerLevel_m20dBm_c (uint8_t)gAspPowerLevel_m20dBm
00076 #define gAspPowerLevel_m18dBm_c (uint8_t)gAspPowerLevel_m18dBm
00077 #define gAspPowerLevel_m16dBm_c (uint8_t)gAspPowerLevel_m16dBm
00078 #define gAspPowerLevel_m14dBm_c (uint8_t)gAspPowerLevel_m14dBm
00079 #define gAspPowerLevel_m12dBm_c (uint8_t)gAspPowerLevel_m12dBm
00080 #define gAspPowerLevel_m10dBm_c (uint8_t)gAspPowerLevel_m10dBm
00081 #define gAspPowerLevel_m8dBm_c  (uint8_t)gAspPowerLevel_m8dBm
00082 #define gAspPowerLevel_m6dBm_c  (uint8_t)gAspPowerLevel_m6dBm
00083 #define gAspPowerLevel_m4dBm_c  (uint8_t)gAspPowerLevel_m4dBm
00084 #define gAspPowerLevel_m2dBm_c  (uint8_t)gAspPowerLevel_m2dBm
00085 #define gAspPowerLevel_0dBm_c   (uint8_t)gAspPowerLevel_0dBm
00086 #define gAspPowerLevel_2dBm_c   (uint8_t)gAspPowerLevel_2dBm
00087 #define gAspPowerLevel_4dBm_c   (uint8_t)gAspPowerLevel_4dBm
00088 #define gAspPowerLevel_6dBm_c   (uint8_t)gAspPowerLevel_6dBm
00089 #define gAspPowerLevel_8dBm_c   (uint8_t)gAspPowerLevel_8dBm
00090 #define gAspPowerLevel_10dBm_c  (uint8_t)gAspPowerLevel_10dBm
00091 #define gAspPowerLevel_12dBm_c  (uint8_t)gAspPowerLevel_12dBm
00092 #define gAspPowerLevel_14dBm_c  (uint8_t)gAspPowerLevel_14dBm
00093 #define gAspPowerLevel_16dBm_c  (uint8_t)gAspPowerLevel_16dBm
00094 
00095 /* OpGroup codes used with FSCI */
00096 #define gFSCI_AspAppOpcodeGroup_c        0x94    /* ASP_APP_SapHandler           */
00097 #define gFSCI_AppAspOpcodeGroup_c        0x95    /* APP_ASP_SapHandler           */
00098 
00099 /************************************************************************************
00100 *************************************************************************************
00101 * Public type definitions
00102 *************************************************************************************
00103 ************************************************************************************/
00104 /* ASP status messages */
00105 typedef enum{
00106     gAspSuccess_c          = 0x00,
00107     gAspInvalidRequest_c   = 0xC2,
00108     gAspDenied_c           = 0xE2,
00109     gAspTooLong_c          = 0xE5,
00110     gAspInvalidParameter_c = 0xE8
00111 }AspStatus_t;
00112 
00113 /* Supported Power Levels */
00114 enum {
00115     gAspPowerLevel_m40dBm = 0x03,
00116     gAspPowerLevel_m38dBm = 0x04,
00117     gAspPowerLevel_m36dBm = 0x05,
00118     gAspPowerLevel_m34dBm = 0x06,
00119     gAspPowerLevel_m32dBm = 0x07,
00120     gAspPowerLevel_m30dBm = 0x08,
00121     gAspPowerLevel_m28dBm = 0x09,
00122     gAspPowerLevel_m26dBm = 0x0A,
00123     gAspPowerLevel_m24dBm = 0x0B,
00124     gAspPowerLevel_m22dBm = 0x0C,
00125     gAspPowerLevel_m20dBm = 0x0D,
00126     gAspPowerLevel_m18dBm = 0x0E,
00127     gAspPowerLevel_m16dBm = 0x0F,
00128     gAspPowerLevel_m14dBm = 0x10,
00129     gAspPowerLevel_m12dBm = 0x11,
00130     gAspPowerLevel_m10dBm = 0x12,
00131     gAspPowerLevel_m8dBm  = 0x13,
00132     gAspPowerLevel_m6dBm  = 0x14,
00133     gAspPowerLevel_m4dBm  = 0x15,
00134     gAspPowerLevel_m2dBm  = 0x16,
00135     gAspPowerLevel_0dBm   = 0x17,
00136     gAspPowerLevel_2dBm   = 0x18,
00137     gAspPowerLevel_4dBm   = 0x19,
00138     gAspPowerLevel_6dBm   = 0x1A,
00139     gAspPowerLevel_8dBm   = 0x1B,
00140     gAspPowerLevel_10dBm  = 0x1C,
00141     gAspPowerLevel_12dBm  = 0x1D,
00142     gAspPowerLevel_14dBm  = 0x1E,
00143     gAspPowerLevel_16dBm  = 0x1F
00144 };
00145 
00146 /* Radio test modes */
00147 enum {
00148     gTestForceIdle_c               = 0,
00149     gTestPulseTxPrbs9_c            = 1,
00150     gTestContinuousRx_c            = 2,
00151     gTestContinuousTxMod_c         = 3,
00152     gTestContinuousTxNoMod_c       = 4,
00153     gTestContinuousTx2Mhz_c        = 5,
00154     gTestContinuousTx200Khz_c      = 6,
00155     gTestContinuousTx1MbpsPRBS9_c  = 7,
00156     gTestContinuousTxExternalSrc_c = 8,  
00157     gTestContinuousTxNoModZero_c   = 9,
00158     gTestContinuousTxNoModOne_c    = 10
00159 };
00160 
00161 /* This enum matches with the FSCI OpCode used by ASP*/
00162 typedef enum {
00163     aspMsgTypeGetTimeReq_c          = 0x00,
00164     aspMsgTypeGetInactiveTimeReq_c  = 0x01,
00165     aspMsgTypeGetMacStateReq_c      = 0x02,
00166     aspMsgTypeDozeReq_c             = 0x03,
00167     aspMsgTypeAutoDozeReq_c         = 0x04,
00168     aspMsgTypeAcomaReq_c            = 0x05,
00169     aspMsgTypeHibernateReq_c        = 0x06,
00170     aspMsgTypeWakeReq_c             = 0x07,
00171     aspMsgTypeEventReq_c            = 0x08,
00172     aspMsgTypeClkoReq_c             = 0x09,
00173     aspMsgTypeTrimReq_c             = 0x0A,
00174     aspMsgTypeDdrReq_c              = 0x0B,
00175     aspMsgTypePortReq_c             = 0x0C,
00176     aspMsgTypeSetMinDozeTimeReq_c   = 0x0D,
00177     aspMsgTypeSetNotifyReq_c        = 0x0E,
00178     aspMsgTypeSetPowerLevel_c       = 0x0F,
00179     aspMsgTypeGetPowerLevel_c       = 0x1F,
00180     aspMsgTypeTelecTest_c           = 0x10,
00181     aspMsgTypeTelecSetFreq_c        = 0x11,
00182     aspMsgTypeGetInactiveTimeCnf_c  = 0x12,
00183     aspMsgTypeGetMacStateCnf_c      = 0x13,
00184     aspMsgTypeDozeCnf_c             = 0x14,
00185     aspMsgTypeAutoDozeCnf_c         = 0x15,
00186     aspMsgTypeTelecSendRawData_c    = 0x16,
00187     aspMsgTypeSetFADState_c         = 0x17,
00188     aspMsgTypeSetFADThreshold_c     = 0x18,
00189     aspMsgTypeGetFADThreshold_c     = 0x19,
00190     aspMsgTypeGetFADState_c         = 0x1A,
00191     aspMsgTypeSetActivePromState_c  = 0x1B,
00192     aspMsgTypeXcvrWriteReq_c        = 0x1C,
00193     aspMsgTypeXcvrReadReq_c         = 0x1D,
00194     aspMsgTypeSetANTXState_c        = 0x20,
00195     aspMsgTypeGetANTXState_c        = 0x21,
00196     aspMsgTypeSetLQIMode_c          = 0x22,
00197     aspMsgTypeGetRSSILevel_c        = 0x23,
00198     aspMsgTypeSetMpmConfig_c        = 0x24,
00199     aspMsgTypeGetMpmConfig_c        = 0x25
00200 }AppAspMsgType_t;
00201 
00202 typedef PACKED_STRUCT aspEventReq_tag
00203 {   /* AspEvent.Request              */
00204     uint32_t eventTime;
00205 } aspEventReq_t;
00206 
00207 typedef PACKED_STRUCT aspGetTimeReq_tag
00208 {   /* AspGetTime.Request            */
00209     uint32_t time;
00210 } aspGetTimeReq_t;
00211 
00212 typedef PACKED_STRUCT aspSetNotifyReq_tag
00213 {   /* AspSetNotify.Request          */
00214     uint8_t notifications;
00215 } aspSetNotifyReq_t;
00216 
00217 
00218 typedef PACKED_STRUCT aspSetPowerLevelReq_tag
00219 {   /* AspSetPowerLevel.Request      */
00220     uint8_t powerLevel;
00221 } aspSetPowerLevelReq_t;
00222 
00223 
00224 typedef PACKED_STRUCT aspGetPowerLevelReq_tag
00225 {   /* AspGetPowerLevel.Request      */
00226     uint8_t powerLevel;
00227 } aspGetPowerLevelReq_t;
00228 
00229 
00230 typedef PACKED_STRUCT aspTelecTest_tag
00231 {   /* AspTelecTest.Request          */
00232     uint8_t mode;
00233 } aspTelecTest_t;
00234 
00235 
00236 typedef PACKED_STRUCT aspTelecsetFreq_tag
00237 {   /* AspTelecSetFreq.Request       */
00238     uint8_t channel;
00239 } aspTelecsetFreq_t;
00240 
00241 
00242 typedef PACKED_STRUCT aspTelecSendRawData_tag
00243 {   /* AspTelecSendRawData.Request   */
00244     uint8_t  length;
00245     uint8_t* dataPtr;
00246 } aspTelecSendRawData_t;
00247 
00248     /* AspSetFADThreshold.Request   */
00249 typedef uint8_t aspFADThreshold_t;
00250     /* AspSetLQIMode.Request    */
00251 typedef uint8_t aspLQIMode_t;
00252 
00253 typedef PACKED_STRUCT aspXcvrReq_tag
00254 {   /* AspXcvrWrite.Request / AspXcvrRead.Request   */
00255     uint8_t  mode;
00256     uint16_t addr;
00257     uint8_t  len;
00258     uint8_t  data[4]; /* more than 4 bytes can be read/written */
00259 } aspXcvrReq_t;
00260 
00261 
00262 typedef PACKED_STRUCT AppToAspMessage_tag
00263 {
00264     AppAspMsgType_t msgType;
00265     PACKED_UNION
00266     {
00267         aspEventReq_t           aspEventReq;
00268         aspGetTimeReq_t         aspGetTimeReq;
00269         aspSetPowerLevelReq_t   aspSetPowerLevelReq;
00270         aspGetPowerLevelReq_t   aspGetPowerLevelReq;
00271         aspTelecTest_t          aspTelecTest;
00272         aspTelecsetFreq_t       aspTelecsetFreq;
00273         aspTelecSendRawData_t   aspTelecSendRawData;
00274         aspFADThreshold_t       aspFADThreshold;
00275         bool_t                  aspFADState;
00276         bool_t                  aspANTXState;
00277         aspLQIMode_t            aspLQIMode;
00278         bool_t                  aspActivePromState;
00279         aspXcvrReq_t            aspXcvrData;
00280         mpmConfig_t             MpmConfig;
00281     }msgData;
00282 } AppToAspMessage_t;
00283 
00284 #ifdef __cplusplus
00285 extern "C" {
00286 #endif 
00287 
00288 /************************************************************************************
00289 *************************************************************************************
00290 * Public memory declarations
00291 *************************************************************************************
00292 ************************************************************************************/
00293 
00294 /************************************************************************************
00295 *************************************************************************************
00296 * Public functions
00297 *************************************************************************************
00298 ************************************************************************************/
00299 #if gAspCapability_d
00300 
00301 void ASP_Init( instanceId_t phyInstance, uint8_t interfaceId );
00302 
00303 AspStatus_t APP_ASP_SapHandler(AppToAspMessage_t *pMsg, instanceId_t instanceId);
00304 
00305 void Asp_GetTimeReq(uint32_t *time);
00306 
00307 AspStatus_t Asp_XcvrWriteReq (uint8_t mode, uint16_t addr, uint8_t len, uint8_t* pData);
00308 AspStatus_t Asp_XcvrReadReq  (uint8_t mode, uint16_t addr, uint8_t len, uint8_t* pData);
00309 
00310 AspStatus_t Asp_SetPowerLevel(uint8_t powerLevel);
00311 uint8_t     Asp_GetPowerLevel(void);
00312 
00313 AspStatus_t Asp_SetActivePromState(bool_t state);
00314 
00315 AspStatus_t Asp_SetFADState(bool_t state);
00316 AspStatus_t Asp_SetFADThreshold(uint8_t thresholdFAD);
00317 
00318 AspStatus_t Asp_SetANTXState(bool_t state);
00319 uint8_t     Asp_GetANTXState(void);
00320 uint8_t     Asp_SetANTPadStateRequest(bool_t antAB_on, bool_t rxtxSwitch_on);
00321 uint8_t     Asp_SetANTPadStrengthRequest(bool_t hiStrength);
00322 uint8_t     Asp_SetANTPadInvertedRequest(bool_t invAntA, bool_t invAntB, bool_t invTx, bool_t invRx);
00323 
00324 AspStatus_t Asp_SetLQIMode(bool_t mode);
00325 uint8_t     Asp_GetRSSILevel(void);
00326 
00327 AspStatus_t ASP_TelecSetFreq    (uint8_t channel);
00328 AspStatus_t ASP_TelecSendRawData(uint8_t* dataPtr);
00329 AspStatus_t ASP_TelecTest       (uint8_t mode);
00330 
00331 #else /* gAspCapability_d */
00332 
00333 #define ASP_Init(phyInstance,interfaceId)
00334 #define Asp_GetTimeReq(time)
00335 
00336 #define APP_ASP_SapHandler(pMsg)                  (gAspDenied_c)
00337 #define Asp_XcvrWriteReq(mode, addr, len, pData)  (gAspDenied_c)
00338 #define Asp_XcvrReadReq(mode, addr, len, pData)   (gAspDenied_c)
00339 #define Asp_SetPowerLevel(powerLevel)             (gAspDenied_c)
00340 #define Asp_SetActivePromState(state)             (gAspDenied_c)
00341 #define Asp_SetFADState(state)                    (gAspDenied_c)
00342 #define Asp_SetFADThreshold(thresholdFAD)         (gAspDenied_c)
00343 #define Asp_SetANTXState(state)                   (gAspDenied_c)
00344 #define Asp_SetLQIMode(mode)                      (gAspDenied_c)
00345 #define ASP_TelecSetFreq(channel)                 (gAspDenied_c)
00346 #define ASP_TelecSendRawData(dataPtr)             (gAspDenied_c)
00347 #define ASP_TelecTest(mode)                       (gAspDenied_c)
00348 
00349 #define Asp_GetPowerLevel() (0)
00350 #define Asp_GetANTXState()  (0)
00351 #define Asp_GetRSSILevel()  (0)
00352 #endif /* gAspCapability_d */
00353 
00354 #ifdef __cplusplus
00355 }
00356 #endif 
00357 
00358 #endif /*__ASP_H__ */