Durwin De La Rue(deleted)
|
|
Durwin De La Rue(deleted)
06/12/2009 12:43 PM
post31636
|
I need to debug the code but can't find where the arguments are getting parsed. I start with this command.
> fs-etfs-nand -r 12800
To check things out, I do this.
> etfsctl -i -d /dev/etfs2
However, both etfs1 and etfs2 show the same information.
# etfsctl -i -d /dev/etfs2
Device NAND2caa
Blocks Clusters/Block Clustersize Totalsize
2048 64 2048 268435456
Pools
Clean Spare Filthy Inactive Xpool Cache
0 0 1947 124608 2048 64
Counts
Erase Avg Read Cache Write Mine Copy Defrag BadBlks
0 0 0 0 0 0 0 0 1
Errors
Ecc Chksum Device
0 0 0
So, I would like to follow the startup sequence to see what all is getting done. I have a project which I think came
from working driver. The name is os-efsys_efsys. I have devio.c and chipio.c. The file chipio.c has the main function
defined like this.
int main(int argc, char *argv[])
{
return(etfs_main(argc, argv));
}
From here I am lost. Some how etfs_main has to make calls back to the source in devio and chipio. I can't find
anyplace where the commandline option '-r #' is parsed. I am familiar with how Linux drivers are written so kernel can
make calls to init, read, and write, but this is different.
Any direction will help.
|
|
|
David Sarrazin
|
RE: Driver startup sequence
|
David Sarrazin
06/12/2009 1:02 PM
post31642
|
RE: Driver startup sequence
Durwin,
etfsctl parses arguments from left to right. Doing
etfsctl -i -d /dev/etfs2
And
etfsctl -i -d /dev/etfs1
Will actually give you the information for /dev/etfs2 (the default value
for -d) twice.
As for where the options are processed, that's done in the options()
function, called from product/trunk/lib/etfs/main.c:etfs_main(). The
"-D" option is processed by devio_options() called from devio_init().
David
> -----Original Message-----
> From: Durwin De La Rue [mailto:community-noreply@qnx.com]
> Sent: June 12, 2009 12:44 PM
> To: general-filesystems
> Subject: Driver startup sequence
>
> I need to debug the code but can't find where the arguments
> are getting parsed. I start with this command.
>
> > fs-etfs-nand -r 12800
>
> To check things out, I do this.
>
> > etfsctl -i -d /dev/etfs2
>
> However, both etfs1 and etfs2 show the same information.
>
> # etfsctl -i -d /dev/etfs2
> Device NAND2caa
> Blocks Clusters/Block Clustersize Totalsize
> 2048 64 2048 268435456
> Pools
> Clean Spare Filthy Inactive Xpool Cache
> 0 0 1947 124608 2048 64
> Counts
> Erase Avg Read Cache Write Mine Copy
> Defrag BadBlks
> 0 0 0 0 0 0 0
> 0 1
> Errors
> Ecc Chksum Device
> 0 0 0
>
> So, I would like to follow the startup sequence to see what
> all is getting done. I have a project which I think came
> from working driver. The name is os-efsys_efsys. I have
> devio.c and chipio.c. The file chipio.c has the main
> function defined like this.
>
> int main(int argc, char *argv[])
> {
> return(etfs_main(argc, argv));
> }
>
> From here I am lost. Some how etfs_main has to make calls
> back to the source in devio and chipio. I can't find
> anyplace where the commandline option '-r #' is parsed. I am
> familiar with how Linux drivers are written so kernel can
> make calls to init, read, and write, but this is different.
>
> Any direction will help.
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post31636
>
>
|
|
|
Durwin De La Rue(deleted)
|
Re: RE: Driver startup sequence
|
Durwin De La Rue(deleted)
06/12/2009 1:15 PM
post31644
|
Re: RE: Driver startup sequence
> Durwin,
>
> etfsctl parses arguments from left to right. Doing
>
> etfsctl -i -d /dev/etfs2
> And
> etfsctl -i -d /dev/etfs1
>
> Will actually give you the information for /dev/etfs2 (the default value
> for -d) twice.
How do I get info on etfs1? etfsctl -d /dev/etfs1 -i ?
>
> As for where the options are processed, that's done in the options()
> function, called from product/trunk/lib/etfs/main.c:etfs_main(). The
> "-D" option is processed by devio_options() called from devio_init().
Is devio_options where the '-r' option gets parsed? This call has code for only the '-D'. I would have expected and
error using '-r' since it is not handled.
>
> David
>
> > -----Original Message-----
> > From: Durwin De La Rue [mailto:community-noreply@qnx.com]
> > Sent: June 12, 2009 12:44 PM
> > To: general-filesystems
> > Subject: Driver startup sequence
> >
> > I need to debug the code but can't find where the arguments
> > are getting parsed. I start with this command.
> >
> > > fs-etfs-nand -r 12800
> >
> > To check things out, I do this.
> >
> > > etfsctl -i -d /dev/etfs2
> >
> > However, both etfs1 and etfs2 show the same information.
> >
> > # etfsctl -i -d /dev/etfs2
> > Device NAND2caa
> > Blocks Clusters/Block Clustersize Totalsize
> > 2048 64 2048 268435456
> > Pools
> > Clean Spare Filthy Inactive Xpool Cache
> > 0 0 1947 124608 2048 64
> > Counts
> > Erase Avg Read Cache Write Mine Copy
> > Defrag BadBlks
> > 0 0 0 0 0 0 0
> > 0 1
> > Errors
> > Ecc Chksum Device
> > 0 0 0
> >
> > So, I would like to follow the startup sequence to see what
> > all is getting done. I have a project which I think came
> > from working driver. The name is os-efsys_efsys. I have
> > devio.c and chipio.c. The file chipio.c has the main
> > function defined like this.
> >
> > int main(int argc, char *argv[])
> > {
> > return(etfs_main(argc, argv));
> > }
> >
> > From here I am lost. Some how etfs_main has to make calls
> > back to the source in devio and chipio. I can't find
> > anyplace where the commandline option '-r #' is parsed. I am
> > familiar with how Linux drivers are written so kernel can
> > make calls to init, read, and write, but this is different.
> >
> > Any direction will help.
> >
> > _______________________________________________
> > General
> > http://community.qnx.com/sf/go/post31636
> >
> >
|
|
|
David Sarrazin
|
RE: RE: Driver startup sequence
|
David Sarrazin
06/12/2009 2:00 PM
post31650
|
RE: RE: Driver startup sequence
> -----Original Message-----
> From: Durwin De La Rue [mailto:community-noreply@qnx.com]
> Sent: June 12, 2009 1:16 PM
> To: general-filesystems
> Subject: Re: RE: Driver startup sequence
>
> > Durwin,
> >
> > etfsctl parses arguments from left to right. Doing
> >
> > etfsctl -i -d /dev/etfs2
> > And
> > etfsctl -i -d /dev/etfs1
> >
> > Will actually give you the information for /dev/etfs2 (the default
> > value for -d) twice.
>
> How do I get info on etfs1? etfsctl -d /dev/etfs1 -i ?
Yes. You have to set the device before passing the operations to be
performed on the device.
>
> >
> > As for where the options are processed, that's done in the
> options()
> > function, called from
> product/trunk/lib/etfs/main.c:etfs_main(). The
> > "-D" option is processed by devio_options() called from
> devio_init().
>
> Is devio_options where the '-r' option gets parsed? This
> call has code for only the '-D'. I would have expected and
> error using '-r' since it is not handled.
devio_options() is only responsible for the string passed to the -D
argument. The parsing of the reset of the options are done in the file
/product/trunk/lib/etfs/options.c, in the function options(). This
function is called from etfs_main() in the file
/product/trunk/lib/etfs/main.c
>
> >
> > David
> >
> > > -----Original Message-----
> > > From: Durwin De La Rue [mailto:community-noreply@qnx.com]
> > > Sent: June 12, 2009 12:44 PM
> > > To: general-filesystems
> > > Subject: Driver startup sequence
> > >
> > > I need to debug the code but can't find where the arguments are
> > > getting parsed. I start with this command.
> > >
> > > > fs-etfs-nand -r 12800
> > >
> > > To check things out, I do this.
> > >
> > > > etfsctl -i -d /dev/etfs2
> > >
> > > However, both etfs1 and etfs2 show the same information.
> > >
> > > # etfsctl -i -d /dev/etfs2
> > > Device NAND2caa
> > > Blocks Clusters/Block Clustersize Totalsize
> > > 2048 64 2048 268435456
> > > Pools
> > > Clean Spare Filthy Inactive Xpool Cache
> > > 0 0 1947 124608 2048 64
> > > Counts
> > > Erase Avg Read Cache Write Mine Copy
> > > Defrag BadBlks
> > > 0 0 0 0 0 0 0
> > > 0 1
> > > Errors
> > > Ecc Chksum Device
> > > 0 0 0
> > >
> > > So, I would like to follow the startup sequence to see
> what all is
> > > getting done. I have a project which I think came from working
> > > driver. The name is os-efsys_efsys. I have devio.c and
> chipio.c.
> > > The file chipio.c has the main function defined like this.
> > >
> > > int main(int argc, char *argv[])
> > > {
> > > return(etfs_main(argc, argv));
> > > }
> > >
> > > From here I am lost. Some how etfs_main has to make
> calls back to
> > > the source in devio and chipio. I can't find anyplace where the
> > > commandline option '-r #' is parsed. I am familiar with
> how Linux
> > > drivers are written so kernel can make calls to init, read, and
> > > write, but this is different.
> > >
> > > Any direction will help.
> > >
> > > _______________________________________________
> > >...
|
|
|
Durwin De La Rue(deleted)
|
Re: RE: RE: Driver startup sequence
|
Durwin De La Rue(deleted)
06/12/2009 2:57 PM
post31660
|
Re: RE: RE: Driver startup sequence
The function devio_readtrans gets called many times after running;
fs-etfs-nand -r 12800
But it never reaches the point mark "NEVER GETS HERE". What is this doing?
int devio_readtrans(struct etfs_devio *dev, unsigned cluster, struct etfs_trans *trp) {
struct spare *spare;
unsigned page = cluster;
CHIPIO *cio = dev->cio;
uint8_t buf[2112];
nand_write_cmd(cio, NANDCMD_READ);
nand_write_pageaddr(cio, page, cio->addrcycles);
nand_write_cmd(cio, NANDCMD_READCONFIRM);
if(nand_wait_busy(cio, MAX_READ_USEC) != 0)
dev->log(_SLOG_CRITICAL, "Timeout on READ");
//nand_read_data(cio, (uint8_t *)&spare, sizeof(spare));
nand_read_data(cio, buf, sizeof(buf));
spare = (struct spare*) &buf[2048];
cio->lastpage = page;
if(spare->status != 0xff || spare->status2 != 0xff) {
dev->log(_SLOG_ERROR, "readtrans BADBLK on cluster %d", cluster);
return(ETFS_TRANS_BADBLK);
}
if(((uint64_t *)spare)[2] == ~0ll && ((uint64_t *)spare)[3] == ~0ll
&& ((uint64_t *)spare)[4] == ~0ll && ((uint64_t *)spare)[5] == ~0ll
&& ((uint64_t *)spare)[6] == ~0ll && ((uint64_t *)spare)[7] == ~0ll)
if(spare->erasesig[0] == ERASESIG1 && spare->erasesig[1] == ERASESIG2)
return(ETFS_TRANS_ERASED);
else
return(ETFS_TRANS_FOXES);
NEVER GETS HERE
if(dev->crc32((uint8_t *) spare, sizeof(spare) - sizeof(spare->crctrans)) != spare->crctrans) {
dev->log(_SLOG_ERROR, "readtrans DATAERR on cluster %d", cluster);
return(ETFS_TRANS_DATAERR);
}
trp->sequence = ENDIAN_LE32(spare->sequence);
trp->fid = ENDIAN_LE16(spare->fid);
trp->cluster = ENDIAN_LE16(spare->clusterlo) + (spare->clusterhi << 16);
trp->nclusters = spare->nclusters;
return(ETFS_TRANS_OK);
}
|
|
|
Lichun Zhu
|
Re: RE: RE: Driver startup sequence
|
Lichun Zhu
07/21/2009 3:38 PM
post34263
|
Re: RE: RE: Driver startup sequence
That means it need to be erased or already erased but no transaction on the flash.
Normally this means you have not erased or format it.
|
|
|
|