1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** GUIX Component */
17 /** */
18 /** Utility (Utility) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "gx_api.h"
28 #include "gx_utility.h"
29
30 /**************************************************************************/
31 /* */
32 /* FUNCTION RELEASE */
33 /* */
34 /* _gx_utility_math_cos_5_4_0 PORTABLE C */
35 /* 6.1 */
36 /* AUTHOR */
37 /* */
38 /* Kenneth Maxwell, Microsoft Corporation */
39 /* */
40 /* DESCRIPTION */
41 /* */
42 /* This service computes the cosine of the supplied angle, which is an */
43 /* old version of _gx_utility_math_cos. */
44 /* */
45 /* INPUT */
46 /* */
47 /* angle Angle to compute cosine of, */
48 /* the input angle should be */
49 /* scaled by 256. */
50 /* */
51 /* OUTPUT */
52 /* */
53 /* cosine Cosine of supplied angle */
54 /* */
55 /* CALLS */
56 /* */
57 /* _gx_utility_math_sin_5_4_0 */
58 /* */
59 /* CALLED BY */
60 /* */
61 /* Application Code */
62 /* */
63 /* RELEASE HISTORY */
64 /* */
65 /* DATE NAME DESCRIPTION */
66 /* */
67 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
68 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
69 /* resulting in version 6.1 */
70 /* */
71 /**************************************************************************/
72 #if defined(GUIX_5_4_0_COMPATIBILITY)
_gx_utility_math_cos_5_4_0(INT angle)73 INT _gx_utility_math_cos_5_4_0(INT angle)
74 {
75
76 return _gx_utility_math_sin_5_4_0(angle + 23040);
77 }
78 #endif
79
80 /**************************************************************************/
81 /* */
82 /* FUNCTION RELEASE */
83 /* */
84 /* _gx_utility_math_cos PORTABLE C */
85 /* 6.1 */
86 /* AUTHOR */
87 /* */
88 /* Kenneth Maxwell, Microsoft Corporation */
89 /* */
90 /* DESCRIPTION */
91 /* */
92 /* This service computes the cosine of the supplied angle. */
93 /* */
94 /* INPUT */
95 /* */
96 /* angle Angle to compute cosine of. */
97 /* The input angle is a fixed */
98 /* point data type, call */
99 /* GX_FIXED_VAL_MAKE to covnert */
100 /* from INT to fixed point data. */
101 /* type. */
102 /* */
103 /* OUTPUT */
104 /* */
105 /* cosine Cosine of supplied angle. */
106 /* The return consin is a fixed */
107 /* point math data type, call */
108 /* GX_FIXED_VAL_TO_INT to convert*/
109 /* from fixed point data type to */
110 /* int. */
111 /* */
112 /* CALLS */
113 /* */
114 /* _gx_utility_math_sin */
115 /* */
116 /* CALLED BY */
117 /* */
118 /* Application Code */
119 /* */
120 /* RELEASE HISTORY */
121 /* */
122 /* DATE NAME DESCRIPTION */
123 /* */
124 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
125 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
126 /* resulting in version 6.1 */
127 /* */
128 /**************************************************************************/
_gx_utility_math_cos(GX_FIXED_VAL angle)129 GX_FIXED_VAL _gx_utility_math_cos(GX_FIXED_VAL angle)
130 {
131
132 return _gx_utility_math_sin(angle + GX_FIXED_VAL_MAKE(90));
133 }
134
135