RCCE_lib_pwr.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // Copyright 2010 Intel Corporation
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. #define RC_GLOBAL_CLOCK_MHZ 1600
  17. #define RPC_ROOT 0
  18. #define RC_NUM_VOLTAGE_DOMAINS 6
  19. #define RC_MIN_VOLTAGE_LEVEL 0
  20. #define RC_MAX_VOLTAGE_LEVEL 6
  21. #define RC_MAX_FREQUENCY_DIVIDER 16 // maximum divider value, so lowest F
  22. #define RC_MIN_FREQUENCY_DIVIDER 2 // minimum divider value, so highest F
  23. #define RC_NUM_FREQUENCY_DIVIDERS (RC_MAX_FREQUENCY_DIVIDER+1)
  24. #define RC_NUM_VOLTAGE_LEVELS 7
  25. #define RPC_PHYSICAL_ADDRESS 0xFB000000
  26. #ifndef SCC
  27. /* real latency is probably closer to 8 800 000 */
  28. #define RC_WAIT_CYCLES 1000000
  29. #endif
  30. #define TILEDIVIDER 0x00000080
  31. #define RC_DEFAULT_VOLTAGE_LEVEL 4
  32. #define RC_DEFAULT_FREQUENCY_DIVIDER 3 // corresponds to tile clock of 1600/3
  33. typedef struct {
  34. float volt;
  35. int VID;
  36. int MHz_cap;
  37. } triple;
  38. int RCCE_set_frequency(int);
  39. static int RC_wait_voltage(RCCE_REQUEST *);
  40. static int RC_set_frequency_divider(int, int);
  41. long long RC_global_clock(void);
  42. unsigned int FID_word(int, int);
  43. unsigned int VID_word(int, int);
  44. #ifdef RC_POWER_MANAGEMENT
  45. #ifndef SCC
  46. typedef struct {
  47. volatile int queue[RC_NUM_VOLTAGE_DOMAINS];
  48. volatile long long start_time;
  49. } RCCE_RPC_REGULATOR;
  50. #define REGULATOR_LENGTH (PAD32byte(sizeof(RCCE_RPC_REGULATOR)))
  51. extern RCCE_RPC_REGULATOR *RCCE_RPC_regulator;
  52. extern long long RC_time_at_birth;
  53. #endif
  54. extern RCCE_COMM RCCE_V_COMM;
  55. extern RCCE_COMM RCCE_F_COMM;
  56. extern RCCE_COMM RCCE_P_COMM;
  57. extern int RCCE_ue_F_masters[4];
  58. extern int RCCE_set_power_active;
  59. extern int RC_current_voltage_level;
  60. extern int RC_current_frequency_divider;
  61. int RCCE_init_RPC(int *, int, int);
  62. #endif
  63. #ifdef _OPENMP
  64. #pragma omp threadprivate (RCCE_ue_F_masters)
  65. #pragma omp threadprivate (RCCE_V_COMM, RCCE_F_COMM, RCCE_P_COMM)
  66. #pragma omp threadprivate (RCCE_set_power_active)
  67. #pragma omp threadprivate (RC_current_voltage_level, RC_current_frequency_divider)
  68. #ifndef SCC
  69. #pragma omp threadprivate (RC_time_at_birth)
  70. #pragma omp threadprivate (RCCE_RPC_regulator)
  71. #endif
  72. #endif