配置自己的UC/OS—II操作系统


每个具体的嵌入式应用系统对实时操作系统的要求是不完全相同的,在实际做项目中,一般我们不可能全部用到UC/OS-II操作系统给我们的所有资源。并且为了减少引入UC/OS操作系统而占用系统的宝贵资源。我们要根据具体情况来对UC/OS操作系统进行裁剪,得到一个即满足需要,又非常紧凑的应用软件系统。

在UC/OS的配置文件(OS_CFG.H)中,对相关的配置常量进行相关的设置。
现对OS_CFG.H中的一些常量配置进行说明:
先看程序:

  1. /* 
  2. ********************************************************************************************************* 
  3. *                                                uC/OS-II 
  4. *                                          The Real-Time Kernel 
  5. * 
  6. *                           (c) Copyright 1992-2001, Jean J. Labrosse, Weston, FL 
  7. *                                           All Rights Reserved 
  8. * 
  9. *                                  uC/OS-II Configuration File for V2.51 
  10. * 
  11. * File : OS_CFG.H 
  12. * By   : Jean J. Labrosse 
  13. ********************************************************************************************************* 
  14. */  
  15.   
  16. /* 
  17. ********************************************************************************************************* 
  18. *                                         uC/OS-II CONFIGURATION 
  19. ********************************************************************************************************* 
  20. */ 
  21.  
  22. #define OS_MAX_EVENTS             42    /* Max. number of event control blocks in your application ...  */   
  23.                                        /* ... MUST be > 0                                              */ 
  24. #define OS_MAX_FLAGS              9    /* Max. number of Event Flag Groups    in your application ...  */   
  25.                                        /* ... MUST be > 0                                              */ 
  26. #define OS_MAX_MEM_PART           9    /* Max. number of memory partitions ...                         */   
  27.                                        /* ... MUST be > 0                                              */ 
  28. #define OS_MAX_QS                 12    /* Max. number of queue control blocks in your application ...  */   
  29.                                        /* ... MUST be > 0                                              */ 
  30. #define OS_MAX_TASKS             12    /* Max. number of tasks in your application ...                 */   
  31.                                        /* ... MUST be >= 2                                             */ 
  32.  
  33. #define OS_LOWEST_PRIO           62    /* Defines the lowest priority that can be assigned ...         */   
  34.                                        /* ... MUST NEVER be higher than 63!                            */ 
  35.  
  36. #define OS_TASK_IDLE_STK_SIZE   512    /* Idle task stack size (# of OS_STK wide entries)              */  
  37.  
  38. #define OS_TASK_STAT_EN           1    /* Enable (1) or Disable(0) the statistics task                 */  
  39. #define OS_TASK_STAT_STK_SIZE   512    /* Statistics task stack size (# of OS_STK wide entries)        */  
  40.  
  41. #define OS_ARG_CHK_EN             1    /* Enable (1) or Disable (0) argument checking                  */  
  42. #define OS_CPU_HOOKS_EN           1    /* uC/OS-II hooks are found in the processor port files         */   
  43.   
  44.   
  45.                                        /* ----------------------- EVENT FLAGS ------------------------ */ 
  46. #define OS_FLAG_EN                1    /* Enable (1) or Disable (0) code generation for EVENT FLAGS    */  
  47. #define OS_FLAG_WAIT_CLR_EN       1    /* Include code for Wait on Clear EVENT FLAGS                   */  
  48. #define OS_FLAG_ACCEPT_EN         1    /*     Include code for OSFlagAccept()                          */  
  49. #define OS_FLAG_DEL_EN            1    /*     Include code for OSFlagDel()                             */  
  50. #define OS_FLAG_QUERY_EN          1    /*     Include code for OSFlagQuery()                           */   
  51.   
  52.   
  53.                                        /* -------------------- MESSAGE MAILBOXES --------------------- */ 
  54. #define OS_MBOX_EN                1    /* Enable (1) or Disable (0) code generation for MAILBOXES      */  
  55. #define OS_MBOX_ACCEPT_EN         1    /*     Include code for OSMboxAccept()                          */  
  56. #define OS_MBOX_DEL_EN            1    /*     Include code for OSMboxDel()                             */  
  57. #define OS_MBOX_POST_EN           1    /*     Include code for OSMboxPost()                            */  
  58. #define OS_MBOX_POST_OPT_EN       1    /*     Include code for OSMboxPostOpt()                         */  
  59. #define OS_MBOX_QUERY_EN          1    /*     Include code for OSMboxQuery()                           */   
  60.   
  61.   
  62.                                        /* --------------------- MEMORY MANAGEMENT -------------------- */ 
  63. #define OS_MEM_EN                 1    /* Enable (1) or Disable (0) code generation for MEMORY MANAGER */  
  64. #define OS_MEM_QUERY_EN           1    /*     Include code for OSMemQuery()                            */   
  65.   
  66.   
  67.                                        /* ---------------- MUTUAL EXCLUSION SEMAPHORES --------------- */ 
  68. #define OS_MUTEX_EN               1    /* Enable (1) or Disable (0) code generation for MUTEX          */  
  69. #define OS_MUTEX_ACCEPT_EN        1    /*     Include code for OSMutexAccept()                         */  
  70. #define OS_MUTEX_DEL_EN           1    /*     Include code for OSMutexDel()                            */  
  71. #define OS_MUTEX_QUERY_EN         1    /*     Include code for OSMutexQuery()                          */   
  72.   
  73.   
  74.                                        /* ---------------------- MESSAGE QUEUES ---------------------- */ 
  75. #define OS_Q_EN                   1    /* Enable (1) or Disable (0) code generation for QUEUES         */  
  76. #define OS_Q_ACCEPT_EN            1    /*     Include code for OSQAccept()                             */  
  77. #define OS_Q_DEL_EN               1    /*     Include code for OSQDel()                                */  
  78. #define OS_Q_FLUSH_EN             1    /*     Include code for OSQFlush()                              */  
  79. #define OS_Q_POST_EN              1    /*     Include code for OSQPost()                               */  
  80. #define OS_Q_POST_FRONT_EN        1    /*     Include code for OSQPostFront()                          */  
  81. #define OS_Q_POST_OPT_EN          1    /*     Include code for OSQPostOpt()                            */  
  82. #define OS_Q_QUERY_EN             1    /*     Include code for OSQQuery()                              */   
  83.   
  84.   
  85.                                        /* ------------------------ SEMAPHORES ------------------------ */ 
  86. #define OS_SEM_EN                 1    /* Enable (1) or Disable (0) code generation for SEMAPHORES     */  
  87. #define OS_SEM_ACCEPT_EN          1    /*    Include code for OSSemAccept()                            */  
  88. #define OS_SEM_DEL_EN             1    /*    Include code for OSSemDel()                               */  
  89. #define OS_SEM_QUERY_EN           1    /*    Include code for OSSemQuery()                             */   
  90.   
  91.   
  92.                                        /* --------------------- TASK MANAGEMENT ---------------------- */ 
  93. #define OS_TASK_CHANGE_PRIO_EN    1    /*     Include code for OSTaskChangePrio()                      */  
  94. #define OS_TASK_CREATE_EN         1    /*     Include code for OSTaskCreate()                          */  
  95. #define OS_TASK_CREATE_EXT_EN     1    /*     Include code for OSTaskCreateExt()                       */  
  96. #define OS_TASK_DEL_EN            1    /*     Include code for OSTaskDel()                             */  
  97. #define OS_TASK_SUSPEND_EN        1    /*     Include code for OSTaskSuspend() and OSTaskResume()      */  
  98. #define OS_TASK_QUERY_EN          1    /*     Include code for OSTaskQuery()                           */   
  99.   
  100.   
  101.                                        /* --------------------- TIME MANAGEMENT ---------------------- */ 
  102. #define OS_TIME_DLY_HMSM_EN       1    /*     Include code for OSTimeDlyHMSM()                         */  
  103. #define OS_TIME_DLY_RESUME_EN     1    /*     Include code for OSTimeDlyResume()                       */  
  104. #define OS_TIME_GET_SET_EN        1    /*     Include code for OSTimeGet() and OSTimeSet()             */   
  105.   
  106.   
  107.                                        /* ---------------------- MISCELLANEOUS ----------------------- */ 
  108. #define OS_SCHED_LOCK_EN          1    /*     Include code for OSSchedLock() and OSSchedUnlock()       */  
  109.  
  110.  
  111. #define OS_TICKS_PER_SEC        200    /* Set the number of ticks in one second                        */   
  112.   
  113.   
  114. typedef INT16U             OS_FLAGS;   /* Date type for event flag bits (8, 16 or 32 bits)             */  
  • 1
  • 2
  • 下一页

相关内容