示例#1
0
/**
 * \brief Main function of the Performance Analyzer application
 * \ingroup group_app_init
 */
int main(void)
{
        irq_initialize_vectors();

	/* Initialize the board.
	 * The board-specific conf_board.h file contains the configuration of
	 * the board initialization.
	 */
	board_init();
	sysclk_init();
        
    /*
     * Power ON - so set the board to INIT state. All hardware, PAL, TAL and
     * stack level initialization must be done using this function
     */
    set_main_state(INIT, NULL);

    cpu_irq_enable();
    
	sio2host_init();

    
    /* INIT was a success - so change to WAIT_FOR_EVENT state */
    set_main_state(WAIT_FOR_EVENT, NULL);

    /* Endless while loop */
    while (1)
    {
        pal_task(); /* Handle platform specific tasks, like serial interface */
        tal_task(); /* Handle transceiver specific tasks */
        app_task(); /* Application task */
        serial_data_handler();
    }
}
示例#2
0
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);
}
示例#3
0
文件: main.c 项目: mknapik/avr-MAC
/**
 * @brief Main function of the Wireless UART application
 */
int main(void)
{
    /* Initialize the TAL layer */
    if (tal_init() != MAC_SUCCESS)
    {
        // something went wrong during initialization
        pal_alert();
    }

    /* Calibrate MCU's RC oscillator */
    pal_calibrate_rc_osc();

    /* Initialize LEDs */
    pal_led_init();
    pal_led(LED_START, LED_ON);     // indicating application is started
    pal_led(LED_DATA_RX, LED_OFF);  // indicating data reception
    pal_led(LED_DATA_TX, LED_OFF);  // indicating successfull data transmission

    /*
     * The stack is initialized above, hence the global interrupts are enabled
     * here.
     */
    pal_global_irq_enable();

    /* Initialize the serial interface used for communication with terminal program */
    if (pal_sio_init(SIO_CHANNEL) != MAC_SUCCESS)
    {
        // something went wrong during initialization
        pal_alert();
    }

    /* Configure TX frame and transceiver */
    configure_frame_sending();

    /* Switch receiver on */
    tal_rx_enable(PHY_RX_ON);

#if(SEND_BLOCKWISE==true)
    start_timer();
#endif

    /* Endless while loop */
    while (1)
    {
        pal_task(); /* Handle platform specific tasks, like serial interface */
        tal_task(); /* Handle transceiver specific tasks */
#if(!(SEND_BLOCKWISE==true))
        app_task(); /* Application task */
#endif
    }
}
示例#4
0
/**
 * @brief Main function of the Sniffer application
 */
int main(void)
{

   /* Initialize the TAL layer */
    if (tal_init() != MAC_SUCCESS)
    {
        /* something went wrong during initialization*/
        pal_alert();
    }

    /* Calibrate MCU's RC oscillator */
    pal_calibrate_rc_osc();

    /* Initialize LEDs */
    pal_led_init();


    /*
     * The stack is initialized above, hence the global interrupts are enabled
     * here.
     */
    pal_global_irq_enable();

    /* Initialize the serial interface used for communication with sniffer
       GUI */
    if (pal_sio_init(SIO_CHANNEL) != MAC_SUCCESS)
    {
        /* something went wrong during initialization */
        pal_alert();
    }

    //sio_getchar();

    Wireshark_Settings = INIT_STATE ;

    /* Endless while loop */
    while (1)
    {
        pal_task();
        tal_task();
        app_task();
    }
}
示例#5
0
/**
 * \brief Run Wireless Module unit tests
 *
 * Initializes the clock system, board and USB.
 * Then runs the wireless task continuously.
 */
int main(void)
{
	irq_initialize_vectors();
	sysclk_init();

	/* Initialize the board.
	 * The board-specific conf_board.h file contains the configuration of
	 * the board initialization.
	 */
	board_init();

	sw_timer_init();
	tal_init();
	/* Enable interrupts */
	cpu_irq_enable();

	stdio_usb_init();

	while (1) {
		tal_task();
	}
}