-
Notifications
You must be signed in to change notification settings - Fork 235
/
Copy pathdevloc.c
82 lines (67 loc) · 1.54 KB
/
devloc.c
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <stdint.h>
#include "sf-types.h"
#include "tag.h"
#include "devsim7708.h"
#include "sh7708.h"
int
devloc_getorbit(void)
{
int orbit = 0;
((uchar *)&orbit)[3] = *(ORBIT+0);
((uchar *)&orbit)[2] = *(ORBIT+1);
((uchar *)&orbit)[1] = *(ORBIT+2);
((uchar *)&orbit)[0] = *(ORBIT+3);
return orbit;
}
int
devloc_getvelocity(void)
{
int velocity = 0;
((uchar *)&velocity)[3] = *(VELOCITY+0);
((uchar *)&velocity)[2] = *(VELOCITY+1);
((uchar *)&velocity)[1] = *(VELOCITY+2);
((uchar *)&velocity)[0] = *(VELOCITY+3);
return velocity;
}
double
devloc_getxloc(void)
{
double xloc = 0.0;
((uchar *)&xloc)[7] = *(XLOC+0);
((uchar *)&xloc)[6] = *(XLOC+1);
((uchar *)&xloc)[5] = *(XLOC+2);
((uchar *)&xloc)[4] = *(XLOC+3);
((uchar *)&xloc)[3] = *(XLOC+4);
((uchar *)&xloc)[2] = *(XLOC+5);
((uchar *)&xloc)[1] = *(XLOC+6);
((uchar *)&xloc)[0] = *(XLOC+7);
return xloc;
}
double
devloc_getyloc(void)
{
double yloc = 0.0;
((uchar *)&yloc)[7] = *(YLOC+0);
((uchar *)&yloc)[6] = *(YLOC+1);
((uchar *)&yloc)[5] = *(YLOC+2);
((uchar *)&yloc)[4] = *(YLOC+3);
((uchar *)&yloc)[3] = *(YLOC+4);
((uchar *)&yloc)[2] = *(YLOC+5);
((uchar *)&yloc)[1] = *(YLOC+6);
((uchar *)&yloc)[0] = *(YLOC+7);
return yloc;
}
double
devloc_getzloc(void)
{
double zloc = 0.0;
((uchar *)&zloc)[7] = *(ZLOC+0);
((uchar *)&zloc)[6] = *(ZLOC+1);
((uchar *)&zloc)[5] = *(ZLOC+2);
((uchar *)&zloc)[4] = *(ZLOC+3);
((uchar *)&zloc)[3] = *(ZLOC+4);
((uchar *)&zloc)[2] = *(ZLOC+5);
((uchar *)&zloc)[1] = *(ZLOC+6);
((uchar *)&zloc)[0] = *(ZLOC+7);
return zloc;
}