nvm_hal.h

Go to the documentation of this file.
00001 /***************************************************************************/
00017 #ifndef __NVMHAL_H
00018 #define __NVMHAL_H
00019 
00020 #include <stdbool.h>
00021 #include "nvm.h"
00022 #include "ecode.h"
00023 
00024 /* Defines for changing HAL functionality. These are both a bit experimental,
00025  * but should work properly. */
00026 
00027 /* Custom write and format methods based on the emlib are used in place of
00028 * the originals. These methods put the CPU to sleep by going to EM1 while the
00029 * operation progresses.
00030 *
00031 * NVMHAL_SLEEP_FORMAT and NVMHAL_SLEEP_WRITE is only used for toggling
00032 * which function is called, and includes about the same amount of code. */
00033 
00035 #ifndef NVMHAL_SLEEP_FORMAT
00036 #define NVMHAL_SLEEP_FORMAT    false
00037 #endif
00038 
00040 #ifndef NVMHAL_SLEEP_WRITE
00041 #define NVMHAL_SLEEP_WRITE     false
00042 #endif
00043 
00047 #ifndef NVMHAL_DMAREAD
00048 #define NVMHAL_DMAREAD    false
00049 #endif
00050 
00052 #define NVMHAL_SLEEP           (NVMHAL_SLEEP_FORMAT | NVMHAL_SLEEP_WRITE)
00053 
00055 #include "em_device.h"
00056 
00057 #if (NVMHAL_SLEEP == true)
00058 #include "em_msc.h"
00059 #include "em_dma.h"
00060 #include "em_cmu.h"
00061 #include "em_emu.h"
00062 #include "em_int.h"
00063 #endif
00064 
00065 #ifdef __cplusplus
00066 extern "C" {
00067 #endif
00068 
00069 
00070 /*******************************************************************************
00071  *****************************   PROTOTYPES   **********************************
00072  ******************************************************************************/
00073 
00074 void NVMHAL_Init(void);
00075 void NVMHAL_DeInit(void);
00076 void NVMHAL_Read(uint8_t *pAddress, void *pObject, uint16_t len);
00077 Ecode_t NVMHAL_Write(uint8_t *pAddress, void const *pObject, uint16_t len);
00078 Ecode_t NVMHAL_PageErase(uint8_t *pAddress);
00079 void NVMHAL_Checksum(uint16_t *checksum, void *pMemory, uint16_t len);
00080 
00081 #ifdef __cplusplus
00082 }
00083 #endif
00084 
00085 #endif /* __NVMHAL_H */