-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmisc.c
More file actions
53 lines (43 loc) · 799 Bytes
/
misc.c
File metadata and controls
53 lines (43 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// lsb2msb or msb2lsb
typedef unsigned char SHIFTINT;
SHIFTINT shift_bit(SHIFTINT data)
{
SHIFTINT ret = 0;
unsigned ret_bits = 0;
unsigned data_bits = sizeof(SHIFTINT) * 8;
while (data_bits-- > 0)
ret |= ((data >> data_bits) & 1) << ret_bits++;
return ret;
}
// traverse all child device node
static void get_of_child(struct device_node *np)
{
struct device_node *child;
for_each_child_of_node(np, child)
{
if (child->name == "A")
{
// to do
continue;
}
if (child->name == "B")
{
// to do
continue;
}
}
}
// get time
#include <sys/time.h>
void get_time(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
tv.tv_sec * 1000000 + tv.tv_usec;
}
// get gcc version
#include <gnu/libc-version.h>
char *gcc_version(void)
{
return gnu_get_libc_version();
}