1 #ifndef __ALT_PRIV_ALARM_H__
2 #define __ALT_PRIV_ALARM_H__
3 
4 /******************************************************************************
5 *                                                                             *
6 * License Agreement                                                           *
7 *                                                                             *
8 * Copyright (c) 2004 Altera Corporation, San Jose, California, USA.           *
9 * All rights reserved.                                                        *
10 *                                                                             *
11 * Permission is hereby granted, free of charge, to any person obtaining a     *
12 * copy of this software and associated documentation files (the "Software"),  *
13 * to deal in the Software without restriction, including without limitation   *
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,    *
15 * and/or sell copies of the Software, and to permit persons to whom the       *
16 * Software is furnished to do so, subject to the following conditions:        *
17 *                                                                             *
18 * The above copyright notice and this permission notice shall be included in  *
19 * all copies or substantial portions of the Software.                         *
20 *                                                                             *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  *
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,    *
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      *
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING     *
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER         *
27 * DEALINGS IN THE SOFTWARE.                                                   *
28 *                                                                             *
29 *                                                                             *
30 * Altera does not recommend, suggest or require that this reference design    *
31 * file be used in conjunction or combination with any other product.          *
32 ******************************************************************************/
33 
34 /******************************************************************************
35 *                                                                             *
36 * THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT.                       *
37 *                                                                             *
38 ******************************************************************************/
39 
40 #include "alt_types.h"
41 
42 /*
43  * This header provides the internal defenitions required by the public
44  * interface alt_alarm.h. These variables and structures are not guaranteed to
45  * exist in future implementations of the HAL.
46  */
47 
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif /* __cplusplus */
52 
53 /*
54  * "alt_alarm_s" is a structure type used to maintain lists of alarm callback
55  * functions.
56  */
57 
58 struct alt_alarm_s
59 {
60   alt_llist llist;       /* linked list */
61   alt_u32 time;          /* time in system ticks of the callback */
62   alt_u32 (*callback) (void* context); /* callback function. The return
63                           * value is the period for the next callback; where
64                           * zero indicates that the alarm should be removed
65                           * from the list.
66                           */
67   alt_u8 rollover;       /* set when desired alarm time + current time causes
68                             overflow, to prevent premature alarm */
69   void* context;         /* Argument for the callback */
70 };
71 
72 /*
73  * "_alt_tick_rate" is a global variable used to store the system clock rate
74  * in ticks per second. This is initialised to zero, which coresponds to there
75  * being no system clock available.
76  *
77  * It is then set to it's final value by the system clock driver through a call
78  * to alt_sysclk_init().
79  */
80 
81 extern alt_u32 _alt_tick_rate;
82 
83 /*
84  * "_alt_nticks" is a global variable which records the elapsed number of
85  * system clock ticks since the last call to settimeofday() or since reset if
86  * settimeofday() has not been called.
87  */
88 
89 extern volatile alt_u32 _alt_nticks;
90 
91 /* The list of registered alarms. */
92 
93 extern alt_llist alt_alarm_list;
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif /* __ALT_PRIV_ALARM_H__ */
100