PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/TNETW_Driver/FW_Transfer/Cmd_MBox/CmdMBox.h

http://github.com/CyanogenMod/cm-kernel
C Header | 167 lines | 81 code | 23 blank | 63 comment | 0 complexity | 924cf0b2470aca5bf66bce70de34b8fb 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: CmdMBox.h */
  38. /* PURPOSE: Acx mailbox object api */
  39. /* */
  40. /**********************************************************************************/
  41. #ifndef _CMDMBOX_H_
  42. #define _CMDMBOX_H_
  43. #include "whalCommon.h"
  44. #include "whalHwDefs.h"
  45. /*****************************************************************************
  46. ** Defines **
  47. *****************************************************************************/
  48. /* wait for a Mail box command to complete */
  49. #define CMDMBOX_WAIT_TIMEOUT 500 /* ms */
  50. #define CMDMBOX_HEADER_LEN 4
  51. #define CMDMBOX_INFO_ELEM_HEADER_LEN 4
  52. #define CMDMBOX_WAIT_CMPLT_STALL_TIME 50 /* us */
  53. #define CMDMBOX_US_TO_MS 1000
  54. /*****************************************************************************
  55. ** Enums **
  56. *****************************************************************************/
  57. typedef enum
  58. {
  59. CMDMBOX_EVENT_SEND_CMD,
  60. CMDMBOX_EVENT_CMD_CMPLT,
  61. CMDMBOX_EVENT_BUS_READY,
  62. CMDMBOX_EVENT_TXN_CMPLT,
  63. CMDMBOX_EVENT_GET_RESULT,
  64. CMDMBOX_EVENT_NUM,
  65. } CmdMBox_SMEvents_e;
  66. typedef enum
  67. {
  68. CMDMBOX_STATE_SENDCMD_NORMAL_IDLE = 0,
  69. CMDMBOX_STATE_SENDCMD_NORMAL_WAIT_BUS,
  70. CMDMBOX_STATE_SENDCMD_NORMAL_WAIT_TXN_BUF,
  71. CMDMBOX_STATE_SENDCMD_NORMAL_WRITE_TRIG_v,
  72. CMDMBOX_STATE_SENDCMD_NORMAL_WAIT_TXN_TRIG,
  73. } CmdMBox_SMStates_SendCmd_Normal_e;
  74. typedef enum
  75. {
  76. CMDMBOX_STATE_SENDCMD_BLOCKING_IDLE = 10,
  77. CMDMBOX_STATE_SENDCMD_BLOCKING_WAIT_BUS,
  78. CMDMBOX_STATE_SENDCMD_BLOCKING_WAIT_TXN_BUF,
  79. CMDMBOX_STATE_SENDCMD_BLOCKING_WRITE_TRIG_v,
  80. CMDMBOX_STATE_SENDCMD_BLOCKING_WAIT_TXN_TRIG,
  81. CMDMBOX_STATE_SENDCMD_BLOCKING_POLL_CMPLT_v,
  82. CMDMBOX_STATE_SENDCMD_BLOCKING_FINISH_v,
  83. } CmdMBox_SMStates_SendCmd_Blocking_e;
  84. typedef enum
  85. {
  86. CMDMBOX_STATE_GETRESULT_NORMAL_IDLE = 20,
  87. CMDMBOX_STATE_GETRESULT_NORMAL_WAIT_TXN,
  88. } CmdMBox_SMStates_GetResult_Normal_e;
  89. typedef enum
  90. {
  91. CMDMBOX_STATE_GETRESULT_BLOCKING_IDLE = 30,
  92. CMDMBOX_STATE_GETRESULT_BLOCKING_WAIT_TXN,
  93. CMDMBOX_STATE_NUM,
  94. } CmdMBox_SMStates_GetResult_Blocking_e;
  95. /*****************************************************************************
  96. ** Types **
  97. *****************************************************************************/
  98. typedef struct _CmdMBox_T CmdMBox_T;
  99. typedef int (*SM_Func_t)(CmdMBox_T* pCmdMBox, CmdMBox_SMEvents_e event);
  100. /*****************************************************************************
  101. ** Structures **
  102. *****************************************************************************/
  103. struct _CmdMBox_T
  104. {
  105. /* handles */
  106. TI_HANDLE hOs;
  107. TI_HANDLE hReport;
  108. TI_HANDLE hTNETWIF;
  109. TI_HANDLE hFwEvent;
  110. TI_HANDLE hTimer;
  111. TI_HANDLE hCmdQueue;
  112. /* SM */
  113. CmdMBox_SMStates_GetResult_Normal_e GetResultNormal_State;
  114. CmdMBox_SMStates_GetResult_Blocking_e GetResultBlocking_State;
  115. CmdMBox_SMStates_SendCmd_Normal_e SendCmdNormal_State;
  116. CmdMBox_SMStates_SendCmd_Blocking_e SendCmdBlocking_State;
  117. SM_Func_t ActiveSM;
  118. SM_Func_t SendCmdSM;
  119. SM_Func_t GetResultSM;
  120. /* HW params */
  121. /* use a struct to read buffers from the bus - used for extra bytes reserving */
  122. PADDING (Command_t HW_CmdMBox)
  123. UINT32 CmdMBox_FW_address;
  124. UINT32 CmdLen;
  125. UINT8* GetResult_ParamsBuf;
  126. UINT32 GetResult_ParamsLen;
  127. BOOLEAN useOpt;
  128. TNETWIF_callback_t fCb;
  129. TI_HANDLE hCb;
  130. };
  131. /*****************************************************************************
  132. ** Internal functions definitions **
  133. *****************************************************************************/
  134. int CmdMBox_SM_GetResultNormal(CmdMBox_T* pCmdMBox, CmdMBox_SMEvents_e event);
  135. int CmdMBox_SM_GetResultBlocking(CmdMBox_T* pCmdMBox, CmdMBox_SMEvents_e event);
  136. int CmdMBox_SM_SendCmdNormal(CmdMBox_T* pCmdMBox, CmdMBox_SMEvents_e event);
  137. int CmdMBox_SM_SendCmdBlocking(CmdMBox_T* pCmdMBox, CmdMBox_SMEvents_e event);
  138. /*****************************************************************************
  139. ** CB functions definitions **
  140. *****************************************************************************/
  141. void CmdMBox_TimeOut(TI_HANDLE hCmdMBox);
  142. void CmdMBox_TxnCmplt(TI_HANDLE hCmdMBox, UINT8 module_id ,TI_STATUS status);
  143. void CmdMBox_BusReady(TI_HANDLE hCmdMBox, UINT8 module_id ,TI_STATUS status);
  144. #endif