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.
aconno_flash.h
00001 /** 00002 * Made by Jurica Resetar @ aconno 00003 * ResetarJurica@gmail.com 00004 * More info @ aconno.de 00005 * 00006 */ 00007 00008 /** \addtogroup hal */ 00009 /** @{*/ 00010 00011 /* mbed Microcontroller Library 00012 * Copyright (c) 2017 ARM Limited 00013 * 00014 * Licensed under the Apache License, Version 2.0 (the "License"); 00015 * you may not use this file except in compliance with the License. 00016 * You may obtain a copy of the License at 00017 * 00018 * http://www.apache.org/licenses/LICENSE-2.0 00019 * 00020 * Unless required by applicable law or agreed to in writing, software 00021 * distributed under the License is distributed on an "AS IS" BASIS, 00022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00023 * See the License for the specific language governing permissions and 00024 * limitations under the License. 00025 */ 00026 #ifndef ACONNO_FLASH_API_H 00027 #define ACONNO_FLASH_API_H 00028 00029 #include "device.h" 00030 #include <stdint.h> 00031 00032 #if DEVICE_FLASH 00033 00034 #define MBED_FLASH_INVALID_SIZE 0xFFFFFFFF 00035 00036 typedef struct flash_s flash_t; 00037 00038 #if TARGET_FLASH_CMSIS_ALGO 00039 #include "flash_data.h" 00040 #endif 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00046 /** 00047 * \defgroup flash_hal Flash HAL API 00048 * @{ 00049 */ 00050 00051 /** Initialize the flash peripheral and the flash_t object 00052 * 00053 * @param obj The flash object 00054 * @return 0 for success, -1 for error 00055 */ 00056 int32_t aconno_flash_init(flash_t *obj); 00057 00058 /** Uninitialize the flash peripheral and the flash_t object 00059 * 00060 * @param obj The flash object 00061 * @return 0 for success, -1 for error 00062 */ 00063 int32_t aconno_flash_free(flash_t *obj); 00064 00065 /** Erase one sector starting at defined address 00066 * 00067 * The address should be at sector boundary. This function does not do any check for address alignments 00068 * @param obj The flash object 00069 * @param address The sector starting address 00070 * @return 0 for success, -1 for error 00071 */ 00072 int32_t aconno_flash_erase_sector(flash_t *obj, uint32_t address); 00073 00074 /** Read data starting at defined address 00075 * 00076 * This function has a WEAK implementation using memcpy for backwards compatibility. 00077 * @param obj The flash object 00078 * @param address Address to begin reading from 00079 * @param data The buffer to read data into 00080 * @param size The number of bytes to read 00081 * @return 0 for success, -1 for error 00082 */ 00083 int32_t aconno_flash_read(flash_t *obj, uint32_t address, uint8_t *data, uint32_t size); 00084 00085 /** Program pages starting at defined address 00086 * 00087 * The pages should not cross multiple sectors. 00088 * This function does not do any check for address alignments or if size is aligned to a page size. 00089 * @param obj The flash object 00090 * @param address The sector starting address 00091 * @param data The data buffer to be programmed 00092 * @param size The number of bytes to program 00093 * @return 0 for success, -1 for error 00094 */ 00095 int32_t aconno_flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size); 00096 00097 /** Get sector size 00098 * 00099 * @param obj The flash object 00100 * @param address The sector starting address 00101 * @return The size of a sector 00102 */ 00103 uint32_t aconno_flash_get_sector_size(const flash_t *obj, uint32_t address); 00104 00105 /** Get page size 00106 * 00107 * The page size defines the writable page size 00108 * @param obj The flash object 00109 * @return The size of a page 00110 */ 00111 uint32_t aconno_flash_get_page_size(const flash_t *obj); 00112 00113 /** Get start address for the flash region 00114 * 00115 * @param obj The flash object 00116 * @return The start address for the flash region 00117 */ 00118 uint32_t aconno_flash_get_start_address(const flash_t *obj); 00119 00120 /** Get the flash region size 00121 * 00122 * @param obj The flash object 00123 * @return The flash region size 00124 */ 00125 uint32_t aconno_flash_get_size(const flash_t *obj); 00126 00127 /**@}*/ 00128 00129 #ifdef __cplusplus 00130 } 00131 #endif 00132 00133 #endif 00134 00135 #endif 00136 00137 /** @}*/
Generated on Thu Jul 14 2022 20:11:16 by
1.7.2