Sfoglia il codice sorgente

!430 [BSP] 整理文件、代码
Merge pull request !430 from bernard/bernard_rt-smart

bernard 4 anni fa
parent
commit
1ce0a6ccb2

+ 22 - 6
bsp/imx6ull-artpi-smart/applications/filesystem.c → bsp/imx6ull-artpi-smart/applications/init_sdtask.c

@@ -1,5 +1,15 @@
+/*
+ * Copyright (c) 2006-2022, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ */
 #include <rtthread.h>
 
+#if defined(RT_USING_DFS)
+
 #include <dfs_fs.h>
 #include <ioremap.h>
 #include <drv_sdio.h>
@@ -21,6 +31,7 @@ static void _sdcard_mount(void)
         rt_thread_mdelay(10);
         device = rt_device_find("sd0");
     }
+
     if (device != RT_NULL)
     {
         if (dfs_mount("sd0", "/mnt", "elm", 0, 0) == RT_EOK)
@@ -45,11 +56,13 @@ static void _sdcard_unmount(void)
     mmcsd_wait_cd_changed(RT_WAITING_FOREVER);
 }
 
-static void sd_mount(void *parameter)
+static void sd_task_entry(void *parameter)
 {
     volatile unsigned int *IN_STATUS;
+
     IN_STATUS = (volatile unsigned int *)rt_ioremap((void *)0x2190030, 4);
-    rt_thread_mdelay(20);
+
+    rt_thread_mdelay(200);
     if (dfs_mount("sd0", "/mnt", "elm", 0, 0) == RT_EOK)
     {
         LOG_I("sd card mount to '/mnt'");
@@ -58,6 +71,7 @@ static void sd_mount(void *parameter)
     {
         LOG_W("sd card mount to '/mnt' failed!");
     }
+
     while (1)
     {
         rt_thread_mdelay(200);
@@ -75,11 +89,10 @@ static void sd_mount(void *parameter)
     }
 }
 
-int sd_task(void)
+int sd_task_init(void)
 {
-
     rt_thread_t tid;
-    tid = rt_thread_create("sd_mount", sd_mount, RT_NULL,
+    tid = rt_thread_create("tsdcard", sd_task_entry, RT_NULL,
                            2048, RT_THREAD_PRIORITY_MAX - 2, 20);
     if (tid != RT_NULL)
     {
@@ -87,8 +100,11 @@ int sd_task(void)
     }
     else
     {
-        LOG_E("create sd_mount thread err!");
+        LOG_E("create sd mount task error!");
     }
+
     return RT_EOK;
 }
+INIT_APP_EXPORT(sd_task_init);
 
+#endif

+ 26 - 0
bsp/imx6ull-artpi-smart/applications/init_udb.c

@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2006-2022, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2022/01/20     bernard      the first version
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <rtthread.h>
+
+#ifdef PKG_USING_UDBD
+#include <udbd.h>
+
+int udbd_system_init(void)
+{
+    udbd_init(UDBD_LINK_SOCKET, "e1");
+    return 0;
+}
+INIT_APP_EXPORT(udbd_system_init);
+#endif

+ 34 - 0
bsp/imx6ull-artpi-smart/applications/init_wifi.c

@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2006-2022, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2022/01/20     bernard      the first version
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <rtthread.h>
+
+#ifdef PKG_USING_RW007
+#define WIFI_SH_PATH "/sd/wifi.sh"
+
+int rw007_wifi_init(void)
+{
+    if (access(WIFI_SH_PATH, 0) != -1)
+    {
+        msh_exec(WIFI_SH_PATH, rt_strlen(WIFI_SH_PATH));   
+    }
+    else
+    {
+        rt_kprintf("%s wi-fi configuration file not exist in sd card!\n", WIFI_SH_PATH);
+    }
+    
+    return 0
+}
+INIT_APP_EXPORT(rw007_wifi_init);
+#endif

+ 0 - 1
bsp/imx6ull-artpi-smart/applications/main.c

@@ -16,4 +16,3 @@ int main(void)
     printf("hello rt-smart\n");
     return 0;
 }
-

+ 15 - 6
bsp/imx6ull-artpi-smart/applications/mnt.c

@@ -17,17 +17,28 @@
 int mnt_init(void)
 {
 #ifdef RT_USING_SDIO2
-    int part_id = 1;
     rt_thread_mdelay(500);
 
-    if (dfs_mount("emmc","/","ext",0,(void *)part_id) != 0)
+    int part_id = 3;
+    if (dfs_mount("emmc","/","elm",0,(void *)part_id) != 0)
     {
-        rt_kprintf("Dir / mount failed!\n");
+        rt_kprintf("Dir / emmc mount failed!\n");
         return -1;
     }
     else
     {
-        rt_kprintf("file system initialization done!\n");
+        rt_kprintf("emmc file system initialization done!\n");
+    }
+
+    part_id = 1;
+    if (dfs_mount("sd0","/sd","elm",0,(void *)part_id) != 0)
+    {
+        rt_kprintf("Dir / sd0 mount failed!\n");
+        return -1;
+    }
+    else
+    {
+        rt_kprintf("sd0 file system initialization done!\n");
     }
 #else
     rt_thread_mdelay(500);
@@ -37,12 +48,10 @@ int mnt_init(void)
         return -1;
     }
 
-    sd_task();
     rt_kprintf("file system initialization done!\n");
 #endif
     return 0;
 }
 INIT_APP_EXPORT(mnt_init);
 
-
 #endif