hal_gpio.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _HAL_GPIO_H_
  13. #define _HAL_GPIO_H_
  14. #include "osi_compiler.h"
  15. OSI_EXTERN_C_BEGIN
  16. /**
  17. * \brief set gpio as input mode
  18. *
  19. * \param gpio gpio id
  20. * \return
  21. * - true on success
  22. * - false on fail, invalid parameter
  23. */
  24. bool halGpioSetInput(unsigned gpio);
  25. /**
  26. * \brief get gpio value
  27. *
  28. * \param gpio gpio id
  29. * \return
  30. * - true on high level
  31. * - false on low level, or invalid parameter
  32. */
  33. bool halGpioGetValue(unsigned gpio);
  34. /**
  35. * \brief set gpio as output
  36. *
  37. * \param gpio gpio id
  38. * \param hi true for high level
  39. * \return
  40. * - true on success
  41. * - false on fail, invalid parameter
  42. */
  43. bool halGpioSetOutput(unsigned gpio, bool hi);
  44. /**
  45. * \brief set gpo output level
  46. *
  47. * \param gpo gpo id
  48. * \param hi true for high level
  49. * \return
  50. * - true on success
  51. * - false on fail, invalid parameter
  52. */
  53. bool halGpoSetOutput(unsigned gpo, bool hi);
  54. /**
  55. * \brief set pmic gpio as input mode
  56. *
  57. * \param gpio pmic gpio id
  58. * \return
  59. * - true on success
  60. * - false on fail, invalid parameter
  61. */
  62. bool halPmicGpioSetInput(unsigned gpio);
  63. /**
  64. * \brief get pmic gpio value
  65. *
  66. * \param gpio pmic gpio id
  67. * \return
  68. * - true on high level
  69. * - false on low level, or invalid parameter
  70. */
  71. bool halPmicGpioGetValue(unsigned gpio);
  72. /**
  73. * \brief set pmic gpio as output
  74. *
  75. * \param gpio pmic gpio id
  76. * \param hi true for high level
  77. * \return
  78. * - true on success
  79. * - false on fail, invalid parameter
  80. */
  81. bool halPmicGpioSetOutput(unsigned gpio, bool hi);
  82. OSI_EXTERN_C_END
  83. #endif