alt_alarm.h 4.6 KB

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