MCUSW
Fls.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (C) 2024 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 /*
96  * Below are the global requirements which are met by this FLS
97  * driver which can't be mapped to a particular source ID
98  */
99 /*
100  * Design : MCAL-7370,MCAL-7251,MCAL-7373,MCAL-7357,MCAL-7387,MCAL-7461,MCAL-7446,MCAL-7391,MCAL-7277,MCAL-7323,MCAL-7272,MCAL-7475,MCAL-7363.MCAL-7347,MCAL-7352,MCAL-7444,MCAL-7373,MCAL-7405,MCAL-7338,MCAL-7347,MCAL-7461
101  */
102 
103  #ifndef FLS_H_
104  #define FLS_H_
105 
106 /* ========================================================================== */
107 /* Include Files */
108 /* ========================================================================== */
109 
110 
111 #include "Std_Types.h"
112 #include "Os.h"
113 #include "Fls_Cfg.h"
114 #include "Fls_Irq.h"
115 #include "Fls_Cbk.h"
116 #include "MemIf_Types.h"
117 #include <SchM_Fls.h>
118 
119 #ifdef __cplusplus
120 extern "C"
121 {
122 #endif
123 
124 
125 /* ========================================================================== */
126 /* Macros & Typedefs */
127 /* ========================================================================== */
128 
136 #define FLS_ISR_VOID (0x00U)
137 
138 #define FLS_ISR_CAT1 (0x01U)
139 
140 #define FLS_ISR_CAT2 (0x02U)
141 /* @} */
142 
150 #define FLS_SW_MAJOR_VERSION (10U)
151 
152 #define FLS_SW_MINOR_VERSION (1U)
153 
154 #define FLS_SW_PATCH_VERSION (0U)
155 /* @} */
156 
164 #define FLS_AR_RELEASE_MAJOR_VERSION (4U)
165 
166 #define FLS_AR_RELEASE_MINOR_VERSION (3U)
167 
168 #define FLS_AR_RELEASE_REVISION_VERSION (1U)
169 /* @} */
170 
176 #define FLS_VENDOR_ID ((uint16) 44U)
177 
178 #define FLS_MODULE_ID ((uint16) 92U)
179 
180 #define FLS_INSTANCE_ID ((uint8) 0U)
181 /* @} */
182 
183 
185 /*
186  * Design : MCAL-7457
187  */
188 typedef uint32 Fls_AddressType;
189 typedef uint32 Fls_LengthType;
190 
191 
198 /*
199  * Design : MCAL-7275,MCAL-7369,MCAL-7308,MCAL-7267,MCAL-7427,MCAL-7269,MCAL-7394,MCAL-7332,MCAL-7394,MCAL-7257,MCAL-7269,MCAL-7308,MCAL-7455,MCAL-7358
200  */
201 #ifndef FLS_E_PARAM_CONFIG
202 
203 #define FLS_E_PARAM_CONFIG ((uint8) 0x01U)
204 #endif
205 #ifndef FLS_E_PARAM_ADDRESS
206 
207 #define FLS_E_PARAM_ADDRESS ((uint8) 0x02U)
208 #endif
209 #ifndef FLS_E_PARAM_LENGTH
210 
211 #define FLS_E_PARAM_LENGTH ((uint8) 0x03U)
212 #endif
213 #ifndef FLS_E_PARAM_DATA
214 
215 #define FLS_E_PARAM_DATA ((uint8) 0x04U)
216 #endif
217 #ifndef FLS_E_UNINIT
218 
219 #define FLS_E_UNINIT ((uint8) 0x05U)
220 #endif
221 #ifndef FLS_E_BUSY
222 
223 #define FLS_E_BUSY ((uint8) 0x06U)
224 #endif
225 #ifndef FLS_E_PARAM_POINTER
226 
227 #define FLS_E_PARAM_POINTER ((uint8) 0x0AU)
228 #endif
229 #ifndef FLS_E_VERIFY_ERASE_FAILED
230 
231 #define FLS_E_VERIFY_ERASE_FAILED ((uint8) 0x07U)
232 #endif
233 #ifndef FLS_E_VERIFY_WRITE_FAILED
234 
235 #define FLS_E_VERIFY_WRITE_FAILED ((uint8) 0x08U)
236 #endif
237 #ifndef FLS_E_TIMEOUT
238 
239 #define FLS_E_TIMEOUT ((uint8) 0x09U)
240 #endif
241 
242 
243 /*TRANSIENT FAULTS WITH HW*/
244 #ifndef FLS_E_ERASE_FAILED
245 
246 #define FLS_E_ERASE_FAILED ((uint8) 0x01U)
247 #endif
248 #ifndef FLS_E_WRITE_FAILED
249 
250 #define FLS_E_WRITE_FAILED ((uint8) 0x02U)
251 #endif
252 #ifndef FLS_E_READ_FAILED
253 
254 #define FLS_E_READ_FAILED ((uint8) 0x03U)
255 #endif
256 #ifndef FLS_E_COMPARE_FAILED
257 
258 #define FLS_E_COMPARE_FAILED ((uint8) 0x04U)
259 #endif
260 #ifndef FLS_E_UNEXPECTED_FLASH_ID
261 
262 #define FLS_E_UNEXPECTED_FLASH_ID ((uint8) 0x05U)
263 #endif
264 
265 
274 #define FLS_SID_INIT ((uint8) 0x00U)
275 
276 #define FLS_SID_ERASE ((uint8) 0x01U)
277 
278 #define FLS_SID_WRITE ((uint8) 0x02U)
279 
280 #define FLS_SID_CANCEL ((uint8) 0x03U)
281 
282 #define FLS_SID_GET_STATUS ((uint8) 0x04U)
283 
284 #define FLS_SID_GET_JOB_RESULT ((uint8) 0x05U)
285 
286 #define FLS_SID_READ ((uint8) 0x07U)
287 
288 #define FLS_SID_COMPARE ((uint8) 0x08U)
289 
290 #define FLS_SID_SET_MODE ((uint8) 0x09U)
291 
292 #define FLS_SID_GET_VERSION_INFO ((uint8) 0x10U)
293 
294 #define FLS_SID_BLANK_CHECK ((uint8) 0x0AU)
295 
296 #define FLS_SID_MAIN_FUNCTION ((uint8) 0x06U)
297 
298 /* @} */
299 
300 /* ========================================================================== */
301 /* Structures and Enums */
302 /* ========================================================================== */
303 
312 /*
313  * Design : MCAL-7339,MCAL-7328,MCAL-7248,MCAL-7298,MCAL-7415,MCAL-7411,MCAL-7431,MCAL-7460,MCAL-7434
314  */
315 typedef struct
316 {
326 
330 typedef enum
331 {
344 /*
345  * Design : MCAL-7343,MCAL-7355,MCAL-7302,MCAL-7404,MCAL-7290,MCAL-7414,MCAL-7273,MCAL-7396,MCAL-7323,MCAL-7348,MCAL-7364,MCAL-7360,MCAL-7287,MCAL-7317,MCAL-7365,MCAL-7291,MCAL-7262
346  */
347 typedef struct Fls_ConfigType_s
348 {
349  Fls_JobEndNotifyType Fls_JobEndNotification;
352  Fls_JobErrorNotifyType Fls_JobErrorNotification;
361  Fls_SectorType sectorList[1];
365  boolean dacEnable;
367  boolean xipEnable;
369  uint64 ospiClkSpeed;
371  boolean dtrEnable;
373  boolean phyEnable;
379  uint32 blockSize;
382 
383 /* @} */
384 
385 /* ========================================================================== */
386 /* Function Declarations */
387 /* ========================================================================== */
388 
395 FUNC(void, FLS_CODE) Fls_SwitchMode(boolean dacEnable, boolean xipEnable);
396 
414 FUNC(void, FLS_CODE) Fls_Init(
415  P2CONST(Fls_ConfigType, AUTOMATIC, FLS_CONFIG_DATA) ConfigPtr);
416 
440 FUNC(Std_ReturnType, FLS_CODE) Fls_Erase(Fls_AddressType TargetAddress, Fls_LengthType Length);
441 
467 FUNC(Std_ReturnType, FLS_CODE) Fls_Write(Fls_AddressType TargetAddress,
468  const uint8 *SourceAddressPtr, Fls_LengthType Length);
469 
495 FUNC(Std_ReturnType, FLS_CODE) Fls_Read(Fls_AddressType SourceAddress,
496  uint8 *TargetAddressPtr,
497  Fls_LengthType Length);
498 
527 #if (STD_ON == FLS_COMPARE_API)
528 FUNC(Std_ReturnType, FLS_CODE) Fls_Compare(Fls_AddressType SourceAddress, const uint8 *TargetAddressPtr, Fls_LengthType Length);
529 #endif
530 
560 #if (STD_ON == FLS_BLANK_CHECK_API)
561 FUNC(Std_ReturnType, FLS_CODE) Fls_BlankCheck(Fls_AddressType Address, Fls_LengthType Length);
562 #endif
563 
581 #if (STD_ON == FLS_GET_STATUS_API)
582 FUNC(MemIf_StatusType, FLS_CODE) Fls_GetStatus( void );
583 #endif
584 
605 #if (STD_ON == FLS_VERSION_INFO_API)
606 FUNC(Std_ReturnType, FLS_CODE) Fls_GetVersionInfo(Std_VersionInfoType *versioninfo);
607 #endif
608 
626 #if (STD_ON == FLS_GET_JOB_RESULT_API)
627 FUNC(MemIf_JobResultType, FLS_CODE) Fls_GetJobResult( void );
628 #endif
629 
641 FUNC(void, FLS_CODE) Fls_MainFunction(void);
642 
660 #if ( FLS_CANCEL_API == STD_ON )
661 FUNC(void, FLS_CODE) Fls_Cancel(void);
662 #endif
663 
664 #ifdef __cplusplus
665 }
666 #endif
667 
668 #endif /* #ifndef FLS_H_ */
669 
670 /* @} */
Definition: Fls.h:338
Std_ReturnType Fls_GetVersionInfo(Std_VersionInfoType *versioninfo)
This service returns the version information of this module.
uint32 Fls_LengthType
Definition: Fls.h:189
Std_ReturnType Fls_Erase(Fls_AddressType TargetAddress, Fls_LengthType Length)
Erases flash sector(s).
uint64 ospiClkSpeed
Definition: Fls.h:369
boolean dtrEnable
Definition: Fls.h:371
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:358
void Fls_Init(const Fls_ConfigType *ConfigPtr)
Initializes the Flash Driver.
Definition: Fls.h:334
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:352
FLS Module Flashable Sectors and pages.
Definition: Fls.h:315
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:317
Fls_JobEndNotifyType Fls_JobEndNotification
Definition: Fls.h:349
Std_ReturnType Fls_Read(Fls_AddressType SourceAddress, uint8 *TargetAddressPtr, Fls_LengthType Length)
Reads from flash memory..
uint32 blockSize
Definition: Fls.h:379
uint32 Fls_AddressType
Type of address type.
Definition: Fls.h:188
OSPI_xferLines
Number of lines used for OSPI read/write transaction.
Definition: Fls.h:330
uint32 flsBaudRateDiv
Definition: Fls.h:377
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:367
Fls_LengthType sectorPageSize
Definition: Fls.h:319
void Fls_Cancel(void)
Cancels an ongoing job.
uint32 maxReadNormalMode
Definition: Fls.h:355
This file contains generated pre compile configuration file for FLS MCAL driver.
OSPI_xferLines ospixferlines
Definition: Fls.h:375
Definition: Fls.h:332
boolean phyEnable
Definition: Fls.h:373
boolean dacEnable
Definition: Fls.h:365
Fls_AddressType sectorStartaddress
Definition: Fls.h:323
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:321
Definition: Fls.h:336
FLS Module Configuration Structure.
Definition: Fls.h:347