📄 intc.c
字号:
/*-----------------------------------------------------------------------------
@@
@@ (Summary) : LH7953x series Interrupt Controller (INTC) Device Driver Source File
@@
@@ (Comment) : Source codes of routines available for INTC
@@
@@ (Author) :
@@
@@ (History) :
@@
@@ (RCS ID) :
@@
------------------------------------------------------------------------*/
#define INTC_C
/*+include files********************************************************/
/* */
/* */
/***********************************************************************/
#include "intc.h"
/************************************************************************
@@
@@ [Name] : apd_INTCChkIRQEnable
@@
@@ [Summary] : This function checks if the queried IRQ source(s) is/are enabled.
@@
@@ [Argument] : interrupt_src : Specify which interrupt type to check
@@
@@ APD_INTC_TIMER0 for Timer0 interrupt
@@ APD_INTC_TIMER1 for Timer1 interrupt
@@ APD_INTC_TIMER2 for Timer2 interrupt
@@ APD_INTC_TIMER3 for Timer3 interrupt
@@ APD_INTC_UART0 for UART channel 0 interrupt
@@ APD_INTC_UART1 for UART channel 1 interrupt
@@ APD_INTC_DMA0 for DMA channel 0 interrupt
@@ APD_INTC_DMA1 for DMA channel 1 interrupt
@@ APD_INTC_PLL for PLL interrupt
@@ APD_INTC_WDT for WDT interrupt
@@ APD_INTC_RTCALM for RTCCALM interrupt
@@ APD_INTC_RTCIRQF for RTCIRQF interrupt
@@ APD_INTC_PWM0 for PWM channel 0 interrupt
@@ APD_INTC_PWM1 for PWM channel 1 interrupt
@@ APD_INTC_PWM2 for PWM channel 2 interrupt
@@ APD_INTC_PWM3 for PWM channel 3 interrupt
@@ APD_INTC_SSP for SPI interrupt
@@ APD_INTC_NOT_DEF for NOT_DEF interrupt
@@ APD_INTC_LCDC for LCDC interrupt
@@ APD_INTC_NOT_DEF1 for NOT_DEF1 interrupt
@@ APD_INTC_INT0 for INT0 interrupt
@@ APD_INTC_INT1 for INT1 interrupt
@@ APD_INTC_INT2 for INT2 interrupt
@@ APD_INTC_INT3 for INT3 interrupt
@@ APD_INTC_INT4 for INT4 interrupt
@@ APD_INTC_INT5 for INT5 interrupt
@@ APD_INTC_INT6 for INT6 interrupt
@@ APD_INTC_INT7 for INT7 interrupt
@@ APD_INTC_ALL for ALL interrupt
@@
@@ You can 'OR' them together for example,
@@ APD_INTC_UART0 | APD_INTC_TIMER0
@@
@@ [Return] : TRUE if any of the queried IRQ source is enabled
@@ FALSE if none of the queried IRQ source(s) is enabled
@@
@@ [Desc] : Check if the queried IRQ source(s) is/are enabled according to the argument.
@@
@@ [Note] : The Interrupt Channel Assignment is different between LH79531, LH79532 and LH79533.
@@
@@ [History] :
@@
@@ [END]
*******************************************************************************/
APD_BOOLEAN apd_INTCChkIRQEnable(unsigned long interrupt_src)
{
APD_BOOLEAN result = FALSE;
if ((*APD_INTCIRQENABLE & interrupt_src) != 0)
result = TRUE;
return (result);
}
/******************************************************************************
@@
@@ [Name] : apd_INTCChkFIQEnable
@@
@@ [Summary] : This function checks if the queried FIQ source(s) is/are enabled.
@@
@@ [Argument] : interrupt_src : Specify which interrupt type to check
@@
@@ APD_INTC_TIMER0 for Timer0 interrupt
@@ APD_INTC_TIMER1 for Timer1 interrupt
@@ APD_INTC_TIMER2 for Timer2 interrupt
@@ APD_INTC_TIMER3 for Timer3 interrupt
@@ APD_INTC_UART0 for UART channel 0 interrupt
@@ APD_INTC_UART1 for UART channel 1 interrupt
@@ APD_INTC_DMA0 for DMA channel 0 interrupt
@@ APD_INTC_DMA1 for DMA channel 1 interrupt
@@ APD_INTC_PLL for PLL interrupt
@@ APD_INTC_WDT for WDT interrupt
@@ APD_INTC_RTCALM for RTCCALM interrupt
@@ APD_INTC_RTCIRQF for RTCIRQF interrupt
@@ APD_INTC_PWM0 for PWM channel 0 interrupt
@@ APD_INTC_PWM1 for PWM channel 1 interrupt
@@ APD_INTC_PWM2 for PWM channel 2 interrupt
@@ APD_INTC_PWM3 for PWM channel 3 interrupt
@@ APD_INTC_SSP for SPI interrupt
@@ APD_INTC_NOT_DEF for NOT_DEF interrupt
@@ APD_INTC_LCDC for LCDC interrupt
@@ APD_INTC_NOT_DEF1 for NOT_DEF1 interrupt
@@ APD_INTC_INT0 for INT0 interrupt
@@ APD_INTC_INT1 for INT1 interrupt
@@ APD_INTC_INT2 for INT2 interrupt
@@ APD_INTC_INT3 for INT3 interrupt
@@ APD_INTC_INT4 for INT4 interrupt
@@ APD_INTC_INT5 for INT5 interrupt
@@ APD_INTC_INT6 for INT6 interrupt
@@ APD_INTC_INT7 for INT7 interrupt
@@ APD_INTC_ALL for ALL interrupt
@@
@@ You can 'OR' them together for example,
@@ APD_INTC_UART0 | APD_INTC_TIMER0
@@
@@ [Return] : TRUE if any of the queried FIQ source is enabled
@@ FALSE if none of the queried FIQ source(s) is enabled
@@
@@ [Desc] : Check if the queried FIQ source(s) is/are enabled according to the argument.
@@
@@ [Note] : The Interrupt Channel Assignment is different between LH79531, LH79532 and LH79533.
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
APD_BOOLEAN apd_INTCChkFIQEnable(unsigned long interrupt_src)
{
APD_BOOLEAN result = FALSE;
if ((*APD_INTCFIQENABLE & interrupt_src) != 0)
result = TRUE;
return (result);
}
/******************************************************************************
@@
@@ [Name] : apd_INTCChkIRQStatus
@@
@@ [Summary] : This function checks the IRQ status of the specified source
@@
@@ [Argument] : interrupt_src : Specify which interrupt type to check
@@ APD_INTC_TIMER0 for Timer0 interrupt
@@ APD_INTC_TIMER1 for Timer1 interrupt
@@ APD_INTC_TIMER2 for Timer2 interrupt
@@ APD_INTC_TIMER3 for Timer3 interrupt
@@ APD_INTC_UART0 for UART channel 0 interrupt
@@ APD_INTC_UART1 for UART channel 1 interrupt
@@ APD_INTC_DMA0 for DMA channel 0 interrupt
@@ APD_INTC_DMA1 for DMA channel 1 interrupt
@@ APD_INTC_PLL for PLL interrupt
@@ APD_INTC_WDT for WDT interrupt
@@ APD_INTC_RTCALM for RTCCALM interrupt
@@ APD_INTC_RTCIRQF for RTCIRQF interrupt
@@ APD_INTC_PWM0 for PWM channel 0 interrupt
@@ APD_INTC_PWM1 for PWM channel 1 interrupt
@@ APD_INTC_PWM2 for PWM channel 2 interrupt
@@ APD_INTC_PWM3 for PWM channel 3 interrupt
@@ APD_INTC_SSP for SPI interrupt
@@ APD_INTC_NOT_DEF for NOT_DEF interrupt
@@ APD_INTC_LCDC for LCDC interrupt
@@ APD_INTC_NOT_DEF1 for NOT_DEF1 interrupt
@@ APD_INTC_INT0 for INT0 interrupt
@@ APD_INTC_INT1 for INT1 interrupt
@@ APD_INTC_INT2 for INT2 interrupt
@@ APD_INTC_INT3 for INT3 interrupt
@@ APD_INTC_INT4 for INT4 interrupt
@@ APD_INTC_INT5 for INT5 interrupt
@@ APD_INTC_INT6 for INT6 interrupt
@@ APD_INTC_INT7 for INT7 interrupt
@@ APD_INTC_ALL for ALL interrupt
@@
@@ You can 'OR' them together for example,
@@ APD_INTC_UART0 | APD_INTC_TIMER0
@@
@@ [Return] : TRUE if any of the queried IRQ status is active
@@ FALSE if none of the queried IRQ status is active
@@
@@ [Desc] : Check if the queried IRQ status is/are active.
@@
@@ [Note] : The Interrupt Channel Assignment is different between LH79531, LH79532 and LH79533.
@@
@@ [History] : 11/12/2000 Kam KW Version 1.0
@@ 14/2/2001 Kam KW Version 1.2
@@ 04/06/2001 Tan WK Version 2.0 Arguments added
@@ 30/08/2001 Teo LL Version 3.0 no change for LH79533
@@
@@ [END]
******************************************************************************/
APD_BOOLEAN apd_INTCChkIRQStatus(unsigned long interrupt_src)
{
APD_BOOLEAN result = FALSE;
if ((*APD_INTCIRQSTATUS & interrupt_src) != 0)
result = TRUE;
return (result);
}
/******************************************************************************
@@
@@ [Name] : apd_INTCChkFIQStatus
@@
@@ [Summary] : This function checks the FIQ status of the specified source
@@
@@ [Argument] : interrupt_src : Specify which interrupt type to check
@@
@@ APD_INTC_TIMER0 for Timer0 interrupt
@@ APD_INTC_TIMER1 for Timer1 interrupt
@@ APD_INTC_TIMER2 for Timer2 interrupt
@@ APD_INTC_TIMER3 for Timer3 interrupt
@@ APD_INTC_UART0 for UART channel 0 interrupt
@@ APD_INTC_UART1 for UART channel 1 interrupt
@@ APD_INTC_DMA0 for DMA channel 0 interrupt
@@ APD_INTC_DMA1 for DMA channel 1 interrupt
@@ APD_INTC_PLL for PLL interrupt
@@ APD_INTC_WDT for WDT interrupt
@@ APD_INTC_RTCALM for RTCCALM interrupt
@@ APD_INTC_RTCIRQF for RTCIRQF interrupt
@@ APD_INTC_PWM0 for PWM channel 0 interrupt
@@ APD_INTC_PWM1 for PWM channel 1 interrupt
@@ APD_INTC_PWM2 for PWM channel 2 interrupt
@@ APD_INTC_PWM3 for PWM channel 3 interrupt
@@ APD_INTC_SSP for SPI interrupt
@@ APD_INTC_NOT_DEF for NOT_DEF interrupt
@@ APD_INTC_LCDC for LCDC interrupt
@@ APD_INTC_NOT_DEF1 for NOT_DEF1 interrupt
@@ APD_INTC_INT0 for INT0 interrupt
@@ APD_INTC_INT1 for INT1 interrupt
@@ APD_INTC_INT2 for INT2 interrupt
@@ APD_INTC_INT3 for INT3 interrupt
@@ APD_INTC_INT4 for INT4 interrupt
@@ APD_INTC_INT5 for INT5 interrupt
@@ APD_INTC_INT6 for INT6 interrupt
@@ APD_INTC_INT7 for INT7 interrupt
@@ APD_INTC_ALL for ALL interrupt
@@
@@ You can 'OR' them together for example,
@@ APD_INTC_UART0 | APD_INTC_TIMER0
@@
@@ [Return] : TRUE if any of the queried FIQ status is active
@@ FALSE if none of the queried FIQ status is active
@@
@@ [Desc] : Check if the queried FIQ status is/are active.
@@
@@ [Note] : The Interrupt Channel Assignment is different between LH79531, LH79532 and LH79533.
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
APD_BOOLEAN apd_INTCChkFIQStatus(unsigned long interrupt_src)
{
APD_BOOLEAN result = FALSE;
if ((*APD_INTCFIQSTATUS & interrupt_src) != 0)
result = TRUE;
return (result);
}
/************************************************************************
@@
@@ [Name] : apd_INTCClrIntr
@@
@@ [Summary] : The function clears the specified interrupt of active channels
@@
@@ [Argument] : interrupt_src : Specify which interrupt type to check
@@
@@ APD_INTC_TIMER0 for Timer0 interrupt
@@ APD_INTC_TIMER1 for Timer1 interrupt
@@ APD_INTC_TIMER2 for Timer2 interrupt
@@ APD_INTC_TIMER3 for Timer3 interrupt
@@ APD_INTC_UART0 for UART channel 0 interrupt
@@ APD_INTC_UART1 for UART channel 1 interrupt
@@ APD_INTC_DMA0 for DMA channel 0 interrupt
@@ APD_INTC_DMA1 for DMA channel 1 interrupt
@@ APD_INTC_PLL for PLL interrupt
@@ APD_INTC_WDT for WDT interrupt
@@ APD_INTC_RTCALM for RTCCALM interrupt
@@ APD_INTC_RTCIRQF for RTCIRQF interrupt
@@ APD_INTC_PWM0 for PWM channel 0 interrupt
@@ APD_INTC_PWM1 for PWM channel 1 interrupt
@@ APD_INTC_PWM2 for PWM channel 2 interrupt
@@ APD_INTC_PWM3 for PWM channel 3 interrupt
@@ APD_INTC_SSP for SPI interrupt
@@ APD_INTC_NOT_DEF for NOT_DEF interrupt
@@ APD_INTC_LCDC for LCDC interrupt
@@ APD_INTC_NOT_DEF1 for NOT_DEF1 interrupt
@@ APD_INTC_INT0 for INT0 interrupt
@@ APD_INTC_INT1 for INT1 interrupt
@@ APD_INTC_INT2 for INT2 interrupt
@@ APD_INTC_INT3 for INT3 interrupt
@@ APD_INTC_INT4 for INT4 interrupt
@@ APD_INTC_INT5 for INT5 interrupt
@@ APD_INTC_INT6 for INT6 interrupt
@@ APD_INTC_INT7 for INT7 interrupt
@@ APD_INTC_ALL for ALL interrupt
@@
@@ You can 'OR' them together for example,
@@ APD_INTC_UART0 | APD_INTC_TIMER0
@@
@@ [Return] : None
@@
@@ [Desc] : Clear edge-triggered active interrupt sources according to the argument.
@@ Corresponding bits in raw status register are cleared too.
@@
@@ [Note] : (1) If the active interrupt source is level sensitive, it must be cleared by accessing
@@ the macro that requested the interrupt.
@@ (2) The Interrupt Channel Assignment is totally different between LH79531,LH79532 and LH79533.
@@
@@ [History] :
@@
@@ [END]
*******************************************************************************/
void apd_INTCClrIntr(unsigned long interrupt_src)
{
*APD_INTCCLEAR = interrupt_src;
}
/******************************************************************************
@@
@@ [Name] : apd_INTCReadIRQEnable
@@
@@ [Summary] : This function returns the contents of APD_INTCIRQENABLE register
@@
@@ [Argument] : None
@@
@@ [Return] : APD_INTCIRQENABLE register
@@
@@ [Desc] : Reads the contents of APD_INTCIRQENABLE register
@@
@@ [Note] :
@@
@@ [History] :
@@
@@ [END]
******************************************************************************/
unsigned long apd_INTCReadIRQEnable(void)
{
return (*APD_INTCIRQENABLE);
}
/******************************************************************************
@@
@@ [Name] : apd_INTCReadFIQEnable
@@
@@ [Summary] : This function returns the contents of APD_INTCFIQENABLE register
@@
@@ [Argument] : None
@@
@@ [Return] : APD_INTCFIQENABLE register
@@
@@ [Desc] : Reads the contents of APD_INTCFIQENABLE register
@@
@@ [Note] :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -