int stm32_bringup(void) { #ifdef HAVE_RTC_DRIVER FAR struct rtc_lowerhalf_s *lower; #endif int ret = OK; #ifdef CONFIG_ZEROCROSS /* Configure the zero-crossing driver */ stm32_zerocross_initialize(); #endif #ifdef CONFIG_RGBLED /* Configure the RGB LED driver */ stm32_rgbled_setup(); #endif #if defined(CONFIG_PCA9635PW) /* Initialize the PCA9635 chip */ ret = stm32_pca9635_initialize(); if (ret < 0) { sdbg("ERROR: stm32_pca9635_initialize failed: %d\n", ret); } #endif #ifdef HAVE_SDIO /* Initialize the SDIO block driver */ ret = stm32_sdio_initialize(); if (ret != OK) { fdbg("ERROR: Failed to initialize MMC/SD driver: %d\n", ret); return ret; } #endif #ifdef HAVE_USBHOST /* Initialize USB host operation. stm32_usbhost_initialize() starts a thread * will monitor for USB connection and disconnection events. */ ret = stm32_usbhost_initialize(); if (ret != OK) { udbg("ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif #ifdef HAVE_USBMONITOR /* Start the USB Monitor */ ret = usbmonitor_start(0, NULL); if (ret != OK) { udbg("ERROR: Failed to start USB monitor: %d\n", ret); return ret; } #endif #ifdef HAVE_RTC_DRIVER /* Instantiate the STM32 lower-half RTC driver */ lower = stm32_rtc_lowerhalf(); if (!lower) { sdbg("ERROR: Failed to instantiate the RTC lower-half driver\n"); return -ENOMEM; } else { /* Bind the lower half driver and register the combined RTC driver * as /dev/rtc0 */ ret = rtc_initialize(0, lower); if (ret < 0) { sdbg("ERROR: Failed to bind/register the RTC driver: %d\n", ret); return ret; } } #endif #ifdef HAVE_ELF /* Initialize the ELF binary loader */ ret = elf_initialize(); if (ret < 0) { sdbg("ERROR: Initialization of the ELF loader failed: %d\n", ret); } #endif #ifdef CONFIG_MAX31855 ret = stm32_max31855initialize("/dev/temp0"); #endif #ifdef CONFIG_MAX6675 ret = stm32_max6675initialize("/dev/temp0"); #endif #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { sdbg("ERROR: Failed to mount procfs at %s: %d\n", STM32_PROCFS_MOUNTPOINT, ret); } #endif return ret; }
int stm32_bringup(void) { #ifdef CONFIG_ONESHOT struct oneshot_lowerhalf_s *os = NULL; #endif int ret = OK; #ifdef CONFIG_PWM /* Initialize PWM and register the PWM device. */ ret = stm32_pwm_setup(); if (ret < 0) { syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); } #endif #ifdef CONFIG_AUDIO_TONE /* Configure and initialize the tone generator. */ ret = stm32_tone_setup(); if (ret < 0) { syslog(LOG_ERR, "ERROR: stm32_tone_setup() failed: %d\n", ret); } #endif #ifdef CONFIG_RGBLED /* Configure and initialize the RGB LED. */ ret = stm32_rgbled_setup(); if (ret < 0) { syslog(LOG_ERR, "ERROR: stm32_rgbled_setup() failed: %d\n", ret); } #endif #ifdef CONFIG_CL_MFRC522 ret = stm32_mfrc522initialize("/dev/rfid0"); if (ret < 0) { syslog(LOG_ERR, "ERROR: stm32_mfrc522initialize() failed: %d\n", ret); } #endif #ifdef CONFIG_ONESHOT os = oneshot_initialize(1, 10); if (os) { ret = oneshot_register("/dev/oneshot", os); } #endif #ifdef CONFIG_BUTTONS /* Register the BUTTON driver */ ret = btn_lower_initialize("/dev/buttons"); if (ret < 0) { syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret); } #endif #ifdef CONFIG_USERLED /* Register the LED driver */ ret = userled_lower_initialize("/dev/userleds"); if (ret < 0) { syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); } #endif #ifdef CONFIG_VEML6070 /* Register the UV-A light sensor */ ret = stm32_veml6070initialize("/dev/uvlight0"); if (ret < 0) { syslog(LOG_ERR, "ERROR: stm32_veml6070initialize() failed: %d\n", ret); } #endif return ret; }