Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file timing.h |
| 3 | */ |
| 4 | #ifndef XYSSL_TIMING_H |
| 5 | #define XYSSL_TIMING_H |
| 6 | |
| 7 | /** |
| 8 | * \brief timer structure |
| 9 | */ |
| 10 | struct hr_time |
| 11 | { |
| 12 | unsigned char opaque[32]; |
| 13 | }; |
| 14 | |
| 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
| 19 | extern int alarmed; |
| 20 | |
| 21 | /** |
| 22 | * \brief Return the CPU cycle counter value |
| 23 | */ |
| 24 | unsigned long hardclock( void ); |
| 25 | |
| 26 | /** |
| 27 | * \brief Return the elapsed time in milliseconds |
| 28 | * |
| 29 | * \param val points to a timer structure |
| 30 | * \param reset if set to 1, the timer is restarted |
| 31 | */ |
| 32 | unsigned long get_timer( struct hr_time *val, int reset ); |
| 33 | |
| 34 | /** |
| 35 | * \brief Setup an alarm clock |
| 36 | * |
| 37 | * \param seconds delay before the "alarmed" flag is set |
| 38 | */ |
| 39 | void set_alarm( int seconds ); |
| 40 | |
| 41 | /** |
| 42 | * \brief Sleep for a certain amount of time |
| 43 | */ |
| 44 | void m_sleep( int milliseconds ); |
| 45 | |
| 46 | #ifdef __cplusplus |
| 47 | } |
| 48 | #endif |
| 49 | |
| 50 | #endif /* timing.h */ |