CC35xxDriverLibrary
ospi.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Filename: ospi.h
3  *
4  * Description: Defines and prototypes for the OSPI peripheral.
5  *
6  * Copyright (c) 2024 Texas Instruments Incorporated
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1) Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * 2) Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3) Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  ******************************************************************************/
35 
36 #ifndef __OSPI_H__
37 #define __OSPI_H__
38 
39 //*****************************************************************************
40 //
45 //
46 //*****************************************************************************
47 
48 #include "../inc/hw_memmap.h"
49 #include "../inc/hw_ospi.h"
50 #include "../inc/hw_types.h"
51 
52 //*****************************************************************************
53 //
54 // If building with a C++ compiler, make all of the definitions in this header
55 // have a C binding.
56 //
57 //*****************************************************************************
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 //*****************************************************************************
63 //
64 // Configuration values that can be passed to \ref OSPIGetSTIGDataRegister() as the regSelect parameter
65 //
66 //*****************************************************************************
68 #define OSPI_STIG_READ_DATA_LOWER OSPI_O_FLASH_RD_DATA_LOWER
69 #define OSPI_STIG_READ_DATA_UPPER OSPI_O_FLASH_RD_DATA_UPPER
71 
72 //*****************************************************************************
73 //
74 // Configuration values that can be passed to OSPIExecuteSTIGWriteCommand() as the OSPISTIGConfig_t parameter
75 //
76 //*****************************************************************************
78 #define OSPI_STIG_MEMORY_BANK_TRANSFER_ENABLE OSPI_FLASH_CMD_CTRL_STIG_MEM_BANK_EN_ENABLE
79 #define OSPI_STIG_MEMORY_BANK_TRANSFER_DISABLE OSPI_FLASH_CMD_CTRL_STIG_MEM_BANK_EN_DISABLE
81 
83 #define OSPI_STIG_WRITE_DATA_ENABLE OSPI_FLASH_CMD_CTRL_ENB_WRITE_DATA_ENABLE
84 #define OSPI_STIG_WRITE_DATA_DISABLE OSPI_FLASH_CMD_CTRL_ENB_MODE_BIT_DISABLE
86 
90 #define OSPI_STIG_MODE_BIT_ENABLE OSPI_FLASH_CMD_CTRL_ENB_MODE_BIT_ENABLE
91 #define OSPI_STIG_MODE_BIT_DISABLE OSPI_FLASH_CMD_CTRL_ENB_MODE_BIT_DISABLE
93 
95 #define OSPI_STIG_COMMAND_ADDRESS_ENABLE OSPI_FLASH_CMD_CTRL_ENB_COMD_ADDR_ENABLE
96 #define OSPI_STIG_COMMAND_ADDRESS_DISABLE OSPI_FLASH_CMD_CTRL_ENB_COMD_ADDR_DISABLE
98 
100 #define OSPI_STIG_READ_DATA_ENABLE OSPI_FLASH_CMD_CTRL_ENB_READ_DATA_ENABLE
101 #define OSPI_STIG_READ_DATA_DISABLE OSPI_FLASH_CMD_CTRL_ENB_READ_DATA_DISABLE
103 
104 //*****************************************************************************
105 //
106 // Enumerations
107 //
108 //*****************************************************************************
109 
111 typedef enum
112 {
122 
124 typedef enum
125 {
139 
140 typedef enum
141 {
147 
148 typedef struct
149 {
150  uint8_t stigOpcode;
151  uint8_t stigRdEn;
152  uint8_t stigRDNumBytes;
153  uint8_t stigAddrEn;
155  uint8_t stigModeBitEN;
156  uint8_t stigWrEn;
157  uint8_t stigWrNumBytes;
159  uint8_t stigMemoryEn;
161 
162 //*****************************************************************************
163 //
182 //
183 //*****************************************************************************
184 uint32_t OSPIGetSTIGDataRegister(uint32_t regSelect);
185 
186 //*****************************************************************************
187 //
198 //
199 //*****************************************************************************
200 void OSPIExecuteSTIGWriteCommand(OSPISTIGConfig_t OspiStigCommand);
201 
202 //*****************************************************************************
203 //
215 //
216 //*****************************************************************************
217 void OSPIStartSTIGCommand(uint32_t configReg);
218 
219 //*****************************************************************************
220 //
228 //
229 //*****************************************************************************
230 void OSPISetCommandAddress(uint32_t address);
231 
232 //*****************************************************************************
233 //
234 // Mark the end of the C bindings section for C++ compilers.
235 //
236 //*****************************************************************************
237 #ifdef __cplusplus
238 }
239 #endif
240 
241 //*****************************************************************************
242 //
246 //
247 //*****************************************************************************
248 
249 #endif // __OSPI_H__
Write enable.
Definition: ospi.h:131
Level of protected block.
Definition: ospi.h:115
Level of protected block.
Definition: ospi.h:117
Write status/configuration register.
Definition: ospi.h:126
Chip erase (60h or C7h)
Definition: ospi.h:133
Definition: ospi.h:148
uint8_t stigModeBitEN
Definition: ospi.h:155
Normal read.
Definition: ospi.h:128
DIO-SPI mode (Instruction sent on DQ0 and DQ1)
Definition: ospi.h:143
Quad SPI en (35h or 38h)
Definition: ospi.h:134
Quad SPI mode Enable.
Definition: ospi.h:119
uint8_t stigAddrNumBytes
Definition: ospi.h:154
Sector erase.
Definition: ospi.h:132
Reset Enable.
Definition: ospi.h:136
uint32_t OSPIGetSTIGDataRegister(uint32_t regSelect)
Returns the read data or status register value.
Status register write protect.
Definition: ospi.h:120
OSPISTIGCommand
Sub group of used JEDEC commands.
Definition: ospi.h:124
OSPIFlashStatusRegister
OSPI flash status register bit indication.
Definition: ospi.h:111
uint8_t stigRdEn
Definition: ospi.h:151
Write in progress bit.
Definition: ospi.h:113
uint8_t stigRDNumBytes
Definition: ospi.h:152
Reset Memory.
Definition: ospi.h:137
uint8_t stigWrNumBytes
Definition: ospi.h:157
Normal write.
Definition: ospi.h:127
void OSPIStartSTIGCommand(uint32_t configReg)
Execute the STIG command.
uint8_t stigWrEn
Definition: ospi.h:156
QIO-SPI mode (Instruction sent on DQ0,DQ1,DQ2 and DQ3)
Definition: ospi.h:144
level of protected block
Definition: ospi.h:118
Write enable latch.
Definition: ospi.h:114
OSPIInstructionType
Definition: ospi.h:140
uint8_t stigOpcode
Definition: ospi.h:150
Quad disable (0xf5 or ffh)
Definition: ospi.h:135
Level of protected block.
Definition: ospi.h:116
Read status register.
Definition: ospi.h:130
Standard SPI mode (instruction always shifted into the device on DQ0 only)
Definition: ospi.h:142
Fast read.
Definition: ospi.h:129
uint8_t stigAddrEn
Definition: ospi.h:153
uint8_t stigNumDummyCycles
Definition: ospi.h:158
void OSPISetCommandAddress(uint32_t address)
Set the address for the STIG write/read command.
OIO-SPI mode (Instruction sent on DQ[7:0].
Definition: ospi.h:145
uint8_t stigMemoryEn
Definition: ospi.h:159
void OSPIExecuteSTIGWriteCommand(OSPISTIGConfig_t OspiStigCommand)
Configure and execute the STIG command.