[bsp/allwinner] feat: porting to RT_USING_DEVICE_OPS#9142
Merged
BernardXiong merged 3 commits intoRT-Thread:masterfrom Jul 9, 2024
Merged
[bsp/allwinner] feat: porting to RT_USING_DEVICE_OPS#9142BernardXiong merged 3 commits intoRT-Thread:masterfrom
BernardXiong merged 3 commits intoRT-Thread:masterfrom
Conversation
Contributor
Author
|
@ylyamin you could check the PR message or the commit log for details 😉 |
This patch ports the codebase to use the RT_USING_DEVICE_OPS structure, which is required by v5.1.0 Smart kernel, improves modularity and makes it easier to manage device operations by consolidating them into a single structure, enhancing maintainability and future scalability. Changes: - Added RT_USING_DEVICE_OPS conditionals to partition.c and drv_sdmmc.c. - Defined rt_device_ops structures for partition and sdmmc drivers. - Updated device initialization to use the ops structure if defined. - Replaced direct function calls with rt_dev_control, rt_dev_read, and rt_dev_write macros where applicable. - Removed redundant us_delay function from os.c. Signed-off-by: Shell <smokewood@qq.com>
BernardXiong
reviewed
Jul 6, 2024
| void sd_mmc1_deinit(void); | ||
|
|
||
| #ifdef RT_USING_DEVICE_OPS | ||
| #define rt_dev_has_control(dev) (dev)->ops->control |
Contributor
Author
There was a problem hiding this comment.
rt_device API 有特殊的操作协议 (open, init),但是 allwinner HAL 实现 API 没有遵循这种协议。这就导致对接后驱动工作异常(驱动内部直接 read 没有 open,无法通过引用计数检查。也可以理解为驱动内部是通过 dev-ops 调内部 API 的,因此不遵循外部操作协议)。
因此建议是建个 issue,后续工作中继续推进驱动的 API 对接问题。本 PR 还是保留宏的形式。
Contributor
Author
|
tested with commit c7e1982 on 柿饼 M7 |
BernardXiong
approved these changes
Jul 9, 2024
messigogogo
pushed a commit
to messigogogo/rt-thread
that referenced
this pull request
Jul 22, 2024
* [bsp/allwinner] feat: porting to RT_USING_DEVICE_OPS This patch ports the codebase to use the RT_USING_DEVICE_OPS structure, which is required by v5.1.0 Smart kernel, improves modularity and makes it easier to manage device operations by consolidating them into a single structure, enhancing maintainability and future scalability. Changes: - Added RT_USING_DEVICE_OPS conditionals to partition.c and drv_sdmmc.c. - Defined rt_device_ops structures for partition and sdmmc drivers. - Updated device initialization to use the ops structure if defined. - Replaced direct function calls with rt_dev_control, rt_dev_read, and rt_dev_write macros where applicable. - Removed redundant us_delay function from os.c. Signed-off-by: Shell <smokewood@qq.com> * feat: update configuration * feat: fixup compiler warning --------- Signed-off-by: Shell <smokewood@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
This patch ports the codebase to use the RT_USING_DEVICE_OPS structure, which is required by v5.1.0 Smart kernel, improves modularity and makes it easier to manage device operations by consolidating them into a single structure, enhancing maintainability and future scalability.
你的解决方案是什么 (what is your solution)
Changes:
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up