Table of ContentsConnecting To the Wildcard Bus Selecting the Wildcard Address CF Card Software Package User Guide and Glossary How To Install the CF Software Using the Driver Code with Forth Categorized List of Functions and Constants File Access and Position Modes Using the File System Functions String Parameters and the Use of THIS_PAGE Root Directory Only and File Name Restrictions Real-Time Clock on the Host Computer Enables Time/Date Marking of Files 12 Automatic Initialization and File Processing Upgrade note for former Memory Interface Board (MIB) Users How To Create and Use an AUTOEXEC.QED File Compile a Program into Flash Memory Transfer the Image File Contents into Memory Restrictions on Software Upgrades Recovering from Buggy AUTOSTART.QED Files Compact Flash Card Software Package Main Glossary Upgrade Notice for Prior Users of the Memory Interface Board |
The Compact-Flash Wildcard and
|
Data | Offset | Type | Min. | Max. |
Seconds | 0 | byte | 0 | 59 |
Minutes | 1 | byte | 0 | 59 |
Hours | 2 | byte | 0 | 23 |
Date | 3 | byte | 1 | 31 |
Month | 4 | byte | 1 | 12 |
Year | 5,6 | int | 2000 | 2099 |
C: long File_To_Memory( void* dest_addr, uint dest_page, ulong numbytes, int file_id )
4th: File_To_Memory ( dest_xaddr\d.numbytes\file_id -- d.numbtyes_read )
Reads from the specified open file to the specified destination in RAM or QED flash memory, and returns the number of bytes read as a 32-bit number. This is the fastest way to load the saved binary image of a compiled program from a CF card into memory (see the AUTOEXEC.QED example at the end of this document for an example of use). File_To_Memory reads numbytes characters starting at the current file position. If the specified destination region is not flash memory, this function simply calls File_Read to perform the data transfer. If the specified destination region is flash memory as described in the implementation details section below, then this function transfers the data into flash memory via the specified file's File_Contents RAM buffer (see the File_Contents glossary entry). The bytes are placed in memory starting at the specified dest_addr on the specified page. A standard procedure is for the calling program to test whether the returned number of bytes read equals the specified input parameter numbytes, and to infer that an error condition occurred if they are unequal. If an error occurs during the read operation, the error code is OR'd with any prior error condition, and the composite bitmapped error code can be retrieved by calling File_Error. An end of file condition can be separately tested for by calling the File_EOF function. See the glossary entries that start with "ERR_" for a complete list of error codes. Implementation details: If there was a prior call to the File_Ungetc function, the "ungot" character is moved to the destination in place of the first file character. To transfer an entire file, use the File_Size function to specify d.numbytes (but recall that C programmers can't call the File_Size function from within the parameter list of File_To_Memory; see the "Tips for C Programmers" section above). This function tests the specified dest_addr as well as the last address to be written; if either of these memory locations is in a known flash area, the flash transfer is used (note that RAM is still properly programmed by the flash transfer, but it takes longer). Otherwise, a RAM transfer is performed by File_Read. Known flash areas are on the QED Board page 7; page 0x0D; and pages 1 to 3 in the DOWNLOAD.MAP or pages 4 to 6 in the STANDARD.MAP.
Benchmark: Transfers from the ATA flash card to RAM take approximately 125 msec per Kbyte, and transfers from the ATA flash card to flash memory take approximately 420 msec per Kbyte. Transfers to flash disable interrupts for up to 25 msec per flash sector.
C: void File_To_Page ( uint page )
4th: File_To_Page ( page -- )
Looks for a file named PAGEpp.BIN, where pp is a hexadecimal representation of the specified page. If the file is found, opens it in read mode, invokes File_To_Memory to copy the file contents to the specified page, and closes the file. For example, if the specified page is 4, then PAGE04.BIN will be opened and its contents copied to page 4. See the glossary entries for File_To_Memory and Page_To_File. Before calling this function, the file system must have been initialized. The file must be a binary file containing exactly 32 kbytes; otherwise an error will be reported and no information will be copied. This function prints a string to the serial output reporting the result.
Output messages are:
File_To_Page completed copy of PAGEpp.BIN
File_To_Page couldn't open PAGEpp.BIN
File_To_Page error: wrong file size at PAGEpp.BIN
File_To_Page could not complete copy of PAGEpp.BIN
This routine is always callable by Process_File, even if the CF Card Forth headers have not been loaded onto the Mosaic controller.
Home|Site Map|Products|Manuals|Resources|Order|About Us
Copyright (c) 2006 Mosaic Industries, Inc.
Your source for single board computers, embedded controllers, and operator interfaces for instruments and automation