We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi everyone, I've used mass storage code from sample codes of KEIL on AT91SAM7x256. And it works correctly; Now I want to change the Memory size show in the My computer (it always show 6 kB!). I'v changed
MSC_MemorySize
but It still shows 6 KB! can anyone help me? thanks for your help!
After that I want to use another type of memory for example SD card instead of SRAM for memory use in this sample. This very important to me. I am so grateful for your help.
Sometimes, it doesn't hurt to try Google. support.microsoft.com/.../140418 averstak.tripod.com/.../bootsec.htm www.ntfs.com/fat-partition-sector.htm www.dewassoc.com/.../boot_sector.htm ...
Google is full with references.
Dear Per, You are right. But I have no idea about the numbers in DiskImg.c so I don't know what to search. And thank you so much.
I have a another question. How I can change the properties of the file readme.txt that shows in the computer inside the flash memory? I mean that the file would be for example read only and the users in the computer could not change that?
A file is read-only if the directory entry has the read-only flag, or if the file system is mounted read-only.
How to change the read-only flag for a directory entry? Same suggestion as in my previous post. Google can find all information about the structures of a FAT file system. The boot record - which I have already given you multiple references to, allows you to figure out the location of the root directory. And that is where you find the directory entry for your "readme.txt" file, and so can find the attributes flag field.
A directory in a FAT file system is just a file but with an attribute flag saying it's a directory. So the documentation available about the FAT file system allows anyone interested to also figure out how to locate directory entries of files in subdirectories. And how to locate the actual file data for files.
There are even a number of binary editor programs that are able to view information as important structures of FAT file systems - originally intended for people trying to recover data from broken diskettes or hard disks.
But in the end, you'll get better progress if you spend time trying to search for information. Each attempt you learn how to make better and better searches.
To make media content Write protect you need to return WP bit set to one in ModeSense response.
In mscuser.c module change ModeSense6/ModeSense10 functions:
void MSC_ModeSense6 (void) { if (!DataInFormat()) return; BulkBuf[ 0] = 0x03; BulkBuf[ 1] = 0x00; BulkBuf[ 2] = 0x80; <---- was 0x00 BulkBuf[ 3] = 0x00; ... } void MSC_ModeSense10 (void) { if (!DataInFormat()) return; BulkBuf[ 0] = 0x00; BulkBuf[ 1] = 0x06; BulkBuf[ 2] = 0x00; BulkBuf[ 3] = 0x80; <---- was 0x00 BulkBuf[ 4] = 0x00; BulkBuf[ 5] = 0x00; ... }
To retarget media from memory to SD Card you need to retarget read and writes from memory to SD Card. So you need to change functions MSC_MemoryRead, MSC_MemoryWrite and MSC_MemoryVerify functions in mscuser.c file to use SD Card write/read instead of memory write/read.
Dear Friends, i really appreciate your concern and help. I am going to do what yo said and read what you referenced.
Note that by making the media write-protected, all files will be write-protected.
This is different from adjusting the directory entry for readme.txt and just make that file read-only.
Dear Per, I think I noticed that they are different. I'm so thankful for the support.
Just note that you can take the DiskImage hex data and place in a little source file that you compile and that writes the data into a binary file on the PC.
Then open that binary file with a good hex editor that supports FAT data structures. Then you can edit the data and save.
Then use a program to convert the binary file to a C hex dump again.
Thanks Tsuneo for excellent explanation od DiskImage.
I have related question, I connected my mcb2300 board with lpc2378 controller to my PC, using ARM\Boards\Keil\MCB2300\RL\USB\Device\Memory example, and it works fine, I changed name of volume, txt file in DiskImage, but can I write some txt file to controller memory using windows, like to regular USB flash drive ?