os_cpu.h

来自「支持pic24单片机的uCOSII 使用P24H256GP610」· C头文件 代码 · 共 81 行

H
81
字号
/*
*********************************************************************************************************
*                                               uC/OS-II
*                                         The Real-Time Kernel
*
*                         (c) Copyright 2002, Jean J. Labrosse, Weston, FL
*                                          All Rights Reserved
*
*
*                                          PIC24 MPLab Port
*                                                 
*
* File         : os_cpu.h
* By           : Eric Shufro
* Port Version : V2.81 and higher)
*********************************************************************************************************
*/

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

#include "p24HJ256GP610.h"
             
/*
*********************************************************************************************************
*                                   APPLICATION INDEPENDENT DATA TYPES
*
* Notes : These data types are chosen based upon the C30 compiler datatype specifications
*********************************************************************************************************
*/

typedef unsigned char     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;

/*
*********************************************************************************************************
*                                         OTHER DATA TYPES
*********************************************************************************************************
*/

typedef 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  3                                           /* Use type 3 critical sections                             */
#define OS_STK_GROWTH       0                                           /* Stack grows from low to high memory                      */


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


#define OS_TASK_SW()  {__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() SRbits.IPL = 6                               /* Disable interrupts (all but 7)                           */
#define OS_EXIT_CRITICAL()  SRbits.IPL = 0                               /* Eenable interrupts                                       */
#endif

#if OS_CRITICAL_METHOD == 3                                             /* Support critical method type 3                           */
#define OS_ENTER_CRITICAL() {cpu_sr = SR; SRbits.IPL = 6;}               /* Disable interrupts (all but 7)                           */
#define OS_EXIT_CRITICAL() SR = cpu_sr;                                 /* Eenable interrupts                                       */
#endif

⌨️ 快捷键说明

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