www.pudn.com > ShfuCOS.rar > OS_CPU.H
/* ********************************************************************************************************* * uC/OS-II * The Real-Time Kernel * * (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL * All Rights Reserved * (c) Copyright ARM Limited 1999. All rights reserved. * * ARM Specific code * * File : OS_CPU.H ********************************************************************************************************* */ #ifndef __OS_CPU_H__ #define __OS_CPU_H__ #include "..\inc\44b.h" #include "..\inc\44blib.h" #ifdef OS_CPU_GLOBALS #define OS_CPU_EXT #else #define OS_CPU_EXT extern #endif /* ********************************************************************************************************* * DATA TYPES * (Compiler Specific) ********************************************************************************************************* */ 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 */ typedef unsigned int OS_CPU_SR; /* 定义CPU 状态寄存器数据宽度(PSR = 32 bits)*/ #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 /* ********************************************************************************************************* * ARM, various architectures * ********************************************************************************************************* */ #define OS_CRITICAL_METHOD 2 #if OS_CRITICAL_METHOD == 2 #define OS_ENTER_CRITICAL() ARMDisableInt() #define OS_EXIT_CRITICAL() ARMEnableInt() #endif #if OS_CRITICAL_METHOD == 3 #define OS_ENTER_CRITICAL() (cpu_sr = OSCPUSaveSR()) #define OS_EXIT_CRITICAL() (OSCPURestoreSR(cpu_sr)) #endif #define OS_TASK_SW OSCtxSw /* * Definitions specific to ARM/uHAL */ #define SVC32MODE 0x13 /* stack stuff */ #define OS_STK_GROWTH 1 /* angel takes up stack */ #define SEMIHOSTED_STACK_NEEDS 1024 /* idle task stack size (words) */ #ifdef SEMIHOSTED #define OS_IDLE_STK_SIZE (32+SEMIHOSTED_STACK_NEEDS) #else #define OS_IDLE_STK_SIZE 32 #endif /* defined in os_cpu_a.s */ extern void OSCtxSw(void); // task switch routine extern void OSIntCtxSw(void); // interrupt context switch extern void ARMDisableInt(void); // disable global interrupts extern void ARMEnableInt(void); // enable global interrupts extern void OSTickISR(void); // timer interrupt routine OS_CPU_SR OSCPUSaveSR(void); void OSCPURestoreSR(OS_CPU_SR cpu_sr); #endif