173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin/* 273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Copyright 2001-2008 Texas Instruments - http://www.ti.com/ 373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * 473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Licensed under the Apache License, Version 2.0 (the "License"); 573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * you may not use this file except in compliance with the License. 673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * You may obtain a copy of the License at 773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * 873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * http://www.apache.org/licenses/LICENSE-2.0 973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * 1073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Unless required by applicable law or agreed to in writing, software 1173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * distributed under the License is distributed on an "AS IS" BASIS, 1273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * See the License for the specific language governing permissions and 1473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * limitations under the License. 1573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin */ 1673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 1773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 1873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin/* 1973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * ======== dbg.h ======== 2073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DSP-BIOS Bridge driver support functions for TI OMAP processors. 2173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Purpose: 2273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Provide debugging services for 'Bridge Mini Drivers. 2373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * 2473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Public Functions: 2573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DBG_Exit 2673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DBG_Init 2773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DBG_Printf 2873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DBG_Trace 2973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * 3073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Notes: 3173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * WMD's must not call DBG_Init or DBG_Exit. 3273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * 3373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin *! Revision History: 3473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin *! ================ 3573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin *! 03-Feb-2000 rr: DBG Levels redefined. 3673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin *! 29-Oct-1999 kc: Cleaned up for code review. 3773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin *! 10-Oct-1997 cr: Added DBG_Printf service. 3873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin *! 29-May-1996 gp: Removed WCD_ prefix. 3973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin *! 15-May-1996 gp: Created. 4073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin */ 4173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 4273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#ifndef DBG_ 4373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_ 4473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 4573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#ifdef __cplusplus 4673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavinextern "C" { 4773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#endif 4873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 4973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#include <dspapi.h> 5073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 5173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin/* Levels of trace debug messages: */ 5273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#ifndef LINUX /* No DEBUGZONE in Linux, DBG mask == GT mask */ 5373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_ENTER (BYTE)(0x01 & DEBUGZONE(0)) /* Function entry point. */ 5473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL1 (BYTE)(0x02 & DEBUGZONE(1)) /* Display debugging state/varibles */ 5573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL2 (BYTE)(0x04 & DEBUGZONE(2)) /* Display debugging state/varibles */ 5673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL3 (BYTE)(0x08 & DEBUGZONE(3)) /* Display debugging state/varibles */ 5773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL4 (BYTE)(0x10 & DEBUGZONE(4)) /* Display debugging state/varibles */ 5873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL5 (BYTE)(0x20 & DEBUGZONE(5)) /* Module Init, Exit */ 5973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL6 (BYTE)(0x40 & DEBUGZONE(6)) /* Warn SERVICES Failures */ 6073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL7 (BYTE)(0x80 & DEBUGZONE(7)) /* Warn Critical Errors */ 6173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#else 6273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_ENTER (BYTE)(0x01) /* Function entry point. */ 6373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL1 (BYTE)(0x02) /* Display debugging state/varibles */ 6473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL2 (BYTE)(0x04) /* Display debugging state/varibles */ 6573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL3 (BYTE)(0x08) /* Display debugging state/varibles */ 6673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL4 (BYTE)(0x10) /* Display debugging state/varibles */ 6773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL5 (BYTE)(0x20) /* Module Init, Exit */ 6873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL6 (BYTE)(0x40) /* Warn SERVICES Failures */ 6973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_LEVEL7 (BYTE)(0x80) /* Warn Critical Errors */ 7073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#endif 7173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 7273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#if ((defined DEBUG) || (defined DDSP_DEBUG_PRODUCT)) && GT_TRACE 7373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 7473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin/* 7573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * ======== DBG_Exit ======== 7673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Purpose: 7773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Discontinue usage of module; free resources when reference count 7873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * reaches 0. 7973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Parameters: 8073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Returns: 8173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Requires: 8273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DBG initialized. 8373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Ensures: 8473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Resources used by module are freed when cRef reaches zero. 8573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin */ 8673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin extern VOID DBG_Exit(); 8773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 8873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin/* 8973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * ======== DBG_Init ======== 9073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Purpose: 9173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Initializes private state of DBG module. 9273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Parameters: 9373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Returns: 9473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * TRUE if initialized; FALSE if error occured. 9573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Requires: 9673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Ensures: 9773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin */ 9873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin extern bool DBG_Init(); 9973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 10073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#ifndef LINUX 10173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin/* 10273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * ======== DBG_Printf ======== 10373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Purpose: 10473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Output a formatted string to the debugger. 10573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Parameters: 10673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * pstrFormat: sprintf-style format string. 10773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * ...: Arguments for format string. 10873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Returns: 10973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DSP_SOK: Success, or trace level masked. 11073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DSP_EFAIL: On Error. 11173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Requires: 11273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DBG initialized. 11373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Ensures: 11473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin */ 11573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin extern DSP_STATUS DBG_Printf(IN PSTR pstrFormat, ...); 11673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#endif // LINUX 11773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 11873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin/* 11973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * ======== DBG_Trace ======== 12073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Purpose: 12173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Output a trace message to the debugger, if the given trace level 12273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * is unmasked. 12373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Parameters: 12473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * bLevel: Trace level. 12573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * pstrFormat: sprintf-style format string. 12673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * ...: Arguments for format string. 12773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Returns: 12873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DSP_SOK: Success, or trace level masked. 12973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DSP_EFAIL: On Error. 13073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Requires: 13173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * DBG initialized. 13273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Ensures: 13373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * Debug message is printed to debugger output window, if trace level 13473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin * is unmasked. 13573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin */ 13673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin extern DSP_STATUS DBG_Trace(IN BYTE bLevel, IN PSTR pstrFormat, ...); 13773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#else 13873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 13973b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_Exit() 14073b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_Init() TRUE 14173b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#define DBG_Trace(bLevel, pstrFormat, args...) 14273b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 14373b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#endif // ((defined DEBUG) || (defined DDSP_DEBUG_PRODUCT)) && GT_TRACE 14473b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin 14573b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#ifdef __cplusplus 14673b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin} 14773b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#endif 14873b11d6e96b6d49896738a1a1c87b295c1b96be2Rebecca Schultz Zavin#endif /* DBG_ */ 149