/** * mbox_client_txdone - The way for a client to run the TX state machine. * @chan: Mailbox channel assigned to this client. * @r: Success status of last transmission. * * The client/protocol had received some 'ACK' packet and it notifies * the API that the last packet was sent successfully. This only works * if the controller can't sense TX-Done. */ void mbox_client_txdone(struct mbox_chan *chan, int r) { if (unlikely(!(chan->txdone_method & TXDONE_BY_ACK))) { dev_err(chan->mbox->dev, "Client can't run the TX ticker\n"); return; } tx_tick(chan, r); }
void acia6850_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TIMER_ID_TRANSMIT: tx_tick(); m_tx_counter = 0; break; case TIMER_ID_RECEIVE: rx_tick(); m_rx_counter = 0; break; } }
static void test_loop(long duration) { g_app.wall_clock.sec = 0; g_app.wall_clock.msec = 0; while (PJ_TIME_VAL_MSEC(g_app.wall_clock) <= duration) { /* Run TX tick */ tx_tick(&g_app.wall_clock); /* Run RX tick */ rx_tick(&g_app.wall_clock); /* Increment tick */ g_app.wall_clock.msec += WALL_CLOCK_TICK; pj_time_val_normalize(&g_app.wall_clock); } }
void acia6850_device::tx_clock_in() { if (m_cts) { m_status |= ACIA6850_STATUS_CTS; } else { m_status &= ~ACIA6850_STATUS_CTS; } m_tx_counter ++; if ( m_tx_counter > m_divide - 1) { tx_tick(); m_tx_counter = 0; } }
static void poll_txdone(unsigned long data) { struct mbox_controller *mbox = (struct mbox_controller *)data; bool txdone, resched = false; int i; for (i = 0; i < mbox->num_chans; i++) { struct mbox_chan *chan = &mbox->chans[i]; if (chan->active_req && chan->cl) { resched = true; txdone = chan->mbox->ops->last_tx_done(chan); if (txdone) tx_tick(chan, 0); } } if (resched) mod_timer(&mbox->poll, jiffies + msecs_to_jiffies(mbox->period)); }
void acia6850_device::tx_clock_in() { int _cts = devcb_call_read_line(&m_in_cts_func); if (_cts) { m_status |= ACIA6850_STATUS_CTS; } else { m_status &= ~ACIA6850_STATUS_CTS; } m_tx_counter ++; if ( m_tx_counter > m_divide - 1) { tx_tick(); m_tx_counter = 0; } }
/** * mbox_send_message - For client to submit a message to be * sent to the remote. * @chan: Mailbox channel assigned to this client. * @mssg: Client specific message typecasted. * * For client to submit data to the controller destined for a remote * processor. If the client had set 'tx_block', the call will return * either when the remote receives the data or when 'tx_tout' millisecs * run out. * In non-blocking mode, the requests are buffered by the API and a * non-negative token is returned for each queued request. If the request * is not queued, a negative token is returned. Upon failure or successful * TX, the API calls 'tx_done' from atomic context, from which the client * could submit yet another request. * The pointer to message should be preserved until it is sent * over the chan, i.e, tx_done() is made. * This function could be called from atomic context as it simply * queues the data and returns a token against the request. * * Return: Non-negative integer for successful submission (non-blocking mode) * or transmission over chan (blocking mode). * Negative value denotes failure. */ int mbox_send_message(struct mbox_chan *chan, void *mssg) { int t; if (!chan || !chan->cl) return -EINVAL; t = add_to_rbuf(chan, mssg); if (t < 0) { dev_err(chan->mbox->dev, "Try increasing MBOX_TX_QUEUE_LEN\n"); return t; } msg_submit(chan); if (chan->txdone_method == TXDONE_BY_POLL) poll_txdone((unsigned long)chan->mbox); if (chan->cl->tx_block && chan->active_req) { unsigned long wait; int ret; if (!chan->cl->tx_tout) /* wait forever */ wait = msecs_to_jiffies(3600000); else wait = msecs_to_jiffies(chan->cl->tx_tout); ret = wait_for_completion_timeout(&chan->tx_complete, wait); if (ret == 0) { t = -EIO; tx_tick(chan, -EIO); } } return t; }
void acia6850_device::transmit_event() { tx_tick(); m_tx_counter = 0; }