Notes
Slide Show
Outline
1
The Flash File System User API
  • By Eric Gregori
2
The Dynamic Flash File System
  • The dynamic flash file system allows the user to store data and web pages in the on-chip flash.
  • NO RESET is requires to update the data.
  • As a matter of fact, no local intervention at all is required.
  • The update occurs over ethernet, using port 80, to easily get through many firewalls.
  • The update can occur at anytime, the firmware automatically handles web page requests, while a update occurs.
3
User API
  • A simple user API is provided, to allow user applications access to any data stored in the FFS.
  • Both binary and ascii data can be stored and retrieved from the FFS.
4
emg_open() function
  • The emg_open() function is used to find data in the FFS.


  • //*****************************************************************************
  • // int emg_open( char *filename, uint32 *data_pointer, uint32 *file_size )
  • //
  • // User API to dynamic flash file system
  • //
  • // Finds the file descriptor in the FAT.
  • // Sets data_pointer to start of data.
  • // Sets file_size to size of file in bytes.
  • // returns a < 0 if error, 0 = success
  • //
  • // for an example of using emg_open(), see cat command in menulib.c
  • //
  • //
  • // Author: Eric Gregori  (847) 651 - 1971
  • //    eric.gregori@freescale.com
  • //*****************************************************************************
  • int emg_open( char *filename, uint32 *data_pointer, uint32 *file_size )


5
Example using emg_open()
  • The CAT command uses the emg_open() function to display file contents at the console promt.


  • INET> cat ppt_files/filelist.xml



  • <xml xmlns:o="urn:schemas-microsoft-com:office:office">
  •  <o:File HRef="master03.htm"/>
  •  <o:File HRef="master03.xml"/>
  •  <o:File HRef="preview.wmf"/>
  •  <o:File HRef="pres.xml"/>
  •  <o:File HRef="slide0001.htm"/>
  •  <o:File HRef="slide0002.htm"/>
  •  <o:File HRef="master03_stylesheet.css"/>
  •  <o:File HRef="script.js"/>
  •  <o:MainFile HRef="../ppt.htm"/>
  •  <o:File HRef="fullscreen.htm"/>
  •  <o:File HRef="buttons.gif"/>
  •  <o:File HRef="frame.htm"/>
  •  <o:File HRef="outline.htm"/>
  •  <o:File HRef="filelist.xml"/>
  • </xml>


  • INET>
6
Try it out
  • This PPT presentation is stored in flash.
  • Try doing a dir at the inet> prompt.
  • INET> dir


  • Static FFS


  • FILENAME                         LENGTH  POINTER
  • readme.htm                       34506    0x13E82
  • CFCORESEMBLEM.gif                12919    0x1C54E


  •                                    Total Size = 47425
  • total static files = 2


  • Dynamic FFS


  • FILENAME                         LENGTH  POINTER
  • ppt.htm                          2744     0x201F0
  • ppt_files/buttons.gif            1987     0x20CA8
  • ppt_files/filelist.xml           667      0x2146B
  • ppt_files/frame.htm              1313     0x21706
  • ppt_files/fullscreen.htm         998      0x21C27
  • ppt_files/master03.htm           1895     0x2200D
  • ppt_files/master03.xml           3834     0x22774
  • ppt_files/master03_stylesheet.css4002     0x2366E
  • ppt_files/outline.htm            10087    0x24610
  • ppt_files/pres.xml               2531     0x26D77
  • ppt_files/preview.wmf            1030     0x2775A
  • ppt_files/script.js              24214    0x27B60
  • ppt_files/slide0001.htm          3306     0x2D9F6
  • ppt_files/slide0002.htm          3262     0x2E6E0


  •                                    Total Size = 61870
  • total dynamic files = 14



  • INET>
7
Then CAT one of the files
  • Notice the FFS supports subdirectories.
  • It also supports long filenames.