00001 /* 00002 * edma3_log.h 00003 * 00004 * EDMA3 logging/tracing service 00005 * 00006 * Copyright (C) 2009 Texas Instruments Incorporated - https://www.ti.com/ 00007 * 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * 00016 * Redistributions in binary form must reproduce the above copyright 00017 * notice, this list of conditions and the following disclaimer in the 00018 * documentation and/or other materials provided with the 00019 * distribution. 00020 * 00021 * Neither the name of Texas Instruments Incorporated nor the names of 00022 * its contributors may be used to endorse or promote products derived 00023 * from this software without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00026 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00027 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00028 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00029 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00030 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00031 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00032 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00033 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00034 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00035 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 * 00037 */ 00038 00039 #ifndef _EDMA3_LOG_H_ 00040 #define _EDMA3_LOG_H_ 00041 00042 #include <std.h> 00043 #include <log.h> 00044 00045 #ifdef __cplusplus 00046 extern "C" { 00047 #endif 00048 00055 00056 /* 00057 Note : This header file is used to BIOS logs only. For porting purposes this 00058 file need to replace EDMA3_LOG_EVENT macro. 00059 00060 This header file uses log format as defined by Socrates Instrumentation. 00061 Any change in the file will result in incorrect interpretation by Socrates Tool. 00062 00063 BIOS Log Format 00064 ------------------------------------------------------------------------------- 00065 | TimeStamp | Sequence # | Event # | Event Descriptor | Data1 | Data2 | Data3 | 00066 | (2 words) | by BIOS | by BIOS | | | | | 00067 ------------------------------------------------------------------------------- 00068 00069 LogBuffer: A single log buffer called DVTEvent_Log will be used for all event logs 00070 TimeStamp: Automatically inserted by BIOS Log_Printf4. 00071 Sequence #: Automatically inserted by BIOS Log_Printf4. This is used to detect data loss. 00072 Event: Name to uniquely identify event. This is the name that will be used in the visualization. 00073 (Limitation: RTA requires the name to be a static global) 00074 Event Descriptor: The Event Descriptor is created using the EDMA3_DVT_DESC Macro. 00075 This Macro is of the following format (see tables below for EventType and ArgType): 00076 EDMA3_DVT_DESC(EventType, Arg1Type, Arg2Type, Arg3Type) 00077 00078 Note: Event # is generated by BIOS based on unique String provided as input to "Log_Printf4". 00079 This string is extracted by Sorcates via the map file. 00080 00081 Note: 00082 1. Only three pieces of data can be included in any log 00083 2. Data needs to be included in the same order as in table. 00084 i.e. if logging INITIATOR, SIZE and CORR then INITIATOR 00085 must be in arg1, CORR in arg2 and SIZE in arg3 00086 00087 Example: 00088 00089 ISRx() 00090 { 00091 Log_Printf4(&DVTEvent_Log, "ISR1", EDMA3_DVT_DESC(EDMA3_DVT_INT_eSTART, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE, 00092 EDMA3_DVT_dNONE)) 00093 : 00094 : 00095 Log_Printf4(&DVTEvent_Log, "ISR1", EDMA3_DVT_DESC(EDMA3_DVT_INT_eEND, EDMA3_DVT_dSIZE, EDMA3_DVT_dNONE, 00096 EDMA3_DVT_dNONE), sizeof(Buffer)) 00097 } 00098 00099 00100 */ 00101 extern far LOG_Obj DVTEvent_Log; 00102 typedef enum 00103 { 00104 EDMA3_DVT_eINT , /* Interrupt Event. Use this only is logging 00105 that the interrupt occurred. Use INT_START/END 00106 if tracking the entry and exit of interrupt */ 00107 EDMA3_DVT_eINT_START, /* Enter Interrupt service routine */ 00108 00109 EDMA3_DVT_eINT_END, /* Exit Interrupt service routine */ 00110 00111 EDMA3_DVT_eFUNC, /* Interrupt Event. Use this only is logging that 00112 the function was called. Use FUNC_START/END if 00113 tracking the entry and exit of function */ 00114 EDMA3_DVT_eFUNC_START, /* Enter function service routine */ 00115 00116 EDMA3_DVT_eFUNC_END, /* Exit function service routine */ 00117 00118 EDMA3_DVT_ePACKET_START, /* Start of a Packet */ 00119 00120 EDMA3_DVT_ePACKET_END, /* End of a Packet */ 00121 00122 EDMA3_DVT_eDATA_SND, /* An event that has a free running counter value 00123 associated with it */ 00124 EDMA3_DVT_eDATA_SND_START, /* A COUNTER Event that has a corresponding 00125 ENDCOUNTER event */ 00126 EDMA3_DVT_eDATA_SND_END, /* End of a STARTCOUNTER event */ 00127 00128 EDMA3_DVT_eDATA_RCV, /* An Event that has a value associated with it */ 00129 00130 EDMA3_DVT_eRCV_START, /* A VALUE event that has a corresponding ENDVALUE 00131 event */ 00132 EDMA3_DVT_eRCV_END, /* End of a STARTVALUE event */ 00133 00134 EDMA3_DVT_eSMPL_COUNTER, /* Sample some free running counter */ 00135 00136 EDMA3_DVT_eEVENT, /* Events not explicitly defined above */ 00137 00138 EDMA3_DVT_eEVENT_START, /* Start of an Event not mentioned in the above list */ 00139 00140 EDMA3_DVT_eEVENT_END /* End of an Event not mentioned in the above list */ 00141 00142 } EDMA3_logEventType; 00143 00144 typedef enum 00145 { 00146 EDMA3_DVT_dNONE , /* No Data */ 00147 00148 EDMA3_DVT_dINST, /* ID for this instance of the driver. This is necessary 00149 if separate analysis is required for different instances 00150 of a multiple instance driver. */ 00151 EDMA3_DVT_dINITIATOR, /* ID of the component that initiated this driver request */ 00152 00153 EDMA3_DVT_dMSG_ID, /* Use to correlate START and END events. This is not 00154 necessary if events are sequenced, i.e. no more than 00155 1 START is pending at any given time. */ 00156 EDMA3_DVT_dCOUNTER, /* Value of a free running counter */ 00157 00158 EDMA3_DVT_dSIZE_BYTES, /* Size in number of bytes */ 00159 00160 EDMA3_DVT_dSIZE_WORDS, /* Size in number of words */ 00161 00162 EDMA3_DVT_dPADD, /* Program Address */ 00163 00164 EDMA3_DVT_dDADD, /* Data address */ 00165 00166 EDMA3_DVT_dDATA, /* Some Data */ 00167 00168 EDMA3_DVT_dPACKET_ID, /* Packet ID */ 00169 00170 EDMA3_DVT_dCHANNEL_ID /* Channel ID */ 00171 00172 } EDMA3_logDataDesc; 00173 00174 00175 #define ARG1(arg1) (arg1 << 8) 00176 #define ARG2(arg2) (arg2 << 16) 00177 #define ARG3(arg3) (arg3 << 24) 00178 00179 #define EDMA3_DVT_DESC(event, arg1, arg2, arg3) (event | ARG1(arg1) | ARG2(arg2) | ARG3(arg3)) 00180 00181 /* 00182 * EDMA3 Event Log Macro 00183 * 00184 * Macro to log the event 00185 */ 00186 #define EDMA3_LOG_EVENT LOG_printf4 00187 00188 00189 /* Examples : For instrumenting a driver which is working in interrupt mode. 00190 00191 Driver Write Function: 00192 00193 Drv_Write(...) 00194 { 00195 EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_eFUNC_START, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE)); 00196 EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_ePACKET_START, EDMA3_DVT_dPACKET_ID, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE), packetId); 00197 00198 . 00199 . 00200 EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_eDATA_SND_START, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE)); 00201 . 00202 . 00203 . 00204 00205 EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_eFUNC_END, EDMA3_DVT_dSIZE_BYTES, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE), Data Transferred); 00206 } 00207 00208 Note: In case the driver is asychronous, then the FUNC_END event will be placed before calling 00209 the completion call back. 00210 00211 00212 DRV_ISR(...) 00213 { 00214 Case: Intermediate Transfer complete 00215 EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_eDATA_SND_END, EDMA3_DVT_dSIZE_BYTES, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE), Data written to Hardware); 00216 00217 case: More Data Pending 00218 EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_eDATA_SND_START, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE)); 00219 } 00220 */ 00223 #ifdef __cplusplus 00224 } 00225 #endif /* extern "C" */ 00226 00227 #endif /* _EDMA3_LOG_H_ */