歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> 配置自己的UC/OS—II操作系統

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

日期:2017/3/1 10:15:52   编辑:Linux編程

每個具體的嵌入式應用系統對實時操作系統的要求是不完全相同的,在實際做項目中,一般我們不可能全部用到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. * uC/OS-II CONFIGURATION
  18. *********************************************************************************************************
  19. */
  20. #define OS_MAX_EVENTS 42 /* Max. number of event control blocks in your application ... */
  21. /* ... MUST be > 0 */
  22. #define OS_MAX_FLAGS 9 /* Max. number of Event Flag Groups in your application ... */
  23. /* ... MUST be > 0 */
  24. #define OS_MAX_MEM_PART 9 /* Max. number of memory partitions ... */
  25. /* ... MUST be > 0 */
  26. #define OS_MAX_QS 12 /* Max. number of queue control blocks in your application ... */
  27. /* ... MUST be > 0 */
  28. #define OS_MAX_TASKS 12 /* Max. number of tasks in your application ... */
  29. /* ... MUST be >= 2 */
  30. #define OS_LOWEST_PRIO 62 /* Defines the lowest priority that can be assigned ... */
  31. /* ... MUST NEVER be higher than 63! */
  32. #define OS_TASK_IDLE_STK_SIZE 512 /* Idle task stack size (# of OS_STK wide entries) */
  33. #define OS_TASK_STAT_EN 1 /* Enable (1) or Disable(0) the statistics task */
  34. #define OS_TASK_STAT_STK_SIZE 512 /* Statistics task stack size (# of OS_STK wide entries) */
  35. #define OS_ARG_CHK_EN 1 /* Enable (1) or Disable (0) argument checking */
  36. #define OS_CPU_HOOKS_EN 1 /* uC/OS-II hooks are found in the processor port files */
  37. /* ----------------------- EVENT FLAGS ------------------------ */
  38. #define OS_FLAG_EN 1 /* Enable (1) or Disable (0) code generation for EVENT FLAGS */
  39. #define OS_FLAG_WAIT_CLR_EN 1 /* Include code for Wait on Clear EVENT FLAGS */
  40. #define OS_FLAG_ACCEPT_EN 1 /* Include code for OSFlagAccept() */
  41. #define OS_FLAG_DEL_EN 1 /* Include code for OSFlagDel() */
  42. #define OS_FLAG_QUERY_EN 1 /* Include code for OSFlagQuery() */
  43. /* -------------------- MESSAGE MAILBOXES --------------------- */
  44. #define OS_MBOX_EN 1 /* Enable (1) or Disable (0) code generation for MAILBOXES */
  45. #define OS_MBOX_ACCEPT_EN 1 /* Include code for OSMboxAccept() */
  46. #define OS_MBOX_DEL_EN 1 /* Include code for OSMboxDel() */
  47. #define OS_MBOX_POST_EN 1 /* Include code for OSMboxPost() */
  48. #define OS_MBOX_POST_OPT_EN 1 /* Include code for OSMboxPostOpt() */
  49. #define OS_MBOX_QUERY_EN 1 /* Include code for OSMboxQuery() */
  50. /* --------------------- MEMORY MANAGEMENT -------------------- */
  51. #define OS_MEM_EN 1 /* Enable (1) or Disable (0) code generation for MEMORY MANAGER */
  52. #define OS_MEM_QUERY_EN 1 /* Include code for OSMemQuery() */
  53. /* ---------------- MUTUAL EXCLUSION SEMAPHORES --------------- */
  54. #define OS_MUTEX_EN 1 /* Enable (1) or Disable (0) code generation for MUTEX */
  55. #define OS_MUTEX_ACCEPT_EN 1 /* Include code for OSMutexAccept() */
  56. #define OS_MUTEX_DEL_EN 1 /* Include code for OSMutexDel() */
  57. #define OS_MUTEX_QUERY_EN 1 /* Include code for OSMutexQuery() */
  58. /* ---------------------- MESSAGE QUEUES ---------------------- */
  59. #define OS_Q_EN 1 /* Enable (1) or Disable (0) code generation for QUEUES */
  60. #define OS_Q_ACCEPT_EN 1 /* Include code for OSQAccept() */
  61. #define OS_Q_DEL_EN 1 /* Include code for OSQDel() */
  62. #define OS_Q_FLUSH_EN 1 /* Include code for OSQFlush() */
  63. #define OS_Q_POST_EN 1 /* Include code for OSQPost() */
  64. #define OS_Q_POST_FRONT_EN 1 /* Include code for OSQPostFront() */
  65. #define OS_Q_POST_OPT_EN 1 /* Include code for OSQPostOpt() */
  66. #define OS_Q_QUERY_EN 1 /* Include code for OSQQuery() */
  67. /* ------------------------ SEMAPHORES ------------------------ */
  68. #define OS_SEM_EN 1 /* Enable (1) or Disable (0) code generation for SEMAPHORES */
  69. #define OS_SEM_ACCEPT_EN 1 /* Include code for OSSemAccept() */
  70. #define OS_SEM_DEL_EN 1 /* Include code for OSSemDel() */
  71. #define OS_SEM_QUERY_EN 1 /* Include code for OSSemQuery() */
  72. /* --------------------- TASK MANAGEMENT ---------------------- */
  73. #define OS_TASK_CHANGE_PRIO_EN 1 /* Include code for OSTaskChangePrio() */
  74. #define OS_TASK_CREATE_EN 1 /* Include code for OSTaskCreate() */
  75. #define OS_TASK_CREATE_EXT_EN 1 /* Include code for OSTaskCreateExt() */
  76. #define OS_TASK_DEL_EN 1 /* Include code for OSTaskDel() */
  77. #define OS_TASK_SUSPEND_EN 1 /* Include code for OSTaskSuspend() and OSTaskResume() */
  78. #define OS_TASK_QUERY_EN 1 /* Include code for OSTaskQuery() */
  79. /* --------------------- TIME MANAGEMENT ---------------------- */
  80. #define OS_TIME_DLY_HMSM_EN 1 /* Include code for OSTimeDlyHMSM() */
  81. #define OS_TIME_DLY_RESUME_EN 1 /* Include code for OSTimeDlyResume() */
  82. #define OS_TIME_GET_SET_EN 1 /* Include code for OSTimeGet() and OSTimeSet() */
  83. /* ---------------------- MISCELLANEOUS ----------------------- */
  84. #define OS_SCHED_LOCK_EN 1 /* Include code for OSSchedLock() and OSSchedUnlock() */
  85. #define OS_TICKS_PER_SEC 200 /* Set the number of ticks in one second */
  86. typedef INT16U OS_FLAGS; /* Date type for event flag bits (8, 16 or 32 bits) */
Copyright © Linux教程網 All Rights Reserved