int main(void) { puts("AT86RF2xx device driver test"); xtimer_init(); for (unsigned i = 0; i < AT86RF2XX_NUM; i++) { const at86rf2xx_params_t *p = &at86rf2xx_params[i]; netdev2_t *dev = (netdev2_t *)(&devs[i]); printf("Initializing AT86RF2xx radio at SPI_%d\n", p->spi); at86rf2xx_setup(&devs[i], (at86rf2xx_params_t*) p); dev->event_callback = _event_cb; dev->driver->init(dev); } _recv_pid = thread_create(stack, sizeof(stack), THREAD_PRIORITY_MAIN - 1, THREAD_CREATE_STACKTEST, _recv_thread, NULL, "recv_thread"); if (_recv_pid <= KERNEL_PID_UNDEF) { puts("Creation of receiver thread failed"); return 1; } /* start the shell */ puts("Initialization successful - starting the shell now"); char line_buf[SHELL_DEFAULT_BUFSIZE]; shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); return 0; }
int main(void) { xtimer_init(); bloom_t *bloom = bloom_new(1 << 12, 8, fnv_hash, sax_hash, sdbm_hash, djb2_hash, kr_hash, dek_hash, rotating_hash, one_at_a_time_hash); printf("Testing Bloom filter.\n\n"); printf("m: %" PRIu32 " k: %" PRIu32 "\n\n", (uint32_t) bloom->m, (uint32_t) bloom->k); genrand_init(myseed); unsigned long t1 = xtimer_now(); for (int i = 0; i < lenB; i++) { buf_fill(buf, BUF_SIZE); buf[0] = MAGIC_B; bloom_add(bloom, (uint8_t *) buf, BUF_SIZE * sizeof(uint32_t) / sizeof(uint8_t)); } unsigned long t2 = xtimer_now(); printf("adding %d elements took %" PRIu32 "ms\n", lenB, (uint32_t) (t2 - t1) / 1000); int in = 0; int not_in = 0; unsigned long t3 = xtimer_now(); for (int i = 0; i < lenA; i++) { buf_fill(buf, BUF_SIZE); buf[0] = MAGIC_A; if (bloom_check(bloom, (uint8_t *) buf, BUF_SIZE * sizeof(uint32_t) / sizeof(uint8_t))) { in++; } else { not_in++; } } unsigned long t4 = xtimer_now(); printf("checking %d elements took %" PRIu32 "ms\n", lenA, (uint32_t) (t4 - t3) / 1000); printf("\n"); printf("%d elements probably in the filter.\n", in); printf("%d elements not in the filter.\n", not_in); double false_positive_rate = (double) in / (double) lenA; printf("%f false positive rate.\n", false_positive_rate); bloom_del(bloom); printf("\nAll done!\n"); return 0; }
int main(void) { tlsf_create_with_pool(_tlsf_heap, sizeof(_tlsf_heap)); printf("%s started\n", APPLICATION_NAME); xtimer_init(); msg_init_queue(main_msg_queue, MAIN_MSG_QUEUE_SIZE); netdev_init(); stack_init(); exp_run(); printf("%s stopped\n", APPLICATION_NAME); return 0; }
int main(void) { #ifdef MODULE_XTIMER /* auto_init is disabled, but some modules depends on this module being initialized */ xtimer_init(); #endif #ifdef OUTPUT TextUIRunner_setOutputter(OUTPUTTER); #endif TESTS_START(); #ifndef NO_TEST_SUITES UNCURRY(RUN_TEST_SUITES, TEST_SUITES) #endif TESTS_END(); return 0; }
/* xtimer_add: * Adds a timer to the pset_h of timers, and sorts the timer list (least time * remaining first). * Return values: * Success: the timer ID which can be used to later remove the timer (>0) * Failure: -1 */ int xtimer_add( void (*func)(void), time_t secs ) { xtime_h *new_xtimer = NULL; time_t tmptime; unsigned count; if( xtimer_list == NULL ) { if( xtimer_init() < 0 ) return -1; } new_xtimer = (xtime_h *)malloc(sizeof(xtime_h)); if( new_xtimer == NULL ) { return -1; } tmptime = time(NULL); if( tmptime == -1 ) { free( new_xtimer ); return -1; } new_xtimer->timerfunc = func; new_xtimer->when = tmptime + secs; if( (count = pset_count( xtimer_list )) == 0 ) { new_xtimer->xtid = 1; } else { new_xtimer->xtid = ((xtime_h *)(pset_pointer(xtimer_list, count-1)))->xtid + 1; } if( pset_add( xtimer_list, new_xtimer ) == NULL ) { free( new_xtimer ); return -1; } pset_sort( xtimer_list, xtimer_compfunc ); return(new_xtimer->xtid); }
void auto_init(void) { #ifdef MODULE_TINYMT32 random_init(0); #endif #ifdef MODULE_XTIMER DEBUG("Auto init xtimer module.\n"); xtimer_init(); #endif #ifdef MODULE_RTC DEBUG("Auto init rtc module.\n"); rtc_init(); #endif #ifdef MODULE_IO1_XPLAINED DEBUG("Auto init IO1 Xplained extension module.\n"); io1_xplained_auto_init(); #endif #ifdef MODULE_SHT11 DEBUG("Auto init SHT11 module.\n"); sht11_init(); #endif #ifdef MODULE_GPIOINT DEBUG("Auto init gpioint module.\n"); gpioint_init(); #endif #ifdef MODULE_LTC4150 DEBUG("Auto init ltc4150 module.\n"); ltc4150_init(); #endif #ifdef MODULE_MCI DEBUG("Auto init mci module.\n"); mci_initialize(); #endif #ifdef MODULE_PROFILING extern void profiling_init(void); profiling_init(); #endif #ifdef MODULE_GNRC_PKTBUF DEBUG("Auto init gnrc_pktbuf module\n"); gnrc_pktbuf_init(); #endif #ifdef MODULE_GNRC_PKTDUMP DEBUG("Auto init gnrc_pktdump module.\n"); gnrc_pktdump_init(); #endif #ifdef MODULE_GNRC_SIXLOWPAN DEBUG("Auto init gnrc_sixlowpan module.\n"); gnrc_sixlowpan_init(); #endif #ifdef MODULE_GNRC_IPV6 DEBUG("Auto init gnrc_ipv6 module.\n"); gnrc_ipv6_init(); #endif #ifdef MODULE_GNRC_UDP DEBUG("Auto init UDP module.\n"); gnrc_udp_init(); #endif #ifdef MODULE_DHT DEBUG("Auto init DHT devices.\n"); extern void dht_auto_init(void); dht_auto_init(); #endif #ifdef MODULE_LWIP DEBUG("Bootstraping lwIP.\n"); lwip_bootstrap(); #endif #ifdef MODULE_GCOAP DEBUG("Auto init gcoap module.\n"); gcoap_init(); #endif /* initialize network devices */ #ifdef MODULE_AUTO_INIT_GNRC_NETIF #ifdef MODULE_AT86RF2XX extern void auto_init_at86rf2xx(void); auto_init_at86rf2xx(); #endif #ifdef MODULE_ATA8510 extern void auto_init_ata8510(void); auto_init_ata8510(); #endif #ifdef MODULE_CC2420 extern void auto_init_cc2420(void); auto_init_cc2420(); #endif #ifdef MODULE_ENCX24J600 extern void auto_init_encx24j600(void); auto_init_encx24j600(); #endif #ifdef MODULE_ENC28J60 extern void auto_init_enc28j60(void); auto_init_enc28j60(); #endif #ifdef MODULE_ETHOS extern void auto_init_ethos(void); auto_init_ethos(); #endif #ifdef MODULE_GNRC_SLIP extern void auto_init_slip(void); auto_init_slip(); #endif #ifdef MODULE_CC110X extern void auto_init_cc110x(void); auto_init_cc110x(); #endif #ifdef MODULE_CC2538_RF extern void auto_init_cc2538_rf(void); auto_init_cc2538_rf(); #endif #ifdef MODULE_XBEE extern void auto_init_xbee(void); auto_init_xbee(); #endif #ifdef MODULE_KW2XRF extern void auto_init_kw2xrf(void); auto_init_kw2xrf(); #endif #ifdef MODULE_NETDEV2_TAP extern void auto_init_netdev2_tap(void); auto_init_netdev2_tap(); #endif #ifdef MODULE_NORDIC_SOFTDEVICE_BLE extern void gnrc_nordic_ble_6lowpan_init(void); gnrc_nordic_ble_6lowpan_init(); #endif #ifdef MODULE_NRFMIN extern void gnrc_nrfmin_init(void); gnrc_nrfmin_init(); #endif #ifdef MODULE_W5100 extern void auto_init_w5100(void); auto_init_w5100(); #endif #endif /* MODULE_AUTO_INIT_GNRC_NETIF */ #ifdef MODULE_GNRC_IPV6_NETIF gnrc_ipv6_netif_init_by_dev(); #endif #ifdef MODULE_GNRC_UHCPC extern void auto_init_gnrc_uhcpc(void); auto_init_gnrc_uhcpc(); #endif /* initialize sensors and actuators */ #ifdef MODULE_AUTO_INIT_SAUL DEBUG("auto_init SAUL\n"); #ifdef MODULE_SAUL_GPIO extern void auto_init_gpio(void); auto_init_gpio(); #endif #ifdef MODULE_SAUL_ADC extern void auto_init_adc(void); auto_init_adc(); #endif #ifdef MODULE_LSM303DLHC extern void auto_init_lsm303dlhc(void); auto_init_lsm303dlhc(); #endif #ifdef MODULE_LPS331AP extern void auto_init_lps331ap(void); auto_init_lps331ap(); #endif #ifdef MODULE_ISL29020 extern void auto_init_isl29020(void); auto_init_isl29020(); #endif #ifdef MODULE_L3G4200D extern void auto_init_l3g4200d(void); auto_init_l3g4200d(); #endif #ifdef MODULE_LIS3DH extern void auto_init_lis3dh(void); auto_init_lis3dh(); #endif #ifdef MODULE_MMA8652 extern void auto_init_mma8652(void); auto_init_mma8652(); #endif #ifdef MODULE_SI70XX extern void auto_init_si70xx(void); auto_init_si70xx(); #endif #ifdef MODULE_BMP180 extern void auto_init_bmp180(void); auto_init_bmp180(); #endif #ifdef MODULE_JC42 extern void auto_init_jc42(void); auto_init_jc42(); #endif #ifdef MODULE_HDC1000 extern void auto_init_hdc1000(void); auto_init_hdc1000(); #endif #endif /* MODULE_AUTO_INIT_SAUL */ #ifdef MODULE_AUTO_INIT_GNRC_RPL #ifdef MODULE_GNRC_RPL extern void auto_init_gnrc_rpl(void); auto_init_gnrc_rpl(); #endif #endif /* MODULE_AUTO_INIT_GNRC_RPL */ }
void auto_init(void) { #ifdef MODULE_CONFIG DEBUG("Auto init loading config\n"); config_load(); #endif #ifdef MODULE_XTIMER DEBUG("Auto init xtimer module.\n"); xtimer_init(); #endif #ifdef MODULE_RTC DEBUG("Auto init rtc module.\n"); rtc_init(); #endif #ifdef MODULE_SHT11 DEBUG("Auto init SHT11 module.\n"); sht11_init(); #endif #ifdef MODULE_GPIOINT DEBUG("Auto init gpioint module.\n"); gpioint_init(); #endif #ifdef MODULE_LTC4150 DEBUG("Auto init ltc4150 module.\n"); ltc4150_init(); #endif #ifdef MODULE_MCI DEBUG("Auto init mci module.\n"); MCI_initialize(); #endif #ifdef MODULE_PROFILING extern void profiling_init(void); profiling_init(); #endif #ifdef MODULE_GNRC_PKTBUF DEBUG("Auto init gnrc_pktbuf module\n"); gnrc_pktbuf_init(); #endif #ifdef MODULE_GNRC_PKTDUMP DEBUG("Auto init gnrc_pktdump module.\n"); gnrc_pktdump_init(); #endif #ifdef MODULE_GNRC_SIXLOWPAN DEBUG("Auto init gnrc_sixlowpan module.\n"); gnrc_sixlowpan_init(); #endif #ifdef MODULE_GNRC_IPV6 DEBUG("Auto init gnrc_ipv6 module.\n"); gnrc_ipv6_init(); #endif #ifdef MODULE_GNRC_UDP DEBUG("Auto init UDP module.\n"); gnrc_udp_init(); #endif /* initialize network devices */ #ifdef MODULE_AUTO_INIT_GNRC_NETIF #ifdef MODULE_AT86RF2XX extern void auto_init_at86rf2xx(void); auto_init_at86rf2xx(); #endif #ifdef MODULE_ENCX24J600 extern void auto_init_encx24j600(void); auto_init_encx24j600(); #endif #ifdef MODULE_GNRC_SLIP extern void auto_init_slip(void); auto_init_slip(); #endif #ifdef MODULE_XBEE extern void auto_init_xbee(void); auto_init_xbee(); #endif #ifdef MODULE_KW2XRF extern void auto_init_kw2xrf(void); auto_init_kw2xrf(); #endif #ifdef MODULE_NETDEV2_TAP extern void auto_init_netdev2_tap(void); auto_init_netdev2_tap(); #endif #endif /* MODULE_AUTO_INIT_GNRC_NETIF */ #ifdef MODULE_GNRC_IPV6_NETIF gnrc_ipv6_netif_init_by_dev(); #endif }
void auto_init(void) { #ifdef MODULE_PRNG void auto_init_random(void); auto_init_random(); #endif #ifdef MODULE_XTIMER DEBUG("Auto init xtimer module.\n"); xtimer_init(); #endif #ifdef MODULE_MCI DEBUG("Auto init mci module.\n"); mci_initialize(); #endif #ifdef MODULE_PROFILING extern void profiling_init(void); profiling_init(); #endif #ifdef MODULE_GNRC_PKTBUF DEBUG("Auto init gnrc_pktbuf module\n"); gnrc_pktbuf_init(); #endif #ifdef MODULE_GNRC_PKTDUMP DEBUG("Auto init gnrc_pktdump module.\n"); gnrc_pktdump_init(); #endif #ifdef MODULE_GNRC_SIXLOWPAN DEBUG("Auto init gnrc_sixlowpan module.\n"); gnrc_sixlowpan_init(); #endif #ifdef MODULE_GNRC_IPV6 DEBUG("Auto init gnrc_ipv6 module.\n"); gnrc_ipv6_init(); #endif #ifdef MODULE_GNRC_UDP DEBUG("Auto init UDP module.\n"); gnrc_udp_init(); #endif #ifdef MODULE_GNRC_TCP DEBUG("Auto init TCP module\n"); gnrc_tcp_init(); #endif #ifdef MODULE_LWIP DEBUG("Bootstraping lwIP.\n"); lwip_bootstrap(); #endif #ifdef MODULE_OPENTHREAD extern void openthread_bootstrap(void); openthread_bootstrap(); #endif #ifdef MODULE_GCOAP DEBUG("Auto init gcoap module.\n"); gcoap_init(); #endif #ifdef MODULE_DEVFS DEBUG("Mounting /dev\n"); extern void auto_init_devfs(void); auto_init_devfs(); #endif #ifdef MODULE_GNRC_IPV6_NIB DEBUG("Auto init gnrc_ipv6_nib module.\n"); gnrc_ipv6_nib_init(); #endif #ifdef MODULE_SKALD DEBUG("Auto init Skald\n"); skald_init(); #endif #ifdef MODULE_RDCLI_COMMON DEBUG("Auto init rdcli_common module\n"); extern void rdcli_common_init(void); rdcli_common_init(); #endif #ifdef MODULE_RDCLI_SIMPLE_STANDALONE DEBUG("Auto init rdcli_simple module\n"); extern void rdcli_simple_run(void); rdcli_simple_run(); #endif #ifdef MODULE_ASYMCUTE DEBUG("Auto init Asymcute\n"); asymcute_handler_run(); #endif /* initialize network devices */ #ifdef MODULE_AUTO_INIT_GNRC_NETIF #ifdef MODULE_AT86RF2XX extern void auto_init_at86rf2xx(void); auto_init_at86rf2xx(); #endif #ifdef MODULE_MRF24J40 extern void auto_init_mrf24j40(void); auto_init_mrf24j40(); #endif #ifdef MODULE_CC2420 extern void auto_init_cc2420(void); auto_init_cc2420(); #endif #ifdef MODULE_ENCX24J600 extern void auto_init_encx24j600(void); auto_init_encx24j600(); #endif #ifdef MODULE_ENC28J60 extern void auto_init_enc28j60(void); auto_init_enc28j60(); #endif #ifdef MODULE_ETHOS extern void auto_init_ethos(void); auto_init_ethos(); #endif #ifdef MODULE_SLIPDEV extern void auto_init_slipdev(void); auto_init_slipdev(); #endif #ifdef MODULE_CC110X extern void auto_init_cc110x(void); auto_init_cc110x(); #endif #ifdef MODULE_CC2538_RF extern void auto_init_cc2538_rf(void); auto_init_cc2538_rf(); #endif #ifdef MODULE_XBEE extern void auto_init_xbee(void); auto_init_xbee(); #endif #ifdef MODULE_KW2XRF extern void auto_init_kw2xrf(void); auto_init_kw2xrf(); #endif #ifdef MODULE_NETDEV_TAP extern void auto_init_netdev_tap(void); auto_init_netdev_tap(); #endif #ifdef MODULE_SOCKET_ZEP extern void auto_init_socket_zep(void); auto_init_socket_zep(); #endif #ifdef MODULE_NORDIC_SOFTDEVICE_BLE extern void gnrc_nordic_ble_6lowpan_init(void); gnrc_nordic_ble_6lowpan_init(); #endif #ifdef MODULE_NRFMIN extern void gnrc_nrfmin_init(void); gnrc_nrfmin_init(); #endif #ifdef MODULE_W5100 extern void auto_init_w5100(void); auto_init_w5100(); #endif #ifdef MODULE_SX127X extern void auto_init_sx127x(void); auto_init_sx127x(); #endif #endif /* MODULE_AUTO_INIT_GNRC_NETIF */ #ifdef MODULE_GNRC_UHCPC extern void auto_init_gnrc_uhcpc(void); auto_init_gnrc_uhcpc(); #endif /* initialize NDN module after the network devices are initialized */ #ifdef MODULE_NDN_RIOT DEBUG("Auto init NDN module.\n"); ndn_init(); #endif /* initialize sensors and actuators */ #ifdef MODULE_SHT1X DEBUG("Auto init SHT1X module (SHT10/SHT11/SHT15 sensor driver).\n"); extern void auto_init_sht1x(void); auto_init_sht1x(); #endif #ifdef MODULE_AUTO_INIT_SAUL DEBUG("auto_init SAUL\n"); #ifdef MODULE_SAUL_GPIO extern void auto_init_gpio(void); auto_init_gpio(); #endif #ifdef MODULE_SAUL_ADC extern void auto_init_adc(void); auto_init_adc(); #endif #ifdef MODULE_LSM303DLHC extern void auto_init_lsm303dlhc(void); auto_init_lsm303dlhc(); #endif #ifdef MODULE_LPS331AP extern void auto_init_lps331ap(void); auto_init_lps331ap(); #endif #ifdef MODULE_ISL29020 extern void auto_init_isl29020(void); auto_init_isl29020(); #endif #ifdef MODULE_L3G4200D extern void auto_init_l3g4200d(void); auto_init_l3g4200d(); #endif #ifdef MODULE_LIS3DH extern void auto_init_lis3dh(void); auto_init_lis3dh(); #endif #ifdef MODULE_LIS3MDL extern void auto_init_lis3mdl(void); auto_init_lis3mdl(); #endif #ifdef MODULE_MAG3110 extern void auto_init_mag3110(void); auto_init_mag3110(); #endif #ifdef MODULE_MMA8X5X extern void auto_init_mma8x5x(void); auto_init_mma8x5x(); #endif #ifdef MODULE_MPL3115A2 extern void auto_init_mpl3115a2(void); auto_init_mpl3115a2(); #endif #ifdef MODULE_MPU9150 extern void auto_init_mpu9150(void); auto_init_mpu9150(); #endif #ifdef MODULE_GROVE_LEDBAR extern void auto_init_grove_ledbar(void); auto_init_grove_ledbar(); #endif #ifdef MODULE_PIR extern void auto_init_pir(void); auto_init_pir(); #endif #ifdef MODULE_SI70XX extern void auto_init_si70xx(void); auto_init_si70xx(); #endif #ifdef MODULE_BMP180 extern void auto_init_bmp180(void); auto_init_bmp180(); #endif #ifdef MODULE_BMX055 extern void auto_init_bmx055(void); auto_init_bmx055(); #endif #if defined(MODULE_BME280) || defined(MODULE_BMP280) extern void auto_init_bmx280(void); auto_init_bmx280(); #endif #ifdef MODULE_JC42 extern void auto_init_jc42(void); auto_init_jc42(); #endif #ifdef MODULE_TSL2561 extern void auto_init_tsl2561(void); auto_init_tsl2561(); #endif #ifdef MODULE_PULSE_COUNTER extern void auto_init_pulse_counter(void); auto_init_pulse_counter(); #endif #ifdef MODULE_HDC1000 extern void auto_init_hdc1000(void); auto_init_hdc1000(); #endif #ifdef MODULE_FXOS8700 extern void auto_init_fxos8700(void); auto_init_fxos8700(); #endif #ifdef MODULE_HTS221 extern void auto_init_hts221(void); auto_init_hts221(); #endif #ifdef MODULE_DHT extern void auto_init_dht(void); auto_init_dht(); #endif #ifdef MODULE_TMP006 extern void auto_init_tmp006(void); auto_init_tmp006(); #endif #ifdef MODULE_TCS37727 extern void auto_init_tcs37727(void); auto_init_tcs37727(); #endif #ifdef MODULE_VEML6070 extern void auto_init_veml6070(void); auto_init_veml6070(); #endif #ifdef MODULE_IO1_XPLAINED extern void auto_init_io1_xplained(void); auto_init_io1_xplained(); #endif #ifdef MODULE_ADXL345 extern void auto_init_adxl345(void); auto_init_adxl345(); #endif #ifdef MODULE_LSM6DSL extern void auto_init_lsm6dsl(void); auto_init_lsm6dsl(); #endif #ifdef MODULE_ADCXX1C extern void auto_init_adcxx1c(void); auto_init_adcxx1c(); #endif #ifdef MODULE_ADS101X extern void auto_init_ads101x(void); auto_init_ads101x(); #endif #ifdef MODULE_LIS2DH12 extern void auto_init_lis2dh12(void); auto_init_lis2dh12(); #endif #ifdef MODULE_SI114X extern void auto_init_si114x(void); auto_init_si114x(); #endif #ifdef MODULE_MMA7660 extern void auto_init_mma7660(void); auto_init_mma7660(); #endif #endif /* MODULE_AUTO_INIT_SAUL */ #ifdef MODULE_AUTO_INIT_GNRC_RPL #ifdef MODULE_GNRC_RPL extern void auto_init_gnrc_rpl(void); auto_init_gnrc_rpl(); #endif #endif /* MODULE_AUTO_INIT_GNRC_RPL */ /* initialize storage devices */ #ifdef MODULE_AUTO_INIT_STORAGE DEBUG("auto_init STORAGE\n"); #ifdef MODULE_SDCARD_SPI extern void auto_init_sdcard_spi(void); auto_init_sdcard_spi(); #endif #endif /* MODULE_AUTO_INIT_STORAGE */ #ifdef MODULE_AUTO_INIT_CAN DEBUG("auto_init CAN\n"); extern void auto_init_candev(void); auto_init_candev(); #endif /* MODULE_AUTO_INIT_CAN */ }
void board_init(void) { int status; /* initialize the boards LEDs */ gpio_init(LED0_PIN, GPIO_OUT); gpio_init(LED1_PIN, GPIO_OUT); gpio_init(LED2_PIN, GPIO_OUT); /* Initialize power control pins */ power_pins_init(); /* Turn on Vperiph for peripherals */ /* * By turning on Vperiph first, and before waiting for the clocks to * stabilize, we will have used enough time to have let the FRAM start up * properly when we want to access it later without having to add any extra * delays. */ gpio_set(MULLE_POWER_VPERIPH); /* Turn on AVDD for reading voltages */ gpio_set(MULLE_POWER_AVDD); /* Initialize RTC oscillator as early as possible since we are using it as a * base clock for the FLL. * It takes a while to stabilize the oscillator, therefore we do this as * soon as possible during boot in order to let it stabilize while other * stuff is initializing. */ /* If the clock is not stable then the UART will have the wrong baud rate * for debug prints as well */ rtt_init(); /* Set up clocks */ set_safe_clock_dividers(); set_fll_source(); kinetis_mcg_set_mode(KINETIS_MCG_FEE); /* At this point we need to wait for 1 ms until the clock is stable. * Since the clock is not yet stable we can only guess how long we must * wait. I have tried to make this as short as possible but still being able * to read the initialization messages written on the UART. * (If the clock is not stable all UART output is garbled until it has * stabilized) */ for (int i = 0; i < 100000; ++i) { __asm__ volatile("nop\n"); } /* Update SystemCoreClock global var */ SystemCoreClockUpdate(); /* initialize the CPU */ cpu_init(); /* NVRAM requires xtimer for timing */ xtimer_init(); /* Initialize NVRAM */ status = mulle_nvram_init(); if (status == 0) { /* Increment boot counter */ increase_boot_count(); } }
void auto_init(void) { #ifdef MODULE_CONFIG DEBUG("Auto init loading config\n"); config_load(); #endif #ifdef MODULE_XTIMER DEBUG("Auto init xtimer module.\n"); xtimer_init(); #endif #ifdef MODULE_RTC DEBUG("Auto init rtc module.\n"); rtc_init(); #endif #ifdef MODULE_SHT11 DEBUG("Auto init SHT11 module.\n"); sht11_init(); #endif #ifdef MODULE_GPIOINT DEBUG("Auto init gpioint module.\n"); gpioint_init(); #endif #ifdef MODULE_LTC4150 DEBUG("Auto init ltc4150 module.\n"); ltc4150_init(); #endif #ifdef MODULE_MCI DEBUG("Auto init mci module.\n"); MCI_initialize(); #endif #ifdef MODULE_PROFILING extern void profiling_init(void); profiling_init(); #endif #ifdef MODULE_GNRC_PKTBUF DEBUG("Auto init gnrc_pktbuf module\n"); gnrc_pktbuf_init(); #endif #ifdef MODULE_GNRC_PKTDUMP DEBUG("Auto init gnrc_pktdump module.\n"); gnrc_pktdump_init(); #endif #ifdef MODULE_GNRC_SIXLOWPAN DEBUG("Auto init gnrc_sixlowpan module.\n"); gnrc_sixlowpan_init(); #endif #ifdef MODULE_GNRC_IPV6 DEBUG("Auto init gnrc_ipv6 module.\n"); gnrc_ipv6_init(); #endif #ifdef MODULE_GNRC_UDP DEBUG("Auto init UDP module.\n"); gnrc_udp_init(); #endif /* initialize network devices */ #ifdef MODULE_AUTO_INIT_GNRC_NETIF #ifdef MODULE_AT86RF2XX extern void auto_init_at86rf2xx(void); auto_init_at86rf2xx(); #endif #ifdef MODULE_ENCX24J600 extern void auto_init_encx24j600(void); auto_init_encx24j600(); #endif #ifdef MODULE_ENC28J60 extern void auto_init_enc28j60(void); auto_init_enc28j60(); #endif #ifdef MODULE_GNRC_SLIP extern void auto_init_slip(void); auto_init_slip(); #endif #ifdef MODULE_CC110X extern void auto_init_cc110x(void); auto_init_cc110x(); #endif #ifdef MODULE_XBEE extern void auto_init_xbee(void); auto_init_xbee(); #endif #ifdef MODULE_KW2XRF extern void auto_init_kw2xrf(void); auto_init_kw2xrf(); #endif #ifdef MODULE_NETDEV2_TAP extern void auto_init_netdev2_tap(void); auto_init_netdev2_tap(); #endif #endif /* MODULE_AUTO_INIT_GNRC_NETIF */ #ifdef MODULE_GNRC_IPV6_NETIF gnrc_ipv6_netif_init_by_dev(); #endif /* initialize sensors and actuators */ #ifdef MODULE_AUTO_INIT_SAUL DEBUG("auto_init SAUL\n"); #ifdef MODULE_SAUL_GPIO extern void auto_init_gpio(void); auto_init_gpio(); #endif #ifdef MODULE_LSM303DLHC extern void auto_init_lsm303dlhc(void); auto_init_lsm303dlhc(); #endif #ifdef MODULE_LPS331AP extern void auto_init_lps331ap(void); auto_init_lps331ap(); #endif #ifdef MODULE_ISL29020 extern void auto_init_isl29020(void); auto_init_isl29020(); #endif #ifdef MODULE_L3G4200D extern void auto_init_l3g4200d(void); auto_init_l3g4200d(); #endif #endif /* MODULE_AUTO_INIT_SAUL */ }