Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: MMC/SD support on LPC2000

2006-01-17 by David Hawkins

> I have looked at the filedisk program your mentioned, but I don't 
> see (or more correctly, understand :-) how I can use that for 
> accessing the individual sectors on the SD card ?
> I'm also more after some "code snippets" that will allow me access 
> to the SD cards sectors from within a C++ or C# application, 
> basically what I would need, is just the "PC equivivalent" of the 
> mmc_read_block() and mmc_write_block() in the Philips apps example 
> code, that way my "PC log file displayer" application can just look 
> at the SD card, and show the circular data (a large logfile) from 
> the card...

I would just try it and see. Install Cygwin, and then install your
USB card reader with SD card installed. Try and figure out if
the /dev/sdX nodes are created. Sorry, I'm not sure what the
Cygwin command might be ...

To read binary data:

   int fd, len;
   char buf[10];

   fd = open("/dev/sda1", O_RDONLY);
   if (fd < 0) {
     printf("open failed\n");
     return -1;
   }
   len = read(fd, buf, 10);
   if (len < 0) {
     printf("read failed\n");
     close(fd);
     return -1;
   }

   ... mess with your data ...

Cheers
Dave

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.