📄 os_cpu.h
字号:
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
* All Rights Reserved
*
* Texas Instruments TMS320C40 Specific Code
* SMALL MEMORY MODEL
*
* File : OS_CPU.H
* By : Jean J. Labrosse
* Modified by: Ran Cabell
*********************************************************************************************************
*/
#ifdef OS_CPU_GLOBALS
#define OS_CPU_EXT
#else
#define OS_CPU_EXT extern
#endif
/*
*********************************************************************************************************
* DATA TYPES
* (Compiler Specific)
* NOTE: On TMS320C40 sizeof(char) == sizeof(int) == sizeof(long) == 32 bits,
* so C40 bytes and words are equivalent (32 bits).
* As a result, the following type distinctions have little significance on the C40.
*********************************************************************************************************
*/
typedef unsigned char BOOLEAN;
typedef unsigned char INT8U; /* Unsigned 8 bit quantity */
typedef signed char INT8S; /* Signed 8 bit quantity */
typedef unsigned int INT16U; /* Unsigned 16 bit quantity */
typedef signed int INT16S; /* Signed 16 bit quantity */
typedef unsigned long INT32U; /* Unsigned 32 bit quantity */
typedef signed long 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 32-bits wide */
#define BYTE INT8S /* Define data types for backward compatibility ... */
#define UBYTE INT8U /* ... to uC/OS V1.xx. Not actually needed for ... */
#define WORD INT16S /* ... uC/OS-II. */
#define UWORD INT16U
#define LONG INT32S
#define ULONG INT32U
/*
*********************************************************************************************************
* Texas Instruments TMS320C40 Small Memory Model
*
* Method #1: Disable/Enable interrupts using simple instructions. After critical section, interrupts
* will be enabled even if they were disabled before entering the critical section.
* If this method is used, the first line in OSIntCtxSw must read "SUBI 3, SP"
*
* Method #2: Disable/Enable interrupts by preserving the state of interrupts. In other words, if
* interrupts were disabled before entering the critical section, they will be disabled when
* leaving the critical section.
* If this method is used, the first line in OSIntCtxSw must read "SUBI 4, SP"
*********************************************************************************************************
*/
#define OS_CRITICAL_METHOD 2
#if OS_CRITICAL_METHOD == 1
#define OS_ENTER_CRITICAL() asm(" ANDN 2000H, ST ; Disable GIE") /* Disable interrupts */
#define OS_EXIT_CRITICAL() asm(" OR 2000H, ST ; Enable GIE") /* Enable interrupts */
#endif
#if OS_CRITICAL_METHOD == 2
#define OS_ENTER_CRITICAL() asm(" PUSH ST"); \
asm(" ANDN 2000H, ST");
#define OS_EXIT_CRITICAL() asm(" POP ST")
#endif
/*
*********************************************************************************************************
* C40 Miscellaneous
*********************************************************************************************************
*/
#define OS_STK_GROWTH 0 /* Stack grows from LOW to HIGH memory on TIC40 */
#define uCOS 0x07 /* Interrupt vector # used for context switch */
#define OS_TASK_SW() asm(" TRAP 7H ; Context switch")
/*
*********************************************************************************************************
* GLOBAL VARIABLES
*********************************************************************************************************
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -