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.
flash_data.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2017 ARM Limited 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 #ifndef MBED_FLASH_DATA_H 00017 #define MBED_FLASH_DATA_H 00018 00019 #include <stdint.h> 00020 00021 // Target flash algorithm structure 00022 typedef struct { 00023 const uint32_t init; 00024 const uint32_t uninit; 00025 const uint32_t erase_sector; 00026 const uint32_t program_page; 00027 const uint32_t static_base; 00028 uint32_t *algo_blob; 00029 } flash_algo_t; 00030 00031 typedef struct { 00032 const uint32_t start; 00033 const uint32_t size; 00034 } sector_info_t; 00035 00036 typedef struct { 00037 const uint32_t page_size; 00038 const uint32_t flash_start; 00039 const uint32_t flash_size; 00040 const sector_info_t *sectors; 00041 const uint32_t sector_info_count; 00042 } flash_target_config_t; 00043 00044 // Target flash configuration 00045 struct flash_s { 00046 const flash_target_config_t *target_config; 00047 const flash_algo_t *flash_algo; 00048 }; 00049 00050 typedef struct { 00051 uint32_t r0; 00052 uint32_t r1; 00053 uint32_t r2; 00054 uint32_t r3; 00055 uint32_t r9; 00056 uint32_t pc; 00057 } args_t; 00058 00059 typedef int32_t (*flash_algo_jump_t)(args_t*); 00060 00061 // prototypes for flash algo CMSIS API 00062 00063 typedef int (*CMSIS_Algo_Function_Init)(unsigned long adr, unsigned long clk, unsigned long fnc); 00064 typedef int (*CMSIS_Algo_Function_UnInit)(unsigned long fnc); 00065 typedef int (*CMSIS_Algo_Function_EraseSector)(unsigned long adr); 00066 typedef int (*CMSIS_Algo_Function_EraseChip)(void); 00067 typedef int (*CMSIS_Algo_Function_ProgramPage)(unsigned long adr, unsigned long sz, unsigned char *buf); 00068 typedef unsigned long (*CMSIS_Algo_Function_Verify)(unsigned long adr, unsigned long sz, unsigned char *buf); 00069 00070 #ifdef __cplusplus 00071 extern "C" { 00072 #endif 00073 00074 /* Set target configuration 00075 */ 00076 void flash_set_target_config(flash_t *obj); 00077 00078 #ifdef __cplusplus 00079 }; 00080 #endif 00081 00082 00083 #endif
Generated on Tue Jul 12 2022 19:00:53 by
