PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/core/data_ctrl/Ctrl/TrafficMonitor/TrafficMonitor.h

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