void mbed_eth_hardware_init(void) { /* Configure and start the timer. Timer 0 will be used for timestamping */ rflpc_timer_enable(RFLPC_TIMER0); /* Clock the timer with the slower clock possible. Enough for millisecond precision */ rflpc_timer_set_clock(RFLPC_TIMER0, RFLPC_CCLK_8); /* Set the pre scale register so that timer counter is incremented every 1ms */ rflpc_timer_set_pre_scale_register(RFLPC_TIMER0, rflpc_clock_get_system_clock() / 8000); /* Start the timer */ rflpc_timer_start(RFLPC_TIMER0); /* Init the GDMA */ rflpc_dma_init(); /* Init output buffers */ mbed_eth_init_tx_buffers(); printf(" ##### # # ###### ####### ######\r\n"); printf("# # # # ###### # # #### ## ## # # # # #\r\n"); printf("# ## ## # # # # # # # # # # # # #\r\n"); printf(" ##### # ## # ##### # # #### # # # ###### ##### # #\r\n"); printf(" # # # # # ## # # # # # # # # #\r\n"); printf("# # # # # ## ## # # # # # # # # #\r\n"); printf(" ##### # # ###### # # #### # # ###### ####### ######\r\n"); printf("\r\n"); printf(".data size: %d\r\n", &_data_end - &_data_start); printf(".bss size: %d\r\n", &_bss_end - &_bss_start); printf(".stack size: %d\r\n", RFLPC_STACK_SIZE); printf("Total: %d\r\n", (&_data_end - &_data_start) + (&_bss_end - &_bss_start) + RFLPC_STACK_SIZE); /* Set the MAC addr from the local ip */ /* @todo: use hardware ID chip from MBED */ local_eth_addr.addr[0] = 2; local_eth_addr.addr[1] = 3; local_eth_addr.addr[2] = local_ip_addr[3]; local_eth_addr.addr[3] = local_ip_addr[2]; local_eth_addr.addr[4] = local_ip_addr[1]; local_eth_addr.addr[5] = local_ip_addr[0]; printf("ETH Init..."); rflpc_eth_init(); rflpc_eth_set_mac_address(local_eth_addr.addr); _init_buffers(); while (!rflpc_eth_link_state()); printf(" done! Link is up\r\n"); printf("My MAC: %02x:%02x:%02x:%02x:%02x:%02x\r\n", local_eth_addr.addr[0], local_eth_addr.addr[1], local_eth_addr.addr[2], local_eth_addr.addr[3], local_eth_addr.addr[4], local_eth_addr.addr[5]); printf("My ip: %d.%d.%d.%d\r\n", local_ip_addr[3], local_ip_addr[2], local_ip_addr[1], local_ip_addr[0]); printf("Starting system takes %d ms\r\n", rflpc_timer_get_counter(RFLPC_TIMER0)); mbed_console_prompt(); rflpc_uart0_set_rx_callback(_uart_irq); }
int main(void) { rflpc_eth_init () ; rflpc_led_init () ; rflpc_eth_irq_enable_set (~0) ; rflpc_eth_irq_enable (~0) ; rflpc_eth_irq_trigger(~0); rflpc_irq_handler_t led = pinpon ; rflpc_eth_set_irq_handler (led) ; /* rflpc_rit_enable() ; rflpc_irq_handler_t check_led = pinpon ; rflpc_rit_set_callback(period, ~period, 1, check_led) ; */ while (1) { } return 0 ; }
int main() { rflpc_eth_init(); rflpc_led_init(); rflpc_irq_init (); rflpc_eth_irq_enable_set(0x30ff); rflpc_eth_set_irq_handler(enableled); rflpc_eth_irq_trigger(1); while(1); return 0; }
int main() { rflpc_eth_init(); rflpc_led_init(); while(1){ if(rflpc_eth_link_state()){ rflpc_led_set(RFLPC_LED_1); } else{ rflpc_led_clr(RFLPC_LED_1); } } return 0; }