SYS/BIOS  7.00
Types.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Texas Instruments Incorporated - https://www.ti.com
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
41 /*
42  * ======== Types.h ========
43  */
44 
45 #ifndef ti_sysbios_runtime_Types__include
46 #define ti_sysbios_runtime_Types__include
47 
48 #include <stdbool.h>
49 #include <stddef.h>
50 #include <stdint.h>
51 
52 /*
53  * legacy TI tools pre-define "__TI_COMPILER_VERSION__"
54  * TI clang tools pre-define "__ti_version__"
55  * we should stop using __ti__, but until then ...
56  */
57 #if defined (__TI_COMPILER_VERSION__) || defined(__ti_version__)
58 #ifndef __ti__
59 #define __ti__
60 #endif
61 #endif
62 
64 /* BIOS 6.x compatibility, use -Dxdc_std__include to disable */
65 #include <xdc/std.h>
66 
67 #define ti_sysbios_runtime_Types_long_names
68 #include "Types_defs.h"
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 
81 typedef struct {
85  uint32_t hi;
89  uint32_t lo;
91 
98 typedef struct {
102  uint32_t hi;
106  uint32_t lo;
107 } Types_FreqHz;
108 
110 typedef int (*Types_Fxn)();
111 
112 /* conversion macros (inline functions) */
113 static inline void * Types_iargToPtr(intptr_t a)
114 {
115  return ((void *)a);
116 }
117 
118 static inline void * Types_uargToPtr(uintptr_t a)
119 {
120  return ((void *)a);
121 }
122 
123 static inline Types_Fxn Types_iargToFxn(intptr_t a)
124 {
125  return ((Types_Fxn)a);
126 }
127 
128 static inline Types_Fxn Types_uargToFxn(uintptr_t a)
129 {
130  return ((Types_Fxn)a);
131 }
132 
133 /*
134  * functions to efficiently convert a single precision float to an IArg
135  * and vice-versa while maintaining client type safety
136  *
137  * Here the assumption is that sizeof(Float) <= sizeof(IArg);
138  */
139 typedef union {
140  float f;
141  intptr_t a;
142 } Types_FloatData;
143 
144 static inline intptr_t Types_floatToArg(float f)
145 {
146  Types_FloatData u;
147  u.f = f;
148 
149  return (u.a);
150 }
151 
152 static inline float Types_argToFloat(intptr_t a)
153 {
154  Types_FloatData u;
155  u.a = a;
156 
157  return (u.f);
158 }
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif /* ti_sysbios_runtime_Types__include */
166 
168 #undef ti_sysbios_runtime_Types_long_names
169 #include "Types_defs.h"
uint32_t lo
least significant 32-bits of frequency
Definition: Types.h:106
uint32_t hi
most significant 32-bits of timestamp
Definition: Types.h:85
uint32_t lo
least significant 32-bits of timestamp
Definition: Types.h:89
uint32_t hi
most significant 32-bits of frequency
Definition: Types.h:102
64-bit frequency struct (in Hz)
Definition: Types.h:98
64-bit timestamp struct
Definition: Types.h:81
© Copyright 1995-2021, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale