Hardware Libraries  20.1
Arria 10 SoC Hardware Manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
alt_timers.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Copyright 2013 Altera Corporation. All Rights Reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software without
17 * specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 ******************************************************************************/
32 
33 /*
34  * $Id: //acds/rel/20.1/embedded/ip/hps/altera_hps/hwlib/include/alt_timers.h#1 $
35  */
36 
41 #ifndef __ALT_GPT_H__
42 #define __ALT_GPT_H__
43 
44 #include <stdint.h>
45 #include <stdbool.h>
46 #include "hwlib.h"
47 
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif /* __cplusplus */
52 
53 
54 /******************************************************************************/
73 /******************************************************************************/
78 typedef enum ALT_GPT_TIMER_e
79 {
88 
95 
107 
108  /* Peripheral Timers */
109  /* OSC1 Clock Group */
115 
121 
122  /* L4_SP Clock Group */
128 
134 
136 
137 
143 {
160 
171 
173 
174 
175 /******************************************************************************/
183 /******************************************************************************/
187 ALT_STATUS_CODE alt_gpt_all_tmr_uninit(void);
188 
189 /******************************************************************************/
193 ALT_STATUS_CODE alt_gpt_all_tmr_init(void);
194 
195 /******************************************************************************/
207 ALT_STATUS_CODE alt_gpt_tmr_stop(ALT_GPT_TIMER_t tmr_id);
208 
209 /******************************************************************************/
221 ALT_STATUS_CODE alt_gpt_tmr_start(ALT_GPT_TIMER_t tmr_id);
222 
223 /******************************************************************************/
236 ALT_STATUS_CODE alt_gpt_tmr_is_running(ALT_GPT_TIMER_t tmr_id);
237 
238 /******************************************************************************/
253 ALT_STATUS_CODE alt_gpt_tmr_reset(ALT_GPT_TIMER_t tmr_id);
254 
255 
257 /******************************************************************************/
265 /******************************************************************************/
287 ALT_STATUS_CODE alt_gpt_counter_set(ALT_GPT_TIMER_t tmr_id,
288  uint32_t val);
289 
290 /******************************************************************************/
305 uint32_t alt_gpt_counter_get(ALT_GPT_TIMER_t tmr_id);
306 
307 /******************************************************************************/
329 
330 /******************************************************************************/
347 uint32_t alt_gpt_maxcounter_get(ALT_GPT_TIMER_t tmr_id);
348 
349 /******************************************************************************/
366 ALT_STATUS_CODE alt_gpt_prescaler_set(ALT_GPT_TIMER_t tmr_id,
367  uint32_t val);
368 
369 /******************************************************************************/
383 uint32_t alt_gpt_prescaler_get(ALT_GPT_TIMER_t tmr_id);
384 
385 /******************************************************************************/
397 uint32_t alt_gpt_freq_get(ALT_GPT_TIMER_t tmr_id);
398 
399 /******************************************************************************/
411 uint32_t alt_gpt_time_get(ALT_GPT_TIMER_t tmr_id);
412 
413 
414 /****************************************************************************************/
430 /****************************************************************************************/
431 
432 uint32_t alt_gpt_delay_ns(ALT_GPT_TIMER_t tmr_id, uint32_t start_counter, uint32_t nanoseconds);
433 
434 /****************************************************************************************/
443 /****************************************************************************************/
444 
445 uint32_t alt_gpt_cpu_gblt_delay_ns(uint64_t nanoseconds);
446 
447 /******************************************************************************/
464 
465 /******************************************************************************/
481 
482 /******************************************************************************/
493 uint32_t alt_gpt_curtime_get(ALT_GPT_TIMER_t tmr_id);
494 
495 
496 /******************************************************************************/
509 
510 
511 /******************************************************************************/
524 
525 
526 /******************************************************************************/
539 
540 
541 /******************************************************************************/
554 uint32_t alt_gpt_maxtime_get(ALT_GPT_TIMER_t tmr_id);
555 
556 /******************************************************************************/
570 
573 /******************************************************************************/
578 /******************************************************************************/
591 ALT_STATUS_CODE alt_gpt_int_disable(ALT_GPT_TIMER_t tmr_id);
592 
593 /******************************************************************************/
606 ALT_STATUS_CODE alt_gpt_int_enable(ALT_GPT_TIMER_t tmr_id);
607 
608 /******************************************************************************/
620 
621 /******************************************************************************/
633 ALT_STATUS_CODE alt_gpt_int_clear_pending(ALT_GPT_TIMER_t tmr_id);
634 
635 /******************************************************************************/
648 ALT_STATUS_CODE alt_gpt_int_is_pending(ALT_GPT_TIMER_t tmr_id);
649 
650 /******************************************************************************/
663 ALT_STATUS_CODE alt_gpt_int_if_pending_clear(ALT_GPT_TIMER_t tmr_id);
666 /******************************************************************************/
673 /******************************************************************************/
702 ALT_STATUS_CODE alt_gpt_mode_set(ALT_GPT_TIMER_t tmr_id,
704 
705 /******************************************************************************/
717 int32_t alt_gpt_mode_get(ALT_GPT_TIMER_t tmr_id);
718 
724 #ifdef __cplusplus
725 }
726 #endif /* __cplusplus */
727 #endif /* __ALT_GPT_H__ */