PageRenderTime 39ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/TNETW_Driver/TNETWIF/Inc/TNETWArb.h

http://github.com/CyanogenMod/cm-kernel
C Header | 153 lines | 53 code | 33 blank | 67 comment | 0 complexity | 321cb0a09a4db13447d0d621c7f68397 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. /** \file GWSI_Synchronizer.h
  36. * \brief GWSI Synchronizer include file
  37. *
  38. * \see GWSI_Synchronizer.c
  39. */
  40. /***************************************************************************/
  41. /* */
  42. /* MODULE: GWSI_Synchronizer.h */
  43. /* PURPOSE: GWSI Synchronizer include file */
  44. /* */
  45. /***************************************************************************/
  46. #ifndef SYNCHRONIZER_H
  47. #define SYNCHRONIZER_H
  48. #include "TNETWIF.h"
  49. #include "TNETWArbSM.h"
  50. #include "TNETWArb_buffer.h"
  51. #include "osTIType.h"
  52. #define TODO_LIST_INDEX 0
  53. #define RUNNING_LIST_INDEX 1
  54. #define NUM_OF_TNETWARB_QUEUES 2
  55. #define TNETWARB_IS_EVENT_PENDING 0x100
  56. /* These defines should be closed by default. They may be open for debug purposes */
  57. typedef struct TNETWARB_INSTANCE_struct
  58. {
  59. TI_HANDLE instance_handle; /* The handle of the module to be used when calling back the client */
  60. TNETWIF_callback_t instance_callback; /* The handler of the module to be used when calling back the client */
  61. UINT8 module_id; /* The module_id of the Client */
  62. UINT8 priority; /* The priority of the client instance */
  63. } TNETWARB_INSTANCE_T;
  64. #define TNETWARB_INSTANCE_SIZE sizeof(TNETWARB_INSTANCE_T)
  65. typedef struct TNETWArbStat_t_
  66. {
  67. UINT32 uStart;
  68. UINT32 uRestart;
  69. UINT32 uFinish;
  70. } TNETWArbStat_t;
  71. /**************************** TNETWARB_CB ********************************/
  72. /****************************************************************************/
  73. typedef struct T_TNETWARB_CB
  74. {
  75. TI_HANDLE hOs;
  76. TI_HANDLE hReport;
  77. TI_HANDLE hTNETWArbSM;
  78. UINT8 TNETWArb_Client_Instance_Array[NUM_OF_TNETWIF_MODULES] [BUFFER_HDR_SIZE+TNETWARB_INSTANCE_SIZE];
  79. TNETWARB_INSTANCE_T *TNETWArb_Running_instance;
  80. TNETWARB_INSTANCE_T *pDefInst;
  81. BUFFER_Q TNETWArbiter_Queues[NUM_OF_TNETWARB_QUEUES];
  82. TnetwArbSMEvents_e event_to_dispatch; /* This is used after the client callback has potentially called itself a FOINISH or RESTART API
  83. Then we remmember the Event to be sent to the TNETW Arbiter State Machine so we prevent nested entrance in the TNETW ARBITER MODULE */
  84. #ifdef TI_DBG
  85. TNETWArbStat_t stat;
  86. #endif
  87. } TNETWArb_t;
  88. #define TNETWArb_is_idle(pTnetwArb_cb) (!pTnetwArb_cb->TNETWArbiter_Queues[RUNNING_LIST_INDEX].count)
  89. #define TNETWArb_is_running(pTnetwArb_cb) (pTnetwArb_cb->TNETWArbiter_Queues[RUNNING_LIST_INDEX].count)
  90. /*******************************************************************************/
  91. /* Each new client shall register itself to the synchronizer by inserting here
  92. its start instance */
  93. /* The "extern" here is anyway to explicite to the user that this fucntion is not
  94. implemented in the synchronizer but in the client */
  95. /*******************************************************************************/
  96. /************************************************************************
  97. API for the TNETWIF to handle the running module's Callbacks.
  98. ************************************************************************/
  99. TI_STATUS TNETWArb_CallClientCallback (TI_HANDLE hTNETWArb);
  100. TI_STATUS TNETWArb_CallTxnCb (TI_HANDLE hTNETWArb);
  101. void TNETWArb_TxnCb (TI_HANDLE hTNETWArb, UINT8 module_id, TI_STATUS status);
  102. void TNETWArb_PrintStat (TI_HANDLE hTNETWArb);
  103. /* API for external module in charge of creating the gwsi_synchronizer initialization */
  104. TI_HANDLE TNETWArb_Init (TI_HANDLE hOs);
  105. void TNETWArb_Config (TI_HANDLE hTNETWArb,TI_HANDLE hReport,TI_HANDLE hELPCtrl);
  106. TI_STATUS TNETWArb_Destroy (TI_HANDLE hTNETWArb);
  107. TI_STATUS TNETWArb_Recovery(TI_HANDLE hTNETWArb, TI_HANDLE hELPCtrl);
  108. /************************************************************************
  109. API for the Client to send an event to the Synchronizer : It can be :
  110. EV_REG_ID (PERFORM_IMMEDIATE or start time for future use)
  111. EV_FINISH_ID (To be called by the client when if finishes its State Machine
  112. ************************************************************************/
  113. TI_STATUS TNETWArb_Start (TI_HANDLE hTNETWArb,UINT8 module_id,TI_HANDLE ClientCallBack_Handle,TNETWIF_callback_t ClientCallBack_Func);
  114. TI_STATUS TNETWArb_Restart (TI_HANDLE hTNETWArb, UINT8 module_id,TI_HANDLE CallBAck_Handle,TNETWIF_callback_t CallBack_Func);
  115. TI_STATUS TNETWArb_Finish (TI_HANDLE hTNETWArb, UINT8 module_id,TI_HANDLE CallBAck_Handle,TNETWIF_callback_t CallBack_Func);
  116. /************************************************************************
  117. API for the Client to register its handle
  118. ************************************************************************/
  119. void TNETWArb_register_handler(TI_HANDLE hTNETWArb,UINT8 module_id,TNETWIF_callback_t module_CB_Func,TI_HANDLE module_handle);
  120. #endif /* SYNCHRONIZER_H */