hal_efuse_pub.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Copyright (C) 2020 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_EFUSE_PUB_H_
  13. #define _HAL_EFUSE_PUB_H_
  14. #include <stdint.h>
  15. #include <stdbool.h>
  16. #include <stddef.h>
  17. #include "hal_config.h"
  18. #include "hal_efuse.h"
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /**
  23. * @brief open the public(non-secure) efuse module
  24. *
  25. * It should be called before reading or writing efuse.
  26. */
  27. void halEfusePubOpen(void);
  28. /**
  29. * @brief close the public(non-secure) efuse module
  30. *
  31. * It should be called when finsh reading or writing efuse.
  32. */
  33. void halEfusePubClose(void);
  34. /**
  35. * @brief read the public(non-secure) efuse in single bit.
  36. *
  37. * @param block_index The index of single bit efuse block.
  38. * @param val The pointer of the data reading form the block.
  39. * @return
  40. * - true success
  41. * - false fail
  42. */
  43. bool halEfusePubSingleRead(uint32_t block_index, uint32_t *val);
  44. /**
  45. * @brief write the public(non-secure) efuse in single bit.
  46. *
  47. * On 8811, hard fault will occur when writing to locked efuse block. Caller
  48. * should avoid this case.
  49. *
  50. * @param block_index The index of single bit efuse block.
  51. * @param val The value will write to the efuse.
  52. * @return
  53. * - true success
  54. * - false fail
  55. */
  56. bool halEfusePubSingleWrite(uint32_t block_index, uint32_t val);
  57. /**
  58. * @brief read the public(non-secure) efuse in double bit
  59. *
  60. * @param block_index the double bit block index
  61. * @param val the value point for read
  62. * @return
  63. * - true on sccess else fail
  64. */
  65. bool halEfusePubDoubleRead(uint32_t block_index, uint32_t *val);
  66. /**
  67. * @brief write the public(non-secure) efuse in double bit
  68. *
  69. * @param block_index the double bit block index
  70. * @param val the value to be writen
  71. * @return
  72. * - true on success else fail
  73. */
  74. bool halEfusePubDoubleWrite(uint32_t block_index, uint32_t val);
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif /* _DRV_EFUSE_H_ */