File indexing completed on 2025-05-11 08:24:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059 #ifndef __ALTERA_AVALON_TIMER_REGS_H__
0060 #define __ALTERA_AVALON_TIMER_REGS_H__
0061
0062 #include <bsp_system.h>
0063
0064 #ifdef __cplusplus
0065 extern "C" {
0066 #endif
0067
0068 #define ALTERA_AVALON_TIMER_STATUS_TO_MSK (0x1)
0069 #define ALTERA_AVALON_TIMER_STATUS_TO_OFST (0)
0070 #define ALTERA_AVALON_TIMER_STATUS_RUN_MSK (0x2)
0071 #define ALTERA_AVALON_TIMER_STATUS_RUN_OFST (1)
0072
0073 #define ALTERA_AVALON_TIMER_CONTROL_ITO_MSK (0x1)
0074 #define ALTERA_AVALON_TIMER_CONTROL_ITO_OFST (0)
0075 #define ALTERA_AVALON_TIMER_CONTROL_CONT_MSK (0x2)
0076 #define ALTERA_AVALON_TIMER_CONTROL_CONT_OFST (1)
0077 #define ALTERA_AVALON_TIMER_CONTROL_START_MSK (0x4)
0078 #define ALTERA_AVALON_TIMER_CONTROL_START_OFST (2)
0079 #define ALTERA_AVALON_TIMER_CONTROL_STOP_MSK (0x8)
0080 #define ALTERA_AVALON_TIMER_CONTROL_STOP_OFST (3)
0081
0082 #define ALTERA_AVALON_TIMER_PERIODL_MSK (0xFFFF)
0083 #define ALTERA_AVALON_TIMER_PERIODL_OFST (0)
0084
0085 #define ALTERA_AVALON_TIMER_PERIODH_MSK (0xFFFF)
0086 #define ALTERA_AVALON_TIMER_PERIODH_OFST (0)
0087
0088 #define ALTERA_AVALON_TIMER_SNAPL_MSK (0xFFFF)
0089 #define ALTERA_AVALON_TIMER_SNAPL_OFST (0)
0090
0091 #define ALTERA_AVALON_TIMER_SNAPH_MSK (0xFFFF)
0092 #define ALTERA_AVALON_TIMER_SNAPH_OFST (0)
0093
0094 #define ALTERA_AVALON_TIMER_PERIOD_0_MSK (0xFFFF)
0095 #define ALTERA_AVALON_TIMER_PERIOD_0_OFST (0)
0096
0097 #define ALTERA_AVALON_TIMER_PERIOD_1_MSK (0xFFFF)
0098 #define ALTERA_AVALON_TIMER_PERIOD_1_OFST (0)
0099
0100 #define ALTERA_AVALON_TIMER_PERIOD_2_MSK (0xFFFF)
0101 #define ALTERA_AVALON_TIMER_PERIOD_2_OFST (0)
0102
0103 #define ALTERA_AVALON_TIMER_PERIOD_3_MSK (0xFFFF)
0104 #define ALTERA_AVALON_TIMER_PERIOD_3_OFST (0)
0105
0106 #define ALTERA_AVALON_TIMER_SNAP_0_MSK (0xFFFF)
0107 #define ALTERA_AVALON_TIMER_SNAP_0_OFST (0)
0108
0109 #define ALTERA_AVALON_TIMER_SNAP_1_MSK (0xFFFF)
0110 #define ALTERA_AVALON_TIMER_SNAP_1_OFST (0)
0111
0112 #define ALTERA_AVALON_TIMER_SNAP_2_MSK (0xFFFF)
0113 #define ALTERA_AVALON_TIMER_SNAP_2_OFST (0)
0114
0115 #define ALTERA_AVALON_TIMER_SNAP_3_MSK (0xFFFF)
0116 #define ALTERA_AVALON_TIMER_SNAP_3_OFST (0)
0117
0118 #define MTIMECMP_MAX_VALUE 0xFFFFFFFFFFFFFFFF
0119
0120 typedef struct
0121 {
0122 volatile uint32_t status;
0123 volatile uint32_t control;
0124 volatile uint32_t period_lo;
0125 volatile uint32_t period_hi;
0126 volatile uint32_t snap_lo;
0127 volatile uint32_t snap_hi;
0128 }altera_avalon_timer_regs_32;
0129
0130 typedef struct
0131 {
0132 volatile uint32_t status;
0133 volatile uint32_t control;
0134 volatile uint32_t period_0;
0135 volatile uint32_t period_1;
0136 volatile uint32_t period_2;
0137 volatile uint32_t period_3;
0138 volatile uint32_t snap_0;
0139 volatile uint32_t snap_1;
0140 volatile uint32_t snap_2;
0141 volatile uint32_t snap_3;
0142 }altera_avalon_timer_regs_64;
0143
0144 typedef struct
0145 {
0146 volatile uint32_t status;
0147 volatile uint32_t control;
0148 volatile uint32_t period;
0149 volatile uint32_t snap;
0150 volatile uint32_t prescalar;
0151 }altera_avalon_timer_precale_regs;
0152
0153 typedef struct
0154 {
0155 volatile uint32_t mtimecmp_lo;
0156 volatile uint32_t mtimecmp_hi;
0157 volatile uint32_t mtime_lo;
0158 volatile uint32_t mtime_hi;
0159 }altera_niosv_timer_regs;
0160
0161 #define CLOCK_REGS \
0162 ((volatile altera_niosv_timer_regs* )ALT_CPU_MTIME_OFFSET)
0163 #define CLOCK_FREQ ALT_CPU_FREQ
0164 #define CLOCK_VECTOR NIOSV_INTERRUPT_VECTOR_TIMER
0165
0166 #define TIMER_REGS \
0167 ((volatile altera_avalon_timer_precale_regs* )BENCHMARK_TIMER_BASE)
0168 #define TIMER_FREQ BENCHMARK_TIMER_FREQ
0169 #define TIMER_VECTOR BENCHMARK_TIMER_IRQ
0170
0171 #define WATCHDOG_REGS \
0172 ((volatile altera_avalon_timer_regs_32* )WATCHDOG_TIMER_BASE)
0173 #define WATCHDOG_FREQ WATCHDOG_TIMER_FREQ
0174 #define WATCHDOG_VECTOR WATCHDOG_TIMER_IRQ
0175
0176 #ifdef __cplusplus
0177 }
0178 #endif
0179
0180 #endif