Example #1
0
void
zbus_txstart(zbus_index_t size)
{
  // FIXME
//  if(zbus_txlen != 0 || zbus_rxlen != 0 || bus_blocked)
//    return;			/* rx or tx in action or
//				   new packet left in buffer
//                                   or somebody is talking on the line */


#ifdef ZBUS_RAW_SUPPORT
  if (!zbus_raw_conn->rport)
#endif
  {
#ifdef SKIPJACK_SUPPORT
    zbus_encrypt (zbus_buf, &size);

    if (!size){
      uip_buf_unlock ();
      // FIXME
      zbus_rxstart ();		/* destroy the packet and restart rx */
      return;
    }
#endif
  }
  zbus_txlen = size;

  if(bus_blocked)
    return;
  __zbus_txstart();
}
Example #2
0
void
rfm12_process(void)
{
  uip_len = rfm12_rxfinish();
  if (!uip_len)
    return;

#ifdef ROUTER_SUPPORT
#ifdef RFM12_RAW_SUPPORT
  if (rfm12_raw_conn->rport)
  {
    /* rfm12 raw capturing active, forward in udp/ip encapsulated form,
     * thusly don't push to the stack. */
    /* FIXME This way we cannot accept rfm12_raw requests from anything
     * but ethernet.  This shalt be improved somewhen. */
    uip_stack_set_active(STACK_ENC);
    memmove(uip_buf + UIP_IPUDPH_LEN + UIP_LLH_LEN, rfm12_data, uip_len);
    uip_slen = uip_len;
    uip_udp_conn = rfm12_raw_conn;
    uip_process(UIP_UDP_SEND_CONN);
    router_output();

    uip_buf_unlock();
    rfm12_rxstart();
    return;
  }
#endif /* RFM12_RAW_SUPPORT */

  /* uip_input expects the number of bytes including the LLH. */
  uip_len = uip_len + RFM12_BRIDGE_OFFSET + RFM12_LLH_LEN;
#endif /* not ROUTER_SUPPORT */

  rfm12_rxstart();

  router_input(STACK_RFM12);

  if (uip_len == 0)
  {
    uip_buf_unlock();
    return;                     /* The stack didn't generate any data
                                 * that has to be sent back. */
  }

  /* Application has generated output, send it out. */
  router_output();
}
Example #3
0
rfm12_index_t
rfm12_rxfinish(void)
{
  if (rfm12_status != RFM12_NEW)
    return (0);                 /* no new Packet */

#ifdef HAVE_STATUSLED_RFM12_RX
  PIN_CLEAR(STATUSLED_RFM12_RX);
#endif

  rfm12_index_t len = rfm12_buf[1];
#ifndef TEENSY_SUPPORT
  len += (rfm12_buf[0] & 0x7F) << 8;
#endif

  if (rfm12_buf[0] & 0x80)
  {
    /* We've received a source routed packet. */
#ifdef RFM12_PCKT_FWD
    if (rfm12_buf[2] == CONF_RFM12_STATID)
    {
      /* Strip source route header. */
      memmove(rfm12_buf, rfm12_buf + 3, len - 1);

      for (uint8_t j = 0; j < 15; j++)
        _delay_ms(10);          /* Wait 150ms for slower receivers to get
                                 * ready again. */

      rfm12_txlen = len - 3;    /* Num of bytes excluding LLH. */
      rfm12_txstart_hard();
      return 0;                 /* We mustn't parse the packet,
                                 * since this might cause a reply. */
    }
#else
    /* We're dumb, let's ignore that packet. */
    len = 0;
#endif
  }

  rfm12_status = RFM12_OFF;

  if (!len)
  {
    uip_buf_unlock();
    rfm12_rxstart();            /* we destroyed the packet ... */
  }

  return (len);                 /* receive size */
}
Example #4
0
void
usb_net_periodic(void)
{
  if (usb_rq_len && (usb_rq_index >= usb_rq_len)) {
    /* A packet arrived, put it into uip */
    uip_len = usb_rq_len + UIP_LLH_LEN;
    usb_rq_len = 0;
    router_input (STACK_USB);

    if (uip_len == 0)
      uip_buf_unlock ();	/* The stack didn't generate any data
				   that has to be sent back. */

    else
      router_output ();         /* Application has generated output,
				   send it out. */
  }
}
Example #5
0
zbus_index_t
zbus_rxfinish(void) 
{
  if (zbus_rxlen != 0) {
#ifdef SKIPJACK_SUPPORT
#ifdef ZBUS_RAW_SUPPORT
    if (!zbus_raw_conn->rport)
#endif
    zbus_decrypt(zbus_buf, (zbus_index_t *) &zbus_rxlen);
    if(!zbus_rxlen) {
      zbus_rxstart ();
      uip_buf_unlock();
    }

#endif
    return zbus_rxlen;
  }
  return 0;
}
Example #6
0
void
usb_net_read_finished (void)
{
  uip_buf_unlock ();
  usb_packet_ready = 0;
}