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

📄 emac_intr.c

📁 TMS320DM6446平台下
💻 C
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -