xplatform_info.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2014-2020 Xilinx, Inc.
  3. * Copyright (c) 2020-2021, WangHuachen
  4. * All rights reserved.
  5. * SPDX-License-Identifier: MIT
  6. *
  7. * Change Logs:
  8. * Date Author Notes
  9. * 2020-11-30 WangHuachen the first version
  10. */
  11. #ifndef XPLATFORM_INFO_H /* prevent circular inclusions */
  12. #define XPLATFORM_INFO_H /* by using protection macros */
  13. #include "xil_types.h"
  14. #include "xparameters.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #if defined (versal)
  19. #define XPAR_PMC_TAP_BASEADDR 0xF11A0000U
  20. #define XPAR_PMC_TAP_VERSION_OFFSET 0x00000004U
  21. #define XPLAT_PS_VERSION_ADDRESS (XPAR_PMC_TAP_BASEADDR + \
  22. XPAR_PMC_TAP_VERSION_OFFSET)
  23. #else
  24. #define XPAR_CSU_BASEADDR 0xFFCA0000U
  25. #define XPAR_CSU_VER_OFFSET 0x00000044U
  26. #define XPLAT_PS_VERSION_ADDRESS (XPAR_CSU_BASEADDR + \
  27. XPAR_CSU_VER_OFFSET)
  28. #endif
  29. #define XPLAT_ZYNQ_ULTRA_MP_SILICON 0x0
  30. #define XPLAT_ZYNQ_ULTRA_MP 0x1
  31. #define XPLAT_ZYNQ_ULTRA_MPVEL 0x2
  32. #define XPLAT_ZYNQ_ULTRA_MPQEMU 0x3
  33. #define XPLAT_ZYNQ 0x4
  34. #define XPLAT_MICROBLAZE 0x5
  35. #define XPLAT_VERSAL 0x6U
  36. #define XPS_VERSION_1 0x0
  37. #define XPS_VERSION_2 0x1
  38. #define XPLAT_INFO_MASK (0xF)
  39. #if defined (versal)
  40. #define XPS_VERSION_INFO_MASK 0xFF00U
  41. #define XPS_VERSION_INFO_SHIFT 0x8U
  42. #define XPLAT_INFO_SHIFT 0x18U
  43. #else
  44. #define XPS_VERSION_INFO_MASK (0xF)
  45. #define XPS_VERSION_INFO_SHIFT 0x0U
  46. #define XPLAT_INFO_SHIFT 0xCU
  47. #endif
  48. static INLINE u32 XGetPlatform_Info()
  49. {
  50. #if defined (versal)
  51. return XPLAT_VERSAL;
  52. #elif defined (ARMR5) || (__aarch64__) || (ARMA53_32) || (PSU_PMU)
  53. return XPLAT_ZYNQ_ULTRA_MP;
  54. #elif (__microblaze__)
  55. return XPLAT_MICROBLAZE;
  56. #else
  57. return XPLAT_ZYNQ;
  58. #endif
  59. }
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif /* end of protection macro */
  64. /**
  65. * @} End of "addtogroup common_platform_info".
  66. */