NXP / Mbed 2 deprecated mcr20_connectivity_test

Dependencies:   fsl_phy_mcr20a fsl_smac mbed-rtos mbed

Fork of mcr20_connectivity_test by Freescale

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Connectivity_Test_Platform.c Source File

Connectivity_Test_Platform.c

00001 /*!
00002 * Copyright (c) 2015, Freescale Semiconductor, Inc.
00003 * All rights reserved.
00004 *
00005 * \file App_Custom.c
00006 *
00007 * Redistribution and use in source and binary forms, with or without modification,
00008 * are permitted provided that the following conditions are met:
00009 *
00010 * o Redistributions of source code must retain the above copyright notice, this list
00011 *   of conditions and the following disclaimer.
00012 *
00013 * o Redistributions in binary form must reproduce the above copyright notice, this
00014 *   list of conditions and the following disclaimer in the documentation and/or
00015 *   other materials provided with the distribution.
00016 *
00017 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
00018 *   contributors may be used to endorse or promote products derived from this
00019 *   software without specific prior written permission.
00020 *
00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00022 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00023 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00024 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00025 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00026 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00027 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00028 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00029 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00030 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031 */
00032 
00033 /************************************************************************************
00034 *************************************************************************************
00035 * Include
00036 *************************************************************************************
00037 ************************************************************************************/
00038 #include "Connectivity_Test_Platform.h"
00039 
00040 /************************************************************************************
00041 *************************************************************************************
00042 * Macros
00043 *************************************************************************************
00044 ************************************************************************************/
00045 #define gCTSelf_EVENT_c (1<<7)
00046 #define SelfNotificationEvent() (OSA_EventSet(&gTaskEvent, gCTSelf_EVENT_c));
00047 
00048 /************************************************************************************
00049 *************************************************************************************
00050 * Public memory declarations
00051 *************************************************************************************
00052 ************************************************************************************/
00053 
00054 /************************************************************************************
00055 *************************************************************************************
00056 * Public memory declarations
00057 *************************************************************************************
00058 ************************************************************************************/
00059 const registerLimits_t registerIntervals[] = 
00060 {
00061   {.regStart=0x00 , .regEnd=0x26, TRUE},
00062   {.regStart=0x28 , .regEnd=0x3F, TRUE},
00063   {.regStart=0x00 , .regEnd=0x28, FALSE},
00064   {.regStart=0x2A , .regEnd=0x2E, FALSE},
00065   {.regStart=0x30 , .regEnd=0x32, FALSE},
00066   {.regStart=0x34 , .regEnd=0x45, FALSE},
00067   {.regStart=0x47 , .regEnd=0x56, FALSE},
00068   {.regStart=0x58 , .regEnd=0x5B, FALSE},
00069   {.regStart=0x5D , .regEnd=0x6B, FALSE},
00070   {.regStart=0x6E , .regEnd=0x71, FALSE},
00071   {.regStart=0x74 , .regEnd=0x75, FALSE},
00072   {.regStart=0x78 , .regEnd=0x83, FALSE},
00073   {.regStart=0x86 , .regEnd=0x86, FALSE},
00074   {.regStart=0x89 , .regEnd=0x8A, FALSE},
00075   {.regStart=0x8D , .regEnd=0x8E, FALSE},
00076   {.regStart=0x91 , .regEnd=0x97, FALSE},
00077   {.regStart=0x9A , .regEnd=0xA1, FALSE},
00078   {.regStart=0xA3 , .regEnd=0xA8, FALSE},
00079   {.regStart=0xAA , .regEnd=0xAF, FALSE},
00080   {.regStart=0xB2 , .regEnd=0xB6, FALSE},
00081   {.regStart=0xFE , .regEnd=0xFF, FALSE},
00082   {.regStart=0x00 , .regEnd=0x00, FALSE}
00083 };
00084 
00085 uint8_t u8Prbs9Buffer[] =
00086 {
00087   0x42,
00088   0xff,0xc1,0xfb,0xe8,0x4c,0x90,0x72,0x8b,0xe7,0xb3,0x51,0x89,0x63,0xab,0x23,0x23,  
00089   0x02,0x84,0x18,0x72,0xaa,0x61,0x2f,0x3b,0x51,0xa8,0xe5,0x37,0x49,0xfb,0xc9,0xca,
00090   0x0c,0x18,0x53,0x2c,0xfd,0x45,0xe3,0x9a,0xe6,0xf1,0x5d,0xb0,0xb6,0x1b,0xb4,0xbe,
00091   0x2a,0x50,0xea,0xe9,0x0e,0x9c,0x4b,0x5e,0x57,0x24,0xcc,0xa1,0xb7,0x59,0xb8,0x87
00092 };
00093 /************************************************************************************
00094 *************************************************************************************
00095 * Private function prototypes
00096 *************************************************************************************
00097 ************************************************************************************/
00098 
00099 /************************************************************************************
00100 *
00101 * InitApp_custom
00102 *
00103 ************************************************************************************/
00104 void InitApp_custom()
00105 {
00106 }
00107 
00108 /************************************************************************************
00109 *
00110 * InitProject_custom
00111 *
00112 ************************************************************************************/
00113 void InitProject_custom()
00114 {
00115 }
00116 
00117 /************************************************************************************
00118 *
00119 * ShortCutsParser
00120 *
00121 * Performs changes in different menus whenever shortcuts are allowed
00122 *
00123 ************************************************************************************/
00124 void ShortCutsParser(uint8_t u8UartData)
00125 {
00126   evTestParameters = TRUE;
00127   evDataFromUART = FALSE;
00128   switch(u8UartData){
00129   case 't':
00130     testOpMode = mTxOperation_c;
00131     break;
00132   case 'r':
00133     testOpMode = mRxOperation_c;
00134     break;
00135   case 'q': 
00136     if(testChannel == (channels_t)gTotalChannels)
00137     {
00138       testChannel = gChannel11_c;
00139     }
00140     else
00141     {
00142       testChannel++;
00143     }
00144     break;
00145   case 'w':
00146     if(testChannel == gChannel11_c)
00147     {
00148       testChannel = (channels_t)gTotalChannels;
00149     }
00150     else
00151     {
00152       testChannel--;
00153     }
00154     break;
00155   case 'a':
00156     testPower++;
00157     if(gMaxOutputPower_c < testPower)
00158     {
00159       testPower = gMinOutputPower_c;
00160     }
00161     break;
00162   case 's':
00163     if(testPower == gMinOutputPower_c)
00164     {
00165       testPower = gMaxOutputPower_c;
00166     }
00167     else
00168     {
00169       testPower--;  
00170     }
00171     break;
00172   case 'n':
00173     testPayloadLen++;
00174     if(gMaxSmacSDULength_c < testPayloadLen)
00175     {
00176       testPayloadLen = 17;
00177     }    
00178     break;
00179   case 'm':
00180     testPayloadLen--;
00181     if(17 > testPayloadLen)
00182     {
00183       testPayloadLen = gMaxSmacSDULength_c;
00184     }    
00185     break;
00186   case 'k':
00187     ccaThresh++;
00188     if(ccaThresh > gMaxCCAThreshold_c)
00189     {
00190       ccaThresh = gMinCCAThreshold_c;
00191     }
00192     break;
00193   case 'l':
00194     ccaThresh--;
00195     if(ccaThresh > gMaxCCAThreshold_c)
00196     {
00197       ccaThresh = gMaxCCAThreshold_c;
00198     }
00199     break;
00200   default:
00201     evDataFromUART = TRUE;
00202     evTestParameters = FALSE;
00203     break;
00204   }
00205 }