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
arm_uc_pal_blockdevice_platform.h
00001 // ---------------------------------------------------------------------------- 00002 // Copyright 2017-2018 ARM Ltd. 00003 // 00004 // SPDX-License-Identifier: Apache-2.0 00005 // 00006 // Licensed under the Apache License, Version 2.0 (the "License"); 00007 // you may not use this file except in compliance with the License. 00008 // You may obtain a copy of the License at 00009 // 00010 // http://www.apache.org/licenses/LICENSE-2.0 00011 // 00012 // Unless required by applicable law or agreed to in writing, software 00013 // distributed under the License is distributed on an "AS IS" BASIS, 00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 // See the License for the specific language governing permissions and 00016 // limitations under the License. 00017 // ---------------------------------------------------------------------------- 00018 00019 #ifndef ARM_UC_PAL_BLOCKDEVICE_PLATFORM_H 00020 #define ARM_UC_PAL_BLOCKDEVICE_PLATFORM_H 00021 00022 #include <stdint.h> 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 enum { 00029 ARM_UC_BLOCKDEVICE_SUCCESS = 0, 00030 ARM_UC_BLOCKDEVICE_FAIL = -1 00031 }; 00032 00033 #define ARM_UC_BLOCKDEVICE_INVALID_SIZE 0xFFFFFFFF 00034 00035 /** Initialize a block device 00036 * 00037 * @return 0 on success or a negative error code on failure 00038 */ 00039 int32_t arm_uc_blockdevice_init(void); 00040 00041 /** Erase blocks on a block device 00042 * 00043 * The state of an erased block is undefined until it has been programmed 00044 * 00045 * @param address Address of block to begin erasing 00046 * @param size Size to erase in bytes, must be a multiple of erase block size 00047 * @return 0 on success, negative error code on failure 00048 */ 00049 int32_t arm_uc_blockdevice_erase(uint64_t address, uint64_t size); 00050 00051 /** Program blocks to a block device 00052 * 00053 * The blocks must have been erased prior to being programmed 00054 * 00055 * If a failure occurs, it is not possible to determine how many bytes succeeded 00056 * 00057 * @param buffer Buffer of data to write to blocks 00058 * @param address Address of block to begin writing to 00059 * @param size Size to write in bytes, must be a multiple of program block size 00060 * @return 0 on success, negative error code on failure 00061 */ 00062 int32_t arm_uc_blockdevice_program(const uint8_t *buffer, 00063 uint64_t address, 00064 uint32_t size); 00065 00066 /** Read blocks from a block device 00067 * 00068 * If a failure occurs, it is not possible to determine how many bytes succeeded 00069 * 00070 * @param buffer Buffer to write blocks to 00071 * @param address Address of block to begin reading from 00072 * @param size Size to read in bytes, must be a multiple of read block size 00073 * @return 0 on success, negative error code on failure 00074 */ 00075 int32_t arm_uc_blockdevice_read(uint8_t *buffer, 00076 uint64_t address, 00077 uint32_t size); 00078 00079 /** Get the size of a programable block 00080 * 00081 * @return Size of a programable block in bytes 00082 * @note Must be a multiple of the read size 00083 */ 00084 uint32_t arm_uc_blockdevice_get_program_size(void); 00085 00086 /** Get the size of a eraseable block 00087 * 00088 * @return Size of a eraseable block in bytes 00089 * @note Must be a multiple of the program size 00090 */ 00091 uint32_t arm_uc_blockdevice_get_erase_size(void); 00092 00093 #ifdef __cplusplus 00094 } 00095 #endif 00096 00097 #endif /* ARM_UC_PAL_BLOCKDEVICE_PLATFORM_H */
Generated on Tue Jul 12 2022 20:20:57 by
