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

📄 interrupts.c

📁 UBOOT 源码
💻 C
📖 第 1 页 / 共 2 页
字号:
			/*			 * Increment irq counter (for debug purpose only)			 */			irq_vecs[vec].count++;			if (irq_vecs[vec].handler != NULL) {				/* call isr */				(*irq_vecs[vec].handler)(irq_vecs[vec].arg);			} else {				mtdcr(uicer, mfdcr(uicer) & ~(0x80000000 >> vec));				printf ("Masking bogus interrupt vector (uic0) 0x%x\n", vec);			}			/*			 * After servicing the interrupt, we have to remove the status indicator.			 */			mtdcr(uicsr, (0x80000000 >> vec));		}		/*		 * Shift msr to next position and increment vector		 */		msr_shift <<= 1;		vec++;	}}#endif /* CONFIG_440GX */#if defined(CONFIG_440)/* Handler for UIC1 interrupt */void uic1_interrupt( void * parms){	ulong uic1_msr;	ulong msr_shift;	int vec;	/*	 * Read masked interrupt status register to determine interrupt source	 */	uic1_msr = mfdcr(uic1msr);	msr_shift = uic1_msr;	vec = 0;	while (msr_shift != 0) {		if (msr_shift & 0x80000000) {			/*			 * Increment irq counter (for debug purpose only)			 */			irq_vecs1[vec].count++;			if (irq_vecs1[vec].handler != NULL) {				/* call isr */				(*irq_vecs1[vec].handler)(irq_vecs1[vec].arg);			} else {				mtdcr(uic1er, mfdcr(uic1er) & ~(0x80000000 >> vec));				printf ("Masking bogus interrupt vector (uic1) 0x%x\n", vec);			}			/*			 * After servicing the interrupt, we have to remove the status indicator.			 */			mtdcr(uic1sr, (0x80000000 >> vec));		}		/*		 * Shift msr to next position and increment vector		 */		msr_shift <<= 1;		vec++;	}}#endif /* defined(CONFIG_440) */#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)/* Handler for UIC2 interrupt */void uic2_interrupt( void * parms){	ulong uic2_msr;	ulong msr_shift;	int vec;	/*	 * Read masked interrupt status register to determine interrupt source	 */	uic2_msr = mfdcr(uic2msr);	msr_shift = uic2_msr;	vec = 0;	while (msr_shift != 0) {		if (msr_shift & 0x80000000) {			/*			 * Increment irq counter (for debug purpose only)			 */			irq_vecs2[vec].count++;			if (irq_vecs2[vec].handler != NULL) {				/* call isr */				(*irq_vecs2[vec].handler)(irq_vecs2[vec].arg);			} else {				mtdcr(uic2er, mfdcr(uic2er) & ~(0x80000000 >> vec));				printf ("Masking bogus interrupt vector (uic2) 0x%x\n", vec);			}			/*			 * After servicing the interrupt, we have to remove the status indicator.			 */			mtdcr(uic2sr, (0x80000000 >> vec));		}		/*		 * Shift msr to next position and increment vector		 */		msr_shift <<= 1;		vec++;	}}#endif /* defined(CONFIG_440GX) */#if defined(CONFIG_440SPE)/* Handler for UIC3 interrupt */void uic3_interrupt( void * parms){	ulong uic3_msr;	ulong msr_shift;	int vec;	/*	 * Read masked interrupt status register to determine interrupt source	 */	uic3_msr = mfdcr(uic3msr);	msr_shift = uic3_msr;	vec = 0;	while (msr_shift != 0) {		if (msr_shift & 0x80000000) {			/*			 * Increment irq counter (for debug purpose only)			 */			irq_vecs3[vec].count++;			if (irq_vecs3[vec].handler != NULL) {				/* call isr */				(*irq_vecs3[vec].handler)(irq_vecs3[vec].arg);			} else {				mtdcr(uic3er, mfdcr(uic3er) & ~(0x80000000 >> vec));				printf ("Masking bogus interrupt vector (uic3) 0x%x\n", vec);			}			/*			 * After servicing the interrupt, we have to remove the status indicator.			 */			mtdcr(uic3sr, (0x80000000 >> vec));		}		/*		 * Shift msr to next position and increment vector		 */		msr_shift <<= 1;		vec++;	}}#endif /* defined(CONFIG_440SPE) *//****************************************************************************//* * Install and free a interrupt handler. */void irq_install_handler (int vec, interrupt_handler_t * handler, void *arg){	struct irq_action *irqa = irq_vecs;	int i = vec;#if defined(CONFIG_440)#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)	if ((vec > 31) && (vec < 64)) {		i = vec - 32;		irqa = irq_vecs1;	} else if (vec > 63) {		i = vec - 64;		irqa = irq_vecs2;	}#else  /* CONFIG_440GX */	if (vec > 31) {		i = vec - 32;		irqa = irq_vecs1;	}#endif /* CONFIG_440GX */#endif /* CONFIG_440 */	/*	 * print warning when replacing with a different irq vector	 */	if ((irqa[i].handler != NULL) && (irqa[i].handler != handler)) {		printf ("Interrupt vector %d: handler 0x%x replacing 0x%x\n",			vec, (uint) handler, (uint) irqa[i].handler);	}	irqa[i].handler = handler;	irqa[i].arg = arg;#if defined(CONFIG_440)#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)	if ((vec > 31) && (vec < 64))		mtdcr (uic1er, mfdcr (uic1er) | (0x80000000 >> i));	else if (vec > 63)		mtdcr (uic2er, mfdcr (uic2er) | (0x80000000 >> i));	else#endif /* CONFIG_440GX */	if (vec > 31)		mtdcr (uic1er, mfdcr (uic1er) | (0x80000000 >> i));	else#endif		mtdcr (uicer, mfdcr (uicer) | (0x80000000 >> i));#if 0	printf ("Install interrupt for vector %d ==> %p\n", vec, handler);#endif}void irq_free_handler (int vec){	struct irq_action *irqa = irq_vecs;	int i = vec;#if defined(CONFIG_440)#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)	if ((vec > 31) && (vec < 64)) {		irqa = irq_vecs1;		i = vec - 32;	} else if (vec > 63) {		irqa = irq_vecs2;		i = vec - 64;	}#endif /* CONFIG_440GX */	if (vec > 31) {		irqa = irq_vecs1;		i = vec - 32;	}#endif#if 0	printf ("Free interrupt for vector %d ==> %p\n",		vec, irq_vecs[vec].handler);#endif#if defined(CONFIG_440)#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)	if ((vec > 31) && (vec < 64))		mtdcr (uic1er, mfdcr (uic1er) & ~(0x80000000 >> i));	else if (vec > 63)		mtdcr (uic2er, mfdcr (uic2er) & ~(0x80000000 >> i));	else#endif /* CONFIG_440GX */	if (vec > 31)		mtdcr (uic1er, mfdcr (uic1er) & ~(0x80000000 >> i));	else#endif		mtdcr (uicer, mfdcr (uicer) & ~(0x80000000 >> i));	irqa[i].handler = NULL;	irqa[i].arg = NULL;}/****************************************************************************/void timer_interrupt_cpu (struct pt_regs *regs){	/* nothing to do here */	return;}/****************************************************************************/#if (CONFIG_COMMANDS & CFG_CMD_IRQ)/******************************************************************************* * * irqinfo - print information about PCI devices * */intdo_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){	int vec;	printf ("\nInterrupt-Information:\n");#if defined(CONFIG_440)	printf ("\nUIC 0\n");#endif	printf ("Nr  Routine   Arg       Count\n");	for (vec=0; vec<32; vec++) {		if (irq_vecs[vec].handler != NULL) {			printf ("%02d  %08lx  %08lx  %d\n",				vec,				(ulong)irq_vecs[vec].handler,				(ulong)irq_vecs[vec].arg,				irq_vecs[vec].count);		}	}#if defined(CONFIG_440)	printf ("\nUIC 1\n");	printf ("Nr  Routine   Arg       Count\n");	for (vec=0; vec<32; vec++) {		if (irq_vecs1[vec].handler != NULL)			printf ("%02d  %08lx  %08lx  %d\n",				vec+31, (ulong)irq_vecs1[vec].handler,				(ulong)irq_vecs1[vec].arg, irq_vecs1[vec].count);	}	printf("\n");#endif#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \    defined(CONFIG_440EPX) || defined(CONFIG_440GRX)	printf ("\nUIC 2\n");	printf ("Nr  Routine   Arg       Count\n");	for (vec=0; vec<32; vec++) {		if (irq_vecs2[vec].handler != NULL)			printf ("%02d  %08lx  %08lx  %d\n",				vec+63, (ulong)irq_vecs2[vec].handler,				(ulong)irq_vecs2[vec].arg, irq_vecs2[vec].count);	}	printf("\n");#endif#if defined(CONFIG_440SPE)	printf ("\nUIC 3\n");	printf ("Nr  Routine   Arg       Count\n");	for (vec=0; vec<32; vec++) {		if (irq_vecs3[vec].handler != NULL)			printf ("%02d  %08lx  %08lx  %d\n",					vec+63, (ulong)irq_vecs3[vec].handler,					(ulong)irq_vecs3[vec].arg, irq_vecs3[vec].count);	}	printf("\n");#endif	return 0;}#endif  /* CONFIG_COMMANDS & CFG_CMD_IRQ */

⌨️ 快捷键说明

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