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

📄 tini400_isr.h

📁 基于DS80C400的ADz转换程序
💻 H
字号:
/*---------------------------------------------------------------------------
 *  Copyright (C) 2005 Dallas Semiconductor Corporation, All Rights Reserved.
 * 
 *  Permission is hereby granted, free of charge, to any person obtaining a
 *  copy of this software and associated documentation files (the "Software"),
 *  to deal in the Software without restriction, including without limitation
 *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
 *  and/or sell copies of the Software, and to permit persons to whom the
 *  Software is furnished to do so, subject to the following conditions:
 * 
 *  The above copyright notice and this permission notice shall be included
 *  in all copies or substantial portions of the Software.
 * 
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 *  IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
 *  OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 *  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *  OTHER DEALINGS IN THE SOFTWARE.
 * 
 *  Except as contained in this notice, the name of Dallas Semiconductor
 *  shall not be used except as stated in the Dallas Semiconductor
 *  Branding Policy.
 * ---------------------------------------------------------------------------
 *
 * This file contains function definitions for use in conjunction with the 
 * built-in ROM functions of the Dallas Semiconductor 400 processor.  This 
 * file is intended for use with the Keil MicroVision (uVision) C compiler.
 *
 * ---------------------------------------------------------------------------
 */
#ifndef __tini400_isr_
#define __tini400_isr_

/** \file tini400_isr.h
 *  \brief Interrupt Service Routine installation functions
 *
 *  This library contains functions that allow processes
 *  to install their own ISR's from C programs.  Normally, the Keil
 *  compiler would automatically install interrupts in their
 *  proper locations.  However, the act of initializing the ROM
 *  sets the entire interrupt vector table, so any interrupt vector
 *  that the Keil compiler generates are destroyed.  These functions
 *  allow programs to restore or update their interrupt vector tables.
 *  
 *  To use interrupts written in C with the Keil compiler, functions
 *  should be defined with the <b>interrupt</b> keyword.  Also,
 *  under the Project Target options dialog, under the C51 panel, 
 *  uncheck the box labeled <i>Interrupt Vectors at Address:</i>.
 *  Then make sure to call <i>#isr_setinterruptvector</i> sometime 
 *  after <i>#init_rom</i> has been called.
 *
 *  For detailed information on the DS80C400 please see the
 *  <a href="http://pdfserv.maxim-ic.com/arpdf/Design/DS80C400UG.pdf">
 *  High-Speed Microcontroller User's Guide: DS80C400 Supplement</a>.
 *
 *  The functions in this library are multi-process safe--that is, if 
 *  you call the same method from two different processes at the same 
 *  time, the parameters to the function will not be destroyed.  
 */


/** Version number associated with this header file.  Should be the same as
 * the version number returned by the <i>#isr_version</i> function.
 * \sa isr_version */
#define TINI400_ISR_VERSION         4

/** Interrupt vector number for the <b>External Interrupt 0</b> interrupt.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_EXTERNALINT0            0

/** Interrupt vector number for the <b>Timer 0</b> interrupt.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_TIMER0                  1

/** Interrupt vector number for the <b>External Interrupt 1</b> interrupt.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_EXTERNALINT1            2

/** Interrupt vector number for the <b>Timer 1</b> interrupt.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_TIMER1                  3

/** Interrupt vector number for the <b>Serial Port 0</b> interrupt.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_SERIAL0                 4

/** Interrupt vector number for the <b>Timer 2</b> interrupt.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_TIMER2                  5

/** Interrupt vector number for the <b>Power Fail</b> interrupt.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_POWERFAIL               6

/** Interrupt vector number for the <b>Serial Port 1</b> interrupt.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_SERIAL1                 7

/** Interrupt vector number for the <b>External Interrupt 2/3/4/5</b> interrupt.
 * <b>Applicable to DS80C400 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_EXTERNALINT2345         8

/** Interrupt vector number for the <b>External Interrupt 2</b> interrupt.
 * <b>Applicable to DS80C390 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_EXTERNALINT2            8

/** Interrupt vector number for the <b>Timer 3</b> interrupt.
 * <b>Applicable to DS80C400 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_TIMER3                  9

/** Interrupt vector number for the <b>External Interrupt 3</b> interrupt.
 * <b>Applicable to DS80C390 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_EXTERNALINT3            9

/** Interrupt vector number for the <b>Serial Port 2</b> interrupt.
 * <b>Applicable to DS80C400 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_SERIAL2                 10

/** Interrupt vector number for the <b>External Interrupt 4</b> interrupt.
 * <b>Applicable to DS80C390 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_EXTERNALINT4            10

/** Interrupt vector number for the <b>Write Protect</b> interrupt.
 * <b>Applicable to DS80C400 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_WRITEPROTECT            11

/** Interrupt vector number for the <b>External Interrupt 5</b> interrupt.
 * <b>Applicable to DS80C390 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_EXTERNALINT5            11

/** Interrupt vector number for the <b>Watchdog Timer</b> interrupt.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_WATCHDOG                12

/** Interrupt vector number for the <b>CAN 0</b> interrupt.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_CAN0                    13

/** Interrupt vector number for the <b>Ethernet Activity</b> interrupt.
 * <b>Applicable to DS80C400 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_ETHERNET                14

/** Interrupt vector number for the <b>CAN 1</b> interrupt.
 * <b>Applicable to DS80C390 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_CAN1                    14

/** Interrupt vector number for the <b>External Power Mode</b> interrupt.
 * <b>Applicable to DS80C400 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_ETHERNETPOWER           15

/** Interrupt vector number for the <b>CAN 0 & 1 bus activity</b> interrupt.
 * <b>Applicable to DS80C390 only</b>.
 * \sa #isr_setinterruptvector
 * \sa #isr_getinterruptvector */
#define ISR_CANBUSACTIVITY          15

/**
 * \brief        Installs an interrupt vector.
 *
 * Installs the function <i>function_ptr</i> as the interrupt service
 * routine for the interrupt defined by <i>vector_number</i>.  
 * Note that <i>vector_number</i> is <b>NOT</b> the address of the interrupt,
 * but the number corresponding to that interrupt as described in the Keil
 * documentation.  For example, a <i>vector_number</i> of <b>1</b> 
 * corresponds to the interrupt at address <code>0Bh</code>, which is the
 * timer 0 overflow interrupt.  A <i>vector_number</i> of <b>4</b>
 * corresponds to the interrupt at address <code>23h</code>, which is the
 * serial port 0 interrupt.
 *
 * This file contains several defines for common interrupts that can be
 * used for the <i>vector_number</i> parameter.
 *
 * The function <i>function_ptr</i> should terminate with a <i>reti</i> 
 * statement (functions declared with the <i>interrupt</i> keyword in 
 * Keil automatically have this).
 * 
 * \param vector_number ID of the interrupt to be installed.  It is up to the
 *                      user to make sure this parameter is in range
 * \param function_ptr  function that will be the interrupt service routine
 *
 * \sa           #isr_getinterruptvector
 */
//---------------------------------------------------------------------------
void isr_setinterruptvector(int vector_number, void* function_ptr);

/**
 * \brief        Gets the current value of an interrupt vector.
 *
 * Returns a function pointer to the interrupt service
 * routine for the interrupt defined by <i>vector_number</i>.  
 * Note that <i>vector_number</i> is <b>NOT</b> the address of the interrupt,
 * but the number corresponding to that interrupt as described in the Keil
 * documentation.  For example, a <i>vector_number</i> of <b>1</b> 
 * corresponds to the interrupt at address <code>0Bh</code>, which is the
 * timer 0 overflow interrupt.  A <i>vector_number</i> of <b>4</b>
 * corresponds to the interrupt at address <code>23h</code>, which is the
 * serial port 0 interrupt.
 *
 * This file contains several defines for common interrupts that can be
 * used for the <i>vector_number</i> parameter.
 * 
 * \param vector_number ID of the interrupt to be installed.  It is up to the
 *                      user to make sure this parameter is in range
 *
 * \return       function pointer for the interrupt service routine.  Returns
 *               <i>NULL</i> if the instruction at the interrupt's address is
 *               not an <code>LJMP</code>.
 *
 * \sa           #isr_setinterruptvector
 */
//---------------------------------------------------------------------------
void* isr_getinterruptvector(int vector_number);

/**
 * \brief        Returns the version number of this ISR library.
 *
 * \return       Version number of this ISR library.
 */
//---------------------------------------------------------------------------
unsigned int isr_version(void);

#endif

⌨️ 快捷键说明

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