source: svn/newcon3bcm2_21bu/BSEAV/lib/bprofile/btrc.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 3.8 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2006, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: btrc.h $
11 * $brcm_Revision: 1 $
12 * $brcm_Date: 12/5/06 11:07a $
13 *
14 * Module Description:
15 *
16 * Perfomance counter module
17 *
18 * Revision History:
19 *
20 * $brcm_Log: /BSEAV/lib/bprofile/btrc.h $
21 *
22 * 1   12/5/06 11:07a vsilyaev
23 * PR 25997: BTRC system level tracing
24 *
25 *
26 *******************************************************************************/
27#ifndef __BTRC_H__
28#define __BTRC_H__
29
30#include "bperf_counter.h"
31#include "blst_slist.h"
32#ifdef __cplusplus
33extern "C"
34{
35#endif
36
37#define B_TRC_N_SAMPLES 4
38#define B_TRC_N_CHANNELS 2
39
40typedef struct BTRC_P_Sample {
41        unsigned samples[B_TRC_N_SAMPLES];
42        bperf_sample perf;
43} BTRC_P_Sample;
44
45#define BTRC_P_SAMPLE_INITIALIZER { {0,0,0,0}, BPERF_SAMPLE_INITIALIZER }
46
47typedef struct BTRC_P_Stats {
48        unsigned count;
49        BTRC_P_Sample last;
50        BTRC_P_Sample max;
51        BTRC_P_Sample min;
52        BTRC_P_Sample total;
53} BTRC_P_Stats;
54
55#define BTRC_P_STATS_INITIALIZER {0, BTRC_P_SAMPLE_INITIALIZER, BTRC_P_SAMPLE_INITIALIZER, BTRC_P_SAMPLE_INITIALIZER, BTRC_P_SAMPLE_INITIALIZER}
56
57typedef struct BTRC_Module {
58        bool b_trc_enable;
59    BLST_S_ENTRY(BTRC_Module) link;
60        const char *name;
61        BTRC_P_Stats stats[B_TRC_N_CHANNELS];
62} BTRC_Module;
63
64BLST_S_HEAD(BTRC_ModuleList, BTRC_Module);
65typedef struct BTRC_ModuleList BTRC_ModuleList;
66
67typedef struct BTRC_P_Entry {
68        unsigned event;
69        unsigned data;
70        unsigned samples[B_TRC_N_SAMPLES];
71        bperf_sample perf;
72}BTRC_P_Entry;
73
74typedef enum BTRC_P_Event {
75        BTRC_P_Event_START=0,
76        BTRC_P_Event_STOP=1,
77        BTRC_P_Event_COUNT=2
78}BTRC_P_Event;
79
80typedef enum BTRC_P_State {
81        BTRC_P_State_DISABLE,
82        BTRC_P_State_ENABLE
83}BTRC_P_State;
84
85void BTRC_P_DoTrace(unsigned event, unsigned data);
86/*
87#define BTRC_P_Encode_Event(inst, event) (((unsigned)(&(inst).b_trc_enable)&(~3))|(event))
88*/
89
90#define BTRC_P_Encode_Event(inst, event) (((unsigned)(&(inst).b_trc_enable)&(~0))+(event))
91
92#define BTRC_P_Encode_Data(chn, us20, us16)  ((((us16)&0xFFFF)<<24) | (((us20)&0xFFFFF)<<4) | ((chn)&0x0F))
93
94#define BTRC_P_MODULE_HANDLE(module) (b_trc_mod_##module)
95#define BTRC_MODULE_HANDLE(module) (&BTRC_P_MODULE_HANDLE(module))
96
97#define BTRC_P_TRACE(module, event, data) (BTRC_P_MODULE_HANDLE(module).b_trc_enable)?BTRC_P_DoTrace(BTRC_P_Encode_Event(BTRC_P_MODULE_HANDLE(module), BTRC_P_Event_##event),data):(void) 0
98
99
100#define BTRC_TRACE(module, event) BTRC_P_TRACE(module, event, 0)
101#define BTRC_CHN_TRACE(module, chn, event) BTRC_P_TRACE(module, event, BTRC_P_Encode_Data(chn, 0, 0))
102#define BTRC_TRACE_DATA20(module, event, data20) BTRC_P_TRACE(module, event, BTRC_P_Encode_Data(0, data20, 0))
103#define BTRC_TRACE_DATA20_16(module, event, data20, data16) BTRC_P_TRACE(module, event, BTRC_P_Encode_Data(0, data20,data16))
104
105#define BTRC_MODULE(module,enable) BTRC_Module BTRC_P_MODULE_HANDLE(module) = {((BTRC_P_State_##enable)!=BTRC_P_State_DISABLE) , BLST_S_INITIALIZER(unused), #module,{\
106                        BTRC_P_STATS_INITIALIZER, BTRC_P_STATS_INITIALIZER}}
107
108#define BTRC_MODULE_DECLARE(module) extern BTRC_Module BTRC_P_MODULE_HANDLE(module)
109
110void BTRC_Module_Reset(BTRC_Module *module);
111void BTRC_Module_Enable(BTRC_Module *module, bool enable);
112void BTRC_Module_Report(const BTRC_Module *modile);
113void BTRC_Module_Register(BTRC_Module *module, BTRC_ModuleList *list);
114
115void BTRC_List_Init(BTRC_ModuleList *list);
116void BTRC_List_Report(BTRC_ModuleList *list);
117                                                                                                                                                                                                                                                                                                                                                                       
118
119#ifdef __cplusplus
120}
121#endif
122
123#endif /* __BTRC_H__ */
124
Note: See TracBrowser for help on using the repository browser.