int buffer_icap_set_configuration(struct hwicap_drvdata *drvdata, u32 *data, u32 size) { int status; s32 buffer_count = 0; s32 num_writes = 0; bool dirty = 0; u32 i; void __iomem *base_address = drvdata->base_address; for (i = 0, buffer_count = 0; i < size; i++) { buffer_icap_set_bram(base_address, buffer_count, data[i]); dirty = 1; if (buffer_count < XHI_MAX_BUFFER_INTS - 1) { buffer_count++; continue; } status = buffer_icap_device_write( drvdata, XHI_BUFFER_START, XHI_MAX_BUFFER_INTS); if (status != 0) { buffer_icap_reset(drvdata); return status; } buffer_count = 0; num_writes++; dirty = 0; } if (dirty) { status = buffer_icap_device_write(drvdata, XHI_BUFFER_START, buffer_count); if (status != 0) { buffer_icap_reset(drvdata); } return status; } return 0; };
/** * buffer_icap_set_configuration - Load a partial bitstream from system memory. * @drvdata: a pointer to the drvdata. * @data: Kernel address of the partial bitstream. * @size: the size of the partial bitstream in 32 bit words. **/ int buffer_icap_set_configuration(struct hwicap_drvdata *drvdata, u32 *data, u32 size) { int status; s32 buffer_count = 0; bool dirty = false; u32 i; void __iomem *base_address = drvdata->base_address; /* Loop through all the data */ for (i = 0, buffer_count = 0; i < size; i++) { /* Copy data to bram */ buffer_icap_set_bram(base_address, buffer_count, data[i]); dirty = true; if (buffer_count < XHI_MAX_BUFFER_INTS - 1) { buffer_count++; continue; } /* Write data to ICAP */ status = buffer_icap_device_write( drvdata, XHI_BUFFER_START, XHI_MAX_BUFFER_INTS); if (status != 0) { /* abort. */ buffer_icap_reset(drvdata); return status; } buffer_count = 0; dirty = false; } /* Write unwritten data to ICAP */ if (dirty) { /* Write data to ICAP */ status = buffer_icap_device_write(drvdata, XHI_BUFFER_START, buffer_count); if (status != 0) { /* abort. */ buffer_icap_reset(drvdata); } return status; } return 0; };