Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DirectAccessDevicekey.h Source File

DirectAccessDevicekey.h

00001 /*
00002  * Copyright (c) 2018 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * 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, WITHOUT
00012  * 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 #ifndef MBED_DIRECT_ACCESS_DEVICEKEY_H
00018 #define MBED_DIRECT_ACCESS_DEVICEKEY_H
00019 
00020 #include "FlashIAP.h"
00021 #include <stdio.h>
00022 /**
00023  * @brief Returns devicekey directly from internal FlashIAP by given tdb internal position
00024  *
00025  * @param[in]  tdb_start_offset     FlashIAP Start address offset of tdb store
00026  * @param[in]  tdb_end_offset       FlashIAP End address offset of tdb store
00027  * @param[in]  data_buf             Buffer to store devicekey data
00028  * @param[in]  data_buf_size        Max expected size of buffer to store the devicekey data
00029  * @param[out] actual_data_size_ptr Actual retrieved devicekey size
00030  *
00031  * @returns MBED_ERROR_INVALID_ARGUMENT         Illegal argument given
00032  *          MBED_ERROR_INVALID_SIZE             data_buf_size is too small for retrieving actual data size
00033  *          MBED_ERROR_INVALID_DATA_DETECTED    devicekey data invalid crc
00034  *          MBED_ERROR_ITEM_NOT_FOUND           devicekey data not found
00035  *          MBED_ERROR_FAILED_OPERATION         internal flash failure
00036  *          MBED_ERROR_READ_FAILED              internal flash read failed
00037  *          MBED_SUCCESS                        successful
00038  */
00039 int direct_access_to_devicekey(uint32_t tdb_start_offset, uint32_t tdb_end_offset, void *data_buf,
00040                                size_t data_buf_size, size_t *actual_data_size_ptr);
00041 
00042 /**
00043  * @brief Returns the expected tdb internal position.
00044  *        Limitations:
00045  *        1. supporting FILESYSTEM or TDB_EXTERNAL configuration only
00046  *        2. supporting either both start_address and size are explicitly given (different than zero)
00047  *           or both of them are zero (default configuration)
00048  *
00049  * @param[out]  out_tdb_start_offset Expected FlashIAP Start address offset of tdb store
00050  * @param[out]  out_tdb_end_offset   Expected FlashIAP End address offset of tdb store
00051  *
00052  * @returns MBED_ERROR_FAILED_OPERATION    internal flash failure
00053  *          MBED_ERROR_UNSUPPORTED         kvstore configuration different than FILESYSTEM or TDB_EXTERNAL
00054  *                                         or start_address or size are different than 0 and the other isn't
00055  *          MBED_ERROR_INVALID_OPERATION   tdb_start_offset or tdb_end_offset are not aligned or lower
00056  *                                         than end of code segment (when using default configuration)
00057  *          MBED_SUCCESS                   successful
00058  *
00059  */
00060 int get_expected_internal_TDBStore_position(uint32_t *out_tdb_start_offset, uint32_t *out_tdb_end_offset);
00061 
00062 #endif /* MBED_DIRECT_ACCESS_DEVICEKEY_H */