Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

clock.h

Go to the documentation of this file.
00001 /*!     \file include/kernel/clock.h
00002  *      \brief The system clock headers.
00003  *      \author Andrea Righi <drizzt@inwind.it>
00004  *      \date Last update: 2003-11-01
00005  *      \note Copyright (&copy;) 2003 Andrea Righi
00006  */
00007 
00008 #ifndef CLOCK_H
00009 #define CLOCK_H
00010 
00011 /** \ingroup Kernel
00012  *  \defgroup KClock Clock Manager
00013  *  The system clock manager.
00014  *  @{
00015  */
00016 
00017 #define LATCH_COUNT     0x00    //!< To copy chip count.
00018 #define TIMER0          0x40    //!< I/O port for timer channel 0.
00019 #define TIMER2          0x42    //!< I/O port for timer channel 2.
00020 #define TIMER_MODE      0x43    //!< I/O port for timer mode control.
00021 #define SQUARE_WAVE     0x36    //!< The sqare-wave form.
00022 #define TIMER_FREQ      1193182L //!< Clock frequency for timer in PC.
00023 
00024 //! Value to initialize timer.
00025 #define TIMER_COUNT     (unsigned)(TIMER_FREQ/HZ)
00026 
00027 //! LATCH is used for the interval timer.
00028 #define LATCH           ((TIMER_FREQ + HZ/2) / HZ)
00029 
00030 //! Clock Frequancy (User settable, default=200Hz)
00031 #define HZ              200
00032 
00033 //! Timeout variable structure.
00034 typedef struct timeout
00035 {
00036         dword start_ticks;
00037         dword ticks_to_wait;
00038 } timeout_t;
00039 
00040 // --- Prototypes ----------------------------------------------------- //
00041 
00042 void init_clock();
00043 void stop_clock();
00044 dword sys_get_ticks(void);
00045 void delay(dword millisec);
00046 
00047 //! Macro equivalent to delay(dword millisec).
00048 #define usleep(m)       delay(m)
00049 
00050 void set_timeout(timeout_t *t, unsigned int millisec);
00051 bool is_timeout(timeout_t *t);
00052 
00053 void clock_thread();
00054 
00055 /** @} */ // end of KClock
00056 
00057 #endif

Generated on Fri Feb 20 15:32:15 2004 for Minirighi by doxygen1.2.18