[BSP][at91sam9260] Cleanup Code.

This commit is contained in:
weety 2017-10-21 17:37:10 +08:00
parent 82ca200ff5
commit ecc8db0cd6
1 changed files with 16 additions and 8 deletions

View File

@ -48,6 +48,8 @@ static int rt_led_app_init(void);
int main(void) int main(void)
{ {
int timeout = 0;
/* Filesystem Initialization */ /* Filesystem Initialization */
#ifdef RT_USING_DFS #ifdef RT_USING_DFS
{ {
@ -74,21 +76,27 @@ int main(void)
rt_mmcsd_core_init(); rt_mmcsd_core_init();
rt_mmcsd_blk_init(); rt_mmcsd_blk_init();
at91_mci_init(); at91_mci_init();
rt_thread_delay(RT_TICK_PER_SECOND*2); timeout = 0;
/* mount sd card fat partition 1 as root directory */ while ((rt_device_find("sd0") == RT_NULL) && (timeout++ < RT_TICK_PER_SECOND*2))
{
rt_thread_delay(1);
}
if (timeout < RT_TICK_PER_SECOND*2)
{
/* mount sd card fat partition 1 as root directory */
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
{ {
rt_kprintf("File System initialized!\n"); rt_kprintf("File System initialized!\n");
} }
else else
rt_kprintf("File System initialzation failed!\n"); rt_kprintf("File System initialzation failed!%d\n", rt_get_errno());
#endif }
else
{
rt_kprintf("No SD card found.\n");
} }
#endif #endif
#ifdef RT_USING_I2C
{
rt_i2c_core_init();
} }
#endif #endif