2009-01-26 08:27:00 -08:00
|
|
|
/* EINA - EFL data type library
|
|
|
|
* Copyright (C) 2007-2008 Jorge Luis Zapata Muga
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library;
|
|
|
|
* if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2009-01-27 08:59:06 -08:00
|
|
|
|
2009-01-26 08:27:00 -08:00
|
|
|
#ifndef EINA_CPU_H_
|
|
|
|
#define EINA_CPU_H_
|
|
|
|
|
2014-10-03 02:36:38 -07:00
|
|
|
/**
|
|
|
|
* @addtogroup Eina_Cpu_Group Cpu
|
|
|
|
*
|
|
|
|
* @brief Cpu and architecture related helpers
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup Eina_Tools_Group Tools
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup Eina_Cpu_Group Cpu
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2009-01-26 08:27:00 -08:00
|
|
|
#include "eina_types.h"
|
|
|
|
|
2014-10-03 02:36:38 -07:00
|
|
|
/**
|
|
|
|
* @typedef Eina_Cpu_Features
|
|
|
|
* Enumerates different hardware architectures.
|
|
|
|
*/
|
2009-01-26 08:27:00 -08:00
|
|
|
typedef enum _Eina_Cpu_Features
|
|
|
|
{
|
2010-07-27 19:37:05 -07:00
|
|
|
EINA_CPU_MMX = 0x00000001,
|
|
|
|
EINA_CPU_SSE = 0x00000002,
|
|
|
|
EINA_CPU_SSE2 = 0x00000004,
|
|
|
|
EINA_CPU_SSE3 = 0x00000008,
|
|
|
|
/* TODO 3DNow! */
|
|
|
|
EINA_CPU_ALTIVEC = 0x00000010,
|
|
|
|
EINA_CPU_VIS = 0x00000020,
|
|
|
|
EINA_CPU_NEON = 0x00000040,
|
2013-10-02 02:31:10 -07:00
|
|
|
EINA_CPU_SSSE3 = 0x00000080,
|
|
|
|
EINA_CPU_SSE41 = 0x00000100,
|
|
|
|
EINA_CPU_SSE42 = 0x00000200
|
2009-01-26 08:27:00 -08:00
|
|
|
} Eina_Cpu_Features;
|
|
|
|
|
2014-10-03 02:36:38 -07:00
|
|
|
/**
|
|
|
|
* @brief Global hardware architecture handler
|
|
|
|
*
|
|
|
|
* @return the current cpu features
|
|
|
|
*/
|
2013-10-02 02:31:10 -07:00
|
|
|
EAPI extern Eina_Cpu_Features eina_cpu_features;
|
|
|
|
|
2014-10-03 02:36:38 -07:00
|
|
|
/**
|
|
|
|
* @brief Cpu features accessor
|
|
|
|
*
|
|
|
|
* @return the current cpu features
|
|
|
|
*/
|
2009-01-26 08:27:00 -08:00
|
|
|
EAPI Eina_Cpu_Features eina_cpu_features_get(void);
|
2014-10-03 02:36:38 -07:00
|
|
|
|
|
|
|
/**
|
2015-08-28 19:31:10 -07:00
|
|
|
* @brief Get the current number of processors
|
2014-10-03 02:36:38 -07:00
|
|
|
*
|
|
|
|
* @return the number of processors that are online, that
|
|
|
|
* is available when the function is called.
|
|
|
|
*/
|
2010-07-27 19:37:05 -07:00
|
|
|
EAPI int eina_cpu_count(void);
|
2014-10-03 02:36:38 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get the current virtual page size
|
|
|
|
*
|
|
|
|
* @return the fixed length that represents the smallest unit of data for memory
|
|
|
|
* allocation performed by the operating system on behalf of the program, and
|
|
|
|
* for transfers between the main memory and any other auxiliary store.
|
|
|
|
*/
|
2013-11-10 00:25:16 -08:00
|
|
|
EAPI int eina_cpu_page_size(void);
|
2009-01-26 08:27:00 -08:00
|
|
|
|
2014-10-03 02:36:38 -07:00
|
|
|
/**
|
|
|
|
* @brief Reverses the byte order of a 16-bit (destination) register.
|
|
|
|
*
|
|
|
|
* @param x The binary word to swap
|
|
|
|
* @return a byte order swapped 16-bit integer.
|
|
|
|
*
|
|
|
|
* On big endian systems, the number is converted to little endian byte order.
|
|
|
|
* On little endian systems, the number is converted to big endian byte order.
|
|
|
|
*/
|
2013-10-02 02:31:10 -07:00
|
|
|
static inline unsigned short eina_swap16(unsigned short x);
|
2014-10-03 02:36:38 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Reverses the byte order of a 32-bit (destination) register.
|
|
|
|
*
|
|
|
|
* @param x The binary word to swap
|
|
|
|
* @return a byte order swapped 32-bit integer.
|
|
|
|
*
|
|
|
|
* On big endian systems, the number is converted to little endian byte order.
|
|
|
|
* On little endian systems, the number is converted to big endian byte order.
|
|
|
|
*/
|
2013-10-02 02:31:10 -07:00
|
|
|
static inline unsigned int eina_swap32(unsigned int x);
|
2014-10-03 02:36:38 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Reverses the byte order of a 64-bit (destination) register.
|
|
|
|
*
|
|
|
|
* @param x The binary word to swap
|
|
|
|
* @return a byte order swapped 64-bit integer.
|
|
|
|
*
|
|
|
|
* On big endian systems, the number is converted to little endian byte order.
|
|
|
|
* On little endian systems, the number is converted to big endian byte order.
|
|
|
|
*/
|
2013-10-02 02:31:10 -07:00
|
|
|
static inline unsigned long long eina_swap64(unsigned long long x);
|
|
|
|
|
|
|
|
#include "eina_inline_cpu.x"
|
|
|
|
|
2014-10-03 02:36:38 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2009-01-26 08:27:00 -08:00
|
|
|
#endif /* EINA_CPU_H_ */
|