release/src/linux/linux/drivers/net/3c527.c
/**
 *	mc32_command_nowait	-	send a command non blocking
 *	@dev: The 3c527 to issue the command to
 *	@cmd: The command word to write to the mailbox
 *	@data: A data block if the command expects one
 *	@len: Length of the data block
 *
 *	Send a command from interrupt state. If there is a command
 *	currently being executed then we return an error of -1. It simply
 *	isn't viable to wait around as commands may be slow. Providing we
 *	get in, we busy wait for the board to become ready to accept the
 *	command and issue it. We do not wait for the command to complete
 *	--- the card will interrupt us when it's done.
 */
mc32_command_nowait     -       send a command non blocking
@dev: The 3c527 to issue the command to
@cmd: The command word to write to the mailbox
@data: A data block if the command expects one
@len: Length of the data block

Send a command from interrupt state. If there is a command
currently being executed then we return an error of -1. It simply
isn't viable to wait around as commands may be slow. Providing we
get in, we busy wait for the board to become ready to accept the
command and issue it. We do not wait for the command to complete
the card will interrupt us when it's done.
mc32_command_nowait - send a command non blocking @dev : The 3c527 to issue the command to @cmd : The command word to write to the mailbox @data : A data block if the command expects one @len : Length of the data block Send a command from interrupt state . If there is a command currently being executed then we return an error of - 1 . It simply isn ' t viable to wait around as commands may be slow . Providing we get in we busy wait for the board to become ready to accept the command and issue it . We do not wait for the command to complete the card will interrupt us when it ' s done .
static int mc32_command_nowait(struct net_device *dev, u16 cmd, void *data, int len)
{
	struct mc32_local *lp = (struct mc32_local *)dev->priv;
	int ioaddr = dev->base_addr;
	if(lp->exec_pending)
		return -1;
	lp->exec_pending=3;
	lp->exec_box->mbox=0;
	lp->exec_box->mbox=cmd;
	memcpy((void *)lp->exec_box->data, data, len);
	barrier();	
	while(!(inb(ioaddr+HOST_STATUS)&HOST_STATUS_CRR));
	outb(1<<6, ioaddr+HOST_CMD);	
	return 0;
}
static int mc32_command_nowait ( struct net_device * dev , u16 cmd , void * data , int len ) { struct mc32_local * lp = ( struct mc32_local * ) dev -> priv ; int ioaddr = dev -> base_addr ; if ( lp -> exec_pending ) return -1 ; lp -> exec_pending = 3 ; lp -> exec_box -> mbox = 0 ; lp -> exec_box -> mbox = cmd ; memcpy ( ( void * ) lp -> exec_box -> data , data , len ) ; barrier ( ) ; while ( ! ( inb ( ioaddr + HOST_STATUS ) & HOST_STATUS_CRR ) ) ; outb ( 1 << 6 , ioaddr + HOST_CMD ) ; return 0 ; }
mc32_command_nowait     -       send a command non blocking
      @dev: The 3c527 to issue the command to
      @cmd: The command word to write to the mailbox
      @data: A data block if the command expects one
      @len: Length of the data block
mc32_command_nowait - send a command non blocking @dev : The 3c527 to issue the command to @cmd : The command word to write to the mailbox @data : A data block if the command expects one @len : Length of the data block
/* the memcpy forgot the volatile so be sure */ /* Send the command */