]> rtime.felk.cvut.cz Git - arc.git/blob - include/NvM_ConfigTypes.h
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[arc.git] / include / NvM_ConfigTypes.h
1 /* -------------------------------- Arctic Core ------------------------------\r
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
3  *\r
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
5  *\r
6  * This source code is free software; you can redistribute it and/or modify it\r
7  * under the terms of the GNU General Public License version 2 as published by the\r
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
9  *\r
10  * This program is distributed in the hope that it will be useful, but\r
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
13  * for more details.\r
14  * -------------------------------- Arctic Core ------------------------------*/\r
15 \r
16 \r
17 \r
18 #ifndef NVM_CONFIG_TYPES_H_\r
19 #define NVM_CONFIG_TYPES_H_\r
20 \r
21 #include "NvM_Types.h"\r
22 \r
23 /* NvM_ApiConfigClassType */    /** @req NVM491 */\r
24 #define NVM_API_CONFIG_CLASS_1  0\r
25 #define NVM_API_CONFIG_CLASS_2  1\r
26 #define NVM_API_CONFIG_CLASS_3  2\r
27 \r
28 typedef enum {\r
29         NVM_CRC16,\r
30         NVM_CRC32\r
31 } Nvm_BlockCRCTypeType;\r
32 \r
33 typedef enum {\r
34         NVM_BLOCK_NATIVE,\r
35         NVM_BLOCK_REDUNDANT,\r
36         NVM_BLOCK_DATASET\r
37 } NvM_BlockManagementTypeType;\r
38 \r
39 /*\r
40  * Callback function prototypes\r
41  */\r
42 \r
43 typedef Std_ReturnType (*NvM_SingleBlockCallbackFunctionType)(uint8 ServiceId, NvM_RequestResultType JobResult);        /** @req NVM467 */\r
44 typedef void (*NvM_MultiBlockCallbackFunctionType)(uint8 ServiceId, NvM_RequestResultType JobResult);   /** @req NVM468 */\r
45 typedef Std_ReturnType (*NvM_InitBlockCallbackFunctionType)(void);      /** @req NVM469 */\r
46 \r
47 /*\r
48  * Containers and configuration parameters
49  */\r
50 \r
51 typedef struct {\r
52         NvM_MultiBlockCallbackFunctionType              MultiBlockCallback;             /** @req NVM500 */\r
53         // The rest of the parameters is realized in NvM_Cfg.h\r
54 } NvM_CommonType;\r
55 \r
56 #if 0   // Currently not used\r
57 typedef struct {\r
58 //      ???                     EaRef;  // TODO: Check this\r
59 //      ???                     FeeRef; // TODO: Check this\r
60 } NvM_TargetBlockReferenceType;\r
61 #endif\r
62 \r
63 typedef struct {\r
64         // NVRAM block global settings\r
65         uint16                                                          NvramBlockIdentifier;   /** @req 3.1.5|NVM481 */        // TODO: Remove? Not needed if block nr correspond to array index.\r
66         NvM_BlockManagementTypeType                     BlockManagementType;    /** @req 3.1.5|NVM062 */\r
67         uint8                                                           BlockJobPriority;               /** @req 3.1.5|NVM477 */\r
68         boolean                                                         BlockWriteProt;                 /** @req 3.1.5|NVM033 */\r
69         boolean                                                         WriteBlockOnce;                 /** @req 3.1.5|NVM072 */\r
70         boolean                                                         SelectBlockForReadall;  /** @req 3.1.5|NVM117 *//** @req 3.1.5|NVM245 */\r
71         boolean                                                         ResistantToChangesSw;   /** @req 3.1.5|NVM483 */\r
72         NvM_SingleBlockCallbackFunctionType     SingleBlockCallback;\r
73         uint16                                                          NvBlockLength;                  /** @req 3.1.5|NVM479 */        // TODO: Check this\r
74 \r
75         // CRC usage of RAM and NV blocks\r
76         boolean                                                         BlockUseCrc;                    /** @req 3.1.5|NVM036 */\r
77         Nvm_BlockCRCTypeType                            BlockCRCType;                   /** @req 3.1.5|NVM476 */\r
78 \r
79         // RAM block, RamBlockDataAddress == NULL means temporary block otherwise permanent block\r
80         uint8                                                           *RamBlockDataAddress;   /** @req 3.1.5|NVM482 */\r
81         boolean                                                         CalcRamBlockCrc;                /** @req 3.1.5|NVM119 */\r
82 \r
83         // NV block, FEE/EA references\r
84         uint8                                                           NvBlockNum;                             /** @req 3.1.5|NVM480 */\r
85         uint32                                                          NvramDeviceId;                  /** @req 3.1.5|NVM035 */\r
86         uint16                                                          NvBlockBaseNumber;              /** @req 3.1.5|NVM478 */\r
87 \r
88         // ROM block, reference, if RomBlockDataAdress == NULL no ROM data is available\r
89         uint16                                                          RomBlockNum;                    /** @req 3.1.5|NVM485 */\r
90         uint8                                                           *RomBlockDataAdress;    /** @req 3.1.5|NVM484 */\r
91         NvM_InitBlockCallbackFunctionType       InitBlockCallback;              /** @req 3.1.5|NVM116 */\r
92 \r
93         // Containers\r
94 #if 0   // Currently not used\r
95         NvM_TargetBlockReferenceType            TargetBlockReference;   /** @req NVM486 */\r
96 #endif\r
97 } NvM_BlockDescriptorType;      /** @req NVM061 */\r
98 \r
99 typedef struct {\r
100         // Containers\r
101         NvM_CommonType                                  Common;                         // 1\r
102         const NvM_BlockDescriptorType   *BlockDescriptor;       // 1..65536\r
103 } NvM_ConfigType;\r
104 \r
105 /*\r
106  * Make the NvM_Config visible for others.\r
107  */\r
108 extern const NvM_ConfigType NvM_Config;\r
109 \r
110 \r
111 \r
112 \r
113 #endif /*NVM_CONFIG_TYPES_H_*/\r