/* Handle bus service to send a message. Note: We do not allow the device to change the data direction!  */
static void fas216_send_messageout(FAS216_Info *info, int start)
/* Handle bus service to send a message. Note: We do not allow the device to change the data direction!  */
static void fas216_send_messageout(FAS216_Info *info, int start)
{
	unsigned int tot_msglen = msgqueue_msglength(&info->scsi.msgs);
	fas216_checkmagic(info);
	fas216_cmd(info, CMD_FLUSHFIFO);
	if (tot_msglen) {
		struct message *msg;
		int msgnr = 0;
		while ((msg = msgqueue_getmsg(&info->scsi.msgs, msgnr++)) != NULL) {
			int i;
			for (i = start; i < msg->length; i++)
				fas216_writeb(info, REG_FF, msg->msg[i]);
			msg->fifo = tot_msglen - (fas216_readb(info, REG_CFIS) & CFIS_CF);
			start = 0;
		}
	} else
		fas216_writeb(info, REG_FF, NOP);
	fas216_cmd(info, CMD_TRANSFERINFO);
	info->scsi.phase = PHASE_MSGOUT;
}