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_acos_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 angle value of the arc cosine x.          */
43 /*                                                                        */
44 /*  INPUT                                                                 */
45 /*                                                                        */
46 /*    x                                     Value whose arc cosine is     */
47 /*                                          computed, in the interval     */
48 /*                                          [-256, 256].                  */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    angle                                 Angle value of arc cosine of x*/
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*    _gx_utility_math_asin_5_4_0           Compute arc sin               */
57 /*                                                                        */
58 /*  CALLED BY                                                             */
59 /*                                                                        */
60 /*    Application Code                                                    */
61 /*                                                                        */
62 /*  RELEASE HISTORY                                                       */
63 /*                                                                        */
64 /*    DATE              NAME                      DESCRIPTION             */
65 /*                                                                        */
66 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
67 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
68 /*                                            resulting in version 6.1    */
69 /*                                                                        */
70 /**************************************************************************/
71 #if defined(GUIX_5_4_0_COMPATIBILITY)
_gx_utility_math_acos_5_4_0(INT x)72 INT _gx_utility_math_acos_5_4_0(INT x)
73 {
74     INT angle = 0;
75 
76     angle = _gx_utility_math_asin_5_4_0(x);
77     angle = 90 - angle;
78 
79     return angle;
80 }
81 #endif
82 
83 /**************************************************************************/
84 /*                                                                        */
85 /*  FUNCTION                                               RELEASE        */
86 /*                                                                        */
87 /*    _gx_utility_math_acos                               PORTABLE C      */
88 /*                                                           6.1          */
89 /*  AUTHOR                                                                */
90 /*                                                                        */
91 /*    Kenneth Maxwell, Microsoft Corporation                              */
92 /*                                                                        */
93 /*  DESCRIPTION                                                           */
94 /*                                                                        */
95 /*    This service computes the angle value of the arc cosine x, which is */
96 /*    an old version of _gx_utility_math_cos.                             */
97 /*                                                                        */
98 /*  INPUT                                                                 */
99 /*                                                                        */
100 /*    x                                     Value whose arc cosine is     */
101 /*                                          computed. The value is a      */
102 /*                                          fixed point math data type,   */
103 /*                                          call GX_FIXED_VAL_MAKE to do  */
104 /*                                          type conversion.              */
105 /*                                                                        */
106 /*  OUTPUT                                                                */
107 /*                                                                        */
108 /*    angle                                 Angle value of arc cosine of x*/
109 /*                                                                        */
110 /*  CALLS                                                                 */
111 /*                                                                        */
112 /*    _gx_utility_math_asin                 Compute arc sin               */
113 /*                                                                        */
114 /*  CALLED BY                                                             */
115 /*                                                                        */
116 /*    Application Code                                                    */
117 /*                                                                        */
118 /*  RELEASE HISTORY                                                       */
119 /*                                                                        */
120 /*    DATE              NAME                      DESCRIPTION             */
121 /*                                                                        */
122 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
123 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
124 /*                                            resulting in version 6.1    */
125 /*                                                                        */
126 /**************************************************************************/
_gx_utility_math_acos(GX_FIXED_VAL x)127 INT _gx_utility_math_acos(GX_FIXED_VAL x)
128 {
129 INT angle = 0;
130 
131     angle = _gx_utility_math_asin(x);
132     angle = 90 - angle;
133 
134     return angle;
135 }
136 
137