XMEMWFF3.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024-2026, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /*
34  * ========== XMEMWFF3.h ==========
35  */
36 #ifndef ti_drivers_xmem_XMEMWFF3__include
37 #define ti_drivers_xmem_XMEMWFF3__include
38 
39 #include <stdint.h>
40 #include <stdbool.h>
41 
42 #if defined(__cplusplus)
43 extern "C" {
44 #endif
45 
49 #define XMEM_FLASH 0
50 #define XMEM_PSRAM 1
51 
56 #define XMEM_WORD_SIZE 4
57 
61 #define CONFIG_XMEM_COUNT 1
62 
66 #define XMEM_NUM_HANDLER 16
67 
76 #define XMEM_STATUS_SUCCESS (0)
77 
85 #define XMEM_STATUS_ERROR (-1)
86 
92 #define XMEM_STATUS_TIMEOUT (-3)
93 
101 #define XMEM_STATUS_INV_OFFSET (-4)
102 
109 #define XMEM_STATUS_INV_ALIGNMENT (-5)
110 
118 #define XMEM_STATUS_INV_SIZE (-6)
119 
127 #define XMEM_STATUS_INV_WRITE (-7)
128 
135 #define XMEM_STATUS_VERIFYBUFFER (-8)
136 
144 #define XMEM_STATUS_INVALID_PARAMS (-9)
145 
155 #define XMEM_READ (0x0)
156 
164 #define XMEM_READ_STIG (0x1)
165 
182 #define XMEM_WRITE (0x0)
183 
191 #define XMEM_WRITE_ERASE (0x1)
192 
201 #define XMEM_WRITE_PRE_VERIFY (0x2)
202 
210 #define XMEM_WRITE_POST_VERIFY (0x4)
211 
218 #define XMEM_WRITE_STIG (0x8)
219 
227 typedef struct
228 {
229  uint32_t address;
230  uint32_t data;
231 } FlashRegister;
232 
239 typedef struct
240 {
241  uint32_t preStigCfg;
242  uint32_t StigCfg;
243  uint32_t postStigCfg;
244  FlashRegister preStigOperation[1];
245  FlashRegister stigOperation[1];
246  FlashRegister postStigOperation[1];
248 
255 typedef struct
256 {
257  uint32_t preStigCfg;
258  uint32_t postStigCfg;
259  FlashRegister preStigOperation[1];
260  FlashRegister stigOperation[1];
261  FlashRegister postStigOperation[1];
263 
270 typedef struct
271 {
272  uint32_t preStigCfg;
273  uint32_t postStigCfg;
274  FlashRegister preStigOperation[1];
275  FlashRegister stigOperation[1];
276  FlashRegister postStigOperation[1];
278 
285 typedef struct
286 {
287  uint32_t NumOfIteration;
288  uint32_t command;
289  uint32_t timeOut;
290  uint32_t polarity;
291  uint32_t mask;
293 
300 typedef struct
301 {
302  FlashRegister enterStigCfg[3];
306  FlashRegister exitStigCfg[3];
308  size_t sectorSize;
309  size_t verifyBufSize;
310 } FlashType;
311 
319 typedef struct
320 {
323 
330 typedef struct
331 {
332  bool opened;
333  uintptr_t mutexKey;
334  size_t regionBase;
336  size_t regionSize;
337  size_t deviceNum;
339 
347 typedef struct
348 {
350 } XMEM_Attrs;
351 
355 typedef struct XMEM_Config_ *XMEM_Handle;
356 
368 typedef struct XMEM_Config_
369 {
371  void *object;
372 
374  const void *hwAttrs;
375 } XMEM_Config;
376 
384 typedef struct
385 {
386  size_t regionBase;
388  size_t regionSize;
389  uint8_t deviceNum;
390 } XMEM_Params;
391 
399 typedef enum
400 {
416 
427 int_fast16_t XMEMWFF3_close(XMEM_Handle handle);
428 
459 int_fast16_t XMEMWFF3_erase(XMEM_Handle handle, size_t offset, size_t size);
460 
471 void XMEMWFF3_getAttrs(XMEM_Handle handle, XMEM_Attrs *attrs);
472 
483 void XMEMWFF3_getObject(XMEM_Handle handle, XMEMWFF3_Object *object);
484 
493 uint8_t XMEMWFF3_getActiveHandlers(void);
494 
502 void XMEMWFF3_init(void);
503 
532 int_fast16_t XMEMWFF3_lock(XMEM_Handle handle, uint32_t timeout);
533 
545 XMEM_Handle XMEMWFF3_open(XMEM_Params *params);
546 
574 int_fast16_t XMEMWFF3_read(XMEM_Handle handle, size_t offset, void *buffer, size_t bufferSize, uint_fast16_t flags);
575 
584 void XMEMWFF3_unlock(XMEM_Handle handle);
585 
637 int_fast16_t XMEMWFF3_write(XMEM_Handle handle, size_t offset, void *buffer, size_t bufferSize, uint_fast16_t flags);
638 
641 #if defined(__cplusplus)
642 }
643 #endif /* defined (__cplusplus) */
644 
646 #endif /* ti_drivers_xmem_XMEMWFF3__include */
Flash STIG read configuration structure.
Definition: XMEMWFF3.h:270
struct XMEM_Config_ * XMEM_Handle
A handle that is returned from the XMEMWFF3_open() call.
Definition: XMEMWFF3.h:355
size_t regionSize
Definition: XMEMWFF3.h:388
Definition: XMEMWFF3.h:414
Definition: XMEMWFF3.h:406
ADC_Params params
Definition: Driver_Init.h:11
XMEM Global configuration.
Definition: XMEMWFF3.h:368
bool opened
Definition: XMEMWFF3.h:332
void * object
Definition: XMEMWFF3.h:371
Definition: XMEMWFF3.h:404
Definition: XMEMWFF3.h:413
int_fast16_t XMEMWFF3_read(XMEM_Handle handle, size_t offset, void *buffer, size_t bufferSize, uint_fast16_t flags)
Read data from the XMEM region associated with the XMEM_Handle.
uint32_t postStigCfg
Definition: XMEMWFF3.h:258
Definition: XMEMWFF3.h:408
uint32_t preStigCfg
Definition: XMEMWFF3.h:272
uint32_t postStigCfg
Definition: XMEMWFF3.h:273
uint32_t NumOfIteration
Definition: XMEMWFF3.h:287
uint32_t postStigCfg
Definition: XMEMWFF3.h:243
uint8_t XMEMWFF3_getActiveHandlers(void)
Function to get the number of active XMEM handlers.
uint32_t timeOut
Definition: XMEMWFF3.h:289
int_fast16_t XMEMWFF3_lock(XMEM_Handle handle, uint32_t timeout)
Function to lock the XMEM driver.
Definition: XMEMWFF3.h:401
Definition: XMEMWFF3.h:410
size_t regionStartAddr
Definition: XMEMWFF3.h:335
Hardware attributes structure for the XMEMWFF3 driver.
Definition: XMEMWFF3.h:319
Flash register structure for address-data pairs.
Definition: XMEMWFF3.h:227
XMEM_Flash_Idx
External flash device type identifiers.
Definition: XMEMWFF3.h:399
struct XMEM_Config_ XMEM_Config
XMEM Global configuration.
void XMEMWFF3_getObject(XMEM_Handle handle, XMEMWFF3_Object *object)
Function to get the XMEM object.
FlashStigEraseCfg eraseStigCfg
Definition: XMEMWFF3.h:305
size_t regionBase
Definition: XMEMWFF3.h:386
Flash STIG erase configuration structure.
Definition: XMEMWFF3.h:239
FlashType flashType
Definition: XMEMWFF3.h:321
size_t regionBase
Definition: XMEMWFF3.h:334
int_fast16_t XMEMWFF3_close(XMEM_Handle handle)
Function to close an XMEM_Handle.
int_fast16_t XMEMWFF3_erase(XMEM_Handle handle, size_t offset, size_t size)
Erase size bytes of the region beginning at offset bytes from the base of the region referenced by th...
Definition: XMEMWFF3.h:402
uint32_t polarity
Definition: XMEMWFF3.h:290
size_t regionSize
Definition: XMEMWFF3.h:336
void XMEMWFF3_init(void)
Function to initialize the XMEM module.
Flash polling configuration structure.
Definition: XMEMWFF3.h:285
uint32_t command
Definition: XMEMWFF3.h:288
int_fast16_t XMEMWFF3_write(XMEM_Handle handle, size_t offset, void *buffer, size_t bufferSize, uint_fast16_t flags)
Write data to the XMEM region associated with the XMEM_Handle.
void XMEMWFF3_unlock(XMEM_Handle handle)
Function to unlock the XMEM driver.
Definition: XMEMWFF3.h:405
XMEM_Handle XMEMWFF3_open(XMEM_Params *params)
Open an XMEM region for reading and writing.
Definition: XMEMWFF3.h:412
Flash type configuration structure.
Definition: XMEMWFF3.h:300
Definition: XMEMWFF3.h:403
const void * hwAttrs
Definition: XMEMWFF3.h:374
FlashType flashType
Definition: XMEMWFF3.h:349
size_t sectorSize
Definition: XMEMWFF3.h:308
size_t regionStartAddr
Definition: XMEMWFF3.h:387
size_t verifyBufSize
Definition: XMEMWFF3.h:309
uint32_t address
Definition: XMEMWFF3.h:229
Parameters for opening an XMEM region.
Definition: XMEMWFF3.h:384
FlashStigWriteCfg writeStigCfg
Definition: XMEMWFF3.h:304
uint32_t data
Definition: XMEMWFF3.h:230
Definition: XMEMWFF3.h:409
Flash STIG write configuration structure.
Definition: XMEMWFF3.h:255
uintptr_t mutexKey
Definition: XMEMWFF3.h:333
XMEM attributes.
Definition: XMEMWFF3.h:347
size_t deviceNum
Definition: XMEMWFF3.h:337
Definition: XMEMWFF3.h:411
void XMEMWFF3_getAttrs(XMEM_Handle handle, XMEM_Attrs *attrs)
Function to get the XMEM attributes.
uint32_t preStigCfg
Definition: XMEMWFF3.h:257
FlashPollingCfg pollingCfg
Definition: XMEMWFF3.h:307
uint32_t preStigCfg
Definition: XMEMWFF3.h:241
uint32_t mask
Definition: XMEMWFF3.h:291
Runtime state object for the XMEMWFF3 driver instance.
Definition: XMEMWFF3.h:330
uint8_t deviceNum
Definition: XMEMWFF3.h:389
FlashStigReadCfg readStigCfg
Definition: XMEMWFF3.h:303
Definition: XMEMWFF3.h:407
uint32_t StigCfg
Definition: XMEMWFF3.h:242
© Copyright 1995-2026, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale