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

📄 tsip_interrupt.c

📁 dsp tms320c6486的csl例程
💻 C
字号:
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005, 2006
 *
 *   Use of this software is controlled by the terms and conditions found
 *   in the license agreement under which this software has been supplied.
 *  ============================================================================
 */
/** ============================================================================
 *   @file  tsip_interrupt.c
 *
 *   @path  $(CSLPATH)\example\c6486\tsip_elb_example\tsip\src
 *
 *   @desc  This file contains the intterupt setup for TSIP.  
 *
 *  ============================================================================
 */

#include <csl_intc.h>
#include <soc.h>
#include "tsip_interrupt.h"
#include "cslr_tsip.h"
#include "csl_tsip.h"

extern CSL_TsipHandle hTsip0;
Uint32 TX_Frame_Int_Count = 0;
Uint32 RX_Frame_Int_Count = 0;
Uint32 TX_SFrame_Int_Count = 0;
Uint32 RX_SFrame_Int_Count = 0;

Uint32 l = 0;

/*
 * =============================================================================
 *   @func   setup_Tsip_Interrupt
 *
 *   @desc
 *  @n This function is to setup interrupts.
 *
 *  @arg  
 *      None
 *
 *  @return
 *      None
 * =============================================================================
 */
void setup_Tsip_Interrupt (
    void
)
{
    CSL_IntcParam vectId1, vectId2, vectId3, vectId4;
    CSL_IntcGlobalEnableState state;

    /* Setup the global Interrupt */
    context.numEvtEntries = 9;
    context.eventhandlerRecord = Record;
    CSL_intcInit(&context);

    /* Enable NMIs  */
    CSL_intcGlobalNmiEnable();

    /* Enable Global Interrupts  */
    CSL_intcGlobalEnable(&state);
    /* Opening a handle for the Tsip Event */
    vectId1 = CSL_INTC_VECTID_4;
    vectId2 = CSL_INTC_VECTID_5;
    vectId3 = CSL_INTC_VECTID_6;
    vectId4 = CSL_INTC_VECTID_7;

    /* intr -33 */
    hIntcTsip1 = CSL_intcOpen(&intcTsip1Obj,
                              CSL_INTC_EVENTID_RSFINT0,
                              &vectId2,
                              NULL);

    /* intr -32 */
    hIntcTsip0 = CSL_intcOpen(&intcTsip0Obj,
                              CSL_INTC_EVENTID_RFSINT0,
                              &vectId1,
                              NULL);

    /* intr -34 */
    hIntcTsip2 = CSL_intcOpen(&intcTsip2Obj,
 							  CSL_INTC_EVENTID_XFSINT0,
                              &vectId3,
                              NULL);

    /* intr -35 */
    hIntcTsip3 = CSL_intcOpen(&intcTsip3Obj,
 							  CSL_INTC_EVENTID_XSFINT0,
                              &vectId4,
                              NULL);

    CSL_intcHookIsr(vectId1,&isr_tsip_rx_frame);
    CSL_intcHookIsr(vectId2,&isr_tsip_rx_sframe);
    CSL_intcHookIsr(vectId3,&isr_tsip_tx_frame);
    CSL_intcHookIsr(vectId4,&isr_tsip_tx_sframe);

    /* Clear the Interrupt */
    CSL_intcHwControl(hIntcTsip0,CSL_INTC_CMD_EVTCLEAR,NULL);
    CSL_intcHwControl(hIntcTsip1,CSL_INTC_CMD_EVTCLEAR,NULL);
    CSL_intcHwControl(hIntcTsip2,CSL_INTC_CMD_EVTCLEAR,NULL);
    CSL_intcHwControl(hIntcTsip3,CSL_INTC_CMD_EVTCLEAR,NULL);

    /* Enable the Interrupt */
    CSL_intcHwControl(hIntcTsip0,CSL_INTC_CMD_EVTENABLE,NULL);
    CSL_intcHwControl(hIntcTsip1,CSL_INTC_CMD_EVTENABLE,NULL);
    CSL_intcHwControl(hIntcTsip2,CSL_INTC_CMD_EVTENABLE,NULL);
    CSL_intcHwControl(hIntcTsip3,CSL_INTC_CMD_EVTENABLE,NULL);
}

/*
 * =============================================================================
 *   @func   close_Tsip_Interrupt
 *
 *   @desc
 *  @n This function is to close all the interrupt instances opend.
 *
 *  @arg  
 *      None
 *
 *  @return
 *      None
 * =============================================================================
 */
void close_Tsip_Interrupt (
    void
)
{
     CSL_intcClose(hIntcTsip0);
     CSL_intcClose(hIntcTsip1);
     CSL_intcClose(hIntcTsip2);
     CSL_intcClose(hIntcTsip3);
}

/*
 * =============================================================================
 *   @func   isr_tsip_rx_frame
 *
 *   @desc
 *  @n This function is TSIP super frame receive Interrupt Service Routine.
 *
 *  @arg  
 *      None
 *
 *  @return
 *      None
 * =============================================================================
 */
interrupt void isr_tsip_rx_sframe (
    void
)
{
	Uint32 iteration = 0;
	while (iteration < 0x100)
	    iteration++;

    CSL_intcHwControl(hIntcTsip1 ,CSL_INTC_CMD_EVTCLEAR,
                      (void*)CSL_INTC_EVENTID_RSFINT0);
    RX_SFrame_Int_Count++;

	iteration = 0;
	while (iteration < 0x100)
	    iteration++;

}

/*
 * =============================================================================
 *   @func   isr_tsip_rx_frame
 *
 *   @desc
 *  @n This function is TSIP frame receive Interrupt Service Routine.
 *
 *  @arg  
 *      None
 *
 *  @return
 *      None
 * =============================================================================
 */
interrupt void isr_tsip_rx_frame (
    void
)
{
    Uint32 argument;
	Uint32 iteration = 0;
	while (iteration < 0x100)
	    iteration++;

    CSL_intcHwControl(hIntcTsip0 ,CSL_INTC_CMD_EVTCLEAR, 
                      (void*)CSL_INTC_EVENTID_RFSINT0);
    RX_Frame_Int_Count++;
    if (RX_SFrame_Int_Count == 1) {
        TsipDone = 1;
        argument = 1;
        CSL_tsipHwControl(hTsip0, CSL_TSIP_CMD_DIS_DMA, &argument);
    }
	iteration = 0;
	while (iteration < 0x100)
	    iteration++;

}

/*
 * =============================================================================
 *   @func   isr_tsip_tx_frame
 *
 *   @desc
 *  @n This function is TSIP frame transmit Interrupt Service Routine.
 *
 *  @arg  
 *      None
 *
 *  @return
 *      None
 * =============================================================================
 */
interrupt void isr_tsip_tx_frame (
    void
)
{
	Uint32 iteration = 0;
	while (iteration < 0x100)
	    iteration++;

    CSL_intcHwControl(hIntcTsip2 ,CSL_INTC_CMD_EVTCLEAR,
    (void*)CSL_INTC_EVENTID_XFSINT0);
    TX_Frame_Int_Count++;
	iteration = 0;
	while (iteration < 0x100)
	    iteration++;

}

/*
 * =============================================================================
 *   @func   isr_tsip_tx_sframe
 *
 *   @desc
 *  @n This function is TSIP super frame transmit Interrupt Service Routine.
 *
 *  @arg  
 *      None
 *
 *  @return
 *      None
 * =============================================================================
 */
interrupt void isr_tsip_tx_sframe (
    void
)
{
	Uint32 iteration = 0;
	while (iteration < 0x1000)
	    iteration++;

    TX_SFrame_Int_Count++;
    CSL_intcHwControl(hIntcTsip3 ,CSL_INTC_CMD_EVTCLEAR,
    (void*) CSL_INTC_EVENTID_XSFINT0);  //CSL_INTC_EVENTID_35);
	iteration = 0;
	while (iteration < 0x1000)
	    iteration++;

}

⌨️ 快捷键说明

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