MCUSW
Fls.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2020 Texas Instruments Incorporated
4 *
5 * All rights reserved not granted herein.
6 *
7 * Limited License.
8 *
9 * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10 * license under copyrights and patents it now or hereafter owns or controls to make,
11 * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12 * terms herein. With respect to the foregoing patent license, such license is granted
13 * solely to the extent that any such patent is necessary to Utilize the software alone.
14 * The patent license shall not apply to any combinations which include this software,
15 * other than combinations with devices manufactured by or for TI ("TI Devices").
16 * No hardware patent is licensed hereunder.
17 *
18 * Redistributions must preserve existing copyright notices and reproduce this license
19 * (including the above copyright notice and the disclaimer and (if applicable) source
20 * code license limitations below) in the documentation and/or other materials provided
21 * with the distribution
22 *
23 * Redistribution and use in binary form, without modification, are permitted provided
24 * that the following conditions are met:
25 *
26 * * No reverse engineering, decompilation, or disassembly of this software is
27 * permitted with respect to any software provided in binary form.
28 *
29 * * any redistribution and use are licensed by TI for use only with TI Devices.
30 *
31 * * Nothing shall obligate TI to provide you with source code for the software
32 * licensed and provided to you in object code.
33 *
34 * If software source code is provided to you, modification and redistribution of the
35 * source code are permitted provided that the following conditions are met:
36 *
37 * * any redistribution and use of the source code, including any resulting derivative
38 * works, are licensed by TI for use only with TI Devices.
39 *
40 * * any redistribution and use of any object code compiled from the source code
41 * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42 *
43 * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44 *
45 * may be used to endorse or promote products derived from this software without
46 * specific prior written permission.
47 *
48 * DISCLAIMER.
49 *
50 * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53 * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59 * OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
61 */
62 
95 /* Design : DES_FLS_001, DES_FLS_002 */
96 /*
97  * Below are the global requirements which are met by this FLS
98  * driver which can't be mapped to a particular source ID
99  */
100 /*
101  * Requirements : MCAL-4169, MCAL-4180, MCAL-4181, MCAL-4183,
102  * MCAL-4184, MCAL-4185, MCAL-4186, MCAL-4189,
103  * MCAL-4211, MCAL-4317, MCAL-4319, MCAL-4334,
104  * MCAL-4335, MCAL-4345, MCAL-4346. MCAL-4347,
105  * MCAL-4348, MCAL-4350, MCAL-4169, MCAL-4179
106  */
107 
108  #ifndef FLS_H_
109  #define FLS_H_
110 
111 /* ========================================================================== */
112 /* Include Files */
113 /* ========================================================================== */
114 
115 
116 #include "Std_Types.h"
117 #include "Fls_Cfg.h"
118 #include "Fls_Irq.h"
119 #include "Fls_Cbk.h"
120 #include "MemIf_Types.h"
121 #include <SchM_Fls.h>
122 
123 #ifdef __cplusplus
124 extern "C"
125 {
126 #endif
127 
128 
129 /* ========================================================================== */
130 /* Macros & Typedefs */
131 /* ========================================================================== */
132 
140 #define FLS_SW_MAJOR_VERSION (1U)
141 
142 #define FLS_SW_MINOR_VERSION (3U)
143 
144 #define FLS_SW_PATCH_VERSION (2U)
145 /* @} */
146 
154 #define FLS_AR_RELEASE_MAJOR_VERSION (4U)
155 
156 #define FLS_AR_RELEASE_MINOR_VERSION (3U)
157 
158 #define FLS_AR_RELEASE_REVISION_VERSION (1U)
159 /* @} */
160 
166 #define FLS_VENDOR_ID ((uint16) 44U)
167 
168 #define FLS_MODULE_ID ((uint16) 92U)
169 
170 #define FLS_INSTANCE_ID ((uint8) 0U)
171 /* @} */
172 
173 
175 /* Requirements : MCAL-4214, MCAL-4213, MCAL-4216 */
176 typedef uint32 Fls_AddressType;
177 typedef uint32 Fls_LengthType;
178 
179 
186 /* Design : DES_FLS_006 */
187 /* Requirements : MCAL-4192, MCAL-4198, MCAL-4200,
188  * MCAL-4199, MCAL-4197, MCAL-4196
189  * MCAL-4190, MCAL-4191, MCAL-4190
190  */
191 #ifndef FLS_E_PARAM_CONFIG
192 
193 #define FLS_E_PARAM_CONFIG ((uint8) 0x01U)
194 #endif
195 #ifndef FLS_E_PARAM_ADDRESS
196 
197 #define FLS_E_PARAM_ADDRESS ((uint8) 0x02U)
198 #endif
199 #ifndef FLS_E_PARAM_LENGTH
200 
201 #define FLS_E_PARAM_LENGTH ((uint8) 0x03U)
202 #endif
203 #ifndef FLS_E_PARAM_DATA
204 
205 #define FLS_E_PARAM_DATA ((uint8) 0x04U)
206 #endif
207 #ifndef FLS_E_UNINIT
208 
209 #define FLS_E_UNINIT ((uint8) 0x05U)
210 #endif
211 #ifndef FLS_E_BUSY
212 
213 #define FLS_E_BUSY ((uint8) 0x06U)
214 #endif
215 #ifndef FLS_E_PARAM_POINTER
216 
217 #define FLS_E_PARAM_POINTER ((uint8) 0x0AU)
218 #endif
219 #ifndef FLS_E_VERIFY_ERASE_FAILED
220 
221 #define FLS_E_VERIFY_ERASE_FAILED ((uint8) 0x07U)
222 #endif
223 #ifndef FLS_E_VERIFY_WRITE_FAILED
224 
225 #define FLS_E_VERIFY_WRITE_FAILED ((uint8) 0x08U)
226 #endif
227 #ifndef FLS_E_TIMEOUT
228 
229 #define FLS_E_TIMEOUT ((uint8) 0x09U)
230 #endif
231 
232 
233 /*TRANSIENT FAULTS WITH HW*/
234 #ifndef FLS_E_ERASE_FAILED
235 
236 #define FLS_E_ERASE_FAILED ((uint8) 0x01U)
237 #endif
238 #ifndef FLS_E_WRITE_FAILED
239 
240 #define FLS_E_WRITE_FAILED ((uint8) 0x02U)
241 #endif
242 #ifndef FLS_E_READ_FAILED
243 
244 #define FLS_E_READ_FAILED ((uint8) 0x03U)
245 #endif
246 #ifndef FLS_E_COMPARE_FAILED
247 
248 #define FLS_E_COMPARE_FAILED ((uint8) 0x04U)
249 #endif
250 #ifndef FLS_E_UNEXPECTED_FLASH_ID
251 
252 #define FLS_E_UNEXPECTED_FLASH_ID ((uint8) 0x05U)
253 #endif
254 
255 
264 #define FLS_SID_INIT ((uint8) 0x00U)
265 
266 #define FLS_SID_ERASE ((uint8) 0x01U)
267 
268 #define FLS_SID_WRITE ((uint8) 0x02U)
269 
270 #define FLS_SID_CANCEL ((uint8) 0x03U)
271 
272 #define FLS_SID_GET_STATUS ((uint8) 0x04U)
273 
274 #define FLS_SID_GET_JOB_RESULT ((uint8) 0x05U)
275 
276 #define FLS_SID_READ ((uint8) 0x07U)
277 
278 #define FLS_SID_COMPARE ((uint8) 0x08U)
279 
280 #define FLS_SID_SET_MODE ((uint8) 0x09U)
281 
282 #define FLS_SID_GET_VERSION_INFO ((uint8) 0x10U)
283 
284 #define FLS_SID_BLANK_CHECK ((uint8) 0x0AU)
285 
286 #define FLS_SID_MAIN_FUNCTION ((uint8) 0x06U)
287 
288 /* @} */
289 
290 /* ========================================================================== */
291 /* Structures and Enums */
292 /* ========================================================================== */
293 
302 /* Design : DES_FLS_009 */
303 /* Requirements : MCAL-4415, MCAL-4412, MCAL-4416, MCAL-4414,
304  * MCAL-4413
305  */
306 typedef struct
307 {
317 
318 
322 /* Design : DES_FLS_009 */
323 /* Requirements : MCAL-4403, MCAL-4404, MCAL-4406, MCAL-4408, MCAL-4411,
324  * MCAL-4818, MCAL-4819, MCAL-4821, MCAL-4820, MCAL-4212,
325  * MCAL-4357
326  */
327 typedef struct Fls_ConfigType_s
328 {
329  Fls_JobEndNotifyType Fls_JobEndNotification;
332  Fls_JobErrorNotifyType Fls_JobErrorNotification;
341  Fls_SectorType sectorList[1];
345  boolean dacEnable;
347  boolean xipEnable;
349  uint64 ospiClkSpeed;
351  boolean dtrEnable;
353  boolean phyEnable;
356 
357 /* @} */
358 
359 /* ========================================================================== */
360 /* Function Declarations */
361 /* ========================================================================== */
362 
369 FUNC(void, FLS_CODE) Fls_SwitchMode(boolean dacEnable, boolean xipEnable);
370 
388 FUNC(void, FLS_CODE) Fls_Init(
389  P2CONST(Fls_ConfigType, AUTOMATIC, FLS_CONFIG_DATA) ConfigPtr);
390 
414 FUNC(Std_ReturnType, FLS_CODE) Fls_Erase(Fls_AddressType TargetAddress, Fls_LengthType Length);
415 
441 FUNC(Std_ReturnType, FLS_CODE) Fls_Write(Fls_AddressType TargetAddress,
442  const uint8 *SourceAddressPtr, Fls_LengthType Length);
443 
469 FUNC(Std_ReturnType, FLS_CODE) Fls_Read(Fls_AddressType SourceAddress,
470  uint8 *TargetAddressPtr,
471  Fls_LengthType Length);
472 
501 #if (STD_ON == FLS_COMPARE_API)
502 FUNC(Std_ReturnType, FLS_CODE) Fls_Compare(Fls_AddressType SourceAddress, const uint8 *TargetAddressPtr, Fls_LengthType Length);
503 #endif
504 
534 #if (STD_ON == FLS_BLANK_CHECK_API)
535 FUNC(Std_ReturnType, FLS_CODE) Fls_BlankCheck(Fls_AddressType Address, Fls_LengthType Length);
536 #endif
537 
555 #if (STD_ON == FLS_GET_STATUS_API)
556 FUNC(MemIf_StatusType, FLS_CODE) Fls_GetStatus( void );
557 #endif
558 
579 #if (STD_ON == FLS_VERSION_INFO_API)
580 FUNC(Std_ReturnType, FLS_CODE) Fls_GetVersionInfo(Std_VersionInfoType *versioninfo);
581 #endif
582 
600 #if (STD_ON == FLS_GET_JOB_RESULT_API)
601 FUNC(MemIf_JobResultType, FLS_CODE) Fls_GetJobResult( void );
602 #endif
603 
615 FUNC(void, FLS_CODE) Fls_MainFunction(void);
616 
617 #ifdef __cplusplus
618 }
619 #endif
620 
621 #endif /* #ifndef FLS_H_ */
622 
623 /* @} */
Std_ReturnType Fls_GetVersionInfo(Std_VersionInfoType *versioninfo)
This service returns the version information of this module.
uint32 Fls_LengthType
Definition: Fls.h:177
Std_ReturnType Fls_Erase(Fls_AddressType TargetAddress, Fls_LengthType Length)
Erases flash sector(s).
uint64 ospiClkSpeed
Definition: Fls.h:349
boolean dtrEnable
Definition: Fls.h:351
Std_ReturnType Fls_Compare(Fls_AddressType SourceAddress, const uint8 *TargetAddressPtr, Fls_LengthType Length)
Compares the contents of an area of flash memory with that of an application data buffer.
uint32 maxWriteNormalMode
Definition: Fls.h:338
void Fls_Init(const Fls_ConfigType *ConfigPtr)
Initializes the Flash Driver.
Std_ReturnType Fls_BlankCheck(Fls_AddressType Address, Fls_LengthType Length)
The function Fls_BlankCheck shall verify, whether a given memory area has been erased but not (yet) p...
Fls_JobErrorNotifyType Fls_JobErrorNotification
Definition: Fls.h:332
FLS Module Flashable Sectors and pages.
Definition: Fls.h:306
This file contains ISR function declaration for FLS MCAL driver.
MemIf_StatusType Fls_GetStatus(void)
Returns the driver state.
MemIf_JobResultType Fls_GetJobResult(void)
Returns the result of the last job.
Fls_LengthType numberOfSectors
Definition: Fls.h:308
Fls_JobEndNotifyType Fls_JobEndNotification
Definition: Fls.h:329
Std_ReturnType Fls_Read(Fls_AddressType SourceAddress, uint8 *TargetAddressPtr, Fls_LengthType Length)
Reads from flash memory..
uint32 Fls_AddressType
Type of address type.
Definition: Fls.h:176
void Fls_MainFunction(void)
Performs the processing of jobs.
Std_ReturnType Fls_Write(Fls_AddressType TargetAddress, const uint8 *SourceAddressPtr, Fls_LengthType Length)
Writes one or more complete flash pages.
boolean xipEnable
Definition: Fls.h:347
Fls_LengthType sectorPageSize
Definition: Fls.h:310
uint32 maxReadNormalMode
Definition: Fls.h:335
This file contains generated pre compile configuration file for FLS MCAL driver.
boolean phyEnable
Definition: Fls.h:353
boolean dacEnable
Definition: Fls.h:345
Fls_AddressType sectorStartaddress
Definition: Fls.h:314
void Fls_SwitchMode(boolean dacEnable, boolean xipEnable)
Switch Mode of the OSPI Driver Parameters (in) : boolean dacEnable - should DAC mode be enaled or dis...
Fls_LengthType sectorSize
Definition: Fls.h:312
FLS Module Configuration Structure.
Definition: Fls.h:327