none
How to access SD card in an application RRS feed

  • Question

  • Hello,

    I want to write an application to write the SD card in WEC7. 

    How to access SD card? 

    What it will get detected as ? It shows folder name as SDMemory.

    I want to write into the raw space of the SD card in WEC7.

    Any thoughts?

    Regards,

    Seetharam


    Seeth

    Saturday, April 27, 2013 6:02 AM

Answers

  • Thank you for your reply.

    I see DSK1: in storage manager no, I can use this name directly and I can give the sector name in seek funtion ??

    Yeah,, I will search for that code in public.

    But then I want to know I can use that directly in CreateFile function. 

    Regards,

    Seetharam


    Seeth

    • Marked as answer by Seeth Tuesday, November 4, 2014 4:57 AM
    Saturday, April 27, 2013 8:09 AM
  • You need to do like this ...

    pflashContext->hSD=CreateFile (TEXT("\\Dsk1:"),GENERIC_READ|GENERIC_WRITE,0,NULL, \
                                OPEN_EXISTING,0,NULL);

    DeviceIoControl(pflashContext->hSD, IOCTL_DISK_WEITE,NULL, 0, (UCHAR *)&SDInterface, \
                                    (DWORD)sizeof(SDInterface), &dwRetbytes, NULL))

    To write from application use the existing stream interface for the disk I/O driver.

    See the disk test API and functions for example ... at

    ~\WINCE700\private\test\BaseOS\Drivers\Storage\

    --- Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    • Marked as answer by Seeth Tuesday, November 4, 2014 4:57 AM
    Monday, April 29, 2013 11:37 AM

All replies

  • If you want to write files into the sdcard, use CreateFile open the sd volume path, such as \\SDMemory\\xxxx;

    If you want to access raw sectors, you need to know the SD card disk driver name, such as DSK2:, call CreateFile() on disk driver name and call DevcieIoControl CODE:  IOCTL_DISK_READ and IOCTL_DISK_WRITE. You can search source under your wince public directory, there should be many files using this code.

    Saturday, April 27, 2013 7:00 AM
  • Thank you for your reply.

    I see DSK1: in storage manager no, I can use this name directly and I can give the sector name in seek funtion ??

    Yeah,, I will search for that code in public.

    But then I want to know I can use that directly in CreateFile function. 

    Regards,

    Seetharam


    Seeth

    • Marked as answer by Seeth Tuesday, November 4, 2014 4:57 AM
    Saturday, April 27, 2013 8:09 AM
  • You need to do like this ...

    pflashContext->hSD=CreateFile (TEXT("\\Dsk1:"),GENERIC_READ|GENERIC_WRITE,0,NULL, \
                                OPEN_EXISTING,0,NULL);

    DeviceIoControl(pflashContext->hSD, IOCTL_DISK_WEITE,NULL, 0, (UCHAR *)&SDInterface, \
                                    (DWORD)sizeof(SDInterface), &dwRetbytes, NULL))

    To write from application use the existing stream interface for the disk I/O driver.

    See the disk test API and functions for example ... at

    ~\WINCE700\private\test\BaseOS\Drivers\Storage\

    --- Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    • Marked as answer by Seeth Tuesday, November 4, 2014 4:57 AM
    Monday, April 29, 2013 11:37 AM
  • To understand a bit better, on desktop Windows would you write bytes directly to different sectors of the hard disk and somehow maintain your own allocation map and sector chain to find the pieces of data later? Or would you open a file and let Windows organize the bytes as normal?

    The same model exists on Windows CE. I suppose that you could write bytes directly to DSK1: but why would you want to do that?

    Paul T.

    Monday, April 29, 2013 4:04 PM