1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\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
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
14 * -------------------------------- Arctic Core ------------------------------*/
\r
26 // Only if external flash device
\r
28 #include "Std_Types.h"
\r
30 #include "MemIf_Types.h"
\r
31 #if defined(USE_DEM)
\r
34 // SW ans Autosar spec versions
\r
35 #define FLS_SW_MAJOR_VERSION 1
\r
36 #define FLS_SW_MINOR_VERSION 0
\r
37 #define FLS_SW_PATCH_VERSION 1
\r
38 #define FLS_AR_MAJOR_VERSION 3
\r
39 #define FLS_AR_MINOR_VERSION 0
\r
40 #define FLS_AR_PATCH_VERSION 2
\r
42 // API service called with wrong parameter
\r
43 #define FLS_E_PARAM_CONFIG 0x01
\r
44 #define FLS_E_PARAM_ADDRESS 0x02
\r
45 #define FLS_E_PARAM_LENGTH 0x03
\r
46 #define FLS_E_PARAM_DATA 0x04
\r
47 // API service called without module initialization
\r
48 #define FLS_E_UNINIT 0x05
\r
49 // API service called while driver still busy
\r
50 #define FLS_E_BUSY 0x06
\r
51 // Erase verification (blank check) failed
\r
52 #define FLS_E_VERIFY_ERASE_FAILED 0x07
\r
53 // Write verification (compare) failed
\r
54 #define FLS_E_VERIFY_WRITE_FAILED 0x08
\r
56 // Service id's for fls functions
\r
57 #define FLS_INIT_ID 0x00
\r
58 #define FLS_ERASE_ID 0x01
\r
59 #define FLS_WRITE_ID 0x02
\r
60 #define FLS_CANCEL_ID 0x03
\r
61 #define FLS_GET_STATUS_ID 0x04
\r
62 #define FLS_GET_JOB_RESULT_ID 0x05
\r
63 #define FLS_MAIN_FUNCTION_ID 0x06
\r
64 #define FLS_READ_ID 0x07
\r
65 #define FLS_COMPARE_ID 0x08
\r
66 #define FLS_SET_MODE_ID 0x09
\r
67 #define FLS_GET_VERSION_INFO_ID 0x10
\r
69 // Used as address offset from the configured flash base address to access a certain
\r
70 // flash memory area.
\r
71 typedef uint32 Fls_AddressType;
\r
73 // Specifies the number of bytes to read/write/erase/compare
\r
76 // Shall be the same type as Fls_AddressType because of
\r
77 // arithmetic operations. Size depends on target platform and
\r
79 typedef uint32 Fls_LengthType;
\r
81 #include "Fls_Cfg.h"
\r
84 * Initializes the Flash Driver.
\r
86 * @param ConfigPtr Pointer to flash driver configuration set.
\r
88 void Fls_Init( const Fls_ConfigType *ConfigPtr );
\r
92 * Erases flash sector(s).
\r
94 * @param TargetAddress Target address in flash memory.
\r
95 * This address offset will be
\r
96 * added to the flash memory base address.
\r
98 * Max.: FLS_SIZE - 1
\r
100 * @param Length Number of bytes to erase
\r
102 * Max.: FLS_SIZE - TargetAddress
\r
104 * @return E_OK: erase command has been accepted
\r
105 * E_NOT_OK: erase command has not been accepted
\r
108 Std_ReturnType Fls_Erase( Fls_AddressType TargetAddress,
\r
109 Fls_LengthType Length );
\r
112 Std_ReturnType Fls_Write ( Fls_AddressType TargetAddress,
\r
113 const uint8 *SourceAddressPtr,
\r
114 Fls_LengthType Length );
\r
116 #if ( FLS_CANCEL_API == STD_ON )
\r
117 void Fls_Cancel( void );
\r
120 #if ( FLS_GET_STATUS_API == STD_ON )
\r
121 MemIf_StatusType Fls_GetStatus( void );
\r
125 MemIf_JobResultType Fls_GetJobResult( void );
\r
128 void Fls_MainFunction( void );
\r
130 Std_ReturnType Fls_Read ( Fls_AddressType SourceAddress,
\r
131 uint8 *TargetAddressPtr,
\r
132 Fls_LengthType Length );
\r
134 #if ( FLS_COMPARE_API == STD_ON )
\r
135 Std_ReturnType Fls_Compare( Fls_AddressType SourceAddress,
\r
136 uint8 *TargetAddressPtr,
\r
137 Fls_LengthType Length );
\r
140 #if ( FLS_SET_MODE_API == STD_ON )
\r
141 void Fls_SetMode( Fls_ModeType Mode );
\r
144 void Fls_GetVersionInfo( Std_VersionInfoType *VersioninfoPtr );
\r
146 void Fls_Check( uint32 flsBaseAddress, uint32 flsTotalSize );
\r