硬汉嵌入式论坛

 找回密码
 立即注册
查看: 3142|回复: 2
收起左侧

[μCOS-II] CPU_INIT这个函数作用是什么?

[复制链接]

62

主题

77

回帖

263

积分

高级会员

积分
263
发表于 2018-6-27 14:21:29 | 显示全部楼层 |阅读模式
注释掉也能编译通过:
static void AppTaskStart(void *p_arg)
{       
    /* 仅用于避免编译器告警,编译器不会产生任何目标代码 */       
    (void)p_arg;   
         
        /* BSP 初始化。 BSP = Board Support Package 板级支持包,可以理解为底层驱动。*/
        bsp_Init();
// CPU_Init();         
        BSP_Tick_Init();  

回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106934
QQ
发表于 2018-6-28 01:20:53 | 显示全部楼层

三个作用
(a) Initialize CPU timestamps
(b) Initialize CPU interrupts disabled time measurements
(c) Initialize CPU host name


  1. /*
  2. *********************************************************************************************************
  3. *                                             CPU_Init()
  4. *
  5. * Description : (1) Initialize CPU module :
  6. *
  7. *                   (a) Initialize CPU timestamps
  8. *                   (b) Initialize CPU interrupts disabled time measurements
  9. *                   (c) Initialize CPU host name
  10. *
  11. *
  12. * Argument(s) : none.
  13. *
  14. * Return(s)   : none.
  15. *
  16. * Caller(s)   : Your Product's Application.
  17. *
  18. *               This function is a CPU initialization function & MAY be called by application/
  19. *               initialization function(s).
  20. *
  21. * Note(s)     : (2) CPU_Init() MUST be called ... :
  22. *
  23. *                   (a) ONLY ONCE from a product's application; ...
  24. *                   (b) BEFORE product's application calls any core CPU module function(s)
  25. *
  26. *               (3) The following initialization functions MUST be sequenced as follows :
  27. *
  28. *                   (a) CPU_TS_Init()           SHOULD precede ALL calls to other CPU timestamp functions
  29. *
  30. *                   (b) CPU_IntDisMeasInit()    SHOULD precede ALL calls to CPU_CRITICAL_ENTER()/CPU_CRITICAL_EXIT()
  31. *                                                   & other CPU interrupts disabled time measurement functions
  32. *********************************************************************************************************
  33. */

  34. void  CPU_Init (void)
  35. {
  36.                                                                 /* --------------------- INIT TS ---------------------- */
  37. #if ((CPU_CFG_TS_EN     == DEF_ENABLED) || \
  38.      (CPU_CFG_TS_TMR_EN == DEF_ENABLED))
  39.     CPU_TS_Init();                                              /* See Note #3a.                                        */
  40. #endif
  41.                                                                 /* -------------- INIT INT DIS TIME MEAS -------------- */
  42. #ifdef  CPU_CFG_INT_DIS_MEAS_EN
  43.     CPU_IntDisMeasInit();                                       /* See Note #3b.                                        */
  44. #endif

  45.                                                                 /* ------------------ INIT CPU NAME ------------------- */
  46. #if (CPU_CFG_NAME_EN == DEF_ENABLED)
  47.      CPU_NameInit();
  48. #endif

  49. #if (CPU_CFG_CACHE_MGMT_EN == DEF_ENABLED)
  50.      CPU_Cache_Init();
  51. #endif
  52. }
复制代码


回复

使用道具 举报

62

主题

77

回帖

263

积分

高级会员

积分
263
 楼主| 发表于 2018-6-28 11:17:37 | 显示全部楼层
eric2013 发表于 2018-6-28 01:20
三个作用
(a) Initialize CPU timestamps
(b) Initialize CPU interrupts disabled time measurements ...

好的谢谢啊。为什么不用也不影响代码呢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-10 11:42 , Processed in 0.152635 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表