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

📄 net_isr.c

📁 GNU环境下uC/OS-II的移植代码:BSP & OS部分
💻 C
字号:
/*
*********************************************************************************************************
*                                              uC/TCP-IP
*                                      The Embedded TCP/IP Suite
*
*                          (c) Copyright 2003-2006; Micrium, Inc.; Weston, FL
*
*               All rights reserved.  Protected by international copyright laws.
*
*               uC/TCP-IP is provided in source form for FREE evaluation, for educational
*               use or peaceful research.  If you plan on using uC/TCP-IP in a commercial
*               product you need to contact Micrium to properly license its use in your
*               product.  We provide ALL the source code for your convenience and to help
*               you experience uC/TCP-IP.  The fact that the source code is provided does
*               NOT mean that you can use it without paying a licensing fee.
*
*               Knowledge of the source code may NOT be used to develop a similar product.
*
*               Please help us continue to provide the Embedded community with the finest
*               software available.  Your honesty is greatly appreciated.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*
*                                BOARD SUPPORT PACKAGE (BSP) FUNCTIONS
*
*                                  TCP/IP STACK ISR SUPPORT FUNCTIONS
*
* Filename      : net_isr.c
* Version       : V1.88
* Programmer(s) : Jean-Denis Hatier
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                             INCLUDE FILES
*********************************************************************************************************
*/

#include  <net.h>
#include  <reg_AT91RM9200.h>


/*
*********************************************************************************************************
*                                   NETWORK INTERRUPT INITIALIZATION
*
* Description : This function is called to initialize the interrupt controller associated with the NIC.
*
* Arguments   : None.
*********************************************************************************************************
*/

void  NetNIC_IntInit (void)
{
                                                                /* AT91RM9200 is on interrupt #24.                      */
    AIC_SVR_REG(24 * 4) = (CPU_INT32U)NetNIC_ISR_Handler;       /* Setup the interrupt vector for the ethernet ISR.     */
    AIC_SMR_REG(24 * 4) = AT91C_AIC_PRIOR_HIGHEST |             /* Level sensitive, low priority.                       */
                          AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE;

    *AT91C_AIC_IECR     = DEF_BIT_24;                           /* Enable ethernet interrupts at AIC level.             */
}


/*
*********************************************************************************************************
*                                        NETWORK INTERRUPT CLEAR
*
* Description : This function is called to clear the interrupt controller associated with the NIC.
*
* Arguments   : None.
*********************************************************************************************************
*/

void  NetNIC_IntClr (void)
{
                                                                /* AT91RM9200 is on interrupt #24.                      */
    *AT91C_AIC_ICCR     = DEF_BIT_24;                           /* Clear interrupt.                                     */
    *AT91C_AIC_EOICR    = DEF_BIT_24;                           /* End of interrupt handler.                            */
}


/*
*********************************************************************************************************
*                                   NETWORK INTERRUPT INITIALIZATION
*
* Description : This function is called to initialize the interrupt controller associated with the phyter.
*
* Arguments   : None.
*********************************************************************************************************
*/

void  NetNIC_PhyIntInit (void)
{
    *AT91C_PMC_PCER     = DEF_BIT_04;                           /* Enable PIO C Peripheral Clock.                       */

    *AT91C_PIOC_PER     = DEF_BIT_02;                           /* Controlled by PIO.                                   */
    *AT91C_PIOC_ODR     = DEF_BIT_02;                           /* Input signal.                                        */
    *AT91C_PIOC_IFDR    = DEF_BIT_02;                           /* Input unfiltered.                                    */
    *AT91C_PIOC_CODR    = DEF_BIT_02;                           /* No output data.                                      */
    *AT91C_PIOC_MDDR    = DEF_BIT_02;                           /* No multi-drive.                                      */
    *AT91C_PIOC_PPUDR   = DEF_BIT_02;                           /* Pull-up disable.                                     */
    *AT91C_PIOC_OWDR    = DEF_BIT_02;                           /* No output to this line.                              */

    *AT91C_PIOC_IER     = DEF_BIT_02;                           /* Enable interrupt.                                    */

                                                                /* BCM5221 is on PC0, which is on interrupt #4.         */
                                                                /* Touch screen, CF card and SD card are also on the    */
                                                                /* PIOC. The NetNIC_PhyISR_Handler() will need to       */
                                                                /* demultiplex which PC pin triggered the interrupt     */
                                                                /* Setup the interrupt vector for the phyter ISR.       */
    AIC_SVR_REG(4 * 4)  = (CPU_INT32U)NetNIC_PhyISR_Handler;
    AIC_SMR_REG(4 * 4)  = AT91C_AIC_PRIOR_LOWEST |              /* Edge sensitive, low priority.                        */
                          AT91C_AIC_SRCTYPE_INT_EDGE_TRIGGERED;

    *AT91C_AIC_IECR     = DEF_BIT_04;                           /* Enable phyter interrupts at AIC level.               */
}


/*
*********************************************************************************************************
*                                        NETWORK INTERRUPT CLEAR
*
* Description : This function is called to clear the interrupt controller associated with the phyter.
*
* Arguments   : None.
*********************************************************************************************************
*/

void  NetNIC_PhyIntClr (void)
{
                                                                /* BCM5221 is on PC0, which is on interrupt #4.         */
    *AT91C_AIC_ICCR     = DEF_BIT_04;                           /* Clear interrupt.                                     */
    *AT91C_AIC_EOICR    = DEF_BIT_04;                           /* End of interrupt handler.                            */
}

⌨️ 快捷键说明

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