fooxx.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright : (C) 2022 Phytium Information Technology, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is OPEN SOURCE software: you can redistribute it and/or modify it
  6. * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
  7. * either version 1.0 of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
  10. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. * See the Phytium Public License for more details.
  12. *
  13. *
  14. * FilePath: fooxx.h
  15. * Date: 2022-02-10 14:53:42
  16. * LastEditTime: 2022-02-18 08:25:35
  17. * Description:  This files is for
  18. *
  19. * Modify History:
  20. * Ver   Who        Date         Changes
  21. * ----- ------     --------    --------------------------------------
  22. */
  23. #ifndef DRIVERS_模块名_FOOXX_H
  24. #define DRIVERS_模块名_FOOXX_H
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. /***************************** Include Files *********************************/
  30. #include "ftypes.h"
  31. #include "fassert.h"
  32. /************************** Constant Definitions *****************************/
  33. /* Configuration options */
  34. #define FOOXX_OPTION_XX
  35. /* Operational Mode */
  36. #define FOOXX_OPER_MODE_XX
  37. /**************************** Type Definitions *******************************/
  38. /**
  39. * This typedef contains configuration information for the device.
  40. */
  41. typedef struct
  42. {
  43. u32 instance_id; /**< Device instance id */
  44. uintptr base_addr; /**< Device base address */
  45. } FooxxConfig;
  46. /**
  47. * This typedef contains driver instance data. The user is required to allocate a
  48. * variable of this type for every device in the system. A pointer
  49. * to a variable of this type is then passed to the driver API functions.
  50. */
  51. typedef struct
  52. {
  53. FooxxConfig config; /**< Current active configs */
  54. u32 is_ready; /**< Device is initialized and ready */
  55. } Fooxx; /**< Device instance */
  56. /************************** Variable Definitions *****************************/
  57. /***************** Macros (Inline Functions) Definitions *********************/
  58. /************************** Function Prototypes ******************************/
  59. /**
  60. * @name: FXxxLookupConfig
  61. * @msg: Get the device instance default configure
  62. * @return {*}
  63. * @param {u32} instance_id
  64. */
  65. const FooxxConfig *FXxxLookupConfig(u32 instance_id);
  66. /*
  67. * @name: FooxxCfgInitialize
  68. * @msg: Initializes a specific instance such that it is ready to be used.
  69. * @param {Fooxx} *instance_p is a pointer to the driver instance.
  70. * @param {FooxxConfig} *config_p is a reference to a structure containing information
  71. * about a specific driver.
  72. * @return SUCCESS if initialization was successful
  73. * ERROR
  74. */
  75. FError FooxxCfgInitialize(Fooxx *instance_p, const FooxxConfig *cofig_p);
  76. /**
  77. * @name: FooxxDeInitialize
  78. * @msg: DeInitialization function for the device instance
  79. * @return {*}
  80. * @param {Fooxx} *instance_p
  81. */
  82. void FooxxDeInitialize(Fooxx *instance_p);
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86. #endif