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, the186 //--------------------------------------------------------------------------------------------------190 //--------------------------------------------------------------------------------------------------193 //--------------------------------------------------------------------------------------------------196 * Connect the current client thread to the service providing this API. Block until the service is199 * For each thread that wants to use this API, either ConnectService or TryConnectService must be200 * called before any other functions in this API. Normally, ConnectService is automatically called205 //--------------------------------------------------------------------------------------------------211 //--------------------------------------------------------------------------------------------------214 * Try to connect the current client thread to the service providing this API. Return with an error217 * For each thread that wants to use this API, either ConnectService or TryConnectService must be218 * called before any other functions in this API. Normally, ConnectService is automatically called227 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).230 //--------------------------------------------------------------------------------------------------236 //--------------------------------------------------------------------------------------------------240 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants243 //--------------------------------------------------------------------------------------------------250 //--------------------------------------------------------------------------------------------------256 * longer a connection to the service, and the functions in this API can't be used. For details, see261 //--------------------------------------------------------------------------------------------------268 //--------------------------------------------------------------------------------------------------273 //--------------------------------------------------------------------------------------------------276 //--------------------------------------------------------------------------------------------------281 //--------------------------------------------------------------------------------------------------284 //--------------------------------------------------------------------------------------------------288 //--------------------------------------------------------------------------------------------------291 //--------------------------------------------------------------------------------------------------296 //--------------------------------------------------------------------------------------------------299 //--------------------------------------------------------------------------------------------------303 //--------------------------------------------------------------------------------------------------306 //--------------------------------------------------------------------------------------------------311 //--------------------------------------------------------------------------------------------------314 //--------------------------------------------------------------------------------------------------318 //--------------------------------------------------------------------------------------------------321 //--------------------------------------------------------------------------------------------------325 //--------------------------------------------------------------------------------------------------328 //--------------------------------------------------------------------------------------------------332 //--------------------------------------------------------------------------------------------------335 //--------------------------------------------------------------------------------------------------339 //--------------------------------------------------------------------------------------------------342 //--------------------------------------------------------------------------------------------------346 //--------------------------------------------------------------------------------------------------349 //--------------------------------------------------------------------------------------------------353 //--------------------------------------------------------------------------------------------------366 //--------------------------------------------------------------------------------------------------370 //--------------------------------------------------------------------------------------------------381 //--------------------------------------------------------------------------------------------------385 //--------------------------------------------------------------------------------------------------389 //--------------------------------------------------------------------------------------------------393 //--------------------------------------------------------------------------------------------------397 //--------------------------------------------------------------------------------------------------403 //--------------------------------------------------------------------------------------------------405 (412 //--------------------------------------------------------------------------------------------------419 //--------------------------------------------------------------------------------------------------428 //--------------------------------------------------------------------------------------------------432 //--------------------------------------------------------------------------------------------------439 //--------------------------------------------------------------------------------------------------450 //--------------------------------------------------------------------------------------------------456 //--------------------------------------------------------------------------------------------------465 //--------------------------------------------------------------------------------------------------471 //--------------------------------------------------------------------------------------------------483 //--------------------------------------------------------------------------------------------------494 //--------------------------------------------------------------------------------------------------506 //--------------------------------------------------------------------------------------------------517 //--------------------------------------------------------------------------------------------------519 * Open the UBI volume of an UBI image to be used for the read and write operations. When open for520 * writing and a volumeSize is given, the UBI volume will be adjusted to this size by freeing the531 //--------------------------------------------------------------------------------------------------542 //--------------------------------------------------------------------------------------------------552 //--------------------------------------------------------------------------------------------------559 //--------------------------------------------------------------------------------------------------567 //--------------------------------------------------------------------------------------------------574 //--------------------------------------------------------------------------------------------------583 //--------------------------------------------------------------------------------------------------592 //--------------------------------------------------------------------------------------------------605 //--------------------------------------------------------------------------------------------------618 //--------------------------------------------------------------------------------------------------630 * If the write addresses an UBI volume and more PEBs are required to write the new data, new PEBs641 //--------------------------------------------------------------------------------------------------654 //--------------------------------------------------------------------------------------------------664 //--------------------------------------------------------------------------------------------------679 //--------------------------------------------------------------------------------------------------689 //--------------------------------------------------------------------------------------------------702 //--------------------------------------------------------------------------------------------------705 * If the partition is already an UBI, an error is raised except if the flag isForcedCreate is set719 //--------------------------------------------------------------------------------------------------731 //--------------------------------------------------------------------------------------------------735 * isForcedCreate is set to true. In this case, the whole UBI volume is recreated and the previous738 * Note that the UBI partition should be opened in write-only or read-write mode, else an error is741 * A static volume cannot be extended when mounted, so it is generally used for SQUASHFS or others755 //--------------------------------------------------------------------------------------------------773 //--------------------------------------------------------------------------------------------------777 * Note that the UBI partition should be opened in write-only or read-write mode, else an error is788 //--------------------------------------------------------------------------------------------------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)void(* le_flash_BadImageDetectionHandlerFunc_t)(const char *LE_NONNULL imageName, void *contextPtr)Definition: le_flash_interface.h:405le_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:191le_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)struct le_flash_BadImageDetectionHandler * le_flash_BadImageDetectionHandlerRef_tDefinition: le_flash_interface.h:394le_result_t le_flash_OpenMtd(const char *LE_NONNULL partitionName, le_flash_OpenMode_t mode, le_flash_PartitionRef_t *partitionRefPtr)struct le_flash_Partition * le_flash_PartitionRef_tDefinition: le_flash_interface.h:386void 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)