Lines Matching defs:msg
344 void iop_complete_message(struct iop_msg *msg)
346 int iop_num = msg->iop_num;
347 int chan = msg->channel;
351 msg->iop_num, msg->channel, IOP_MSG_LEN, msg->reply);
353 offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN);
356 iop_writeb(iop_base[iop_num], offset, msg->reply[i]);
361 iop_interrupt(iop_base[msg->iop_num]);
363 msg->status = IOP_MSGSTATUS_UNUSED;
370 static void iop_do_send(struct iop_msg *msg)
372 volatile struct mac_iop *iop = iop_base[msg->iop_num];
376 msg->iop_num, msg->channel, IOP_MSG_LEN, msg->message);
378 offset = IOP_ADDR_SEND_MSG + (msg->channel * IOP_MSG_LEN);
381 iop_writeb(iop, offset, msg->message[i]);
384 iop_writeb(iop, IOP_ADDR_SEND_STATE + msg->channel, IOP_MSG_NEW);
397 struct iop_msg *msg;
402 if (!(msg = iop_send_queue[iop_num][chan])) return;
404 msg->status = IOP_MSGSTATUS_COMPLETE;
407 msg->reply[i] = iop_readb(iop, offset);
410 iop_num, chan, IOP_MSG_LEN, msg->reply);
412 if (msg->handler) (*msg->handler)(msg);
413 msg->status = IOP_MSGSTATUS_UNUSED;
414 msg = msg->next;
415 iop_send_queue[iop_num][chan] = msg;
416 if (msg && iop_readb(iop, IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE)
417 iop_do_send(msg);
429 struct iop_msg *msg;
431 msg = iop_get_unused_msg();
432 msg->iop_num = iop_num;
433 msg->channel = chan;
434 msg->status = IOP_MSGSTATUS_UNSOL;
435 msg->handler = iop_listeners[iop_num][chan].handler;
440 msg->message[i] = iop_readb(iop, offset);
443 iop_num, chan, IOP_MSG_LEN, msg->message);
450 if (msg->handler) {
451 (*msg->handler)(msg);
453 memset(msg->reply, 0, IOP_MSG_LEN);
454 iop_complete_message(msg);
470 struct iop_msg *msg, *q;
476 msg = iop_get_unused_msg();
477 if (!msg) return -ENOMEM;
479 msg->next = NULL;
480 msg->status = IOP_MSGSTATUS_WAITING;
481 msg->iop_num = iop_num;
482 msg->channel = chan;
483 msg->caller_priv = privdata;
484 memcpy(msg->message, msg_data, msg_len);
485 msg->handler = handler;
488 iop_send_queue[iop_num][chan] = msg;
489 iop_do_send(msg);
492 q->next = msg;