u32 AR_Init(u32 *stack_idx_array,u32 num_entries) { #ifdef _AR_DEBUG u32 freq; #endif u32 level; u32 aram_base = 0x4000; if(__ARInit_Flag) return aram_base; _CPU_ISR_Disable(level); __ARDmaCallback = NULL; IRQ_Request(IRQ_DSP_ARAM,__ARHandler,NULL); __UnmaskIrq(IRQMASK(IRQ_DSP_ARAM)); __ARStackPointer = aram_base; __ARFreeBlocks = num_entries; __ARBlockLen = stack_idx_array; #ifdef _AR_DEBUG freq = _dspReg[13]&0xff; if(((f32)freq)!=156.0 && ((f32)freq)!=176.0) { printf("AR_Init(): Illegal SDRAM refresh value(%f)\n",(f32)(freq)); abort(); } #endif _dspReg[13] = (_dspReg[13]&~0xff)|(_dspReg[13]&0xff); __ARCheckSize(); __ARInit_Flag = 1; _CPU_ISR_Restore(level); return __ARStackPointer; }
u32 AR_Init(u32 *stack_idx_array,u32 num_entries) { u32 level; u32 aram_base = 0x4000; if(__ARInit_Flag) return aram_base; _CPU_ISR_Disable(level); __ARDmaCallback = NULL; IRQ_Request(IRQ_DSP_ARAM,__ARHandler,NULL); __UnmaskIrq(IRQMASK(IRQ_DSP_ARAM)); __ARStackPointer = aram_base; __ARFreeBlocks = num_entries; __ARBlockLen = stack_idx_array; _dspReg[13] = (_dspReg[13]&~0xff)|(_dspReg[13]&0xff); __ARCheckSize(); __ARInit_Flag = 1; _CPU_ISR_Restore(level); return __ARStackPointer; }
static __inline__ void __exi_setinterrupts(s32 nChn,exibus_priv *exi) { exibus_priv *pexi = &eximap[EXI_CHANNEL_2]; if(nChn==EXI_CHANNEL_0) { __MaskIrq((IRQMASK(IRQ_EXI0_EXI)|IRQMASK(IRQ_EXI2_EXI))); if(!(exi->flags&EXI_FLAG_LOCKED) && (exi->CallbackEXI || pexi->CallbackEXI)) __UnmaskIrq((IRQMASK(IRQ_EXI0_EXI)|IRQMASK(IRQ_EXI2_EXI))); } else if(nChn==EXI_CHANNEL_1) { __MaskIrq(IRQMASK(IRQ_EXI1_EXI)); if(!(exi->flags&EXI_FLAG_LOCKED) && exi->CallbackEXI) __UnmaskIrq(IRQMASK(IRQ_EXI1_EXI)); } else if(nChn==EXI_CHANNEL_2) { //explicitly use of channel 2 only if debugger is attached. __MaskIrq(IRQMASK(IRQ_EXI0_EXI)); if(!(exi->flags&EXI_FLAG_LOCKED) && IRQ_GetHandler(IRQ_PI_DEBUG)) __UnmaskIrq(IRQMASK(IRQ_EXI2_EXI)); } }
static s32 __exi_attach(s32 nChn,EXICallback ext_cb) { s32 ret; u32 level; exibus_priv *exi = &eximap[nChn]; _CPU_ISR_Disable(level); ret = 0; if(!(exi->flags&EXI_FLAG_ATTACH)) { if(__exi_probe(nChn)==1) { __exi_clearirqs(nChn,1,0,0); exi->CallbackEXT = ext_cb; __UnmaskIrq(((IRQMASK(IRQ_EXI0_EXT))>>(nChn*3))); exi->flags |= EXI_FLAG_ATTACH; ret = 1; } }
void DSP_Init() { u32 level; #ifdef _DSP_DEBUG printf("DSP_Init()\n"); #endif _CPU_ISR_Disable(level); if(__dsp_inited==FALSE) { __dsp_intcb= __dsp_def_taskcb; IRQ_Request(IRQ_DSP_DSP,__dsp_inthandler,NULL); __UnmaskIrq(IRQMASK(IRQ_DSP_DSP)); _dspReg[5] = (_dspReg[5]&~(DSPCR_AIINT|DSPCR_ARINT|DSPCR_DSPINT))|DSPCR_DSPRESET; _dspReg[5] = (_dspReg[5]&~(DSPCR_HALT|DSPCR_AIINT|DSPCR_ARINT|DSPCR_DSPINT)); __dsp_currtask = NULL; __dsp_firsttask = NULL; __dsp_lasttask = NULL; tmp_task = NULL; __dsp_inited = TRUE; } _CPU_ISR_Restore(level); }