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

📄 os_cpu.h

📁 我移植的uCos 2.86 版本,可以在单片51上运行,在AT89C51ED2上测试过.
💻 H
字号:
/*
*********************************************************************************************************
*                                               uC/OS-II
*                                         The Real-Time Kernel
*
*                               (c) Copyright 2006, Micrium, Weston, FL
*                                          All Rights Reserved
*
*                                            PIC24 MPLab Port
*                                                 
*
* File         : os_cpu.h
* By           : Eric Shufro
* Port Version : V2.81 (and higher)
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                           INCLUDES
*********************************************************************************************************
*/

#ifndef __OS_CPU_H
#define __OS_CPU_H

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

//#include <p24FJ128GA010.h>

/*
*********************************************************************************************************
*                                          PROTOTYPES
*********************************************************************************************************
*/

void  OSCtxSw(void) ;
void  OSIntCtxSw(void) ;
void  OSStartHighRdy(void) ;

/*
*********************************************************************************************************
*                                   APPLICATION INDEPENDENT DATA TYPES
*
* Notes : These data types are chosen based upon the C30 compiler datatype specifications
*********************************************************************************************************
*/

typedef unsigned char     BOOLEAN;
//typedef bit     		  BOOLEAN;
typedef unsigned char     INT8U;
typedef signed char       INT8S;
typedef unsigned int      INT16U;
typedef signed int        INT16S;
typedef unsigned long     INT32U;
typedef signed long       INT32S;
typedef float             FP32;
typedef long double       FP64;

/*
*********************************************************************************************************
*                                         OTHER DATA TYPES
*********************************************************************************************************
*/
//#define OS_STK 	INT16U XDAT
typedef XDAT INT16U            OS_STK;                               /* Define the size of each stack entry            */
typedef INT16U            OS_CPU_SR;                             /* Define the size of CPU status register         */

/*
*********************************************************************************************************
*                                         PROCESSOR SPECIFICS
*********************************************************************************************************
*/

#define  OS_CRITICAL_METHOD    1 
                                  /* Use type 3 critical sections                   */
#define  OS_STK_GROWTH        0                     		/* Stack grows from HIGH to LOW memory on for large mode */

#define OS_TASK_SW()        OSCtxSw()//{__asm__ volatile("call _OSCtxSw");} /* Macro for defining a high level context switch */

#if OS_CRITICAL_METHOD == 1
                                   /* Support critical method type 1                 */
#define  OS_ENTER_CRITICAL()  EA=0		    				/* Disable interrupts                            */
#define  OS_EXIT_CRITICAL()   EA=1			 				/* Enable  interrupts                            */
#endif

#if      OS_CRITICAL_METHOD == 2
/* As an undocumented keyword of keil c. __asm is supported in Keil C v6.20.
. No other means to define assemble language code in a macro, I have to use it here. If your compiler does not support __asm, use method 1 or 3 then. */
/* A2 AF MOV C, EA*/
/* C2 AF CLR EA   */
/* C0 D0 PUSH PSW */
#define  OS_ENTER_CRITICAL()    __asm DB 0A2H, 0AFH, 0C2H, 0AFH, 0C0H, 0D0H

/* D0 D0 POP PSW   */
/* 92 AF MOV EA, C */
#define  OS_EXIT_CRITICAL()     __asm DB 0D0H, 0D0H, 092H, 0AFH
#endif

#if      OS_CRITICAL_METHOD == 3
#define  OS_ENTER_CRITICAL()  (cpu_sr = EA, EA=0)    /* Disable interrupts                        */
#define  OS_EXIT_CRITICAL()   (EA = cpu_sr)    /* Enable  interrupts                        */
#endif

#define OS_ISR_PROTO_EXT	1

#endif


⌨️ 快捷键说明

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