Can I suggest a simpler approach:
long val0 = *((long*)(0|CAM_UNCACHED_BIT));
write(fd, &val0, 4);
write(fd, (void*)4, MAXRAMADDR-3); // MAXRAMADDR is last valid RAM location
No additional #defines in camera.h and the correct RAM size is already defined for many cameras.
Thanks, I haven't looked into makefile.inc, that's why I have missed this already existing #define.
Note: This requires an update to makefile.inc to change the default value of MAXRAMADDR from 0x200000 to 0x1FFFFFF (this will make it consistent with other usage).
I have attached a new patch with your suggested changes. The patch also defines MAXRAMADDR for two cameras that only have 16MB of RAM. I have tested this new version: it works on the A410, Ixus65, SX100IS.
I'd also like to request a "promotion" to beta for my A410 port. I got feedback (more or less) from 4 different users and the port doesn't currently have unsolved bugs I know about. I've developed it using the 1.00f firmware, two people reported success using it with their 1.00e revision camera. Patch also attached. Porting thread is here:
http://chdk.setepontos.com/index.php?topic=2597.0Edit
@philmoz: Thanks.