hal_it.c

来自「最新版IAR FOR ARM(EWARM)5.11中的代码例子」· C语言 代码 · 共 137 行

C
137
字号
//-----------------------------------------------------------------------------
// HAL_IT
//-----------------------------------------------------------------------------

#include <stdlib.h>
#include "hal_map.h"
#include "hal_it.h"
#include "hal_gpio.h"
#include "hal_mac.h"
#include "hal_ic.h"


//-----------------------------------------------------------------------------
//* Name: MAC_Handler()
//* Funcionality: This function handles MAC exception.
//* NOTE: find all the irq routines in hal_mac.c
//-----------------------------------------------------------------------------
#define MAC_NULL 0x0
static u32 MAC_INT_VECTOR[32] = {DmaMac_RxEmpty, DmaMac_RxFull, DmaMac_RxEntry, DmaMac_RxTo,
                                MAC_NULL, DmaMac_PckLost, DmaMac_RxNext, DmaMac_RxDone,
                                MAC_NULL, DmaMac_RxMErr, MAC_NULL, MAC_NULL,
                                MAC_NULL, MAC_NULL, MAC_NULL, DmaMac_RxCurrDone,
                                DmaMac_TxEmpty, DmaMac_TxFull, DmaMac_TxEntry, DmaMac_TxTo,
                                MAC_NULL, MAC_NULL, DmaMac_TxNext, DmaMac_TxDone,
                                MAC_NULL, DmaMac_TxMErr, MAC_NULL, MAC_NULL,
                                DmaMac_MACInt, MAC_NULL, MAC_NULL, DmaMac_TxCurrDone};
typedef void (*fc)(void);
static fc Mac_Irq_Handler_Call[32] =  {MAC_IrqHandler_RxEmpty, MAC_IrqHandler_RxFull, MAC_IrqHandler_RxEntry, MAC_IrqHandler_RxTo,
                                NULL, MAC_IrqHandler_PckLost, MAC_IrqHandler_RxNext, MAC_IrqHandler_RxDone,
                                NULL, MAC_IrqHandler_RxMErr, NULL, NULL,
                                NULL, NULL, NULL, MAC_IrqHandler_RxCurrDone,
                                MAC_IrqHandler_TxEmpty, MAC_IrqHandler_TxFull, MAC_IrqHandler_TxEntry, MAC_IrqHandler_TxTo,
                                NULL, NULL, MAC_IrqHandler_TxNext, MAC_IrqHandler_TxDone,
                                NULL, MAC_IrqHandler_TxMErr, NULL, NULL,
                                MAC_IrqHandler_MACInt, NULL, NULL, MAC_IrqHandler_TxCurrDone};

void MAC_Handler(void)
{
  u8 i;
  u32 temp = 1;

  for (i=0;i<32;i++){
    if ( (temp<<i) & DmaMac_IntStat_Msk ) {

              if (DMA_MAC->DMA_INT_STS & MAC_INT_VECTOR[i] & DMA_MAC->DMA_INT_EN){
                DMA_MAC->DMA_INT_STS = MAC_INT_VECTOR[i];
                SetBit (IC->PENDING,IC_MAC);
                //-------- call the interrupt service routine

                Mac_Irq_Handler_Call[i]();

                //-------- call the interrupt service routine
              }
    }
  }
}
/*******************************************************************************
* Function Name  : USB_Handler
* Description    : This function handles USB exception.
*******************************************************************************/
void USB_Handler(void)
{
}

/*******************************************************************************
* Function Name  : IEE1284_Handler
* Description    : This function handles IEE1284 exception.
*******************************************************************************/
void IEE1284_Handler(void)
{
}

/*******************************************************************************
* Function Name  : I2C_Handler
* Description    : This function handles I2C exception.
*******************************************************************************/
void I2C_Handler(void)
{
}

/*******************************************************************************
* Function Name  : UART_Handler
* Description    : This function handles UART exception.
*******************************************************************************/
void UART_Handler(void)
{
}

/*******************************************************************************
* Function Name  : RTC_Handler
* Description    : This function handles RTC exception.
*******************************************************************************/
void RTC_Handler(void)
{
}
/*******************************************************************************
* Function Name  : TIMER1_Handler
* Description    : This function handles TIMER1 exception.
*******************************************************************************/
void TIMER1_Handler(void)
{
}

/*******************************************************************************
* Function Name  : TIMER2_Handler
* Description    : This function handles TIMER2 exception.

*******************************************************************************/
void TIMER2_Handler(void)
{
}

/*******************************************************************************
* Function Name  : nXIRQ0_Handler
* Description    : This function handles nXIRQ0 exception.
*******************************************************************************/
void nXIRQ0_Handler(void)
{
}

/*******************************************************************************
* Function Name  : nXIRQ1_Handler
* Description    : This function handles nXIRQ1 exception.
*******************************************************************************/
void nXIRQ1_Handler(void)
{
}

/*******************************************************************************
* Function Name  : DMA_Handler
* Description    : This function handles DMA exception.
*******************************************************************************/
void DMA_Handler(void)
{
}

⌨️ 快捷键说明

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