4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
35 /***************************************************************************/
37 /* MODULE: TrafficMonitor.h */
38 /* PURPOSE: TrafficMonitor module Header file */
40 /***************************************************************************/
41 #ifndef _TRAFFIC_MONITOR_H
42 #define _TRAFFIC_MONITOR_H
46 #include "GeneralUtilApi.h"
47 #include "TrafficMonitorAPI.h"
49 /* time interval to load for the down limit alert Timer *
50 *(TrafficMonitor_t->TrafficMonTimer) */
51 #define MIN_MONITOR_INTERVAL 50 /*mSec*/
53 /*The max number of Alert Element that the traffic monitor will be able to Manage.*/
54 #define MAX_MONITORED_REQ 32
56 /* The max number of Alert element that can *
57 * be associated to other alert element for reset condition*/
58 #define MAX_RST_ELMENT_PER_ALERT 3
60 /* BW Window in MS. changing this number must take NUM_OF_SLIDING_WINDOWS into consideration */
61 #define BW_WINDOW_MS 1000
63 #define NUM_OF_SLIDING_WINDOWS 8 /* Must be power of 2 !!! */
64 #define CYCLIC_COUNTER_ELEMENT (NUM_OF_SLIDING_WINDOWS - 1) /* Note that it is aligned to NUM_OF_SLIDING_WINDOWS */
66 #define SIZE_OF_WINDOW_MS ( BW_WINDOW_MS / NUM_OF_SLIDING_WINDOWS) /* 125 Ms */
69 This struct is used for the sliding windows algorithm used to calculate the band width */
72 TI_UINT32 uCurrentWindow;
73 TI_UINT32 auFirstEventsTS[NUM_OF_SLIDING_WINDOWS];
74 TI_UINT32 auWindowCounter[NUM_OF_SLIDING_WINDOWS];
78 /* The traffic manger class structure */
82 TI_HANDLE NotificationRegList;
89 TI_HANDLE TxRegReqHandle;
90 TI_HANDLE RxRegReqHandle;
92 BandWidth_t DirectTxFrameBW;
93 BandWidth_t DirectRxFrameBW;
95 TI_UINT8 trafficDownTestIntervalPercent; /* Percentage of max down events test interval */
96 /*to use in our "traffic down" timer */
97 TI_BOOL DownTimerEnabled; /* Indicates whether the "down traffic" timer is active or not */
99 TI_HANDLE hTrafficMonTimer;
104 /* Function definition that used for event Aggregation/filtering/etc.. */
105 typedef void (*TraffActionFunc_t)(TI_HANDLE TraffElem,int Count);
107 /* This enum holds the event providers that are optional in the system */
112 MAX_NUM_MONITORED_MODULES /* Don't move this enum this index defines the
113 number of module that can be monitored.*/
119 * Alert State option enum
121 * 1. ON but not active
125 ALERT_WAIT_FOR_RESET = 0, /* Event has been triggered, awaiting reset event to occur */
131 /* Basic Alert element structure */
132 typedef struct AlertElement_t
135 TraffAlertState_t CurrentState;
139 TraffDirection_t Direction;
140 TraffTrigger_t Trigger;
143 TraffEevntCall_t CallBack;
146 TI_UINT32 TimeIntervalMs;
148 TI_BOOL RstWasAssigned;
149 TraffActionFunc_t ActionFunc;
150 TI_UINT32 MonitorMask[MAX_NUM_MONITORED_MODULES];
151 struct AlertElement_t *ResetElment[MAX_RST_ELMENT_PER_ALERT];
152 }TrafficAlertElement_t;