XFlash_Write - 2023.1 English

Standalone Library Documentation: BSP and Libraries Document Collection (UG643)

Document ID
UG643
Release Date
2023-05-16
Version
2023.1 English

This function programs the flash device(s) with data specified in the user buffer.

The source and destination address must be aligned to the width of the flash's data bus.

The device is polled until an error or the operation completes successfully.

Note: None.

Prototype

int XFlash_Write(XFlash *InstancePtr, u32 Offset, u32 Bytes, void *SrcPtr);

Parameters

The following table lists the XFlash_Write function arguments.

Table 1. XFlash_Write Arguments
Type Name Description
XFlash * InstancePtr Pointer to the XFlash instance.
u32 Offset Offset into the device(s) address space from which to begin programming. Must be aligned to the width of the flash's data bus.
u32 Bytes Number of bytes to program.
void * SrcPtr Source address containing data to be programmed. Must be aligned to the width of the flash's data bus. The SrcPtr doesn't have to be aligned to the flash width if the processor supports unaligned access. But, since this library is generic, and some processors(eg. Microblaze) do not support unaligned access; this API requires the SrcPtr to be aligned.

Returns

  • XST_SUCCESS if successful.
  • XFLASH_ERROR if a write error occurred. This error is usually device specific. Use XFlash_DeviceControl() to retrieve specific error conditions. When this error is returned, it is possible that the target address range was only partially programmed.