From 28f3e037b6d69a4ab04ae95fb85b4e45572f1cfc Mon Sep 17 00:00:00 2001 From: Wangzongqiang <126842169+Wangzongqiang@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:51:58 +0800 Subject: [PATCH] [bsp][phytium ] support dc driver with ops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改bsp/phytium中DC驱动接口,利用ops注册相关驱动 --- bsp/phytium/libraries/drivers/drv_dc.c | 20 ++++++++++++++++--- .../phytium_standalone_sdk_install.py | 2 +- .../port/fdriver_port/fdrivers_port.h | 13 ++---------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/bsp/phytium/libraries/drivers/drv_dc.c b/bsp/phytium/libraries/drivers/drv_dc.c index 71644fe947..abe2a988a8 100644 --- a/bsp/phytium/libraries/drivers/drv_dc.c +++ b/bsp/phytium/libraries/drivers/drv_dc.c @@ -90,16 +90,31 @@ static rt_err_t rt_dc_control(rt_device_t dev, int cmd, void *args) } return RT_EOK; } + +#ifdef RT_USING_DEVICE_OPS +const static struct rt_device_ops dc_ops = +{ + rt_dc_init, + RT_NULL, + RT_NULL, + RT_NULL, + RT_NULL, + rt_dc_control +}; +#endif + static void rt_hw_dc_register(struct phytium_dc_bus *dc_control_bus, const char *name, rt_uint32_t flag, void *data) { RT_ASSERT(dc_control_bus != RT_NULL); struct rt_device *dc; dc = &(dc_control_bus->parent); dc->type = RT_Device_Class_Graphic; +#ifdef RT_USING_DEVICE_OPS + dc->ops = &dc_ops; +#else dc->init = rt_dc_init; - dc->open = RT_NULL; - dc->close = RT_NULL; dc->control = rt_dc_control; +#endif dc->user_data = data; /* register Display Controller device to RT-Thread */ rt_device_register(dc, "dc", RT_DEVICE_FLAG_RDWR); @@ -145,4 +160,3 @@ int rt_hw_dc_init(void) } INIT_DEVICE_EXPORT(rt_hw_dc_init); - diff --git a/bsp/phytium/libraries/phytium_standalone_sdk_install.py b/bsp/phytium/libraries/phytium_standalone_sdk_install.py index 161b1e3082..ced6db85a9 100644 --- a/bsp/phytium/libraries/phytium_standalone_sdk_install.py +++ b/bsp/phytium/libraries/phytium_standalone_sdk_install.py @@ -19,6 +19,6 @@ def clone_repository(branch, commit_hash): if __name__ == "__main__": branch_to_clone = "master" - commit_to_clone = "822fc36aff031d54e7c80f254fb64206ab187981" + commit_to_clone = "13657081faf9f2d504592f7110159c4e63dc6f29" clone_repository(branch_to_clone, commit_to_clone) \ No newline at end of file diff --git a/bsp/phytium/libraries/port/fdriver_port/fdrivers_port.h b/bsp/phytium/libraries/port/fdriver_port/fdrivers_port.h index 50e0e2945c..695545b940 100644 --- a/bsp/phytium/libraries/port/fdriver_port/fdrivers_port.h +++ b/bsp/phytium/libraries/port/fdriver_port/fdrivers_port.h @@ -13,7 +13,7 @@ * * FilePath: fdrivers_port.h * Created Date: 2023-10-16 17:02:35 - * Last Modified: 2024-01-05 14:51:14 + * Last Modified: Tue Feb 20 2024 * Description: This file is for drive layer code decoupling * * Modify History: @@ -25,22 +25,13 @@ #ifndef FDRIVERS_PORT_H #define FDRIVERS_PORT_H -#ifdef __aarch64__ - #include "faarch64.h" -#else - #include "faarch32.h" -#endif #include /***************************** Include Files *********************************/ #include "rtconfig.h" #include "ftypes.h" #include "drv_log.h" #include "fkernel.h" -#ifdef __aarch64__ - #include "faarch64.h" -#else - #include "faarch32.h" -#endif +#include "faarch.h" #ifdef __cplusplus extern "C"