PageRenderTime 61ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/staging/csr/csr_log.h

https://gitlab.com/SpasilliumNexus/frankenclark_kernel
C Header | 223 lines | 163 code | 27 blank | 33 comment | 4 complexity | 202defa43a1f615146b799127ae1df20 MD5 | raw file
  1. #ifndef CSR_LOG_H__
  2. #define CSR_LOG_H__
  3. /*****************************************************************************
  4. (c) Cambridge Silicon Radio Limited 2010
  5. All rights reserved and confidential information of CSR
  6. Refer to LICENSE.txt included with this source for details
  7. on the license terms.
  8. *****************************************************************************/
  9. #include "csr_sched.h"
  10. #include "csr_prim_defs.h"
  11. #include "csr_msgconv.h"
  12. /*
  13. * Log filtering
  14. */
  15. /*----------------------------------------------------*/
  16. /* Filtering on environment specific log levels */
  17. /*----------------------------------------------------*/
  18. typedef u32 CsrLogLevelEnvironment;
  19. #define CSR_LOG_LEVEL_ENVIRONMENT_OFF ((CsrLogLevelEnvironment) 0x00000000) /* No environment data/events are logged */
  20. #define CSR_LOG_LEVEL_ENVIRONMENT_BCI_ACL ((CsrLogLevelEnvironment) 0x00000001) /* BlueCore Channel Interface HCI Acl data are logged */
  21. #define CSR_LOG_LEVEL_ENVIRONMENT_BCI_HCI ((CsrLogLevelEnvironment) 0x00000002) /* BlueCore Channel Interface HCI Cmd/Evt data are logged */
  22. #define CSR_LOG_LEVEL_ENVIRONMENT_BCI_SCO ((CsrLogLevelEnvironment) 0x00000004) /* BlueCore Channel Interface HCI Sco data are logged */
  23. #define CSR_LOG_LEVEL_ENVIRONMENT_BCI_VENDOR ((CsrLogLevelEnvironment) 0x00000008) /* BlueCore Channel Interface HCI Vendor specific data are logged (This includes BCCMD, HQ, VM etc) */
  24. #define CSR_LOG_LEVEL_ENVIRONMENT_TRANSPORTS ((CsrLogLevelEnvironment) 0x00000010) /* Transport protocol data is logged (This includes transport protocols like BCSP, H4 etc.) */
  25. #define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_REG ((CsrLogLevelEnvironment) 0x00000020) /* Background Interrupt registration events are logged */
  26. #define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_UNREG ((CsrLogLevelEnvironment) 0x00000040) /* Background Interrupt unregistration events are logged */
  27. #define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_SET ((CsrLogLevelEnvironment) 0x00000080) /* Background Interrupt set events are logged */
  28. #define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_START ((CsrLogLevelEnvironment) 0x00000100) /* Background Interrupt start events are logged */
  29. #define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_DONE ((CsrLogLevelEnvironment) 0x00000200) /* Background Interrupt done events are logged */
  30. #define CSR_LOG_LEVEL_ENVIRONMENT_PROTO ((CsrLogLevelEnvironment) 0x00000400) /* Transport protocol events are logged */
  31. #define CSR_LOG_LEVEL_ENVIRONMENT_PROTO_LOC ((CsrLogLevelEnvironment) 0x00000800) /* The Location where the transport protocol event occurred are logged NB: This is a supplement to CSR_LOG_LEVEL_ENVIRONMENT_PROTO, it has no effect without it */
  32. /* The bit masks between here are reserved for future usage */
  33. #define CSR_LOG_LEVEL_ENVIRONMENT_ALL ((CsrLogLevelEnvironment) 0xFFFFFFFF) /* All possible environment data/events are logged WARNING: By using this define the application also accepts future possible environment data/events in the logs */
  34. /*----------------------------------------------------*/
  35. /* Filtering on task specific log levels */
  36. /*----------------------------------------------------*/
  37. typedef u32 CsrLogLevelTask;
  38. #define CSR_LOG_LEVEL_TASK_OFF ((CsrLogLevelTask) 0x00000000) /* No events are logged for this task */
  39. #define CSR_LOG_LEVEL_TASK_TEXT ((CsrLogLevelTask) 0x00000001) /* Text strings printed by a task are logged NB: This bit does not affect the CSR_LOG_TEXT_LEVEL interface. This has to be configured separately */
  40. #define CSR_LOG_LEVEL_TASK_TEXT_LOC ((CsrLogLevelTask) 0x00000002) /* The locaction where the text string call occurred are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TEXT, it has no effect without it */
  41. #define CSR_LOG_LEVEL_TASK_STATE ((CsrLogLevelTask) 0x00000004) /* FSM state transitions in a task are logged */
  42. #define CSR_LOG_LEVEL_TASK_STATE_NAME ((CsrLogLevelTask) 0x00000008) /* The name of each state in a FSM state transition are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */
  43. #define CSR_LOG_LEVEL_TASK_STATE_LOC ((CsrLogLevelTask) 0x00000010) /* The location where the FSM state transition occurred are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */
  44. #define CSR_LOG_LEVEL_TASK_TASK_SWITCH ((CsrLogLevelTask) 0x00000020) /* Activation and deactiation of a task are logged */
  45. #define CSR_LOG_LEVEL_TASK_MESSAGE_PUT ((CsrLogLevelTask) 0x00000080) /* Message put operations are logged */
  46. #define CSR_LOG_LEVEL_TASK_MESSAGE_PUT_LOC ((CsrLogLevelTask) 0x00000100) /* The location where a message was sent are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_MESSAGE_PUT, it has no effect without it */
  47. #define CSR_LOG_LEVEL_TASK_MESSAGE_GET ((CsrLogLevelTask) 0x00000200) /* Message get operations are logged */
  48. #define CSR_LOG_LEVEL_TASK_MESSAGE_QUEUE_PUSH ((CsrLogLevelTask) 0x00000400) /* Message push operations are logged */
  49. #define CSR_LOG_LEVEL_TASK_MESSAGE_QUEUE_POP ((CsrLogLevelTask) 0x00000800) /* Message pop operations are logged */
  50. #define CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE ((CsrLogLevelTask) 0x00001000) /* Only the type of primitives in messages are logged. By default the entire primitive is serialized and logged */
  51. #define CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT ((CsrLogLevelTask) 0x00002000) /* An upper limit (defined by CSR_LOG_PRIM_SIZE_UPPER_LIMIT) is applied to how much of a primitive in a message are logged. NB: This limit is only applied if CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE is _not_ defined */
  52. #define CSR_LOG_LEVEL_TASK_TIMER_IN ((CsrLogLevelTask) 0x00004000) /* TimedEventIn events are logged */
  53. #define CSR_LOG_LEVEL_TASK_TIMER_IN_LOC ((CsrLogLevelTask) 0x00008000) /* The location where a timer was started are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TIMER_IN, it has no effect without it */
  54. #define CSR_LOG_LEVEL_TASK_TIMER_CANCEL ((CsrLogLevelTask) 0x00010000) /* TimedEventCancel events are logged */
  55. #define CSR_LOG_LEVEL_TASK_TIMER_CANCEL_LOC ((CsrLogLevelTask) 0x00020000) /* The location where a timer was cancelled are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TIMER_CANCEL, it has no effect without it */
  56. #define CSR_LOG_LEVEL_TASK_TIMER_FIRE ((CsrLogLevelTask) 0x00040000) /* TimedEventFire events are logged */
  57. #define CSR_LOG_LEVEL_TASK_TIMER_DONE ((CsrLogLevelTask) 0x00080000) /* TimedEventDone events are logged */
  58. /* The bit masks between here are reserved for future usage */
  59. #define CSR_LOG_LEVEL_TASK_ALL ((CsrLogLevelTask) 0xFFFFFFFF & ~(CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE | CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT)) /* All info possible to log for a task are logged. WARNING: By using this define the application also accepts future possible task data/events in the logs */
  60. u8 CsrLogEnvironmentIsFiltered(CsrLogLevelEnvironment level);
  61. CsrLogLevelTask CsrLogTaskFilterGet(CsrSchedQid taskId);
  62. u8 CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level);
  63. /*
  64. * Logging stuff
  65. */
  66. #define CSR_LOG_STRINGIFY_REAL(a) (#a)
  67. #define CSR_LOG_STRINGIFY(a) CSR_LOG_STRINGIFY_REAL(a)
  68. typedef struct {
  69. u16 primitiveType;
  70. const char *primitiveName;
  71. CsrMsgConvMsgEntry *messageConv; /* Private - do not use */
  72. } CsrLogPrimitiveInformation;
  73. typedef struct {
  74. const char *techVer;
  75. u32 primitiveInfoCount;
  76. CsrLogPrimitiveInformation *primitiveInfo;
  77. } CsrLogTechInformation;
  78. /*---------------------------------*/
  79. /* Tech logging */
  80. /*---------------------------------*/
  81. typedef u8 bitmask8_t;
  82. typedef u16 bitmask16_t;
  83. typedef u32 bitmask32_t;
  84. #ifdef CSR_LOG_ENABLE
  85. #ifdef CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER
  86. /* DEPRECATED - replaced by csr_log_text.h */
  87. #define CSR_LOG_TEXT(text) \
  88. do { \
  89. if (!CsrLogTaskIsFiltered(CsrSchedTaskQueueGet(), CSR_LOG_LEVEL_TASK_TEXT)) { \
  90. CsrLogTaskText(text, __LINE__, __FILE__); \
  91. } \
  92. } while (0)
  93. #else
  94. /* DEPRECATED - replaced by csr_log_text.h */
  95. #define CSR_LOG_TEXT(text) \
  96. do { \
  97. if (!CsrLogTaskIsFiltered(CsrSchedTaskQueueGet(), CSR_LOG_LEVEL_TASK_TEXT)) { \
  98. CsrLogTaskText(text, 0, NULL); \
  99. } \
  100. } while (0)
  101. #endif
  102. #else
  103. #define CSR_LOG_TEXT(text)
  104. #endif
  105. /* DEPRECATED - replaced by csr_log_text.h */
  106. void CsrLogTaskText(const char *text,
  107. u32 line,
  108. const char *file);
  109. #define CSR_LOG_STATE_TRANSITION_MASK_FSM_NAME (0x001)
  110. #define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE (0x002)
  111. #define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE_STR (0x004)
  112. #define CSR_LOG_STATE_TRANSITION_MASK_PREV_STATE (0x008)
  113. #define CSR_LOG_STATE_TRANSITION_MASK_PREV_STATE_STR (0x010)
  114. #define CSR_LOG_STATE_TRANSITION_MASK_EVENT (0x020)
  115. #define CSR_LOG_STATE_TRANSITION_MASK_EVENT_STR (0x040)
  116. /* DEPRECATED - replaced by csr_log_text.h */
  117. void CsrLogStateTransition(bitmask16_t mask,
  118. u32 identifier,
  119. const char *fsm_name,
  120. u32 prev_state,
  121. const char *prev_state_str,
  122. u32 in_event,
  123. const char *in_event_str,
  124. u32 next_state,
  125. const char *next_state_str,
  126. u32 line,
  127. const char *file);
  128. /*---------------------------------*/
  129. /* BSP logging */
  130. /*---------------------------------*/
  131. void CsrLogSchedInit(u8 thread_id);
  132. void CsrLogSchedDeinit(u8 thread_id);
  133. void CsrLogSchedStart(u8 thread_id);
  134. void CsrLogSchedStop(u8 thread_id);
  135. void CsrLogInitTask(u8 thread_id, CsrSchedQid tskid, const char *tskName);
  136. void CsrLogDeinitTask(u16 task_id);
  137. void CsrLogActivate(CsrSchedQid tskid);
  138. void CsrLogDeactivate(CsrSchedQid tskid);
  139. #define SYNERGY_SERIALIZER_TYPE_DUMP (0x000)
  140. #define SYNERGY_SERIALIZER_TYPE_SER (0x001)
  141. void CsrLogMessagePut(u32 line,
  142. const char *file,
  143. CsrSchedQid src_task_id,
  144. CsrSchedQid dst_taskid,
  145. CsrSchedMsgId msg_id,
  146. u16 prim_type,
  147. const void *msg);
  148. void CsrLogMessageGet(CsrSchedQid src_task_id,
  149. CsrSchedQid dst_taskid,
  150. u8 get_res,
  151. CsrSchedMsgId msg_id,
  152. u16 prim_type,
  153. const void *msg);
  154. void CsrLogTimedEventIn(u32 line,
  155. const char *file,
  156. CsrSchedQid task_id,
  157. CsrSchedTid tid,
  158. u32 requested_delay,
  159. u16 fniarg,
  160. const void *fnvarg);
  161. void CsrLogTimedEventFire(CsrSchedQid task_id,
  162. CsrSchedTid tid);
  163. void CsrLogTimedEventDone(CsrSchedQid task_id,
  164. CsrSchedTid tid);
  165. void CsrLogTimedEventCancel(u32 line,
  166. const char *file,
  167. CsrSchedQid task_id,
  168. CsrSchedTid tid,
  169. u8 cancel_res);
  170. void CsrLogBgintRegister(u8 thread_id,
  171. CsrSchedBgint irq,
  172. const char *callback,
  173. const void *ptr);
  174. void CsrLogBgintUnregister(CsrSchedBgint irq);
  175. void CsrLogBgintSet(CsrSchedBgint irq);
  176. void CsrLogBgintServiceStart(CsrSchedBgint irq);
  177. void CsrLogBgintServiceDone(CsrSchedBgint irq);
  178. void CsrLogExceptionStateEvent(u16 prim_type,
  179. CsrPrim msg_type,
  180. u16 state,
  181. u32 line,
  182. const char *file);
  183. void CsrLogExceptionGeneral(u16 prim_type,
  184. u16 state,
  185. const char *text,
  186. u32 line,
  187. const char *file);
  188. void CsrLogExceptionWarning(u16 prim_type,
  189. u16 state,
  190. const char *text,
  191. u32 line,
  192. const char *file);
  193. #endif