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, the191 //--------------------------------------------------------------------------------------------------195 //--------------------------------------------------------------------------------------------------198 //--------------------------------------------------------------------------------------------------201 * Connect the current client thread to the service providing this API. Block until the service is204 * For each thread that wants to use this API, either ConnectService or TryConnectService must be205 * called before any other functions in this API. Normally, ConnectService is automatically called210 //--------------------------------------------------------------------------------------------------216 //--------------------------------------------------------------------------------------------------219 * Try to connect the current client thread to the service providing this API. Return with an error222 * For each thread that wants to use this API, either ConnectService or TryConnectService must be223 * called before any other functions in this API. Normally, ConnectService is automatically called232 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).235 //--------------------------------------------------------------------------------------------------241 //--------------------------------------------------------------------------------------------------245 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants248 //--------------------------------------------------------------------------------------------------255 //--------------------------------------------------------------------------------------------------261 * longer a connection to the service, and the functions in this API can't be used. For details, see266 //--------------------------------------------------------------------------------------------------273 //--------------------------------------------------------------------------------------------------277 //--------------------------------------------------------------------------------------------------280 //--------------------------------------------------------------------------------------------------284 //--------------------------------------------------------------------------------------------------287 //--------------------------------------------------------------------------------------------------291 //--------------------------------------------------------------------------------------------------294 //--------------------------------------------------------------------------------------------------300 //--------------------------------------------------------------------------------------------------303 //--------------------------------------------------------------------------------------------------307 //--------------------------------------------------------------------------------------------------310 //--------------------------------------------------------------------------------------------------317 //--------------------------------------------------------------------------------------------------326 //--------------------------------------------------------------------------------------------------330 //--------------------------------------------------------------------------------------------------337 //--------------------------------------------------------------------------------------------------348 //--------------------------------------------------------------------------------------------------354 //--------------------------------------------------------------------------------------------------363 //--------------------------------------------------------------------------------------------------369 //--------------------------------------------------------------------------------------------------381 //--------------------------------------------------------------------------------------------------392 //--------------------------------------------------------------------------------------------------404 //--------------------------------------------------------------------------------------------------415 //--------------------------------------------------------------------------------------------------417 * Open the UBI volume of an UBI image to be used for the read and write operations. When open for418 * writing and a volumeSize is given, the UBI volume will be adjusted to this size by freeing the429 //--------------------------------------------------------------------------------------------------440 //--------------------------------------------------------------------------------------------------450 //--------------------------------------------------------------------------------------------------457 //--------------------------------------------------------------------------------------------------465 //--------------------------------------------------------------------------------------------------472 //--------------------------------------------------------------------------------------------------481 //--------------------------------------------------------------------------------------------------490 //--------------------------------------------------------------------------------------------------503 //--------------------------------------------------------------------------------------------------516 //--------------------------------------------------------------------------------------------------528 * If the write addresses an UBI volume and more PEBs are required to write the new data, new PEBs539 //--------------------------------------------------------------------------------------------------552 //--------------------------------------------------------------------------------------------------562 //--------------------------------------------------------------------------------------------------577 //--------------------------------------------------------------------------------------------------587 //--------------------------------------------------------------------------------------------------600 //--------------------------------------------------------------------------------------------------603 * If the partition is already an UBI, an error is raised except if the flag isForcedCreate is set617 //--------------------------------------------------------------------------------------------------629 //--------------------------------------------------------------------------------------------------633 * isForcedCreate is set to true. In this case, the whole UBI volume is recreated and the previous636 * Note that the UBI partition should be opened in write-only or read-write mode, else an error is639 * A static volume cannot be extended when mounted, so it is generally used for SQUASHFS or others653 //--------------------------------------------------------------------------------------------------671 //--------------------------------------------------------------------------------------------------675 * Note that the UBI partition should be opened in write-only or read-write mode, else an error is686 //--------------------------------------------------------------------------------------------------void le_flash_RemoveBadImageDetectionHandler(le_flash_BadImageDetectionHandlerRef_t handlerRef)le_result_t le_flash_ReleaseAccess(void)le_result_t le_flash_Write(le_flash_PartitionRef_t partitionRef, uint32_t blockIndex, const uint8_t *writeDataPtr, size_t writeDataSize)void le_flash_ConnectService(void)struct le_flash_Partition * le_flash_PartitionRef_tDefinition: le_flash_common.h:146LE_FULL_API void le_flash_SetServerDisconnectHandler(le_flash_DisconnectHandler_t disconnectHandler, void *contextPtr)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)le_result_t le_flash_CloseUbiVolume(le_flash_PartitionRef_t partitionRef)void le_flash_DisconnectService(void)le_result_t le_flash_TryConnectService(void)le_flash_BadImageDetectionHandlerRef_t le_flash_AddBadImageDetectionHandler(le_flash_BadImageDetectionHandlerFunc_t handlerPtr, void *contextPtr)le_result_t le_flash_CreateUbi(const char *LE_NONNULL partitionName, bool isForcedCreate, le_flash_PartitionRef_t *partitionRefPtr)void(* le_flash_DisconnectHandler_t)(void *)Definition: le_flash_interface.h:196le_result_t le_flash_DeleteUbiVolume(le_flash_PartitionRef_t partitionRef, const char *LE_NONNULL volumeName)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_OpenMtd(const char *LE_NONNULL partitionName, le_flash_OpenMode_t mode, le_flash_PartitionRef_t *partitionRefPtr)le_result_t le_flash_Close(le_flash_PartitionRef_t partitionRef)le_result_t le_flash_Read(le_flash_PartitionRef_t partitionRef, uint32_t blockIndex, uint8_t *readDataPtr, size_t *readDataSizePtr)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_EraseBlock(le_flash_PartitionRef_t partitionRef, uint32_t blockIndex)le_result_t le_flash_OpenUbiVolume(le_flash_PartitionRef_t partitionRef, const char *LE_NONNULL volumeName, int32_t volumeSize)le_result_t le_flash_GetUbiVolumeInformation(le_flash_PartitionRef_t partitionRef, uint32_t *freeBlockNumberPtr, uint32_t *allocatedBlockNumberPtr, uint32_t *sizeInBytesPtr)struct le_flash_BadImageDetectionHandler * le_flash_BadImageDetectionHandlerRef_tDefinition: le_flash_common.h:154void(* le_flash_BadImageDetectionHandlerFunc_t)(const char *LE_NONNULL imageName, void *contextPtr)Definition: le_flash_common.h:165le_result_t le_flash_RequestAccess(void)