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

📄 porticcavr.h

📁 这是AVR单片机上能跑的嵌入式操作系统salvo
💻 H
字号:
/************************************************************ 
The contents of this file are subject to the Pumpkin Salvo
License (the "License").  You may not use this file except
in compliance with the License. You may obtain a copy of
the License at http://www.pumpkininc.com, or from
warranty@pumpkininc.com.

Software distributed under the License is distributed on an
"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
or implied. See the License for specific language governing
the warranty and the rights and limitations under the
License.

The Original Code is Salvo - The RTOS that runs in tiny
places(TM). Copyright (C) 1995-2002 Pumpkin, Inc. and its
Licensor(s). All Rights Reserved.

$Source: C:\\RCS\\d\\salvo\\inc\\porticcavr.h,v $
$Author: aek $
$Revision: 3.6 $
$Date: 2003-10-16 19:58:05-07 $

Porting file for Atmel AVR and ImageCraft ICCAVR C compiler. 

Using io8515v.h when building avr and atmega libraries is OK, 
as the relevant portions that Salvo references (only _CLI()
and _SEI()) do not change across the entire family.

************************************************************/

#include <macros.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>


/* ICCAVR C compiler uses the AVR's hardware (SP) stack */
/*  for return addresses, and a software (Y) stack      */
/*  directly underneath it for locals, parameters, etc. */
/* ICCAVR uses table lookup for indirect function calls,*/
/*  and therefore tFPs are not real addresses, but TLU	*/
/*  entire. So, we use a mix of the OSDispatch() and    */
/*  label-based context switchers, for full             */
/*  compatibility with Code Compressor.                 */
#define OSCTXSW_METHOD					OSVIA_OSDISPATCH_WLABEL


/* SP is 16 bits                                        */
#define OSBYTES_OF_FRAMEP				2


/* conventional stack-based context-switcher, with the  */
/*  added requirement of a label due to the use of      */
/*  xicall for indirect jumps (to be compatible with    */
/*  Code Compressor.                                    */
#define OS_Yield(label)                 do { OSCtxSw(label); \
                                             asm("_" _OSMkstr(label) "::"); \
                                        } while (0)


/* use ICCAVR's intrinsic functions.                    */
#if !defined(OSDi)
#define OSDi()   						_CLI()            
#endif
#if !defined(OSEi)
#define OSEi()      					_SEI()                    
#endif
  
          
/* ICCAVR supports this keyword, but in a manner that   */
/*  does not allow a simple #pragma monitor in front of */
/*  each monitor function. See salvomcg.h on how this   */
/*  was handled. By defining this (as blank), the code  */
/*  is configured to let ICCAVR handle int disable and  */
/*  restore on monitor functions.                       */
#define	OSMONITOR_KEYWORD_PRE			
#define	OSMONITOR_KEYWORD_PRE_PROTO			

 
/* should work fine. 									*/
#define OSUSE_MEMSET                    TRUE


/* printf() supports p (pointer) format. 				*/
#define OSUSE_PRINTF_P_FORMAT			TRUE


/* Watchdog reset                                       */
#define OSCLEAR_WATCHDOG_TIMER()    	_WDR()

/************************************************************ 
****                                                     ****
**                                                         **
Notes 

1. ICCAVR does not support bitfield packing (i.e. into
unsigned char instead of unsigned int). 

2. OSDispatch() and OSCtxSw() are in porticcavr.s.

**                                                         **
****                                                     ****
************************************************************/

⌨️ 快捷键说明

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