xyq4513 发表于 2009-5-11 21:32:03

uC/OS 的问题

请问 uC/OS 中 os_cfg_r.h 和 os_cfg.h 有什么关系啊?是不是都是必须的?

zchong 发表于 2009-5-13 18:23:01

os_cfg_r.h只是个参考

xyq4513 发表于 2009-5-13 20:19:36

两天了,终于有人回答了。谢谢。

楼上南京哪儿的啊 ?

zchong 发表于 2009-5-13 20:23:30

南瑞路

xyq4513 发表于 2009-5-13 20:57:50

楼上是南瑞的 ?膜拜下。

编译时
   OSTCBCur->OSTCBMsg         = (void      *)0;      /* Clear taskmessage
这句话出错

出错提示:
!E E:\Software\uCOS-II\Source\os_core.c(533): unknown field `OSTCBMsg' of `struct os_tcb'
E:\Software\uCOS-II\Source\os_core.c(533): operands of = have illegal types `int' and `pointer to void'

是什么问题?

passerby 发表于 2009-5-13 21:20:46

是说结构体 os_tcb 里面没有 OSTCBMsg 这个成员
应该是在
#if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0)
这句,如果预编译的设置里面,上面的条件,也就是这几个设定的宏不满足条件,就不编译后面的这个结构体变量.
则结构体里面就没有 OSTCBMsg 这个成员了.

typedef struct os_tcb {
    OS_STK      *OSTCBStkPtr;      /* Pointer to current top of stack                              */

#if OS_TASK_CREATE_EXT_EN > 0
    void          *OSTCBExtPtr;      /* Pointer to user definable data for TCB extension             */
    OS_STK      *OSTCBStkBottom;   /* Pointer to bottom of stack                                 */
    INT32U         OSTCBStkSize;       /* Size of task stack (in number of stack elements)             */
    INT16U         OSTCBOpt;         /* Task options as passed by OSTaskCreateExt()                  */
    INT16U         OSTCBId;            /* Task ID (0..65535)                                           */
#endif

    struct os_tcb *OSTCBNext;          /* Pointer to next   TCB in the TCB list                      */
    struct os_tcb *OSTCBPrev;          /* Pointer to previous TCB in the TCB list                      */

#if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0) || (OS_SEM_EN > 0) || (OS_MUTEX_EN > 0)
    OS_EVENT      *OSTCBEventPtr;      /* Pointer to event control block                               */
#endif

#if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0)                //▲就是在这里
    void          *OSTCBMsg;         /* Message received from OSMboxPost() or OSQPost()            */
#endif

#if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
#if OS_TASK_DEL_EN > 0
    OS_FLAG_NODE*OSTCBFlagNode;      /* Pointer to event flag node                                 */
#endif   
    OS_FLAGS       OSTCBFlagsRdy;      /* Event flags that made task ready to run                      */
#endif

    INT16U         OSTCBDly;         /* Nbr ticks to delay task or, timeout waiting for event      */
    INT8U          OSTCBStat;          /* Task status                                                */
    INT8U          OSTCBPrio;          /* Task priority (0 == highest, 63 == lowest)                   */

    INT8U          OSTCBX;             /* Bit position in groupcorresponding to task priority (0..7) */
    INT8U          OSTCBY;             /* Index into ready table corresponding to task priority      */
    INT8U          OSTCBBitX;          /* Bit mask to access bit position in ready table               */
    INT8U          OSTCBBitY;          /* Bit mask to access bit position in ready group               */

#if OS_TASK_DEL_EN > 0
    BOOLEAN      OSTCBDelReq;      /* Indicates whether a task needs to delete itself            */
#endif
} OS_TCB;

xyq4513 发表于 2009-5-13 21:28:13

谢谢楼上的解答,豁然开朗。
页: [1]
查看完整版本: uC/OS 的问题