nvm_hal.h

Go to the documentation of this file.
00001 /***************************************************************************/
00036 #ifndef __NVMHAL_H
00037 #define __NVMHAL_H
00038 
00039 #include <stdbool.h>
00040 
00041 #include "nvm.h"
00042 
00043 /* Defines for changing HAL functionality. These are both a bit experimental,
00044  * but should work properly. */
00045 
00046 /* Custom write and format methods based on the emlib are used in place of
00047 * the originals. These methods put the CPU to sleep by going to EM1 while the
00048 * operation progresses.
00049 *
00050 * NVMHAL_SLEEP_FORMAT and NVMHAL_SLEEP_WRITE is only used for toggling
00051 * which function is called, and includes about the same amount of code. */
00052 
00054 #ifndef NVMHAL_SLEEP_FORMAT
00055 #define NVMHAL_SLEEP_FORMAT    false
00056 #endif
00057 
00059 #ifndef NVMHAL_SLEEP_WRITE
00060 #define NVMHAL_SLEEP_WRITE     false
00061 #endif
00062 
00066 #ifndef NVMHAL_DMAREAD
00067 #define NVMHAL_DMAREAD    false
00068 #endif
00069 
00071 #define NVMHAL_SLEEP           (NVMHAL_SLEEP_FORMAT | NVMHAL_SLEEP_WRITE)
00072 
00074 #include "em_device.h"
00075 
00076 #if (NVMHAL_SLEEP == true)
00077 #include "em_msc.h"
00078 #include "em_dma.h"
00079 #include "em_cmu.h"
00080 #include "em_emu.h"
00081 #include "em_int.h"
00082 #endif
00083 
00084 #ifdef __cplusplus
00085 extern "C" {
00086 #endif
00087 
00088 /*******************************************************************************
00089  ******************************   CONSTANTS   **********************************
00090  ******************************************************************************/
00091 
00092 /*******************************************************************************
00093  *****************************   PROTOTYPES   **********************************
00094  ******************************************************************************/
00095 
00096 void NVMHAL_Init(void);
00097 void NVMHAL_DeInit(void);
00098 void NVMHAL_Read(uint8_t *pAddress, void *pObject, uint16_t len);
00099 NVM_Result_t NVMHAL_Write(uint8_t *pAddress, void const *pObject, uint16_t len);
00100 NVM_Result_t NVMHAL_PageErase(uint8_t *pAddress);
00101 void NVMHAL_Checksum(uint16_t *checksum, void *pMemory, uint16_t len);
00102 
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 
00107 #endif /* __NVMHAL_H */