Altera HWLIB  16.0
The Altera HW Manager API Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
alt_timers.h
Go to the documentation of this file.
1 
5 /******************************************************************************
6 *
7 * Copyright 2013 Altera Corporation. All Rights Reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * 3. Neither the name of the copyright holder nor the names of its contributors
20 * may be used to endorse or promote products derived from this software without
21 * specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************/
36 
37 /*
38  * $Id: //depot/embedded/rel/15.0/ip/hps/altera_hps/hwlib/include/alt_timers.h#1 $
39  */
40 
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 /******************************************************************************/
430 
431 /******************************************************************************/
447 
448 /******************************************************************************/
459 uint32_t alt_gpt_curtime_get(ALT_GPT_TIMER_t tmr_id);
460 
461 
462 /******************************************************************************/
475 
476 
477 /******************************************************************************/
490 
491 
492 /******************************************************************************/
505 
506 
507 /******************************************************************************/
520 uint32_t alt_gpt_maxtime_get(ALT_GPT_TIMER_t tmr_id);
521 
522 /******************************************************************************/
536 
539 /******************************************************************************/
544 /******************************************************************************/
557 ALT_STATUS_CODE alt_gpt_int_disable(ALT_GPT_TIMER_t tmr_id);
558 
559 /******************************************************************************/
572 ALT_STATUS_CODE alt_gpt_int_enable(ALT_GPT_TIMER_t tmr_id);
573 
574 /******************************************************************************/
586 
587 /******************************************************************************/
599 ALT_STATUS_CODE alt_gpt_int_clear_pending(ALT_GPT_TIMER_t tmr_id);
600 
601 /******************************************************************************/
614 ALT_STATUS_CODE alt_gpt_int_is_pending(ALT_GPT_TIMER_t tmr_id);
615 
616 /******************************************************************************/
629 ALT_STATUS_CODE alt_gpt_int_if_pending_clear(ALT_GPT_TIMER_t tmr_id);
632 /******************************************************************************/
639 /******************************************************************************/
668 ALT_STATUS_CODE alt_gpt_mode_set(ALT_GPT_TIMER_t tmr_id,
670 
671 /******************************************************************************/
683 int32_t alt_gpt_mode_get(ALT_GPT_TIMER_t tmr_id);
684 
690 #ifdef __cplusplus
691 }
692 #endif /* __cplusplus */
693 #endif /* __ALT_GPT_H__ */