Esempio n. 1
0
static bool
process_packet(bool backup, unsigned char *frame, int frame_len)
{
    unsigned char tmp[IP_RECV_BUF_SIZE + ETHERNET_HDR_LEN];

    if (!backup) {

        return process_in(frame);
    } else {
        memcpy(tmp, frame, frame_len);

        return process_in(tmp);
    }
}
Esempio n. 2
0
static void sync_link(gaelco_serial_state *state)
{
	volatile buf_t *buf = state->m_in_ptr;
	int breakme = 1;
	do
	{
		shmem_lock(state->m_shmem);
		process_in(state);
		/* HACK: put some timing noise on the line */
		if (buf->cnt + state->m_slack_cnt > state->m_out_ptr->cnt)
			breakme = 0;
		/* stop if not connected .. */
		if ((state->m_out_ptr->stat & GAELCOSER_STATUS_RESET) != 0)
			breakme = 0;
		shmem_unlock(state->m_shmem);
	} while (breakme);

	state->m_slack_cnt++;
	state->m_slack_cnt = (state->m_slack_cnt % LINK_SLACK) + LINK_SLACK_B;

	shmem_lock(state->m_shmem);
	state->m_out_ptr->stat &= ~GAELCOSER_STATUS_RESET;
	shmem_unlock(state->m_shmem);
}