首先,分配内存的时间必须是确定的。一般内存管理算法是根据需要存储的数据的长度在内存中去寻找一个与这...
(level); rt_set_errno(-RT_ETIMEOUT); return RT_NULL; } RT_DEBUG_NOT_IN_INTERRUPT; thread->error = RT_EOK; /* need suspend thread */ rt_thread_suspend(thread); rt_list_insert_after(&(mp->suspend_thread), &(thread->tlist)); mp->suspend_thread_count++; if (time > 0) { /...
8 rt_free(fullpath); 9 rt_set_errno(-ENOTDIR); 10 11 return -1; 12 } 13 dfs_file_close(&fd); 14 } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 6.1.2 注册devfs文件系统 如果开启了DFS,devfs设备文件系统会在dfs_init()里自动初始化和挂载。 1#ifdef RT_USING_DFS_...
if(fullpath==NULL)/* not an abstract path */{rt_set_errno(-ENOTDIR);return-1;}/* Check if the path exists or not, raw APIs call, fixme */if((strcmp(fullpath,"/")!=0)&&(strcmp(fullpath,"/dev")!=0)){structdfs_fdfd;if(dfs_file_open(&fd,fullpath,O_RDONLY|O_DIRECTORY)<0)...
/* Check if the path exists or not, raw APIs call, fixme */if((strcmp(fullpath,"/")!=0)&&(strcmp(fullpath,"/dev")!=0)){struct dfs_fd fd;if(dfs_file_open(&fd,fullpath,O_RDONLY|O_DIRECTORY)<0){rt_free(fullpath);rt_set_errno(-ENOTDIR);return-1;}dfs_file_close(&fd);}...
rt_set_errno(-RT_ENOSYS); return 0; } static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args) { dbg_log(DBG_LOG, "rt_imxrt_eth_control...\n"); switch (cmd) { case NIOCTL_GADDR: /* get mac address */ if (args) ...
9 rt_set_errno(-ENOTDIR); 10 11 return -1; 12 } 13 dfs_file_close(&fd); 14 } 6.1.2 注册devfs文件系统 如果开启了DFS,devfs设备文件系统会在dfs_init()里自动初始化和挂载。 1#ifdef RT_USING_DFS_DEVFS 2 { 3 extern int devfs_init(void); 4 ...
rt_device_t rt_console_set_device(const char* name); void rt_kprintf(const char *fmt, ...); rt_err_t rt_get_errno(void); void rt_set_errno(rt_err_t no); void* rt_memset(void *src, int c, rt_ubase_t n); void* rt_memcpy(void *dest, const void *src, rt_ubase_t n)...
rt_set_errno => 0x0800f185 _rt_errno => 0x0800f1c5 rt_memset => 0x0800f1f9 rt_memcpy => 0x0800f2b1 rt_memmove => 0x0800f385 rt_memcmp => 0x0800f409 rt_strstr => 0x0800f461 rt_strcasecmp => 0x0800f4c1 rt_strncpy => 0x0800f525 ...
0 需要读取当前线程的 errno 来判断错误状态 */ rt_size_t rt_device_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) 调用这个函数,会从 dev 设备中读取数据,并存放在 buffer 缓冲区中,这个缓冲区的最大长度是 size,pos 根据不同的设备类别有不同的意义。