platformCPU.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _PLATFORM_CPU_H_
  23. #define _PLATFORM_CPU_H_
  24. //-----------------------------------------------------------------------------
  25. enum ProcessorType
  26. {
  27. // x86
  28. CPU_X86Compatible,
  29. CPU_Intel_Unknown,
  30. CPU_Intel_486,
  31. CPU_Intel_Pentium,
  32. CPU_Intel_PentiumMMX,
  33. CPU_Intel_PentiumPro,
  34. CPU_Intel_PentiumII,
  35. CPU_Intel_PentiumCeleron,
  36. CPU_Intel_PentiumIII,
  37. CPU_Intel_Pentium4,
  38. CPU_AMD_K6,
  39. CPU_AMD_K6_2,
  40. CPU_AMD_K6_3,
  41. CPU_AMD_Athlon,
  42. CPU_AMD_Unknown,
  43. CPU_Cyrix_6x86,
  44. CPU_Cyrix_MediaGX,
  45. CPU_Cyrix_6x86MX,
  46. CPU_Cyrix_GXm, // Media GX w/ MMX
  47. CPU_Cyrix_Unknown,
  48. // PowerPC
  49. CPU_PowerPC_Unknown,
  50. CPU_PowerPC_601,
  51. CPU_PowerPC_603,
  52. CPU_PowerPC_603e,
  53. CPU_PowerPC_603ev,
  54. CPU_PowerPC_604,
  55. CPU_PowerPC_604e,
  56. CPU_PowerPC_604ev,
  57. CPU_PowerPC_G3,
  58. CPU_PowerPC_G4,
  59. CPU_PowerPC_G4_7450,
  60. CPU_PowerPC_G4_7455,
  61. CPU_PowerPC_G4_7447,
  62. CPU_PowerPC_G5
  63. };
  64. //-----------------------------------------------------------------------------
  65. enum x86Properties
  66. {
  67. // x86 properties
  68. CPU_PROP_C = (1<<0),
  69. CPU_PROP_FPU = (1<<1),
  70. CPU_PROP_MMX = (1<<2), // Integer-SIMD
  71. CPU_PROP_3DNOW = (1<<3), // AMD Float-SIMD
  72. CPU_PROP_SSE = (1<<4), // PentiumIII SIMD
  73. CPU_PROP_RDTSC = (1<<5) // Read Time Stamp Counter
  74. // CPU_PROP_SSE2 = (1<<6), // Pentium4 SIMD
  75. // CPU_PROP_MP = (1<<7) // Multi-processor system
  76. };
  77. //-----------------------------------------------------------------------------
  78. enum PPCProperties
  79. {
  80. // PowerPC properties
  81. CPU_PROP_PPCMIN = (1<<0),
  82. CPU_PROP_ALTIVEC = (1<<1), // Float-SIMD
  83. CPU_PROP_PPCMP = (1<<7) // Multi-processor system
  84. };
  85. //-----------------------------------------------------------------------------
  86. struct Processor
  87. {
  88. static void init();
  89. };
  90. //-----------------------------------------------------------------------------
  91. struct TorqueSystemInfo
  92. {
  93. struct Processor
  94. {
  95. ProcessorType type;
  96. const char *name;
  97. U32 mhz;
  98. U32 properties; // CPU type specific enum
  99. } processor;
  100. };
  101. extern TorqueSystemInfo PlatformSystemInfo;
  102. #endif // _PLATFORM_CPU_H_