📄 var_intr.s
字号:
//=============================================================================
//
// var_intr.S
//
// H8S/2674 interupt mask, unmask and acknowledge routines
//
//=============================================================================
//###ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//###ECOSGPLCOPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): Uwe Kindler
// Contributors: Uwe Kindler
// Date: 2003-02-06
// Purpose: Interrupt mask, unmask and acknowledge functions
// Description: The functions are written in assembly in order to make them
// as fast as possible because they are used within ISRs and DSRs
// often.
//####DESCRIPTIONEND####
//
//=============================================================================
//===========================================================================
// INCLUDES
//===========================================================================
#include <pkgconf/hal.h>
#include <cyg/hal/basetype.h>
#include <cyg/hal/var_intr_numbers.h>
#include <cyg/hal/mod_regs_wdt.h>
//==========================================================================
// BLOCK INTERRUPT
// DESCRIPTION:
// Causes the interrupt associated with the given vector to be
// blocked.
//
// PARAMETERS:
// er0 Vector to be blocked
//
// NOTES:
// This function is behind the macro HAL_INTERRUPT_MASK()
//==========================================================================
.h8300s
.text
.extern CYG_LABEL_DEFN(hal_int_mask_tbl)
.global CYG_LABEL_DEFN(hal_interrupt_mask)
CYG_LABEL_DEFN(hal_interrupt_mask):
//
// the watchdog overflow interrupt masking differs from all other
// and requires some special treatment
//
#if defined(CYGBLD_HAL_H8S_WATCHDOG_INTERRUPT_CODE)
cmp.b #CYGNUM_HAL_INTERRUPT_WOVI, r0l // check if it is the WOVI interrupt
bne no_wovi_int_mask
mov.b @CYGARC_TCSRR ,r2l // HAL_READ_UINT8(CYGARC_TCSRR, ier_data);
and.b #0xDF, r2l // ier_data &= ~0x20
extu.w r2 // r2h is 0 now
or.w #CYGARC_TCSR_MAGIC, r2 // CYGARC_TCSR_MAGIC | ier_data
mov.w r2, @CYGARC_TCSRW // HAL_WRITE_UINT16(CYGARC_TCSRW, ier_data);
rts
//
// if its is not the WOVI interrupt then we can execute the
// common code
//
no_wovi_int_mask:
#endif // (CYGBLD_HAL_H8S_WATCHDOG_INTERRUPT_CODE)
shll.l #2, er0 // vector * 4 for table
add.l #CYG_LABEL_DEFN(hal_int_mask_tbl), er0 // store addr. of table in er0
mov.b @er0, r1l // get mask from tbl. and store in r1l
mov.l @er0, er0 // get int. reg. address from tbl. and store in er0
extu.w e0 // e0 contains also mask - delete now
bclr r1l, @er0 // clear interrup enable bit
rts
//==========================================================================
// ENABLE INTERRUPT
// DESCRIPTION:
// Causes the interrupt associated with the given vector to be
// enabled.
//
// PARAMETERS:
// er0 Vector to be enabled
//
// NOTES:
// This function is behind the macro HAL_INTERRUPT_MASK()
//==========================================================================
.global CYG_LABEL_DEFN(hal_interrupt_unmask)
CYG_LABEL_DEFN(hal_interrupt_unmask):
//
// the watchdog overflow interrupt masking differs from all other
// and requires some special treatment
//
#if defined(CYGBLD_HAL_H8S_WATCHDOG_INTERRUPT_CODE)
cmp.b #CYGNUM_HAL_INTERRUPT_WOVI, r0l // check if it is the WOVI interrupt
bne no_wovi_int_unmask
mov.b @CYGARC_TCSRR ,r2l // HAL_READ_UINT8(CYGARC_TCSRR, ier_data);
or.b #0x20, r2l // ier_data |= 0x20
extu.w r2 // r2h is 0 now
or.w #CYGARC_TCSR_MAGIC, r2 // CYGARC_TCSR_MAGIC | ier_data
mov.w r2, @CYGARC_TCSRW // HAL_WRITE_UINT16(CYGARC_TCSRW, ier_data);
rts
//
// if its is not the WOVI interrupt then we can execute the
// common code
//
no_wovi_int_unmask:
#endif // (CYGBLD_HAL_H8S_WATCHDOG_INTERRUPT_CODE)
shll.l #2, er0 // vector * 4 for table
add.l #CYG_LABEL_DEFN(hal_int_mask_tbl), er0 // store addr. of table in er0
mov.b @er0, r1l // get mask from tbl. and store in r1l
mov.l @er0, er0 // get int. reg. address from tbl. and store in er0
extu.w e0 // e0 contains also mask - delete now
bset r1l, @er0 // set interrupt enable bit
rts
//==========================================================================
// ACKNOWLEDGE INTERRUPT
// DESCRIPTION:
// Acknowledges the current interrupt from the given vector.
// This is usually executed from the ISR for this vector when it is
// prepared to allow further interrupts.
//
// PARAMETERS:
// er0 Vector to be acknowledged
//==========================================================================
.global CYG_LABEL_DEFN(hal_interrupt_acknowledge)
CYG_LABEL_DEFN(hal_interrupt_acknowledge):
//
// the watchdog overflow interrupt acknowledge differs from all other
// and requires some special treatment
//
#if defined(CYGBLD_HAL_H8S_WATCHDOG_INTERRUPT_CODE)
cmp.b #CYGNUM_HAL_INTERRUPT_WOVI, r0l // check if it is the WOVI interrupt
bne no_wovi_int_ackn
mov.b @CYGARC_TCSRR ,r2l // HAL_READ_UINT8(CYGARC_TCSRR, isr_data);
and.b #0x7f, r2l // isr_data &= ~0x80;
extu.w r2 // r2h is 0 now
or.w #CYGARC_TCSR_MAGIC, r2 // CYGARC_TCSR_MAGIC | isr_data
mov.w r2, @CYGARC_TCSRW // HAL_WRITE_UINT16(CYGARC_TCSRW, isr_data);
rts
//
// if its is not the WOVI interrupt then we can execute the
// common code
//
no_wovi_int_ackn:
#endif // (CYGBLD_HAL_H8S_WATCHDOG_INTERRUPT_CODE)
shll.l #2, er0 // vector * 4 for table
add.l #CYG_LABEL_DEFN(hal_int_ackn_tbl), er0 // store addr. of table in er0
mov.b @er0, r1l // status = hal_int_ackn_tbl[vector].mask;
mov.l @er0, er0 // register = hal_int_ackn_tbl[vector].address;
extu.w e0
mov.b @er0, r2l // HAL_READ_UINT8(register, isr_data);
and.b r1l, r2l // isr_data &= ~status;
mov.b r2l, @er0 // HAL_WRITE_UINT8(register, isr_data);
rts
//=--------------------------------------------------------------------------
// End of delay_us.S
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -