Hardware Libraries  20.1
Stratix 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 2017 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/main/embedded/ip/hps/armv8/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 /******************************************************************************/
74 /******************************************************************************/
79 typedef enum ALT_GPT_TIMER_e
80 {
85 
86 
91 
96 
101 
102  /* Peripheral Timers */
103  /* OSC1 Clock Group */
109 
115 
116  /* L4_SP Clock Group */
122 
128 
130 
131 
137 {
154 
165 
167 
168 
169 /******************************************************************************/
177 /******************************************************************************/
181 ALT_STATUS_CODE alt_gpt_all_tmr_uninit(void);
182 
183 /******************************************************************************/
187 ALT_STATUS_CODE alt_gpt_all_tmr_init(void);
188 
189 /******************************************************************************/
201 ALT_STATUS_CODE alt_gpt_tmr_stop(ALT_GPT_TIMER_t tmr_id);
202 
203 /******************************************************************************/
215 ALT_STATUS_CODE alt_gpt_tmr_start(ALT_GPT_TIMER_t tmr_id);
216 
217 /******************************************************************************/
230 ALT_STATUS_CODE alt_gpt_tmr_is_running(ALT_GPT_TIMER_t tmr_id);
231 
232 /******************************************************************************/
247 ALT_STATUS_CODE alt_gpt_tmr_reset(ALT_GPT_TIMER_t tmr_id);
248 
249 
251 /******************************************************************************/
259 /******************************************************************************/
281 ALT_STATUS_CODE alt_gpt_counter_set(ALT_GPT_TIMER_t tmr_id,
282  uint32_t val);
283 
284 /******************************************************************************/
299 uint64_t alt_gpt_counter_get(ALT_GPT_TIMER_t tmr_id);
300 
301 /******************************************************************************/
323 
324 /******************************************************************************/
341 uint32_t alt_gpt_maxcounter_get(ALT_GPT_TIMER_t tmr_id);
342 
343 /******************************************************************************/
360 ALT_STATUS_CODE alt_gpt_prescaler_set(ALT_GPT_TIMER_t tmr_id,
361  uint32_t val);
362 
363 /******************************************************************************/
377 uint32_t alt_gpt_prescaler_get(ALT_GPT_TIMER_t tmr_id);
378 
379 /******************************************************************************/
391 uint32_t alt_gpt_freq_get(ALT_GPT_TIMER_t tmr_id);
392 
393 /******************************************************************************/
405 uint64_t alt_gpt_time_get(ALT_GPT_TIMER_t tmr_id);
406 
407 
408 /****************************************************************************************/
426 /****************************************************************************************/
427 
428 uint32_t alt_gpt_delay_ns(ALT_GPT_TIMER_t tmr_id, uint32_t start_counter, uint32_t nanoseconds);
429 
430 /******************************************************************************/
447 
448 /******************************************************************************/
464 
465 /******************************************************************************/
476 uint64_t alt_gpt_curtime_get(ALT_GPT_TIMER_t tmr_id);
477 
478 
479 /******************************************************************************/
492 
493 
494 /******************************************************************************/
507 
508 
509 /******************************************************************************/
522 
523 
524 /******************************************************************************/
537 uint64_t alt_gpt_maxtime_get(ALT_GPT_TIMER_t tmr_id);
538 
539 /******************************************************************************/
553 
556 /******************************************************************************/
561 /******************************************************************************/
574 ALT_STATUS_CODE alt_gpt_int_disable(ALT_GPT_TIMER_t tmr_id);
575 
576 /******************************************************************************/
589 ALT_STATUS_CODE alt_gpt_int_enable(ALT_GPT_TIMER_t tmr_id);
590 
591 /******************************************************************************/
603 
604 /******************************************************************************/
616 ALT_STATUS_CODE alt_gpt_int_clear_pending(ALT_GPT_TIMER_t tmr_id);
617 
618 /******************************************************************************/
631 ALT_STATUS_CODE alt_gpt_int_is_pending(ALT_GPT_TIMER_t tmr_id);
632 
633 /******************************************************************************/
646 ALT_STATUS_CODE alt_gpt_int_if_pending_clear(ALT_GPT_TIMER_t tmr_id);
649 /******************************************************************************/
656 /******************************************************************************/
685 ALT_STATUS_CODE alt_gpt_mode_set(ALT_GPT_TIMER_t tmr_id,
687 
688 /******************************************************************************/
700 int32_t alt_gpt_mode_get(ALT_GPT_TIMER_t tmr_id);
701 
702 
705 #ifdef __cplusplus
706 }
707 #endif /* __cplusplus */
708 #endif /* __ALT_GPT_H__ */