コード例 #1
0
ファイル: mac_api.c プロジェクト: thegeek82000/asf
bool wpan_task(void)
{
    bool event_processed;
    uint8_t *event = NULL;

    /* mac_task returns true if a request was processed completely */
    event_processed = mac_task();

    /*
     * MAC to NHLE event queue should be dispatched
     * irrespective of the dispatcher state.
     */
    event = (uint8_t *)qmm_queue_remove(&mac_nhle_q, NULL);

    /* If an event has been detected, handle it. */
    if (NULL != event) {
        dispatch_event(event);
        event_processed = true;
    }

#ifdef ENABLE_RTB
    rtb_task();
#endif  /* ENABLE_RTB */
    tal_task();
    pal_task();

    return (event_processed);
}
コード例 #2
0
ファイル: sicslowmac.c プロジェクト: AWRyder/contiki
PROCESS_THREAD(mac_process, ev, data)
{

  PROCESS_POLLHANDLER(mac_pollhandler());


  PROCESS_BEGIN();

  radio_status_t return_value;

  /* init radio */
  /** \todo: this screws up if calosc is set to TRUE, find out why? */
  return_value = radio_init(false, NULL, NULL, NULL);

#if DEBUG
  if (return_value == RADIO_SUCCESS) {
    printf("Radio init successful.\n");
  } else {
    printf("Radio init failed with return: %d\n", return_value);
  }
#endif

  uint8_t eeprom_channel;
  uint8_t eeprom_check;
  
  eeprom_channel = eeprom_read_byte((uint8_t *)9);
  eeprom_check = eeprom_read_byte((uint8_t *)10);
  
  if ((eeprom_channel < 11) || (eeprom_channel > 26) || ((uint8_t)eeprom_channel != (uint8_t)~eeprom_check)) {
#if UIP_CONF_USE_RUM
	eeprom_channel = 19; //Default
#else
	eeprom_channel = 24; //Default
#endif
  }

  radio_set_operating_channel(eeprom_channel);
  radio_use_auto_tx_crc(true);
  radio_set_trx_state(TRX_OFF);

  mac_init();

  /* Set up MAC function pointers and sicslowpan callback. */
  pmac_driver->set_receive_function = setinput;
  pmac_driver->send = sicslowmac_dataRequest;
  sicslowpan_init(pmac_driver);

  ieee_15_4_init(&ieee15_4ManagerAddress);

  radio_set_trx_state(RX_AACK_ON);

  while(1) {
    PROCESS_YIELD();
    mac_task(ev, data);

  }

  PROCESS_END();
}
コード例 #3
0
ファイル: sicslowmac.c プロジェクト: AWRyder/contiki
void mac_pollhandler(void)
{
    mac_task(0, NULL);
}