summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhislain Loaec <gloaec@cadoles.com>2014-10-03 11:36:38 +0200
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2014-10-20 16:11:12 +0200
commitf69ad1a9e504ee6c26af194214ad975cca995188 (patch)
tree01389050ab8a59a8ece6cdba64a126bee1aa5823
parentb446401d8f5cc6ed094d34a3168a094b69860a56 (diff)
eina: Eina_Cpu / Eina_Thread API documentation
-rw-r--r--src/lib/eina/Eina.h2
-rw-r--r--src/lib/eina/eina_cpu.h84
-rw-r--r--src/lib/eina/eina_fp.h78
-rw-r--r--src/lib/eina/eina_list.h2
-rw-r--r--src/lib/eina/eina_thread.h12
5 files changed, 148 insertions, 30 deletions
diff --git a/src/lib/eina/Eina.h b/src/lib/eina/Eina.h
index 9a8341d527..bb6d32555b 100644
--- a/src/lib/eina/Eina.h
+++ b/src/lib/eina/Eina.h
@@ -66,6 +66,7 @@
66 * Linux, BSD, Opensolaris and Windows (XP and CE). 66 * Linux, BSD, Opensolaris and Windows (XP and CE).
67 * 67 *
68 * The data types that are available are (see @ref Eina_Data_Types_Group): 68 * The data types that are available are (see @ref Eina_Data_Types_Group):
69 * @li @ref Eina_Fp_Group standard floating point numbers.
69 * @li @ref Eina_Inline_Array_Group standard array of inlined members. 70 * @li @ref Eina_Inline_Array_Group standard array of inlined members.
70 * @li @ref Eina_Array_Group standard array of @c void* data. 71 * @li @ref Eina_Array_Group standard array of @c void* data.
71 * @li @ref Eina_Hash_Group standard hash of @c void* data. 72 * @li @ref Eina_Hash_Group standard hash of @c void* data.
@@ -86,6 +87,7 @@
86 * @li @ref Eina_Benchmark_Group helper to write benchmarks. 87 * @li @ref Eina_Benchmark_Group helper to write benchmarks.
87 * @li @ref Eina_Convert_Group faster conversion from strings to integers, double, etc. 88 * @li @ref Eina_Convert_Group faster conversion from strings to integers, double, etc.
88 * @li @ref Eina_Counter_Group measures number of calls and their time. 89 * @li @ref Eina_Counter_Group measures number of calls and their time.
90 * @li @ref Eina_Cpu_Group Cpu and architecture related helpers.
89 * @li @ref Eina_Error_Group error identifiers. 91 * @li @ref Eina_Error_Group error identifiers.
90 * @li @ref Eina_File_Group simple file list and path split. 92 * @li @ref Eina_File_Group simple file list and path split.
91 * @li @ref Eina_Lalloc_Group simple lazy allocator. 93 * @li @ref Eina_Lalloc_Group simple lazy allocator.
diff --git a/src/lib/eina/eina_cpu.h b/src/lib/eina/eina_cpu.h
index e31ed76735..e871774aa2 100644
--- a/src/lib/eina/eina_cpu.h
+++ b/src/lib/eina/eina_cpu.h
@@ -19,8 +19,30 @@
19#ifndef EINA_CPU_H_ 19#ifndef EINA_CPU_H_
20#define EINA_CPU_H_ 20#define EINA_CPU_H_
21 21
22/**
23 * @addtogroup Eina_Cpu_Group Cpu
24 *
25 * @brief Cpu and architecture related helpers
26 */
27
28/**
29 * @addtogroup Eina_Tools_Group Tools
30 *
31 * @{
32 */
33
34/**
35 * @defgroup Eina_Cpu_Group Cpu
36 *
37 * @{
38 */
39
22#include "eina_types.h" 40#include "eina_types.h"
23 41
42/**
43 * @typedef Eina_Cpu_Features
44 * Enumerates different hardware architectures.
45 */
24typedef enum _Eina_Cpu_Features 46typedef enum _Eina_Cpu_Features
25{ 47{
26 EINA_CPU_MMX = 0x00000001, 48 EINA_CPU_MMX = 0x00000001,
@@ -36,16 +58,78 @@ typedef enum _Eina_Cpu_Features
36 EINA_CPU_SSE42 = 0x00000200 58 EINA_CPU_SSE42 = 0x00000200
37} Eina_Cpu_Features; 59} Eina_Cpu_Features;
38 60
61/**
62 * @brief Global hardware architecture handler
63 *
64 * @return the current cpu features
65 */
39EAPI extern Eina_Cpu_Features eina_cpu_features; 66EAPI extern Eina_Cpu_Features eina_cpu_features;
40 67
68/**
69 * @brief Cpu features accessor
70 *
71 * @return the current cpu features
72 */
41EAPI Eina_Cpu_Features eina_cpu_features_get(void); 73EAPI Eina_Cpu_Features eina_cpu_features_get(void);
74
75/**
76 * @brief Get the current number of precessors
77 *
78 * @return the number of processors that are online, that
79 * is available when the function is called.
80 */
42EAPI int eina_cpu_count(void); 81EAPI int eina_cpu_count(void);
82
83/**
84 * @brief Get the current virtual page size
85 *
86 * @return the fixed length that represents the smallest unit of data for memory
87 * allocation performed by the operating system on behalf of the program, and
88 * for transfers between the main memory and any other auxiliary store.
89 */
43EAPI int eina_cpu_page_size(void); 90EAPI int eina_cpu_page_size(void);
44 91
92/**
93 * @brief Reverses the byte order of a 16-bit (destination) register.
94 *
95 * @param x The binary word to swap
96 * @return a byte order swapped 16-bit integer.
97 *
98 * On big endian systems, the number is converted to little endian byte order.
99 * On little endian systems, the number is converted to big endian byte order.
100 */
45static inline unsigned short eina_swap16(unsigned short x); 101static inline unsigned short eina_swap16(unsigned short x);
102
103/**
104 * @brief Reverses the byte order of a 32-bit (destination) register.
105 *
106 * @param x The binary word to swap
107 * @return a byte order swapped 32-bit integer.
108 *
109 * On big endian systems, the number is converted to little endian byte order.
110 * On little endian systems, the number is converted to big endian byte order.
111 */
46static inline unsigned int eina_swap32(unsigned int x); 112static inline unsigned int eina_swap32(unsigned int x);
113
114/**
115 * @brief Reverses the byte order of a 64-bit (destination) register.
116 *
117 * @param x The binary word to swap
118 * @return a byte order swapped 64-bit integer.
119 *
120 * On big endian systems, the number is converted to little endian byte order.
121 * On little endian systems, the number is converted to big endian byte order.
122 */
47static inline unsigned long long eina_swap64(unsigned long long x); 123static inline unsigned long long eina_swap64(unsigned long long x);
48 124
49#include "eina_inline_cpu.x" 125#include "eina_inline_cpu.x"
50 126
127/**
128 * @}
129 */
130
131/**
132 * @}
133 */
134
51#endif /* EINA_CPU_H_ */ 135#endif /* EINA_CPU_H_ */
diff --git a/src/lib/eina/eina_fp.h b/src/lib/eina/eina_fp.h
index 426df4ae04..600404d050 100644
--- a/src/lib/eina/eina_fp.h
+++ b/src/lib/eina/eina_fp.h
@@ -21,19 +21,19 @@
21# define EINA_FP_H_ 21# define EINA_FP_H_
22 22
23/** 23/**
24 * @addtogroup Eina_Data_Types_Group Data Types 24 * @addtogroup Eina_Fp_Group Fp
25 * 25 *
26 * @{ 26 * @brief Floating point numbers data type management.
27 */ 27 */
28 28
29/** 29/**
30 * @addtogroup Eina_Containers_Group Containers 30 * @addtogroup Eina_Data_Types_Group Data Types
31 * 31 *
32 * @{ 32 * @{
33 */ 33 */
34 34
35/** 35/**
36 * @defgroup Eina_Hash_Group Fp 36 * @defgroup Eina_Fp_Group Fp
37 * 37 *
38 * @{ 38 * @{
39 */ 39 */
@@ -48,45 +48,48 @@ typedef signed int int32_t;
48# include <stdint.h> 48# include <stdint.h>
49#endif 49#endif
50 50
51/**
52 * @def EINA_F32P32_PI
53 * @brief Yields the 32-bit PI constant
54 */
51#define EINA_F32P32_PI 0x00000003243f6a89 55#define EINA_F32P32_PI 0x00000003243f6a89
52 56
53
54/** 57/**
55 * @typedef Eina_F32p32 58 * @typedef Eina_F32p32
56 * Type for floating point number where the size of the integer part is 32bits 59 * Type for floating point number where the size of the integer part is 32-bit
57 * and the size of the decimal part is 32bits 60 * and the size of the decimal part is 32-bit
58 */ 61 */
59typedef int64_t Eina_F32p32; 62typedef int64_t Eina_F32p32;
60 63
61/** 64/**
62 * @typedef Eina_F16p16 65 * @typedef Eina_F16p16
63 * Type for floating point number where the size of the integer part is 16bits 66 * Type for floating point number where the size of the integer part is 16-bit
64 * and the size of the decimal part is 16bits 67 * and the size of the decimal part is 16-bit
65 */ 68 */
66typedef int32_t Eina_F16p16; 69typedef int32_t Eina_F16p16;
67 70
68/** 71/**
69 * @typedef Eina_F8p24 72 * @typedef Eina_F8p24
70 * Type for floating point number where the size of the integer part is 8bits 73 * Type for floating point number where the size of the integer part is 8-bit
71 * and the size of the decimal part is 24bits 74 * and the size of the decimal part is 24bits
72 */ 75 */
73typedef int32_t Eina_F8p24; 76typedef int32_t Eina_F8p24;
74 77
75/** 78/**
76 * @brief Create a new Eina_F32p32 floating point number from standard 32 bits 79 * @brief Create a new Eina_F32p32 floating point number from standard 32-bit
77 * integer 80 * integer
78 * 81 *
79 * @param v 32bits integer value to convert 82 * @param v 32-bit integer value to convert
80 * @return The value converted into Eina_F32p32 format 83 * @return The value converted into Eina_F32p32 format
81 */ 84 */
82static inline Eina_F32p32 eina_f32p32_int_from(int32_t v); 85static inline Eina_F32p32 eina_f32p32_int_from(int32_t v);
83 86
84/** 87/**
85 * @brief Create a new standard 32bits integer from Eina_F32p32 floating point 88 * @brief Create a new standard 32-bit integer from Eina_F32p32 floating point
86 * number 89 * number
87 * 90 *
88 * @param v Eina_F32p32 value to convert 91 * @param v Eina_F32p32 value to convert
89 * @return The value converted into 32bits integer 92 * @return The value converted into 32-bit integer
90 */ 93 */
91static inline int32_t eina_f32p32_int_to(Eina_F32p32 v); 94static inline int32_t eina_f32p32_int_to(Eina_F32p32 v);
92 95
@@ -175,7 +178,14 @@ static inline Eina_F32p32 eina_f32p32_sqrt(Eina_F32p32 a);
175 */ 178 */
176static inline unsigned int eina_f32p32_fracc_get(Eina_F32p32 v); 179static inline unsigned int eina_f32p32_fracc_get(Eina_F32p32 v);
177 180
178// dont use llabs - issues if not on 64bit 181/**
182 * @brief Get the absolute value of an Eina_F32p32 floating point number
183 *
184 * @param a The floating point number
185 * @return The absolute value for the number @p a
186 * @warning Has known issues on 64-bit architecture, prefer
187 * eina_f32p32_fracc_get() instead
188 */
179#define eina_fp32p32_llabs(a) ((a < 0) ? -(a) : (a)) 189#define eina_fp32p32_llabs(a) ((a < 0) ? -(a) : (a))
180 190
181/** 191/**
@@ -195,24 +205,35 @@ EAPI Eina_F32p32 eina_f32p32_cos(Eina_F32p32 a);
195EAPI Eina_F32p32 eina_f32p32_sin(Eina_F32p32 a); 205EAPI Eina_F32p32 eina_f32p32_sin(Eina_F32p32 a);
196 206
197 207
208/**
209 * @def EINA_F16P16_ONE
210 *
211 * Yields the maximum 16-bit unsigned integer size (= 65536)
212 */
198#define EINA_F16P16_ONE (1 << 16) 213#define EINA_F16P16_ONE (1 << 16)
214
215/**
216 * @def EINA_F16P16_HALF
217 *
218 * Yields the maximum 16-bit signed integer size (= 32768)
219 */
199#define EINA_F16P16_HALF (1 << 15) 220#define EINA_F16P16_HALF (1 << 15)
200 221
201/** 222/**
202 * @brief Create a new Eina_F16p316 floating point number from standard 32 bits 223 * @brief Create a new Eina_F16p316 floating point number from standard 32-bit
203 * integer 224 * integer
204 * 225 *
205 * @param v 32bits integer value to convert 226 * @param v 32-bit integer value to convert
206 * @return The value converted into Eina_F16p16 format 227 * @return The value converted into Eina_F16p16 format
207 */ 228 */
208static inline Eina_F16p16 eina_f16p16_int_from(int32_t v); 229static inline Eina_F16p16 eina_f16p16_int_from(int32_t v);
209 230
210/** 231/**
211 * @brief Create a new standard 32bits integer from Eina_F16p16 floating point 232 * @brief Create a new standard 32-bit integer from Eina_F16p16 floating point
212 * number 233 * number
213 * 234 *
214 * @param v Eina_F16p16 value to convert 235 * @param v Eina_F16p16 value to convert
215 * @return The value converted into 32bits integer 236 * @return The value converted into 32-bit integer
216 */ 237 */
217static inline int32_t eina_f16p16_int_to(Eina_F16p16 v); 238static inline int32_t eina_f16p16_int_to(Eina_F16p16 v);
218 239
@@ -315,20 +336,20 @@ static inline unsigned int eina_f16p16_fracc_get(Eina_F16p16 v);
315 336
316 337
317/** 338/**
318 * @brief Create a new Eina_F16p316 floating point number from standard 32 bits 339 * @brief Create a new Eina_F16p316 floating point number from standard 32-bit
319 * integer 340 * integer
320 * 341 *
321 * @param v 32bits integer value to convert 342 * @param v 32-bit integer value to convert
322 * @return The value converted into Eina_F8p24 format 343 * @return The value converted into Eina_F8p24 format
323 */ 344 */
324static inline Eina_F8p24 eina_f8p24_int_from(int32_t v); 345static inline Eina_F8p24 eina_f8p24_int_from(int32_t v);
325 346
326/** 347/**
327 * @brief Create a new standard 32bits integer from Eina_F8p24 floating point 348 * @brief Create a new standard 32-bit integer from Eina_F8p24 floating point
328 * number 349 * number
329 * 350 *
330 * @param v Eina_F8p24 value to convert 351 * @param v Eina_F8p24 value to convert
331 * @return The value converted into 32bits integer 352 * @return The value converted into 32-bit integer
332 */ 353 */
333static inline int32_t eina_f8p24_int_to(Eina_F8p24 v); 354static inline int32_t eina_f8p24_int_to(Eina_F8p24 v);
334 355
@@ -340,12 +361,10 @@ static inline int32_t eina_f8p24_int_to(Eina_F8p24 v);
340 */ 361 */
341static inline Eina_F8p24 eina_f8p24_float_from(float v); 362static inline Eina_F8p24 eina_f8p24_float_from(float v);
342 363
343/* 364/**
344 * @brief Create a new standard float from Eina_F8p24 floating point 365 * @brief Create a new standard float from Eina_F8p24 floating point number
345 * number 366 *
346 * 367 * @param v Eina_F8p24 value to convert @return The value converted into float
347 * @param v Eina_F8p24 value to convert
348 * @return The value converted into float
349 */ 368 */
350static inline float eina_f8p24_float_to(Eina_F8p24 v); 369static inline float eina_f8p24_float_to(Eina_F8p24 v);
351 370
@@ -472,4 +491,5 @@ static inline Eina_F8p24 eina_f16p16_to_f8p24(Eina_F16p16 a);
472/** 491/**
473 * @} 492 * @}
474 */ 493 */
494
475#endif 495#endif
diff --git a/src/lib/eina/eina_list.h b/src/lib/eina/eina_list.h
index a32a1149ec..91de6ea08c 100644
--- a/src/lib/eina/eina_list.h
+++ b/src/lib/eina/eina_list.h
@@ -1276,7 +1276,7 @@ static inline unsigned int eina_list_count(const Eina_List *list) EINA_PURE;
1276 * This macro is a shortcut for typing eina_list_data_get(eina_list_last()) 1276 * This macro is a shortcut for typing eina_list_data_get(eina_list_last())
1277 * @since 1.8 1277 * @since 1.8
1278 */ 1278 */
1279static inline void *eina_list_last_data_get(const Eina_List *list) 1279static inline void *eina_list_last_data_get(const Eina_List *list);
1280 1280
1281/** 1281/**
1282 * @brief Returned a new iterator associated to a list. 1282 * @brief Returned a new iterator associated to a list.
diff --git a/src/lib/eina/eina_thread.h b/src/lib/eina/eina_thread.h
index 3e89ea9f24..3ad5486ddd 100644
--- a/src/lib/eina/eina_thread.h
+++ b/src/lib/eina/eina_thread.h
@@ -42,10 +42,22 @@
42 * @{ 42 * @{
43 */ 43 */
44 44
45/**
46 * @typedef Eina_Thread
47 * Type for a generic thread.
48 */
45typedef unsigned long int Eina_Thread; 49typedef unsigned long int Eina_Thread;
46 50
51/**
52 * @typedef Eina_Thread_Cb
53 * Type for the definition of a thread callback function
54 */
47typedef void *(*Eina_Thread_Cb)(void *data, Eina_Thread t); 55typedef void *(*Eina_Thread_Cb)(void *data, Eina_Thread t);
48 56
57/**
58 * @typedef Eina_Thead_Priority
59 * Type to enumerate different thread priorities
60 */
49typedef enum _Eina_Thread_Priority 61typedef enum _Eina_Thread_Priority
50{ 62{
51 EINA_THREAD_URGENT, 63 EINA_THREAD_URGENT,