fddma_selftest.c 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright : (C) 2022 Phytium Information Technology, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is OPEN SOURCE software: you can redistribute it and/or modify it
  6. * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
  7. * either version 1.0 of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
  10. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. * See the Phytium Public License for more details.
  12. *
  13. *
  14. * FilePath: fddma_selftest.c
  15. * Date: 2022-02-10 14:53:42
  16. * LastEditTime: 2022-02-18 08:24:47
  17. * Description:  This files is for ddma self test
  18. *
  19. * Modify History:
  20. * Ver   Who        Date         Changes
  21. * ----- ------     --------    --------------------------------------
  22. * 1.0 Zhugengyu 2022/5/13 init commit
  23. */
  24. /***************************** Include Files *********************************/
  25. #include <string.h>
  26. #include "fkernel.h"
  27. #include "fparameters.h"
  28. #include "fassert.h"
  29. #include "fdebug.h"
  30. #include "fddma_hw.h"
  31. #include "fddma.h"
  32. /************************** Constant Definitions *****************************/
  33. /**************************** Type Definitions *******************************/
  34. /************************** Variable Definitions *****************************/
  35. /***************** Macros (Inline Functions) Definitions *********************/
  36. #define FDDMA_DEBUG_TAG "DDMA-TEST"
  37. #define FDDMA_ERROR(format, ...) FT_DEBUG_PRINT_E(FDDMA_DEBUG_TAG, format, ##__VA_ARGS__)
  38. #define FDDMA_WARN(format, ...) FT_DEBUG_PRINT_W(FDDMA_DEBUG_TAG, format, ##__VA_ARGS__)
  39. #define FDDMA_INFO(format, ...) FT_DEBUG_PRINT_I(FDDMA_DEBUG_TAG, format, ##__VA_ARGS__)
  40. #define FDDMA_DEBUG(format, ...) FT_DEBUG_PRINT_D(FDDMA_DEBUG_TAG, format, ##__VA_ARGS__)
  41. #define FDDMA_DUMPER(base_addr, reg_off, reg_name) \
  42. FDDMA_DEBUG("\t\t[%s]@0x%x\t=\t0x%x", reg_name, (reg_off), FDdmaReadReg((base_addr), (reg_off)))
  43. /************************** Function Prototypes ******************************/
  44. /****************************************************************************/
  45. void FDdmaDumpRegisters(uintptr base_addr)
  46. {
  47. FDDMA_DEBUG("ddma@0x%x", base_addr);
  48. FDDMA_DUMPER(base_addr, FDDMA_CTL_OFFSET, "ctl");
  49. FDDMA_DUMPER(base_addr, FDDMA_CHAN_0_3_CFG_OFFSET, "chan_0_3");
  50. FDDMA_DUMPER(base_addr, FDDMA_STA_OFFSET, "sta");
  51. FDDMA_DUMPER(base_addr, FDDMA_MASK_INTR_OFFSET, "mask_intr");
  52. FDDMA_DUMPER(base_addr, FDDMA_UP_AXI_AW_CFG_OFFSET, "up_axi_aw");
  53. FDDMA_DUMPER(base_addr, FDDMA_UP_AXI_AR_CFG_OFFSET, "up_axi_ar");
  54. FDDMA_DUMPER(base_addr, FDDMA_DOWN_AXI_AW_CFG_OFFSET, "dw_axi_aw");
  55. FDDMA_DUMPER(base_addr, FDDMA_DOWN_AXI_AR_CFG_OFFSET, "dw_axi_ar");
  56. FDDMA_DUMPER(base_addr, FDDMA_CHAN_BIND_OFFSET, "chan_bind");
  57. FDDMA_DUMPER(base_addr, FDDMA_GCAP_OFFSET, "gcap");
  58. FDDMA_DUMPER(base_addr, FDDMA_CHAN_4_7_CFG_OFFSET, "chan_4_7");
  59. }
  60. void FDdmaDumpChanRegisters(uintptr base_addr, FDdmaChanIndex chan)
  61. {
  62. FDDMA_DEBUG("\tchan-%d", chan);
  63. FDDMA_DUMPER(base_addr, FDDMA_CHAN_DDR_UP_ADDR_OFFSET(chan), "ddr_up");
  64. FDDMA_DUMPER(base_addr, FDDMA_CHAN_DDR_LOW_ADDR_OFFSET(chan), "ddr_low");
  65. FDDMA_DUMPER(base_addr, FDDMA_CHAN_DEV_ADDR_OFFSET(chan), "dev");
  66. FDDMA_DUMPER(base_addr, FDDMA_CHAN_TS_OFFSET(chan), "ts");
  67. FDDMA_DUMPER(base_addr, FDDMA_CHAN_CRT_UP_ADDR_OFFSET(chan), "crt_up");
  68. FDDMA_DUMPER(base_addr, FDDMA_CHAN_CRT_LOW_ADDR_OFFSET(chan), "crt_low");
  69. FDDMA_DUMPER(base_addr, FDDMA_CHAN_CTL_OFFSET(chan), "ctl");
  70. FDDMA_DUMPER(base_addr, FDDMA_CHAN_STS_OFFSET(chan), "sts");
  71. FDDMA_DUMPER(base_addr, FDDMA_CHAN_TIMEOUT_CNT_OFFSET(chan), "cnt");
  72. }