emac_intr.c

来自「TI的DM6446的硬件平台搭建的相关例子」· C语言 代码 · 共 73 行

C
73
字号
#include "emac.h"

extern void EMAC_isr( );

CSL_IntcHandle              intc_handle;
CSL_IntcObj                 intc_object;
CSL_IntcHwSetup             intc_hwsetup;
CSL_IntcEventHandlerRecord  intc_event_handler_record;
CSL_IntcEventEnableState    intc_event_state;

void supervisorMode() //Change to Super Visor Mode
{
	asm(" SWI #1 ");
}

EMAC_initIntc( )
{
	Uint32      retcode = 0;
    CSL_Status  status = CSL_SOK;

    /*
     *  Initialize EMAC & ARM Interrupt State
     */

    /* Disable global interrupt in wrapper */
    CSL_FINST( EWRAP_REGS->EWCTL, EWRAP_EWCTL_INTEN, DISABLE );

    /* Initialize INTC */
    CSL_intcInit( );

    /*  Initialize INTC Dispatcher */
    CSL_intcDispatcherInit( );

    //Clear All Peripheral Interrupts
	CSL_INTC1_REGS->EINT0 = 0x0;
	CSL_INTC1_REGS->EINT1 = 0x0;

    /*
     * Change to Supervisor Mode to Enagle FIQ & IRQ Interrupts
     */
    supervisorMode( );

    /* Set as IRQ w/ priority 2 */
    intc_hwsetup.priority = CSL_INTC_PRIORITY_2;
    intc_handle = CSL_intcOpen( &intc_object,
                                CSL_INTC_EVENTID_EMACINT,
                                CSL_INTC_VECTID_DEFAULT,
                                &intc_hwsetup,
                                &status );
    if ( status != CSL_SOK )
         retcode++;

    intc_event_handler_record.handler   = &EMAC_isr;
    intc_event_handler_record.arg       = 0;
    intc_event_handler_record.evtId     = CSL_INTC_EVENTID_EMACINT;
    intc_event_handler_record.dummy     = 0;
    CSL_intcPlugEventHandler( intc_handle, &intc_event_handler_record );
    CSL_intcEventEnable( CSL_INTC_EVENTID_EMACINT, &intc_event_state );

    /* Set Interrupt Timer Count */
    EWRAP_REGS->EWINTTCNT = 0;

    /* Enable global interrupt in wrapper */
    CSL_FINST( EWRAP_REGS->EWCTL, EWRAP_EWCTL_INTEN, ENABLE );

    return retcode;
}

EMAC_closeIntc( )
{
    CSL_intcClose( intc_handle );
}

⌨️ 快捷键说明

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