parameters.c 948 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Email: opensource_embedded@phytium.com.cn
  7. *
  8. * Change Logs:
  9. * Date Author Notes
  10. * 2022-10-26 huanghe first commit
  11. *
  12. */
  13. #include "rtconfig.h"
  14. #include <rtthread.h>
  15. #include "fcpu_info.h"
  16. #include "fparameters.h"
  17. u32 GetCpuMaskToAffval(u32 *cpu_mask, u32 *cluster_id, u32 *target_list)
  18. {
  19. if (*cpu_mask == 0)
  20. {
  21. return 0;
  22. }
  23. *target_list = 0;
  24. *cluster_id = 0;
  25. if (*cpu_mask & 0x3)
  26. {
  27. *cluster_id = 0x200;
  28. if ((*cpu_mask & 0x3) == 0x3)
  29. {
  30. *target_list = 3;
  31. }
  32. else if ((*cpu_mask & 0x1))
  33. {
  34. *target_list = 1;
  35. }
  36. else
  37. {
  38. *target_list = 2;
  39. }
  40. *cpu_mask &= ~0x3; /* clear all mask */
  41. }
  42. else
  43. {
  44. *cpu_mask = 0;
  45. return 0;
  46. }
  47. return 1;
  48. }