CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

What is "flush buffer" in mmc used for ?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
husam



Joined: 17 Feb 2010
Posts: 10
Location: jordan

View user's profile Send private message

What is "flush buffer" in mmc used for ?
PostPosted: Sun Feb 21, 2010 12:14 pm     Reply with quote

Hi,
I'm new to MMC & SD, and I hope for some help !!!

1- What is "flush buffer" in mmc used for ?

2- I use mmcsd.c library from CCS PCWHD compiler and I saw a
function called:
Code:

mmcsd_write_block(a, s, p);

I hope for someone to tell me how to use it, and the difference between
it and another function called:
Code:

mmcsd_write_byte(a, p);

Thanks
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sun Feb 21, 2010 8:53 pm     Reply with quote

I have not used the driver you are using but I can guess these.

When you write to an SD/MMC card you write in 512 byte blocks. What actually happens when you write to the file system the write takes place into the file buffer, not the physical media. When the file buffer is full, or you attempt to write to a different sector, or you close the file then the driver writes (flushes) the buffer to the media. However, if you have an application that only writes a few bytes at a time (say a GPS at 10 second recording intervals) you don't want to lose data that is in the buffer when you turn off the GPS without closing the file. Periodically "flushing" the file system will write the current buffer to the media.

A write_byte() function would write a single byte to the file buffer.
A write_block() function would write a sequence (block) of bytes to the file buffer.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group