Creation of a new flash in the specified device.
Syntax |
flashDiskCreate(string flash, uint flags, uint @size, uint @nackx, uint gid=0): bool |
---|---|
flash |
Name of the flash to be created |
flags |
Creation settings |
size |
Reference to required partition size [kb] |
nackx |
Reference to extended NACK code, if any, in case of error |
gid |
Identifier of any graphical percentage element to be used, which can be created with the addGauge() function |
Result |
Returns logical outcome of operation |
Valid settings (flags) for the function are as follows:
Flag |
Description |
---|---|
flashDiskCreate_QueryOnly |
Queries only the actual size that would be applied to the flash, based on the request |
flashDiskCreate_Overwrite. |
Allows overwriting of any existing flash |
Annotation:
•Creation is supported only for compact type flash.
•The flash name also contains the as of the reference device: for example /DISKA1, indicates device A (primary) and flash 1. However, refer to the documentation of the specific device involved for more information.
•Specifying the flashDiskCreate_Overwrite flag gives the option of recreating any existing flash: in this case, care must be taken as all flash contents will be irretrievably lost.
•If successful, the reference to the requested size (size) will instead contain the size actually applied (or applicable if specified flag flashDiskCreate_QueryOnly).
•The extended NACK code contains the actual NACK code in loWord(nackx) and any additional information in hiWord(nackx).
Example of use
To create the flash as the first partition of the main device (DISKA1):
uint nackx uint size uint gid = addGauge() size = 1024 ; 1Mb if(flashDiskCreate("/diska1", flashDiskCreate_Overwrite, @size, @nackx, gid)) ; TODO: flash creation ok else printNack (nackx) ; TODO: error handling end |