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
PhyDebug.c
00001 /*! 00002 * Copyright (c) 2015, Freescale Semiconductor, Inc. 00003 * All rights reserved. 00004 * 00005 * \file PhyDebug.c 00006 * MCR20: PHY debug and logging functions 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 00035 /************************************************************************************ 00036 ************************************************************************************* 00037 * Includes 00038 ************************************************************************************* 00039 ************************************************************************************/ 00040 00041 #include "EmbeddedTypes.h " 00042 //#include "PortConfig.h" 00043 #include "MCR20Drv.h " 00044 #include "MCR20Reg.h" 00045 #include "Phy.h " 00046 #include "PhyDebug.h " 00047 00048 00049 #ifdef MAC_PHY_DEBUG 00050 00051 00052 /************************************************************************************ 00053 ************************************************************************************* 00054 * Private memory declarations 00055 ************************************************************************************* 00056 ************************************************************************************/ 00057 00058 uint16_t nDebugIndex = 0, nDebugSize = DEBUG_LOG_ENTRIES * 4; 00059 uint8_t nDebugStorage[DEBUG_LOG_ENTRIES * 4]; 00060 00061 00062 /************************************************************************************ 00063 ************************************************************************************* 00064 * Public functions 00065 ************************************************************************************* 00066 ************************************************************************************/ 00067 00068 void PhyDebugLogTime(uint8_t item) 00069 { 00070 uint32_t time; 00071 nDebugStorage[nDebugIndex + 0] = item; 00072 MCR20Drv_DirectAccessSPIMultiByteRead( (uint8_t) EVENT_TMR_LSB, (uint8_t *) &time, 3); 00073 00074 nDebugStorage[nDebugIndex + 3] = (uint8_t) (time >> 0); 00075 nDebugStorage[nDebugIndex + 2] = (uint8_t) (time >> 8); 00076 nDebugStorage[nDebugIndex + 1] = (uint8_t) (time >> 16); 00077 00078 nDebugIndex += 4; 00079 if(nDebugIndex >= nDebugSize) 00080 { 00081 nDebugIndex = 0; 00082 } 00083 } 00084 00085 /***********************************************************************************/ 00086 00087 void PhyDebugLogParam1(uint8_t item, uint8_t param1) 00088 { 00089 nDebugStorage[nDebugIndex + 0] = item; 00090 nDebugStorage[nDebugIndex + 1] = param1; 00091 nDebugStorage[nDebugIndex + 2] = 0; 00092 nDebugStorage[nDebugIndex + 3] = 0; 00093 00094 nDebugIndex += 4; 00095 if(nDebugIndex >= nDebugSize) 00096 { 00097 nDebugIndex = 0; 00098 } 00099 } 00100 00101 /***********************************************************************************/ 00102 00103 void PhyDebugLogParam2(uint8_t item, uint8_t param1, uint8_t param2) 00104 { 00105 nDebugStorage[nDebugIndex + 0] = item; 00106 nDebugStorage[nDebugIndex + 1] = param1; 00107 nDebugStorage[nDebugIndex + 2] = param2; 00108 nDebugStorage[nDebugIndex + 3] = 0; 00109 00110 nDebugIndex += 4; 00111 if(nDebugIndex >= nDebugSize) 00112 { 00113 nDebugIndex = 0; 00114 } 00115 } 00116 00117 /***********************************************************************************/ 00118 00119 void PhyDebugLogParam3(uint8_t item, uint8_t param1, uint8_t param2, uint8_t param3) 00120 { 00121 nDebugStorage[nDebugIndex + 0] = item; 00122 nDebugStorage[nDebugIndex + 1] = param1; 00123 nDebugStorage[nDebugIndex + 2] = param2; 00124 nDebugStorage[nDebugIndex + 3] = param3; 00125 00126 nDebugIndex += 4; 00127 if(nDebugIndex >= nDebugSize) 00128 { 00129 nDebugIndex = 0; 00130 } 00131 } 00132 00133 /***********************************************************************************/ 00134 00135 #endif /* MAC_PHY_DEBUG */ 00136 00137
Generated on Fri Jul 15 2022 21:41:17 by
