public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Frank Pagliughi <fpagliughi@mindspring.com>
To: Ken Yee <kenkyee@excite.com>
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] reading size and used space on compact flash (CF) card?
Date: Fri, 29 Jun 2012 22:42:00 -0000	[thread overview]
Message-ID: <4FEE2F62.6010001@mindspring.com> (raw)
In-Reply-To: <20120629091545.28040@web005.roc2.bluetie.com>

On 06/29/2012 09:15 AM, Ken Yee wrote:
> ...
>          } else {
>              error = cyg_io_get_config(cf_handle,0,&cf_info,&len); //
>              //printf("cf get_config error: %i %i\n",error,-EINVAL); // should get -EINVAL???
>              uint32_t block_size = cf_info.block_size;
>              uint32_t blocks_num = cf_info.blocks_num;
>              uint32_t phys_block_size = cf_info.phys_block_size;
>              bool is_connected = cf_info.connected;
>
> ...
> But as mentioned in the code, it's returning crazy numbers in the 33MB range no matter what size CF card I install (I've tried 32MB and 128MB :-(
> Is there any other official API to read the size of it or any other IDE devices?
>

You are not using the proper key when querying for the disk information. 
You need to use CYG_IO_GET_CONFIG_DISK_INFO (not zero) as in:

     error = cyg_io_get_config(cf_handle, CYG_IO_GET_CONFIG_DISK_INFO, 
&cf_info, &len);

When you use the unrecognized key of zero, the function returns the 
error code -EINVAL because it doesn't recognize the query. With the 
proper query the function should return 0 for success.

Frank

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

      reply	other threads:[~2012-06-29 22:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-29 13:16 Ken Yee
2012-06-29 22:42 ` Frank Pagliughi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FEE2F62.6010001@mindspring.com \
    --to=fpagliughi@mindspring.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=kenkyee@excite.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).