186#include "xil_cache.h"
188#if defined (XCLOCKING)
189#include "xil_clocking.h"
241#if defined (XCLOCKING)
284#define BYTES256_PER_PAGE 256U
285#define BYTES512_PER_PAGE 512U
286#define BYTES1024_PER_PAGE 1024U
287#define PAGES16_PER_SECTOR 16U
288#define PAGES128_PER_SECTOR 128U
289#define PAGES256_PER_SECTOR 256U
290#define PAGES512_PER_SECTOR 512U
291#define PAGES1024_PER_SECTOR 1024U
292#define NUM_OF_SECTORS2 2U
293#define NUM_OF_SECTORS4 4U
294#define NUM_OF_SECTORS8 8U
295#define NUM_OF_SECTORS16 16U
296#define NUM_OF_SECTORS32 32U
297#define NUM_OF_SECTORS64 64U
298#define NUM_OF_SECTORS128 128U
299#define NUM_OF_SECTORS256 256U
300#define NUM_OF_SECTORS512 512U
301#define NUM_OF_SECTORS1024 1024U
302#define NUM_OF_SECTORS2048 2048U
303#define NUM_OF_SECTORS4096 4096U
304#define NUM_OF_SECTORS8192 8192U
305#define SECTOR_SIZE_64K 0X10000U
306#define SECTOR_SIZE_128K 0X20000U
307#define SECTOR_SIZE_256K 0X40000U
308#define SECTOR_SIZE_512K 0X80000U
311#define XQSPIPSU_READMODE_DMA 0x0U
312#define XQSPIPSU_READMODE_IO 0x1U
314#define XQSPIPSU_SELECT_FLASH_CS_LOWER 0x1U
315#define XQSPIPSU_SELECT_FLASH_CS_UPPER 0x2U
316#define XQSPIPSU_SELECT_FLASH_CS_BOTH 0x3U
318#define XQSPIPSU_SELECT_FLASH_BUS_LOWER 0x1U
319#define XQSPIPSU_SELECT_FLASH_BUS_UPPER 0x2U
320#define XQSPIPSU_SELECT_FLASH_BUS_BOTH 0x3U
322#define XQSPIPSU_SELECT_MODE_SPI 0x1U
323#define XQSPIPSU_SELECT_MODE_DUALSPI 0x2U
324#define XQSPIPSU_SELECT_MODE_QUADSPI 0x4U
326#define XQSPIPSU_GENFIFO_CS_SETUP 0x05U
327#define XQSPIPSU_GENFIFO_CS_HOLD 0x04U
329#define XQSPIPSU_CLK_ACTIVE_LOW_OPTION 0x2U
330#define XQSPIPSU_CLK_PHASE_1_OPTION 0x4U
331#define XQSPIPSU_MANUAL_START_OPTION 0x8U
333#define XQSPIPSU_LQSPI_MODE_OPTION 0x20U
335#define XQSPIPSU_LQSPI_LESS_THEN_SIXTEENMB 1U
338#define XQSPIPSU_GENFIFO_EXP_START 0x100U
340#define XQSPIPSU_DMA_BYTES_MAX 0x10000000U
342#define XQSPIPSU_CLK_PRESCALE_2 0x00U
343#define XQSPIPSU_CLK_PRESCALE_4 0x01U
344#define XQSPIPSU_CLK_PRESCALE_8 0x02U
345#define XQSPIPSU_CLK_PRESCALE_16 0x03U
346#define XQSPIPSU_CLK_PRESCALE_32 0x04U
347#define XQSPIPSU_CLK_PRESCALE_64 0x05U
348#define XQSPIPSU_CLK_PRESCALE_128 0x06U
349#define XQSPIPSU_CLK_PRESCALE_256 0x07U
350#define XQSPIPSU_CR_PRESC_MAXIMUM 7U
352#define XQSPIPSU_CONNECTION_MODE_SINGLE 0U
353#define XQSPIPSU_CONNECTION_MODE_STACKED 1U
354#define XQSPIPSU_CONNECTION_MODE_PARALLEL 2U
357#define XQSPIPSU_FREQ_37_5MHZ 37500000U
358#define XQSPIPSU_FREQ_40MHZ 40000000U
359#define XQSPIPSU_FREQ_100MHZ 100000000U
360#define XQSPIPSU_FREQ_150MHZ 150000000U
363#define XQSPIPSU_MSG_FLAG_STRIPE 0x1U
364#define XQSPIPSU_MSG_FLAG_RX 0x2U
365#define XQSPIPSU_MSG_FLAG_TX 0x4U
366#define XQSPIPSU_MSG_FLAG_POLL 0x8U
368#define XQSPIPSU_RXADDR_OVER_32BIT 0x100000000U
370#define XQSPIPSU_SET_WP 1
375#define XQspiPsu_Select(InstancePtr, Mask) \
376 XQspiPsu_Out32(((InstancePtr)->Config.BaseAddress) + \
377 XQSPIPSU_SEL_OFFSET, (Mask))
382#define XQspiPsu_Enable(InstancePtr) \
383 XQspiPsu_Out32(((InstancePtr)->Config.BaseAddress) + \
384 XQSPIPSU_EN_OFFSET, XQSPIPSU_EN_MASK)
388#define XQspiPsu_Disable(InstancePtr) \
389 XQspiPsu_Out32(((InstancePtr)->Config.BaseAddress) + \
390 XQSPIPSU_EN_OFFSET, 0x0U)
396#define XQspiPsu_GetLqspiConfigReg(InstancePtr) \
397 XQspiPsu_In32((XQSPIPS_BASEADDR) + \
398 XQSPIPSU_LQSPI_CR_OFFSET)
413static inline void XQspiPsu_ManualStartEnable(
XQspiPsu *InstancePtr)
418 xil_printf(
"\nXQspiPsu_ManualStartEnable\r\n");
423 xil_printf(
"\nManual Start\r\n");
427 XQSPIPSU_CFG_START_GEN_FIFO_MASK);
442static inline void XQspiPsu_GenFifoEntryCSAssert(
const XQspiPsu *InstancePtr)
449 xil_printf(
"\nXQspiPsu_GenFifoEntryCSAssert\r\n");
453 GenFifoEntry |= (XQSPIPSU_GENFIFO_MODE_SPI | InstancePtr->
GenFifoCS |
456 xil_printf(
"\nFifoEntry=%08x\r\n", GenFifoEntry);
474static inline void XQspiPsu_GenFifoEntryCSDeAssert(
const XQspiPsu *InstancePtr)
481 xil_printf(
"\nXQspiPsu_GenFifoEntryCSDeAssert\r\n");
485 GenFifoEntry |= (XQSPIPSU_GENFIFO_MODE_SPI | InstancePtr->
GenFifoBus |
488 xil_printf(
"\nFifoEntry=%08x\r\n", GenFifoEntry);
510static inline void StubStatusHandler(
const void *CallBackRef, u32 StatusEvent,
513 (
const void) CallBackRef;
525 UINTPTR EffectiveAddr);
void XQspiPsu_SetStatusHandler(XQspiPsu *InstancePtr, void *CallBackRef, XQspiPsu_StatusHandler FuncPointer)
Definition: xqspipsu.c:873
s32 XQspiPsu_ClearOptions(XQspiPsu *InstancePtr, u32 Options)
Definition: xqspipsu_options.c:214
XQspiPsu_Config XQspiPsu_ConfigTable[XPAR_XQSPIPSU_NUM_INSTANCES]
void XQspiPsu_WriteProtectToggle(const XQspiPsu *InstancePtr, u32 Toggle)
This API enables/ disables Write Protect pin on the flash parts.
Definition: xqspipsu.c:901
#define XQSPIPSU_CFG_OFFSET
Definition: xqspipsu_hw.h:96
void XQspiPsu_SelectFlash(XQspiPsu *InstancePtr, u8 FlashCS, u8 FlashBus)
Definition: xqspipsu_options.c:381
s32 XQspiPsu_SetReadMode(XQspiPsu *InstancePtr, u32 Mode)
Definition: xqspipsu_options.c:457
#define XQSPIPSU_GEN_FIFO_OFFSET
Definition: xqspipsu_hw.h:487
void XQspiPsu_Idle(const XQspiPsu *InstancePtr)
Definition: xqspipsu.c:209
void XQspiPsu_SetWP(const XQspiPsu *InstancePtr, u8 Value)
Definition: xqspipsu_options.c:519
#define XQspiPsu_WriteReg(BaseAddress, RegOffset, RegisterValue)
Definition: xqspipsu_hw.h:997
s32 XQspiPsu_PolledTransfer(XQspiPsu *InstancePtr, XQspiPsu_Msg *Msg, u32 NumMsg)
Definition: xqspipsu.c:432
s32 XQspiPsu_InterruptTransfer(XQspiPsu *InstancePtr, XQspiPsu_Msg *Msg, u32 NumMsg)
Definition: xqspipsu.c:587
s32 XQspiPsu_CheckDmaDone(XQspiPsu *InstancePtr)
Definition: xqspipsu.c:1030
#define XQSPIPSU_GENFIFO_CS_HOLD
Definition: xqspipsu.h:327
s32 XQspiPsu_StartDmaTransfer(XQspiPsu *InstancePtr, XQspiPsu_Msg *Msg, u32 NumMsg)
Definition: xqspipsu.c:941
void XQspiPsu_Reset(XQspiPsu *InstancePtr)
Definition: xqspipsu.c:249
s32 XQspiPsu_CfgInitialize(XQspiPsu *InstancePtr, const XQspiPsu_Config *ConfigPtr, UINTPTR EffectiveAddr)
Definition: xqspipsu.c:129
void(* XQspiPsu_StatusHandler)(const void *CallBackRef, u32 StatusEvent, u32 ByteCount)
Definition: xqspipsu.h:211
s32 XQspiPsu_SetClkPrescaler(const XQspiPsu *InstancePtr, u8 Prescaler)
Definition: xqspipsu_options.c:319
#define XQSPIPSU_GENFIFO_CS_SETUP
Definition: xqspipsu.h:326
s32 XQspiPsu_InterruptHandler(XQspiPsu *InstancePtr)
Definition: xqspipsu.c:683
void XQspiPsu_Abort(XQspiPsu *InstancePtr)
Definition: xqspipsu.c:276
u32 XQspiPsu_GetOptions(const XQspiPsu *InstancePtr)
Definition: xqspipsu_options.c:278
#define XQspiPsu_ReadReg(BaseAddress, RegOffset)
Definition: xqspipsu_hw.h:979
s32 XQspiPsu_SetOptions(XQspiPsu *InstancePtr, u32 Options)
Definition: xqspipsu_options.c:116
#define Xil_AssertVoid(Expression)
This assert macro is to be used for void functions. This in conjunction with the Xil_AssertWait boole...
Definition: xil_assert.h:86
#define Xil_AssertVoidAlways()
Always assert. This assert macro is to be used for void functions. Use for instances where an assert ...
Definition: xil_assert.h:131
#define NULL
Requests a GPIO pin group configuration.
Definition: xil_types.h:54
#define XIL_COMPONENT_IS_READY
Definition: xil_types.h:57
Definition: xqspipsu.h:234
u8 IsCacheCoherent
Definition: xqspipsu.h:240
UINTPTR BaseAddress
Definition: xqspipsu.h:236
u16 DeviceId
Definition: xqspipsu.h:235
u32 InputClockHz
Definition: xqspipsu.h:237
u8 ConnectionMode
Definition: xqspipsu.h:238
u8 BusWidth
Definition: xqspipsu.h:239
Definition: xqspipsu.h:217
u8 * TxBfrPtr
Definition: xqspipsu.h:218
u8 PollData
Definition: xqspipsu.h:223
u8 * RxBfrPtr
Definition: xqspipsu.h:219
u32 Flags
Definition: xqspipsu.h:222
u8 PollBusMask
Definition: xqspipsu.h:226
u32 ByteCount
Definition: xqspipsu.h:220
u8 PollStatusCmd
Definition: xqspipsu.h:225
u64 RxAddr64bit
Definition: xqspipsu.h:227
u32 PollTimeout
Definition: xqspipsu.h:224
u8 Xfer64bit
Definition: xqspipsu.h:228
u32 BusWidth
Definition: xqspipsu.h:221
Definition: xqspipsu.h:251
u32 GenFifoBus
Definition: xqspipsu.h:268
u8 IsManualstart
Definition: xqspipsu.h:272
s32 IsUnaligned
Definition: xqspipsu.h:271
XQspiPsu_Msg * Msg
Definition: xqspipsu.h:273
u8 * SendBufferPtr
Definition: xqspipsu.h:255
XQspiPsu_StatusHandler StatusHandler
Definition: xqspipsu.h:274
s32 TxBytes
Definition: xqspipsu.h:259
u8 * RecvBufferPtr
Definition: xqspipsu.h:256
u64 RecvBuffer
Definition: xqspipsu.h:257
XQspiPsu_Config Config
Definition: xqspipsu.h:252
void * StatusRef
Definition: xqspipsu.h:275
u32 IsBusy
Definition: xqspipsu.h:265
u32 ReadMode
Definition: xqspipsu.h:266
s32 GenFifoEntries
Definition: xqspipsu.h:261
s32 RxBytes
Definition: xqspipsu.h:260
s32 MsgCnt
Definition: xqspipsu.h:270
u32 GenFifoCS
Definition: xqspipsu.h:267
u8 * GenFifoBufferPtr
Definition: xqspipsu.h:258
u32 IsReady
Definition: xqspipsu.h:253
s32 NumMsg
Definition: xqspipsu.h:269