@@ -130,39 +130,52 @@ void PIOS_Board_Init(void)
130130 }
131131
132132 /* Set up the SPI interface to the flash and rfm22b */
133+ //if (PIOS_SPI_Init(&pios_spi_telem_flash_adapter_id, &pios_spi_telem_flash_cfg)) {
134+ // PIOS_DEBUG_Assert(0);
135+ //}
136+ /* Set up the SPI interface to the tfcard and rfm22b */
133137 if (PIOS_SPI_Init (& pios_spi_telem_flash_adapter_id , & pios_spi_telem_flash_cfg )) {
134138 PIOS_DEBUG_Assert (0 );
135139 }
136140
137141#if defined(PIOS_INCLUDE_FLASH )
138142 /* Connect flash to the appropriate interface and configure it */
139- uintptr_t flash_id ;
143+ // uintptr_t flash_id;
140144
141145 // Initialize the external USER flash
142- if (PIOS_Flash_Jedec_Init (& flash_id , pios_spi_telem_flash_adapter_id , 1 )) {
143- PIOS_DEBUG_Assert (0 );
144- }
146+ // if (PIOS_Flash_Jedec_Init(&flash_id, pios_spi_telem_flash_adapter_id, 1)) {
147+ // PIOS_DEBUG_Assert(0);
148+ // }
149+
150+ // if (PIOS_FLASHFS_Logfs_Init(&pios_uavo_settings_fs_id, &flashfs_external_system_cfg, &pios_jedec_flash_driver, flash_id)) {
151+ // PIOS_DEBUG_Assert(0);
152+ // }
145153
146- if (PIOS_FLASHFS_Logfs_Init (& pios_uavo_settings_fs_id , & flashfs_external_system_cfg , & pios_jedec_flash_driver , flash_id )) {
147- PIOS_DEBUG_Assert (0 );
148- }
149154#endif /* if defined(PIOS_INCLUDE_FLASH) */
150155
156+ #if defined(PIOS_INCLUDE_SDCARD )
157+ /* Enable and mount the SDCard */
158+ // SPI is initialized above
159+ PIOS_SDCARD_Init (pios_spi_telem_flash_adapter_id /*TODO: use flash is stupid!*/ );
160+ PIOS_SDCARD_MountFS (0 );
161+ PIOS_FLASHFS_Logfs_Init (& pios_uavo_settings_fs_id , NULL , NULL , 0 );
162+ #endif
163+
151164#if defined(PIOS_INCLUDE_RTC )
152165 PIOS_RTC_Init (& pios_rtc_main_cfg );
153166#endif
154167
155168 /* IAP System Setup */
156169 PIOS_IAP_Init ();
157170 // check for safe mode commands from gcs
158- if (PIOS_IAP_ReadBootCmd (0 ) == PIOS_IAP_CLEAR_FLASH_CMD_0 &&
159- PIOS_IAP_ReadBootCmd (1 ) == PIOS_IAP_CLEAR_FLASH_CMD_1 &&
160- PIOS_IAP_ReadBootCmd (2 ) == PIOS_IAP_CLEAR_FLASH_CMD_2 ) {
161- PIOS_FLASHFS_Format (pios_uavo_settings_fs_id );
162- PIOS_IAP_WriteBootCmd (0 , 0 );
163- PIOS_IAP_WriteBootCmd (1 , 0 );
164- PIOS_IAP_WriteBootCmd (2 , 0 );
165- }
171+ // if (PIOS_IAP_ReadBootCmd(0) == PIOS_IAP_CLEAR_FLASH_CMD_0 &&
172+ // PIOS_IAP_ReadBootCmd(1) == PIOS_IAP_CLEAR_FLASH_CMD_1 &&
173+ // PIOS_IAP_ReadBootCmd(2) == PIOS_IAP_CLEAR_FLASH_CMD_2) {
174+ // PIOS_FLASHFS_Format(pios_uavo_settings_fs_id);
175+ // PIOS_IAP_WriteBootCmd(0, 0);
176+ // PIOS_IAP_WriteBootCmd(1, 0);
177+ // PIOS_IAP_WriteBootCmd(2, 0);
178+ // }
166179
167180#ifdef PIOS_INCLUDE_WDG
168181 PIOS_WDG_Init ();
@@ -232,9 +245,12 @@ void PIOS_Board_Init(void)
232245
233246 /* Moved this here to allow DSM binding on flexiport */
234247#if defined(PIOS_INCLUDE_FLASH )
235- if (PIOS_FLASHFS_Logfs_Init (& pios_user_fs_id , & flashfs_external_user_cfg , & pios_jedec_flash_driver , flash_id )) {
236- PIOS_DEBUG_Assert (0 );
237- }
248+ //if (PIOS_FLASHFS_Logfs_Init(&pios_user_fs_id, &flashfs_external_user_cfg, &pios_jedec_flash_driver, flash_id)) {
249+ // PIOS_DEBUG_Assert(0);
250+ //}
251+ //if (PIOS_FLASHFS_Logfs_Init(&pios_user_fs_id, &flashfs_external_user_cfg, &pios_jedec_flash_driver, 0)) {
252+ // PIOS_DEBUG_Assert(0);
253+ //}
238254#endif /* if defined(PIOS_INCLUDE_FLASH) */
239255
240256
0 commit comments