国产毛片a精品毛-国产毛片黄片-国产毛片久久国产-国产毛片久久精品-青娱乐极品在线-青娱乐精品

電子工程網(wǎng)

標(biāo)題: ucos(head file) [打印本頁(yè)]

作者: 諸葛孔明    時(shí)間: 2009-8-28 10:38
標(biāo)題: ucos(head file)
/*
************************************                                                                                                 uC/OS
*                                          The Real-Time Kernel
*                                           SYSTEM DECLARATIONS
*
*                        (c) Copyright 1992-1995, Jean J. Labrosse, Plantation, FL
*                                           All Rights Reserved
*
*                                                  V1.08
*
* File : UCOS.H
* By   : Jean J. Labrosse
************************************************************
*/
/*
************************************************************
*                                          uC/OS CONFIGURATION
************************************************************
*/

#define OS_FAR                  far    /* Define OS_FAR for the processor (ix86 CPUs)                  */
#define OS_STK_TYPE           UBYTE    /* Data type used for stack                                     */

#define uCOS                   0x80    /* Interrupt vector assigned to uC/OS                           */

#define OS_MAX_TASKS             63    /* Maximum number of tasks in your application                  */
#define OS_MAX_EVENTS            20    /* Maximum number of event control blocks in your application   */
#define OS_MAX_QS                 5    /* Maximum number of queue control blocks in your application   */

#define OS_IDLE_TASK_STK_SIZE  1024    /* Idle task stack size (BYTEs)                                 */
#define OS_IDLE_TASK_STK_TOP   1024    /* Index into idle task top of stack                            */

#define OS_TASK_CHANGE_PRIO_EN    1    /* Include code for OSTaskChangePrio()                          */
#define OS_TASK_DEL_EN            1    /* Include code for OSTaskDel()                                 */
#define OS_SEM_EN                 1    /* Include code for SEMAPHORES                                  */
#define OS_MBOX_EN                1    /* Include code for MAILBOXES                                   */
#define OS_Q_EN                   1    /* Include code for QUEUES                                      */
#define OS_TASK_SUSPEND_EN        1    /* Include code for OSTaskSuspend() and OSTaskResume()          */
/*$PAGE*/
/*
************************************************************
*                                            MISCELLANEOUS
************************************************************
*/

#ifdef  OS_GLOBALS
#define OS_EXT
#else
#define OS_EXT  extern
#endif

#define OS_PRIO_SELF           0xFF    /* Indicate SELF priority                                       */

/*
************************************************************
*                                           uC/OS ERROR CODES
************************************************************
*/

#define OS_NO_ERR                 0

#define OS_TIMEOUT               10
#define OS_TASK_NOT_EXIST        11

#define OS_MBOX_FULL             20
#define OS_MBOX_MSG_NOT_AVAIL    21

#define OS_Q_FULL                30
#define OS_Q_MSG_NOT_AVAIL       31

#define OS_PRIO_EXIST            40
#define OS_PRIO_ERR              41
#define OS_PRIO_INVALID          42

#define OS_SEM_ERR               50
#define OS_SEM_OVF               51
#define OS_SEM_NOT_AVAIL         52

#define OS_TASK_DEL_ERR          60
#define OS_TASK_DEL_IDLE         61
#define OS_TASK_DEL_REQ          62

#define OS_NO_MORE_TCB           70

#define OS_TIME_NOT_DLY          80

#define OS_TASK_SUSPEND_PRIO     90
#define OS_TASK_SUSPEND_IDLE     91

#define OS_TASK_RESUME_PRIO     100
#define OS_TASK_NOT_SUSPENDED   101
/*$PAGE*/
/*
************************************************************
*                                          EVENT CONTROL BLOCK
************************************************************
*/

typedef struct os_event {
    UBYTE  OSEventGrp;                 /* Group corresponding to tasks waiting for event to occur      */
    UBYTE  OSEventTbl[8];              /* List of tasks waiting for event to occur                     */
    UWORD  OSEventCnt;                 /* Count of used when event is a semaphore                      */
    void  *OSEventPtr;                 /* Pointer to message or queue structure                        */
} OS_EVENT;


/*
************************************************************
*                                        uC/OS TASK CONTROL BLOCK
************************************************************
*/

typedef struct os_tcb {
    void   OS_FAR *OSTCBStkPtr;        /* Pointer to current top of stack                              */
    UBYTE          OSTCBStat;          /* Task status                                                  */
    UBYTE          OSTCBPrio;          /* Task priority (0 == highest, 63 == lowest)                   */
    UWORD          OSTCBDly;           /* Nbr ticks to delay task or, timeout waiting for event        */
    BOOLEAN        OSTCBDelReq;        /* Indicates whether a task needs to delete itself              */
    UBYTE          OSTCBX;             /* Bit position in group  corresponding to task priority (0..7) */
    UBYTE          OSTCBY;             /* Index into ready table corresponding to task priority        */
    UBYTE          OSTCBBitX;          /* Bit mask to access bit position in ready table               */
    UBYTE          OSTCBBitY;          /* Bit mask to access bit position in ready group               */
    OS_EVENT      *OSTCBEventPtr;      /* Pointer to event control block                               */
    void          *OSTCBMsg;           /* Message received from OSMboxPost() or OSQPost()              */
    struct os_tcb *OSTCBNext;          /* Pointer to next     TCB in the TCB list                      */
    struct os_tcb *OSTCBPrev;          /* Pointer to previous TCB in the TCB list                      */
} OS_TCB;


/*
************************************************************
*                                          QUEUE CONTROL BLOCK
************************************************************
*/

typedef struct os_q {
    struct os_q   *OSQPtr;             /* Link to next queue control block in list of free blocks      */
    void         **OSQStart;           /* Pointer to start of queue data                               */
    void         **OSQEnd;             /* Pointer to end   of queue data                               */
    void         **OSQIn;              /* Pointer to where next message will be inserted  in   the Q   */
    void         **OSQOut;             /* Pointer to where next message will be extracted from the Q   */
    UBYTE          OSQSize;            /* Size of queue (maximum number of entries)                    */
    UBYTE          OSQEntries;         /* Current number of entries in the queue                       */
} OS_Q;
/*$PAGE*/
/*
************************************************************
*                                         uC/OS GLOBAL VARIABLES
************************************************************
*/
                                       /* SYSTEM VARIABLES                                             */
OS_EXT  UWORD      OSCtxSwCtr;         /* Counter of number of context switches                        */
OS_EXT  ULONG      OSIdleCtr;          /* Idle counter                                                 */
OS_EXT  UBYTE      OSIntNesting;       /* Interrupt nesting level                                      */
OS_EXT  BOOLEAN    OSRunning;          /* Flag indicating that kernel is running                       */
OS_EXT  OS_TCB    *OSTCBCur;           /* Pointer to currently running TCB                             */
OS_EXT  OS_TCB    *OSTCBHighRdy;       /* Pointer to highest priority TCB ready to run                 */
OS_EXT  OS_TCB    *OSTCBPrioTbl[64];   /* Table of pointers to all created TCBs                        */

/*
*********************************************************************************************************
*                                       uC/OS FUNCTION PROTOTYPES
*********************************************************************************************************
*/

void        OSInit(void);

void        OSStart(void);
void        OSStartHighRdy(void);

void        OSSched(void);
void        OSSchedLock(void);
void        OSSchedUnlock(void);

UBYTE       OSTaskCreate(void (OS_FAR *task)(void *pd), void *pdata, void *pstk, UBYTE prio);
UBYTE       OSTaskDel(UBYTE prio);
UBYTE       OSTaskDelReq(UBYTE prio);
UBYTE       OSTaskChangePrio(UBYTE oldprio, UBYTE newprio);
UBYTE       OSTaskSuspend(UBYTE prio);
UBYTE       OSTaskResume(UBYTE prio);
UBYTE       OSTCBInit(UBYTE prio, void OS_FAR *stk);

void        OSIntEnter(void);
void        OSIntExit(void);
void        OSIntCtxSw(void);

void OS_FAR OSCtxSw(void);
void OS_FAR OSTickISR(void);

void        OSTimeDly(UWORD ticks);
UBYTE       OSTimeDlyResume(UBYTE prio);
void        OSTimeTick(void);
void        OSTimeSet(ULONG ticks);
ULONG       OSTimeGet(void);

OS_EVENT   *OSSemCreate(UWORD value);
UWORD       OSSemAccept(OS_EVENT *pevent);
UBYTE       OSSemPost(OS_EVENT *pevent);
void        OSSemPend(OS_EVENT *pevent, UWORD timeout, UBYTE *err);

OS_EVENT   *OSMboxCreate(void *msg);
void       *OSMboxAccept(OS_EVENT *pevent);
UBYTE       OSMboxPost(OS_EVENT *pevent, void *msg);
void       *OSMboxPend(OS_EVENT *pevent, UWORD timeout, UBYTE *err);

OS_EVENT   *OSQCreate(void **start, UBYTE size);
void       *OSQAccept(OS_EVENT *pevent);
UBYTE       OSQPost(OS_EVENT *pevent, void *msg);
void       *OSQPend(OS_EVENT *pevent, UWORD timeout, UBYTE *err)
作者: foreverlee    時(shí)間: 2010-6-9 21:39
這也能上傳啊




歡迎光臨 電子工程網(wǎng) (http://www.qingdxww.cn/) Powered by Discuz! X3.4
主站蜘蛛池模板: 五月婷网站 | 黄色成年视频 | 免费精品国产福利片 | 中国麻豆 | 四虎永久免费影院在线 | 中文字幕日本在线 | 日韩一区二区三区在线免费观看 | 一级毛片免费在线 | 国产人成精品综合欧美成人 | 视频一区亚洲 | 亚洲一区二区黄色 | 免费一级片在线观看 | 狠狠操操| 999国产视频| 天天天操操操 | 国产一级一国产一级毛片 | 成品人app软件大全下载 | 国产aⅴ2021 国产a v高清一区二区三区 | 99久久99久久精品免费看子伦 | 国产一级一片免费播放视频 | 狠狠综合久久久综合 | 欧美一级久久久久久久久大 | 亚洲国产日韩在线人高清 磁力 | 欧美日本道| 国产一级精品毛片 | 国产亚洲精品一品区99热 | 2019国产开嫩苞视频 | 国产欧美日韩免费一区二区 | 国产精品视频久久久久 | 福利片一区 | 日本护士xxxjapanese| 成人国内精品久久久久影院 | 国产午夜亚洲精品不卡免下载 | 一区二区三区毛片免费 | 色视频在线免费看 | 精品国产91 | 久久亚洲国产高清 | 国产青草视频在线观看 | 国产一级毛片高清视频完整版 | 亚洲国产高清一区二区三区 | 四虎网站在线播放 |