MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_init_thread_entry

Function rt_init_thread_entry

bsp/mini4020/applications/application.c:39–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37#define RT_INIT_THREAD_STACK_SIZE (2*1024)
38
39void rt_init_thread_entry(void *parameter)
40{
41 int fd;
42 rt_uint32_t sz;
43 char buffer[20];
44#ifdef RT_USING_DFS
45 dfs_init();
46#ifdef RT_USING_DFS_ELMFAT
47 elm_init();
48 /* mount sd card fat partition 1 as root directory */
49 if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
50 {
51 rt_kprintf("File System initialized!\n");
52
53 /*Open a file*/
54 fd = open("/fattest.txt", O_RDWR|O_CREAT, 0);
55 if (fd < 0)
56 {
57 rt_kprintf("open file for write failed\n");
58 return;
59 }
60
61 sz = write(fd,"Hello RT-Thread!",sizeof("Hello RT-Thread!"));
62
63 if (sz != 0)
64 {
65 rt_kprintf("written %d\n",sz);
66 }
67 else
68 rt_kprintf("haven't written\n");
69
70 lseek(fd, 0, SEEK_SET);
71
72 sz = read(fd, buffer, sizeof(buffer));
73
74 if (sz != 0)
75 {
76 rt_kprintf("READ %d:",sz);
77 while (sz--)
78 rt_kprintf("%c",buffer[sz]);//opposite
79 rt_kprintf("\n");
80 }
81 else
82 rt_kprintf("haven't read\n");
83
84 close(fd);
85 }
86 else
87 rt_kprintf("File System initialzation failed!\n");
88#endif
89#endif
90}
91
92void rt_led_thread_entry(void *parameter)
93{

Callers

nothing calls this directly

Calls 9

rt_kprintfFunction · 0.85
dfs_initFunction · 0.50
elm_initFunction · 0.50
dfs_mountFunction · 0.50
openFunction · 0.50
writeFunction · 0.50
lseekFunction · 0.50
readFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected