Lines Matching refs:msg

326 void iop_complete_message(struct iop_msg *msg)  in iop_complete_message()  argument
328 int iop_num = msg->iop_num; in iop_complete_message()
329 int chan = msg->channel; in iop_complete_message()
333 msg->iop_num, msg->channel, IOP_MSG_LEN, msg->reply); in iop_complete_message()
335 offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN); in iop_complete_message()
338 iop_writeb(iop_base[iop_num], offset, msg->reply[i]); in iop_complete_message()
343 iop_interrupt(iop_base[msg->iop_num]); in iop_complete_message()
345 msg->status = IOP_MSGSTATUS_UNUSED; in iop_complete_message()
352 static void iop_do_send(struct iop_msg *msg) in iop_do_send() argument
354 volatile struct mac_iop *iop = iop_base[msg->iop_num]; in iop_do_send()
358 msg->iop_num, msg->channel, IOP_MSG_LEN, msg->message); in iop_do_send()
360 offset = IOP_ADDR_SEND_MSG + (msg->channel * IOP_MSG_LEN); in iop_do_send()
363 iop_writeb(iop, offset, msg->message[i]); in iop_do_send()
366 iop_writeb(iop, IOP_ADDR_SEND_STATE + msg->channel, IOP_MSG_NEW); in iop_do_send()
379 struct iop_msg *msg; in iop_handle_send() local
384 if (!(msg = iop_send_queue[iop_num][chan])) return; in iop_handle_send()
386 msg->status = IOP_MSGSTATUS_COMPLETE; in iop_handle_send()
389 msg->reply[i] = iop_readb(iop, offset); in iop_handle_send()
392 iop_num, chan, IOP_MSG_LEN, msg->reply); in iop_handle_send()
394 if (msg->handler) (*msg->handler)(msg); in iop_handle_send()
395 msg->status = IOP_MSGSTATUS_UNUSED; in iop_handle_send()
396 msg = msg->next; in iop_handle_send()
397 iop_send_queue[iop_num][chan] = msg; in iop_handle_send()
398 if (msg && iop_readb(iop, IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) in iop_handle_send()
399 iop_do_send(msg); in iop_handle_send()
411 struct iop_msg *msg; in iop_handle_recv() local
413 msg = iop_get_unused_msg(); in iop_handle_recv()
414 msg->iop_num = iop_num; in iop_handle_recv()
415 msg->channel = chan; in iop_handle_recv()
416 msg->status = IOP_MSGSTATUS_UNSOL; in iop_handle_recv()
417 msg->handler = iop_listeners[iop_num][chan].handler; in iop_handle_recv()
422 msg->message[i] = iop_readb(iop, offset); in iop_handle_recv()
425 iop_num, chan, IOP_MSG_LEN, msg->message); in iop_handle_recv()
432 if (msg->handler) { in iop_handle_recv()
433 (*msg->handler)(msg); in iop_handle_recv()
435 memset(msg->reply, 0, IOP_MSG_LEN); in iop_handle_recv()
436 iop_complete_message(msg); in iop_handle_recv()
452 struct iop_msg *msg, *q; in iop_send_message() local
458 msg = iop_get_unused_msg(); in iop_send_message()
459 if (!msg) return -ENOMEM; in iop_send_message()
461 msg->next = NULL; in iop_send_message()
462 msg->status = IOP_MSGSTATUS_WAITING; in iop_send_message()
463 msg->iop_num = iop_num; in iop_send_message()
464 msg->channel = chan; in iop_send_message()
465 msg->caller_priv = privdata; in iop_send_message()
466 memcpy(msg->message, msg_data, msg_len); in iop_send_message()
467 msg->handler = handler; in iop_send_message()
470 iop_send_queue[iop_num][chan] = msg; in iop_send_message()
471 iop_do_send(msg); in iop_send_message()
474 q->next = msg; in iop_send_message()