1 /*! 2 * \file nvmm.h 3 * 4 * \brief None volatile memory management module 5 * 6 * \copyright Revised BSD License, see section \ref LICENSE. 7 * 8 * \code 9 * ______ _ 10 * / _____) _ | | 11 * ( (____ _____ ____ _| |_ _____ ____| |__ 12 * \____ \| ___ | (_ _) ___ |/ ___) _ \ 13 * _____) ) ____| | | || |_| ____( (___| | | | 14 * (______/|_____)_|_|_| \__)_____)\____)_| |_| 15 * (C)2013-2017 Semtech 16 * 17 * ___ _____ _ ___ _ _____ ___ ___ ___ ___ 18 * / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __| 19 * \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _| 20 * |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___| 21 * embedded.connectivity.solutions=============== 22 * 23 * \endcode 24 * 25 * \author Miguel Luis ( Semtech ) 26 * 27 * \author Gregory Cristian ( Semtech ) 28 * 29 * \author Daniel Jaeckle ( STACKFORCE ) 30 * 31 * \author Johannes Bruder ( STACKFORCE ) 32 */ 33 #ifndef __NVMM_H__ 34 #define __NVMM_H__ 35 36 #ifdef __cplusplus 37 extern "C" 38 { 39 #endif 40 41 #include <stdlib.h> 42 #include <stdint.h> 43 #include <stdbool.h> 44 45 /*! 46 * \brief Writes data to given data block. 47 * 48 * \param[IN] src Pointer to the source of data to be copied. 49 * \param[IN] size Number of bytes to copy. 50 * \param[IN] offset Relative NVM offset. 51 * 52 * \retval Status of the operation 53 */ 54 uint16_t NvmmWrite( uint8_t* src, uint16_t size, uint16_t offset ); 55 56 /*! 57 * \brief Reads from data block to destination pointer. 58 * 59 * \param[IN] dst Pointer to the destination array where the content is to be copied. 60 * \param[IN] size Number of bytes to copy. 61 * \param[IN] offset Relative NVM offset. 62 * 63 * \retval Status of the operation 64 */ 65 uint16_t NvmmRead( uint8_t* dest, uint16_t size, uint16_t offset ); 66 67 /*! 68 * \brief Verfies the CRC 32 of a data block. The function assumes that the 69 * crc32 is at the end of the block with 4 bytes. 70 * 71 * \param[IN] size Length of the block. 72 * \param[IN] offset Address offset of the NVM. 73 * 74 * \retval Status of the operation 75 */ 76 bool NvmmCrc32Check( uint16_t size, uint16_t offset ); 77 78 /*! 79 * \brief Invalidates the CRC 32 of a data block. The function assumes that the 80 * crc32 is at the end of the block with 4 bytes. 81 * 82 * \param[IN] size Length of the block. 83 * \param[IN] offset Address offset of the NVM. 84 * 85 * \retval Status of the operation 86 */ 87 bool NvmmReset( uint16_t size, uint16_t offset ); 88 89 #ifdef __cplusplus 90 } 91 #endif 92 93 #endif // __NVMM_H__ 94