hv_boot_Common.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * @file hv_boot_Common.h
  3. * @brief Header file of ddr .
  4. *
  5. * @verbatim
  6. * ==============================================================================
  7. * ##### How to use #####
  8. * ==============================================================================
  9. * (+)
  10. * @endverbatim
  11. * @author HiView SoC Software Team
  12. * @version 1.0.0
  13. * @date 2022-08-18
  14. */
  15. #ifndef __HV_BOOT_COMMON_H
  16. #define __HV_BOOT_COMMON_H
  17. #define BOOT_DEBUG_LEVEL_VERBOSE 0
  18. #define BOOT_DEBUG_LEVEL_DEBUG 1
  19. #define BOOT_DEBUG_LEVEL_INFO 2
  20. #define BOOT_DEBUG_LEVEL_WAR 3
  21. #define BOOT_DEBUG_LEVEL_ERR 4
  22. #define BOOT_DEBUG_CONTR_LEVELL 3
  23. #define BOOT_RD32(addr) (*(volatile unsigned int*)((addr) | 0xa0000000))
  24. #define BOOT_WT32(addr, value) (*(volatile unsigned int*)((addr) | 0xa0000000) = (value))
  25. #define BOOT_W32_FIELD(addr, field, value) do { \
  26. unsigned int _val = BOOT_RD32(addr); \
  27. ((addr##_struct*)&(_val))->field = value; \
  28. BOOT_WT32(addr, _val); \
  29. } while (0)
  30. #define BOOT_R32_DECL_VAR() unsigned int _reg_val
  31. #define BOOT_R32_FIELD(addr, field) \
  32. (_reg_val = BOOT_RD32(addr), ((addr##_struct*)(void*)&(_reg_val))->field)
  33. void Hv_Boot_PrintHex(unsigned int Level, unsigned int uiVal);
  34. void Hv_Boot_Print_String(unsigned int Level, const char *pcString);
  35. void Hv_Boot_Wait_Us(unsigned int Us);
  36. void Hv_Boot_Wait_Ms(unsigned int Ms);
  37. #endif