⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_cpu.h

📁 If you port &micro C/OS-II to a processor not listed and want to include your port on this web site,
💻 H
字号:
/*
*********************************************************************************************************
*                                               uC/OS-II
*                                        The Real-Time Kernel
*
*                        (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
*                                          All Rights Reserved
*
*                                          V850 Specific code
*                                      NORMAL MEMORY MODEL (Code <2MB)
*
* File : OS_CPU.H
* By   : Jean J. Labrosse
*********************************************************************************************************
*/
/*
*********************************************************************************************************
Company         :  NEC Elecronics GmbH
Title           :  OS CPU Header MODULE
Description     :  RTOS kernel (hardware-specific) functions
File            :  OS_CPU_A.asm
Type            :  compiler Green Hills
Library         :

Author          :  Lorenzo Altieri  AltieriL@ee.nec.de
Comments        :


Revisions       :
Version         : (Version) (dd/mm/yy) changes
               x.xx    ddmmyy                  Create file
               0.01                    09/03/2004
*********************************************************************************************************
*/

#ifdef  OS_CPU_GLOBALS
#define OS_CPU_EXT
#else
#define OS_CPU_EXT  extern
#endif

/*
*********************************************************************************************************
*                                              DATA TYPES
*                                         (Compiler Specific)
*********************************************************************************************************
*/
#ifndef  OS_CPU_MY_DATA
#define OS_CPU_MY_DATA

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 unsigned long  LONG32U;                  /* Unsigned 32 bit quantity                           */
typedef signed   long  LONG32S;                  /* 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-bit wide                    */

typedef volatile unsigned long  OS_CPU_SR;

#define BYTE           INT8S                     /* Define data types for backward compatibility ...   */
#define UBYTE          INT8U                     /* ... to uC/OS V1.xx.  Not actually needed for ...   */
#define WORDS          INT16S                    /* ... uC/OS-II.                                      */
#define UWORDS         INT16U
#define WORD           INT32S                    /* ... uC/OS-II.                                      */
#define UWORD          INT32U
#define LONG           INT32S
#define ULONG          INT32U

#endif

/*
*********************************************************************************************************
*                              NEC V850ES   port
*
* 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.  You MUST
*             change the constant in OS_CPU_A.ASM, function OSIntCtxSw() from 10 to 8.
*
* 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.  You MUST change the constant in OS_CPU_A.ASM, function
*             OSIntCtxSw() from 8 to 10.
*
* Method #3:  Save SR in local function register. Only this method works reliably for now.
*********************************************************************************************************
*/
#define  OS_CRITICAL_METHOD    1                       /* The other two methods appear to have trouble! */

#if      OS_CRITICAL_METHOD == 1
#define  OS_ENTER_CRITICAL()            DI()                /* Disable interrupts                            */
#define  OS_EXIT_CRITICAL()             EI()                /* Enable  interrupts                            */
#endif

#if      OS_CRITICAL_METHOD == 2 /* Minimum pointer movement is 2 bytes */
#define  OS_ENTER_CRITICAL()  asm("prepare {r22}, 0"); asm("stsr PSW, r22"); asm("di");  /* Disable interrupts */
#define  OS_EXIT_CRITICAL()   asm("ldsr r22, PSW"); asm("dispose 0, {r22}");             /* Enable  interrupts */
#endif


#if OS_CRITICAL_METHOD == 3
#include    "Inc\df3239.h"
#include    "Inc\type.h"
#include    "Inc\df3239extIO.h"
#define  OS_ENTER_CRITICAL()   cpu_sr=__get_processor_register(Reg_PSW);__DI(); /* Disable interrupts */
#define  OS_EXIT_CRITICAL()    __set_processor_register(Reg_PSW,cpu_sr)         /* Enable  interrupts */

#endif


/*
*********************************************************************************************************
*                           Miscellaneous
*********************************************************************************************************
*/

#define  OS_STK_GROWTH        1                       /* Stack grows from HIGH to LOW memory */
#define  OS_TASK_SW()         asm("trap   0x10")      /* Interrupt vector # used for context switch    */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -