2025-01-13 11:09:58 +03:00
|
|
|
|
#include "x_int13.h"
|
|
|
|
|
|
|
|
|
|
#include <281xEvTimersInit.h>
|
|
|
|
|
#include <project.h>
|
|
|
|
|
|
|
|
|
|
#include "DSP281x_Examples.h" // DSP281x Examples Include File
|
|
|
|
|
#include "DSP281x_SWPrioritizedIsrLevels.h" // DSP281x Examples Include File
|
|
|
|
|
#include "DSP281x_Device.h"
|
|
|
|
|
#include "MemoryFunctions.h"
|
|
|
|
|
#include "Spartan2E_Adr.h"
|
|
|
|
|
#include "TuneUpPlane.h"
|
2025-01-15 13:39:33 +03:00
|
|
|
|
|
2025-01-13 11:09:58 +03:00
|
|
|
|
|
|
|
|
|
//Pointers to handler functions
|
|
|
|
|
void (*int13_handler)() = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2025-01-15 13:39:33 +03:00
|
|
|
|
unsigned int enable_profile_led1_pwm = 1;
|
|
|
|
|
unsigned int enable_profile_led2_pwm = 1;
|
2025-01-13 11:09:58 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int InitXilinxSpartan2E(void (*int_handler)())
|
|
|
|
|
{
|
|
|
|
|
int err;
|
|
|
|
|
|
|
|
|
|
project.controller.status = component_NotReady;
|
|
|
|
|
|
|
|
|
|
err = load_xilinx_new(0x130000, SIZE_XILINX200);
|
|
|
|
|
if (err)
|
|
|
|
|
return err;
|
|
|
|
|
|
|
|
|
|
err = test_xilinx_live();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_XINTC_INT13
|
|
|
|
|
if (int_handler)
|
|
|
|
|
XIntcInterruptSetup(int_handler);
|
|
|
|
|
else
|
|
|
|
|
err = 1;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (err == 0)
|
|
|
|
|
project.controller.status = component_Ready;
|
|
|
|
|
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interrupt void XIntc_INT13_Handler(void)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
IER &= MINT13; // Set "global" priority
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if (_ENABLE_INTERRUPT_PROFILE_LED1)
|
2025-01-15 13:39:33 +03:00
|
|
|
|
if (enable_profile_led1_pwm)
|
2025-01-13 11:09:58 +03:00
|
|
|
|
i_led1_on_off_special(1);
|
|
|
|
|
#endif
|
|
|
|
|
#if (_ENABLE_INTERRUPT_PROFILE_LED2)
|
2025-01-15 13:39:33 +03:00
|
|
|
|
if (enable_profile_led2_pwm)
|
|
|
|
|
i_led2_on_off_special(1);
|
2025-01-13 11:09:58 +03:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
EINT;
|
|
|
|
|
|
|
|
|
|
// Insert ISR Code here.......
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// i_led2_on_off(1);
|
|
|
|
|
// IER &= 0xEFFF;
|
|
|
|
|
|
|
|
|
|
if (project.controller.write.setup.bit.use_int13 == 1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// EnableInterrupts();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
|
|
|
|
|
// stop_eva_timer1();
|
|
|
|
|
|
|
|
|
|
if(int13_handler)
|
|
|
|
|
{
|
|
|
|
|
int13_handler();
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//// start_eva_timer1();
|
|
|
|
|
// DINT;
|
|
|
|
|
//
|
|
|
|
|
// IFR &= 0xefff; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!
|
|
|
|
|
// IER |= M_INT13;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// IFR &= 0xefff; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!
|
|
|
|
|
// IER |= M_INT13;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// EnableInterrupts();
|
|
|
|
|
// c = IFR; // & 0x0100
|
|
|
|
|
// if (c)
|
|
|
|
|
// {
|
|
|
|
|
// count_lost_interrupt++;
|
|
|
|
|
// IFR &= 0xfeff; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!
|
|
|
|
|
// }
|
|
|
|
|
// EnableInterrupts();
|
|
|
|
|
// i_led2_on_off(0);
|
|
|
|
|
|
|
|
|
|
// IFR &= 0xfeff; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!
|
|
|
|
|
// EINT;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if (_ENABLE_INTERRUPT_PROFILE_LED1)
|
2025-01-15 13:39:33 +03:00
|
|
|
|
if (enable_profile_led1_pwm)
|
2025-01-13 11:09:58 +03:00
|
|
|
|
i_led1_on_off_special(0);
|
|
|
|
|
#endif
|
|
|
|
|
#if (_ENABLE_INTERRUPT_PROFILE_LED2)
|
2025-01-15 13:39:33 +03:00
|
|
|
|
if (enable_profile_led2_pwm)
|
|
|
|
|
i_led2_on_off_special(0);
|
2025-01-13 11:09:58 +03:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int XIntcInterruptSetup(void (*int_handler)())
|
|
|
|
|
{
|
|
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
|
|
EALLOW;
|
|
|
|
|
|
|
|
|
|
GpioMuxRegs.GPEMUX.bit.XNMI_XINT13_GPIOE2=1;
|
|
|
|
|
// GpioMuxRegs.GPEDIR.bit.GPIOE2 = 0;
|
|
|
|
|
// GpioDataRegs.GPESET.bit.GPIOE2 = 1;
|
|
|
|
|
|
|
|
|
|
PieVectTable.XINT13=&XIntc_INT13_Handler;
|
|
|
|
|
int13_handler = int_handler;
|
|
|
|
|
// PieCtrlRegs.PIECRTL.bit.
|
|
|
|
|
XIntruptRegs.XNMICR.bit.POLARITY=0;
|
|
|
|
|
XIntruptRegs.XNMICR.bit.SELECT=1;
|
|
|
|
|
XIntruptRegs.XNMICR.bit.ENABLE=0;
|
|
|
|
|
|
|
|
|
|
// Enable interrupt 13
|
|
|
|
|
// IER |= M_INT13;
|
|
|
|
|
|
|
|
|
|
project.controller.read.status.bit.int13_inited = 1;
|
|
|
|
|
|
|
|
|
|
// EDIS;
|
|
|
|
|
// EnableInterrupts();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Start the interrupt controller in simulation mode.
|
|
|
|
|
*/
|
|
|
|
|
// result = XIntc_Start(Ptr, intc_mode_is_Sim); // sim mode
|
|
|
|
|
// if (!(result == status_Success))
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
// return status_Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void start_int13_interrupt(void)
|
|
|
|
|
{
|
|
|
|
|
// Enable interrupt 13
|
|
|
|
|
IER |= M_INT13;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void stop_int13_interrupt(void)
|
|
|
|
|
{
|
|
|
|
|
// Disable interrupt 13
|
|
|
|
|
// IER &= ~(M_INT13);
|
|
|
|
|
IER &= MINT13; // Set "global" priority
|
|
|
|
|
}
|