debug.h 3.9 KB

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