]> rtime.felk.cvut.cz Git - arc.git/blob - include/NvM.h
Regenerated examples. Removed linux board. Added default cross compiler for TI.
[arc.git] / include / NvM.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 \r
19 \r
20 \r
21 \r
22 \r
23 /** @req NVM077 */\r
24 \r
25 \r
26 #ifndef NVM_H_\r
27 #define NVM_H_\r
28 \r
29 #define NVM_MODULE_ID                   MODULE_ID_NVM\r
30 #define NVM_VENDOR_ID                   1\r
31 \r
32 #define NVM_SW_MAJOR_VERSION    1\r
33 #define NVM_SW_MINOR_VERSION    0\r
34 #define NVM_SW_PATCH_VERSION    0\r
35 #define NVM_AR_MAJOR_VERSION    3\r
36 #define NVM_AR_MINOR_VERSION    0\r
37 #define NVM_AR_PATCH_VERSION    1\r
38 \r
39 #include "NvM_Cfg.h"\r
40 /** @req NVM028 */ // NvmCommon configuration block is implemented in the NvM_Cfg.h file\r
41 /** @req NVM491 *//** @req NVM492 *//** @req NVM493 *//** @req NVM494 *//** @req NVM495 */\r
42 /** @req NVM496 *//** @req NVM497 *//** @req NVM498 *//** @req NVM499 */\r
43 /** @req NVM501 *//** @req NVM502 *//** @req NVM503 *//** @req NVM504 *//** @req NVM505 */\r
44 \r
45 \r
46 #if (NVM_DEV_ERROR_DETECT == STD_ON)\r
47 // Error codes reported by this module defined by AUTOSAR\r
48 #define NVM_E_PARAM_BLOCK_ID                            0x0A\r
49 #define NVM_E_PARAM_BLOCK_TYPE                          0x0B\r
50 #define NVM_E_PARAM_BLOCK_DATA_IDX                      0x0C\r
51 #define NVM_E_PARAM_ADDRESS                                     0x0D\r
52 #define NVM_E_PARAM_DATA                                        0x0E\r
53 #define NVM_E_NOT_INITIALIZED                           0x14\r
54 #define NVM_E_BLOCK_PENDING                                     0x15\r
55 #define NVM_E_LIST_OVERFLOW                                     0x16\r
56 #define NVM_E_NV_WRITE_PROTECTED                        0x17\r
57 #define NVM_E_BLOCK_CONFIG                                      0x18\r
58 \r
59 \r
60 // Other error codes reported by this module\r
61 #define NVM_PARAM_OUT_OF_RANGE                          0x40\r
62 #define NVM_UNEXPECTED_STATE                            0x41\r
63 #define NVM_E_WRONG_CONFIG                                      0xfd\r
64 #define NVM_E_UNEXPECTED_EXECUTION                      0xfe\r
65 #define NVM_E_NOT_IMPLEMENTED_YET                       0xff\r
66 \r
67 #endif\r
68 // Service ID in this module\r
69 #define NVM_INIT_ID                                                             0x00\r
70 #define NVM_SET_DATA_INDEX_ID                                   0x01\r
71 #define NVM_GET_DATA_INDEX_ID                                   0x02\r
72 #define NVM_SET_BLOCK_PROTECTION_ID                             0x03\r
73 #define NVM_GET_ERROR_STATUS_ID                                 0x04\r
74 #define NVM_SET_RAM_BLOCK_STATUS_ID                             0x05\r
75 #define NVM_READ_BLOCK_ID                                               0x06\r
76 #define NVM_WRITE_BLOCK_ID                                              0x07\r
77 #define NVM_RESTORE_BLOCK_DEFAULTS_ID                   0x08\r
78 #define NVM_ERASE_NV_BLOCK_ID                                   0x09\r
79 #define NVM_CANCEL_WRITE_ALL_ID                                 0x0a\r
80 #define NVM_INVALIDATENV_BLOCK_ID                               0x0b\r
81 #define NVM_READ_ALL_ID                                                 0x0c\r
82 #define NVM_WRITE_ALL_ID                                                0x0d\r
83 #define NVM_MAIN_FUNCTION_ID                                    0x0e\r
84 #define NVM_GET_VERSION_INFO_ID                                 0x0f\r
85 \r
86 #define NVM_LOC_READ_BLOCK_ID                                   0x40\r
87 #define NVM_LOC_WRITE_BLOCK_ID                                  0x41\r
88 #define NVM_GLOBAL_ID                                                   0xff\r
89 \r
90 \r
91 \r
92 #if ( NVM_VERSION_INFO_API == STD_ON )  /** @req NVM452 */\r
93 #define NvM_GetVersionInfo(_vi) STD_GET_VERSION_INFO(_vi, NVM)\r
94 #endif /* NVM_VERSION_INFO_API */\r
95 \r
96 void NvM_MainFunction(void);    /** @req NVM464 */\r
97 \r
98 void NvM_Init( void );  /** @req NVM447 */\r
99 void NvM_ReadAll( void );       /** @req NVM460 */\r
100 void NvM_WriteAll( void );      /** @req NVM461 */\r
101 void NvM_CancelWriteAll( void );        /** @req NVM458 */\r
102 Std_ReturnType NvM_GetErrorStatus( NvM_BlockIdType blockId, NvM_RequestResultType *requestResultPtr );  /** @req NVM451 */\r
103 void NvM_SetBlockLockStatus( NvM_BlockIdType blockId, boolean blockLocked );\r
104 \r
105 #if (NVM_SET_RAM_BLOCK_STATUS_API == STD_ON)\r
106 Std_ReturnType NvM_SetRamBlockStatus( NvM_BlockIdType blockId, boolean blockChanged );  /** @req NVM453 */\r
107 #endif\r
108 \r
109 #if (NVM_API_CONFIG_CLASS > NVM_API_CONFIG_CLASS_1)\r
110 Std_ReturnType NvM_SetDataIndex( NvM_BlockIdType blockId, uint8 dataIndex );    /** @req NVM448 */\r
111 Std_ReturnType NvM_GetDataIndex( NvM_BlockIdType blockId, uint8 *dataIndexPtr );        /** @req NVM449 */\r
112 Std_ReturnType NvM_ReadBlock( NvM_BlockIdType blockId, uint8 *dstPtr ); /** @req NVM454 */\r
113 Std_ReturnType NvM_WriteBlock( NvM_BlockIdType blockId, const uint8 *srcPtr );  /** @req NVM455 */\r
114 Std_ReturnType NvM_RestoreBlockDefaults( NvM_BlockIdType blockId, uint8 *dstPtr );      /** @req NVM456 */\r
115 #endif\r
116 \r
117 #if (NVM_API_CONFIG_CLASS > NVM_API_CONFIG_CLASS_2)\r
118 Std_ReturnType NvM_SetBlockProtection( NvM_BlockIdType blockId, boolean protectionEnabled );    /** @req NVM450 */\r
119 Std_ReturnType NvM_EraseNvBlock( NvM_BlockIdType blockId );     /** @req NVM457 */\r
120 Std_ReturnType NvM_InvalidateNvBlock( NvM_BlockIdType blockId );        /** @req NVM459 */\r
121 #endif\r
122 \r
123 \r
124 \r
125 \r
126 #endif /*NVM_H_*/\r