|
.Format Method |
Top Previous Next |
Function: |
Formats the flash memory to create a flash disk. |
Syntax: |
fd.format(totalsize as word, numstoredfiles as byte) as pl_fd_status_codes |
Returns: |
One of the following pl_fd_status_codes, also affects fd.laststatus: 0- PL_FD_STATUS_OK: Completed successfully. 1- PL_FD_STATUS_FAIL : Physical flash memory failure (fatal). 4- PL_FD_STATUS_INV_PARAM: Invalid argument have been provided for the invoked method. |
See Also: |
Part |
Description |
totalsize |
Desired number of sectors occupied by the disk in flash memory. Cannot exceed available space (fd.availableflashspace) and may be slightly corrected downwards for internal housekeeping reasons. Actual total size can be checked through the fd.totalsize. |
maxstoredfiles |
Desired maximum number of files that the disk will allow to create. Actual maximum number of files will be adjusted automatically to be a multiple of four and not exceed 64 (for example, specifying 6 will result in the actual value of 8). If you specify 0 you will get 4 files. |
Details
Actual usable capacity (fd.capacity) of the formatted disk will be less than its total size. This is because the disk also includes "housekeeping" sectors (see fd.numservicesectors). Reducing the maxstoredfiles parameter decreases the number of required housekeeping sectors.
The 4- PL_FD_INV_PARAM status code will be returned if the totalsize specified exceeded available space (fd.availableflashspace) or was too small even for the "housekeeping" data of the disk to fit in.
After formatting the disk will be in the dismounted state and will need to be mounted (see fd.mount) before any disk-related activity can be successfully performed.