1 /**************************************************************************** 2 **+-----------------------------------------------------------------------+** 3 **| |** 4 **| Copyright(c) 1998 - 2008 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 ****************************************************************************/ 35 36 /***************************************************************************/ 37 /* */ 38 /* MODULE: TrafficMonitor.h */ 39 /* PURPOSE: TrafficMonitor module Header file */ 40 /* */ 41 /***************************************************************************/ 42 #ifndef _TRAFFIC_MONITOR_H 43 #define _TRAFFIC_MONITOR_H 44 45 46 #include "osTIType.h" 47 #include "GeneralUtilApi.h" 48 #include "TrafficMonitorAPI.h" 49 50 /* time interval to load for the down limit alert Timer * 51 *(TrafficMonitor_t->TrafficMonTimer) */ 52 #define MIN_MONITOR_INTERVAL 50 /*mSec*/ 53 54 /*The max number of Alert Element that the traffic monitor will be able to Manage.*/ 55 #define MAX_MONITORED_REQ 32 56 57 /* The max number of Alert element that can * 58 * be associated to other alert element for reset condition*/ 59 #define MAX_RST_ELMENT_PER_ALERT 3 60 61 /* BW Window in MS. changing this number must take NUM_OF_SLIDING_WINDOWS into consideration */ 62 #define BW_WINDOW_MS 1000 63 64 #define NUM_OF_SLIDING_WINDOWS 8 /* Must be power of 2 !!! */ 65 #define CYCLIC_COUNTER_ELEMENT (NUM_OF_SLIDING_WINDOWS - 1) /* Note that it is aligned to NUM_OF_SLIDING_WINDOWS */ 66 67 #define SIZE_OF_WINDOW_MS ( BW_WINDOW_MS / NUM_OF_SLIDING_WINDOWS) /* 125 Ms */ 68 69 /* BandWidth_t 70 This struct is used for the sliding windows algorithm used to calculate the band width */ 71 typedef struct 72 { 73 UINT32 uCurrentWindow; 74 UINT32 auFirstEventsTS[NUM_OF_SLIDING_WINDOWS]; 75 UINT32 auWindowCounter[NUM_OF_SLIDING_WINDOWS]; 76 }BandWidth_t; 77 78 79 /* The traffic manger class structure */ 80 typedef struct 81 { 82 BOOL Active; 83 TI_HANDLE NotificationRegList; 84 TI_HANDLE hOs; 85 TI_HANDLE TrafficMonTimer; 86 TI_HANDLE hRxData; 87 TI_HANDLE hTxData; 88 89 TI_HANDLE TxRegReqHandle; 90 TI_HANDLE RxRegReqHandle; 91 92 BandWidth_t DirectTxFrameBW; 93 BandWidth_t DirectRxFrameBW; 94 95 UINT8 trafficDownTestIntervalPercent; /* Percentage of max down events test interval */ 96 /*to use in our "traffic down" timer */ 97 BOOL DownTimerEnabled; /* Indicates whether the "down traffic" timer is active or not */ 98 99 }TrafficMonitor_t; 100 101 102 /* Function definition that used for event Aggregation/filtering/etc.. */ 103 typedef VOID (*TraffActionFunc_t)(TI_HANDLE TraffElem,int Count); 104 105 /* This enum holds the event providers that are optional in the system */ 106 typedef enum 107 { 108 TX_TRAFF_MODULE = 0, 109 RX_TRAFF_MODULE = 1, 110 MAX_NUM_MONITORED_MODULES, /* Don't move this enum this index defines the 111 number of module that can be monitored.*/ 112 }MonModuleTypes_t; 113 114 115 116 /* 117 * Alert State option enum 118 * 0. disabled 119 * 1. ON but not active 120 * 2. ON and active 121 */ 122 typedef enum { 123 ALERT_WAIT_FOR_RESET = 0, /* Event has been triggered, awaiting reset event to occur */ 124 ALERT_OFF, 125 ALERT_ON 126 }TraffAlertState_t; 127 128 129 /* Basic Alert element structure */ 130 typedef struct AlertElement_t 131 { 132 /*initial param*/ 133 TraffAlertState_t CurrentState; 134 int EventCounter; 135 int Threshold; 136 UINT32 TimeOut; 137 TraffDirection_t Direction; 138 TraffTrigger_t Trigger; 139 BOOL Enabled; 140 int LastCounte; 141 TraffEevntCall_t CallBack; 142 TI_HANDLE Context ; 143 UINT32 Cookie; 144 UINT32 TimeIntervalMs; 145 BOOL AutoCreated; 146 BOOL RstWasAssigned; 147 TraffActionFunc_t ActionFunc; 148 UINT32 MonitorMask[MAX_NUM_MONITORED_MODULES]; 149 struct AlertElement_t *ResetElment[MAX_RST_ELMENT_PER_ALERT]; 150 }TrafficAlertElement_t; 151 152 #endif 153