I haven't been able to dig anything up on this using the search engine or Google. Has anyone been able to read the size and free space left on a CF card (which uses the IDE driver)?
Closest thing I found was this code that I modified slightly: int get_size() { cyg_disk_info_t cf_info; char cf_model[41]; cyg_io_handle_t cf_handle; cyg_uint32 len = sizeof(cyg_disk_info_t); int error = cyg_io_lookup(CFDEV_, &cf_handle); if (error!=0) { printf("lookup error:%i\n",error); return 0; } 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; memset(cf_model, 0, sizeof(cf_model)); strncpy(cf_model,cf_info.ident.model_num,sizeof(cf_model)); printf("block size:%d, phys_block_size:%d, num_blocks:%d, connected:%d, model:%s\n" ,block_size,phys_block_size,blocks_num,is_connected,cf_model); // block_size should be 512 bytes and we want to return megabytes block_size = 1; // hack for now because it's returning 33MB for block size from the current API :-P return (((blocks_num/1024)*block_size)/1024); } } 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? -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss