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 /*
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 "Fls_Cfg.h"
113 #include "Fls_Irq.h"
114 #include "Fls_Cbk.h"
115 #include "MemIf_Types.h"
116 #include <SchM_Fls.h>
117 #include "Os.h"
118 
119 #ifdef __cplusplus
120 extern "C"
121 {
122 #endif
123 
124 
125 /* ========================================================================== */
126 /* Macros & Typedefs */
127 /* ========================================================================== */
128 
136 #define FLS_SW_MAJOR_VERSION (2U)
137 
138 #define FLS_SW_MINOR_VERSION (0U)
139 
140 #define FLS_SW_PATCH_VERSION (0U)
141 /* @} */
142 
150 #define FLS_AR_RELEASE_MAJOR_VERSION (4U)
151 
152 #define FLS_AR_RELEASE_MINOR_VERSION (3U)
153 
154 #define FLS_AR_RELEASE_REVISION_VERSION (1U)
155 /* @} */
156 
162 #define FLS_VENDOR_ID ((uint16) 44U)
163 
164 #define FLS_MODULE_ID ((uint16) 92U)
165 
166 #define FLS_INSTANCE_ID ((uint8) 0U)
167 /* @} */
168 
169 
171 /*
172  * Design : MCAL-7457
173  */
174 typedef uint32 Fls_AddressType;
175 typedef uint32 Fls_LengthType;
176 
177 
184 /*
185  * 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
186  */
187 #ifndef FLS_E_PARAM_CONFIG
188 
189 #define FLS_E_PARAM_CONFIG ((uint8) 0x01U)
190 #endif
191 #ifndef FLS_E_PARAM_ADDRESS
192 
193 #define FLS_E_PARAM_ADDRESS ((uint8) 0x02U)
194 #endif
195 #ifndef FLS_E_PARAM_LENGTH
196 
197 #define FLS_E_PARAM_LENGTH ((uint8) 0x03U)
198 #endif
199 #ifndef FLS_E_PARAM_DATA
200 
201 #define FLS_E_PARAM_DATA ((uint8) 0x04U)
202 #endif
203 #ifndef FLS_E_UNINIT
204 
205 #define FLS_E_UNINIT ((uint8) 0x05U)
206 #endif
207 #ifndef FLS_E_BUSY
208 
209 #define FLS_E_BUSY ((uint8) 0x06U)
210 #endif
211 #ifndef FLS_E_PARAM_POINTER
212 
213 #define FLS_E_PARAM_POINTER ((uint8) 0x0AU)
214 #endif
215 #ifndef FLS_E_VERIFY_ERASE_FAILED
216 
217 #define FLS_E_VERIFY_ERASE_FAILED ((uint8) 0x07U)
218 #endif
219 #ifndef FLS_E_VERIFY_WRITE_FAILED
220 
221 #define FLS_E_VERIFY_WRITE_FAILED ((uint8) 0x08U)
222 #endif
223 #ifndef FLS_E_TIMEOUT
224 
225 #define FLS_E_TIMEOUT ((uint8) 0x09U)
226 #endif
227 
228 
229 /*TRANSIENT FAULTS WITH HW*/
230 #ifndef FLS_E_ERASE_FAILED
231 
232 #define FLS_E_ERASE_FAILED ((uint8) 0x01U)
233 #endif
234 #ifndef FLS_E_WRITE_FAILED
235 
236 #define FLS_E_WRITE_FAILED ((uint8) 0x02U)
237 #endif
238 #ifndef FLS_E_READ_FAILED
239 
240 #define FLS_E_READ_FAILED ((uint8) 0x03U)
241 #endif
242 #ifndef FLS_E_COMPARE_FAILED
243 
244 #define FLS_E_COMPARE_FAILED ((uint8) 0x04U)
245 #endif
246 #ifndef FLS_E_UNEXPECTED_FLASH_ID
247 
248 #define FLS_E_UNEXPECTED_FLASH_ID ((uint8) 0x05U)
249 #endif
250 
251 
260 #define FLS_SID_INIT ((uint8) 0x00U)
261 
262 #define FLS_SID_ERASE ((uint8) 0x01U)
263 
264 #define FLS_SID_WRITE ((uint8) 0x02U)
265 
266 #define FLS_SID_CANCEL ((uint8) 0x03U)
267 
268 #define FLS_SID_GET_STATUS ((uint8) 0x04U)
269 
270 #define FLS_SID_GET_JOB_RESULT ((uint8) 0x05U)
271 
272 #define FLS_SID_READ ((uint8) 0x07U)
273 
274 #define FLS_SID_COMPARE ((uint8) 0x08U)
275 
276 #define FLS_SID_SET_MODE ((uint8) 0x09U)
277 
278 #define FLS_SID_GET_VERSION_INFO ((uint8) 0x10U)
279 
280 #define FLS_SID_BLANK_CHECK ((uint8) 0x0AU)
281 
282 #define FLS_SID_MAIN_FUNCTION ((uint8) 0x06U)
283 
284 /* @} */
285 
286 /* ========================================================================== */
287 /* Structures and Enums */
288 /* ========================================================================== */
289 
298 /*
299  * Design : MCAL-7339,MCAL-7328,MCAL-7248,MCAL-7298,MCAL-7415,MCAL-7411,MCAL-7431,MCAL-7460,MCAL-7434
300  */
301 typedef struct
302 {
312 
316 typedef enum
317 {
330 /*
331  * 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
332  */
333 typedef struct Fls_ConfigType_s
334 {
335  Fls_JobEndNotifyType Fls_JobEndNotification;
338  Fls_JobErrorNotifyType Fls_JobErrorNotification;
347  Fls_SectorType sectorList[1];
351  boolean dacEnable;
353  boolean xipEnable;
355  uint64 ospiClkSpeed;
357  boolean dtrEnable;
359  boolean phyEnable;
365  uint32 blockSize;
368 
369 /* @} */
370 
371 /* ========================================================================== */
372 /* Function Declarations */
373 /* ========================================================================== */
374 
381 FUNC(void, FLS_CODE) Fls_SwitchMode(boolean dacEnable, boolean xipEnable);
382 
400 FUNC(void, FLS_CODE) Fls_Init(
401  P2CONST(Fls_ConfigType, AUTOMATIC, FLS_CONFIG_DATA) ConfigPtr);
402 
426 FUNC(Std_ReturnType, FLS_CODE) Fls_Erase(Fls_AddressType TargetAddress, Fls_LengthType Length);
427 
453 FUNC(Std_ReturnType, FLS_CODE) Fls_Write(Fls_AddressType TargetAddress,
454  const uint8 *SourceAddressPtr, Fls_LengthType Length);
455 
481 FUNC(Std_ReturnType, FLS_CODE) Fls_Read(Fls_AddressType SourceAddress,
482  uint8 *TargetAddressPtr,
483  Fls_LengthType Length);
484 
513 #if (STD_ON == FLS_COMPARE_API)
514 FUNC(Std_ReturnType, FLS_CODE) Fls_Compare(Fls_AddressType SourceAddress, const uint8 *TargetAddressPtr, Fls_LengthType Length);
515 #endif
516 
546 #if (STD_ON == FLS_BLANK_CHECK_API)
547 FUNC(Std_ReturnType, FLS_CODE) Fls_BlankCheck(Fls_AddressType Address, Fls_LengthType Length);
548 #endif
549 
567 #if (STD_ON == FLS_GET_STATUS_API)
568 FUNC(MemIf_StatusType, FLS_CODE) Fls_GetStatus( void );
569 #endif
570 
591 #if (STD_ON == FLS_VERSION_INFO_API)
592 FUNC(Std_ReturnType, FLS_CODE) Fls_GetVersionInfo(Std_VersionInfoType *versioninfo);
593 #endif
594 
612 #if (STD_ON == FLS_GET_JOB_RESULT_API)
613 FUNC(MemIf_JobResultType, FLS_CODE) Fls_GetJobResult( void );
614 #endif
615 
627 FUNC(void, FLS_CODE) Fls_MainFunction(void);
628 
646 FUNC(void, FLS_CODE) Fls_Cancel(void);
647 
648 #ifdef __cplusplus
649 }
650 #endif
651 
652 #endif /* #ifndef FLS_H_ */
653 
654 /* @} */
Definition: Fls.h:324
Std_ReturnType Fls_GetVersionInfo(Std_VersionInfoType *versioninfo)
This service returns the version information of this module.
uint32 Fls_LengthType
Definition: Fls.h:175
Std_ReturnType Fls_Erase(Fls_AddressType TargetAddress, Fls_LengthType Length)
Erases flash sector(s).
uint64 ospiClkSpeed
Definition: Fls.h:355
boolean dtrEnable
Definition: Fls.h:357
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:344
void Fls_Init(const Fls_ConfigType *ConfigPtr)
Initializes the Flash Driver.
Definition: Fls.h:320
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:338
FLS Module Flashable Sectors and pages.
Definition: Fls.h:301
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:303
Fls_JobEndNotifyType Fls_JobEndNotification
Definition: Fls.h:335
Std_ReturnType Fls_Read(Fls_AddressType SourceAddress, uint8 *TargetAddressPtr, Fls_LengthType Length)
Reads from flash memory..
uint32 blockSize
Definition: Fls.h:365
uint32 Fls_AddressType
Type of address type.
Definition: Fls.h:174
OSPI_xferLines
Number of lines used for OSPI read/write transaction.
Definition: Fls.h:316
uint32 flsBaudRateDiv
Definition: Fls.h:363
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:353
Fls_LengthType sectorPageSize
Definition: Fls.h:305
void Fls_Cancel(void)
Cancels an ongoing job.
uint32 maxReadNormalMode
Definition: Fls.h:341
This file contains generated pre compile configuration file for FLS MCAL driver.
OSPI_xferLines ospixferlines
Definition: Fls.h:361
Definition: Fls.h:318
boolean phyEnable
Definition: Fls.h:359
boolean dacEnable
Definition: Fls.h:351
Fls_AddressType sectorStartaddress
Definition: Fls.h:309
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:307
Definition: Fls.h:322
FLS Module Configuration Structure.
Definition: Fls.h:333