示例#1
0
文件: nullmac.c 项目: EDAyele/ptunes
/*---------------------------------------------------------------------------*/
static void
input_packet(const struct radio_driver *d)
{
  if(receiver_callback) {
    receiver_callback(&nullmac_driver);
  }
}
示例#2
0
文件: rime-udp.c 项目: kincki/contiki
PROCESS_THREAD(rime_udp_process, ev, data)
{
  static uip_ipaddr_t ipaddr;

  PROCESS_BEGIN();

  broadcast_conn = udp_broadcast_new(HTONS(RIME_UDP_PORT), NULL);
  if(broadcast_conn == NULL) {
    PRINTF("rime-udp: Failed to allocate a broadcast connection!\n");
  }

  uip_create_unspecified(&ipaddr);
  unicast_conn = udp_new(&ipaddr, HTONS(RIME_UDP_PORT), NULL);
  if(unicast_conn == NULL) {
    PRINTF("rime-udp: Failed to allocate a unicast connection!\n");
  }

  udp_bind(unicast_conn, HTONS(RIME_UDP_PORT));

  while(1) {
    PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
    if(uip_newdata()) {
      packetbuf_clear();
      memmove(packetbuf_hdrptr(), uip_appdata, uip_datalen());
      PRINTF("rime-udp: received %d bytes\n", uip_datalen());
      receiver_callback(&rime_udp_driver);
    }
  }

  PROCESS_END();
}
示例#3
0
文件: cc2420.c 项目: kincki/contiki
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(cc2420_process, ev, data)
{
  PROCESS_BEGIN();

  PRINTF("cc2420_process: started\n");
  
  while(1) {
    PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
#if CC2420_TIMETABLE_PROFILING
    TIMETABLE_TIMESTAMP(cc2420_timetable, "poll");
#endif /* CC2420_TIMETABLE_PROFILING */
        
    if(receiver_callback != NULL) {
      PRINTF("cc2420_process: calling receiver callback\n");
      receiver_callback(&cc2420_driver);
#if CC2420_TIMETABLE_PROFILING
      TIMETABLE_TIMESTAMP(cc2420_timetable, "end");
      timetable_aggregate_compute_detailed(&aggregate_time,
					   &cc2420_timetable);
      timetable_clear(&cc2420_timetable);
#endif /* CC2420_TIMETABLE_PROFILING */
    } else {
      PRINTF("cc2420_process not receiving function\n");
      flushrx();
    }
  }

  PROCESS_END();
}
示例#4
0
/* Process to handle input packets
 * Receive interrupts cause this process to be polled
 * It calls the core MAC layer which calls rf230_read to get the packet
*/
PROCESS_THREAD(nrf24l01_process, ev, data)
{
  PROCESS_BEGIN();
  
  while(1) 
  {
    PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
    
#if RF230_TIMETABLE_PROFILING
    TIMETABLE_TIMESTAMP(rf230_timetable, "poll");
#endif /* RF230_TIMETABLE_PROFILING */
        
    if(receiver_callback != NULL) 
    {
      receiver_callback(&nrf24l01_driver);
	  
#if RF230_TIMETABLE_PROFILING
      TIMETABLE_TIMESTAMP(rf230_timetable, "end");
      timetable_aggregate_compute_detailed(&aggregate_time,
					   &rf230_timetable);
      timetable_clear(&rf230_timetable);
#endif /* RF230_TIMETABLE_PROFILING */
    } 
    else 
    {
      PRINTF("nrf24l01_process not receiving function\n");
      //flushrx();
    }
  }

  PROCESS_END();
}
示例#5
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(cgroups_radio_process, ev, data)
{
  PROCESS_BEGIN();

  while(1) {
    PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);

   //PRINTF("Cgroups Radio Interrupt: Diff %d\n", rtimer_arch_now() - interrupt_time);
    
    if(receiver_callback != NULL) {
      receiver_callback(&cgroups_radio_driver);		/*Use the function from the reciever to call back to it with the radio driver functions*/
    } else {
      PRINTF("cgroups_radio_process: no set receiving function\n");
    }
  }

  PROCESS_END();
}
示例#6
0
文件: tdma_mac.c 项目: EDAyele/ptunes
/*---------------------------------------------------------------------------*/
static void
input(const struct radio_driver *d)
{
  receiver_callback(&tdma_mac_driver);
}