timer.h
1 |
#ifndef __TIMER_H
|
---|---|
2 |
#define __TIMER_H
|
3 |
|
4 |
/** @defgroup timer timer
|
5 |
* @{
|
6 |
*
|
7 |
* Functions for using the i8254 timers
|
8 |
*/
|
9 |
|
10 |
/**
|
11 |
* @brief Configures a timer to generate a square wave
|
12 |
*
|
13 |
* @param timer Timer to configure. (Ranges from 0 to 2)
|
14 |
* @param rate Frequency of the square wave to generate
|
15 |
* @return Return 0 upon success and non-zero otherwise
|
16 |
*/
|
17 |
int timer_set_rate(unsigned long timer, unsigned long rate); |
18 |
|
19 |
/**
|
20 |
* @brief Reads the the mode in which a timer was programmed
|
21 |
*
|
22 |
* @param timer Timer whose status to read (Ranges from 0 to 2)
|
23 |
* @param st Address of memory position to be filled with the timer status
|
24 |
* @return Return 0 upon success and non-zero otherwise
|
25 |
*/
|
26 |
int timer_get_status(unsigned long timer, u8_t *st); |
27 |
|
28 |
/**
|
29 |
* @brief Shows the mode in which a timer was programmed
|
30 |
*
|
31 |
* Displays in a human friendly way, the configuration of the input
|
32 |
* timer, by providing the values (and meanings) of the different
|
33 |
* components of a timer status information
|
34 |
*
|
35 |
* @param timer Timer whose status to read (Ranges from 0 to 2)
|
36 |
* @return Return 0 upon success and non-zero otherwise
|
37 |
*/
|
38 |
int timer_show_status(unsigned long timer); |
39 |
|
40 |
/**
|
41 |
* @brief Subscribes and enables Timer 0 interrupts
|
42 |
*
|
43 |
* @return Returns bitmask for this interrupt, upon success, 0 upon failure
|
44 |
*/
|
45 |
unsigned long timer_subscribe_int(void ); |
46 |
|
47 |
/**
|
48 |
* @brief Unsubscribes Timer 0 interrupts
|
49 |
*
|
50 |
* @return Return 0 upon success and non-zero otherwise
|
51 |
*/
|
52 |
int timer_unsubscribe_int();
|
53 |
#endif __TIMER_H
|