kernels/linux-2.4.0/drivers/net/macmace.c
/*
 *	The PSC has passed us a DMA interrupt event.
 */
The PSC has passed us a DMA interrupt event.
The PSC has passed us a DMA interrupt event .
static void mace68k_dma_intr(int irq, void *dev_id, struct pt_regs *regs)
{
	struct net_device *dev = (struct net_device *) dev_id;
	struct mace68k_data *mp = (struct mace68k_data *) dev->priv;
#if 0
	u32 psc_status;
	while((psc_status=psc_read_long(0x0804))!=psc_read_long(0x0804));
	if(psc_status&0x60000000)
	{
#endif
		u16 psc_status = psc_read_word(PSC_ENETRD_CTL);
		printk("mace68k_dma_intr: PSC_ENETRD_CTL = %04X\n", (uint) psc_status);
		if (psc_status & 0x2000) {
			mace68k_rxdma_reset(dev);
			mp->rx_done = 0;
		} else if (psc_status & 0x100) {
			int left;
			psc_write_word(PSC_ENETRD_CMD + mp->rx_slot, 0x1100);
			left=psc_read_long(PSC_ENETRD_LEN + mp->rx_slot);
			while(mp->rx_done < left)
			{
				struct mace_frame *mf=((struct mace_frame *)
					mp->rx_ring)+mp->rx_done++;
				mace_dma_rx_frame(dev, mf);
			}
			if(left == 0)	
			{
				psc_load_rxdma_base(mp->rx_slot, 
					(void *)virt_to_phys(mp->rx_ring));
				mp->rx_slot^=16;
				mp->rx_done = 0;
			}
			else
			{
				psc_write_word(PSC_ENETRD_CMD+mp->rx_slot,
					0x9800);
			}
		}
		psc_status = psc_read_word(PSC_ENETWR_CTL);
		printk("mace68k_dma_intr: PSC_ENETWR_CTL = %04X\n", (uint) psc_status);
		if (psc_status & 0x2000) {
			mace68k_txdma_reset(dev);
		} else if (psc_status & 0x0100) {
			psc_write_word(PSC_ENETWR_CMD + mp->tx_slot, 0x0100);
			mp->tx_slot ^=16;
			mp->tx_count++;
			dev->tbusy = 0;
			mark_bh(NET_BH);
		}
#if 0
	}
#endif
}
static void mace68k_dma_intr ( int irq , void * dev_id , struct pt_regs * regs ) { struct net_device * dev = ( struct net_device * ) dev_id ; struct mace68k_data * mp = ( struct mace68k_data * ) dev -> priv ; #if 0 u32 psc_status ; while ( ( psc_status = psc_read_long ( 0x0804 ) ) != psc_read_long ( 0x0804 ) ) ; if ( psc_status & 0x60000000 ) { #endif 
		 
		u16 psc_status = psc_read_word(PSC_ENETRD_CTL); printk ( " \n " , ( uint ) psc_status ) ; if ( psc_status & 0x2000 ) { mace68k_rxdma_reset ( dev ) ; mp -> rx_done = 0 ; } else if ( psc_status & 0x100 ) { int left ; psc_write_word ( PSC_ENETRD_CMD + mp -> rx_slot , 0x1100 ) ; left = psc_read_long ( PSC_ENETRD_LEN + mp -> rx_slot ) ; while ( mp -> rx_done < left ) { struct mace_frame * mf = ( ( struct mace_frame * ) mp -> rx_ring ) + mp -> rx_done ++ ; mace_dma_rx_frame ( dev , mf ) ; } if ( left == 0 ) { psc_load_rxdma_base ( mp -> rx_slot , ( void * ) virt_to_phys ( mp -> rx_ring ) ) ; mp -> rx_slot ^= 16 ; mp -> rx_done = 0 ; } else { psc_write_word ( PSC_ENETRD_CMD + mp -> rx_slot , 0x9800 ) ; } } psc_status = psc_read_word ( PSC_ENETWR_CTL ) ; printk ( " \n " , ( uint ) psc_status ) ; if ( psc_status & 0x2000 ) { mace68k_txdma_reset ( dev ) ; } else if ( psc_status & 0x0100 ) { psc_write_word ( PSC_ENETWR_CMD + mp -> tx_slot , 0x0100 ) ; mp -> tx_slot ^= 16 ; mp -> tx_count ++ ; dev -> tbusy = 0 ; mark_bh ( NET_BH ) ; } #if 0 } #endif }
The PSC has passed us a DMA interrupt event.
The PSC has passed us a DMA interrupt event .
/* It seems this must be allowed to stabilise ?? */ /*
	 *	Was this an ethernet event ?
	 */ 
		/*
		 *	Process the read queue
		 */ /* read packets */ /* Out of DMA room */ /*
		 *	Process the write queue
		 */ /* apple's driver seems to loop over this until neither */ /* condition is true.    - jmt                          */