dbglog.h 3.6 KB

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