platform.h 964 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-04-12 ErikChan the first version
  9. */
  10. #ifndef __PLATFORM_H__
  11. #define __PLATFORM_H__
  12. #include <drivers/ofw.h>
  13. #include <drivers/core/driver.h>
  14. struct rt_platform_device
  15. {
  16. struct rt_device parent;
  17. const char *name;
  18. const struct rt_ofw_node_id *id;
  19. void *priv;
  20. };
  21. struct rt_platform_driver
  22. {
  23. struct rt_driver parent;
  24. const char *name;
  25. const struct rt_ofw_node_id *ids;
  26. rt_err_t (*probe)(struct rt_platform_device *pdev);
  27. };
  28. struct rt_platform_device *rt_platform_device_alloc(const char *name);
  29. rt_err_t rt_platform_driver_register(struct rt_platform_driver *pdrv);
  30. rt_err_t rt_platform_device_register(struct rt_platform_device *pdev);
  31. #define RT_PLATFORM_DRIVER_EXPORT(driver) RT_DRIVER_EXPORT(driver, platform, BUILIN)
  32. #endif /* __PLATFORM_H__ */