root / proj / include / utils.h @ 200
History | View | Annotate | Download (2.11 KB)
1 |
#ifndef UTILS_H_INCLUDED
|
---|---|
2 |
#define UTILS_H_INCLUDED
|
3 |
|
4 |
/**
|
5 |
* @brief Gets the least significant byte of a 16-bit variable
|
6 |
* @param val 16-bit variable
|
7 |
* @param lsb Pointer to a 8-bit variable to store the value of the LSB
|
8 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
9 |
*/
|
10 |
int(util_get_LSB)(uint16_t val, uint8_t *lsb);
|
11 |
|
12 |
/**
|
13 |
* @brief Gets the most significant byte of a 16-bit variable
|
14 |
* @param val 16-bit variable
|
15 |
* @param lsb Pointer to a 8-bit variable to store the value of the MSB
|
16 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
17 |
*/
|
18 |
int(util_get_MSB)(uint16_t val, uint8_t *msb);
|
19 |
|
20 |
/**
|
21 |
* @brief sys_inb wrapper
|
22 |
* @param port Port to read from
|
23 |
* @param value Pointer to byte to store value read
|
24 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
25 |
*/
|
26 |
int (util_sys_inb)(int port, uint8_t *value); |
27 |
|
28 |
/**
|
29 |
* @brief Unsubcribes Interrupts
|
30 |
* @param interrupt_id Interrupt ID, value via arguments on subscription of the interrupt_id
|
31 |
* @see subscribe_kbc_interrupt, subscribe_timer_interrupt
|
32 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
33 |
*/
|
34 |
int (unsubscribe_interrupt)(int *interrupt_id); |
35 |
|
36 |
/**
|
37 |
* @brief Gets the minimum value out of two values.
|
38 |
* @param a First value
|
39 |
* @param b Second value
|
40 |
* @return The minimum of the two values
|
41 |
*/
|
42 |
int32_t min(int32_t a, int32_t b); |
43 |
|
44 |
/**
|
45 |
* @brief Gets the maximum value out of two values.
|
46 |
* @param a First value
|
47 |
* @param b Second value
|
48 |
* @return The maximum of the two values
|
49 |
*/
|
50 |
int32_t max(int32_t a, int32_t b); |
51 |
|
52 |
/**
|
53 |
* @brief Gets the minimum value out of two doubles.
|
54 |
* @param a First value
|
55 |
* @param b Second value
|
56 |
* @return The minimum of the two values
|
57 |
*/
|
58 |
double min_d(double a, double b); |
59 |
|
60 |
/**
|
61 |
* @brief Gets the maximum value out of two doubles.
|
62 |
* @param a First value
|
63 |
* @param b Second value
|
64 |
* @return The maximum of the two values
|
65 |
*/
|
66 |
double max_d(double a, double b); |
67 |
|
68 |
|
69 |
#endif //UTILS_H_INCLUDED |