Esempio n. 1
0
int
handle_network_read(void)
{
  if (!(rx_descr2.status & d_eop)) {
    return FALSE;
  }

  /* Even if wasn't to us, we must do this... */
  rx_descr2.status = 0;
  *R_DMA_CH1_FIRST = (udword)&rx_descr;

  /* Was it to me? */
  if (ntohl(rx_header.seq) == (seq+1)) { 
    interface        = NETWORK;
    last_timeout     = *R_TIMER_DATA >> IO_BITNR(R_TIMER_DATA, timer0);
    nbr_read        += rx_descr2.hw_len - CRC_LEN;
    rx_descr2.buf   += rx_descr2.hw_len - CRC_LEN;
    rx_descr2.sw_len = bytes_to_read - nbr_read - CRC_LEN < 1500 ?
      bytes_to_read - nbr_read + CRC_LEN: 1500;  /* FIX!!!!! */
    rx_descr2.sw_len = rx_descr2.sw_len + NETWORK_HEADER_LENGTH < 64
      ? 64 - NETWORK_HEADER_LENGTH : rx_descr2.sw_len; /* Less than minimum eth packet? */

    seq++;
    send_network_ack();
  }
	{ 
		R_PAR0_CTRL_DATA,
		R_PAR0_STATUS_DATA,
		R_PAR0_CONFIG,
		R_PAR0_DELAY,
		/* DMA interrupt stuff */
		2,
		1U << 4, /* uses DMA 2 and 3 */
		R_DMA_CH2_CLR_INTR,
		R_DMA_CH2_FIRST,
		R_DMA_CH2_CMD,
		R_DMA_CH3_CLR_INTR,
		R_DMA_CH3_FIRST,
		R_DMA_CH3_CMD,
		/* Non DMA interrupt stuff */
		IO_BITNR(R_VECT_MASK_RD, par0),
		R_IRQ_MASK0_RD,
		R_IRQ_MASK0_CLR,
		R_IRQ_READ0,
		R_IRQ_MASK0_SET,
		IO_FIELD(R_IRQ_MASK0_RD, par0_ready, 1U), /* tx (ready)*/
		IO_FIELD(R_IRQ_MASK0_RD, par0_data, 1U), /* rx (data)*/
		IO_FIELD(R_IRQ_MASK0_RD, par0_ecp_cmd, 1U), /* ecp_cmd */
		IO_FIELD(R_IRQ_MASK0_RD, par0_peri, 1U), /* peri */
		0
	},
	{
		R_PAR1_CTRL_DATA,
		R_PAR1_STATUS_DATA,
		R_PAR1_CONFIG,
		R_PAR1_DELAY,