rem: u32 ret,level,lck,reg; EXICallback cb;
add: s64 idtime = 0; u32 ret,lck,reg;
context: u32 EXI_GetID(u32 nChn,u32 nDev,u32 *nId){	u32 ret,level,lck,reg;	EXICallback cb;	exibus_priv *exi = &eximap[nChn];#ifdef _EXI_DEBUG		printf("EXI_GetID(exi_buscode = %d)\n",exi->exi_buscode);#endif	if(nChn<EXI_CHANNEL_2 && nDev==EXI_DEVICE_0) {		if(__exi_probe(nChn)==0) return 0;		if(exi->exi_buscode) {#ifdef _EXI_DEBUG			printf("EXI_GetID(exi_id = %d)\n",exi->exi_id);#endif			*nId = exi->exi_id;			return exi->exi_id;		}		_CPU_ISR_Disable(level);		ret = 0;		if(!(exi->flags&EXI_FLAG_ATTACH)) {			if(__exi_probe(nChn)==1) {				exi->CallbackEXT = NULL;				exi->flags |= EXI_FLAG_ATTACH;				__exi_clearirqs(nChn,1,0,0);				__UnmaskIrq(IRQMASK(IRQ_EXI0_EXT)>>(nChn*3));				ret = 1;			}		}		_CPU_ISR_Restore(level);		if(!ret) return 0;	}		lck = 0;	if(nChn<EXI_CHANNEL_2 && nDev==EXI_DEVICE_0) lck = 1;	if(lck)  ret = EXI_Lock(nChn,nDev,__unlocked_handler);	else ret = EXI_Lock(nChn,nDev,NULL);	if(ret) {		if(EXI_Select(nChn,nDev,EXI_SPEED1MHZ)==1) {			reg = 0;			EXI_Imm(nChn,&reg,2,EXI_WRITE,NULL);			EXI_Sync(nChn);			EXI_Imm(nChn,nId,4,EXI_READ,NULL);			EXI_Sync(nChn);			EXI_Deselect(nChn);		}		_CPU_ISR_Disable(level);		if(exi->flags&EXI_FLAG_LOCKED) {			exi->flags &= ~EXI_FLAG_LOCKED;			__exi_setinterrupts(nChn,exi);			if(exi->lck_cnt>0) {				cb = exi->lck_dev[0].unlockcb;				if((--exi->lck_cnt)>0) memmove(&(exi->lck_dev[0]),&(exi->lck_dev[1]),(exi->lck_cnt*sizeof(struct _lck_dev)));				if(cb) cb(nChn,nDev);				}		}		_CPU_ISR_Restore(level);	}		if(nChn<EXI_CHANNEL_2 && nDev==EXI_DEVICE_0) {		_CPU_ISR_Disable(level);		if(exi->flags&EXI_FLAG_ATTACH) {			if(!(exi->flags&EXI_FLAG_LOCKED) || exi->lockeddev!=EXI_DEVICE_0) {				exi->flags &= ~EXI_FLAG_ATTACH;				__MaskIrq(((IRQMASK(IRQ_EXI0_EXI)|IRQMASK(IRQ_EXI0_TC)|IRQMASK(IRQ_EXI0_EXT))>>(nChn*3)));			}		}		exi->exi_buscode = exi_buscode[nChn] = *nId;		exi->exi_id = *nId;#ifdef _EXI_DEBUG		printf("EXI_GetID(exi_id = %d)\n",exi->exi_id);#endif		_CPU_ISR_Restore(level);		return exi->exi_id;	}	return 0;}