This function programs the flash device(s) with data specified in the user buffer.
The source and destination address are always aligned to the width of the flash data bus.
The device is polled until an error or the operation completes successfully.
Prototype
int XFlash_Write(XFlash *InstancePtr, u32 Offset, u32 Bytes, void *SrcPtr);
Parameters
The following table lists the XFlash_Write function arguments.
| Type | Member | Description |
|---|---|---|
| XFlash * | InstancePtr | Pointer to the XFlash instance |
| u32 | Offset | Offset into the device(s) address space from which to begin programming. Ensure to align with the width of the flash's data bus |
| u32 | Bytes | Number of bytes to program |
| void * | SrcPtr | Source address containing program data. It must be aligned to the width of the flash data bus. The SrcPtr does not have to be aligned to the flash width if the processor supports unaligned access. This library is generic, and some processors (for example,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.