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 via email to