RCCE_power_reset.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #include "RCCE.h"
  17. #include <stdio.h>
  18. void print_dividers(void);
  19. int RCCE_APP(int argc, char **argv){
  20. RCCE_REQUEST req;
  21. int fdiv, vlevel, ID;
  22. RCCE_init(&argc, &argv);
  23. RCCE_debug_set(RCCE_DEBUG_ALL);
  24. ID = RCCE_ue();
  25. // first turn the frequency so low that any voltage level is valid
  26. if(RCCE_set_frequency_divider(8, &fdiv)) {
  27. printf("UE %d failed SET_FREQUENCY_DIVIDER 8\n", ID);
  28. fflush(NULL);
  29. }
  30. // Ask for a tile clock divider of 2. This corresponds to voltage
  31. // level 4, i.e. 1.1 V.
  32. if(RCCE_iset_power(2, &req, &fdiv, &vlevel)) {
  33. printf("UE %d failed ISET_POWER 2\n", ID);
  34. fflush(NULL);
  35. }
  36. // need to wait for thenew voltage target to be reached
  37. if (RCCE_wait_power(&req)) {
  38. printf("UE %d failed WAIT_POWER 2\n", ID);
  39. fflush(NULL);
  40. }
  41. // now set a tile clock divider of 3, to arrive at the default
  42. // frequency of 533 MHz
  43. if (RCCE_set_frequency_divider(3, &fdiv)) {
  44. printf("UE %d failed SET_FREQUENCY_DIVIDER 3\n", ID);
  45. fflush(NULL);
  46. }
  47. RCCE_barrier(&RCCE_COMM_WORLD);
  48. if (ID==0)print_dividers();
  49. RCCE_finalize();
  50. return(0);
  51. }