nrf_nvmc.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is confidential property of Nordic
  4. * Semiconductor ASA.Terms and conditions of usage are described in detail
  5. * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. * $LastChangedRevision: 17685 $
  12. */
  13. /**
  14. * @file
  15. * @brief NMVC driver API.
  16. */
  17. #ifndef NRF_NVMC_H__
  18. #define NRF_NVMC_H__
  19. #include <stdint.h>
  20. /**
  21. * @defgroup nrf_nvmc Non-volatile memory controller
  22. * @{
  23. * @ingroup nrf_drivers
  24. * @brief Driver for the NVMC peripheral.
  25. *
  26. * This driver allows writing to the non-volatile memory (NVM) regions
  27. * of the chip. In order to write to NVM the controller must be powered
  28. * on and the relevant page must be erased.
  29. *
  30. */
  31. /**
  32. * @brief Erase a page in flash. This is required before writing to any
  33. * address in the page.
  34. *
  35. * @param address Start address of the page.
  36. */
  37. void nrf_nvmc_page_erase(uint32_t address);
  38. /**
  39. * @brief Write a single byte to flash.
  40. *
  41. * The function reads the word containing the byte, and then
  42. * rewrites the entire word.
  43. *
  44. * @param address Address to write to.
  45. * @param value Value to write.
  46. */
  47. void nrf_nvmc_write_byte(uint32_t address , uint8_t value);
  48. /**
  49. * @brief Write a 32-bit word to flash.
  50. * @param address Address to write to.
  51. * @param value Value to write.
  52. */
  53. void nrf_nvmc_write_word(uint32_t address, uint32_t value);
  54. /**
  55. * @brief Write consecutive bytes to flash.
  56. *
  57. * @param address Address to write to.
  58. * @param src Pointer to data to copy from.
  59. * @param num_bytes Number of bytes in src to write.
  60. */
  61. void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_bytes);
  62. /**
  63. * @brief Write consecutive words to flash.
  64. *
  65. * @param address Address to write to.
  66. * @param src Pointer to data to copy from.
  67. * @param num_words Number of bytes in src to write.
  68. */
  69. void nrf_nvmc_write_words(uint32_t address, const uint32_t * src, uint32_t num_words);
  70. #endif // NRF_NVMC_H__
  71. /** @} */