kernels/linux-2.4.0/drivers/net/3c527.c
/**
 *	mc32_command_nowait:
 *	@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 isnt viable
 *	to wait around as commands may be slow. Providing we get in then
 *	we send the command and busy wait for the board to acknowledge that
 *	a command request is pending. We do not wait for the command to 
 *	complete, just for the card to admit to noticing it.  
 */
@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 isnt viable
to wait around as commands may be slow. Providing we get in then
we send the command and busy wait for the board to acknowledge that
a command request is pending. We do not wait for the command to
complete, just for the card to admit to noticing it.
@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 isnt viable to wait around as commands may be slow . Providing we get in then we send the command and busy wait for the board to acknowledge that a command request is pending . We do not wait for the command to complete just for the card to admit to noticing it .
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:
      @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 : @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 */