This is for a single board computer running Linux. There is no physical hard drive in the system but is using onboard flash chips. Earlier we used DiskOnChip which I could access at "/dev/discs/disc0/disc". Recently started using a new board which has a different flash chip and is on IDE bus.
I am trying to port some of the drivers and the 'ioctl()' call is failing.
Here is the original code (irrelevant code lines have been omitted):
********* code -start **********
fd=open(BIT_FILE, O_RDWR);
if(fd>0)
{
rc=read(fd,&BIT_buff, sizeof(BIT_Qfile);
// handle any error
if(ioctl(fd,MEMGETINFO,&meminfo) != 0)
{ close(fd);
printf("Failed at call to ioctl with MEMGETINFO.");
return(rc);
} /* END of if(ioctl(fd,MEMGETINFO,&meminfo) != 0) */
} /* END of if(fd>0) */
------
----
****** END of code ******
This all works great on the first board where the BIT_FILE is defined as "/dev/mtd/0".
When I try the same code on the second ( with solid state on-board IDE drive) it fails.
I can see the error message printed on the console which shows that the ioctl call with MEMGETINFO failed.
I modified the definition of BIT_FILE to different things as follows with the same resuults: "/dev/discs/disc0/part1" and tried "/dev/ide/host1/bus0/target0/lun0/disc/part1".
My question is: what should I use for BIT_FILE while 'opening anew file' which is further used for 'ioctl()' operation?
I guess any generic solution that uses a drive on IDE bus should work for my problem. Anyone, any suggestions please?
Thanks in advance.