AM64x MCU+ SDK  08.02.00
ospi/v0/ospi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * 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
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
50 #ifndef OSPI_H_
51 #define OSPI_H_
52 
53 /* ========================================================================== */
54 /* Include Files */
55 /* ========================================================================== */
56 
57 #include <stdint.h>
58 #include <kernel/dpl/SystemP.h>
59 #include <kernel/dpl/HwiP.h>
60 #include <kernel/dpl/SemaphoreP.h>
61 #include <drivers/hw_include/csl_types.h>
62 #include <drivers/hw_include/cslr_ospi.h>
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
68 /* ========================================================================== */
69 /* Macros & Typedefs */
70 /* ========================================================================== */
71 
73 typedef void *OSPI_Handle;
74 
83 #define OSPI_TRANSFER_COMPLETED (0U)
84 #define OSPI_TRANSFER_STARTED (1U)
85 #define OSPI_TRANSFER_CANCELLED (2U)
86 #define OSPI_TRANSFER_FAILED (3U)
87 #define OSPI_TRANSFER_CSN_DEASSERT (4U)
88 #define OSPI_TRANSFER_TIMEOUT (5U)
89 
110 #define OSPI_TRANSFER_MODE_BLOCKING (0U)
111 
115 #define OSPI_TRANSFER_MODE_CALLBACK (1U)
116 
120 #define OSPI_TRANSFER_MODE_POLLING (2U)
121 
137 #define OSPI_FF_POL0_PHA0 (0U)
138 #define OSPI_FF_POL0_PHA1 (CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_PHASE_FLD_MASK | 0U)
139 #define OSPI_FF_POL1_PHA0 (0U | CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_POL_FLD_MASK)
140 #define OSPI_FF_POL1_PHA1 (CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_PHASE_FLD_MASK | \
141  CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_POL_FLD_MASK)
142 
152 #define OSPI_XFER_LINES_SINGLE (0U)
153 #define OSPI_XFER_LINES_DUAL (1U)
154 #define OSPI_XFER_LINES_QUAD (2U)
155 #define OSPI_XFER_LINES_OCTAL (3U)
156 
166 #define OSPI_CMD_INVALID_OPCODE (0xFFU)
167 #define OSPI_CMD_INVALID_ADDR (0xFFFFFFFFU)
168 
178 #define OSPI_CMD_EXT_TYPE_REPEAT (0x00U)
179 #define OSPI_CMD_EXT_TYPE_INVERSE (0x01U)
180 #define OSPI_CMD_EXT_TYPE_NONE (0x02U)
181 
191 #define OSPI_NOR_PROTOCOL_1_1_1 (0x00)
192 #define OSPI_NOR_PROTOCOL_1_1_2 (0x01)
193 #define OSPI_NOR_PROTOCOL_1_2_2 (0x02)
194 #define OSPI_NOR_PROTOCOL_1_1_4 (0x03)
195 #define OSPI_NOR_PROTOCOL_1_4_4 (0x04)
196 #define OSPI_NOR_PROTOCOL_1_1_8 (0x05)
197 #define OSPI_NOR_PROTOCOL_1_8_8 (0x06)
198 #define OSPI_NOR_PROTOCOL_2_2_2_S (0x07)
199 #define OSPI_NOR_PROTOCOL_2_2_2_D (0x08)
200 #define OSPI_NOR_PROTOCOL_4_4_4_S (0x09)
201 #define OSPI_NOR_PROTOCOL_4_4_4_D (0x0A)
202 #define OSPI_NOR_PROTOCOL_8_8_8_S (0x0B)
203 #define OSPI_NOR_PROTOCOL_8_8_8_D (0x0C)
204 
214 #define OSPI_CS0 (0U)
215 #define OSPI_CS1 (1U)
216 #define OSPI_CS2 (2U)
217 #define OSPI_CS3 (3U)
218 
219 #define OSPI_CHIP_SELECT(x) ((~((1U) << (x))) & 0xFU)
220 
230 #define OSPI_DECODER_SELECT4 ((uint32_t) 0U)
231 #define OSPI_DECODER_SELECT16 ((uint32_t) 1U)
232 
234 /* ========================================================================== */
235 /* Structure Declarations */
236 /* ========================================================================== */
244 typedef struct
245 {
246  uint32_t count;
248  void *buf;
250  uint32_t addrOffset;
252  uint32_t status;
254  uint32_t transferTimeout;
257 
258 typedef struct
259 {
260  uint8_t cmd;
262  uint32_t cmdAddr;
265  uint8_t numAddrBytes;
267  void *txDataBuf;
269  uint32_t txDataLen;
272 
273 typedef struct
274 {
275  uint8_t cmd;
277  uint32_t cmdAddr;
280  uint8_t numAddrBytes;
282  void *rxDataBuf;
284  uint32_t rxDataLen;
287 
296 typedef struct
297 {
298  uint32_t regionStartAddr;
300  uint32_t regionSize;
304 
315 typedef struct
316 {
317  int32_t ospiDmaChIndex;
318  /* Index of Channel used by OSPI DMA Driver. This index will be set by SysCfg according to the DMA driver chosen.
319  * The OSPI driver uses this index to do an \ref OSPI_dmaOpen inside the \ref OSPI_open if the DMA mode is enabled
320  */
321 } OSPI_Params;
322 
324 typedef struct
325 {
326  /*
327  * SOC configuration
328  */
329  uint32_t baseAddr;
331  uint32_t dataBaseAddr;
333  uint32_t inputClkFreq;
336  /*
337  * Driver configuration
338  */
339  uint32_t intrNum;
341  uint32_t intrEnable;
343  uint8_t intrPriority;
345  uint32_t dtrEnable;
347  uint32_t dmaEnable;
349  uint32_t phyEnable;
351  uint32_t dacEnable;
353  uint32_t xferLines;
355  uint32_t frmFmt;
357  uint32_t devDelays[4];
359  uint32_t chipSelect;
361  uint32_t decChipSelect;
363  uint32_t baudRateDiv;
371 } OSPI_Attrs;
372 
377 typedef struct
378 {
379  /*
380  * User params
381  */
384  uint32_t transferMode;
386  uint32_t xferLines;
388  uint32_t rdDummyCycles;
390  uint32_t cmdDummyCycles;
392  uint32_t rdDataCapDelay;
396  uint32_t numAddrBytes;
401  uint32_t cmdExtType;
404  /*
405  * State variables
406  */
407  uint32_t isOpen;
421 } OSPI_Object;
422 
423 typedef struct
424 {
429 } OSPI_Config;
430 
431 typedef struct {
432 
433  /* Data and CMDs */
434 
455  uint32_t XSPI_NOR_SR_WIP;
456  uint32_t XSPI_NOR_SR_WEL;
491 
492  /* Settings and flags */
494  /* Number of address bytes supported. 3 or 4 or both */
495 
496  uint8_t dtrSupport;
497  /* Supports DTR clocking or not */
498 
499  uint8_t qeType;
500  /* Quad Enable Requirements Type */
501 
502  uint8_t seq444Enable[5];
503  /* Sequence numbers to enable 4-4-4 mode */
504 
505  uint8_t seq444Disable[4];
506  /* Sequence numbers to disable 4-4-4 mode */
507 
508  uint8_t oeType;
509  /* Octal Enable Requirements Type */
510 
511  uint8_t cmdExtType;
512  /* Command Extension supported by the flash in 8D mode */
513 
514  uint8_t byteOrder;
515  /* Byte order of the flash data out in 8D mode */
516 
517  uint8_t supportedEraseTypes[2];
518  /* Indexed array of 2 selected supported erase types. [0] will be sect, [1] will be block */
519 
521 
523 extern OSPI_Config gOspiConfig[];
525 extern uint32_t gOspiConfigNum;
526 
527 /* ========================================================================== */
528 /* Internal/Private Structure Declarations */
529 /* ========================================================================== */
530 
531 /* ========================================================================== */
532 /* Function Declarations */
533 /* ========================================================================== */
534 
538 void OSPI_init(void);
539 
543 void OSPI_deinit(void);
544 
545 
551 void OSPI_Params_init( OSPI_Params *ospiParams);
552 
567 OSPI_Handle OSPI_open(uint32_t index, const OSPI_Params *openParams);
568 
578 void OSPI_close(OSPI_Handle handle);
579 
593 
612 
625 
638 
664 int32_t OSPI_readCmd(OSPI_Handle handle, OSPI_ReadCmdParams *rdParams);
665 
677 int32_t OSPI_writeCmd(OSPI_Handle handle, OSPI_WriteCmdParams *wrParams);
678 
687 
696 
705 
715 uint32_t OSPI_isDacEnable(OSPI_Handle handle);
716 
726 uint32_t OSPI_isDmaEnable(OSPI_Handle handle);
727 
738 
748 uint32_t OSPI_isPhyEnable(OSPI_Handle handle);
749 
760 uint32_t OSPI_isDtrEnable(OSPI_Handle handle);
761 
771 int32_t OSPI_enableDDR(OSPI_Handle handle);
772 
782 int32_t OSPI_enableSDR(OSPI_Handle handle);
783 
794 
805 int32_t OSPI_setRdDataCaptureDelay(OSPI_Handle handle, uint32_t rdDataCapDelay);
806 
816 void OSPI_setNumAddrBytes(OSPI_Handle handle, uint32_t numAddrBytes);
817 
828 void OSPI_setDeviceSize(OSPI_Handle handle, uint32_t pageSize, uint32_t blkSize);
829 
839 void OSPI_setCmdDummyCycles(OSPI_Handle handle, uint32_t cmdDummyCycles);
840 
850 void OSPI_setReadDummyCycles(OSPI_Handle handle, uint32_t dummyCycles);
851 
861 void OSPI_setPhyEnableSuccess(OSPI_Handle handle, uint32_t success);
862 
873 
883 void OSPI_cmdModeBitSet(OSPI_Handle handle, uint32_t enable);
884 
894 void OSPI_rdModeBitSet(OSPI_Handle handle, uint32_t enable);
895 
905 void OSPI_setXferLines(OSPI_Handle handle, uint32_t xferLines);
906 
918 
928 
939 void OSPI_setXferOpCodes(OSPI_Handle handle, uint8_t readCmd, uint8_t pageProgCmd);
940 
950 void OSPI_setCmdExtType(OSPI_Handle handle, uint32_t cmdExtType);
951 
962 
973 
984 
996 int32_t OSPI_phyTuneDDR(OSPI_Handle handle, uint32_t flashOffset);
997 
1011 int32_t OSPI_phyTuneGrapher(OSPI_Handle handle, uint32_t flashOffset, uint8_t arrays[4][128][128]);
1012 
1020 void OSPI_phyGetTuningData(uint32_t *tuningData, uint32_t *tuningDataSize);
1021 
1031 int32_t OSPI_phyReadAttackVector(OSPI_Handle handle, uint32_t offset);
1032 
1042 int32_t OSPI_enablePhy(OSPI_Handle handle);
1043 
1054 
1065 
1076 
1077 
1098 
1110 int32_t OSPI_norFlashReadId(OSPI_Handle handle, uint32_t *manufacturerId, uint32_t *deviceId);
1111 
1124 int32_t OSPI_norFlashWrite(OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len);
1125 
1138 int32_t OSPI_norFlashRead(OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len);
1139 
1152 int32_t OSPI_norFlashReadSfdp(OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len);
1153 
1164 int32_t OSPI_norFlashErase(OSPI_Handle handle, uint32_t address);
1169 #ifdef __cplusplus
1170 }
1171 #endif
1172 
1173 #endif /* #ifndef OSPI_H_ */
1174 
OSPI_norFlashWrite
int32_t OSPI_norFlashWrite(OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
This function writes data to the flash at a specified offset.
OSPI_GenericXspiDevDefines::oeType
uint8_t oeType
Definition: ospi/v0/ospi.h:508
OSPI_isDacEnable
uint32_t OSPI_isDacEnable(OSPI_Handle handle)
This function checks if the Direct Access Controller is enabled.
OSPI_AddrRegion::regionSize
uint32_t regionSize
Definition: ospi/v0/ospi.h:300
OSPI_setCmdDummyCycles
void OSPI_setCmdDummyCycles(OSPI_Handle handle, uint32_t cmdDummyCycles)
This function sets appropriate dummy cycles to be used while sending STIG commands to flash.
OSPI_GenericXspiDevDefines::XSPI_NOR_444_READ_DUMMY_CYCLES_LC
uint16_t XSPI_NOR_444_READ_DUMMY_CYCLES_LC
Definition: ospi/v0/ospi.h:465
OSPI_GenericXspiDevDefines::XSPI_NOR_OCTAL_READ_DUMMY_CYCLE_LC
uint16_t XSPI_NOR_OCTAL_READ_DUMMY_CYCLE_LC
Definition: ospi/v0/ospi.h:468
OSPI_Transaction::status
uint32_t status
Definition: ospi/v0/ospi.h:252
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_PAGE_PROG_3B
uint8_t XSPI_NOR_CMD_PAGE_PROG_3B
Definition: ospi/v0/ospi.h:444
OSPI_GenericXspiDevDefines::XSPI_NOR_QUAD_MODE_CFG_ADDR
uint32_t XSPI_NOR_QUAD_MODE_CFG_ADDR
Definition: ospi/v0/ospi.h:482
OSPI_ReadCmdParams::numAddrBytes
uint8_t numAddrBytes
Definition: ospi/v0/ospi.h:280
OSPI_ReadCmdParams
Definition: ospi/v0/ospi.h:274
OSPI_Transaction_init
void OSPI_Transaction_init(OSPI_Transaction *trans)
Function to initialize the OSPI_Transaction structure.
OSPI_GenericXspiDevDefines::XSPI_NOR_OCTAL_DDR_RDVREG_DUMMY_CYCLE
uint16_t XSPI_NOR_OCTAL_DDR_RDVREG_DUMMY_CYCLE
Definition: ospi/v0/ospi.h:473
OSPI_GenericXspiDevDefines::XSPI_NOR_OCTAL_DDR_WRREG_ADDR_BYTES
uint16_t XSPI_NOR_OCTAL_DDR_WRREG_ADDR_BYTES
Definition: ospi/v0/ospi.h:472
OSPI_setRdDataCaptureDelay
int32_t OSPI_setRdDataCaptureDelay(OSPI_Handle handle, uint32_t rdDataCapDelay)
This function sets read data capture cycles in the OSPI controller.
OSPI_GenericXspiDevDefines::XSPI_NOR_FLASH_SIZE
uint64_t XSPI_NOR_FLASH_SIZE
Definition: ospi/v0/ospi.h:487
OSPI_WriteCmdParams
Definition: ospi/v0/ospi.h:259
OSPI_Object::rdDataCapDelay
uint32_t rdDataCapDelay
Definition: ospi/v0/ospi.h:392
OSPI_disablePhyPipeline
int32_t OSPI_disablePhyPipeline(OSPI_Handle handle)
This function disables the PHY Pipeline.
OSPI_ReadCmdParams_init
void OSPI_ReadCmdParams_init(OSPI_ReadCmdParams *rdParams)
Function to initialize the OSPI_ReadCmdParams structure.
OSPI_enableSDR
int32_t OSPI_enableSDR(OSPI_Handle handle)
This function enables the Single Data Rate (SDR)
OSPI_Transaction::transferTimeout
uint32_t transferTimeout
Definition: ospi/v0/ospi.h:254
OSPI_Attrs::dacEnable
uint32_t dacEnable
Definition: ospi/v0/ospi.h:351
OSPI_Attrs::xferLines
uint32_t xferLines
Definition: ospi/v0/ospi.h:353
OSPI_norFlashReadSfdp
int32_t OSPI_norFlashReadSfdp(OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
This function reads SFDP table from the flash from a specified offset.
OSPI_Object::cmdExtType
uint32_t cmdExtType
Definition: ospi/v0/ospi.h:401
OSPI_Transaction
Data structure used with OSPI_Transfers - OSPI_readDirect, OSPI_writeDirect, OSPI_readIndirect,...
Definition: ospi/v0/ospi.h:245
OSPI_WriteCmdParams::cmdAddr
uint32_t cmdAddr
Definition: ospi/v0/ospi.h:262
OSPI_GenericXspiDevDefines::XSPI_NOR_NVREG_OFFSET
uint32_t XSPI_NOR_NVREG_OFFSET
Definition: ospi/v0/ospi.h:481
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_WRREG
uint8_t XSPI_NOR_CMD_WRREG
Definition: ospi/v0/ospi.h:438
OSPI_phyReadAttackVector
int32_t OSPI_phyReadAttackVector(OSPI_Handle handle, uint32_t offset)
This function checks if the attack vector, or the data used for tuning the PHY is present at an offse...
OSPI_norFlashRead
int32_t OSPI_norFlashRead(OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
This function reads data from the flash from a specified offset.
OSPI_Attrs::intrPriority
uint8_t intrPriority
Definition: ospi/v0/ospi.h:343
index
uint16_t index
Definition: tisci_rm_proxy.h:3
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_SECTOR_ERASE_4B
uint8_t XSPI_NOR_CMD_SECTOR_ERASE_4B
Definition: ospi/v0/ospi.h:441
SystemP.h
OSPI_init
void OSPI_init(void)
This function initializes the OSPI module.
OSPI_GenericXspiDevDefines::XSPI_NOR_SR_WEL
uint32_t XSPI_NOR_SR_WEL
Definition: ospi/v0/ospi.h:456
OSPI_enableDdrRdCmds
int32_t OSPI_enableDdrRdCmds(OSPI_Handle handle)
This function sets DDR bit in INSTR_RD register for RD commands.
OSPI_norFlashErase
int32_t OSPI_norFlashErase(OSPI_Handle handle, uint32_t address)
This function erases 1 block of data starting from a provided address.
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_RDID
uint8_t XSPI_NOR_CMD_RDID
Definition: ospi/v0/ospi.h:448
OSPI_setXferLines
void OSPI_setXferLines(OSPI_Handle handle, uint32_t xferLines)
This function sets the number of transfer lines to the OSPI controller.
OSPI_deinit
void OSPI_deinit(void)
This function de-initializes the OSPI module.
OSPI_setDualOpCodeMode
void OSPI_setDualOpCodeMode(OSPI_Handle handle)
This function sets OSPI controller to use dual byte opcodes.
OSPI_setDeviceSize
void OSPI_setDeviceSize(OSPI_Handle handle, uint32_t pageSize, uint32_t blkSize)
This function sets the block size and page size of the flash to the device size register in OSPI.
OSPI_Params_init
void OSPI_Params_init(OSPI_Params *ospiParams)
Initialize data structure with defaults.
OSPI_getXferLines
uint32_t OSPI_getXferLines(OSPI_Handle handle)
This function returns the current number of transfer lines set in the OSPI controller.
OSPI_GenericXspiDevDefines::XSPI_NOR_PAGE_SIZE
uint16_t XSPI_NOR_PAGE_SIZE
Definition: ospi/v0/ospi.h:488
OSPI_GenericXspiDevDefines::XSPI_NOR_BLOCK_SIZE
uint32_t XSPI_NOR_BLOCK_SIZE
Definition: ospi/v0/ospi.h:489
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_114_READ
uint8_t XSPI_NOR_CMD_114_READ
Definition: ospi/v0/ospi.h:454
OSPI_isDtrEnable
uint32_t OSPI_isDtrEnable(OSPI_Handle handle)
This function checks if the Dual Transfer Rate (Sampling on both rising and falling edge of the clock...
OSPI_Object::handle
OSPI_Handle handle
Definition: ospi/v0/ospi.h:382
OSPI_ReadCmdParams::cmdAddr
uint32_t cmdAddr
Definition: ospi/v0/ospi.h:277
OSPI_GenericXspiDevDefines::XSPI_NOR_DUMMY_CYCLE_CFG_ADDR
uint32_t XSPI_NOR_DUMMY_CYCLE_CFG_ADDR
Definition: ospi/v0/ospi.h:486
OSPI_Attrs::dataBaseAddr
uint32_t dataBaseAddr
Definition: ospi/v0/ospi.h:331
OSPI_Transaction::count
uint32_t count
Definition: ospi/v0/ospi.h:246
OSPI_Attrs::dtrEnable
uint32_t dtrEnable
Definition: ospi/v0/ospi.h:345
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_BLOCK_ERASE_4B
uint8_t XSPI_NOR_CMD_BLOCK_ERASE_4B
Definition: ospi/v0/ospi.h:443
OSPI_GenericXspiDevDefines::dtrSupport
uint8_t dtrSupport
Definition: ospi/v0/ospi.h:496
OSPI_Attrs::baudRateDiv
uint32_t baudRateDiv
Definition: ospi/v0/ospi.h:363
OSPI_Params
OSPI Parameters.
Definition: ospi/v0/ospi.h:316
OSPI_GenericXspiDevDefines::XSPI_NOR_444_READ_MODE_CLKS
uint16_t XSPI_NOR_444_READ_MODE_CLKS
Definition: ospi/v0/ospi.h:463
OSPI_GenericXspiDevDefines::XSPI_NOR_OCTAL_RDSFDP_DUMMY_CYCLE
uint16_t XSPI_NOR_OCTAL_RDSFDP_DUMMY_CYCLE
Definition: ospi/v0/ospi.h:475
OSPI_GenericXspiDevDefines::XSPI_NOR_SR_WIP
uint32_t XSPI_NOR_SR_WIP
Definition: ospi/v0/ospi.h:455
OSPI_GenericXspiDevDefines::XSPI_NOR_OCTAL_DDR_RDREG_ADDR_BYTES
uint16_t XSPI_NOR_OCTAL_DDR_RDREG_ADDR_BYTES
Definition: ospi/v0/ospi.h:471
OSPI_norFlashReadId
int32_t OSPI_norFlashReadId(OSPI_Handle handle, uint32_t *manufacturerId, uint32_t *deviceId)
This function tries to read the JEDEC ID from the NOR flash connected to the OSPI peripheral.
OSPI_setXferOpCodes
void OSPI_setXferOpCodes(OSPI_Handle handle, uint8_t readCmd, uint8_t pageProgCmd)
This function sets the opcodes for reading and page programming the flash.
OSPI_getHandle
OSPI_Handle OSPI_getHandle(uint32_t index)
This function returns the handle of an open OSPI Instance from the instance index.
SemaphoreP.h
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_RDREG
uint8_t XSPI_NOR_CMD_RDREG
Definition: ospi/v0/ospi.h:447
OSPI_Object::transferMode
uint32_t transferMode
Definition: ospi/v0/ospi.h:384
OSPI_WriteCmdParams::txDataLen
uint32_t txDataLen
Definition: ospi/v0/ospi.h:269
OSPI_WriteCmdParams::txDataBuf
void * txDataBuf
Definition: ospi/v0/ospi.h:267
OSPI_disableDacMode
int32_t OSPI_disableDacMode(OSPI_Handle handle)
This function disables the Direct Access Mode.
OSPI_GenericXspiDevDefines::XSPI_NOR_QUAD_CMD_READ_DUMMY_CYCLES
uint16_t XSPI_NOR_QUAD_CMD_READ_DUMMY_CYCLES
Definition: ospi/v0/ospi.h:466
OSPI_phyTuneGrapher
int32_t OSPI_phyTuneGrapher(OSPI_Handle handle, uint32_t flashOffset, uint8_t arrays[4][128][128])
This function takes a 4x128x128 array and fills it with TX RX DLL data for graphing purpose.
OSPI_Attrs::inputClkFreq
uint32_t inputClkFreq
Definition: ospi/v0/ospi.h:333
OSPI_GenericXspiDevDefines::XSPI_NOR_WRR_WRITE_TIMEOUT
uint32_t XSPI_NOR_WRR_WRITE_TIMEOUT
Definition: ospi/v0/ospi.h:477
OSPI_setNumAddrBytes
void OSPI_setNumAddrBytes(OSPI_Handle handle, uint32_t numAddrBytes)
This function set the number of bytes used to send address while reading or writing to flash memory.
OSPI_Attrs::dmaRestrictedRegions
const OSPI_AddrRegion * dmaRestrictedRegions
Definition: ospi/v0/ospi.h:365
OSPI_Object::cmdDummyCycles
uint32_t cmdDummyCycles
Definition: ospi/v0/ospi.h:390
OSPI_Attrs
OSPI instance attributes - used during init time.
Definition: ospi/v0/ospi.h:325
OSPI_getFlashDataBaseAddr
uint32_t OSPI_getFlashDataBaseAddr(OSPI_Handle handle)
This function gets the SOC mapped data base address of the flash.
OSPI_Object
OSPI driver object.
Definition: ospi/v0/ospi.h:378
OSPI_readDirect
int32_t OSPI_readDirect(OSPI_Handle handle, OSPI_Transaction *trans)
Function to perform direct reads from the flash using DAC controller.
OSPI_phyGetTuningData
void OSPI_phyGetTuningData(uint32_t *tuningData, uint32_t *tuningDataSize)
This function returns the address to the attack vector buf required for tuning the PHY.
OSPI_Object::rdDummyCycles
uint32_t rdDummyCycles
Definition: ospi/v0/ospi.h:388
OSPI_Attrs::chipSelect
uint32_t chipSelect
Definition: ospi/v0/ospi.h:359
OSPI_Object::isOpen
uint32_t isOpen
Definition: ospi/v0/ospi.h:407
OSPI_ReadCmdParams::rxDataBuf
void * rxDataBuf
Definition: ospi/v0/ospi.h:282
OSPI_writeIndirect
int32_t OSPI_writeIndirect(OSPI_Handle handle, OSPI_Transaction *trans)
Function to perform indirect writes to the flash using INDAC controller.
OSPI_WriteCmdParams::cmd
uint8_t cmd
Definition: ospi/v0/ospi.h:260
OSPI_GenericXspiDevDefines::XSPI_NOR_VREG_OFFSET
uint32_t XSPI_NOR_VREG_OFFSET
Definition: ospi/v0/ospi.h:480
OSPI_enablePhyPipeline
int32_t OSPI_enablePhyPipeline(OSPI_Handle handle)
This function enables the PHY Pipeline.
OSPI_GenericXspiDevDefines::XSPI_NOR_444_READ_DUMMY_CYCLES
uint16_t XSPI_NOR_444_READ_DUMMY_CYCLES
Definition: ospi/v0/ospi.h:464
OSPI_GenericXspiDevDefines::XSPI_NOR_DDR_OCTAL_MODE_CFG_BIT_LOCATION
uint32_t XSPI_NOR_DDR_OCTAL_MODE_CFG_BIT_LOCATION
Definition: ospi/v0/ospi.h:485
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_444_SDR_READ
uint8_t XSPI_NOR_CMD_444_SDR_READ
Definition: ospi/v0/ospi.h:452
OSPI_norFlashInit1s1s1s
int32_t OSPI_norFlashInit1s1s1s(OSPI_Handle handle)
This function initializes the NOR flash to work in 1-1-1 mode.
OSPI_isPhyEnable
uint32_t OSPI_isPhyEnable(OSPI_Handle handle)
This function checks if the OSPI PHY controller is enabled.
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_888_SDR_READ
uint8_t XSPI_NOR_CMD_888_SDR_READ
Definition: ospi/v0/ospi.h:450
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_PAGE_PROG_4B
uint8_t XSPI_NOR_CMD_PAGE_PROG_4B
Definition: ospi/v0/ospi.h:445
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_SECTOR_ERASE_3B
uint8_t XSPI_NOR_CMD_SECTOR_ERASE_3B
Definition: ospi/v0/ospi.h:440
OSPI_GenericXspiDevDefines::XSPI_NOR_DEVICE_ID
uint16_t XSPI_NOR_DEVICE_ID
Definition: ospi/v0/ospi.h:459
HwiP.h
OSPI_GenericXspiDevDefines::qeType
uint8_t qeType
Definition: ospi/v0/ospi.h:499
OSPI_writeCmd
int32_t OSPI_writeCmd(OSPI_Handle handle, OSPI_WriteCmdParams *wrParams)
Function to send specific commands and related data to flash.
OSPI_GenericXspiDevDefines::XSPI_NOR_MANF_ID
uint8_t XSPI_NOR_MANF_ID
Definition: ospi/v0/ospi.h:458
OSPI_setPhyEnableSuccess
void OSPI_setPhyEnableSuccess(OSPI_Handle handle, uint32_t success)
This function sets the phyEnableSuccess field in OSPI_Object. Has to be called from flash driver.
OSPI_GenericXspiDevDefines::XSPI_NOR_RDID_NUM_BYTES
uint8_t XSPI_NOR_RDID_NUM_BYTES
Definition: ospi/v0/ospi.h:457
OSPI_Params::ospiDmaChIndex
int32_t ospiDmaChIndex
Definition: ospi/v0/ospi.h:317
OSPI_enablePhy
int32_t OSPI_enablePhy(OSPI_Handle handle)
This function enables the PHY.
OSPI_Transaction::buf
void * buf
Definition: ospi/v0/ospi.h:248
OSPI_Object::phyEnableSuccess
uint32_t phyEnableSuccess
Definition: ospi/v0/ospi.h:415
OSPI_GenericXspiDevDefines::XSPI_NOR_BULK_ERASE_TIMEOUT
uint32_t XSPI_NOR_BULK_ERASE_TIMEOUT
Definition: ospi/v0/ospi.h:478
OSPI_disablePhy
int32_t OSPI_disablePhy(OSPI_Handle handle)
This function disables the PHY.
OSPI_enableDDR
int32_t OSPI_enableDDR(OSPI_Handle handle)
This function enables the Dual Data Rate (DDR)
OSPI_Config
Definition: ospi/v0/ospi.h:424
OSPI_AddrRegion
OSPI Address Region.
Definition: ospi/v0/ospi.h:297
OSPI_Attrs::intrNum
uint32_t intrNum
Definition: ospi/v0/ospi.h:339
OSPI_close
void OSPI_close(OSPI_Handle handle)
Function to close a OSPI peripheral specified by the OSPI handle.
OSPI_Object::lockObj
SemaphoreP_Object lockObj
Definition: ospi/v0/ospi.h:409
OSPI_GenericXspiDevDefines::addrByteSupport
uint8_t addrByteSupport
Definition: ospi/v0/ospi.h:493
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_RSTMEM
uint8_t XSPI_NOR_CMD_RSTMEM
Definition: ospi/v0/ospi.h:436
OSPI_WriteCmdParams::numAddrBytes
uint8_t numAddrBytes
Definition: ospi/v0/ospi.h:265
OSPI_Object::xferLines
uint32_t xferLines
Definition: ospi/v0/ospi.h:386
OSPI_GenericXspiDevDefines::XSPI_NOR_114_READ_DUMMY_CYCLES_LC
uint16_t XSPI_NOR_114_READ_DUMMY_CYCLES_LC
Definition: ospi/v0/ospi.h:462
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_READ
uint8_t XSPI_NOR_CMD_READ
Definition: ospi/v0/ospi.h:449
OSPI_isDmaEnable
uint32_t OSPI_isDmaEnable(OSPI_Handle handle)
This function checks if DMA is enabled for reads.
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_WREN
uint8_t XSPI_NOR_CMD_WREN
Definition: ospi/v0/ospi.h:437
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_RDSR
uint8_t XSPI_NOR_CMD_RDSR
Definition: ospi/v0/ospi.h:446
OSPI_GenericXspiDevDefines::XSPI_NOR_PAGE_PROG_TIMEOUT
uint32_t XSPI_NOR_PAGE_PROG_TIMEOUT
Definition: ospi/v0/ospi.h:479
OSPI_GenericXspiDevDefines::XSPI_NOR_QUAD_MODE_CFG_BIT_LOCATION
uint32_t XSPI_NOR_QUAD_MODE_CFG_BIT_LOCATION
Definition: ospi/v0/ospi.h:483
OSPI_GenericXspiDevDefines::XSPI_NOR_OCTAL_RDSFDP_ADDR_TYPE
uint8_t XSPI_NOR_OCTAL_RDSFDP_ADDR_TYPE
Definition: ospi/v0/ospi.h:476
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_BLOCK_ERASE_3B
uint8_t XSPI_NOR_CMD_BLOCK_ERASE_3B
Definition: ospi/v0/ospi.h:442
HwiP_Object
Opaque Hwi object used with the Hwi APIs.
Definition: HwiP.h:91
OSPI_Object::hwiObj
HwiP_Object hwiObj
Definition: ospi/v0/ospi.h:413
OSPI_GenericXspiDevDefines::XSPI_NOR_DDR_OCTAL_MODE_CFG_ADDR
uint32_t XSPI_NOR_DDR_OCTAL_MODE_CFG_ADDR
Definition: ospi/v0/ospi.h:484
OSPI_Object::numAddrBytes
uint32_t numAddrBytes
Definition: ospi/v0/ospi.h:396
OSPI_Object::phyRdDataCapDelay
uint32_t phyRdDataCapDelay
Definition: ospi/v0/ospi.h:394
OSPI_setReadDummyCycles
void OSPI_setReadDummyCycles(OSPI_Handle handle, uint32_t dummyCycles)
This function sets appropriate dummy cycles for flash read.
OSPI_Object::ospiDmaHandle
void * ospiDmaHandle
Definition: ospi/v0/ospi.h:420
gOspiConfig
OSPI_Config gOspiConfig[]
Externally defined driver configuration array.
OSPI_isIntrEnable
uint32_t OSPI_isIntrEnable(OSPI_Handle handle)
This function checks if interrupts are enabled.
OSPI_GenericXspiDevDefines::cmdExtType
uint8_t cmdExtType
Definition: ospi/v0/ospi.h:511
OSPI_Transaction::addrOffset
uint32_t addrOffset
Definition: ospi/v0/ospi.h:250
OSPI_Attrs::dmaEnable
uint32_t dmaEnable
Definition: ospi/v0/ospi.h:347
OSPI_GenericXspiDevDefines::XSPI_NOR_OCTAL_DDR_RDSR_DUMMY_CYCLE
uint16_t XSPI_NOR_OCTAL_DDR_RDSR_DUMMY_CYCLE
Definition: ospi/v0/ospi.h:469
OSPI_Attrs::phyEnable
uint32_t phyEnable
Definition: ospi/v0/ospi.h:349
SemaphoreP_Object
Opaque semaphore object used with the semaphore APIs.
Definition: SemaphoreP.h:59
OSPI_AddrRegion::regionStartAddr
uint32_t regionStartAddr
Definition: ospi/v0/ospi.h:298
OSPI_ReadCmdParams::rxDataLen
uint32_t rxDataLen
Definition: ospi/v0/ospi.h:284
OSPI_WriteCmdParams_init
void OSPI_WriteCmdParams_init(OSPI_WriteCmdParams *wrParams)
Function to initialize the OSPI_WriteCmdParams structure.
OSPI_setCmdExtType
void OSPI_setCmdExtType(OSPI_Handle handle, uint32_t cmdExtType)
This function sets the type of command extension used in dual byte opcode mode.
OSPI_GenericXspiDevDefines::byteOrder
uint8_t byteOrder
Definition: ospi/v0/ospi.h:514
OSPI_open
OSPI_Handle OSPI_open(uint32_t index, const OSPI_Params *openParams)
This function opens a given OSPI peripheral.
OSPI_Object::currTrans
OSPI_Transaction * currTrans
Definition: ospi/v0/ospi.h:418
OSPI_GenericXspiDevDefines::XSPI_NOR_SECTOR_SIZE
uint32_t XSPI_NOR_SECTOR_SIZE
Definition: ospi/v0/ospi.h:490
OSPI_Attrs::intrEnable
uint32_t intrEnable
Definition: ospi/v0/ospi.h:341
OSPI_enableDacMode
int32_t OSPI_enableDacMode(OSPI_Handle handle)
This function enables the Direct Access Mode.
OSPI_Handle
void * OSPI_Handle
A handle that is returned from a OSPI_open() call.
Definition: ospi/v0/ospi.h:73
OSPI_Attrs::baseAddr
uint32_t baseAddr
Definition: ospi/v0/ospi.h:329
OSPI_Attrs::frmFmt
uint32_t frmFmt
Definition: ospi/v0/ospi.h:355
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_RSTEN
uint8_t XSPI_NOR_CMD_RSTEN
Definition: ospi/v0/ospi.h:435
gOspiConfigNum
uint32_t gOspiConfigNum
Externally defined driver configuration array size.
OSPI_ReadCmdParams::cmd
uint8_t cmd
Definition: ospi/v0/ospi.h:275
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_888_DDR_READ
uint8_t XSPI_NOR_CMD_888_DDR_READ
Definition: ospi/v0/ospi.h:451
OSPI_writeDirect
int32_t OSPI_writeDirect(OSPI_Handle handle, OSPI_Transaction *trans)
Function to perform direct writes to the flash using DAC controller.
OSPI_Config::attrs
const OSPI_Attrs * attrs
Definition: ospi/v0/ospi.h:425
OSPI_GenericXspiDevDefines
Definition: ospi/v0/ospi.h:431
OSPI_getPhyEnableSuccess
uint32_t OSPI_getPhyEnableSuccess(OSPI_Handle handle)
This function fetches the phyEnableSuccess field in OSPI_Object.
OSPI_phyTuneDDR
int32_t OSPI_phyTuneDDR(OSPI_Handle handle, uint32_t flashOffset)
This function tunes the OSPI PHY for DDR mode to set optimal PHY parameters.
OSPI_GenericXspiDevDefines::XSPI_NOR_114_READ_DUMMY_CYCLES
uint16_t XSPI_NOR_114_READ_DUMMY_CYCLES
Definition: ospi/v0/ospi.h:461
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_BULK_ERASE
uint8_t XSPI_NOR_CMD_BULK_ERASE
Definition: ospi/v0/ospi.h:439
OSPI_GenericXspiDevDefines::XSPI_NOR_OCTAL_DDR_RDSR_ADDR_BYTES
uint16_t XSPI_NOR_OCTAL_DDR_RDSR_ADDR_BYTES
Definition: ospi/v0/ospi.h:470
OSPI_readCmd
int32_t OSPI_readCmd(OSPI_Handle handle, OSPI_ReadCmdParams *rdParams)
Function to send specific commands and receive related data from flash.
OSPI_Config::object
OSPI_Object * object
Definition: ospi/v0/ospi.h:427
OSPI_readIndirect
int32_t OSPI_readIndirect(OSPI_Handle handle, OSPI_Transaction *trans)
Function to perform indirect reads from the flash using INDAC controller.
OSPI_GenericXspiDevDefines::XSPI_NOR_CMD_444_DDR_READ
uint8_t XSPI_NOR_CMD_444_DDR_READ
Definition: ospi/v0/ospi.h:453
OSPI_cmdModeBitSet
void OSPI_cmdModeBitSet(OSPI_Handle handle, uint32_t enable)
This function sets command mode bit.
OSPI_GenericXspiDevDefines::XSPI_NOR_114_READ_MODE_CLKS
uint16_t XSPI_NOR_114_READ_MODE_CLKS
Definition: ospi/v0/ospi.h:460
OSPI_Attrs::decChipSelect
uint32_t decChipSelect
Definition: ospi/v0/ospi.h:361
OSPI_GenericXspiDevDefines::XSPI_NOR_OCTAL_READ_DUMMY_CYCLE
uint16_t XSPI_NOR_OCTAL_READ_DUMMY_CYCLE
Definition: ospi/v0/ospi.h:467
OSPI_GenericXspiDevDefines::XSPI_NOR_OCTAL_DDR_RDNVREG_DUMMY_CYCLE
uint16_t XSPI_NOR_OCTAL_DDR_RDNVREG_DUMMY_CYCLE
Definition: ospi/v0/ospi.h:474
OSPI_rdModeBitSet
void OSPI_rdModeBitSet(OSPI_Handle handle, uint32_t enable)
This function sets Read mode bit.
OSPI_Object::transferSemObj
SemaphoreP_Object transferSemObj
Definition: ospi/v0/ospi.h:411
enable
@ enable
Definition: iPtcpDrv.h:63