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,MCAL-7432,MCAL-7431,MCAL-7460,MCAL-7434,MCAL-7411
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 /* Macros & Typedefs */
126 /* ========================================================================== */
127 
128 /* None */
129 
137 #define FLS_SW_MAJOR_VERSION (11U)
139 #define FLS_SW_MINOR_VERSION (1U)
141 #define FLS_SW_PATCH_VERSION (0U)
142 /* @} */
143 
151 #define FLS_AR_RELEASE_MAJOR_VERSION (4U)
153 #define FLS_AR_RELEASE_MINOR_VERSION (3U)
155 #define FLS_AR_RELEASE_REVISION_VERSION (1U)
156 /* @} */
157 
163 #define FLS_VENDOR_ID ((uint16) 44U)
165 #define FLS_MODULE_ID ((uint16) 92U)
167 #define FLS_INSTANCE_ID ((uint8) 0U)
168 /* @} */
169 
170 
172 /*
173  * Design : MCAL-7457
174  */
175 typedef uint32 Fls_AddressType;
176 typedef uint32 Fls_LengthType;
177 
178 
185 /*
186  * 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
187  */
188 #ifndef FLS_E_PARAM_CONFIG
190 #define FLS_E_PARAM_CONFIG ((uint8) 0x01U)
191 #endif
192 #ifndef FLS_E_PARAM_ADDRESS
194 #define FLS_E_PARAM_ADDRESS ((uint8) 0x02U)
195 #endif
196 #ifndef FLS_E_PARAM_LENGTH
198 #define FLS_E_PARAM_LENGTH ((uint8) 0x03U)
199 #endif
200 #ifndef FLS_E_PARAM_DATA
202 #define FLS_E_PARAM_DATA ((uint8) 0x04U)
203 #endif
204 #ifndef FLS_E_UNINIT
206 #define FLS_E_UNINIT ((uint8) 0x05U)
207 #endif
208 #ifndef FLS_E_BUSY
210 #define FLS_E_BUSY ((uint8) 0x06U)
211 #endif
212 #ifndef FLS_E_PARAM_POINTER
214 #define FLS_E_PARAM_POINTER ((uint8) 0x0AU)
215 #endif
216 #ifndef FLS_E_VERIFY_ERASE_FAILED
218 #define FLS_E_VERIFY_ERASE_FAILED ((uint8) 0x07U)
219 #endif
220 #ifndef FLS_E_VERIFY_WRITE_FAILED
222 #define FLS_E_VERIFY_WRITE_FAILED ((uint8) 0x08U)
223 #endif
224 #ifndef FLS_E_TIMEOUT
226 #define FLS_E_TIMEOUT ((uint8) 0x09U)
227 #endif
228 
229 
230 /*TRANSIENT FAULTS WITH HW*/
231 #ifndef FLS_E_ERASE_FAILED
233 #define FLS_E_ERASE_FAILED ((uint8) 0x01U)
234 #endif
235 #ifndef FLS_E_WRITE_FAILED
237 #define FLS_E_WRITE_FAILED ((uint8) 0x02U)
238 #endif
239 #ifndef FLS_E_READ_FAILED
241 #define FLS_E_READ_FAILED ((uint8) 0x03U)
242 #endif
243 #ifndef FLS_E_COMPARE_FAILED
245 #define FLS_E_COMPARE_FAILED ((uint8) 0x04U)
246 #endif
247 #ifndef FLS_E_UNEXPECTED_FLASH_ID
249 #define FLS_E_UNEXPECTED_FLASH_ID ((uint8) 0x05U)
250 #endif
251 
252 
261 #define FLS_SID_INIT ((uint8) 0x00U)
263 #define FLS_SID_ERASE ((uint8) 0x01U)
265 #define FLS_SID_WRITE ((uint8) 0x02U)
267 #define FLS_SID_CANCEL ((uint8) 0x03U)
269 #define FLS_SID_GET_STATUS ((uint8) 0x04U)
271 #define FLS_SID_GET_JOB_RESULT ((uint8) 0x05U)
273 #define FLS_SID_READ ((uint8) 0x07U)
275 #define FLS_SID_COMPARE ((uint8) 0x08U)
277 #define FLS_SID_SET_MODE ((uint8) 0x09U)
279 #define FLS_SID_GET_VERSION_INFO ((uint8) 0x10U)
281 #define FLS_SID_BLANK_CHECK ((uint8) 0x0AU)
283 #define FLS_SID_MAIN_FUNCTION ((uint8) 0x06U)
284 
285 /* @} */
286 
287 /* ========================================================================== */
288 /* Structures and Enums */
289 /* ========================================================================== */
290 
299 typedef enum
300 {
313 /*
314  * 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
315  */
316 typedef struct Fls_ConfigType_s
317 {
318  Fls_JobEndNotifyType Fls_JobEndNotification;
321  Fls_JobErrorNotifyType Fls_JobErrorNotification;
330  boolean dacEnable;
332  boolean xipEnable;
334  uint64 ospiClkSpeed;
336  boolean dtrEnable;
338  boolean phyEnable;
344  uint32 blockSize;
347 
348 /* @} */
349 
350 /* ========================================================================== */
351 /* Function Declarations */
352 /* ========================================================================== */
353 
360 FUNC(void, FLS_CODE) Fls_SwitchMode(boolean dacEnable, boolean xipEnable);
361 
379 FUNC(void, FLS_CODE) Fls_Init(
380  P2CONST(Fls_ConfigType, AUTOMATIC, FLS_CONFIG_DATA) ConfigPtr);
381 
405 FUNC(Std_ReturnType, FLS_CODE) Fls_Erase(Fls_AddressType TargetAddress, Fls_LengthType Length);
406 
432 FUNC(Std_ReturnType, FLS_CODE) Fls_Write(Fls_AddressType TargetAddress,
433  const uint8 *SourceAddressPtr, Fls_LengthType Length);
434 
460 FUNC(Std_ReturnType, FLS_CODE) Fls_Read(Fls_AddressType SourceAddress,
461  uint8 *TargetAddressPtr,
462  Fls_LengthType Length);
463 
492 #if (STD_ON == FLS_COMPARE_API)
493 FUNC(Std_ReturnType, FLS_CODE) Fls_Compare(Fls_AddressType SourceAddress, const uint8 *TargetAddressPtr, Fls_LengthType Length);
494 #endif
495 
525 #if (STD_ON == FLS_BLANK_CHECK_API)
526 FUNC(Std_ReturnType, FLS_CODE) Fls_BlankCheck(Fls_AddressType Address, Fls_LengthType Length);
527 #endif
528 
546 #if (STD_ON == FLS_GET_STATUS_API)
547 FUNC(MemIf_StatusType, FLS_CODE) Fls_GetStatus( void );
548 #endif
549 
570 #if (STD_ON == FLS_VERSION_INFO_API)
571 FUNC(Std_ReturnType, FLS_CODE) Fls_GetVersionInfo(Std_VersionInfoType *versioninfo);
572 #endif
573 
591 #if (STD_ON == FLS_GET_JOB_RESULT_API)
592 FUNC(MemIf_JobResultType, FLS_CODE) Fls_GetJobResult( void );
593 #endif
594 
606 FUNC(void, FLS_CODE) Fls_MainFunction(void);
607 
625 #if ( FLS_CANCEL_API == STD_ON )
626 FUNC(void, FLS_CODE) Fls_Cancel(void);
627 #endif
628 
629 #ifdef __cplusplus
630 }
631 #endif
632 
633 #endif /* #ifndef FLS_H_ */
634 
635 /* @} */
This file contains generated pre compile configuration file for FLS MCAL driver.
This file contains ISR function declaration for FLS MCAL driver.
Std_ReturnType Fls_Read(Fls_AddressType SourceAddress, uint8 *TargetAddressPtr, Fls_LengthType Length)
Reads from flash memory..
Std_ReturnType Fls_GetVersionInfo(Std_VersionInfoType *versioninfo)
This service returns the version information of this module.
MemIf_StatusType Fls_GetStatus(void)
Returns the driver state.
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...
Std_ReturnType Fls_Erase(Fls_AddressType TargetAddress, Fls_LengthType Length)
Erases flash sector(s).
void Fls_Init(const Fls_ConfigType *ConfigPtr)
Initializes the Flash Driver.
MemIf_JobResultType Fls_GetJobResult(void)
Returns the result of the last job.
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.
void Fls_SwitchMode(boolean dacEnable, boolean xipEnable)
Switch Mode of the OSPI Driver Parameters (in) : boolean dacEnable - should DAC mode be enaled or dis...
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.
OSPI_xferLines
Number of lines used for OSPI read/write transaction.
Definition: Fls.h:300
uint32 Fls_LengthType
Definition: Fls.h:176
void Fls_Cancel(void)
Cancels an ongoing job.
uint32 Fls_AddressType
Type of address type.
Definition: Fls.h:175
uint32 blockSize
Definition: Fls.h:344
boolean dacEnable
Definition: Fls.h:330
uint32 flsBaudRateDiv
Definition: Fls.h:342
uint32 maxWriteNormalMode
Definition: Fls.h:327
OSPI_xferLines ospixferlines
Definition: Fls.h:340
uint32 maxReadNormalMode
Definition: Fls.h:324
Fls_JobErrorNotifyType Fls_JobErrorNotification
Definition: Fls.h:321
boolean xipEnable
Definition: Fls.h:332
boolean phyEnable
Definition: Fls.h:338
uint64 ospiClkSpeed
Definition: Fls.h:334
Fls_JobEndNotifyType Fls_JobEndNotification
Definition: Fls.h:318
boolean dtrEnable
Definition: Fls.h:336
@ OSPI_XFER_LINES_SINGLE
Definition: Fls.h:301
@ OSPI_XFER_LINES_DUAL
Definition: Fls.h:303
@ OSPI_XFER_LINES_OCTAL
Definition: Fls.h:307
@ OSPI_XFER_LINES_QUAD
Definition: Fls.h:305
FLS Module Configuration Structure.
Definition: Fls.h:317