hv_pm51_Reg.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * @file hv_pm51_Reg.h
  3. * @brief PM51 register related define.
  4. *
  5. * @verbatim
  6. * ==============================================================================
  7. * ##### How to use #####
  8. * ==============================================================================
  9. * (+) Use ()
  10. *
  11. * @endverbatim
  12. * @author HiView SoC Software Team
  13. * @version 1.0.0
  14. * @date 2023-03-01
  15. */
  16. #ifndef __HV_PM51_REG_H__
  17. #define __HV_PM51_REG_H__
  18. #include "hv_pm51_Base.h"
  19. #define XDATABYTE(regaddr) *((UCHAR8 xdata *)(regaddr))
  20. #define XDATADWORD(regaddr) *((ULONG32 xdata *)(regaddr))
  21. #define Write_XDATAReg(regaddr, value) XDATABYTE(regaddr) = (value)
  22. #define Read_XDATAReg(regaddr) XDATABYTE(regaddr)
  23. #define Write_XDATARegDWORD(regaddr, value) XDATADWORD(regaddr) = (value)
  24. #define Read_XDATARegDWORD(regaddr) XDATADWORD(regaddr)
  25. /* dma register define */
  26. /* dma transfer xram start addr */
  27. #define reg_xram_startaddr_low_byte (0x8000)
  28. #define reg_xram_startaddr_high_byte (reg_xram_startaddr_low_byte + 1)
  29. /* dma transfer data length */
  30. #define reg_lenth_count_low_byte (0x8002)
  31. #define reg_lenth_count_high_byte (reg_lenth_count_low_byte + 1)
  32. /* dma transfer eerpom start address */
  33. #define reg_code_startaddr_byte0 (0x8005)
  34. #define reg_code_startaddr_byte1 (reg_code_startaddr_byte0 + 1)
  35. #define reg_code_startaddr_byte2 (reg_code_startaddr_byte1 + 1)
  36. /* dma trigger reg */
  37. #define reg_length_cnt_flag (0x8004) /* 0x8004[7] set 1 to trigger dma, hw clear to 0 after dma done */
  38. /* sfr & esfr register define */
  39. /* Timer divider ,keep default */
  40. sfr ET10USL = 0xA6;
  41. sfr ET10USH = 0xA7;
  42. /* Timer WDG Enable */
  43. /* [0]: timer0 [1]: timer1 [2]: watchdog [7]: 1 = read reg counter 0= read setting value */
  44. sfr ETEA = 0xA9;
  45. /* Timer value set */
  46. sfr ET0L = 0xAA;
  47. sfr ET0H = 0xAB;
  48. sfr ET1L = 0xAC;
  49. sfr ET1H = 0xAD;
  50. /* WDG valuse set */
  51. sfr EWDG = 0xAE;
  52. /* APB Addr High 16bit offset for 8051 */
  53. sfr APB_AddrReg_Low = 0xC4;
  54. sfr APB_AddrReg_High = 0xC5;
  55. /* std 8051 sfr */
  56. sfr T2CON = 0xC8;
  57. sfr RCP2L = 0xCA;
  58. sfr RCP2H = 0xCB;
  59. sfr TL2 = 0xCC;
  60. sfr TH2 = 0xCD;
  61. sfr EI1 = 0xE8;
  62. /* int proirity */
  63. sfr IPH = 0xB9;
  64. sfr IP1 = 0xF8;
  65. sfr IPH1 = 0xF9;
  66. #endif