Fork of nRF51822 by
nordic/nrf-sdk/nrf_nvmc.h@37:c29c330d942c, 2014-07-07 (annotated)
- Committer:
- Rohit Grover
- Date:
- Mon Jul 07 13:43:31 2014 +0100
- Revision:
- 37:c29c330d942c
- Parent:
- 0:eff01767de02
changes required to upgrade to V7 of the soft-device
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. |
bogdanm | 0:eff01767de02 | 2 | * |
bogdanm | 0:eff01767de02 | 3 | * The information contained herein is confidential property of Nordic |
bogdanm | 0:eff01767de02 | 4 | * Semiconductor ASA.Terms and conditions of usage are described in detail |
bogdanm | 0:eff01767de02 | 5 | * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
bogdanm | 0:eff01767de02 | 6 | * |
bogdanm | 0:eff01767de02 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
bogdanm | 0:eff01767de02 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
bogdanm | 0:eff01767de02 | 9 | * the file. |
bogdanm | 0:eff01767de02 | 10 | * |
bogdanm | 0:eff01767de02 | 11 | * $LastChangedRevision: 17685 $ |
bogdanm | 0:eff01767de02 | 12 | */ |
bogdanm | 0:eff01767de02 | 13 | |
bogdanm | 0:eff01767de02 | 14 | /** |
bogdanm | 0:eff01767de02 | 15 | * @file |
bogdanm | 0:eff01767de02 | 16 | * @brief NMVC driver API. |
bogdanm | 0:eff01767de02 | 17 | */ |
bogdanm | 0:eff01767de02 | 18 | |
bogdanm | 0:eff01767de02 | 19 | #ifndef NRF_NVMC_H__ |
bogdanm | 0:eff01767de02 | 20 | #define NRF_NVMC_H__ |
bogdanm | 0:eff01767de02 | 21 | |
bogdanm | 0:eff01767de02 | 22 | #include <stdint.h> |
bogdanm | 0:eff01767de02 | 23 | |
bogdanm | 0:eff01767de02 | 24 | |
bogdanm | 0:eff01767de02 | 25 | /** |
bogdanm | 0:eff01767de02 | 26 | * @defgroup nrf_nvmc Non-volatile memory controller |
bogdanm | 0:eff01767de02 | 27 | * @{ |
bogdanm | 0:eff01767de02 | 28 | * @ingroup nrf_drivers |
bogdanm | 0:eff01767de02 | 29 | * @brief Driver for the nRF51 NVMC peripheral. |
bogdanm | 0:eff01767de02 | 30 | * |
bogdanm | 0:eff01767de02 | 31 | * This driver allows writing to the non-volatile memory (NVM) regions |
bogdanm | 0:eff01767de02 | 32 | * of the nRF51. In order to write to NVM the controller must be powered |
bogdanm | 0:eff01767de02 | 33 | * on and the relevant page must be erased. |
bogdanm | 0:eff01767de02 | 34 | * |
bogdanm | 0:eff01767de02 | 35 | */ |
bogdanm | 0:eff01767de02 | 36 | |
bogdanm | 0:eff01767de02 | 37 | |
bogdanm | 0:eff01767de02 | 38 | /** |
bogdanm | 0:eff01767de02 | 39 | * @brief Erase a page in flash. This is required before writing to any |
bogdanm | 0:eff01767de02 | 40 | * address in the page. |
bogdanm | 0:eff01767de02 | 41 | * |
bogdanm | 0:eff01767de02 | 42 | * @param address Start address of the page. |
bogdanm | 0:eff01767de02 | 43 | */ |
bogdanm | 0:eff01767de02 | 44 | void nrf_nvmc_page_erase(uint32_t address); |
bogdanm | 0:eff01767de02 | 45 | |
bogdanm | 0:eff01767de02 | 46 | |
bogdanm | 0:eff01767de02 | 47 | /** |
bogdanm | 0:eff01767de02 | 48 | * @brief Write a single byte to flash. |
bogdanm | 0:eff01767de02 | 49 | * |
bogdanm | 0:eff01767de02 | 50 | * The function reads the word containing the byte, and then |
bogdanm | 0:eff01767de02 | 51 | * rewrites the entire word. |
bogdanm | 0:eff01767de02 | 52 | * |
bogdanm | 0:eff01767de02 | 53 | * @param address Address to write to. |
bogdanm | 0:eff01767de02 | 54 | * @param value Value to write. |
bogdanm | 0:eff01767de02 | 55 | */ |
bogdanm | 0:eff01767de02 | 56 | void nrf_nvmc_write_byte(uint32_t address , uint8_t value); |
bogdanm | 0:eff01767de02 | 57 | |
bogdanm | 0:eff01767de02 | 58 | |
bogdanm | 0:eff01767de02 | 59 | /** |
bogdanm | 0:eff01767de02 | 60 | * @brief Write a 32-bit word to flash. |
bogdanm | 0:eff01767de02 | 61 | * @param address Address to write to. |
bogdanm | 0:eff01767de02 | 62 | * @param value Value to write. |
bogdanm | 0:eff01767de02 | 63 | */ |
bogdanm | 0:eff01767de02 | 64 | void nrf_nvmc_write_word(uint32_t address, uint32_t value); |
bogdanm | 0:eff01767de02 | 65 | |
bogdanm | 0:eff01767de02 | 66 | |
bogdanm | 0:eff01767de02 | 67 | /** |
bogdanm | 0:eff01767de02 | 68 | * @brief Write consecutive bytes to flash. |
bogdanm | 0:eff01767de02 | 69 | * |
bogdanm | 0:eff01767de02 | 70 | * @param address Address to write to. |
bogdanm | 0:eff01767de02 | 71 | * @param src Pointer to data to copy from. |
bogdanm | 0:eff01767de02 | 72 | * @param num_bytes Number of bytes in src to write. |
bogdanm | 0:eff01767de02 | 73 | */ |
bogdanm | 0:eff01767de02 | 74 | void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_bytes); |
bogdanm | 0:eff01767de02 | 75 | |
bogdanm | 0:eff01767de02 | 76 | |
bogdanm | 0:eff01767de02 | 77 | /** |
bogdanm | 0:eff01767de02 | 78 | @ @brief Write consecutive words to flash. |
bogdanm | 0:eff01767de02 | 79 | * |
bogdanm | 0:eff01767de02 | 80 | * @param address Address to write to. |
bogdanm | 0:eff01767de02 | 81 | * @param src Pointer to data to copy from. |
bogdanm | 0:eff01767de02 | 82 | * @param num_words Number of bytes in src to write. |
bogdanm | 0:eff01767de02 | 83 | */ |
bogdanm | 0:eff01767de02 | 84 | void nrf_nvmc_write_words(uint32_t address, const uint32_t * src, uint32_t num_words); |
bogdanm | 0:eff01767de02 | 85 | |
bogdanm | 0:eff01767de02 | 86 | |
bogdanm | 0:eff01767de02 | 87 | #endif // NRF_NVMC_H__ |
bogdanm | 0:eff01767de02 | 88 | /** @} */ |
bogdanm | 0:eff01767de02 | 89 | |
bogdanm | 0:eff01767de02 | 90 |