mediCAL's first BLE project
Fork of nRF51822 by
nordic/nrf-sdk/nrf_nvmc.h@0:eff01767de02, 2014-03-26 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Mar 26 14:38:17 2014 +0000
- Revision:
- 0:eff01767de02
- Child:
- 37:c29c330d942c
Initial import of the nRF51822 code
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 | #include "nordic_global.h" |
bogdanm | 0:eff01767de02 | 24 | |
bogdanm | 0:eff01767de02 | 25 | |
bogdanm | 0:eff01767de02 | 26 | /** |
bogdanm | 0:eff01767de02 | 27 | * @defgroup nrf_nvmc Non-volatile memory controller |
bogdanm | 0:eff01767de02 | 28 | * @{ |
bogdanm | 0:eff01767de02 | 29 | * @ingroup nrf_drivers |
bogdanm | 0:eff01767de02 | 30 | * @brief Driver for the nRF51 NVMC peripheral. |
bogdanm | 0:eff01767de02 | 31 | * |
bogdanm | 0:eff01767de02 | 32 | * This driver allows writing to the non-volatile memory (NVM) regions |
bogdanm | 0:eff01767de02 | 33 | * of the nRF51. In order to write to NVM the controller must be powered |
bogdanm | 0:eff01767de02 | 34 | * on and the relevant page must be erased. |
bogdanm | 0:eff01767de02 | 35 | * |
bogdanm | 0:eff01767de02 | 36 | */ |
bogdanm | 0:eff01767de02 | 37 | |
bogdanm | 0:eff01767de02 | 38 | |
bogdanm | 0:eff01767de02 | 39 | /** |
bogdanm | 0:eff01767de02 | 40 | * @brief Erase a page in flash. This is required before writing to any |
bogdanm | 0:eff01767de02 | 41 | * address in the page. |
bogdanm | 0:eff01767de02 | 42 | * |
bogdanm | 0:eff01767de02 | 43 | * @param address Start address of the page. |
bogdanm | 0:eff01767de02 | 44 | */ |
bogdanm | 0:eff01767de02 | 45 | void nrf_nvmc_page_erase(uint32_t address); |
bogdanm | 0:eff01767de02 | 46 | |
bogdanm | 0:eff01767de02 | 47 | |
bogdanm | 0:eff01767de02 | 48 | /** |
bogdanm | 0:eff01767de02 | 49 | * @brief Write a single byte to flash. |
bogdanm | 0:eff01767de02 | 50 | * |
bogdanm | 0:eff01767de02 | 51 | * The function reads the word containing the byte, and then |
bogdanm | 0:eff01767de02 | 52 | * rewrites the entire word. |
bogdanm | 0:eff01767de02 | 53 | * |
bogdanm | 0:eff01767de02 | 54 | * @param address Address to write to. |
bogdanm | 0:eff01767de02 | 55 | * @param value Value to write. |
bogdanm | 0:eff01767de02 | 56 | */ |
bogdanm | 0:eff01767de02 | 57 | void nrf_nvmc_write_byte(uint32_t address , uint8_t value); |
bogdanm | 0:eff01767de02 | 58 | |
bogdanm | 0:eff01767de02 | 59 | |
bogdanm | 0:eff01767de02 | 60 | /** |
bogdanm | 0:eff01767de02 | 61 | * @brief Write a 32-bit word to flash. |
bogdanm | 0:eff01767de02 | 62 | * @param address Address to write to. |
bogdanm | 0:eff01767de02 | 63 | * @param value Value to write. |
bogdanm | 0:eff01767de02 | 64 | */ |
bogdanm | 0:eff01767de02 | 65 | void nrf_nvmc_write_word(uint32_t address, uint32_t value); |
bogdanm | 0:eff01767de02 | 66 | |
bogdanm | 0:eff01767de02 | 67 | |
bogdanm | 0:eff01767de02 | 68 | /** |
bogdanm | 0:eff01767de02 | 69 | * @brief Write consecutive bytes to flash. |
bogdanm | 0:eff01767de02 | 70 | * |
bogdanm | 0:eff01767de02 | 71 | * @param address Address to write to. |
bogdanm | 0:eff01767de02 | 72 | * @param src Pointer to data to copy from. |
bogdanm | 0:eff01767de02 | 73 | * @param num_bytes Number of bytes in src to write. |
bogdanm | 0:eff01767de02 | 74 | */ |
bogdanm | 0:eff01767de02 | 75 | void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_bytes); |
bogdanm | 0:eff01767de02 | 76 | |
bogdanm | 0:eff01767de02 | 77 | |
bogdanm | 0:eff01767de02 | 78 | /** |
bogdanm | 0:eff01767de02 | 79 | @ @brief Write consecutive words to flash. |
bogdanm | 0:eff01767de02 | 80 | * |
bogdanm | 0:eff01767de02 | 81 | * @param address Address to write to. |
bogdanm | 0:eff01767de02 | 82 | * @param src Pointer to data to copy from. |
bogdanm | 0:eff01767de02 | 83 | * @param num_words Number of bytes in src to write. |
bogdanm | 0:eff01767de02 | 84 | */ |
bogdanm | 0:eff01767de02 | 85 | void nrf_nvmc_write_words(uint32_t address, const uint32_t * src, uint32_t num_words); |
bogdanm | 0:eff01767de02 | 86 | |
bogdanm | 0:eff01767de02 | 87 | |
bogdanm | 0:eff01767de02 | 88 | #endif // NRF_NVMC_H__ |
bogdanm | 0:eff01767de02 | 89 | /** @} */ |
bogdanm | 0:eff01767de02 | 90 | |
bogdanm | 0:eff01767de02 | 91 |