test
Fork of nrf51-sdk by
Embed:
(wiki syntax)
Show/hide line numbers
nrf_nvmc.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (c) Nordic Semiconductor ASA 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without modification, 00006 * are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, this 00009 * list of conditions and the following disclaimer. 00010 * 00011 * 2. Redistributions in binary form must reproduce the above copyright notice, this 00012 * list of conditions and the following disclaimer in the documentation and/or 00013 * other materials provided with the distribution. 00014 * 00015 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 00016 * contributors to this software may be used to endorse or promote products 00017 * derived from this software without specific prior written permission. 00018 * 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00021 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00022 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00023 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00024 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00025 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00026 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00027 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 */ 00032 00033 /** 00034 * @file 00035 * @brief NMVC driver API. 00036 */ 00037 00038 #ifndef NRF_NVMC_H__ 00039 #define NRF_NVMC_H__ 00040 00041 #include <stdint.h> 00042 00043 00044 /** 00045 * @defgroup nrf_nvmc Non-volatile memory controller 00046 * @{ 00047 * @ingroup nrf_drivers 00048 * @brief Driver for the NVMC peripheral. 00049 * 00050 * This driver allows writing to the non-volatile memory (NVM) regions 00051 * of the chip. In order to write to NVM the controller must be powered 00052 * on and the relevant page must be erased. 00053 * 00054 */ 00055 00056 00057 /** 00058 * @brief Erase a page in flash. This is required before writing to any 00059 * address in the page. 00060 * 00061 * @param address Start address of the page. 00062 */ 00063 void nrf_nvmc_page_erase(uint32_t address); 00064 00065 00066 /** 00067 * @brief Write a single byte to flash. 00068 * 00069 * The function reads the word containing the byte, and then 00070 * rewrites the entire word. 00071 * 00072 * @param address Address to write to. 00073 * @param value Value to write. 00074 */ 00075 void nrf_nvmc_write_byte(uint32_t address , uint8_t value); 00076 00077 00078 /** 00079 * @brief Write a 32-bit word to flash. 00080 * @param address Address to write to. 00081 * @param value Value to write. 00082 */ 00083 void nrf_nvmc_write_word(uint32_t address, uint32_t value); 00084 00085 00086 /** 00087 * @brief Write consecutive bytes to flash. 00088 * 00089 * @param address Address to write to. 00090 * @param src Pointer to data to copy from. 00091 * @param num_bytes Number of bytes in src to write. 00092 */ 00093 void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_bytes); 00094 00095 00096 /** 00097 * @brief Write consecutive words to flash. 00098 * 00099 * @param address Address to write to. 00100 * @param src Pointer to data to copy from. 00101 * @param num_words Number of bytes in src to write. 00102 */ 00103 void nrf_nvmc_write_words(uint32_t address, const uint32_t * src, uint32_t num_words); 00104 00105 00106 #endif // NRF_NVMC_H__ 00107 /** @} */ 00108 00109
Generated on Tue Jul 12 2022 15:51:27 by 1.7.2