icu.c

来自「基于ARM的应用Source6」· C语言 代码 · 共 91 行

C
91
字号
/*----------------------------------------------------------------------------
 *  Copyright (c) 2001 by National Semiconductor Corporation
 *  National Semiconductor Corporation
 *
 *  All rights reserved
 *
 *<<<-------------------------------------------------------------------------
 * File Contents:
 *	icu.c - ICU related functions
 *
 *  Project: USB Demo firmware
 *  Author : Yan Nosovitsky
 *  Date   : Oct 2001
 *----------------------------------------------------------------------->>>*/

#include "..\include\all.h"


/*----------------------------------------------------------------------------
 *                              ICU_init()
 *
 *  ICU initialization: mask all interrupts, install interrupt table
 *  The function MUST be called on the reset
 *
 *--------------------------------------------------------------------------*/
public void ICU_init(void)
{
	_disable_();
    /* Mask all interrupts */
    IENAM0 = 0;
    IENAM1 = 0;
 
    /* Clear all pending interrupts */
    IECLR0 = 0xffff;
    IECLR1 = 0xffff;
    _enable_(); 
}

/*----------------------------------------------------------------------------
 *                              ICU_mask_int(int_no)
 *
 *  Masks an interrupt
 *
 *  Input:
 *      int_no      Interrupt number
 *
 * Make very sure that the interrupts are disabled while masking
 * the interrupt. Restore the int state as it was prior the 
 * call, and do not enable them blindly !!
 *--------------------------------------------------------------------------*/
public void ICU_mask_int(int int_no)
{
	_disable_();
    ICU_MASK_INT(int_no);
    _enable_(); 
}
/*----------------------------------------------------------------------------
 *                              ICU_unmask_int(int_no)
 *
 *  Unmasks an interrupt
 *
 *  Input:
 *      int_no      Interrupt number
 *
 * Make very sure that the interrupts are disabled while unmasking
 * the interrupt. Restore the int state as it was prior the 
 * call, and do not enable them blindly !!
 *--------------------------------------------------------------------------*/
public void ICU_unmask_int(int int_no)
{
	_disable_();
    ICU_UNMASK_INT(int_no);
    _enable_(); 
}

/*----------------------------------------------------------------------------
 *                              ICU_clear_int(int_no)
 *
 *  Clears a pending interrupt
 *
 *  Input:
 *      int_no      Interrupt number
 *
 *--------------------------------------------------------------------------*/
public void ICU_clear_int(int int_no)
{
    assert(0 <= int_no && int_no <= 31);
    ICU_CLEAR_INT(int_no);
}

⌨️ 快捷键说明

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