Problem found in Xilinx icap driver for kernel 2.6
I'm porting linux 2.6 kernel to a ML 410 board using Xilinx's kernel
tree. Particularly, I would like to use Xilinx's icap driver (as in driver/char/xilinx_hwicap. I do not have problems in using it to write a partial bitstream to ICAP; but I have a problem when performing read back. I'm trying to read from a device from a user application using: int* frame = (int*) malloc( 83 * sizeof(int)); FILE *ICAP; ICAP = fopen("/dev/icap0", "r+b"); fwrite(word, sizeof(*word), 18, ICAP); fread(frame, sizeof(int), 83, ICAP); The device is opened OK. And the 18 words written to icap is the same as those in hwicap v1_01_a driver's xhwicap_device_read_frame.c: 1. Dummy 2. Sync 3. Noop 4. Noop 5. CMD 6. RCRC 7. Noop 8. Noop 9. CMD 10. RCFG 11. Noop 12. Noop 13. Noop 14. W FAR 15. frame addr 16. FRDO 83 words 17. Noop 18. Noop The problem is, in icap read function, static int buffer_icap_device_read(struct hwicap_drvdata *drvdata,u32 offset, u32 count) "count" is not the same value as I requested with fread. Instead of 0x53 (words), it gets 0x1000 (bytes). This value seems to causes a device read failure (it is not associated with frame boundary, and it is not the same value as previous command written to icap requests)- the icap status register after read is 0, not the normal value 0x7ffc; and data copied to user buffer is not the desired frame data. Actually, I am able to work around with this problem by forcing count to 83 in hwicap_read. This is OK since I mostly only needs to read one frame. By doing so, icap status register is the correct value of 0x7ffc after read. And in user space, *frame get the desired frame data. How can I fix the driver function so that hwicap_read gets the same "count" as fread passes to it? |
All times are GMT -5. The time now is 02:22 PM. |