dw_timer.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2017-2019 Alibaba Group Holding Limited
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-08-20 zx.chen header file for timer driver
  9. */
  10. #ifndef __DW_TIMER_H
  11. #define __DW_TIMER_H
  12. #include <stdio.h>
  13. #include "soc.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /*
  18. * define the bits for TxControl
  19. */
  20. #define DW_TIMER_TXCONTROL_ENABLE (1UL << 0)
  21. #define DW_TIMER_TXCONTROL_MODE (1UL << 1)
  22. #define DW_TIMER_TXCONTROL_INTMASK (1UL << 2)
  23. #define DW_TIMER_TXCONTROL_TRIGGER (1UL << 4)
  24. #define DW_TIMER_INIT_DEFAULT_VALUE (0xffffffff / drv_get_timer_freq(0) * 1000000)
  25. typedef struct
  26. {
  27. __IOM uint32_t TxLoadCount; /* Offset: 0x000 (R/W) Receive buffer register */
  28. __IM uint32_t TxCurrentValue; /* Offset: 0x004 (R) Transmission hold register */
  29. __IOM uint8_t TxControl: 5; /* Offset: 0x008 (R/W) Clock frequency division low section register */
  30. uint8_t RESERVED0[3];
  31. __IM uint8_t TxEOI: 1; /* Offset: 0x00c (R) Clock frequency division high section register */
  32. uint8_t RESERVED1[3];
  33. __IM uint8_t TxIntStatus: 1; /* Offset: 0x010 (R) Interrupt enable register */
  34. uint8_t RESERVED2[3];
  35. } dw_timer_reg_t;
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif /* __DW_TIMER_H */