?? os_cpu.h
字號:
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 1992-2001, Jean J. Labrosse, Weston, FL
* All Rights Reserved
*
* uC/OS-II Configuration File for V2.51
*
* File : OS_CPU.H
* By : Jean J. Labrosse
* Ported by : Farid LEZIAR (fleziar@yahoo.fr)
* version : 2.0
*
*
* This port is free. you can use it, redistribute it
* and/or modify it under the following terms:
*
* 1. You are not allowed to remove or modify this copyright notice
* and License paragraphs, even if parts of the software is used.
* 2. The improvements and/or extentions you make must be available
* for the community under THIS license, source code included.
* 4. You may NOT distribute this software under another license without
* explicit permission from farid LEZIAR (fleziar@yahoo.fr).
* 5. This software is free, and distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY.
* 6. Tou have you inform me whenever you use this software.
*
*********************************************************************************************************
*/
#ifdef OS_CPU_GLOBALS
#define OS_CPU_EXT
#else
#define OS_CPU_EXT extern
#endif
/*
*********************************************************************************************************
* DATA TYPES FOR NIOS 16/32 bits
* (Compiler Specific)
*********************************************************************************************************
*/
typedef unsigned char BOOLEAN; /* Unsigned 8 bit */
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 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 long OS_STK; /* Each stack entry is 32-bit wide */
typedef unsigned short OS_CPU_SR; /* Define size of CPU status register (16 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
/*
*********************************************************************************************************
*
*
* 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.
*
* 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.
*
* Method #3: Disable/Enable interrupts by preserving the state of interrupts. Generally speaking you
* would store the state of the interrupt disable flag in the local variable 'cpu_sr' and then
* disable interrupts. 'cpu_sr' is allocated in all of uC/OS-II's functions that need to
* disable interrupts. You would restore the interrupt disable state by copying back 'cpu_sr'
* into the CPU's status register.
*********************************************************************************************************
*/
#define OS_CRITICAL_METHOD 1
#if OS_CRITICAL_METHOD == 1
#define OS_ENTER_CRITICAL() asm("PFX 8 \n WRCTL %g0;") /* Disable interrupts */
#define OS_EXIT_CRITICAL() asm("PFX 9 \n WRCTL %g0;") /* Enable interrupts */
#endif
#if OS_CRITICAL_METHOD == 2
#define OS_ENTER_CRITICAL() /* Disable interrupts */
#define OS_EXIT_CRITICAL() /* Enable interrupts */
#endif
#if OS_CRITICAL_METHOD == 3
#define OS_ENTER_CRITICAL() cpu_sr = getITStatus() /* Disable interrupts */
#define OS_EXIT_CRITICAL() setITStatus(cpu_sr) /* Enable interrupts */
#endif
/*
*********************************************************************************************************
* NIOS 32bits
*********************************************************************************************************
*/
#define OS_STK_GROWTH 1 /* Stack grows from HIGH to LOW memory on NIOS */
#define OS_TASK_SW() asm("TRAP 21"); /* Depends on Design : between 16-63 */
/* 21 is the first parameter of OSNiosInitContextSwitch (see OSNios.h) */
/*
*********************************************************************************************************
* GLOBAL VARIABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* PROTOTYPES
*********************************************************************************************************
*/
INT32U getStatus(); /* implemented in OS_CPU_A*.S */
INT32U getFP(); /* implemented in OS_CPU_A*.S */
INT32U getSP(); /* implemented in OS_CPU_A*.S */
INT32U getReg(); /* implemented in OS_CPU_A*.S */
OS_CPU_SR getITStatus(); /* implemented in OS_CPU_A*.S */
void setITStatus(OS_CPU_SR status); /* implemented in OS_CPU_A*.S */
INT16U getHILIMIT(); /* implemented in OS_CPU_A*.S */
INT16U getIPRI(); /* implemented in OS_CPU_A*.S */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -