AM62x MCU+ SDK  09.02.01
ospi/v0/ospi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021-2023 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_CMD_INVALID_OPCODE (0xFFU)
153 #define OSPI_CMD_INVALID_DUMMY (0xFFU)
154 #define OSPI_CMD_INVALID_ADDR (0xFFFFFFFFU)
155 
165 #define OSPI_CMD_EXT_TYPE_REPEAT (0x00U)
166 #define OSPI_CMD_EXT_TYPE_INVERSE (0x01U)
167 #define OSPI_CMD_EXT_TYPE_NONE (0x02U)
168 
178 #define OSPI_FLASH_PROTOCOL(cmd, addr, data, dtr) (uint32_t)(((uint32_t)(dtr) << 24) | \
179  ((uint32_t)(cmd) << 16) | \
180  ((uint32_t)(addr) << 8) | \
181  ((uint32_t)(data) << 0))
182 #define OSPI_FLASH_PROTOCOL_INVALID (uint32_t)(0xFFFFFFFF)
183 
193 #define OSPI_CS0 (0U)
194 #define OSPI_CS1 (1U)
195 #define OSPI_CS2 (2U)
196 #define OSPI_CS3 (3U)
197 
198 #define OSPI_CHIP_SELECT(x) ((~((1U) << (x))) & 0xFU)
199 
209 #define OSPI_DECODER_SELECT4 ((uint32_t) 0U)
210 #define OSPI_DECODER_SELECT16 ((uint32_t) 1U)
211 
221 #define OSPI_NOR_DMA_COPY_LOWER_LIMIT (1024U)
222 #define OSPI_NAND_DMA_COPY_LOWER_LIMIT (256U)
223 
242 #define OSPI_FLASH_CFG_PHY_MASTER_CONTROL_REG_PHY_MASTER_MODE (0U)
243 #define OSPI_FLASH_CFG_PHY_MASTER_CONTROL_REG_PHY_BYPASS_MODE (1U)
244 
256 #define OSPI_PHY_DLL_FULL_CYCLE_LOCK ((uint16_t) 0U)
257 #define OSPI_PHY_DLL_HALF_CYCLE_LOCK ((uint16_t) 1U)
258 
260 /* ========================================================================== */
261 /* Structure Declarations */
262 /* ========================================================================== */
270 typedef struct
271 {
272  uint32_t count;
274  void *buf;
276  uint32_t addrOffset;
278  uint32_t status;
280  uint32_t transferTimeout;
285 
286 typedef struct
287 {
288  uint8_t cmd;
290  uint32_t cmdAddr;
293  uint8_t numAddrBytes;
295  void *txDataBuf;
297  uint32_t txDataLen;
300 
301 typedef struct
302 {
303  uint8_t cmd;
305  uint32_t cmdAddr;
308  uint8_t numAddrBytes;
310  uint8_t dummyBits;
312  void *rxDataBuf;
314  uint16_t rxDataLen;
317 
326 typedef struct
327 {
328  uint32_t regionStartAddr;
330  uint32_t regionSize;
334 
342 typedef struct
343 {
354  int32_t rxLowSearchEnd;
362  int32_t txLowSearchEnd;
372  uint32_t rdDelayMin;
374  uint32_t rdDelayMax;
377 
386 typedef struct
387 {
388  uint32_t phyControlMode;
390  uint32_t dllLockMode;
393 
395 
406 typedef struct
407 {
408  int32_t ospiDmaChIndex;
409  /* Index of Channel used by OSPI DMA Driver. This index will be set by SysCfg according to the DMA driver chosen.
410  * The OSPI driver uses this index to do an \ref OSPI_dmaOpen inside the \ref OSPI_open if the DMA mode is enabled
411  */
412 } OSPI_Params;
413 
415 typedef struct
416 {
417  /*
418  * SOC configuration
419  */
420  uint32_t baseAddr;
422  uint32_t dataBaseAddr;
424  uint32_t inputClkFreq;
427  /*
428  * Driver configuration
429  */
430  uint32_t intrNum;
432  uint32_t intrEnable;
434  uint8_t intrPriority;
436  uint32_t dmaEnable;
438  uint32_t phyEnable;
440  uint32_t phySkipTuning;
442  uint32_t dacEnable;
444  uint32_t frmFmt;
446  uint32_t devDelays[4];
448  uint32_t chipSelect;
450  uint32_t decChipSelect;
452  uint32_t baudRateDiv;
464 } OSPI_Attrs;
465 
470 typedef struct
471 {
472  /*
473  * User params
474  */
477  uint32_t transferMode;
479  uint32_t protocol;
486  uint32_t rdDummyCycles;
488  uint32_t cmdDummyCycles;
490  uint32_t rdDataCapDelay;
494  uint32_t phyCfgVal;
496  uint32_t phyDummyCycles;
498  uint32_t numAddrBytes;
503  uint32_t cmdExtType;
506  /*
507  * State variables
508  */
509  uint32_t isOpen;
523 } OSPI_Object;
524 
525 typedef struct
526 {
531 } OSPI_Config;
532 
534 extern OSPI_Config gOspiConfig[];
536 extern uint32_t gOspiConfigNum;
537 
538 /* ========================================================================== */
539 /* Internal/Private Structure Declarations */
540 /* ========================================================================== */
541 
542 /* ========================================================================== */
543 /* Function Declarations */
544 /* ========================================================================== */
545 
549 void OSPI_init(void);
550 
554 void OSPI_deinit(void);
555 
556 
562 void OSPI_Params_init( OSPI_Params *ospiParams);
563 
578 OSPI_Handle OSPI_open(uint32_t index, const OSPI_Params *openParams);
579 
589 void OSPI_close(OSPI_Handle handle);
590 
604 
623 
636 
649 
675 int32_t OSPI_readCmd(OSPI_Handle handle, OSPI_ReadCmdParams *rdParams);
676 
688 int32_t OSPI_writeCmd(OSPI_Handle handle, OSPI_WriteCmdParams *wrParams);
689 
698 
707 
716 
726 uint32_t OSPI_getInputClk(OSPI_Handle handle);
727 
737 uint32_t OSPI_isDacEnable(OSPI_Handle handle);
738 
748 uint32_t OSPI_isDmaEnable(OSPI_Handle handle);
749 
760 
770 uint32_t OSPI_isPhyEnable(OSPI_Handle handle);
771 
782 uint32_t OSPI_isDtrEnable(OSPI_Handle handle);
783 
793 int32_t OSPI_enableDDR(OSPI_Handle handle);
794 
804 int32_t OSPI_enableSDR(OSPI_Handle handle);
805 
816 
827 int32_t OSPI_setRdDataCaptureDelay(OSPI_Handle handle, uint32_t rdDataCapDelay);
828 
838 void OSPI_setNumAddrBytes(OSPI_Handle handle, uint32_t numAddrBytes);
839 
850 void OSPI_setDeviceSize(OSPI_Handle handle, uint32_t pageSize, uint32_t blkSize);
851 
861 void OSPI_setCmdDummyCycles(OSPI_Handle handle, uint32_t cmdDummyCycles);
862 
872 void OSPI_setReadDummyCycles(OSPI_Handle handle, uint32_t dummyCycles);
873 
883 void OSPI_setPhyEnableSuccess(OSPI_Handle handle, uint32_t success);
884 
894 void OSPI_setModeBits(OSPI_Handle handle, uint32_t modeBits);
895 
905 
915 
926 
936 void OSPI_cmdModeBitSet(OSPI_Handle handle, uint32_t enable);
937 
947 void OSPI_rdModeBitSet(OSPI_Handle handle, uint32_t enable);
948 
960 uint32_t OSPI_getProtocol(OSPI_Handle handle);
961 
972 void OSPI_setProtocol(OSPI_Handle handle, uint32_t protocol);
973 
983 
993 
1004 void OSPI_setXferOpCodes(OSPI_Handle handle, uint8_t readCmd, uint8_t pageProgCmd);
1005 
1015 void OSPI_setCmdExtType(OSPI_Handle handle, uint32_t cmdExtType);
1016 
1027 
1038 
1049 
1061 int32_t OSPI_phyTuneDDR(OSPI_Handle handle, uint32_t flashOffset);
1062 
1074 int32_t OSPI_phyTuneSDR(OSPI_Handle handle, uint32_t flashOffset);
1075 
1089 int32_t OSPI_phyTuneGrapher(OSPI_Handle handle, uint32_t flashOffset, uint8_t arrays[4][128][128]);
1090 
1098 void OSPI_phyGetTuningData(uint32_t *tuningData, uint32_t *tuningDataSize);
1099 
1109 int32_t OSPI_phyReadAttackVector(OSPI_Handle handle, uint32_t offset);
1110 
1118 
1126 
1133 
1143 int32_t OSPI_enablePhy(OSPI_Handle handle);
1144 
1155 
1166 
1177 
1178 
1199 
1212 void OSPI_norFlashSetCmds(uint8_t rdCmd, uint8_t wrCmd, uint8_t eraseCmd);
1213 
1225 int32_t OSPI_norFlashReadId(OSPI_Handle handle, uint32_t *manufacturerId, uint32_t *deviceId);
1226 
1239 int32_t OSPI_norFlashWrite(OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len);
1240 
1253 int32_t OSPI_norFlashRead(OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len);
1254 
1267 int32_t OSPI_norFlashReadSfdp(OSPI_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len);
1268 
1279 int32_t OSPI_norFlashErase(OSPI_Handle handle, uint32_t address);
1291 
1294 #ifdef __cplusplus
1295 }
1296 #endif
1297 
1298 #endif /* #ifndef OSPI_H_ */
1299 
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_setProtocol
void OSPI_setProtocol(OSPI_Handle handle, uint32_t protocol)
This function sets the number of transfer lines in the OSPI driver to set the requested protocol.
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:330
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_Object::phyDummyCycles
uint32_t phyDummyCycles
Definition: ospi/v0/ospi.h:496
OSPI_ReadCmdParams::rxDataLen
uint16_t rxDataLen
Definition: ospi/v0/ospi.h:314
OSPI_Transaction::status
uint32_t status
Definition: ospi/v0/ospi.h:278
OSPI_ReadCmdParams::numAddrBytes
uint8_t numAddrBytes
Definition: ospi/v0/ospi.h:308
OSPI_ReadCmdParams
Definition: ospi/v0/ospi.h:302
OSPI_Transaction_init
void OSPI_Transaction_init(OSPI_Transaction *trans)
Function to initialize the OSPI_Transaction structure.
OSPI_setRdDataCaptureDelay
int32_t OSPI_setRdDataCaptureDelay(OSPI_Handle handle, uint32_t rdDataCapDelay)
This function sets read data capture cycles in the OSPI controller.
OSPI_phyWriteTunedVal
void OSPI_phyWriteTunedVal(OSPI_Handle handle)
This function writes OSPI PHY DLL values if the previous stage has already configured it.
OSPI_WriteCmdParams
Definition: ospi/v0/ospi.h:287
OSPI_Object::rdDataCapDelay
uint32_t rdDataCapDelay
Definition: ospi/v0/ospi.h:490
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:280
OSPI_Attrs::dacEnable
uint32_t dacEnable
Definition: ospi/v0/ospi.h:442
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:503
OSPI_Transaction
Data structure used with OSPI_Transfers - OSPI_readDirect, OSPI_writeDirect, OSPI_readIndirect,...
Definition: ospi/v0/ospi.h:271
OSPI_WriteCmdParams::cmdAddr
uint32_t cmdAddr
Definition: ospi/v0/ospi.h:290
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:434
index
uint16_t index
Definition: tisci_rm_proxy.h:3
OSPI_getInputClk
uint32_t OSPI_getInputClk(OSPI_Handle handle)
This function returns the input clk frequency OSPI was programmed at.
OSPI_phyTuneSDR
int32_t OSPI_phyTuneSDR(OSPI_Handle handle, uint32_t flashOffset)
This function tunes the OSPI PHY for SDR mode to set optimal PHY parameters.
SystemP.h
OSPI_init
void OSPI_init(void)
This function initializes the OSPI module.
OSPI_enableDdrRdCmds
int32_t OSPI_enableDdrRdCmds(OSPI_Handle handle)
This function sets DDR bit in INSTR_RD register for RD commands.
OSPI_PhyConfiguration
OSPI PHY Configuration.
Definition: ospi/v0/ospi.h:387
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_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_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:475
OSPI_ReadCmdParams::cmdAddr
uint32_t cmdAddr
Definition: ospi/v0/ospi.h:305
OSPI_Attrs::dataBaseAddr
uint32_t dataBaseAddr
Definition: ospi/v0/ospi.h:422
OSPI_Transaction::count
uint32_t count
Definition: ospi/v0/ospi.h:272
OSPI_PhyTuneWindowParams::txHighSearchStart
int32_t txHighSearchStart
Definition: ospi/v0/ospi.h:364
OSPI_PhyTuneWindowParams::rxTxDLLSearchStep
uint32_t rxTxDLLSearchStep
Definition: ospi/v0/ospi.h:370
OSPI_Attrs::phaseDelayElement
uint32_t phaseDelayElement
Definition: ospi/v0/ospi.h:454
OSPI_PhyTuneWindowParams::rxHighSearchStart
int32_t rxHighSearchStart
Definition: ospi/v0/ospi.h:356
OSPI_PhyConfiguration::tuningWindowParams
OSPI_PhyTuneWindowParams tuningWindowParams
Definition: ospi/v0/ospi.h:392
OSPI_Attrs::baudRateDiv
uint32_t baudRateDiv
Definition: ospi/v0/ospi.h:452
OSPI_PhyConfiguration::dllLockMode
uint32_t dllLockMode
Definition: ospi/v0/ospi.h:390
OSPI_Params
OSPI Parameters.
Definition: ospi/v0/ospi.h:407
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_skipTuning
int32_t OSPI_skipTuning(OSPI_Handle handle)
This function checks if OSPI tuning should be skipped based on user input and if phy bit is set.
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_PhyTuneWindowParams::txDLLSearchOffset
int32_t txDLLSearchOffset
Definition: ospi/v0/ospi.h:368
OSPI_Object::transferMode
uint32_t transferMode
Definition: ospi/v0/ospi.h:477
OSPI_WriteCmdParams::txDataLen
uint32_t txDataLen
Definition: ospi/v0/ospi.h:297
OSPI_WriteCmdParams::txDataBuf
void * txDataBuf
Definition: ospi/v0/ospi.h:295
OSPI_PhyTuneWindowParams::rdDelayMin
uint32_t rdDelayMin
Definition: ospi/v0/ospi.h:372
OSPI_disableDacMode
int32_t OSPI_disableDacMode(OSPI_Handle handle)
This function disables the Direct Access Mode.
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:424
OSPI_getProtocol
uint32_t OSPI_getProtocol(OSPI_Handle handle)
This function returns the current protocol for which the transfer lines in OSPI driver is configured ...
OSPI_PhyTuneWindowParams::txDllHighWindowEnd
int32_t txDllHighWindowEnd
Definition: ospi/v0/ospi.h:350
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:456
OSPI_Object::cmdDummyCycles
uint32_t cmdDummyCycles
Definition: ospi/v0/ospi.h:488
OSPI_Attrs
OSPI instance attributes - used during init time.
Definition: ospi/v0/ospi.h:416
OSPI_getFlashDataBaseAddr
uint32_t OSPI_getFlashDataBaseAddr(OSPI_Handle handle)
This function gets the SOC mapped data base address of the flash.
OSPI_PhyTuneWindowParams::txDllHighWindowStart
int32_t txDllHighWindowStart
Definition: ospi/v0/ospi.h:348
OSPI_Object
OSPI driver object.
Definition: ospi/v0/ospi.h:471
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_clearDualOpCodeMode
void OSPI_clearDualOpCodeMode(OSPI_Handle handle)
This function sets OSPI controller to not use dual byte opcodes.
OSPI_Object::rdDummyCycles
uint32_t rdDummyCycles
Definition: ospi/v0/ospi.h:486
OSPI_Attrs::chipSelect
uint32_t chipSelect
Definition: ospi/v0/ospi.h:448
OSPI_Object::isOpen
uint32_t isOpen
Definition: ospi/v0/ospi.h:509
OSPI_ReadCmdParams::rxDataBuf
void * rxDataBuf
Definition: ospi/v0/ospi.h:312
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:288
OSPI_PhyTuneWindowParams::txLowSearchEnd
int32_t txLowSearchEnd
Definition: ospi/v0/ospi.h:362
OSPI_phyReadTunedVal
void OSPI_phyReadTunedVal(OSPI_Handle handle)
This function reads OSPI PHY values if the previous stage has already configured it.
OSPI_Object::protocol
uint32_t protocol
Definition: ospi/v0/ospi.h:479
OSPI_enablePhyPipeline
int32_t OSPI_enablePhyPipeline(OSPI_Handle handle)
This function enables the PHY Pipeline.
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_Attrs::phySkipTuning
uint32_t phySkipTuning
Definition: ospi/v0/ospi.h:440
HwiP.h
OSPI_writeCmd
int32_t OSPI_writeCmd(OSPI_Handle handle, OSPI_WriteCmdParams *wrParams)
Function to send specific commands and related data to flash.
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_Params::ospiDmaChIndex
int32_t ospiDmaChIndex
Definition: ospi/v0/ospi.h:408
OSPI_enablePhy
int32_t OSPI_enablePhy(OSPI_Handle handle)
This function enables the PHY.
OSPI_Transaction::buf
void * buf
Definition: ospi/v0/ospi.h:274
OSPI_Object::phyEnableSuccess
uint32_t phyEnableSuccess
Definition: ospi/v0/ospi.h:517
OSPI_PhyTuneWindowParams::txLowSearchStart
int32_t txLowSearchStart
Definition: ospi/v0/ospi.h:360
OSPI_PhyTuneWindowParams::rxLowSearchEnd
int32_t rxLowSearchEnd
Definition: ospi/v0/ospi.h:354
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:526
OSPI_AddrRegion
OSPI Address Region.
Definition: ospi/v0/ospi.h:327
OSPI_Attrs::intrNum
uint32_t intrNum
Definition: ospi/v0/ospi.h:430
OSPI_close
void OSPI_close(OSPI_Handle handle)
Function to close a OSPI peripheral specified by the OSPI handle.
OSPI_enableModeBitsRead
void OSPI_enableModeBitsRead(OSPI_Handle handle)
This function enables mode bits transmission while reading.
OSPI_Object::lockObj
SemaphoreP_Object lockObj
Definition: ospi/v0/ospi.h:511
OSPI_Object::phyCfgVal
uint32_t phyCfgVal
Definition: ospi/v0/ospi.h:494
OSPI_PhyTuneWindowParams
OSPI PHY Tuning Window Parameters.
Definition: ospi/v0/ospi.h:343
OSPI_WriteCmdParams::numAddrBytes
uint8_t numAddrBytes
Definition: ospi/v0/ospi.h:293
OSPI_PhyConfiguration::phyControlMode
uint32_t phyControlMode
Definition: ospi/v0/ospi.h:388
OSPI_isDmaEnable
uint32_t OSPI_isDmaEnable(OSPI_Handle handle)
This function checks if DMA is enabled for reads.
OSPI_PhyTuneWindowParams::rxHighSearchEnd
int32_t rxHighSearchEnd
Definition: ospi/v0/ospi.h:358
OSPI_PhyTuneWindowParams::rdDelayMax
uint32_t rdDelayMax
Definition: ospi/v0/ospi.h:374
OSPI_phyResyncDLL
void OSPI_phyResyncDLL(OSPI_Handle handle)
This function resyncs the DLL values.
OSPI_enableModeBitsCmd
void OSPI_enableModeBitsCmd(OSPI_Handle handle)
This function enables mode bits transmission while sending CMDs.
HwiP_Object
Opaque Hwi object used with the Hwi APIs.
Definition: HwiP.h:93
OSPI_Object::hwiObj
HwiP_Object hwiObj
Definition: ospi/v0/ospi.h:515
OSPI_ReadCmdParams::dummyBits
uint8_t dummyBits
Definition: ospi/v0/ospi.h:310
OSPI_Object::numAddrBytes
uint32_t numAddrBytes
Definition: ospi/v0/ospi.h:498
OSPI_Object::phyRdDataCapDelay
uint32_t phyRdDataCapDelay
Definition: ospi/v0/ospi.h:492
OSPI_norFlashSetCmds
void OSPI_norFlashSetCmds(uint8_t rdCmd, uint8_t wrCmd, uint8_t eraseCmd)
This function sets up internal bookkeeping variables for read, write and erase commands....
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:522
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_Transaction::addrOffset
uint32_t addrOffset
Definition: ospi/v0/ospi.h:276
OSPI_Attrs::dmaEnable
uint32_t dmaEnable
Definition: ospi/v0/ospi.h:436
OSPI_Attrs::phyEnable
uint32_t phyEnable
Definition: ospi/v0/ospi.h:438
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:328
OSPI_PhyTuneWindowParams::txHighSearchEnd
int32_t txHighSearchEnd
Definition: ospi/v0/ospi.h:366
OSPI_Transaction::dmaCopyLowerLimit
uint32_t dmaCopyLowerLimit
Definition: ospi/v0/ospi.h:282
OSPI_PhyTuneWindowParams::rxLowSearchStart
int32_t rxLowSearchStart
Definition: ospi/v0/ospi.h:352
OSPI_PhyTuneWindowParams::txDllLowWindowStart
int32_t txDllLowWindowStart
Definition: ospi/v0/ospi.h:344
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_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:520
OSPI_Attrs::intrEnable
uint32_t intrEnable
Definition: ospi/v0/ospi.h:432
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:420
OSPI_Attrs::frmFmt
uint32_t frmFmt
Definition: ospi/v0/ospi.h:444
gOspiConfigNum
uint32_t gOspiConfigNum
Externally defined driver configuration array size.
OSPI_ReadCmdParams::cmd
uint8_t cmd
Definition: ospi/v0/ospi.h:303
OSPI_writeDirect
int32_t OSPI_writeDirect(OSPI_Handle handle, OSPI_Transaction *trans)
Function to perform direct writes to the flash using DAC controller.
OSPI_setModeBits
void OSPI_setModeBits(OSPI_Handle handle, uint32_t modeBits)
This function sets mode bits in the mode bit field of OSPI config register.
OSPI_Config::attrs
const OSPI_Attrs * attrs
Definition: ospi/v0/ospi.h:527
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_readCmd
int32_t OSPI_readCmd(OSPI_Handle handle, OSPI_ReadCmdParams *rdParams)
Function to send specific commands and receive related data from flash.
OSPI_Attrs::phyConfiguration
OSPI_PhyConfiguration phyConfiguration
Definition: ospi/v0/ospi.h:461
OSPI_Config::object
OSPI_Object * object
Definition: ospi/v0/ospi.h:529
OSPI_readIndirect
int32_t OSPI_readIndirect(OSPI_Handle handle, OSPI_Transaction *trans)
Function to perform indirect reads from the flash using INDAC controller.
OSPI_cmdModeBitSet
void OSPI_cmdModeBitSet(OSPI_Handle handle, uint32_t enable)
This function sets command mode bit.
OSPI_Attrs::decChipSelect
uint32_t decChipSelect
Definition: ospi/v0/ospi.h:450
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:513
OSPI_PhyTuneWindowParams::txDllLowWindowEnd
int32_t txDllLowWindowEnd
Definition: ospi/v0/ospi.h:346