The MCR20A Wireless UART application functions as an wireless UART bridge between two (one-to-one) or several (one to many) boards. The application can be used with both a TERM, or with software that is capable of opening a serial port and writing to or reading from it. The characters sent or received are not necessarily ASCII printable characters.

Dependencies:   fsl_phy_mcr20a fsl_smac mbed-rtos mbed

Fork of mcr20_wireless_uart by Freescale

By default, the application uses broadcast addresses for OTA communication. This way, the application can be directly downloaded and run without any user intervention. The following use case assumes no changes have been done to the project.

  • Two (or more) MCR20A platforms (plugged into the FRDM-K64F Freescale Freedom Development platform) have to be connected to the PC using the mini/micro-USB cables.
  • The code must be downloaded on the platforms via CMSIS-DAP (or other means).
  • After that, two or more TERM applications must be opened, and the serial ports must be configured with the same baud rate as the one in the project (default baud rate is 115200). Other necessary serial configurations are 8 bit, no parity, and 1 stop bit.
  • To start the setup, each platform must be reset, and one of the (user) push buttons found on the MCR20A platform must be pressed. The user can press any of the non-reset buttons on the FRDM-K64F Freescale Freedom Development platform as well. *This initiates the state machine of the application so user can start.

Documentation

SMAC Demo Applications User Guide

Committer:
cotigac
Date:
Fri Apr 03 05:23:33 2015 +0000
Revision:
18:b02fc0e53df8
Started creating wireless uart demo based on mbed-rtos

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cotigac 18:b02fc0e53df8 1 /*!
cotigac 18:b02fc0e53df8 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
cotigac 18:b02fc0e53df8 3 * All rights reserved.
cotigac 18:b02fc0e53df8 4 *
cotigac 18:b02fc0e53df8 5 * \file ASP.c
cotigac 18:b02fc0e53df8 6 * This is the source file for the ASP module.
cotigac 18:b02fc0e53df8 7 *
cotigac 18:b02fc0e53df8 8 * Redistribution and use in source and binary forms, with or without modification,
cotigac 18:b02fc0e53df8 9 * are permitted provided that the following conditions are met:
cotigac 18:b02fc0e53df8 10 *
cotigac 18:b02fc0e53df8 11 * o Redistributions of source code must retain the above copyright notice, this list
cotigac 18:b02fc0e53df8 12 * of conditions and the following disclaimer.
cotigac 18:b02fc0e53df8 13 *
cotigac 18:b02fc0e53df8 14 * o Redistributions in binary form must reproduce the above copyright notice, this
cotigac 18:b02fc0e53df8 15 * list of conditions and the following disclaimer in the documentation and/or
cotigac 18:b02fc0e53df8 16 * other materials provided with the distribution.
cotigac 18:b02fc0e53df8 17 *
cotigac 18:b02fc0e53df8 18 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
cotigac 18:b02fc0e53df8 19 * contributors may be used to endorse or promote products derived from this
cotigac 18:b02fc0e53df8 20 * software without specific prior written permission.
cotigac 18:b02fc0e53df8 21 *
cotigac 18:b02fc0e53df8 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
cotigac 18:b02fc0e53df8 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
cotigac 18:b02fc0e53df8 24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
cotigac 18:b02fc0e53df8 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
cotigac 18:b02fc0e53df8 26 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
cotigac 18:b02fc0e53df8 27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
cotigac 18:b02fc0e53df8 28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
cotigac 18:b02fc0e53df8 29 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
cotigac 18:b02fc0e53df8 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
cotigac 18:b02fc0e53df8 31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cotigac 18:b02fc0e53df8 32 */
cotigac 18:b02fc0e53df8 33
cotigac 18:b02fc0e53df8 34 /************************************************************************************
cotigac 18:b02fc0e53df8 35 *************************************************************************************
cotigac 18:b02fc0e53df8 36 * Include
cotigac 18:b02fc0e53df8 37 *************************************************************************************
cotigac 18:b02fc0e53df8 38 ************************************************************************************/
cotigac 18:b02fc0e53df8 39
cotigac 18:b02fc0e53df8 40 #include "EmbeddedTypes.h"
cotigac 18:b02fc0e53df8 41 //#include "fsl_os_abstraction.h"
cotigac 18:b02fc0e53df8 42
cotigac 18:b02fc0e53df8 43 #include "Phy.h"
cotigac 18:b02fc0e53df8 44 #include "PhyInterface.h"
cotigac 18:b02fc0e53df8 45 #include "MpmInterface.h"
cotigac 18:b02fc0e53df8 46 #include "AspInterface.h"
cotigac 18:b02fc0e53df8 47
cotigac 18:b02fc0e53df8 48 #if 0
cotigac 18:b02fc0e53df8 49 #include "MemManager.h"
cotigac 18:b02fc0e53df8 50 #include "FunctionLib.h"
cotigac 18:b02fc0e53df8 51 #include "Panic.h"
cotigac 18:b02fc0e53df8 52 #endif
cotigac 18:b02fc0e53df8 53
cotigac 18:b02fc0e53df8 54 #include "MCR20Drv.h"
cotigac 18:b02fc0e53df8 55 #include "MCR20Reg.h"
cotigac 18:b02fc0e53df8 56
cotigac 18:b02fc0e53df8 57 #if gFsciIncluded_c
cotigac 18:b02fc0e53df8 58 #include "FsciInterface.h"
cotigac 18:b02fc0e53df8 59 #include "FsciCommands.h"
cotigac 18:b02fc0e53df8 60 #include "FsciCommunication.h"
cotigac 18:b02fc0e53df8 61 #endif
cotigac 18:b02fc0e53df8 62
cotigac 18:b02fc0e53df8 63 #if gAspCapability_d
cotigac 18:b02fc0e53df8 64
cotigac 18:b02fc0e53df8 65 /************************************************************************************
cotigac 18:b02fc0e53df8 66 *************************************************************************************
cotigac 18:b02fc0e53df8 67 * Public macros
cotigac 18:b02fc0e53df8 68 *************************************************************************************
cotigac 18:b02fc0e53df8 69 ************************************************************************************/
cotigac 18:b02fc0e53df8 70 #define mFAD_THR_ResetValue 0x82
cotigac 18:b02fc0e53df8 71 #define mANT_AGC_CTRL_ResetValue 0x40
cotigac 18:b02fc0e53df8 72
cotigac 18:b02fc0e53df8 73 /************************************************************************************
cotigac 18:b02fc0e53df8 74 *************************************************************************************
cotigac 18:b02fc0e53df8 75 * Public type definitions
cotigac 18:b02fc0e53df8 76 *************************************************************************************
cotigac 18:b02fc0e53df8 77 ************************************************************************************/
cotigac 18:b02fc0e53df8 78 //MCR20 DTS modes
cotigac 18:b02fc0e53df8 79 enum {
cotigac 18:b02fc0e53df8 80 gDtsNormal_c,
cotigac 18:b02fc0e53df8 81 gDtsTxOne_c,
cotigac 18:b02fc0e53df8 82 gDtsTxZero_c,
cotigac 18:b02fc0e53df8 83 gDtsTx2Mhz_c,
cotigac 18:b02fc0e53df8 84 gDtsTx200Khz_c,
cotigac 18:b02fc0e53df8 85 gDtsTx1MbpsPRBS9_c,
cotigac 18:b02fc0e53df8 86 gDtsTxExternalSrc_c,
cotigac 18:b02fc0e53df8 87 gDtsTxRandomSeq_c
cotigac 18:b02fc0e53df8 88 };
cotigac 18:b02fc0e53df8 89
cotigac 18:b02fc0e53df8 90 /************************************************************************************
cotigac 18:b02fc0e53df8 91 *************************************************************************************
cotigac 18:b02fc0e53df8 92 * Private functions prototype
cotigac 18:b02fc0e53df8 93 *************************************************************************************
cotigac 18:b02fc0e53df8 94 ************************************************************************************/
cotigac 18:b02fc0e53df8 95 phyStatus_t AspSetDtsMode( uint8_t mode );
cotigac 18:b02fc0e53df8 96 phyStatus_t AspEnableBER( void );
cotigac 18:b02fc0e53df8 97 void AspDisableBER( void );
cotigac 18:b02fc0e53df8 98
cotigac 18:b02fc0e53df8 99 #if gFsciIncluded_c
cotigac 18:b02fc0e53df8 100 static void fsciAspReqHandler(void *pData, void* param, uint32_t interfaceId);
cotigac 18:b02fc0e53df8 101 static void AspSapMonitor(void *pData, void* param, uint32_t interfaceId);
cotigac 18:b02fc0e53df8 102 #endif
cotigac 18:b02fc0e53df8 103
cotigac 18:b02fc0e53df8 104 /************************************************************************************
cotigac 18:b02fc0e53df8 105 *************************************************************************************
cotigac 18:b02fc0e53df8 106 * Private memory declarations
cotigac 18:b02fc0e53df8 107 *************************************************************************************
cotigac 18:b02fc0e53df8 108 ************************************************************************************/
cotigac 18:b02fc0e53df8 109 //2405 2410 2415 2420 2425 2430 2435 2440 2445 2450 2455 2460 2465 2470 2475 2480
cotigac 18:b02fc0e53df8 110 static const uint16_t asp_pll_frac[16] = {0x2400, 0x4C00, 0x7400, 0x9C00, 0xC400, 0xEC00, 0x1400, 0x3C00, 0x6400, 0x8C00, 0xB400, 0xDC00, 0x0400, 0x2C00, 0x5400, 0x7C00};
cotigac 18:b02fc0e53df8 111
cotigac 18:b02fc0e53df8 112 #if gFsciIncluded_c
cotigac 18:b02fc0e53df8 113 static uint8_t mAspFsciBinding[gPhyInstancesCnt_c];
cotigac 18:b02fc0e53df8 114 #endif
cotigac 18:b02fc0e53df8 115
cotigac 18:b02fc0e53df8 116 /************************************************************************************
cotigac 18:b02fc0e53df8 117 *************************************************************************************
cotigac 18:b02fc0e53df8 118 * Public functions
cotigac 18:b02fc0e53df8 119 *************************************************************************************
cotigac 18:b02fc0e53df8 120 ************************************************************************************/
cotigac 18:b02fc0e53df8 121
cotigac 18:b02fc0e53df8 122 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 123 * \brief Initialize the ASP module
cotigac 18:b02fc0e53df8 124 *
cotigac 18:b02fc0e53df8 125 * \param[in] phyInstance The instance of the PHY
cotigac 18:b02fc0e53df8 126 * \param[in] interfaceId The Serial Manager interface used
cotigac 18:b02fc0e53df8 127 *
cotigac 18:b02fc0e53df8 128 ********************************************************************************** */
cotigac 18:b02fc0e53df8 129 #undef mFuncId_c
cotigac 18:b02fc0e53df8 130 #define mFuncId_c 0
cotigac 18:b02fc0e53df8 131 void ASP_Init( instanceId_t phyInstance, uint8_t interfaceId )
cotigac 18:b02fc0e53df8 132 {
cotigac 18:b02fc0e53df8 133 #if gFsciIncluded_c
cotigac 18:b02fc0e53df8 134 if( phyInstance < gPhyInstancesCnt_c )
cotigac 18:b02fc0e53df8 135 {
cotigac 18:b02fc0e53df8 136 mAspFsciBinding[phyInstance] = interfaceId;
cotigac 18:b02fc0e53df8 137 FSCI_RegisterOpGroup( gFSCI_AppAspOpcodeGroup_c, gFsciMonitorMode_c, fsciAspReqHandler, NULL, gAspInterfaceId);
cotigac 18:b02fc0e53df8 138 FSCI_RegisterOpGroup( gFSCI_AspSapId_c, gFsciMonitorMode_c, AspSapMonitor, NULL, gAspInterfaceId);
cotigac 18:b02fc0e53df8 139 }
cotigac 18:b02fc0e53df8 140 #endif
cotigac 18:b02fc0e53df8 141 }
cotigac 18:b02fc0e53df8 142
cotigac 18:b02fc0e53df8 143 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 144 * \brief ASP SAP handler.
cotigac 18:b02fc0e53df8 145 *
cotigac 18:b02fc0e53df8 146 * \param[in] pMsg Pointer to the request message
cotigac 18:b02fc0e53df8 147 * \param[in] instanceId The instance of the PHY
cotigac 18:b02fc0e53df8 148 *
cotigac 18:b02fc0e53df8 149 * \return AspStatus_t
cotigac 18:b02fc0e53df8 150 *
cotigac 18:b02fc0e53df8 151 ********************************************************************************** */
cotigac 18:b02fc0e53df8 152 #undef mFuncId_c
cotigac 18:b02fc0e53df8 153 #define mFuncId_c 1
cotigac 18:b02fc0e53df8 154 AspStatus_t APP_ASP_SapHandler(AppToAspMessage_t *pMsg, instanceId_t instanceId)
cotigac 18:b02fc0e53df8 155 {
cotigac 18:b02fc0e53df8 156 AspStatus_t status = gAspSuccess_c;
cotigac 18:b02fc0e53df8 157 #if gFsciIncluded_c
cotigac 18:b02fc0e53df8 158 FSCI_Monitor( gFSCI_AspSapId_c,
cotigac 18:b02fc0e53df8 159 pMsg,
cotigac 18:b02fc0e53df8 160 NULL,
cotigac 18:b02fc0e53df8 161 gAspInterfaceId );
cotigac 18:b02fc0e53df8 162 #endif
cotigac 18:b02fc0e53df8 163 switch( pMsg->msgType )
cotigac 18:b02fc0e53df8 164 {
cotigac 18:b02fc0e53df8 165 case aspMsgTypeGetTimeReq_c:
cotigac 18:b02fc0e53df8 166 Asp_GetTimeReq((uint32_t*)&pMsg->msgData.aspGetTimeReq.time);
cotigac 18:b02fc0e53df8 167 break;
cotigac 18:b02fc0e53df8 168 case aspMsgTypeXcvrWriteReq_c:
cotigac 18:b02fc0e53df8 169 status = Asp_XcvrWriteReq( pMsg->msgData.aspXcvrData.mode,
cotigac 18:b02fc0e53df8 170 pMsg->msgData.aspXcvrData.addr,
cotigac 18:b02fc0e53df8 171 pMsg->msgData.aspXcvrData.len,
cotigac 18:b02fc0e53df8 172 pMsg->msgData.aspXcvrData.data);
cotigac 18:b02fc0e53df8 173 break;
cotigac 18:b02fc0e53df8 174 case aspMsgTypeXcvrReadReq_c:
cotigac 18:b02fc0e53df8 175 status = Asp_XcvrReadReq( pMsg->msgData.aspXcvrData.mode,
cotigac 18:b02fc0e53df8 176 pMsg->msgData.aspXcvrData.addr,
cotigac 18:b02fc0e53df8 177 pMsg->msgData.aspXcvrData.len,
cotigac 18:b02fc0e53df8 178 pMsg->msgData.aspXcvrData.data);
cotigac 18:b02fc0e53df8 179 break;
cotigac 18:b02fc0e53df8 180 case aspMsgTypeSetFADState_c:
cotigac 18:b02fc0e53df8 181 status = Asp_SetFADState(pMsg->msgData.aspFADState);
cotigac 18:b02fc0e53df8 182 break;
cotigac 18:b02fc0e53df8 183 case aspMsgTypeSetFADThreshold_c:
cotigac 18:b02fc0e53df8 184 status = Asp_SetFADThreshold(pMsg->msgData.aspFADThreshold);
cotigac 18:b02fc0e53df8 185 break;
cotigac 18:b02fc0e53df8 186 case aspMsgTypeSetANTXState_c:
cotigac 18:b02fc0e53df8 187 status = Asp_SetANTXState(pMsg->msgData.aspANTXState);
cotigac 18:b02fc0e53df8 188 break;
cotigac 18:b02fc0e53df8 189 case aspMsgTypeGetANTXState_c:
cotigac 18:b02fc0e53df8 190 *((uint8_t*)&status) = Asp_GetANTXState();
cotigac 18:b02fc0e53df8 191 break;
cotigac 18:b02fc0e53df8 192 case aspMsgTypeSetPowerLevel_c:
cotigac 18:b02fc0e53df8 193 status = Asp_SetPowerLevel(pMsg->msgData.aspSetPowerLevelReq.powerLevel);
cotigac 18:b02fc0e53df8 194 break;
cotigac 18:b02fc0e53df8 195 case aspMsgTypeGetPowerLevel_c:
cotigac 18:b02fc0e53df8 196 *((uint8_t*)&status) = Asp_GetPowerLevel(); //remove compiler warning
cotigac 18:b02fc0e53df8 197 break;
cotigac 18:b02fc0e53df8 198 case aspMsgTypeTelecSetFreq_c:
cotigac 18:b02fc0e53df8 199 status = ASP_TelecSetFreq(pMsg->msgData.aspTelecsetFreq.channel);
cotigac 18:b02fc0e53df8 200 break;
cotigac 18:b02fc0e53df8 201 case aspMsgTypeTelecSendRawData_c:
cotigac 18:b02fc0e53df8 202 status = ASP_TelecSendRawData((uint8_t*)&pMsg->msgData.aspTelecSendRawData);
cotigac 18:b02fc0e53df8 203 break;
cotigac 18:b02fc0e53df8 204 case aspMsgTypeTelecTest_c:
cotigac 18:b02fc0e53df8 205 status = ASP_TelecTest(pMsg->msgData.aspTelecTest.mode);
cotigac 18:b02fc0e53df8 206 break;
cotigac 18:b02fc0e53df8 207 case aspMsgTypeSetLQIMode_c:
cotigac 18:b02fc0e53df8 208 status = Asp_SetLQIMode(pMsg->msgData.aspLQIMode);
cotigac 18:b02fc0e53df8 209 break;
cotigac 18:b02fc0e53df8 210 case aspMsgTypeGetRSSILevel_c:
cotigac 18:b02fc0e53df8 211 *((uint8_t*)&status) = Asp_GetRSSILevel(); //remove compiler warning
cotigac 18:b02fc0e53df8 212 break;
cotigac 18:b02fc0e53df8 213 #if gMpmIncluded_d
cotigac 18:b02fc0e53df8 214 case aspMsgTypeSetMpmConfig_c:
cotigac 18:b02fc0e53df8 215 MPM_SetConfig(&pMsg->msgData.MpmConfig);
cotigac 18:b02fc0e53df8 216 break;
cotigac 18:b02fc0e53df8 217 case aspMsgTypeGetMpmConfig_c:
cotigac 18:b02fc0e53df8 218 MPM_GetConfig(&pMsg->msgData.MpmConfig);
cotigac 18:b02fc0e53df8 219 break;
cotigac 18:b02fc0e53df8 220 #endif
cotigac 18:b02fc0e53df8 221 default:
cotigac 18:b02fc0e53df8 222 status = gAspInvalidRequest_c;// OR gAspInvalidParameter_c
cotigac 18:b02fc0e53df8 223 break;
cotigac 18:b02fc0e53df8 224 }
cotigac 18:b02fc0e53df8 225 #if gFsciIncluded_c
cotigac 18:b02fc0e53df8 226 FSCI_Monitor( gFSCI_AspSapId_c,
cotigac 18:b02fc0e53df8 227 pMsg,
cotigac 18:b02fc0e53df8 228 (void*)&status,
cotigac 18:b02fc0e53df8 229 gAspInterfaceId );
cotigac 18:b02fc0e53df8 230 #endif
cotigac 18:b02fc0e53df8 231 return status;
cotigac 18:b02fc0e53df8 232 }
cotigac 18:b02fc0e53df8 233
cotigac 18:b02fc0e53df8 234 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 235 * \brief Returns the current PHY time
cotigac 18:b02fc0e53df8 236 *
cotigac 18:b02fc0e53df8 237 * \param[in] time location where the PHY time will be stored
cotigac 18:b02fc0e53df8 238 *
cotigac 18:b02fc0e53df8 239 ********************************************************************************** */
cotigac 18:b02fc0e53df8 240 #undef mFuncId_c
cotigac 18:b02fc0e53df8 241 #define mFuncId_c 2
cotigac 18:b02fc0e53df8 242 void Asp_GetTimeReq(uint32_t *time)
cotigac 18:b02fc0e53df8 243 {
cotigac 18:b02fc0e53df8 244 PhyTimeReadClock( time );
cotigac 18:b02fc0e53df8 245 }
cotigac 18:b02fc0e53df8 246
cotigac 18:b02fc0e53df8 247 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 248 * \brief Write XCVR registers
cotigac 18:b02fc0e53df8 249 *
cotigac 18:b02fc0e53df8 250 * \param[in] mode Direct/Indirect access
cotigac 18:b02fc0e53df8 251 * \param[in] addr XCVR address
cotigac 18:b02fc0e53df8 252 * \param[in] len number of bytes to write
cotigac 18:b02fc0e53df8 253 * \param[in] pData data o be written
cotigac 18:b02fc0e53df8 254 *
cotigac 18:b02fc0e53df8 255 * \return AspStatus_t
cotigac 18:b02fc0e53df8 256 *
cotigac 18:b02fc0e53df8 257 ********************************************************************************** */
cotigac 18:b02fc0e53df8 258 #undef mFuncId_c
cotigac 18:b02fc0e53df8 259 #define mFuncId_c 3
cotigac 18:b02fc0e53df8 260 AspStatus_t Asp_XcvrWriteReq (uint8_t mode, uint16_t addr, uint8_t len, uint8_t* pData)
cotigac 18:b02fc0e53df8 261 {
cotigac 18:b02fc0e53df8 262 if (mode)
cotigac 18:b02fc0e53df8 263 MCR20Drv_IndirectAccessSPIMultiByteWrite((uint8_t)addr, pData, len);
cotigac 18:b02fc0e53df8 264 else
cotigac 18:b02fc0e53df8 265 MCR20Drv_DirectAccessSPIMultiByteWrite((uint8_t)addr, pData, len);
cotigac 18:b02fc0e53df8 266
cotigac 18:b02fc0e53df8 267 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 268 }
cotigac 18:b02fc0e53df8 269
cotigac 18:b02fc0e53df8 270 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 271 * \brief Read XCVR registers
cotigac 18:b02fc0e53df8 272 *
cotigac 18:b02fc0e53df8 273 * \param[in] mode Direct/Indirect access
cotigac 18:b02fc0e53df8 274 * \param[in] addr XCVR address
cotigac 18:b02fc0e53df8 275 * \param[in] len number of bytes to read
cotigac 18:b02fc0e53df8 276 * \param[in] pData location where data will be stored
cotigac 18:b02fc0e53df8 277 *
cotigac 18:b02fc0e53df8 278 * \return AspStatus_t
cotigac 18:b02fc0e53df8 279 *
cotigac 18:b02fc0e53df8 280 ********************************************************************************** */
cotigac 18:b02fc0e53df8 281 #undef mFuncId_c
cotigac 18:b02fc0e53df8 282 #define mFuncId_c 4
cotigac 18:b02fc0e53df8 283 AspStatus_t Asp_XcvrReadReq (uint8_t mode, uint16_t addr, uint8_t len, uint8_t* pData)
cotigac 18:b02fc0e53df8 284 {
cotigac 18:b02fc0e53df8 285 if (mode)
cotigac 18:b02fc0e53df8 286 MCR20Drv_IndirectAccessSPIMultiByteRead((uint8_t)addr, pData, len);
cotigac 18:b02fc0e53df8 287 else
cotigac 18:b02fc0e53df8 288 MCR20Drv_DirectAccessSPIMultiByteRead((uint8_t)addr, pData, len);
cotigac 18:b02fc0e53df8 289
cotigac 18:b02fc0e53df8 290 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 291 }
cotigac 18:b02fc0e53df8 292
cotigac 18:b02fc0e53df8 293 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 294 * \brief Set Tx output power level
cotigac 18:b02fc0e53df8 295 *
cotigac 18:b02fc0e53df8 296 * \param[in] powerLevel The new power level: 0x03-0x1F (see documentation for details)
cotigac 18:b02fc0e53df8 297 *
cotigac 18:b02fc0e53df8 298 * \return AspStatus_t
cotigac 18:b02fc0e53df8 299 *
cotigac 18:b02fc0e53df8 300 ********************************************************************************** */
cotigac 18:b02fc0e53df8 301 #undef mFuncId_c
cotigac 18:b02fc0e53df8 302 #define mFuncId_c 5
cotigac 18:b02fc0e53df8 303 AspStatus_t Asp_SetPowerLevel( uint8_t powerLevel )
cotigac 18:b02fc0e53df8 304 {
cotigac 18:b02fc0e53df8 305 if(powerLevel > gAspPowerLevel_16dBm)
cotigac 18:b02fc0e53df8 306 return gAspInvalidParameter_c;
cotigac 18:b02fc0e53df8 307
cotigac 18:b02fc0e53df8 308 {
cotigac 18:b02fc0e53df8 309 uint8_t res;
cotigac 18:b02fc0e53df8 310
cotigac 18:b02fc0e53df8 311 res = PhyPlmeSetPwrLevelRequest(powerLevel);
cotigac 18:b02fc0e53df8 312
cotigac 18:b02fc0e53df8 313 if( res == gPhySuccess_c )
cotigac 18:b02fc0e53df8 314 {
cotigac 18:b02fc0e53df8 315 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 316 }
cotigac 18:b02fc0e53df8 317 else
cotigac 18:b02fc0e53df8 318 {
cotigac 18:b02fc0e53df8 319 return gAspDenied_c;
cotigac 18:b02fc0e53df8 320 }
cotigac 18:b02fc0e53df8 321 }
cotigac 18:b02fc0e53df8 322 }
cotigac 18:b02fc0e53df8 323
cotigac 18:b02fc0e53df8 324 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 325 * \brief Read the current Tx power level
cotigac 18:b02fc0e53df8 326 *
cotigac 18:b02fc0e53df8 327 * \return power level
cotigac 18:b02fc0e53df8 328 *
cotigac 18:b02fc0e53df8 329 ********************************************************************************** */
cotigac 18:b02fc0e53df8 330 #undef mFuncId_c
cotigac 18:b02fc0e53df8 331 #define mFuncId_c 6
cotigac 18:b02fc0e53df8 332 uint8_t Asp_GetPowerLevel()
cotigac 18:b02fc0e53df8 333 {
cotigac 18:b02fc0e53df8 334 return MCR20Drv_DirectAccessSPIRead(PA_PWR);
cotigac 18:b02fc0e53df8 335 }
cotigac 18:b02fc0e53df8 336
cotigac 18:b02fc0e53df8 337 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 338 * \brief Set the state of Active Promiscuous functionality
cotigac 18:b02fc0e53df8 339 *
cotigac 18:b02fc0e53df8 340 * \param[in] state new state
cotigac 18:b02fc0e53df8 341 *
cotigac 18:b02fc0e53df8 342 * \return AspStatus_t
cotigac 18:b02fc0e53df8 343 *
cotigac 18:b02fc0e53df8 344 ********************************************************************************** */
cotigac 18:b02fc0e53df8 345 #undef mFuncId_c
cotigac 18:b02fc0e53df8 346 #define mFuncId_c 7
cotigac 18:b02fc0e53df8 347 AspStatus_t Asp_SetActivePromState(bool_t state)
cotigac 18:b02fc0e53df8 348 {
cotigac 18:b02fc0e53df8 349 PhySetActivePromiscuous(state);
cotigac 18:b02fc0e53df8 350 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 351 }
cotigac 18:b02fc0e53df8 352
cotigac 18:b02fc0e53df8 353 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 354 * \brief Set the state of Fast Antenna Diversity functionality
cotigac 18:b02fc0e53df8 355 *
cotigac 18:b02fc0e53df8 356 * \param[in] state new state
cotigac 18:b02fc0e53df8 357 *
cotigac 18:b02fc0e53df8 358 * \return AspStatus_t
cotigac 18:b02fc0e53df8 359 *
cotigac 18:b02fc0e53df8 360 ********************************************************************************** */
cotigac 18:b02fc0e53df8 361 #undef mFuncId_c
cotigac 18:b02fc0e53df8 362 #define mFuncId_c 8
cotigac 18:b02fc0e53df8 363 AspStatus_t Asp_SetFADState(bool_t state)
cotigac 18:b02fc0e53df8 364 {
cotigac 18:b02fc0e53df8 365 if( gPhySuccess_c != PhyPlmeSetFADStateRequest(state) )
cotigac 18:b02fc0e53df8 366 {
cotigac 18:b02fc0e53df8 367 return gAspDenied_c;
cotigac 18:b02fc0e53df8 368 }
cotigac 18:b02fc0e53df8 369 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 370 }
cotigac 18:b02fc0e53df8 371
cotigac 18:b02fc0e53df8 372 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 373 * \brief Set the Fast Antenna Diversity threshold
cotigac 18:b02fc0e53df8 374 *
cotigac 18:b02fc0e53df8 375 * \param[in] threshold
cotigac 18:b02fc0e53df8 376 *
cotigac 18:b02fc0e53df8 377 * \return AspStatus_t
cotigac 18:b02fc0e53df8 378 *
cotigac 18:b02fc0e53df8 379 ********************************************************************************** */
cotigac 18:b02fc0e53df8 380 #undef mFuncId_c
cotigac 18:b02fc0e53df8 381 #define mFuncId_c 9
cotigac 18:b02fc0e53df8 382 AspStatus_t Asp_SetFADThreshold(uint8_t threshold)
cotigac 18:b02fc0e53df8 383 {
cotigac 18:b02fc0e53df8 384 if( gPhySuccess_c != PhyPlmeSetFADThresholdRequest(threshold) )
cotigac 18:b02fc0e53df8 385 {
cotigac 18:b02fc0e53df8 386 return gAspDenied_c;
cotigac 18:b02fc0e53df8 387 }
cotigac 18:b02fc0e53df8 388 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 389 }
cotigac 18:b02fc0e53df8 390
cotigac 18:b02fc0e53df8 391 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 392 * \brief Set the ANTX functionality
cotigac 18:b02fc0e53df8 393 *
cotigac 18:b02fc0e53df8 394 * \param[in] state
cotigac 18:b02fc0e53df8 395 *
cotigac 18:b02fc0e53df8 396 * \return AspStatus_t
cotigac 18:b02fc0e53df8 397 *
cotigac 18:b02fc0e53df8 398 ********************************************************************************** */
cotigac 18:b02fc0e53df8 399 #undef mFuncId_c
cotigac 18:b02fc0e53df8 400 #define mFuncId_c 10
cotigac 18:b02fc0e53df8 401 AspStatus_t Asp_SetANTXState(bool_t state)
cotigac 18:b02fc0e53df8 402 {
cotigac 18:b02fc0e53df8 403 if( gPhySuccess_c != PhyPlmeSetANTXStateRequest(state) )
cotigac 18:b02fc0e53df8 404 {
cotigac 18:b02fc0e53df8 405 return gAspDenied_c;
cotigac 18:b02fc0e53df8 406 }
cotigac 18:b02fc0e53df8 407 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 408 }
cotigac 18:b02fc0e53df8 409
cotigac 18:b02fc0e53df8 410 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 411 * \brief Get the ANTX functionality
cotigac 18:b02fc0e53df8 412 *
cotigac 18:b02fc0e53df8 413 * \return current state
cotigac 18:b02fc0e53df8 414 *
cotigac 18:b02fc0e53df8 415 ********************************************************************************** */
cotigac 18:b02fc0e53df8 416 #undef mFuncId_c
cotigac 18:b02fc0e53df8 417 #define mFuncId_c 11
cotigac 18:b02fc0e53df8 418 uint8_t Asp_GetANTXState(void)
cotigac 18:b02fc0e53df8 419 {
cotigac 18:b02fc0e53df8 420 return PhyPlmeGetANTXStateRequest();
cotigac 18:b02fc0e53df8 421 }
cotigac 18:b02fc0e53df8 422
cotigac 18:b02fc0e53df8 423 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 424 * \brief Set the ANTX pad state
cotigac 18:b02fc0e53df8 425 *
cotigac 18:b02fc0e53df8 426 * \param[in] antAB_on
cotigac 18:b02fc0e53df8 427 * \param[in] rxtxSwitch_on
cotigac 18:b02fc0e53df8 428 *
cotigac 18:b02fc0e53df8 429 * \return status
cotigac 18:b02fc0e53df8 430 *
cotigac 18:b02fc0e53df8 431 ********************************************************************************** */
cotigac 18:b02fc0e53df8 432 #undef mFuncId_c
cotigac 18:b02fc0e53df8 433 #define mFuncId_c 12
cotigac 18:b02fc0e53df8 434 uint8_t Asp_SetANTPadStateRequest(bool_t antAB_on, bool_t rxtxSwitch_on)
cotigac 18:b02fc0e53df8 435 {
cotigac 18:b02fc0e53df8 436 return PhyPlmeSetANTPadStateRequest(antAB_on, rxtxSwitch_on);
cotigac 18:b02fc0e53df8 437 }
cotigac 18:b02fc0e53df8 438
cotigac 18:b02fc0e53df8 439 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 440 * \brief Set the ANTX pad strength
cotigac 18:b02fc0e53df8 441 *
cotigac 18:b02fc0e53df8 442 * \param[in] hiStrength
cotigac 18:b02fc0e53df8 443 *
cotigac 18:b02fc0e53df8 444 * \return status
cotigac 18:b02fc0e53df8 445 *
cotigac 18:b02fc0e53df8 446 ********************************************************************************** */
cotigac 18:b02fc0e53df8 447 #undef mFuncId_c
cotigac 18:b02fc0e53df8 448 #define mFuncId_c 13
cotigac 18:b02fc0e53df8 449 uint8_t Asp_SetANTPadStrengthRequest(bool_t hiStrength)
cotigac 18:b02fc0e53df8 450 {
cotigac 18:b02fc0e53df8 451 return PhyPlmeSetANTPadStrengthRequest(hiStrength);
cotigac 18:b02fc0e53df8 452 }
cotigac 18:b02fc0e53df8 453
cotigac 18:b02fc0e53df8 454 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 455 * \brief Set the ANTX inverted pads
cotigac 18:b02fc0e53df8 456 *
cotigac 18:b02fc0e53df8 457 * \param[in] invAntA invert Ant_A pad
cotigac 18:b02fc0e53df8 458 * \param[in] invAntB invert Ant_B pad
cotigac 18:b02fc0e53df8 459 * \param[in] invTx invert Tx pad
cotigac 18:b02fc0e53df8 460 * \param[in] invRx invert Rx pad
cotigac 18:b02fc0e53df8 461 *
cotigac 18:b02fc0e53df8 462 * \return status
cotigac 18:b02fc0e53df8 463 *
cotigac 18:b02fc0e53df8 464 ********************************************************************************** */
cotigac 18:b02fc0e53df8 465 #undef mFuncId_c
cotigac 18:b02fc0e53df8 466 #define mFuncId_c 14
cotigac 18:b02fc0e53df8 467 uint8_t Asp_SetANTPadInvertedRequest(bool_t invAntA, bool_t invAntB, bool_t invTx, bool_t invRx)
cotigac 18:b02fc0e53df8 468 {
cotigac 18:b02fc0e53df8 469 return PhyPlmeSetANTPadInvertedRequest(invAntA, invAntB, invTx, invRx);
cotigac 18:b02fc0e53df8 470 }
cotigac 18:b02fc0e53df8 471
cotigac 18:b02fc0e53df8 472 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 473 * \brief Set the LQI mode
cotigac 18:b02fc0e53df8 474 *
cotigac 18:b02fc0e53df8 475 * \param[in] mode
cotigac 18:b02fc0e53df8 476 *
cotigac 18:b02fc0e53df8 477 * \return AspStatus_t
cotigac 18:b02fc0e53df8 478 *
cotigac 18:b02fc0e53df8 479 ********************************************************************************** */
cotigac 18:b02fc0e53df8 480 #undef mFuncId_c
cotigac 18:b02fc0e53df8 481 #define mFuncId_c 15
cotigac 18:b02fc0e53df8 482 AspStatus_t Asp_SetLQIMode(bool_t mode)
cotigac 18:b02fc0e53df8 483 {
cotigac 18:b02fc0e53df8 484 if( gPhySuccess_c != PhyPlmeSetLQIModeRequest(mode) )
cotigac 18:b02fc0e53df8 485 {
cotigac 18:b02fc0e53df8 486 return gAspDenied_c;
cotigac 18:b02fc0e53df8 487 }
cotigac 18:b02fc0e53df8 488 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 489 }
cotigac 18:b02fc0e53df8 490
cotigac 18:b02fc0e53df8 491 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 492 * \brief Get the last RSSI level
cotigac 18:b02fc0e53df8 493 *
cotigac 18:b02fc0e53df8 494 * \return RSSI
cotigac 18:b02fc0e53df8 495 *
cotigac 18:b02fc0e53df8 496 ********************************************************************************** */
cotigac 18:b02fc0e53df8 497 #undef mFuncId_c
cotigac 18:b02fc0e53df8 498 #define mFuncId_c 16
cotigac 18:b02fc0e53df8 499 uint8_t Asp_GetRSSILevel(void)
cotigac 18:b02fc0e53df8 500 {
cotigac 18:b02fc0e53df8 501 return PhyPlmeGetRSSILevelRequest();
cotigac 18:b02fc0e53df8 502 }
cotigac 18:b02fc0e53df8 503
cotigac 18:b02fc0e53df8 504 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 505 * \brief Set current channel
cotigac 18:b02fc0e53df8 506 *
cotigac 18:b02fc0e53df8 507 * \param[in] channel channel number (11-26)
cotigac 18:b02fc0e53df8 508 *
cotigac 18:b02fc0e53df8 509 * \return AspStatus_t
cotigac 18:b02fc0e53df8 510 *
cotigac 18:b02fc0e53df8 511 ********************************************************************************** */
cotigac 18:b02fc0e53df8 512 #undef mFuncId_c
cotigac 18:b02fc0e53df8 513 #define mFuncId_c 17
cotigac 18:b02fc0e53df8 514 AspStatus_t ASP_TelecSetFreq(uint8_t channel)
cotigac 18:b02fc0e53df8 515 {
cotigac 18:b02fc0e53df8 516 PhyPlmeForceTrxOffRequest();
cotigac 18:b02fc0e53df8 517 if( gPhySuccess_c != PhyPlmeSetCurrentChannelRequest(channel,0) )
cotigac 18:b02fc0e53df8 518 {
cotigac 18:b02fc0e53df8 519 return gAspInvalidParameter_c;
cotigac 18:b02fc0e53df8 520 }
cotigac 18:b02fc0e53df8 521
cotigac 18:b02fc0e53df8 522 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 523 }
cotigac 18:b02fc0e53df8 524
cotigac 18:b02fc0e53df8 525 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 526 * \brief Send a raw data frame OTA
cotigac 18:b02fc0e53df8 527 *
cotigac 18:b02fc0e53df8 528 * \param[in] dataPtr raw data
cotigac 18:b02fc0e53df8 529 *
cotigac 18:b02fc0e53df8 530 * \return AspStatus_t
cotigac 18:b02fc0e53df8 531 *
cotigac 18:b02fc0e53df8 532 ********************************************************************************** */
cotigac 18:b02fc0e53df8 533 #undef mFuncId_c
cotigac 18:b02fc0e53df8 534 #define mFuncId_c 18
cotigac 18:b02fc0e53df8 535 AspStatus_t ASP_TelecSendRawData(uint8_t* dataPtr)
cotigac 18:b02fc0e53df8 536 {
cotigac 18:b02fc0e53df8 537 uint8_t phyReg;
cotigac 18:b02fc0e53df8 538
cotigac 18:b02fc0e53df8 539 dataPtr[0] += 2; /* Add FCS length to PSDU Length*/
cotigac 18:b02fc0e53df8 540
cotigac 18:b02fc0e53df8 541 // Validate the length
cotigac 18:b02fc0e53df8 542 if(dataPtr[0] > gMaxPHYPacketSize_c)
cotigac 18:b02fc0e53df8 543 return gAspTooLong_c;
cotigac 18:b02fc0e53df8 544
cotigac 18:b02fc0e53df8 545 //Force Idle
cotigac 18:b02fc0e53df8 546 PhyPlmeForceTrxOffRequest();
cotigac 18:b02fc0e53df8 547 AspSetDtsMode(gDtsNormal_c);
cotigac 18:b02fc0e53df8 548 AspDisableBER();
cotigac 18:b02fc0e53df8 549 // Load the TX PB: load the PSDU Lenght byte but not the FCS bytes
cotigac 18:b02fc0e53df8 550 MCR20Drv_PB_SPIBurstWrite(dataPtr, dataPtr[0] + 1 - 2);
cotigac 18:b02fc0e53df8 551 // Program a Tx sequence
cotigac 18:b02fc0e53df8 552 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 553 phyReg |= gTX_c;
cotigac 18:b02fc0e53df8 554 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 555 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 556 }
cotigac 18:b02fc0e53df8 557
cotigac 18:b02fc0e53df8 558 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 559 * \brief Set Telec test mode
cotigac 18:b02fc0e53df8 560 *
cotigac 18:b02fc0e53df8 561 * \param[in] mode Telec test mode
cotigac 18:b02fc0e53df8 562 *
cotigac 18:b02fc0e53df8 563 * \return AspStatus_t
cotigac 18:b02fc0e53df8 564 *
cotigac 18:b02fc0e53df8 565 ********************************************************************************** */
cotigac 18:b02fc0e53df8 566 #undef mFuncId_c
cotigac 18:b02fc0e53df8 567 #define mFuncId_c 19
cotigac 18:b02fc0e53df8 568 AspStatus_t ASP_TelecTest(uint8_t mode)
cotigac 18:b02fc0e53df8 569 {
cotigac 18:b02fc0e53df8 570 uint8_t phyReg;
cotigac 18:b02fc0e53df8 571 static uint8_t aTxContModPattern[2];
cotigac 18:b02fc0e53df8 572 uint8_t channel;
cotigac 18:b02fc0e53df8 573 static bool_t fracSet = FALSE;
cotigac 18:b02fc0e53df8 574
cotigac 18:b02fc0e53df8 575 // Get current channel number
cotigac 18:b02fc0e53df8 576 channel = PhyPlmeGetCurrentChannelRequest(0);
cotigac 18:b02fc0e53df8 577
cotigac 18:b02fc0e53df8 578 if( fracSet )
cotigac 18:b02fc0e53df8 579 {
cotigac 18:b02fc0e53df8 580 ASP_TelecSetFreq(channel);
cotigac 18:b02fc0e53df8 581 fracSet = FALSE;
cotigac 18:b02fc0e53df8 582 }
cotigac 18:b02fc0e53df8 583
cotigac 18:b02fc0e53df8 584 switch( mode )
cotigac 18:b02fc0e53df8 585 {
cotigac 18:b02fc0e53df8 586 case gTestForceIdle_c: //ForceIdle();
cotigac 18:b02fc0e53df8 587 PhyPlmeForceTrxOffRequest();
cotigac 18:b02fc0e53df8 588
cotigac 18:b02fc0e53df8 589 AspSetDtsMode(gDtsNormal_c);
cotigac 18:b02fc0e53df8 590 AspDisableBER();
cotigac 18:b02fc0e53df8 591 break;
cotigac 18:b02fc0e53df8 592
cotigac 18:b02fc0e53df8 593 case gTestPulseTxPrbs9_c: // Continuously transmit a PRBS9 pattern.
cotigac 18:b02fc0e53df8 594 // PLME_PRBS9_Load (); // Load the TX RAM
cotigac 18:b02fc0e53df8 595 AspSetDtsMode(gDtsTxRandomSeq_c);
cotigac 18:b02fc0e53df8 596 //Enable continuous TX mode
cotigac 18:b02fc0e53df8 597 AspEnableBER();
cotigac 18:b02fc0e53df8 598 // Start Tx packet mode with no interrupt on end
cotigac 18:b02fc0e53df8 599 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 600 phyReg |= gTX_c;
cotigac 18:b02fc0e53df8 601 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 602 break;
cotigac 18:b02fc0e53df8 603
cotigac 18:b02fc0e53df8 604 case gTestContinuousRx_c: // Sets the device into continuous RX mode
cotigac 18:b02fc0e53df8 605 AspSetDtsMode(gDtsNormal_c);
cotigac 18:b02fc0e53df8 606 //Enable continuous RX mode
cotigac 18:b02fc0e53df8 607 AspEnableBER();
cotigac 18:b02fc0e53df8 608 // Set length of data in DUAL_PAN_DWELL register
cotigac 18:b02fc0e53df8 609 MCR20Drv_IndirectAccessSPIWrite(DUAL_PAN_DWELL, 127);
cotigac 18:b02fc0e53df8 610 // Start Rx packet mode with no interrupt on end
cotigac 18:b02fc0e53df8 611 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 612 phyReg |= gRX_c;
cotigac 18:b02fc0e53df8 613 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 614 break;
cotigac 18:b02fc0e53df8 615
cotigac 18:b02fc0e53df8 616 case gTestContinuousTxMod_c: // Sets the device to continuously transmit a 10101010 pattern
cotigac 18:b02fc0e53df8 617 AspSetDtsMode(gDtsNormal_c);
cotigac 18:b02fc0e53df8 618 //Enable continuous TX mode
cotigac 18:b02fc0e53df8 619 AspEnableBER();
cotigac 18:b02fc0e53df8 620 //Prepare TX operation
cotigac 18:b02fc0e53df8 621 aTxContModPattern[0] = 1;
cotigac 18:b02fc0e53df8 622 aTxContModPattern[1] = 0xAA;
cotigac 18:b02fc0e53df8 623 // Load the TX PB
cotigac 18:b02fc0e53df8 624 MCR20Drv_PB_SPIBurstWrite(aTxContModPattern, aTxContModPattern[0] + 1);
cotigac 18:b02fc0e53df8 625 // Program a Tx sequence
cotigac 18:b02fc0e53df8 626 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 627 phyReg |= gTX_c;
cotigac 18:b02fc0e53df8 628 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 629 break;
cotigac 18:b02fc0e53df8 630
cotigac 18:b02fc0e53df8 631 case gTestContinuousTxNoMod_c: // Sets the device to continuously transmit an unmodulated CW
cotigac 18:b02fc0e53df8 632 //Enable unmodulated TX
cotigac 18:b02fc0e53df8 633 AspSetDtsMode(gDtsTxOne_c);
cotigac 18:b02fc0e53df8 634 //Enable continuous TX mode
cotigac 18:b02fc0e53df8 635 AspEnableBER();
cotigac 18:b02fc0e53df8 636 MCR20Drv_DirectAccessSPIMultiByteWrite(PLL_FRAC0_LSB, (uint8_t *) &asp_pll_frac[channel - 11], 2);
cotigac 18:b02fc0e53df8 637 fracSet = TRUE;
cotigac 18:b02fc0e53df8 638 // Program a Tx sequence
cotigac 18:b02fc0e53df8 639 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 640 phyReg |= gTX_c;
cotigac 18:b02fc0e53df8 641 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 642 break;
cotigac 18:b02fc0e53df8 643
cotigac 18:b02fc0e53df8 644 case gTestContinuousTx2Mhz_c:
cotigac 18:b02fc0e53df8 645 AspSetDtsMode(gDtsTx2Mhz_c);
cotigac 18:b02fc0e53df8 646 //Enable continuous TX mode
cotigac 18:b02fc0e53df8 647 AspEnableBER();
cotigac 18:b02fc0e53df8 648 // Program a Tx sequence
cotigac 18:b02fc0e53df8 649 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 650 phyReg |= gTX_c;
cotigac 18:b02fc0e53df8 651 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 652 break;
cotigac 18:b02fc0e53df8 653
cotigac 18:b02fc0e53df8 654 case gTestContinuousTx200Khz_c:
cotigac 18:b02fc0e53df8 655 AspSetDtsMode(gDtsTx200Khz_c);
cotigac 18:b02fc0e53df8 656 //Enable continuous TX mode
cotigac 18:b02fc0e53df8 657 AspEnableBER();
cotigac 18:b02fc0e53df8 658 // Program a Tx sequence
cotigac 18:b02fc0e53df8 659 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 660 phyReg |= gTX_c;
cotigac 18:b02fc0e53df8 661 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 662 break;
cotigac 18:b02fc0e53df8 663
cotigac 18:b02fc0e53df8 664 case gTestContinuousTx1MbpsPRBS9_c:
cotigac 18:b02fc0e53df8 665 AspSetDtsMode(gDtsTx1MbpsPRBS9_c);
cotigac 18:b02fc0e53df8 666 //Enable continuous TX mode
cotigac 18:b02fc0e53df8 667 AspEnableBER();
cotigac 18:b02fc0e53df8 668 // Program a Tx sequence
cotigac 18:b02fc0e53df8 669 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 670 phyReg |= gTX_c;
cotigac 18:b02fc0e53df8 671 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 672 break;
cotigac 18:b02fc0e53df8 673
cotigac 18:b02fc0e53df8 674 case gTestContinuousTxExternalSrc_c:
cotigac 18:b02fc0e53df8 675 AspSetDtsMode(gDtsTxExternalSrc_c);
cotigac 18:b02fc0e53df8 676 //Enable continuous TX mode
cotigac 18:b02fc0e53df8 677 AspEnableBER();
cotigac 18:b02fc0e53df8 678 // Program a Tx sequence
cotigac 18:b02fc0e53df8 679 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 680 phyReg |= gTX_c;
cotigac 18:b02fc0e53df8 681 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 682 break;
cotigac 18:b02fc0e53df8 683
cotigac 18:b02fc0e53df8 684 case gTestContinuousTxNoModZero_c:
cotigac 18:b02fc0e53df8 685 //Enable unmodulated TX
cotigac 18:b02fc0e53df8 686 AspSetDtsMode(gDtsTxZero_c);
cotigac 18:b02fc0e53df8 687 //Enable continuous TX mode
cotigac 18:b02fc0e53df8 688 AspEnableBER();
cotigac 18:b02fc0e53df8 689 // Program a Tx sequence
cotigac 18:b02fc0e53df8 690 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 691 phyReg |= gTX_c;
cotigac 18:b02fc0e53df8 692 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 693 break;
cotigac 18:b02fc0e53df8 694
cotigac 18:b02fc0e53df8 695 case gTestContinuousTxNoModOne_c:
cotigac 18:b02fc0e53df8 696 //Enable unmodulated TX
cotigac 18:b02fc0e53df8 697 AspSetDtsMode(gDtsTxOne_c);
cotigac 18:b02fc0e53df8 698 //Enable continuous TX mode
cotigac 18:b02fc0e53df8 699 AspEnableBER();
cotigac 18:b02fc0e53df8 700 // Program a Tx sequence
cotigac 18:b02fc0e53df8 701 phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1);
cotigac 18:b02fc0e53df8 702 phyReg |= gTX_c;
cotigac 18:b02fc0e53df8 703 MCR20Drv_DirectAccessSPIWrite( (uint8_t) PHY_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 704 break;
cotigac 18:b02fc0e53df8 705 }
cotigac 18:b02fc0e53df8 706
cotigac 18:b02fc0e53df8 707 return gAspSuccess_c;
cotigac 18:b02fc0e53df8 708 }
cotigac 18:b02fc0e53df8 709
cotigac 18:b02fc0e53df8 710 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 711 * \brief Return the instance of the PHY associated with the FSCI interface
cotigac 18:b02fc0e53df8 712 *
cotigac 18:b02fc0e53df8 713 * \param[in] interfaceId FSCI interface
cotigac 18:b02fc0e53df8 714 *
cotigac 18:b02fc0e53df8 715 * \return insance
cotigac 18:b02fc0e53df8 716 *
cotigac 18:b02fc0e53df8 717 ********************************************************************************** */
cotigac 18:b02fc0e53df8 718 #if gFsciIncluded_c
cotigac 18:b02fc0e53df8 719 #undef mFuncId_c
cotigac 18:b02fc0e53df8 720 #define mFuncId_c 20
cotigac 18:b02fc0e53df8 721 static uint32_t getPhyInstance( uint32_t interfaceId )
cotigac 18:b02fc0e53df8 722 {
cotigac 18:b02fc0e53df8 723 uint32_t i;
cotigac 18:b02fc0e53df8 724
cotigac 18:b02fc0e53df8 725 for( i=0; i<gPhyInstancesCnt_c; i++ )
cotigac 18:b02fc0e53df8 726 if( mAspFsciBinding[i] == interfaceId )
cotigac 18:b02fc0e53df8 727 return i;
cotigac 18:b02fc0e53df8 728
cotigac 18:b02fc0e53df8 729 return 0;
cotigac 18:b02fc0e53df8 730 }
cotigac 18:b02fc0e53df8 731
cotigac 18:b02fc0e53df8 732 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 733 * \brief Handle ASP requests received from FSCI
cotigac 18:b02fc0e53df8 734 *
cotigac 18:b02fc0e53df8 735 * \param[in] pData monitored message
cotigac 18:b02fc0e53df8 736 * \param[in] param
cotigac 18:b02fc0e53df8 737 * \param[in] interfaceId FSCI interface
cotigac 18:b02fc0e53df8 738 *
cotigac 18:b02fc0e53df8 739 ********************************************************************************** */
cotigac 18:b02fc0e53df8 740 #undef mFuncId_c
cotigac 18:b02fc0e53df8 741 #define mFuncId_c 21
cotigac 18:b02fc0e53df8 742 static void fsciAspReqHandler(void *pData, void* param, uint32_t interfaceId)
cotigac 18:b02fc0e53df8 743 {
cotigac 18:b02fc0e53df8 744 clientPacket_t *pClientPacket = ((clientPacket_t*)pData);
cotigac 18:b02fc0e53df8 745 uint8_t *pMsg = pClientPacket->structured.payload;
cotigac 18:b02fc0e53df8 746
cotigac 18:b02fc0e53df8 747 pMsg -= sizeof(AppAspMsgType_t);
cotigac 18:b02fc0e53df8 748 ((AppToAspMessage_t*)pMsg)->msgType = (AppAspMsgType_t)pClientPacket->structured.header.opCode;
cotigac 18:b02fc0e53df8 749
cotigac 18:b02fc0e53df8 750 APP_ASP_SapHandler( (AppToAspMessage_t*)pMsg, getPhyInstance( interfaceId ) );
cotigac 18:b02fc0e53df8 751 MEM_BufferFree(pData);
cotigac 18:b02fc0e53df8 752 }
cotigac 18:b02fc0e53df8 753
cotigac 18:b02fc0e53df8 754 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 755 * \brief Monitor the ASP Requests and Responses
cotigac 18:b02fc0e53df8 756 *
cotigac 18:b02fc0e53df8 757 * \param[in] pData monitored message
cotigac 18:b02fc0e53df8 758 * \param[in] param
cotigac 18:b02fc0e53df8 759 * \param[in] interfaceId FSCI interface
cotigac 18:b02fc0e53df8 760 *
cotigac 18:b02fc0e53df8 761 * \return AspStatus_t
cotigac 18:b02fc0e53df8 762 *
cotigac 18:b02fc0e53df8 763 ********************************************************************************** */
cotigac 18:b02fc0e53df8 764 #undef mFuncId_c
cotigac 18:b02fc0e53df8 765 #define mFuncId_c 22
cotigac 18:b02fc0e53df8 766 static void AspSapMonitor(void *pData, void* param, uint32_t interfaceId)
cotigac 18:b02fc0e53df8 767 {
cotigac 18:b02fc0e53df8 768 clientPacket_t *pFsciPacket = MEM_BufferAlloc( sizeof(clientPacket_t) );
cotigac 18:b02fc0e53df8 769 AppToAspMessage_t *pReq = (AppToAspMessage_t*)pData;
cotigac 18:b02fc0e53df8 770 uint8_t *p;
cotigac 18:b02fc0e53df8 771
cotigac 18:b02fc0e53df8 772 if( NULL == pFsciPacket )
cotigac 18:b02fc0e53df8 773 {
cotigac 18:b02fc0e53df8 774 FSCI_Error( gFsciOutOfMessages_c, interfaceId );
cotigac 18:b02fc0e53df8 775 return;
cotigac 18:b02fc0e53df8 776 }
cotigac 18:b02fc0e53df8 777
cotigac 18:b02fc0e53df8 778 p = pFsciPacket->structured.payload;
cotigac 18:b02fc0e53df8 779
cotigac 18:b02fc0e53df8 780 if( NULL == param ) // Requests
cotigac 18:b02fc0e53df8 781 {
cotigac 18:b02fc0e53df8 782 pFsciPacket->structured.header.opGroup = gFSCI_AppAspOpcodeGroup_c;
cotigac 18:b02fc0e53df8 783 pFsciPacket->structured.header.opCode = pReq->msgType;
cotigac 18:b02fc0e53df8 784
cotigac 18:b02fc0e53df8 785 switch( pReq->msgType )
cotigac 18:b02fc0e53df8 786 {
cotigac 18:b02fc0e53df8 787 case aspMsgTypeGetTimeReq_c:
cotigac 18:b02fc0e53df8 788 break;
cotigac 18:b02fc0e53df8 789 case aspMsgTypeXcvrWriteReq_c:
cotigac 18:b02fc0e53df8 790 case aspMsgTypeXcvrReadReq_c:
cotigac 18:b02fc0e53df8 791 *p++ = pReq->msgData.aspXcvrData.mode;
cotigac 18:b02fc0e53df8 792 *((uint16_t*)p) = pReq->msgData.aspXcvrData.addr;
cotigac 18:b02fc0e53df8 793 p += sizeof(uint16_t);
cotigac 18:b02fc0e53df8 794 *p++ = pReq->msgData.aspXcvrData.len;
cotigac 18:b02fc0e53df8 795 if( pReq->msgType == aspMsgTypeXcvrWriteReq_c )
cotigac 18:b02fc0e53df8 796 {
cotigac 18:b02fc0e53df8 797 FLib_MemCpy( p, pReq->msgData.aspXcvrData.data,
cotigac 18:b02fc0e53df8 798 pReq->msgData.aspXcvrData.len );
cotigac 18:b02fc0e53df8 799 p += pReq->msgData.aspXcvrData.len;
cotigac 18:b02fc0e53df8 800 }
cotigac 18:b02fc0e53df8 801 break;
cotigac 18:b02fc0e53df8 802 case aspMsgTypeSetFADState_c:
cotigac 18:b02fc0e53df8 803 FLib_MemCpy( p, &pReq->msgData.aspFADState, sizeof(pReq->msgData.aspFADState) );
cotigac 18:b02fc0e53df8 804 p += sizeof(pReq->msgData.aspFADState);
cotigac 18:b02fc0e53df8 805 break;
cotigac 18:b02fc0e53df8 806 case aspMsgTypeSetFADThreshold_c:
cotigac 18:b02fc0e53df8 807 FLib_MemCpy( p, &pReq->msgData.aspFADThreshold, sizeof(pReq->msgData.aspFADThreshold) );
cotigac 18:b02fc0e53df8 808 p += sizeof(pReq->msgData.aspFADThreshold);
cotigac 18:b02fc0e53df8 809 break;
cotigac 18:b02fc0e53df8 810 case aspMsgTypeSetANTXState_c:
cotigac 18:b02fc0e53df8 811 FLib_MemCpy( p, &pReq->msgData.aspANTXState, sizeof(pReq->msgData.aspANTXState) );
cotigac 18:b02fc0e53df8 812 p += sizeof(pReq->msgData.aspANTXState);
cotigac 18:b02fc0e53df8 813 break;
cotigac 18:b02fc0e53df8 814 case aspMsgTypeGetANTXState_c:
cotigac 18:b02fc0e53df8 815 /* Nothing to do here */
cotigac 18:b02fc0e53df8 816 break;
cotigac 18:b02fc0e53df8 817
cotigac 18:b02fc0e53df8 818 case aspMsgTypeSetPowerLevel_c:
cotigac 18:b02fc0e53df8 819 FLib_MemCpy( p, &pReq->msgData.aspSetPowerLevelReq, sizeof(pReq->msgData.aspSetPowerLevelReq) );
cotigac 18:b02fc0e53df8 820 p += sizeof(pReq->msgData.aspSetPowerLevelReq);
cotigac 18:b02fc0e53df8 821 break;
cotigac 18:b02fc0e53df8 822 case aspMsgTypeGetPowerLevel_c:
cotigac 18:b02fc0e53df8 823 /* Nothing to do here */
cotigac 18:b02fc0e53df8 824 break;
cotigac 18:b02fc0e53df8 825 case aspMsgTypeTelecSetFreq_c:
cotigac 18:b02fc0e53df8 826 FLib_MemCpy( p, &pReq->msgData.aspTelecsetFreq, sizeof(pReq->msgData.aspTelecsetFreq) );
cotigac 18:b02fc0e53df8 827 p += sizeof(pReq->msgData.aspTelecsetFreq);
cotigac 18:b02fc0e53df8 828 break;
cotigac 18:b02fc0e53df8 829 case aspMsgTypeTelecSendRawData_c:
cotigac 18:b02fc0e53df8 830 FLib_MemCpy( p, &pReq->msgData.aspTelecSendRawData, sizeof(pReq->msgData.aspTelecSendRawData) );
cotigac 18:b02fc0e53df8 831 p += sizeof(pReq->msgData.aspTelecSendRawData);
cotigac 18:b02fc0e53df8 832 break;
cotigac 18:b02fc0e53df8 833 case aspMsgTypeTelecTest_c:
cotigac 18:b02fc0e53df8 834 FLib_MemCpy( p, &pReq->msgData.aspTelecTest, sizeof(pReq->msgData.aspTelecTest) );
cotigac 18:b02fc0e53df8 835 p += sizeof(pReq->msgData.aspTelecTest);
cotigac 18:b02fc0e53df8 836 break;
cotigac 18:b02fc0e53df8 837 case aspMsgTypeSetLQIMode_c:
cotigac 18:b02fc0e53df8 838 FLib_MemCpy(p, &pReq->msgData.aspLQIMode, sizeof(pReq->msgData.aspLQIMode) );
cotigac 18:b02fc0e53df8 839 p += sizeof(pReq->msgData.aspLQIMode);
cotigac 18:b02fc0e53df8 840 break;
cotigac 18:b02fc0e53df8 841 case aspMsgTypeGetRSSILevel_c:
cotigac 18:b02fc0e53df8 842 /* Nothing to do here */
cotigac 18:b02fc0e53df8 843 break;
cotigac 18:b02fc0e53df8 844 }
cotigac 18:b02fc0e53df8 845 }
cotigac 18:b02fc0e53df8 846 else // Confirms / Indications
cotigac 18:b02fc0e53df8 847 {
cotigac 18:b02fc0e53df8 848 pFsciPacket->structured.header.opGroup = gFSCI_AspAppOpcodeGroup_c;
cotigac 18:b02fc0e53df8 849 pFsciPacket->structured.header.opCode = pReq->msgType;
cotigac 18:b02fc0e53df8 850
cotigac 18:b02fc0e53df8 851 *p++ = *((uint8_t*)param);/* copy status */
cotigac 18:b02fc0e53df8 852
cotigac 18:b02fc0e53df8 853 switch( pReq->msgType )
cotigac 18:b02fc0e53df8 854 {
cotigac 18:b02fc0e53df8 855 case aspMsgTypeGetTimeReq_c:
cotigac 18:b02fc0e53df8 856 FLib_MemCpy( p, &pReq->msgData.aspGetTimeReq.time , sizeof(aspEventReq_t) );
cotigac 18:b02fc0e53df8 857 p += sizeof(aspEventReq_t);
cotigac 18:b02fc0e53df8 858 break;
cotigac 18:b02fc0e53df8 859 case aspMsgTypeGetMpmConfig_c:
cotigac 18:b02fc0e53df8 860 FLib_MemCpy( p, &pReq->msgData.MpmConfig , sizeof(mpmConfig_t) );
cotigac 18:b02fc0e53df8 861 p += sizeof(mpmConfig_t);
cotigac 18:b02fc0e53df8 862 break;
cotigac 18:b02fc0e53df8 863 case aspMsgTypeXcvrReadReq_c:
cotigac 18:b02fc0e53df8 864 *p++ = pReq->msgData.aspXcvrData.len; /* copy length */
cotigac 18:b02fc0e53df8 865 FLib_MemCpy( p, pReq->msgData.aspXcvrData.data, pReq->msgData.aspXcvrData.len );
cotigac 18:b02fc0e53df8 866 p += pReq->msgData.aspXcvrData.len;
cotigac 18:b02fc0e53df8 867 break;
cotigac 18:b02fc0e53df8 868 }
cotigac 18:b02fc0e53df8 869
cotigac 18:b02fc0e53df8 870 }
cotigac 18:b02fc0e53df8 871
cotigac 18:b02fc0e53df8 872 /* Send data over the serial interface */
cotigac 18:b02fc0e53df8 873 pFsciPacket->structured.header.len = (fsciLen_t)(p - pFsciPacket->structured.payload);
cotigac 18:b02fc0e53df8 874
cotigac 18:b02fc0e53df8 875 if ( pFsciPacket->structured.header.len )
cotigac 18:b02fc0e53df8 876 FSCI_transmitFormatedPacket( pFsciPacket, interfaceId );
cotigac 18:b02fc0e53df8 877 else
cotigac 18:b02fc0e53df8 878 MEM_BufferFree( pFsciPacket );
cotigac 18:b02fc0e53df8 879 }
cotigac 18:b02fc0e53df8 880
cotigac 18:b02fc0e53df8 881 #endif /* gFsciIncluded_c */
cotigac 18:b02fc0e53df8 882
cotigac 18:b02fc0e53df8 883
cotigac 18:b02fc0e53df8 884 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 885 * \brief Set the Tx data source selector
cotigac 18:b02fc0e53df8 886 *
cotigac 18:b02fc0e53df8 887 * \param[in] mode
cotigac 18:b02fc0e53df8 888 *
cotigac 18:b02fc0e53df8 889 * \return AspStatus_t
cotigac 18:b02fc0e53df8 890 *
cotigac 18:b02fc0e53df8 891 ********************************************************************************** */
cotigac 18:b02fc0e53df8 892 phyStatus_t AspSetDtsMode(uint8_t mode)
cotigac 18:b02fc0e53df8 893 {
cotigac 18:b02fc0e53df8 894 uint8_t phyReg;
cotigac 18:b02fc0e53df8 895
cotigac 18:b02fc0e53df8 896 phyReg = MCR20Drv_IndirectAccessSPIRead(TX_MODE_CTRL);
cotigac 18:b02fc0e53df8 897 phyReg &= ~cTX_MODE_CTRL_DTS_MASK; // Clear DTS_MODE
cotigac 18:b02fc0e53df8 898 phyReg |= mode; // Set new DTS_MODE
cotigac 18:b02fc0e53df8 899 MCR20Drv_IndirectAccessSPIWrite(TX_MODE_CTRL, phyReg);
cotigac 18:b02fc0e53df8 900
cotigac 18:b02fc0e53df8 901 return gPhySuccess_c;
cotigac 18:b02fc0e53df8 902 }
cotigac 18:b02fc0e53df8 903
cotigac 18:b02fc0e53df8 904 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 905 * \brief Enable XCVR test mode
cotigac 18:b02fc0e53df8 906 *
cotigac 18:b02fc0e53df8 907 * \return AspStatus_t
cotigac 18:b02fc0e53df8 908 *
cotigac 18:b02fc0e53df8 909 ********************************************************************************** */
cotigac 18:b02fc0e53df8 910 phyStatus_t AspEnableBER()
cotigac 18:b02fc0e53df8 911 {
cotigac 18:b02fc0e53df8 912 uint8_t phyReg;
cotigac 18:b02fc0e53df8 913
cotigac 18:b02fc0e53df8 914 phyReg = MCR20Drv_IndirectAccessSPIRead(DTM_CTRL1);
cotigac 18:b02fc0e53df8 915 phyReg |= cDTM_CTRL1_DTM_EN;
cotigac 18:b02fc0e53df8 916 MCR20Drv_IndirectAccessSPIWrite(DTM_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 917
cotigac 18:b02fc0e53df8 918 phyReg = MCR20Drv_IndirectAccessSPIRead(TESTMODE_CTRL);
cotigac 18:b02fc0e53df8 919 phyReg |= cTEST_MODE_CTRL_CONTINUOUS_EN | cTEST_MODE_CTRL_IDEAL_PFC_EN;
cotigac 18:b02fc0e53df8 920 MCR20Drv_IndirectAccessSPIWrite(TESTMODE_CTRL, phyReg);
cotigac 18:b02fc0e53df8 921
cotigac 18:b02fc0e53df8 922 return gPhySuccess_c;
cotigac 18:b02fc0e53df8 923 }
cotigac 18:b02fc0e53df8 924
cotigac 18:b02fc0e53df8 925 /*! *********************************************************************************
cotigac 18:b02fc0e53df8 926 * \brief Disable XCVR test mode
cotigac 18:b02fc0e53df8 927 *
cotigac 18:b02fc0e53df8 928 ********************************************************************************** */
cotigac 18:b02fc0e53df8 929 void AspDisableBER()
cotigac 18:b02fc0e53df8 930 {
cotigac 18:b02fc0e53df8 931 uint8_t phyReg;
cotigac 18:b02fc0e53df8 932
cotigac 18:b02fc0e53df8 933 phyReg = MCR20Drv_IndirectAccessSPIRead(DTM_CTRL1);
cotigac 18:b02fc0e53df8 934 phyReg &= ~cDTM_CTRL1_DTM_EN;
cotigac 18:b02fc0e53df8 935 MCR20Drv_IndirectAccessSPIWrite(DTM_CTRL1, phyReg);
cotigac 18:b02fc0e53df8 936
cotigac 18:b02fc0e53df8 937 phyReg = MCR20Drv_IndirectAccessSPIRead(TESTMODE_CTRL);
cotigac 18:b02fc0e53df8 938 phyReg &= ~(cTEST_MODE_CTRL_CONTINUOUS_EN | cTEST_MODE_CTRL_IDEAL_PFC_EN);
cotigac 18:b02fc0e53df8 939 MCR20Drv_IndirectAccessSPIWrite(TESTMODE_CTRL, phyReg);
cotigac 18:b02fc0e53df8 940 }
cotigac 18:b02fc0e53df8 941
cotigac 18:b02fc0e53df8 942
cotigac 18:b02fc0e53df8 943 #endif /* gAspCapability_d */
cotigac 18:b02fc0e53df8 944