le_flash_interface.h
Go to the documentation of this file.
23 * - in an Unsorted Block Images (UBI) volume, using a MTD and updating UBI information and headers.46 * - le_flash_AddBadImageDetectionHandler() API adds a handler to notify when an image becomes bad51 * access to the flash. When all flash modifications are done, le_flash_ReleaseAccess() is required.54 * Depending on how the read/write operations have to be done, the correct open API has to be used:64 * A sample code showing how to open UBI, retrieve UBI information and close UBI can be seen below:72 * When a block needs to be erased; the application has to call le_flash_EraseBlock() API to perform76 * To read data, le_flash_Read() has to be called. The data are read at the specified block index.77 * Note that this index is not the index of the block into the partition, but a logical block index:89 * A sample code showing how to read a whole UBI volume inside an UBI partition can be seen below:106 * A sample code showing how to write a whole UBI volume inside an UBI partition can be seen below:122 * A sample code showing how to open, retrieve information and close a partition can be seen below:133 * A sample code showing how to open UBI, retrieve UBI information and close UBI can be seen below:138 * an error LE_DUPLICATE will be reported. The overwrite of the partition can be forced by setting146 * be reported. The flag isForcedCreate permits to re-create the volume, but the previous content164 * This API is synchronous: it is blocking until the write is over. After the end of the write, the187 //--------------------------------------------------------------------------------------------------191 //--------------------------------------------------------------------------------------------------194 //--------------------------------------------------------------------------------------------------197 * Connect the current client thread to the service providing this API. Block until the service is200 * For each thread that wants to use this API, either ConnectService or TryConnectService must be201 * called before any other functions in this API. Normally, ConnectService is automatically called206 //--------------------------------------------------------------------------------------------------212 //--------------------------------------------------------------------------------------------------215 * Try to connect the current client thread to the service providing this API. Return with an error218 * For each thread that wants to use this API, either ConnectService or TryConnectService must be219 * called before any other functions in this API. Normally, ConnectService is automatically called228 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).231 //--------------------------------------------------------------------------------------------------237 //--------------------------------------------------------------------------------------------------241 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants244 //--------------------------------------------------------------------------------------------------251 //--------------------------------------------------------------------------------------------------257 * longer a connection to the service, and the functions in this API can't be used. For details, see262 //--------------------------------------------------------------------------------------------------269 //--------------------------------------------------------------------------------------------------273 //--------------------------------------------------------------------------------------------------276 //--------------------------------------------------------------------------------------------------280 //--------------------------------------------------------------------------------------------------283 //--------------------------------------------------------------------------------------------------287 //--------------------------------------------------------------------------------------------------290 //--------------------------------------------------------------------------------------------------296 //--------------------------------------------------------------------------------------------------299 //--------------------------------------------------------------------------------------------------303 //--------------------------------------------------------------------------------------------------306 //--------------------------------------------------------------------------------------------------313 //--------------------------------------------------------------------------------------------------322 //--------------------------------------------------------------------------------------------------326 //--------------------------------------------------------------------------------------------------333 //--------------------------------------------------------------------------------------------------344 //--------------------------------------------------------------------------------------------------350 //--------------------------------------------------------------------------------------------------359 //--------------------------------------------------------------------------------------------------365 //--------------------------------------------------------------------------------------------------377 //--------------------------------------------------------------------------------------------------388 //--------------------------------------------------------------------------------------------------400 //--------------------------------------------------------------------------------------------------411 //--------------------------------------------------------------------------------------------------413 * Open the UBI volume of an UBI image to be used for the read and write operations. When open for414 * writing and a volumeSize is given, the UBI volume will be adjusted to this size by freeing the425 //--------------------------------------------------------------------------------------------------436 //--------------------------------------------------------------------------------------------------446 //--------------------------------------------------------------------------------------------------453 //--------------------------------------------------------------------------------------------------461 //--------------------------------------------------------------------------------------------------468 //--------------------------------------------------------------------------------------------------477 //--------------------------------------------------------------------------------------------------486 //--------------------------------------------------------------------------------------------------499 //--------------------------------------------------------------------------------------------------512 //--------------------------------------------------------------------------------------------------524 * If the write addresses an UBI volume and more PEBs are required to write the new data, new PEBs535 //--------------------------------------------------------------------------------------------------548 //--------------------------------------------------------------------------------------------------558 //--------------------------------------------------------------------------------------------------573 //--------------------------------------------------------------------------------------------------583 //--------------------------------------------------------------------------------------------------596 //--------------------------------------------------------------------------------------------------599 * If the partition is already an UBI, an error is raised except if the flag isForcedCreate is set613 //--------------------------------------------------------------------------------------------------625 //--------------------------------------------------------------------------------------------------629 * isForcedCreate is set to true. In this case, the whole UBI volume is recreated and the previous632 * Note that the UBI partition should be opened in write-only or read-write mode, else an error is635 * A static volume cannot be extended when mounted, so it is generally used for SQUASHFS or others649 //--------------------------------------------------------------------------------------------------667 //--------------------------------------------------------------------------------------------------671 * Note that the UBI partition should be opened in write-only or read-write mode, else an error is682 //--------------------------------------------------------------------------------------------------le_flash_BadImageDetectionHandlerRef_t le_flash_AddBadImageDetectionHandler(le_flash_BadImageDetectionHandlerFunc_t handlerPtr, void *contextPtr)le_result_t le_flash_EraseBlock(le_flash_PartitionRef_t partitionRef, uint32_t blockIndex)le_result_t le_flash_GetBlockInformation(le_flash_PartitionRef_t partitionRef, uint32_t *badBlocksNumberPtr, uint32_t *eraseBlocksNumberPtr, uint32_t *eraseBlockSizePtr, uint32_t *pageSizePtr)le_result_t le_flash_RequestAccess(void)le_result_t le_flash_CloseUbiVolume(le_flash_PartitionRef_t partitionRef)le_result_t le_flash_Write(le_flash_PartitionRef_t partitionRef, uint32_t blockIndex, const uint8_t *writeDataPtr, size_t writeDataSize)le_result_t le_flash_OpenUbiVolume(le_flash_PartitionRef_t partitionRef, const char *LE_NONNULL volumeName, int32_t volumeSize)le_result_t le_flash_CreateUbiVolume(le_flash_PartitionRef_t partitionRef, bool isForcedCreate, uint32_t volumeID, le_flash_UbiVolumeType_t volumeType, const char *LE_NONNULL volumeName, int32_t volumeSize)void(* le_flash_DisconnectHandler_t)(void *)Definition: le_flash_interface.h:192le_result_t le_flash_ReleaseAccess(void)le_result_t le_flash_GetUbiVolumeInformation(le_flash_PartitionRef_t partitionRef, uint32_t *freeBlockNumberPtr, uint32_t *allocatedBlockNumberPtr, uint32_t *sizeInBytesPtr)le_result_t le_flash_Read(le_flash_PartitionRef_t partitionRef, uint32_t blockIndex, uint8_t *readDataPtr, size_t *readDataSizePtr)void le_flash_DisconnectService(void)le_result_t le_flash_OpenMtd(const char *LE_NONNULL partitionName, le_flash_OpenMode_t mode, le_flash_PartitionRef_t *partitionRefPtr)LE_FULL_API void le_flash_SetServerDisconnectHandler(le_flash_DisconnectHandler_t disconnectHandler, void *contextPtr)le_result_t le_flash_CreateUbi(const char *LE_NONNULL partitionName, bool isForcedCreate, le_flash_PartitionRef_t *partitionRefPtr)void le_flash_ConnectService(void)void le_flash_RemoveBadImageDetectionHandler(le_flash_BadImageDetectionHandlerRef_t handlerRef)le_result_t le_flash_Close(le_flash_PartitionRef_t partitionRef)le_result_t le_flash_OpenUbi(const char *LE_NONNULL partitionName, le_flash_OpenMode_t mode, le_flash_PartitionRef_t *partitionRefPtr)le_result_t le_flash_TryConnectService(void)le_result_t le_flash_DeleteUbiVolume(le_flash_PartitionRef_t partitionRef, const char *LE_NONNULL volumeName)