dbglog.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #ifndef _DBGLOG_H_
  27. #define _DBGLOG_H_
  28. #ifndef ATH_TARGET
  29. #include "athstartpack.h"
  30. #endif
  31. #include <wlan_module_ids.h>
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #define DBGLOG_TIMESTAMP_OFFSET 0
  36. #define DBGLOG_TIMESTAMP_MASK 0xFFFFFFFF /* Bit 0-15. Contains bit
  37. 8-23 of the LF0 timer */
  38. #define DBGLOG_DBGID_OFFSET 0
  39. #define DBGLOG_DBGID_MASK 0x000003FF /* Bit 0-9 */
  40. #define DBGLOG_DBGID_NUM_MAX 256 /* Upper limit is width of mask */
  41. #define DBGLOG_MODULEID_OFFSET 10
  42. #define DBGLOG_MODULEID_MASK 0x0003FC00 /* Bit 10-17 */
  43. #define DBGLOG_MODULEID_NUM_MAX 32 /* Upper limit is width of mask */
  44. #define DBGLOG_VDEVID_OFFSET 18
  45. #define DBGLOG_VDEVID_MASK 0x03FC0000 /* Bit 20-25*/
  46. #define DBGLOG_VDEVID_NUM_MAX 16
  47. #define DBGLOG_NUM_ARGS_OFFSET 26
  48. #define DBGLOG_NUM_ARGS_MASK 0xFC000000 /* Bit 26-31 */
  49. #define DBGLOG_NUM_ARGS_MAX 9 /* it is bcoz of limitation
  50. of corebsp MSG*() to accept max 9 arg */
  51. #define DBGLOG_LOG_BUFFER_SIZE 1500
  52. #define DBGLOG_DBGID_DEFINITION_LEN_MAX 90
  53. #define DBGLOG_HOST_LOG_BUFFER_SIZE DBGLOG_LOG_BUFFER_SIZE
  54. #define DBGLOG_GET_DBGID(arg) \
  55. ((arg & DBGLOG_DBGID_MASK) >> DBGLOG_DBGID_OFFSET)
  56. #define DBGLOG_GET_MODULEID(arg) \
  57. ((arg & DBGLOG_MODULEID_MASK) >> DBGLOG_MODULEID_OFFSET)
  58. #define DBGLOG_GET_VDEVID(arg) \
  59. ((arg & DBGLOG_VDEVID_MASK) >> DBGLOG_VDEVID_OFFSET)
  60. #define DBGLOG_GET_NUMARGS(arg) \
  61. ((arg & DBGLOG_NUM_ARGS_MASK) >> DBGLOG_NUM_ARGS_OFFSET)
  62. #define DBGLOG_GET_TIME_STAMP(arg) \
  63. ((arg & DBGLOG_TIMESTAMP_MASK) >> DBGLOG_TIMESTAMP_OFFSET)
  64. /* Debug Log levels*/
  65. typedef enum {
  66. DBGLOG_ML = 0,
  67. DBGLOG_VERBOSE = 0,
  68. DBGLOG_INFO,
  69. DBGLOG_INFO_LVL_1,
  70. DBGLOG_INFO_LVL_2,
  71. DBGLOG_WARN,
  72. DBGLOG_ERR,
  73. DBGLOG_LVL_MAX
  74. }DBGLOG_LOG_LVL;
  75. PREPACK struct dbglog_buf_s {
  76. struct dbglog_buf_s *next;
  77. A_UINT8 *buffer;
  78. A_UINT32 bufsize;
  79. A_UINT32 length;
  80. A_UINT32 count;
  81. A_UINT32 free;
  82. } POSTPACK;
  83. PREPACK struct dbglog_hdr_s {
  84. struct dbglog_buf_s *dbuf;
  85. A_UINT32 dropped;
  86. } POSTPACK;
  87. #define DBGLOG_MAX_VDEVID 15 /* 0-15 */
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif /* _DBGLOG_H_ */