📄 ucos_iif.h
字号:
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
* All Rights Reserved
*
* V2.00
*
* File : uCOS_II.H
* By : Jean J. Labrosse
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MISCELLANEOUS
*********************************************************************************************************
*/
/**/
/*#ifndef RCSID
#define RCSID "$Header: /DspxBoot/Src/ProTyp2/UCOSC31.H 2 8/14/97 7:42a Fowleydg $"
#endif*/
#ifndef __UCOSC31C_H__
#define __UCOSC31C_H__
/*2001/10/19 renamed as os_cpu.h, upgrade to ucos-ii
by zl
*/
/*
* Copyright (c) 1997 by General Electric Company
*
* $Logfile: /DspxBoot/Src/ProTyp2/UCOSC31.H $
* $Revision: 2 $
*
* $Log: /DspxBoot/Src/ProTyp2/UCOSC31.H $
//
// 2 8/14/97 7:42a Fowleydg
// Use TRAPs for critical OS functions
*
* 1 2/21/97 3:01p Fowleydg
* Header for machine dependent code of uC/OS, the real-time kernel
*
* Last Mod: June 2, 1997 9:11:43AM
*/
/*
* DATA TYPES - note: on TMS320C31, all data types are 32 bits wide...
*/
/*zlmodi ins for uCOS-ii*/
typedef unsigned char BOOLEAN;
typedef unsigned char INT8U; /* Unsigned 8 bit quantity */
typedef signed char INT8S; /* Signed 8 bit quantity */
typedef unsigned short INT16U; /* Unsigned 16 bit quantity */
typedef signed short INT16S; /* Signed 16 bit quantity */
typedef unsigned int INT32U; /* Unsigned 32 bit quantity */
typedef signed int INT32S; /* Signed 32 bit quantity */
typedef float FP32; /* Single precision floating point */
typedef double FP64; /* Double precision floating point */
typedef unsigned int OS_STK; /* Each stack entry is 16-bit wide */
/*eolzimodi*/
/*zlmodi del*/
#if 0 /*for uCOS*/
typedef unsigned char BOOLEAN;
typedef unsigned char UBYTE; /* Unsigned 8 bit quantity */
typedef signed char BYTE; /* Signed 8 bit quantity */
typedef unsigned int UWORD; /* Unsigned 16 bit quantity */
typedef signed int WORD; /* Signed 16 bit quantity */
typedef unsigned long ULONG; /* Unsigned 32 bit quantity */
typedef signed long LONG; /* Signed 32 bit quantity */
typedef float FP; /* Single precision floating point */
#endif
/*eozlmodi */
/*zlmodi ins :: tms320c3x's stack grows up!*/
#define OS_STK_GROWTH 0
/*eozlmodi*/
/*
* CONSTANTS
*/
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/*
* TI TMS320C31 DSP Specifics
*/
/*zlmodi del #define OS_ENTER_CRITICAL() asm(" TRAP 25");*/
/*zlmodi ins*/
#define OS_ENTER_CRITICAL() asm(" and 0d000H,ST");
/*eozlmodi*/
#define OS_EXIT_CRITICAL() asm(" OR 2000H,ST");
/*zlmodi del #define OS_TASK_SW() asm(" TRAP 27");*/
#define OS_TASK_SW() asm(" trap 27");/*OSCtxSw();/*asm(" call _OSCtxSw");/*zlmodi ins*/
void OSCtxSw(void);
/*zlmodi del #define OS_FAR far*/
/*zlmodi ins*/
#define OS_FAR /*this key word is bolw shit at the beginning*/
/*eozlmodi*/
/*zlmodi del #define OS_STK_TYPE UBYTE*/
/*#define OFFSET_RESET 0
#define OFFSET_INT0 1
#define OFFSET_INT1 2
#define OFFSET_INT2 3
#define OFFSET_INT3 4
#define OFFSET_XINT0 5
#define OFFSET_RINT0 6
#define OFFSET_XINT1 7
#define OFFSET_RINT1 8
#define OFFSET_TINT0 9
#define OFFSET_TINT1 10
#define OFFSET_DINT 11
#define OFFSET_TRAP(n) (0x20+(n))
/*#define RETS() asm(" TRAP 25");
#define RETI() asm(" TRAP 26");
void OS_FAR OSRets(void);
void OS_FAR OSReti(void);
int OS_FAR OSSetIE(int x);
void OS_FAR OSTaskSuspendSelf(void);*/
/*OS_CPU_EXT INT8U OSTickDOSCtr; /* Counter used to invoke DOS's tick handler every 'n' ticks */
/*eojoined*/
/*zl joined*/
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
* All Rights Reserved
*
* Configuration for Intel 80x86 (Large)
*
* File : OS_CFG.H
* By : Jean J. Labrosse
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* uC/OS-II CONFIGURATION
*********************************************************************************************************
*/
#define OS_MAX_EVENTS 60 /* Max. number of event control blocks in your application ... */
/* ... MUST be >= 2 */
#define OS_MAX_MEM_PART 2 /* Max. number of memory partitions ... */
/* ... MUST be >= 2 */
#define OS_MAX_QS 8 /* Max. number of queue control blocks in your application ... */
/* ... MUST be >= 2 */
#define OS_MAX_TASKS 62 /* Max. number of tasks in your application ... */
/* ... MUST be >= 2 */
#define OS_LOWEST_PRIO 61 /* Defines the lowest priority that can be assigned ... */
/* ... MUST NEVER be higher than 63! */
#define OS_TASK_IDLE_STK_SIZE 128 /* Idle task stack size (# of 16-bit wide entries) */
#define OS_TASK_STAT_EN 1 /* Enable (1) or Disable(0) the statistics task */
#define OS_TASK_STAT_STK_SIZE 128 /* Statistics task stack size (# of 16-bit wide entries) */
#define OS_CPU_HOOKS_EN 1 /* uC/OS-II hooks are found in the processor port files */
#define OS_MBOX_EN 1 /* Include code for MAILBOXES */
#define OS_MEM_EN 0 /* Include code for MEMORY MANAGER (fixed sized memory blocks) */
#define OS_Q_EN 1 /* Include code for QUEUES */
#define OS_SEM_EN 1 /* Include code for SEMAPHORES */
#define OS_TASK_CHANGE_PRIO_EN 0 /* Include code for OSTaskChangePrio() */
#define OS_TASK_CREATE_EN 1 /* Include code for OSTaskCreate() */
#define OS_TASK_CREATE_EXT_EN 0 /* Include code for OSTaskCreateExt() */
#define OS_TASK_DEL_EN 0 /* Include code for OSTaskDel() */
#define OS_TASK_SUSPEND_EN 1 /* Include code for OSTaskSuspend() and OSTaskResume() */
#define OS_TICKS_PER_SEC 320 /* Set the number of ticks in one second */
/*#define OS_TICKS_PER_SEC 640+320 /* Set the number of ticks in one second */
/*end of joined*/
#define OS_VERSION 200 /* Version of uC/OS-II (Vx.yy multiplied by 100) */
#ifdef OS_GLOBALS
#define OS_EXT
#else
#define OS_EXT extern
#endif
#define OS_PRIO_SELF 0xFF /* Indicate SELF priority */
#if OS_TASK_STAT_EN
#define OS_N_SYS_TASKS 2 /* Number of system tasks */
#else
#define OS_N_SYS_TASKS 1
#endif
#define OS_STAT_PRIO (OS_LOWEST_PRIO - 1) /* Statistic task priority */
#define OS_IDLE_PRIO (OS_LOWEST_PRIO) /* IDLE task priority */
#define OS_EVENT_TBL_SIZE ((OS_LOWEST_PRIO) / 8 + 1) /* Size of event table */
#define OS_RDY_TBL_SIZE ((OS_LOWEST_PRIO) / 8 + 1) /* Size of ready table */
#define OS_TASK_IDLE_ID 65535 /* I.D. numbers for Idle and Stat tasks */
#define OS_TASK_STAT_ID 65534
/* TASK STATUS (Bit definition for OSTCBStat) */
#define OS_STAT_RDY 0x00 /* Ready to run */
#define OS_STAT_SEM 0x01 /* Pending on semaphore */
#define OS_STAT_MBOX 0x02 /* Pending on mailbox */
#define OS_STAT_Q 0x04 /* Pending on queue */
#define OS_STAT_SUSPEND 0x08 /* Task is suspended */
#define OS_EVENT_TYPE_MBOX 1
#define OS_EVENT_TYPE_Q 2
#define OS_EVENT_TYPE_SEM 3
/* TASK OPTIONS (see OSTaskCreateExt()) */
#define OS_TASK_OPT_STK_CHK 0x0001 /* Enable stack checking for the task */
#define OS_TASK_OPT_STK_CLR 0x0002 /* Clear the stack when the task is create */
#define OS_TASK_OPT_SAVE_FP 0x0004 /* Save the contents of any floating-point registers */
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/*
*********************************************************************************************************
* ERROR CODES
*********************************************************************************************************
*/
#define OS_NO_ERR 0
#define OS_ERR_EVENT_TYPE 1
#define OS_ERR_PEND_ISR 2
#define OS_TIMEOUT 10
#define OS_TASK_NOT_EXIST 11
#define OS_MBOX_FULL 20
#define OS_Q_FULL 30
#define OS_PRIO_EXIST 40
#define OS_PRIO_ERR 41
#define OS_PRIO_INVALID 42
#define OS_SEM_OVF 50
#define OS_TASK_DEL_ERR 60
#define OS_TASK_DEL_IDLE 61
#define OS_TASK_DEL_REQ 62
#define OS_TASK_DEL_ISR 63
#define OS_NO_MORE_TCB 70
#define OS_TIME_NOT_DLY 80
#define OS_TIME_INVALID_MINUTES 81
#define OS_TIME_INVALID_SECONDS 82
#define OS_TIME_INVALID_MILLI 83
#define OS_TIME_ZERO_DLY 84
#define OS_TASK_SUSPEND_PRIO 90
#define OS_TASK_SUSPEND_IDLE 91
#define OS_TASK_RESUME_PRIO 100
#define OS_TASK_NOT_SUSPENDED 101
#define OS_MEM_INVALID_PART 110
#define OS_MEM_INVALID_BLKS 111
#define OS_MEM_INVALID_SIZE 112
#define OS_MEM_NO_FREE_BLKS 113
#define OS_MEM_FULL 114
#define OS_TASK_OPT_ERR 130
/*$PAGE*/
/*
*********************************************************************************************************
* EVENT CONTROL BLOCK
*********************************************************************************************************
*/
#if (OS_MAX_EVENTS >= 2)
typedef struct {
void *OSEventPtr; /* Pointer to message or queue structure */
INT8U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
INT16U OSEventCnt; /* Count of used when event is a semaphore */
INT8U OSEventType; /* OS_EVENT_TYPE_MBOX, OS_EVENT_TYPE_Q or OS_EVENT_TYPE_SEM */
INT8U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
} OS_EVENT;
#endif
/*$PAGE*/
/*
*********************************************************************************************************
* MESSAGE MAILBOX DATA
*********************************************************************************************************
*/
#if OS_MBOX_EN
typedef struct {
void *OSMsg; /* Pointer to message in mailbox */
INT8U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
INT8U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
} OS_MBOX_DATA;
#endif
/*
*********************************************************************************************************
* MEMORY PARTITION DATA STRUCTURES
*********************************************************************************************************
*/
#if OS_MEM_EN && (OS_MAX_MEM_PART >= 2)
typedef struct { /* MEMORY CONTROL BLOCK */
void *OSMemAddr; /* Pointer to beginning of memory partition */
void *OSMemFreeList; /* Pointer to list of free memory blocks */
INT32U OSMemBlkSize; /* Size (in bytes) of each block of memory */
INT32U OSMemNBlks; /* Total number of blocks in this partition */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -