Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:42

0001 /******************************************************************************
0002 * Copyright (C) 2018 - 2022 Xilinx, Inc.  All rights reserved.
0003 * SPDX-License-Identifier: MIT
0004 ******************************************************************************/
0005 
0006 #include "xqspipsu.h"
0007 
0008 int QspiPsu_NOR_Initialize(
0009   XQspiPsu *QspiPsuInstancePtr,
0010   u16 QspiPsuIntrId
0011 );
0012 
0013 /*****************************************************************************/
0014 /**
0015  *
0016  * This function erases the sectors in the  serial Flash connected to the
0017  * QSPIPSU interface.
0018  *
0019  * @param   QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0020  * @param   Address contains the address of the first sector which needs to
0021  *      be erased.
0022  * @param   ByteCount contains the total size to be erased.
0023  *
0024  * @return  XST_SUCCESS if successful, else XST_FAILURE.
0025  *
0026  * @note    None.
0027  *
0028  ******************************************************************************/
0029 int QspiPsu_NOR_Erase(
0030   XQspiPsu *QspiPsuPtr,
0031   u32 Address,
0032   u32 ByteCount
0033 );
0034 
0035 /*****************************************************************************/
0036 /**
0037  *
0038  * This function writes to the  serial Flash connected to the QSPIPSU interface.
0039  * All the data put into the buffer must be in the same page of the device with
0040  * page boundaries being on 256 byte boundaries.
0041  *
0042  * @param   QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0043  * @param   Address contains the address to write data to in the Flash.
0044  * @param   ByteCount contains the number of bytes to write.
0045  * @param   WriteBfrPtr is pointer to the write buffer (which is to be transmitted)
0046  *
0047  * @return  XST_SUCCESS if successful, else XST_FAILURE.
0048  *
0049  * @note    None.
0050  *
0051  ******************************************************************************/
0052 int QspiPsu_NOR_Write_Page(
0053   XQspiPsu *QspiPsuPtr,
0054   u32 Address,
0055   u32 ByteCount,
0056   u8 *WriteBfrPtr
0057 );
0058 
0059 /*****************************************************************************/
0060 /**
0061  *
0062  * This function writes to the serial Flash connected to the QSPIPSU interface.
0063  * Writes will be broken into device page sized and aligned writes as necessary.
0064  *
0065  * @param   QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0066  * @param   Address contains the address to write data to in the Flash.
0067  * @param   ByteCount contains the number of bytes to write.
0068  * @param   WriteBfrPtr is pointer to the write buffer (which is to be transmitted)
0069  *
0070  * @return  XST_SUCCESS if successful, else XST_FAILURE.
0071  *
0072  * @note    None.
0073  *
0074  ******************************************************************************/
0075 int QspiPsu_NOR_Write(
0076   XQspiPsu *QspiPsuPtr,
0077   u32 Address,
0078   u32 ByteCount,
0079   u8 *WriteBfrPtr
0080 );
0081 
0082 /*****************************************************************************/
0083 /**
0084  *
0085  * This function performs a read. Reads are limited by the internal Xilinx flash
0086  * driver buffer. Default setting is in DMA mode.
0087  *
0088  * @param   QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0089  * @param   Address contains the address to begin the read at.
0090  * @param   ByteCount contains the total size to be read.
0091  * @param   ReadBfrPtr is pointer to the read buffer to which valid received data
0092  *      should be written
0093  *
0094  * @return  XST_SUCCESS if successful, else XST_FAILURE.
0095  *
0096  * @note    None.
0097  *
0098  ******************************************************************************/
0099 int QspiPsu_NOR_Read_Page(
0100   XQspiPsu *QspiPsuPtr,
0101   u32 Address,
0102   u32 ByteCount,
0103   u8 **ReadBfrPtr
0104 );
0105 
0106 /*****************************************************************************/
0107 /**
0108  *
0109  * This function performs a read. Default setting is in DMA mode.
0110  *
0111  * @param   QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0112  * @param   Address contains the address to begin the read at.
0113  * @param   ByteCount contains the total size to be read.
0114  * @param   ReadBfr The read buffer to which valid received data
0115  *      should be written
0116  *
0117  * @return  XST_SUCCESS if successful, else XST_FAILURE.
0118  *
0119  * @note    None.
0120  *
0121  ******************************************************************************/
0122 int QspiPsu_NOR_Read(
0123   XQspiPsu *QspiPsuPtr,
0124   u32 Address,
0125   u32 ByteCount,
0126   u8 *ReadBfr
0127 );
0128 
0129 /*****************************************************************************/
0130 /**
0131  *
0132  * This function performs a read of the ECC Status Register for a given address.
0133  *
0134  * @param   QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0135  * @param   Address contains the address of the ECC unit for which the ECCSR
0136  *      needs to be read. The ECC unit contains 16 bytes of user data
0137  *      and all bytes in an ECC unit will return the same ECCSR.
0138  * @param   ReadBfrPtr is a pointer to a single byte to which the ECCSR will
0139  *      be written.
0140  *
0141  * @return  XST_SUCCESS if successful, else XST_FAILURE.
0142  *
0143  * @note    Only the three least significant bits of the returned byte are
0144  *      meaningful. If all bits are 0, ECC is enabled for this unit and
0145  *      no errors have been encountered.
0146  *      Bit 0 is 1: ECC is disabled for the requested unit.
0147  *      Bit 1 is 1: A single bit error has been corrected in user data.
0148  *      Bit 2 is 1: A single bit error has been found in the ECC data
0149  *                  and may indicate user data corruption.
0150  *
0151  ******************************************************************************/
0152 int QspiPsu_NOR_Read_Ecc(
0153   XQspiPsu *QspiPsuPtr,
0154   u32 Address,
0155   u8 *ReadBfrPtr
0156 );
0157 
0158 /*****************************************************************************/
0159 /**
0160  *
0161  * This function returns the size of attached flash parts.
0162  *
0163  * @param   QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0164  *
0165  * @return  The size of attached flash in bytes.
0166  *
0167  ******************************************************************************/
0168 u32 QspiPsu_NOR_Get_Device_Size(XQspiPsu *QspiPsuPtr);
0169 
0170 /*****************************************************************************/
0171 /**
0172  *
0173  * This function returns the sector size of attached flash parts.
0174  *
0175  * @param   QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0176  *
0177  * @return  The sector size of attached flash in bytes.
0178  *
0179  ******************************************************************************/
0180 u32 QspiPsu_NOR_Get_Sector_Size(XQspiPsu *QspiPsuPtr);
0181 
0182 /*****************************************************************************/
0183 /**
0184  *
0185  * This function performs a read of the RDID configuration space.
0186  *
0187  * @param   QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0188  * @param   ReadBfrPtr is a pointer to a buffer to be filled with
0189  *      configuration data.
0190  * @param   ReadLen is the total length of the configuration space to read.
0191  *
0192  * @return  XST_SUCCESS if successful, else XST_FAILURE.
0193  *
0194  ******************************************************************************/
0195 int QspiPsu_NOR_RDID(XQspiPsu *QspiPsuPtr, u8 *ReadBfrPtr, u32 ReadLen);
0196 
0197 /*****************************************************************************/
0198 /**
0199  *
0200  * This function performs a read of the SFDP configuration space.
0201  *
0202  * @param   QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0203  * @param   ReadBfrPtr is a pointer to a buffer to be filled with
0204  *      configuration data.
0205  * @param   ReadLen is the total length of the configuration space to read.
0206  *
0207  * @return  XST_SUCCESS if successful, else XST_FAILURE.
0208  *
0209  ******************************************************************************/
0210 int QspiPsu_NOR_RDSFDP(
0211   XQspiPsu *QspiPsuPtr,
0212   u32 Address,
0213   u32 ByteCount,
0214   u8 **ReadBfrPtr
0215 );
0216 
0217 /**
0218  * This function returns the page size of attached flash parts.
0219  *
0220  * @param QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0221  *
0222  * @return The page size of attached flash in bytes.
0223  ******************************************************************************/
0224 u32 QspiPsu_NOR_Get_Page_Size(XQspiPsu *QspiPsuPtr);
0225 
0226 /**
0227  * This function returns the JEDEC ID of attached flash parts.
0228  *
0229  * @param QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
0230  *
0231  * @return The JEDEC ID of attached flash in bytes.
0232  ******************************************************************************/
0233 u32 QspiPsu_NOR_Get_JEDEC_ID(XQspiPsu *QspiPsuPtr);