| 1 |
2 |
alfik |
#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 |
|
|
* This agreement shall be governed in all respects by the laws of the State *
|
| 30 |
|
|
* of California and by the laws of the United States of America. *
|
| 31 |
|
|
* *
|
| 32 |
|
|
* Altera does not recommend, suggest or require that this reference design *
|
| 33 |
|
|
* file be used in conjunction or combination with any other product. *
|
| 34 |
|
|
******************************************************************************/
|
| 35 |
|
|
|
| 36 |
|
|
/******************************************************************************
|
| 37 |
|
|
* *
|
| 38 |
|
|
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
| 39 |
|
|
* *
|
| 40 |
|
|
******************************************************************************/
|
| 41 |
|
|
|
| 42 |
|
|
#include "alt_types.h"
|
| 43 |
|
|
|
| 44 |
|
|
/*
|
| 45 |
|
|
* This header provides the internal defenitions required by the public
|
| 46 |
|
|
* interface alt_alarm.h. These variables and structures are not guaranteed to
|
| 47 |
|
|
* exist in future implementations of the HAL.
|
| 48 |
|
|
*/
|
| 49 |
|
|
|
| 50 |
|
|
#ifdef __cplusplus
|
| 51 |
|
|
extern "C"
|
| 52 |
|
|
{
|
| 53 |
|
|
#endif /* __cplusplus */
|
| 54 |
|
|
|
| 55 |
|
|
/*
|
| 56 |
|
|
* "alt_alarm_s" is a structure type used to maintain lists of alarm callback
|
| 57 |
|
|
* functions.
|
| 58 |
|
|
*/
|
| 59 |
|
|
|
| 60 |
|
|
struct alt_alarm_s
|
| 61 |
|
|
{
|
| 62 |
|
|
alt_llist llist; /* linked list */
|
| 63 |
|
|
alt_u32 time; /* time in system ticks of the callback */
|
| 64 |
|
|
alt_u32 (*callback) (void* context); /* callback function. The return
|
| 65 |
|
|
* value is the period for the next callback; where
|
| 66 |
|
|
* zero indicates that the alarm should be removed
|
| 67 |
|
|
* from the list.
|
| 68 |
|
|
*/
|
| 69 |
|
|
alt_u8 rollover; /* set when desired alarm time + current time causes
|
| 70 |
|
|
overflow, to prevent premature alarm */
|
| 71 |
|
|
void* context; /* Argument for the callback */
|
| 72 |
|
|
};
|
| 73 |
|
|
|
| 74 |
|
|
/*
|
| 75 |
|
|
* "_alt_tick_rate" is a global variable used to store the system clock rate
|
| 76 |
|
|
* in ticks per second. This is initialised to zero, which coresponds to there
|
| 77 |
|
|
* being no system clock available.
|
| 78 |
|
|
*
|
| 79 |
|
|
* It is then set to it's final value by the system clock driver through a call
|
| 80 |
|
|
* to alt_sysclk_init().
|
| 81 |
|
|
*/
|
| 82 |
|
|
|
| 83 |
|
|
extern alt_u32 _alt_tick_rate;
|
| 84 |
|
|
|
| 85 |
|
|
/*
|
| 86 |
|
|
* "_alt_nticks" is a global variable which records the elapsed number of
|
| 87 |
|
|
* system clock ticks since the last call to settimeofday() or since reset if
|
| 88 |
|
|
* settimeofday() has not been called.
|
| 89 |
|
|
*/
|
| 90 |
|
|
|
| 91 |
|
|
extern volatile alt_u32 _alt_nticks;
|
| 92 |
|
|
|
| 93 |
|
|
/* The list of registered alarms. */
|
| 94 |
|
|
|
| 95 |
|
|
extern alt_llist alt_alarm_list;
|
| 96 |
|
|
|
| 97 |
|
|
#ifdef __cplusplus
|
| 98 |
|
|
}
|
| 99 |
|
|
#endif
|
| 100 |
|
|
|
| 101 |
|
|
#endif /* __ALT_PRIV_ALARM_H__ */
|