drv_efuse.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 _DRV_EFUSE_H_
  13. #define _DRV_EFUSE_H_
  14. #include "osi_compiler.h"
  15. #include "hal_efuse.h"
  16. #include <stdbool.h>
  17. OSI_EXTERN_C_BEGIN
  18. /**
  19. * \brief data type with drv prefix
  20. */
  21. typedef halEfuseReadWriteOp_t drvEfuseReadWriteOp_t;
  22. /**
  23. * \brief efuse word count
  24. *
  25. * \return single bit efuse word count
  26. */
  27. unsigned drvEfuseCount(void);
  28. /**
  29. * \brief read one EFUSE block
  30. *
  31. * \param is_double whether to access with double bit
  32. * \param block_index block index
  33. * \param value read value
  34. * \return
  35. * - true on success
  36. * - false on fail, invalid parameter or not readable
  37. */
  38. bool drvEfuseRead(bool is_double, uint32_t block_index, uint32_t *value);
  39. /**
  40. * \brief write one EFUSE
  41. *
  42. * \param is_double whether to access with double bit
  43. * \param block_index block index
  44. * \param value read value
  45. * \return
  46. * - true on success
  47. * - false on fail, invalid parameter or not writable
  48. */
  49. bool drvEfuseWrite(bool is_double, uint32_t block_index, uint32_t value);
  50. /**
  51. * \brief multiple efuse block read or write
  52. *
  53. * It will call \p halEfuseReadWrite with multi-thread protection.
  54. *
  55. * \param params read or write parameters
  56. * \param count parameter count
  57. * \return
  58. * - true on success
  59. * - false on fail, invalid parameter, not readable or writable
  60. */
  61. bool drvEfuseReadWrite(drvEfuseReadWriteOp_t *params, uint32_t count);
  62. /**
  63. * \brief efuse block lock state
  64. *
  65. * It will call \p halEfuseGetLockState with multi-thread protection.
  66. *
  67. * \param is_double whether to access with double bit
  68. * \param block_index block index
  69. * \return lock state
  70. */
  71. halEfuseBlockLockState_t drvEfuseGetLockState(bool is_double, uint32_t block_index);
  72. /**
  73. * \brief invalidate efuse block read cache
  74. *
  75. * It will call \p halEfuseCacheInvalidate with multi-thread protection.
  76. *
  77. * \param is_double whether to access with double bit
  78. * \param block_index block index
  79. */
  80. void drvEfuseCacheInvalidate(bool is_double, uint32_t block_index);
  81. /**
  82. * \brief invalidate all efuse blocks read cache
  83. *
  84. * It will call \p halEfuseCacheInvalidateAll with multi-thread protection.
  85. */
  86. void drvEfuseCacheInvalidateAll(void);
  87. OSI_EXTERN_C_END
  88. #endif