nvm_config.h

Go to the documentation of this file.
00001 /***************************************************************************/
00014 #ifndef __NVMCONFIG_H
00015 #define __NVMCONFIG_H
00016 
00017 #include <stdint.h>
00018 #include <stdbool.h>
00019 #include "ecode.h"
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00025 /***************************************************************************/
00030 /***************************************************************************/
00035 /*******************************************************************************
00036  ****************************   CONFIGURATION   ********************************
00037  ******************************************************************************/
00038 
00040 #define NVM_FEATURE_WEAR_PAGES_ENABLED               true
00041 
00043 #define NVM_FEATURE_STATIC_WEAR_ENABLED              true
00044   
00046 #define NVM_STATIC_WEAR_THRESHOLD                    100
00047 
00049 #define NVM_FEATURE_READ_VALIDATION_ENABLED          true
00050 
00052 #define NVM_FEATURE_WRITE_VALIDATION_ENABLED         true
00053 
00055 #define NVM_FEATURE_WEARLEVELGET_ENABLED             true
00056 
00058 #define NVM_FEATURE_WRITE_NECESSARY_CHECK_ENABLED    true
00059 
00061 #define NVM_MAX_NUMBER_OF_PAGES                      32
00062   
00065 #define NVM_PAGES_SCRATCH                            1
00066 
00068 #define NVM_PAGE_SIZE                                FLASH_PAGE_SIZE
00069 
00070 /*******************************************************************************
00071  ******************************   TYPEDEFS   ***********************************
00072  ******************************************************************************/
00073 
00075 typedef enum
00076 {
00077   nvmPageTypeNormal = 0, 
00078   nvmPageTypeWear   = 1  
00079 } NVM_Page_Type_t;
00080 
00082 typedef struct
00083 {
00084   uint8_t  * location; 
00085   uint16_t size;       
00086   uint8_t  objectId;   
00087 } NVM_Object_Descriptor_t;
00088 
00090 typedef NVM_Object_Descriptor_t   NVM_Page_t[];
00091 
00092 
00094 typedef struct
00095 {
00096   uint8_t           pageId;    
00097   NVM_Page_t const *page;      
00098   uint8_t           pageType;  
00099 } NVM_Page_Descriptor_t;
00100 
00102 typedef NVM_Page_Descriptor_t   NVM_Page_Table_t[];
00103 
00105 typedef struct
00106 { NVM_Page_Table_t const *nvmPages;  
00107   uint8_t          const pages;      
00108   uint8_t          const userPages;  
00109   uint8_t          const *nvmArea;   
00110 } NVM_Config_t;
00111 
00112 
00113 /*******************************************************************************
00114  *****************************   PROTOTYPES   **********************************
00115  ******************************************************************************/
00116 
00117 NVM_Config_t const *NVM_ConfigGet(void);
00118 
00122 #ifdef __cplusplus
00123 }
00124 #endif
00125 
00126 #endif /* __NVMCONFIG_H */