diff options
| author | guo <[email protected]> | 2022-12-03 12:07:44 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-12-03 12:07:44 +0800 |
| commit | ecf2d8215961ca7c539132b62a72df6072cc3e14 (patch) | |
| tree | 59005f0f74f2593c0435059264f624c862a89f55 /components/fal/src | |
| parent | aaf5462c6d4ae9466a0a8cd2a4bb00cfe1fef2f2 (diff) | |
sync branch rt-smart. (#6641)
* Synchronize the code of the rt mart branch to the master branch.
* TTY device
* Add lwP code from rt-smart
* Add vnode in DFS, but DFS will be re-write for rt-smart
* There are three libcpu for rt-smart:
* arm/cortex-a, arm/aarch64
* riscv64
Co-authored-by: Rbb666 <[email protected]>
Co-authored-by: zhkag <[email protected]>
Diffstat (limited to 'components/fal/src')
| -rw-r--r-- | components/fal/src/fal_rtt.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/components/fal/src/fal_rtt.c b/components/fal/src/fal_rtt.c index 52d276d8c9..98f1c3abe0 100644 --- a/components/fal/src/fal_rtt.c +++ b/components/fal/src/fal_rtt.c @@ -397,13 +397,17 @@ const static struct rt_device_ops char_dev_ops = }; #endif -#ifdef RT_USING_POSIX -#include <dfs_posix.h> +#ifdef RT_USING_POSIX_DEVIO +#include <dfs_file.h> +#include <unistd.h> +#include <stdio.h> /* rename() */ +#include <sys/stat.h> +#include <sys/statfs.h> /* statfs() */ /* RT-Thread device filesystem interface */ static int char_dev_fopen(struct dfs_fd *fd) { - struct fal_char_device *part = (struct fal_char_device *) fd->data; + struct fal_char_device *part = (struct fal_char_device *) fd->vnode->data; assert(part != RT_NULL); @@ -427,7 +431,7 @@ static int char_dev_fopen(struct dfs_fd *fd) static int char_dev_fread(struct dfs_fd *fd, void *buf, size_t count) { int ret = 0; - struct fal_char_device *part = (struct fal_char_device *) fd->data; + struct fal_char_device *part = (struct fal_char_device *) fd->vnode->data; assert(part != RT_NULL); @@ -447,7 +451,7 @@ static int char_dev_fread(struct dfs_fd *fd, void *buf, size_t count) static int char_dev_fwrite(struct dfs_fd *fd, const void *buf, size_t count) { int ret = 0; - struct fal_char_device *part = (struct fal_char_device *) fd->data; + struct fal_char_device *part = (struct fal_char_device *) fd->vnode->data; assert(part != RT_NULL); @@ -476,7 +480,7 @@ static const struct dfs_file_ops char_dev_fops = RT_NULL, /* getdents */ RT_NULL, }; -#endif /* defined(RT_USING_POSIX) */ +#endif /* defined(RT_USING_POSIX_DEVIO) */ /** * create RT-Thread char device by specified partition @@ -527,7 +531,7 @@ struct rt_device *fal_char_device_create(const char *parition_name) rt_device_register(RT_DEVICE(char_dev), fal_part->name, RT_DEVICE_FLAG_RDWR); log_i("The FAL char device (%s) created successfully", fal_part->name); -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO /* set fops */ char_dev->parent.fops = &char_dev_fops; #endif |
