ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

sections
part 1
part 2
part 3
part 4
part 5
part 6
part 7
part 8
part 9


3 - Input and Output

3.01 - Can I do I/O as in 'normal' C/C++?
3.02 - Mapping seems insecure - is it?
3.03 - What is sebbing?
3.04 - What is the SEB format?
3.05 - How do I program it?
3.06 - How do I handle audio?
3.07 - How do I scan for files in the system?
3.08 - What about directories/subdirectories?
3.09 - Isn't that cluttered?
3.10 - How do I work with the MMC?



3.01 - Can I do I/O as in 'normal' C/C++?
Functions like fopen() and open() allow I/O for files on disk. With the ebm, files are in the same memory as the program - for this reason, you only need to map the file in, and then access it with a pointer, much like an array. The benefits are speed (nothing gets copied), and speed (adjusting a pointer to data is much faster than seek()). Check ebo_mapin() for more details.

3.02 - Mapping seems insecure - is it?
Security abounds on the Franklin platform. If a file is restricted, you won't be able to map to it. Likewise, mapping for reading only is more secure than for writing. The worst case is two programs running at the same time, reading and writing to a mapped file at the same time. In that case, the problem can still be avoided by creating your own system to arbitrate between programs (such as with a mutex)

3.03 - What is sebbing?
It's a word I just made up (at least, I think I did). Here's my equally made-up definition: To take an ordinary file, and add the SEB information necessary to make it available for use on a Franklin eBookMan.

3.04 - What is the SEB format?
Although it can be very detailed (like an archive or zip packing), for individual files, it is simply a 4K block stuck on the front of an ordinary file, providing strings of information identifying the accompanying file. It's needed to make the file compatible with the ebm File Manager.

3.05 - How do I program it?
SEB I/O routines are available on the Franklin website. As well, check this site for an upcoming tutorial.

3.06 - How do I handle audio?
If you are thinking of including audio in your program, two types of audio output will eventually be possible: waveform and piezo (buzzer). The piezo routines can be used now, but the waveform API is still in development. A third audio option is jingles, which are actually piezo calls strung together.

3.07 - How do I scan for files in the system?
Use the ebo_first_object() and ebo_next_object() functions to walk through the file list.

3.08 - What about directories/subdirectories?
The ebm has a flat file structure - everything is in one directory.

3.09 - Isn't that cluttered?
It isn't, for several reasons: 1) a maximum of 16 meg in the system can hold only so many files, 2) the time to scan the file listing is small, since it's in memory already (no disk), 3) you present to the user only the files you consider necessary for your application (such as all the TXT files), further reducing the files seen, and 4) since the ebm is generally a single-user device, organizing files around a personal directory structure isn't an issue.

3.10 - How do I work with the MMC?
Refer to the example source 'ebm_object.h' on how to use the following functions for access to the MMC:
  • ebo_first_xobject() - find first object on MMC
  • ebo_next_xobject() - find next object on MMC
  • ebo_locate_xobject() - look up MMC object name




Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice