📄 rtos.h
字号:
#ifndef RTOS_H_INCLUDED
#define RTOS_H_INCLUDED
/***********************************************************************
* *
* RTOS.H : include file for RTOS *
* *
* to be included in every C-module accessing RTOS-routines *
* *
************************************************************************
************************************************************************
* *
* Part of embOS real-time operating system *
* *
* (c) Copyright SEGGER Microcontrollersysteme GmbH *
* *
* *
************************************************************************
*/
/********************************************************
* *
* Chip specifics F16LX *
* *
*********************************************************
*/
#include <string.h>
#define OS_CPU "F16LX"
#define OS_CPU_VERSION 306
#define OS_I32 signed long
#define OS_U32 unsigned long
#if 1 /* Normally 1, just for tests 0 ! */
#define OS_DI() __DI()
#define OS_EI() __EI()
#else /* Switch P4.7 to show interrupt latencies */
#define OS_DI() {__DI(); (*(volatile char*)4) |= 0x80; }
#define OS_EI() {__EI(); (*(volatile char*)4) &= 0x7f; }
#endif
#define FAR far
#define OS_SP_ADJUST 0
#define OS_GetTime() ((int)OS_Time)
#define OS_STACKPTR /* No override needed (any memory area will do) */
#define OS_SADDR __near /* OS-data needs to be in near memory */
#if 0
#define OS_STACKPTR __near /* Stacks do not need to be in near memory */
#endif
#define OS_COMPILER_LOCATION_LEFT 0
/* Option to supply more info to viewer */
#define OS_SUPPORT_SYSSTACK_INFO (1)
/*
Options, to be selected by defining or not defining
*/
#define __ExpandEnterRegion__
/* #define __ExpandLeaveRegion__ */
#define __ExpandGetMsgCnt__
#define RTOS_ACTIVATION_DOES_NOT_RESTORE
/*
**************************************
* *
* Configuration switches *
* *
**************************************
The following are configuration switches. These switches can
be changed if necessary in order to optimize the RTOS for
your application if necessary. Please note that this requires
recompilation of the libraries !!!
(The source code of the OS is needed).
Not all available switches are listed here, as for switches
which are not defined the default value is used.
*/
#define OS_SUPPORT_TIMEOUT 1
/********************************************************
*
* Interrupt specifics F16LX
*
*********************************************************
*/
/*
Special Int stack switching is not needed with F16
*/
#define OS_EnterIntStack()
#define OS_LeaveIntStack()
/* F16LX does not disable interrupts, when ISR is entered.
Per default, interrupts are not nestable, when using embOS
Therefore we disable interrupts when ISR is entered.
*/
#define OS_EnterInterrupt() { \
OS_DI(); \
OS_MARK_IN_ISR(); \
OS_RegionCnt++; \
OS_DICnt++; \
}
#define OS_EnterNestableInterrupt() { \
OS_DI(); \
OS_MARK_IN_ISR(); \
OS_RegionCnt++; \
OS_EI(); \
}
/* Leave Interrupt also disables interrupts prior changing
* OS variables. This is done, to be on the safe side
*/
#define OS_LeaveInterrupt() { \
OS_DI(); \
OS_MARK_OUTOF_ISR(); \
OS_DICnt--; \
if (!--OS_RegionCnt) { \
if (OS_Pending) { \
OS_SwitchFromInt(); \
} \
} \
}
#define OS_LeaveNestableInterrupt() { \
OS_DI(); \
OS_MARK_OUTOF_ISR(); \
if (!--OS_RegionCnt) { \
if (OS_Pending) { \
OS_SwitchFromInt(); \
} \
} \
}
#define OS_LeaveInterruptNoSwitch() { \
OS_DI(); \
OS_MARK_OUTOF_ISR(); \
OS_DICnt--; \
OS_RegionCnt--; \
}
#define OS_LeaveNestableInterruptNoSwitch() { \
OS_DI(); \
OS_MARK_OUTOF_ISR(); \
OS_RegionCnt--; \
}
/*************** End of OSChip.h ***********************/
/********************************************************************
*
* Generic portion of embOS starts here
*
*********************************************************************
This file (original name OS_RAW.h) is part of RTOS.h, the include
file for embOS.
*/
#define __EMBOS__ 1 /* Make it possible for application to find out */
#define EMBOS 1 /* that embOS is compiled and linked */
#define OS_VERSION (30606)
/*********************************************************************
*
* Defines for library types
*
**********************************************************************
*/
#if defined(OS_LIBMODE_R)
#define OS_CHECKSTACK 0
#define OS_DEBUG 0
#define OS_PROFILE 0
#define OS_SUPPORT_TICKSTEP 0
#define OS_TRACE 0
#define OS_CreateTask OS_CreateTask_R
#define OS_LIBMODE "R"
#elif defined(OS_LIBMODE_RP) /* Not normally generated */
#define OS_CHECKSTACK 0
#define OS_DEBUG 0
#define OS_PROFILE 1
#define OS_SUPPORT_TICKSTEP 1
#define OS_TRACE 0
#define OS_CreateTask OS_CreateTask_RP
#define OS_LIBMODE "RP"
#elif defined(OS_LIBMODE_S)
#define OS_CHECKSTACK 1
#define OS_DEBUG 0
#define OS_PROFILE 0
#define OS_SUPPORT_TICKSTEP 0
#define OS_TRACE 0
#define OS_CreateTask OS_CreateTask_S
#define OS_LIBMODE "S"
#elif defined(OS_LIBMODE_SP)
#define OS_PROFILE 1
#define OS_CHECKSTACK 1
#define OS_DEBUG 0
#define OS_SUPPORT_TICKSTEP 1
#define OS_TRACE 0
#define OS_CreateTask OS_CreateTask_SP
#define OS_LIBMODE "SP"
#elif defined(OS_LIBMODE_D)
#define OS_PROFILE 0
#define OS_CHECKSTACK 1
#define OS_DEBUG 1
#define OS_SUPPORT_TICKSTEP 1
#define OS_TRACE 0
#define OS_CreateTask OS_CreateTask_D
#define OS_LIBMODE "D"
#elif defined(OS_LIBMODE_DP)
#define OS_PROFILE 1
#define OS_CHECKSTACK 1
#define OS_DEBUG 1
#define OS_SUPPORT_TICKSTEP 1
#define OS_TRACE 0
#define OS_CreateTask OS_CreateTask_DP
#define OS_LIBMODE "DP"
#elif defined(OS_LIBMODE_ST)
#define OS_CHECKSTACK 1
#define OS_DEBUG 0
#define OS_PROFILE 1
#define OS_SUPPORT_TICKSTEP 1
#define OS_TRACE 1
#define OS_CreateTask OS_CreateTask_ST
#define OS_LIBMODE "ST"
#elif defined(OS_LIBMODE_DT)
#define OS_CHECKSTACK 1
#define OS_DEBUG 1
#define OS_PROFILE 1
#define OS_SUPPORT_TICKSTEP 1
#define OS_TRACE 1
#define OS_CreateTask OS_CreateTask_DT
#define OS_LIBMODE "DT"
#elif defined(OS_LIBMODE_T)
#error This libmode has been renamed. T -> DT
#else
#error Please define library type used !
#endif
/*
****************************************************
* *
* OS Compile time switches *
* *
****************************************************
These compile time switches can be modified when recompiling
the library. Usually, the values are in OSCHIP.H, which is then
merged with OS_RAW.H to form RTOS.H.
If the values are not defined in OSCHIP.H, the default values
below are used.
*/
/* Make it possible to place const data in RAM via
define and therefor via command line. This is required
for some smaller CPUs in small memory models
It is defined to be "const" by default, but can be defined to nothing
by simply adding a -DOS_CONST_DATA on the commandline
*/
#ifndef OS_CONST_DATA
#define OS_CONST_DATA const /* Default */
#else
#undef OS_CONST_DATA
#define OS_CONST_DATA /* define blank */
#endif
#ifndef OS_MODEL
#define OS_MODEL ""
#endif
#ifndef OS_MEMSET
#define OS_MEMSET(a,v,s) memset(a,v,s)
#endif
#ifndef OS_DUMMY_STATEMENT
#define OS_DUMMY_STATEMENT()
#endif
#ifndef OS_USEPARA
#define OS_USEPARA(para) para=para
#endif
#ifndef OS_SUPPORT_TICKSTEP
#define OS_SUPPORT_TICKSTEP 0
#endif
#ifndef OS_SUPPORT_TIMEOUT
#define OS_SUPPORT_TIMEOUT 1
#endif
#ifndef OS_SUPPORT_DIAG
#ifdef __OS_SUPPORT_DIAG__
#define OS_SUPPORT_DIAG 1
#else
#define OS_SUPPORT_DIAG 0
#endif
#endif
#ifndef OS_TRACKNAME
#define OS_TRACKNAME (1)
#endif
#ifndef OS_TRACE
#define OS_TRACE (0)
#endif
#ifndef __OS_RRSUPPORTED__
#define __OS_RRSUPPORTED__ (1)
#endif
#ifndef __OS_CREATETASK0__
#define __OS_CREATETASK0__
#endif
#ifndef __OS_STACK_AT_BOTTOM__
#define __OS_STACK_AT_BOTTOM__ (0)
#endif
#ifndef __OS_STACK_BOTTOM_USED
#define __OS_STACK_BOTTOM_USED (0)
#endif
/* Settings for NON-ANSI compiler syntax
The default behaviour complies with IAR.
*/
#ifndef OS_COMPILER_LOCATION_LEFT
#define OS_COMPILER_LOCATION_LEFT 1 /* (req. for IAR) */
#endif
/*********************************************************************
*
* Config switch checking
*
**********************************************************************
*/
/* Not required. */
/*********************************************************************
*
* Define basic types
*
**********************************************************************
*/
#ifndef OS_I8
#define OS_I8 signed char
#endif
#ifndef OS_U8
#define OS_U8 unsigned char
#endif
#ifndef OS_I16
#define OS_I16 signed short
#endif
#ifndef OS_U16
#define OS_U16 unsigned short
#endif
#ifndef OS_I32
#define OS_I32 long
#endif
#ifndef OS_U32
#define OS_U32 unsigned OS_I32
#endif
/* Defines a true integer. This type is guaranteed
a) to have at least 8 bits,
b) to compile and execute best on the target CPU
It will normally be the same as an int, but on most
8-bit CPUs it will be replaced by a character because
the CPU can deal with 8 bits more efficient than with
16 bit integers.
Use with care !
*/
#ifndef OS_INT
#define OS_INT int
#endif
#ifndef OS_UINT
#define OS_UINT unsigned OS_INT
#endif
/*********************************************************************
*
* Error codes
*
**********************************************************************
*/
/* stack overflow or invalid stack */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -