]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/edma3_lld.git/blob - packages/ti/sdo/edma3/rm/src/edma3_log.h
EDMA3: Adding release package 02.00.00.03
[keystone-rtos/edma3_lld.git] / packages / ti / sdo / edma3 / rm / src / edma3_log.h
1 /*******************************************************************************\r
2 **+--------------------------------------------------------------------------+**\r
3 **|                            ****                                          |**\r
4 **|                            ****                                          |**\r
5 **|                            ******o***                                    |**\r
6 **|                      ********_///_****                                   |**\r
7 **|                      ***** /_//_/ ****                                   |**\r
8 **|                       ** ** (__/ ****                                    |**\r
9 **|                           *********                                      |**\r
10 **|                            ****                                          |**\r
11 **|                            ***                                           |**\r
12 **|                                                                          |**\r
13 **|         Copyright (c) 1998-2006 Texas Instruments Incorporated           |**\r
14 **|                        ALL RIGHTS RESERVED                               |**\r
15 **|                                                                          |**\r
16 **| Permission is hereby granted to licensees of Texas Instruments           |**\r
17 **| Incorporated (TI) products to use this computer program for the sole     |**\r
18 **| purpose of implementing a licensee product based on TI products.         |**\r
19 **| No other rights to reproduce, use, or disseminate this computer          |**\r
20 **| program, whether in part or in whole, are granted.                       |**\r
21 **|                                                                          |**\r
22 **| TI makes no representation or warranties with respect to the             |**\r
23 **| performance of this computer program, and specifically disclaims         |**\r
24 **| any responsibility for any damages, special or consequential,            |**\r
25 **| connected with the use of this program.                                  |**\r
26 **|                                                                          |**\r
27 **+--------------------------------------------------------------------------+**\r
28 *******************************************************************************/\r
29 \r
30 \r
31 /** \file   edma3_log.h\r
32     \brief  EDMA3 logging/tracing service\r
33 \r
34     This file contains interface for EDMA3 error/event/message logging and\r
35     tracing service.\r
36 \r
37     (C) Copyright 2006, Texas Instruments, Inc\r
38 \r
39     \author     EDMA3 Architecture Team\r
40 \r
41     \version    1.0 Anant Gole  Created\r
42  */\r
43 \r
44 \r
45 #ifndef _EDMA3_LOG_H_\r
46 #define _EDMA3_LOG_H_\r
47 \r
48 #include <std.h>\r
49 #include <log.h>\r
50 \r
51 #ifdef __cplusplus\r
52 extern "C" {\r
53 #endif\r
54 \r
55 /**\r
56  * \defgroup EDMA3 Log Service\r
57  *\r
58  *  EDMA3 error/event/message logging/tracing service\r
59  */\r
60 /*@{*/\r
61 \r
62 /*\r
63     Note : This header file is used to BIOS logs only. For porting purposes this\r
64            file need to replace EDMA3_LOG_EVENT macro.\r
65 \r
66            This header file uses log format as defined by Socrates Instrumentation.\r
67            Any change in the file will result in incorrect interpretation by Socrates Tool.\r
68 \r
69                                   BIOS Log Format\r
70 -------------------------------------------------------------------------------\r
71 | TimeStamp | Sequence # | Event # | Event Descriptor | Data1 | Data2 | Data3 |\r
72 | (2 words) | by BIOS    | by BIOS |                  |       |       |       |\r
73 -------------------------------------------------------------------------------\r
74 \r
75 LogBuffer:          A single log buffer called DVTEvent_Log will be used for all event logs\r
76 TimeStamp:          Automatically inserted by BIOS Log_Printf4.\r
77 Sequence #:         Automatically inserted by BIOS Log_Printf4. This is used to detect data loss.\r
78 Event:              Name to uniquely identify event. This is the name that will be used in the visualization.\r
79                     (Limitation: RTA requires the name to be a static global)\r
80 Event Descriptor:   The Event Descriptor is created using the EDMA3_DVT_DESC Macro.\r
81                     This Macro is of the following format (see tables below for EventType and ArgType):\r
82                     EDMA3_DVT_DESC(EventType, Arg1Type, Arg2Type, Arg3Type)\r
83 \r
84 Note: Event # is generated by BIOS based on unique String provided as input to "Log_Printf4".\r
85 This string is extracted by Sorcates via the map file.\r
86 \r
87 Note:\r
88 1. Only three pieces of data can be included in any log\r
89 2. Data needs to be included in the same order as in table.\r
90    i.e. if logging INITIATOR, SIZE and CORR then INITIATOR\r
91    must be in arg1, CORR in arg2 and SIZE in arg3\r
92 \r
93 Example:\r
94 \r
95 ISRx()\r
96 {\r
97     Log_Printf4(&DVTEvent_Log, "ISR1", EDMA3_DVT_DESC(EDMA3_DVT_INT_eSTART, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE,\r
98         EDMA3_DVT_dNONE))\r
99     :\r
100     :\r
101     Log_Printf4(&DVTEvent_Log, "ISR1", EDMA3_DVT_DESC(EDMA3_DVT_INT_eEND, EDMA3_DVT_dSIZE, EDMA3_DVT_dNONE,\r
102         EDMA3_DVT_dNONE), sizeof(Buffer))\r
103 }\r
104 \r
105 \r
106 */\r
107 extern far LOG_Obj DVTEvent_Log;\r
108 typedef enum\r
109 {\r
110     EDMA3_DVT_eINT          ,   /* Interrupt Event. Use this only is logging\r
111                                        that the interrupt occurred. Use INT_START/END\r
112                                        if tracking the entry and exit of interrupt */\r
113     EDMA3_DVT_eINT_START,               /* Enter Interrupt service routine */\r
114 \r
115     EDMA3_DVT_eINT_END,             /* Exit Interrupt service routine */\r
116 \r
117     EDMA3_DVT_eFUNC,                    /* Interrupt Event. Use this only is logging that\r
118                                        the function was called. Use FUNC_START/END if\r
119                                        tracking the entry and exit of function */\r
120     EDMA3_DVT_eFUNC_START,          /* Enter function service routine */\r
121 \r
122     EDMA3_DVT_eFUNC_END,                /* Exit function service routine */\r
123 \r
124     EDMA3_DVT_ePACKET_START,            /* Start of a Packet */\r
125 \r
126     EDMA3_DVT_ePACKET_END,          /* End of a Packet */\r
127 \r
128     EDMA3_DVT_eDATA_SND,                /* An event that has a free running counter value\r
129                                        associated with it */\r
130     EDMA3_DVT_eDATA_SND_START,      /* A COUNTER Event that has a corresponding\r
131                                        ENDCOUNTER event */\r
132     EDMA3_DVT_eDATA_SND_END,            /* End of a STARTCOUNTER event */\r
133 \r
134     EDMA3_DVT_eDATA_RCV,                /* An Event that has a value associated with it */\r
135 \r
136     EDMA3_DVT_eRCV_START,               /* A VALUE event that has a corresponding ENDVALUE\r
137                                        event */\r
138     EDMA3_DVT_eRCV_END,             /* End of a STARTVALUE event */\r
139 \r
140     EDMA3_DVT_eSMPL_COUNTER,            /* Sample some free running counter */\r
141 \r
142     EDMA3_DVT_eEVENT,                   /* Events not explicitly defined above */\r
143 \r
144     EDMA3_DVT_eEVENT_START,         /* Start of an Event not mentioned in the above list */\r
145 \r
146     EDMA3_DVT_eEVENT_END                /* End of an Event not mentioned in the above list */\r
147 \r
148 } EDMA3_logEventType;\r
149 \r
150 typedef enum\r
151 {\r
152     EDMA3_DVT_dNONE ,   /* No Data */\r
153 \r
154     EDMA3_DVT_dINST,                    /* ID for this instance of the driver. This is necessary\r
155                                        if separate analysis is required for different instances\r
156                                        of a multiple instance driver. */\r
157     EDMA3_DVT_dINITIATOR,               /* ID of the component that initiated this driver request */\r
158 \r
159     EDMA3_DVT_dMSG_ID,              /* Use to correlate START and END events. This is not\r
160                                        necessary if  events are sequenced, i.e. no more than\r
161                                        1 START is pending at any given time. */\r
162     EDMA3_DVT_dCOUNTER,             /* Value of a free running counter */\r
163 \r
164     EDMA3_DVT_dSIZE_BYTES,          /* Size in number of bytes */\r
165 \r
166     EDMA3_DVT_dSIZE_WORDS,          /* Size in number of words */\r
167 \r
168     EDMA3_DVT_dPADD,                    /* Program Address */\r
169 \r
170     EDMA3_DVT_dDADD,                    /* Data address */\r
171 \r
172     EDMA3_DVT_dDATA,                    /* Some Data */\r
173 \r
174     EDMA3_DVT_dPACKET_ID,               /* Packet ID */\r
175 \r
176     EDMA3_DVT_dCHANNEL_ID               /* Channel ID */\r
177 \r
178 } EDMA3_logDataDesc;\r
179 \r
180 \r
181 #define ARG1(arg1) (arg1 << 8)\r
182 #define ARG2(arg2) (arg2 << 16)\r
183 #define ARG3(arg3) (arg3 << 24)\r
184 \r
185 #define EDMA3_DVT_DESC(event, arg1, arg2, arg3) (event | ARG1(arg1) | ARG2(arg2) | ARG3(arg3))\r
186 \r
187 /*\r
188  * EDMA3 Event Log Macro\r
189  *\r
190  * Macro to log the event\r
191  */\r
192 #define EDMA3_LOG_EVENT     LOG_printf4\r
193 \r
194 \r
195 /* Examples : For instrumenting a driver which is working in interrupt mode.\r
196 \r
197 Driver Write Function:\r
198 \r
199     Drv_Write(...)\r
200     {\r
201         EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_eFUNC_START, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE));\r
202         EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_ePACKET_START, EDMA3_DVT_dPACKET_ID, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE), packetId);\r
203 \r
204         .\r
205         .\r
206         EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_eDATA_SND_START, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE));\r
207         .\r
208         .\r
209         .\r
210 \r
211         EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_eFUNC_END, EDMA3_DVT_dSIZE_BYTES, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE), Data Transferred);\r
212     }\r
213 \r
214 Note: In case the driver is asychronous, then the FUNC_END event will be placed before calling\r
215       the completion call back.\r
216 \r
217 \r
218     DRV_ISR(...)\r
219     {\r
220         Case: Intermediate Transfer complete\r
221             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);\r
222 \r
223         case: More Data Pending\r
224             EDMA3_LOG_EVENT(hLog, "DRV", EDMA3_DVT_DESC(EDMA3_DVT_eDATA_SND_START, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE, EDMA3_DVT_dNONE));\r
225     }\r
226 */\r
227 /*@}*/\r
228 \r
229 #ifdef __cplusplus\r
230 }\r
231 #endif /* extern "C" */\r
232 \r
233 #endif /* _EDMA3_LOG_H_ */\r