@@ -93,6 +93,69 @@ static int sam_timerisr(int irq, uint32_t *regs, void *arg)
93
93
* Public Functions
94
94
****************************************************************************/
95
95
96
+ #ifdef CONFIG_CLOCK_ADJTIME
97
+
98
+ /****************************************************************************
99
+ * Function: up_adj_timer_period
100
+ *
101
+ * Description:
102
+ * Adjusts timer period. This call is used when adjusting timer period as
103
+ * defined in adjtime() function.
104
+ *
105
+ * Input Parameters:
106
+ * period_inc_usec - period adjustment in usec (reset to default value
107
+ * if 0)
108
+ *
109
+ ****************************************************************************/
110
+
111
+ void up_adj_timer_period (long long period_inc_usec )
112
+ {
113
+ uint32_t period ;
114
+ long long period_inc ;
115
+
116
+ if (period_inc_usec == 0 )
117
+ {
118
+ period_inc = 0 ;
119
+ }
120
+ else
121
+ {
122
+ period_inc = (SAM_SYSTICK_CLOCK / 1000000 ) * period_inc_usec - 1 ;
123
+ }
124
+
125
+ period = SYSTICK_RELOAD + period_inc ;
126
+
127
+ /* Check whether period is at maximum value. */
128
+
129
+ if (period > 0x00ffffff )
130
+ {
131
+ period = 0x00ffffff ;
132
+ }
133
+
134
+ putreg32 (period , NVIC_SYSTICK_RELOAD );
135
+ }
136
+
137
+ /****************************************************************************
138
+ * Function: up_get_timer_period
139
+ *
140
+ * Description:
141
+ * This function returns the timer period in usec.
142
+ *
143
+ * Input Parameters:
144
+ * period_usec - returned timer period in usec
145
+ *
146
+ ****************************************************************************/
147
+
148
+ void up_get_timer_period (long long * period_usec )
149
+ {
150
+ uint32_t period ;
151
+
152
+ period = getreg32 (NVIC_SYSTICK_RELOAD );
153
+
154
+ * period_usec = ((period + 1 ) / (SAM_SYSTICK_CLOCK / 1000000 ));
155
+ }
156
+
157
+ #endif
158
+
96
159
/****************************************************************************
97
160
* Function: up_timer_initialize
98
161
*
0 commit comments