1 /*
2 * PowerMgrDbgPrint.c
3 *
4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name Texas Instruments nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 /** \file PowerMgrDbgPrint.c
35 * \brief Includes primtoputs for debugging the power manager module.
36 * \
37 * \date 29-Aug-2006
38 */
39
40 #ifndef __POWER_MGR_DBG_PRINT__
41 #define __POWER_MGR_DBG_PRINT__
42
43 #define __FILE_ID__ FILE_ID_72
44 #include "tidef.h"
45 #include "report.h"
46 #include "osApi.h"
47 #include "PowerMgr.h"
48
49 #ifdef TI_DBG
50
51 #define MAX_DESC_LENGTH 32
52
53 #ifdef REPORT_LOG
54 void powerMgrPrintPriorities( TI_HANDLE hPowerMgr, powerMngModePriority_t* pPriorities );
55
56 static char booleanDesc[ 2 ][ MAX_DESC_LENGTH ] = {"no", "yes"};
57 static char powerModeDesc[ POWER_MODE_MAX ][ MAX_DESC_LENGTH ] =
58 { "Auto", "Active", "Short doze", "Long doze", "PS only" };
59 static char powerPolicyDesc[ POWERAUTHO_POLICY_NUM ][ MAX_DESC_LENGTH ] =
60 { "ELP", "PD", "AWAKE" };
61 static char priorityDesc[ POWER_MANAGER_MAX_PRIORITY ][ MAX_DESC_LENGTH ] =
62 { "User priority", "Soft-Gemini priority" };
63 static char psStatusDesc[ POWER_SAVE_STATUS_NUMBER ][ MAX_DESC_LENGTH ]=
64 { "Enter fail", "Enter success", "Exit fail", "Exit succes" };
65 #endif
66
67 /****************************************************************************************
68 * PowerMgr_printObject *
69 ****************************************************************************************
70 DESCRIPTION: print configuration of the PowerMgr object - use for debug!
71
72 INPUT: - hPowerMgr - Handle to the Power Manager
73 OUTPUT:
74 RETURN: void.\n
75 ****************************************************************************************/
PowerMgr_printObject(TI_HANDLE hPowerMgr)76 void PowerMgr_printObject( TI_HANDLE hPowerMgr )
77 {
78 #ifdef REPORT_LOG
79 PowerMgr_t *pPowerMgr = (PowerMgr_t*)hPowerMgr;
80
81 WLAN_OS_REPORT(("------------ Power Manager Object ------------\n\n"));
82 WLAN_OS_REPORT(("PS enabled: %s, desired power mode profile: %s, last power mode profile: %s\n",
83 booleanDesc[ pPowerMgr->psEnable ], powerModeDesc[ pPowerMgr->desiredPowerModeProfile ],
84 powerModeDesc[ pPowerMgr->lastPowerModeProfile ]));
85 WLAN_OS_REPORT(("Default power policy: %ss, PS power policy: %s\n",
86 powerPolicyDesc[ pPowerMgr->defaultPowerLevel ],
87 powerPolicyDesc[ pPowerMgr->PowerSavePowerLevel ]));
88 WLAN_OS_REPORT(("Current priority: %s\n", priorityDesc[ pPowerMgr->powerMngPriority ]));
89 powerMgrPrintPriorities( hPowerMgr, pPowerMgr->powerMngModePriority );
90 WLAN_OS_REPORT(("\n------------ auto mode parameters ------------\n"));
91 WLAN_OS_REPORT(("Interval: %d, active threshold: %d, doze threshold: %d, doze mode: %s\n\n",
92 pPowerMgr->autoModeInterval, pPowerMgr->autoModeActiveTH, pPowerMgr->autoModeDozeTH,
93 powerModeDesc[ pPowerMgr->autoModeDozeMode ]));
94 WLAN_OS_REPORT(("Beacon listen interval:%d, DTIM listen interval:%d, last PS status: %s\n\n",
95 pPowerMgr->beaconListenInterval, pPowerMgr->dtimListenInterval,
96 psStatusDesc[ pPowerMgr->lastPsTransaction ]));
97 WLAN_OS_REPORT(("------------ Handles ------------\n"));
98 WLAN_OS_REPORT(("%-15s: 0x%x, %-15s:0x%x\n","hOS", pPowerMgr->hOS, "hTWD", pPowerMgr->hTWD));
99 WLAN_OS_REPORT(("%-15s: 0x%x, %-15s:0x%x\n","hReport", pPowerMgr->hReport, "hTrafficMonitor", pPowerMgr->hTrafficMonitor));
100 WLAN_OS_REPORT(("%-15s: 0x%x, %-15s:0x%x\n","hSiteMgr", pPowerMgr->hSiteMgr, "hTWD", pPowerMgr->hTWD));
101 WLAN_OS_REPORT(("%-15s: 0x%x, %-15s:0x%x\n","hRetryPsTimer", pPowerMgr->hRetryPsTimer, "hActiveTMEvent", pPowerMgr->passToActiveTMEvent));
102 WLAN_OS_REPORT(("%-15s: 0x%x\n", "hDozeTMEvent", pPowerMgr->passToDozeTMEvent));
103 #endif
104 }
105
106 #ifdef REPORT_LOG
powerMgrPrintPriorities(TI_HANDLE hPowerMgr,powerMngModePriority_t * pPriorities)107 void powerMgrPrintPriorities( TI_HANDLE hPowerMgr, powerMngModePriority_t* pPriorities )
108 {
109 int i;
110
111 for ( i = 0; i < POWER_MANAGER_MAX_PRIORITY; i++ )
112 {
113 WLAN_OS_REPORT(("Priority: %-15s, enabled: %s, power mode: %s\n",
114 priorityDesc[ i ], booleanDesc[ pPriorities[ i ].priorityEnable ],
115 powerModeDesc[ pPriorities[ i ].powerMode ]));
116 }
117 }
118 #endif
119 #endif /* TI_DBG */
120
121 #endif /* __POWER_MGR_DBG_PRINT__ */
122