{"id":116,"date":"2009-01-29T20:23:37","date_gmt":"2009-01-30T03:23:37","guid":{"rendered":"http:\/\/imagecraft.wordpress.com\/?p=116"},"modified":"2009-01-29T20:23:37","modified_gmt":"2009-01-30T03:23:37","slug":"filesys-and-sd-modules-plus-emos-update","status":"publish","type":"post","link":"https:\/\/imagecraft.com\/?p=116","title":{"rendered":"FileSys and SD modules, plus eMOS update"},"content":{"rendered":"<p>First, a quick update on eMOS: we have modified the eMOS_MsgReceive function to include a timeout value, so that the call may timeout if no message is received within the specified time period. A couple minor functions are also added. See the <a href=\"http:\/\/www.imagecraft.com\/pub\/emos_avr.pdf\" target=\"_blank\" rel=\"noopener\">doc <\/a>for details.<\/p>\n<p>\/\/ EDIT: yes, the goal is to support both FAT16 and FAT32. Long File Name under FAT32 may require end user to pay Microsoft a licensing fee of $0.25 per copy used, or we may support a different LFN implemenation<\/p>\n<p>We are now looking into our first plug-in module for eMOS, which is a file system and SD driver. We will probably also include a standalone version that does not require eMOS. The eMOS version will of course fully support multitasking.<\/p>\n<p>In terms of API, the obvious choice for the FS is in fact the stdio.h C API, in summary:<\/p>\n<p>(more under the &#8230;more&#8230;)<\/p>\n<p><!--more--><\/p>\n<p>File IO functions:<\/p>\n<ul>\n<li>fprintf &#8211; formatted output<\/li>\n<li>fputs &#8211; outputs a string<\/li>\n<li>fwrite &#8211; writes a block of data<\/li>\n<li>fputc -writes a single character<\/li>\n<li>fscanf &#8211; formatted input<\/li>\n<li>fgets &#8211; reads a string<\/li>\n<li>fread &#8211; reads a block of data<\/li>\n<li>fgets &#8211; reads a single character<\/li>\n<li>ungetc &#8211; &#8220;unread&#8221; the last read character<\/li>\n<\/ul>\n<p>File functions:<\/p>\n<ul>\n<li>fopen &#8211; opens a file by name and mode<\/li>\n<li>fclose &#8211; closes a file<\/li>\n<li>freopen &#8211; closes an open file and associates the FILE stream with another file<\/li>\n<li>rename &#8211; renames a file by name<\/li>\n<li>remove &#8211; removes a file by name<\/li>\n<\/ul>\n<p>Auxiliary functions:<\/p>\n<ul>\n<li>ftell &#8211; returns IO position<\/li>\n<li>fsetpos &#8211; sets IO position<\/li>\n<li>fseek &#8211; sets IO position<\/li>\n<li>rewind &#8211; rewinds IO position to beginning of file<\/li>\n<li>setbuf, setvbuf &#8211; allocates a buffer for IO operations<\/li>\n<li>tmpnam &#8211; returns a unique temporary file name<\/li>\n<li>tmpfile &#8211; creates a temporary files<\/li>\n<\/ul>\n<p>Standard C does not define directory functions, but of course they are needed:<\/p>\n<ul>\n<li>chdir &#8211; changes current directory<\/li>\n<li>getcwd, getcurdir &#8211; returns the current directory<\/li>\n<li>mkdir &#8211; creates a directory<\/li>\n<li>rmdir &#8211; removes a directory<\/li>\n<li>findfirst &#8211; returns the first file that matches a pattern<\/li>\n<li>findnext &#8211; returns the next file that matches the previous pattern<\/li>\n<\/ul>\n<p>Low level file sys support:<\/p>\n<ul>\n<li>mount &#8211; mounts a file system device<\/li>\n<li>freespace &#8211; returns the amount of free bytes on the device<\/li>\n<li>devicesize &#8211; returns the storage size<\/li>\n<\/ul>\n<p>The file system will be optimized for flash devices, in particular, SD and Data Flash drivers are initially included. &#8220;Wear leveling&#8221; will be optimized to maximize the lifetime of the unit.<\/p>\n<p><strong>Bootloader Update<\/strong><\/p>\n<p>Another design goal is to have a library usable by a bootloader to load an updated application program from a SD card. Due to the bootloader space limitation, not allAPI functions will be supported but this feature would allow you to perform field upgrades of your systems in a relatively pain free way.<\/p>\n<p>*****<\/p>\n<p>As we are still only in the design stage, I welcome your comments and suggestions, either as a reply to this post or to you can email me directly richard @imagecraft.com<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First, a quick update on eMOS: we have modified the eMOS_MsgReceive function to include a timeout value, so that the call may timeout if no message is received within the specified time period. A couple minor functions are also added. See the doc for details. \/\/ EDIT: yes, the goal is to support both FAT16 and FAT32. Long File Name under FAT32 may require end user to pay Microsoft a licensing fee of $0.25 per copy used, or we may support a different LFN implemenation We are now looking into our first plug-in module for eMOS, which is a file [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[8],"tags":[],"class_list":["post-116","post","type-post","status-publish","format-standard","hentry","category-new-product"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/imagecraft.com\/index.php?rest_route=\/wp\/v2\/posts\/116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imagecraft.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imagecraft.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imagecraft.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/imagecraft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=116"}],"version-history":[{"count":0,"href":"https:\/\/imagecraft.com\/index.php?rest_route=\/wp\/v2\/posts\/116\/revisions"}],"wp:attachment":[{"href":"https:\/\/imagecraft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imagecraft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imagecraft.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}