timer.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef _ARCH_TIMER_H_
  2. #define _ARCH_TIMER_H_
  3. /*
  4. * <MFS> Modified for Streamit
  5. * Added timer modifications from Harald Kipp, 2008/07/29 + new NutDelay implementation
  6. *
  7. * Copyright (C) 2001-2005 by egnite Software GmbH. 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
  11. * are met:
  12. *
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. * 3. Neither the name of the copyright holders nor the names of
  19. * contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
  23. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  25. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
  26. * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  27. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  28. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  29. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  30. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  31. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  32. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  33. * SUCH DAMAGE.
  34. *
  35. * For additional information see http://www.ethernut.de/
  36. */
  37. /*
  38. * $Log: timer.h,v $
  39. * Revision 1.2 2008/07/08 08:25:05 haraldkipp
  40. * NutDelay is no more architecture specific.
  41. * Number of loops per millisecond is configurable or will be automatically
  42. * determined.
  43. * A new function NutMicroDelay provides shorter delays.
  44. *
  45. * Revision 1.1 2005/07/26 18:42:19 haraldkipp
  46. * First check in
  47. *
  48. */
  49. #if defined(__AVR__)
  50. #include <arch/avr/timer.h>
  51. #elif defined(__arm__)
  52. #include <arch/arm/timer.h>
  53. #elif defined(__H8300H__) || defined(__H8300S__)
  54. #include <arch/h8300h/timer.h>
  55. #elif defined(__m68k__)
  56. #include <arch/m68k/timer.h>
  57. #elif defined(__linux__) || defined(__APPLE__) || defined(__CYGWIN__)
  58. #include <arch/unix/timer.h>
  59. #endif
  60. __BEGIN_DECLS
  61. /* Prototypes */
  62. /*
  63. * Architecture dependent functions.
  64. */
  65. extern void NutRegisterTimer(void (*handler) (void *));
  66. extern u_long NutGetCpuClock(void);
  67. extern u_long NutGetTickClock(void);
  68. extern u_long NutTimerMillisToTicks(u_long ms);
  69. __END_DECLS
  70. /* End of prototypes */
  71. #endif