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

📄 os_cpu.h

📁 ucos_ii 在Z80系列单片机上的移植
💻 H
字号:
/*
*********************************************************************************************************
*                                               uC/OS-II
*                                        The Real-Time Kernel
*
*                          (c) Copyright 1992-2000, Jean J. Labrosse, Weston, FL
*                                          All Rights Reserved
*
*                                           eZ80-Specific code
*
* File    : OS_CPU.H
* By      : Jean J. Labrosse
* Revised      : Douglas Beattie Jr., ICONIX Research (30-MAY-2003)
* Port Version : v1.00 (for uC/OS-II V2.52 or higher)
* By      : Douglas Beattie Jr. <beattidp@ieee.org>
* Version : V1.00
*********************************************************************************************************
*/

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

/*
*********************************************************************************************************
*                                              DATA TYPES
*                                         (Compiler Specific)
*********************************************************************************************************
*/
/*  ZDS-II eZ80 C compiler object sizes (for reference) are:
  char 8 bits
  short 16 bits
  int 24 bits  <<=== Note, 24-bit integers!
  long 32 bits
  float 32 bits
  double 32 bits
  long double 32 bits
*/


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   INT24U;                   /* Unsigned 24-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                    */
/* 64-bit? no such thing! */

typedef unsigned int   OS_STK;                   /* Each stack entry is 24 bits wide                   */
/* typedef unsigned long OS_CPU_SR */  /* not used unless Critical Method #3 */

#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


/* 
*********************************************************************************************************
*                                          Z382-Specific code
*                                                
*                                        CRITICAL SECTION CONTROL
*
* 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.
*********************************************************************************************************
*/
#define  OS_CRITICAL_METHOD    1

#if      OS_CRITICAL_METHOD == 1
#define  OS_ENTER_CRITICAL()  asm(" DI"); /* disable_interrupt() */
#define  OS_EXIT_CRITICAL()   asm(" EI"); /* enable_interrupt() */
#endif

#if      OS_CRITICAL_METHOD == 2
#define  OS_ENTER_CRITICAL() \
               asm(" PUSH SR"); \
               asm(" DI");

#define  OS_EXIT_CRITICAL()  \
               asm(" POP SR");
#endif




/*
*********************************************************************************************************
*                                          Z382-Specific code
*                                                
*                                              MISCELLANEOUS
*********************************************************************************************************
*/

//#define  RST_00H              0xC7                    /* Restart instructions                          */
//#define  RST_08H              0xCF
//#define  RST_10H              0xD7
//#define  RST_18H              0xDF
//#define  RST_20H              0xE7
//#define  RST_28H              0xEF
//#define  RST_30H              0xF7
//#define  RST_38H              0xFF


#define  OS_STK_GROWTH        1                       /* Stack grows from HIGH to LOW memory on Z-180  */

#define  OS_TASK_SW() \
         asm(" .EXTERN _OSCtxSw"); \
         asm(" CALL _OSCtxSw");//_asm(" RST 20h"); /* _opc(RST_20H) Execute a RESTART instruction*/


⌨️ 快捷键说明

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