mirror of https://github.com/RT-Thread/rt-thread
[bsp][phytium ] support dc driver with ops
修改bsp/phytium中DC驱动接口,利用ops注册相关驱动
This commit is contained in:
parent
bd228eb9c5
commit
28f3e037b6
|
@ -90,16 +90,31 @@ static rt_err_t rt_dc_control(rt_device_t dev, int cmd, void *args)
|
||||||
}
|
}
|
||||||
return RT_EOK;
|
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)
|
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);
|
RT_ASSERT(dc_control_bus != RT_NULL);
|
||||||
struct rt_device *dc;
|
struct rt_device *dc;
|
||||||
dc = &(dc_control_bus->parent);
|
dc = &(dc_control_bus->parent);
|
||||||
dc->type = RT_Device_Class_Graphic;
|
dc->type = RT_Device_Class_Graphic;
|
||||||
|
#ifdef RT_USING_DEVICE_OPS
|
||||||
|
dc->ops = &dc_ops;
|
||||||
|
#else
|
||||||
dc->init = rt_dc_init;
|
dc->init = rt_dc_init;
|
||||||
dc->open = RT_NULL;
|
|
||||||
dc->close = RT_NULL;
|
|
||||||
dc->control = rt_dc_control;
|
dc->control = rt_dc_control;
|
||||||
|
#endif
|
||||||
dc->user_data = data;
|
dc->user_data = data;
|
||||||
/* register Display Controller device to RT-Thread */
|
/* register Display Controller device to RT-Thread */
|
||||||
rt_device_register(dc, "dc", RT_DEVICE_FLAG_RDWR);
|
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);
|
INIT_DEVICE_EXPORT(rt_hw_dc_init);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,6 @@ def clone_repository(branch, commit_hash):
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
branch_to_clone = "master"
|
branch_to_clone = "master"
|
||||||
commit_to_clone = "822fc36aff031d54e7c80f254fb64206ab187981"
|
commit_to_clone = "13657081faf9f2d504592f7110159c4e63dc6f29"
|
||||||
|
|
||||||
clone_repository(branch_to_clone, commit_to_clone)
|
clone_repository(branch_to_clone, commit_to_clone)
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* FilePath: fdrivers_port.h
|
* FilePath: fdrivers_port.h
|
||||||
* Created Date: 2023-10-16 17:02:35
|
* 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
|
* Description: This file is for drive layer code decoupling
|
||||||
*
|
*
|
||||||
* Modify History:
|
* Modify History:
|
||||||
|
@ -25,22 +25,13 @@
|
||||||
#ifndef FDRIVERS_PORT_H
|
#ifndef FDRIVERS_PORT_H
|
||||||
#define FDRIVERS_PORT_H
|
#define FDRIVERS_PORT_H
|
||||||
|
|
||||||
#ifdef __aarch64__
|
|
||||||
#include "faarch64.h"
|
|
||||||
#else
|
|
||||||
#include "faarch32.h"
|
|
||||||
#endif
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
/***************************** Include Files *********************************/
|
/***************************** Include Files *********************************/
|
||||||
#include "rtconfig.h"
|
#include "rtconfig.h"
|
||||||
#include "ftypes.h"
|
#include "ftypes.h"
|
||||||
#include "drv_log.h"
|
#include "drv_log.h"
|
||||||
#include "fkernel.h"
|
#include "fkernel.h"
|
||||||
#ifdef __aarch64__
|
#include "faarch.h"
|
||||||
#include "faarch64.h"
|
|
||||||
#else
|
|
||||||
#include "faarch32.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|
Loading…
Reference in New Issue