OSAPI  0.29
Open System API
common_type_cpu.h
1 // *****************************************************************************************
2 //
3 // File description:
4 //
5 // Author: Joao Costa
6 // Purpose: Common declarations for a CPU information
7 //
8 // *****************************************************************************************
9 
10 #ifndef OSAPI_COMMON_TYPE_CPU_H_
11 #define OSAPI_COMMON_TYPE_CPU_H_
12 
13 // *****************************************************************************************
14 //
15 // Section: Import headers
16 //
17 // *****************************************************************************************
18 
19 // System headers
20 #include <stdint.h>
21 
22 // Import OSAPI headers
23 
24 // Include own headers
25 
26 
27 // *****************************************************************************************
28 //
29 // Section: Constants
30 //
31 // *****************************************************************************************
32 
33 // Define the size of main CPU types
34 #define OSAPI_MACHINE_CPU_SIZE_VENDORID 20 //?
35 #define OSAPI_MACHINE_CPU_SIZE_FAMILY 2
36 #define OSAPI_MACHINE_CPU_SIZE_MODEL 2
37 #define OSAPI_MACHINE_CPU_SIZE_MODELNAME 65 // ?
38 #define OSAPI_MACHINE_CPU_SIZE_REVISION 10 // AKA Stepping
39 #define OSAPI_MACHINE_CPU_SIZE_VIRTUAL 10 // ?
40 
41 // *****************************************************************************************
42 //
43 // Section: Type definitions
44 //
45 // *****************************************************************************************
46 
48 typedef uint8_t t_cpu_nthreads;
49 
51 typedef uint16_t t_cpu_ncores;
52 
54 typedef uint32_t t_cpu_nlogical;
55 
57 typedef uint16_t t_cpu_nsocket;
58 
59 
60 // All CPU architectures must define the t_cpu_regs structure/type
61 #if (OSAPI_CPU_ARCHITECTURE_TARGET == OSAPI_CPU_ARCHITECTURE_X86) || (OSAPI_CPU_ARCHITECTURE_TARGET == OSAPI_CPU_ARCHITECTURE_AMD64)
62 
65 {
66  uint32_t eax;
67  uint32_t ebx;
68  uint32_t ecx;
69  uint32_t edx;
70 };
71 
73 typedef struct osapi_cpu_regs_S t_cpu_regs;
74 
75 #else
76  #error "Unknown CPU architecture"
77 #endif
78 
79 
80 #endif /* OSAPI_COMMON_TYPE_CPU_H_ */
osapi_cpu_regs_S::ebx
uint32_t ebx
EBX register.
Definition: common_type_cpu.h:67
osapi_cpu_regs_S
General purpose registers for INTEL/AMD architectures.
Definition: common_type_cpu.h:64
osapi_cpu_regs_S::ecx
uint32_t ecx
ECX register.
Definition: common_type_cpu.h:68
osapi_cpu_regs_S::edx
uint32_t edx
EDX register.
Definition: common_type_cpu.h:69
osapi_cpu_regs_S::eax
uint32_t eax
EAX register.
Definition: common_type_cpu.h:66