debug.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /* SPDX-License-Identifier: LGPL-2.1 OR BSD-3-Clause */
  2. /*
  3. * Copyright (c) 2019, Chips&Media
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  16. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  19. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #ifndef _DEBUG_H_
  27. #define _DEBUG_H_
  28. #ifdef USE_FEEDING_METHOD_BUFFER
  29. #include "wave511/config.h"
  30. #include "wave511/sample_v2/helper/main_helper.h"
  31. #else
  32. #include "config.h"
  33. #include "main_helper.h"
  34. #endif
  35. enum {
  36. CNMQC_ENV_NONE,
  37. CNMQC_ENV_GDBSERVER, /*!<< It executes gdb server in order to debug F/W on the C&M FPGA env. */
  38. CNMQC_ENV_MAX,
  39. };
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif /* __cplusplus */
  43. extern void InitializeDebugEnv(Uint32 options);
  44. extern void ReleaseDebugEnv(void);
  45. extern void ExecuteDebugger(void);
  46. void ChekcAndPrintDebugInfo(VpuHandle handle, BOOL isEnc, RetCode result);
  47. void PrintDecVpuStatus(
  48. DecHandle handle
  49. );
  50. void PrintEncVpuStatus(
  51. EncHandle handle
  52. );
  53. void PrintMemoryAccessViolationReason(
  54. Uint32 core_idx,
  55. void *outp
  56. );
  57. #define VCORE_DBG_ADDR(__vCoreIdx) 0x8000+(0x1000*__vCoreIdx) + 0x300
  58. #define VCORE_DBG_DATA(__vCoreIdx) 0x8000+(0x1000*__vCoreIdx) + 0x304
  59. #define VCORE_DBG_READY(__vCoreIdx) 0x8000+(0x1000*__vCoreIdx) + 0x308
  60. void WriteRegVCE(
  61. Uint32 core_idx,
  62. Uint32 vce_core_idx,
  63. Uint32 vce_addr,
  64. Uint32 udata
  65. );
  66. Uint32 ReadRegVCE(
  67. Uint32 core_idx,
  68. Uint32 vce_core_idx,
  69. Uint32 vce_addr
  70. );
  71. extern char dumpTime[200];
  72. #define HEXDUMP_COLS 16
  73. void DisplayHex(void *mem, Uint32 len, char* name);
  74. RetCode PrintVpuProductInfo(
  75. Uint32 core_idx,
  76. VpuAttr* productInfo
  77. );
  78. Int32 HandleDecInitSequenceError(
  79. DecHandle handle,
  80. Uint32 productId,
  81. DecOpenParam* openParam,
  82. DecInitialInfo* seqInfo,
  83. RetCode apiErrorCode
  84. );
  85. void HandleDecoderError(
  86. DecHandle handle,
  87. Uint32 frameIdx,
  88. DecOutputInfo* outputInfo
  89. );
  90. void DumpCodeBuffer(
  91. const char* path
  92. );
  93. void HandleEncoderError(
  94. EncHandle handle,
  95. Uint32 encPicCnt,
  96. EncOutputInfo* outputInfo
  97. );
  98. Uint32 SetEncoderTimeout(
  99. int width,
  100. int height
  101. );
  102. void print_busy_timeout_status(
  103. Uint32 coreIdx,
  104. Uint32 product_code,
  105. Uint32 pc
  106. );
  107. void wave5xx_vcpu_status (
  108. unsigned long coreIdx
  109. );
  110. void vdi_print_vpu_status(
  111. unsigned long coreIdx
  112. );
  113. void wave5xx_bpu_status(
  114. Uint32 coreIdx
  115. );
  116. void vdi_print_vcore_status(
  117. Uint32 coreIdx
  118. );
  119. void vdi_print_vpu_status_dec(
  120. unsigned long coreIdx
  121. );
  122. void vdi_print_vpu_status_enc(
  123. unsigned long coreIdx
  124. );
  125. void vdi_log(
  126. unsigned long coreIdx,
  127. int cmd,
  128. int step
  129. );
  130. #ifdef __cplusplus
  131. }
  132. #endif /* __cplusplus */
  133. #endif /* _DEBUG_H_ */