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

📄 os_cpu_a.lst

📁 这是一个UCOS的AVR移植程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
   1               	# 1 "os_cpu_a.asm"
   2               	# 1 "<built-in>"
   1               	;**************************************************************************************************
   0               	
   0               	
   2               	;                                               uC/OS-II
   3               	;                                         The Real-Time Kernel
   4               	;
   5               	;                                          AVR Specific code
   6               	;                                           (AVR-GCC 3.x)
   7               	;
   8               	;
   9               	; File         : OS_CPU_A.ASM
  10               	; By           : Ole Saether
  11               	; Port Version : V1.01
  12               	;
  13               	; AVR-GCC port version : 1.0 	2001-04-02 modified/ported to avr-gcc by Jesper Hansen (jesperh@telia
  14               	;
  15               	; Modifications by Julius Luukko 2003-02-19 (Julius.Luukko@lut.fi):
  16               	;
  17               	; - Minor modification to OSTickISR's declaration to global and addition of #include <avr/io.h> 
  18               	;   in order to work with gcc 3.3.
  19               	; - Moved 'sei' from the beginning of OSTickISR after the increasing of OSIntNesting (as the book s
  20               	; - Changed the order of reloading the timer counter and calling of OSIntExit
  21               	; - Changed OSIntCtxSw to the way it is supposed to be with OS_VERSION >= 251
  22               	; - Changed OSTickISR so that is saves the stack pointer into the current task's OS_TCB if OSTickIS
  23               	;   first level ISR
  24               	; - os_cfg.h must be included (definitions of CPU_CLOCK_HZ and OS_TICKS_PER_SEC)
  25               	; - avr/io.h is included to get SIG_OVERFLOW0 to produce the code to the interrupt vector table
  26               	;
  27               	; Modifications by Julius Luukko 2003-03-06 (Julius.Luukko@lut.fi):
  28               	;
  29               	; - RAMPZ is also saved to the stack
  30               	;
  31               	; Modifications by Julius Luukko 2003-03-18 (Julius.Luukko@lut.fi):
  32               	;
  33               	; - RAMPZ and SREG were popped out of the stack in the wrong order! Corrected this.
  34               	; - Divided macros PUSHRS and POPRS into to macros PUSHRS, PUSHSREG, POPRS and POPSREG. Additionall
  35               	; in ISRs macro called PUSHSREGISR must be used. It sets the I bit i SREG, since its always unset, 
  36               	; ISR is entered. It must be, however, set to enable interrupts when the task is run again.
  37               	; - RCALLs changed to CALLs. This allows the code of called functions to be further away from the c
  38               	;   (fixes the "relocating truncated to fit" error from the linker)
  39               	; 
  40               	;
  41               	; Modifications by Julius Luukko 2003-03-19 (Julius.Luukko@lut.fi):
  42               	;
  43               	; - timer interrupt is changed so that the timer counter register is updated right after _not_first
  44               	;   (was AFTER the call to OSIntExit!!)
  45               	;
  46               	; Modifications by Julius Luukko 2003-06-24 (Julius.Luukko@lut.fi):
  47               	;
  48               	; - I/O port addressing is now done using the macro _SFR_IO_ADDR from avr-libc and the address
  49               	; definitions are removed from here
  50               	; - RAMPZ is pushed and popped only if it is defined, i.e. with chips that have it
  51               	;
  52               	; Modifications by Julius Luukko 2003-07-21 (Julius.Luukko@lut.fi) for V2.70
  53               	;
  54               	; - OSTaskSwHook is not called if OS_TASK_SW_HOOK_EN == 0
  55               	; - defines typedef to ; so that os_cfg_r.h can be used more easily as a starting point for
  56               	;   the application specific os_cfg.h
  57               	;
  58               	;**************************************************************************************************
  59               	
  60               	;**************************************************************************************************
  61               	;                                      C PREPROCESSOR DIRECTIVES
  62               	;**************************************************************************************************
  63               	
  64               	#include <avr/io.h>
   1               	/* Copyright (c) 2002,2003 Marek Michalkiewicz, Joerg Wunsch
   2               	   All rights reserved.
   3               	
   4               	   Redistribution and use in source and binary forms, with or without
   5               	   modification, are permitted provided that the following conditions are met:
   6               	
   7               	   * Redistributions of source code must retain the above copyright
   8               	     notice, this list of conditions and the following disclaimer.
   9               	
  10               	   * Redistributions in binary form must reproduce the above copyright
  11               	     notice, this list of conditions and the following disclaimer in
  12               	     the documentation and/or other materials provided with the
  13               	     distribution.
  14               	
  15               	   * Neither the name of the copyright holders nor the names of
  16               	     contributors may be used to endorse or promote products derived
  17               	     from this software without specific prior written permission.
  18               	
  19               	  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  20               	  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21               	  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22               	  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  23               	  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  24               	  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  25               	  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26               	  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  27               	  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28               	  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  29               	  POSSIBILITY OF SUCH DAMAGE. */
  30               	
  31               	/* $Id: io.h,v 1.14 2004/11/24 18:57:36 troth Exp $ */
  32               	
  33               	/** \defgroup avr_io AVR device-specific IO definitions
  34               	    \code #include <avr/io.h> \endcode
  35               	
  36               	    This header file includes the apropriate IO definitions for the
  37               	    device that has been specified by the <tt>-mmcu=</tt> compiler
  38               	    command-line switch.  This is done by diverting to the appropriate
  39               	    file <tt>&lt;avr/io</tt><em>XXXX</em><tt>.h&gt;</tt> which should
  40               	    never be included directly.  Some register names common to all
  41               	    AVR devices are defined directly within <tt>&lt;avr/io.h&gt;</tt>,
  42               	    but most of the details come from the respective include file.
  43               	
  44               	    Note that this file always includes
  45               	    \code #include <avr/sfr_defs.h> \endcode
  46               	    See \ref avr_sfr for the details.
  47               	
  48               	    Included are definitions of the IO register set and their
  49               	    respective bit values as specified in the Atmel documentation.
  50               	    Note that Atmel is not very consistent in its naming conventions,
  51               	    so even identical functions sometimes get different names on
  52               	    different devices.
  53               	
  54               	    Also included are the specific names useable for interrupt
  55               	    function definitions as documented
  56               	    \ref avr_signames "here".
  57               	
  58               	    Finally, the following macros are defined:
  59               	
  60               	    - \b RAMEND
  61               	    <br>
  62               	    A constant describing the last on-chip RAM location.
  63               	    <br>
  64               	    - \b XRAMEND
  65               	    <br>
  66               	    A constant describing the last possible location in RAM.
  67               	    This is equal to RAMEND for devices that do not allow for
  68               	    external RAM.
  69               	    <br>
  70               	    - \b E2END
  71               	    <br>
  72               	    A constant describing the address of the last EEPROM cell.
  73               	    <br>
  74               	    - \b FLASHEND
  75               	    <br>
  76               	    A constant describing the last byte address in flash ROM.
  77               	    <br>
  78               	    - \b SPM_PAGESIZE
  79               	    <br>
  80               	    For devices with bootloader support, the flash pagesize
  81               	    (in bytes) to be used for the \c SPM instruction. */
  82               	
  83               	#ifndef _AVR_IO_H_
  84               	#define _AVR_IO_H_
  85               	
  86               	#include <avr/sfr_defs.h>
   1               	/* Copyright (c) 2002, Marek Michalkiewicz <marekm@amelek.gda.pl>
   2               	   All rights reserved.
   3               	
   4               	   Redistribution and use in source and binary forms, with or without
   5               	   modification, are permitted provided that the following conditions are met:
   6               	
   7               	   * Redistributions of source code must retain the above copyright
   8               	     notice, this list of conditions and the following disclaimer.
   9               	
  10               	   * Redistributions in binary form must reproduce the above copyright
  11               	     notice, this list of conditions and the following disclaimer in
  12               	     the documentation and/or other materials provided with the
  13               	     distribution.
  14               	
  15               	   * Neither the name of the copyright holders nor the names of
  16               	     contributors may be used to endorse or promote products derived
  17               	     from this software without specific prior written permission.
  18               	
  19               	   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  20               	   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21               	   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22               	   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  23               	   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  24               	   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  25               	   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26               	   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  27               	   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28               	   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  29               	   POSSIBILITY OF SUCH DAMAGE.  */
  30               	
  31               	/* avr/sfr_defs.h - macros for accessing AVR special function registers */
  32               	
  33               	/* $Id: sfr_defs.h,v 1.14.2.1 2005/01/07 19:25:25 arcanum Exp $ */
  34               	
  35               	#ifndef _AVR_SFR_DEFS_H_
  36               	#define _AVR_SFR_DEFS_H_ 1
  37               	
  38               	/** \defgroup avr_sfr_notes Additional notes from <avr/sfr_defs.h>
  39               	    \ingroup avr_sfr
  40               	
  41               	   The \c <avr/sfr_defs.h> file is included by all of the \c <avr/ioXXXX.h>
  42               	   files, which use macros defined here to make the special function register
  43               	   definitions look like C variables or simple constants, depending on the
  44               	   <tt>_SFR_ASM_COMPAT</tt> define.  Some examples from \c <avr/iom128.h> to
  45               	   show how to define such macros:
  46               	
  47               	\code
  48               	#define PORTA _SFR_IO8(0x1b)
  49               	#define TCNT1 _SFR_IO16(0x2c)
  50               	#define PORTF _SFR_MEM8(0x61)
  51               	#define TCNT3 _SFR_MEM16(0x88)
  52               	\endcode
  53               	
  54               	   If \c _SFR_ASM_COMPAT is not defined, C programs can use names like
  55               	   <tt>PORTA</tt> directly in C expressions (also on the left side of
  56               	   assignment operators) and GCC will do the right thing (use short I/O
  57               	   instructions if possible).  The \c __SFR_OFFSET definition is not used in
  58               	   any way in this case.
  59               	
  60               	   Define \c _SFR_ASM_COMPAT as 1 to make these names work as simple constants
  61               	   (addresses of the I/O registers).  This is necessary when included in
  62               	   preprocessed assembler (*.S) source files, so it is done automatically if
  63               	   \c __ASSEMBLER__ is defined.  By default, all addresses are defined as if
  64               	   they were memory addresses (used in \c lds/sts instructions).  To use these
  65               	   addresses in \c in/out instructions, you must subtract 0x20 from them.
  66               	
  67               	   For more backwards compatibility, insert the following at the start of your
  68               	   old assembler source file:
  69               	
  70               	\code
  71               	#define __SFR_OFFSET 0
  72               	\endcode
  73               	
  74               	   This automatically subtracts 0x20 from I/O space addresses, but it's a
  75               	   hack, so it is recommended to change your source: wrap such addresses in
  76               	   macros defined here, as shown below.  After this is done, the
  77               	   <tt>__SFR_OFFSET</tt> definition is no longer necessary and can be removed.
  78               	
  79               	   Real example - this code could be used in a boot loader that is portable
  80               	   between devices with \c SPMCR at different addresses.
  81               	
  82               	\verbatim
  83               	<avr/iom163.h>: #define SPMCR _SFR_IO8(0x37)
  84               	<avr/iom128.h>: #define SPMCR _SFR_MEM8(0x68)

⌨️ 快捷键说明

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