source: rtems/bsps/include/dev/spi/xqspipsu-flash-helper.h @ a67aab6

Last change on this file since a67aab6 was a67aab6, checked in by Kinsey Moore <kinsey.moore@…>, on 05/19/23 at 17:47:32

bsps/xqspipsu: Ensure NOR writes align

This change causes NOR writes to be broken according to page boundaries.
Writes across page boundaries cause the writes beyond the boundary to
fail silently. This also introduces a new function that will explicitly
write pages.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/******************************************************************************
2* Copyright (C) 2018 - 2022 Xilinx, Inc.  All rights reserved.
3* SPDX-License-Identifier: MIT
4******************************************************************************/
5
6#include "xqspipsu.h"
7
8int QspiPsu_NOR_Initialize(
9  XQspiPsu *QspiPsuInstancePtr,
10  u16 QspiPsuIntrId
11);
12
13/*****************************************************************************/
14/**
15 *
16 * This function erases the sectors in the  serial Flash connected to the
17 * QSPIPSU interface.
18 *
19 * @param       QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
20 * @param       Address contains the address of the first sector which needs to
21 *              be erased.
22 * @param       ByteCount contains the total size to be erased.
23 *
24 * @return      XST_SUCCESS if successful, else XST_FAILURE.
25 *
26 * @note        None.
27 *
28 ******************************************************************************/
29int QspiPsu_NOR_Erase(
30  XQspiPsu *QspiPsuPtr,
31  u32 Address,
32  u32 ByteCount
33);
34
35/*****************************************************************************/
36/**
37 *
38 * This function writes to the  serial Flash connected to the QSPIPSU interface.
39 * All the data put into the buffer must be in the same page of the device with
40 * page boundaries being on 256 byte boundaries.
41 *
42 * @param       QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
43 * @param       Address contains the address to write data to in the Flash.
44 * @param       ByteCount contains the number of bytes to write.
45 * @param       WriteBfrPtr is pointer to the write buffer (which is to be transmitted)
46 *
47 * @return      XST_SUCCESS if successful, else XST_FAILURE.
48 *
49 * @note        None.
50 *
51 ******************************************************************************/
52int QspiPsu_NOR_Write_Page(
53  XQspiPsu *QspiPsuPtr,
54  u32 Address,
55  u32 ByteCount,
56  u8 *WriteBfrPtr
57);
58
59/*****************************************************************************/
60/**
61 *
62 * This function writes to the serial Flash connected to the QSPIPSU interface.
63 * Writes will be broken into device page sized and aligned writes as necessary.
64 *
65 * @param       QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
66 * @param       Address contains the address to write data to in the Flash.
67 * @param       ByteCount contains the number of bytes to write.
68 * @param       WriteBfrPtr is pointer to the write buffer (which is to be transmitted)
69 *
70 * @return      XST_SUCCESS if successful, else XST_FAILURE.
71 *
72 * @note        None.
73 *
74 ******************************************************************************/
75int QspiPsu_NOR_Write(
76  XQspiPsu *QspiPsuPtr,
77  u32 Address,
78  u32 ByteCount,
79  u8 *WriteBfrPtr
80);
81
82/*****************************************************************************/
83/**
84 *
85 * This function performs a read. Default setting is in DMA mode.
86 *
87 * @param       QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
88 * @param       Address contains the address of the first sector which needs to
89 *              be erased.
90 * @param       ByteCount contains the total size to be erased.
91 * @param       ReadBfrPtr is pointer to the read buffer to which valid received data
92 *              should be written
93 *
94 * @return      XST_SUCCESS if successful, else XST_FAILURE.
95 *
96 * @note        None.
97 *
98 ******************************************************************************/
99int QspiPsu_NOR_Read(
100  XQspiPsu *QspiPsuPtr,
101  u32 Address,
102  u32 ByteCount,
103  u8 **ReadBfrPtr
104);
105
106/*****************************************************************************/
107/**
108 *
109 * This function performs a read of the ECC Status Register for a given address.
110 *
111 * @param       QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
112 * @param       Address contains the address of the ECC unit for which the ECCSR
113 *              needs to be read. The ECC unit contains 16 bytes of user data
114 *              and all bytes in an ECC unit will return the same ECCSR.
115 * @param       ReadBfrPtr is a pointer to a single byte to which the ECCSR will
116 *              be written.
117 *
118 * @return      XST_SUCCESS if successful, else XST_FAILURE.
119 *
120 * @note        Only the three least significant bits of the returned byte are
121 *              meaningful. If all bits are 0, ECC is enabled for this unit and
122 *              no errors have been encountered.
123 *              Bit 0 is 1: ECC is disabled for the requested unit.
124 *              Bit 1 is 1: A single bit error has been corrected in user data.
125 *              Bit 2 is 1: A single bit error has been found in the ECC data
126 *                          and may indicate user data corruption.
127 *
128 ******************************************************************************/
129int QspiPsu_NOR_Read_Ecc(
130  XQspiPsu *QspiPsuPtr,
131  u32 Address,
132  u8 *ReadBfrPtr
133);
Note: See TracBrowser for help on using the repository browser.