parameters.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. /**
  18. * @name: GetCpuMaskToAffval
  19. * @msg: 参考 GetCpuMaskToAffval 进行参数的重新定义 ,两个小核心定义的id 为0,1 ,两个大核的id 为 2,3
  20. * @return {*}
  21. * @note:
  22. * @param {u32} *cpu_mask
  23. * @param {u32} *cluster_id
  24. * @param {u32} *target_list
  25. */
  26. u32 GetCpuMaskToAffval(u32 *cpu_mask, u32 *cluster_id, u32 *target_list)
  27. {
  28. if (*cpu_mask == 0)
  29. {
  30. return 0;
  31. }
  32. *target_list = 0;
  33. *cluster_id = 0;
  34. if (*cpu_mask & 0x4)
  35. {
  36. *target_list = 1;
  37. *cpu_mask &= ~0x4;
  38. }
  39. else if (*cpu_mask & 0x8)
  40. {
  41. *cluster_id = 0x100;
  42. *target_list = 1;
  43. *cpu_mask &= ~0x8;
  44. }
  45. else if (*cpu_mask & 0x3)
  46. {
  47. *cluster_id = 0x200;
  48. if ((*cpu_mask & 0x3) == 0x3)
  49. {
  50. *target_list = 3;
  51. }
  52. else if ((*cpu_mask & 0x4))
  53. {
  54. *target_list = 1;
  55. }
  56. else
  57. {
  58. *target_list = 2;
  59. }
  60. *cpu_mask &= ~0x3;
  61. }
  62. else
  63. {
  64. *cpu_mask = 0;
  65. return 0;
  66. }
  67. return 1;
  68. }