Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FXAS21002 FXOS8700Q
pal_plat_update.cpp
00001 /******************************************************************************* 00002 * Copyright 2016, 2017 ARM Ltd. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 *******************************************************************************/ 00016 00017 #include <mbed.h> 00018 #include <pal.h> 00019 #include <pal_plat_update.h> 00020 00021 #define TRACE_GROUP "PAL" 00022 00023 #ifndef PAL_UPDATE_ACTIVE_METADATA_HEADER_OFFSET 00024 #ifdef MBED_CONF_MBED_CLIENT_PAL_UPDATE_ACTIVE_METADATA_HEADER_OFFSET 00025 #define PAL_UPDATE_ACTIVE_METADATA_HEADER_OFFSET MBED_CONF_MBED_CLIENT_PAL_UPDATE_ACTIVE_METADATA_HEADER_OFFSET 00026 #else // MBED_CONF_MBED_CLIENT_PAL_UPDATE_ACTIVE_METADATA_HEADER_OFFSET 00027 #define PAL_UPDATE_ACTIVE_METADATA_HEADER_OFFSET 0 00028 #endif // MBED_CONF_MBED_CLIENT_PAL_UPDATE_ACTIVE_METADATA_HEADER_OFFSET 00029 #endif // PAL_UPDATE_ACTIVE_METADATA_HEADER_OFFSET 00030 00031 palStatus_t pal_plat_imageInitAPI(palImageSignalEvent_t CBfunction) 00032 { 00033 return PAL_ERR_NOT_IMPLEMENTED; 00034 } 00035 00036 palStatus_t pal_plat_imageDeInit(void) 00037 { 00038 return PAL_ERR_NOT_IMPLEMENTED; 00039 } 00040 00041 palStatus_t pal_plat_imageGetMaxNumberOfImages(uint8_t *imageNumber) 00042 { 00043 return PAL_ERR_NOT_IMPLEMENTED; 00044 } 00045 00046 palStatus_t pal_plat_imageSetVersion(palImageId_t imageId, const palConstBuffer_t* version) 00047 { 00048 return PAL_ERR_NOT_IMPLEMENTED; 00049 } 00050 00051 palStatus_t pal_plat_imageGetDirectMemAccess(palImageId_t imageId, void** imagePtr, size_t *imageSizeInBytes) 00052 { 00053 return PAL_ERR_NOT_IMPLEMENTED; 00054 } 00055 00056 palStatus_t pal_plat_imageActivate(palImageId_t imageId) 00057 { 00058 return PAL_ERR_NOT_IMPLEMENTED; 00059 } 00060 00061 palStatus_t pal_plat_imageGetActiveHash(palBuffer_t *hash) 00062 { 00063 palStatus_t ret = PAL_ERR_UPDATE_ERROR ; 00064 uint32_t read_offset = PAL_UPDATE_ACTIVE_METADATA_HEADER_OFFSET + 00065 offsetof(FirmwareHeader_t, firmwareSHA256); 00066 00067 FlashIAP flash; 00068 int rc = -1; 00069 00070 rc = flash.init(); 00071 if (rc != 0) 00072 { 00073 PAL_LOG_ERR("flash init failed\r\n"); 00074 goto exit; 00075 } 00076 00077 00078 rc = flash.read(hash->buffer, read_offset, SIZEOF_SHA256); 00079 if (rc != 0) 00080 { 00081 PAL_LOG_ERR("flash read failed\r\n"); 00082 goto exit; 00083 } 00084 00085 hash->bufferLength = SIZEOF_SHA256; 00086 00087 rc = flash.deinit(); 00088 if (rc != 0) 00089 { 00090 PAL_LOG_ERR("flash deinit failed\r\n"); 00091 goto exit; 00092 } 00093 00094 ret = PAL_SUCCESS; 00095 00096 exit: 00097 return ret; 00098 } 00099 00100 palStatus_t pal_plat_imageGetActiveVersion (palBuffer_t* version) 00101 { 00102 return PAL_ERR_NOT_IMPLEMENTED; 00103 } 00104 00105 palStatus_t pal_plat_imageWriteHashToMemory (const palConstBuffer_t* const hashValue) 00106 { 00107 return PAL_ERR_NOT_IMPLEMENTED; 00108 } 00109 00110 palStatus_t pal_plat_imageSetHeader(palImageId_t imageId, palImageHeaderDeails_t *details) 00111 { 00112 return PAL_ERR_NOT_IMPLEMENTED; 00113 } 00114 00115 palStatus_t pal_plat_imageReserveSpace(palImageId_t imageId, size_t imageSize) 00116 { 00117 return PAL_ERR_NOT_IMPLEMENTED; 00118 } 00119 00120 palStatus_t pal_plat_imageWrite(palImageId_t imageId, size_t offset, palConstBuffer_t *chunk) 00121 { 00122 return PAL_ERR_NOT_IMPLEMENTED; 00123 } 00124 00125 palStatus_t pal_plat_imageReadToBuffer(palImageId_t imageId, size_t offset, palBuffer_t *chunk) 00126 { 00127 return PAL_ERR_NOT_IMPLEMENTED; 00128 } 00129 00130 palStatus_t pal_plat_imageFlush(palImageId_t package_id) 00131 { 00132 return PAL_ERR_NOT_IMPLEMENTED; 00133 }
Generated on Tue Jul 12 2022 20:21:02 by
