1 /* 2 * Copyright (C) 2017-2019 Alibaba Group Holding Limited 3 */ 4 5 /****************************************************************************** 6 * @file dw_timer.h 7 * @brief header file for timer driver 8 * @version V1.0 9 * @date 02. June 2017 10 ******************************************************************************/ 11 #ifndef __DW_TIMER_H 12 #define __DW_TIMER_H 13 14 #include <stdio.h> 15 #include "soc.h" 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 /* 22 * define the bits for TxControl 23 */ 24 #define DW_TIMER_TXCONTROL_ENABLE (1UL << 0) 25 #define DW_TIMER_TXCONTROL_MODE (1UL << 1) 26 #define DW_TIMER_TXCONTROL_INTMASK (1UL << 2) 27 #define DW_TIMER_TXCONTROL_TRIGGER (1UL << 4) 28 29 #define DW_TIMER_INIT_DEFAULT_VALUE (0xffffffff / drv_get_timer_freq(0) * 1000000) 30 31 typedef struct { 32 __IOM uint32_t TxLoadCount; /* Offset: 0x000 (R/W) Receive buffer register */ 33 __IM uint32_t TxCurrentValue; /* Offset: 0x004 (R) Transmission hold register */ 34 __IOM uint8_t TxControl: 5; /* Offset: 0x008 (R/W) Clock frequency division low section register */ 35 uint8_t RESERVED0[3]; 36 __IM uint8_t TxEOI: 1; /* Offset: 0x00c (R) Clock frequency division high section register */ 37 uint8_t RESERVED1[3]; 38 __IM uint8_t TxIntStatus: 1; /* Offset: 0x010 (R) Interrupt enable register */ 39 uint8_t RESERVED2[3]; 40 } dw_timer_reg_t; 41 42 #ifdef __cplusplus 43 } 44 #endif 45 46 #endif /* __DW_TIMER_H */ 47 48