#define CHIP_LEVEL_REG 0x02620000
#define KICK0 *(unsigned int*)(CHIP_LEVEL_REG + 0x0038)
#define KICK1 *(unsigned int*)(CHIP_LEVEL_REG + 0x003C)
#define KICK0_UNLOCK (0x83E70B13)
#define KICK1_UNLOCK (0x95A4F1E0)
#define KICK_LOCK 0
int32_t iIPCGRInfo[CORENUM] = {IPCGR0,IPCGR1};
int32_t iIPCARInfo[CORENUM] = {IPCAR0,IPCAR1};
#define IPCGR0 (0x02620240u)
#define IPCGR1 (0x02620244u)
#define IPCAR0 (0x02620280u)
#define IPCAR1 (0x02620284u)
核0的发IPC中断:
void IPC_init()
{
uint32_t a;
uint32_t coreID = CSL_chipReadReg (CSL_CHIP_DNUM);//读取当前核的编号
for (a=0; a<1000; a++)
asm (" NOP 5");
if (0 == coreID)
{
IssueInterruptToNextCore();
}
}
void IssueInterruptToNextCore()
{
uint32_t CoreNum;
uint32_t iNextCore;
static uint32_t interruptInfo=0;
CoreNum = CSL_chipReadReg (CSL_CHIP_DNUM);
iNextCore = (CoreNum + 1)%2;
interruptInfo =0x10;
dd++;
//解锁
KICK0 = KICK0_UNLOCK;
KICK1 = KICK1_UNLOCK;
*(volatile uint32_t *) iIPCGRInfo[iNextCore] = interruptInfo;//给核1 IPCGR的SRCS0置1
*(volatile uint32_t *) iIPCGRInfo[iNextCore] |= 1; //给核1 IPCGR的IPCG置1
//锁定
KICK0 = KICK_LOCK;
KICK1 = KICK_LOCK;
}
核1的响应IPC中断:
void IPC_ISR()
{
volatile uint32_t read_ipcgr;
//解锁
KICK0 = KICK0_UNLOCK;
KICK1 = KICK1_UNLOCK;
read_ipcgr = *(volatile Uint32 *) iIPCGRInfo[1]; //读核1 IPCGR的SRCS0
*(volatile uint32_t *) iIPCARInfo[1] = read_ipcgr; //清核1 IPCAR的SRCC0 IPCGR的SRCS0
//锁定
KICK0 = KICK_LOCK;
KICK1 = KICK_LOCK;
interruptNumber++;
}
核1的IPC中断CSL_GEM_IPC_LOCAL挂接在中断4上
void KeyStone_UART_Interrupts_Init(void)
{
uiCIC_out_num= 20;//in C6657, CIC out 0 is also INTC input 22
CIC_Regs= gpCIC0_regs;
/* Disable Global host interrupts. */
CIC_Regs->GLOBAL_ENABLE_HINT_REG= 0;
/* Configure no nesting support in the CPINTC Module. */
CIC_Regs->CONTROL_REG= ((CIC_Regs->CONTROL_REG&~CSL_CPINTC_CONTROL_REG_NEST_MODE_MASK|(CPINTC_NO_NESTING<<CSL_CPINTC_CONTROL_REG_NEST_MODE_SHIFT));
/*map UART ERR INT, RX EVT, and EDMA CC2 GINT to CIC out*/
KeyStone_CIC_event_map(CIC_Regs, CSL_INTC0_URXEVT, uiCIC_out_num+1);
KeyStone_CIC_event_map(CIC_Regs, CSL_INTC0_URXEVT_B, uiCIC_out_num+1);
/* Enable Global host interrupts. */
CIC_Regs->GLOBAL_ENABLE_HINT_REG= 1;
/* map UART RX interrupt to INT5 */
//IPC中断CSL_GEM_IPC_LOCAL挂接在系统中断4上
gpCGEM_regs->INTMUX1 =(CSL_GEM_INTC0_OUT_1_PLUS_20_MUL_N<<CSL_CGEM_INTMUX1_INTSEL5_SHIFT)|(CSL_GEM_IPC_LOCAL<<CSL_CGEM_INTMUX1_INTSEL4_SHIFT);
/* Clear all DSP core events */
gpCGEM_regs->EVTCLR[0]= 0xFFFFFFFF;
gpCGEM_regs->EVTCLR[1]= 0xFFFFFFFF;
gpCGEM_regs->EVTCLR[2]= 0xFFFFFFFF;
gpCGEM_regs->EVTCLR[3]= 0xFFFFFFFF;
/* clear DSP core interrupt flag */
ICR= IFR;
/* enable INT4, 5, 6 */
IER = 3|(1<<4)|(1<<5);
/* Interrupt Service Table Pointer to begining of LL2 memory */
ISTP= 0x11800000;
/* enable GIE */
TSR = TSR | 1;
}
IPC KICK寄存器的地址 以及赋值没有错
也可以确定核0在周期的发IPC中断 周期16ms核1的IPC中断服务只响应1次 之后就不进中断 interruptNumber一直为1????
是中断的问题 还是IPC的问题 还是KICK解锁、锁定的问题???
Allen35065:
见附件IPC中断处理流程
skysteed:
回复 Allen35065:
Allen Yin:
谢谢 我看一下!
还是要问一下 我写的程序 问题在哪里啊???