mbed library sources. Supersedes mbed-src. Edited target satm32f446 for user USART3 pins

Dependents:   IGLOO_board

Fork of mbed-dev by mbed official

Committer:
ua1arn
Date:
Mon Jul 30 12:31:10 2018 +0000
Revision:
188:3f10722804f9
Parent:
186:707f6e361f3e
before add multi-configuration USB descriptors

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 160:d5399cc887bb 1 /* mbed Microcontroller Library
<> 160:d5399cc887bb 2 * Copyright (c) 2017 ARM Limited
<> 160:d5399cc887bb 3 *
<> 160:d5399cc887bb 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 160:d5399cc887bb 5 * you may not use this file except in compliance with the License.
<> 160:d5399cc887bb 6 * You may obtain a copy of the License at
<> 160:d5399cc887bb 7 *
<> 160:d5399cc887bb 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 160:d5399cc887bb 9 *
<> 160:d5399cc887bb 10 * Unless required by applicable law or agreed to in writing, software
<> 160:d5399cc887bb 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 160:d5399cc887bb 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 160:d5399cc887bb 13 * See the License for the specific language governing permissions and
<> 160:d5399cc887bb 14 * limitations under the License.
<> 160:d5399cc887bb 15 */
<> 160:d5399cc887bb 16 #ifndef MBED_FLASH_DATA_H
<> 160:d5399cc887bb 17 #define MBED_FLASH_DATA_H
<> 160:d5399cc887bb 18
<> 160:d5399cc887bb 19 #include <stdint.h>
<> 160:d5399cc887bb 20
AnnaBridge 184:08ed48f1de7f 21 /** Target flash algorithm structure
AnnaBridge 184:08ed48f1de7f 22 */
<> 160:d5399cc887bb 23 typedef struct {
AnnaBridge 184:08ed48f1de7f 24 const uint32_t init; /**< Init function address */
AnnaBridge 184:08ed48f1de7f 25 const uint32_t uninit; /**< Uninit function address */
AnnaBridge 184:08ed48f1de7f 26 const uint32_t erase_sector; /**< Erase sector function address */
AnnaBridge 184:08ed48f1de7f 27 const uint32_t program_page; /**< Program page function address */
AnnaBridge 184:08ed48f1de7f 28 const uint32_t static_base; /**< Static base address */
AnnaBridge 184:08ed48f1de7f 29 uint32_t *algo_blob; /**< Pointer to flash algo binary blob */
<> 160:d5399cc887bb 30 } flash_algo_t;
<> 160:d5399cc887bb 31
AnnaBridge 184:08ed48f1de7f 32 /** Sector information structure
AnnaBridge 184:08ed48f1de7f 33 */
<> 160:d5399cc887bb 34 typedef struct {
AnnaBridge 184:08ed48f1de7f 35 const uint32_t start; /**< Sector start address */
AnnaBridge 184:08ed48f1de7f 36 const uint32_t size; /**< Sector size */
<> 160:d5399cc887bb 37 } sector_info_t;
<> 160:d5399cc887bb 38
AnnaBridge 184:08ed48f1de7f 39 /** Flash configuration structure
AnnaBridge 184:08ed48f1de7f 40 */
<> 160:d5399cc887bb 41 typedef struct {
AnnaBridge 184:08ed48f1de7f 42 const uint32_t page_size; /**< The minimum program page size that can be written */
AnnaBridge 184:08ed48f1de7f 43 const uint32_t flash_start; /**< Start address of the flash <0, flash_size) */
AnnaBridge 184:08ed48f1de7f 44 const uint32_t flash_size; /**< Flash size. The size is accumulative sum of all sector sizes */
AnnaBridge 184:08ed48f1de7f 45 const sector_info_t *sectors; /**< List of sectors - sector can vary in sizes */
AnnaBridge 184:08ed48f1de7f 46 const uint32_t sector_info_count; /**< Number of sectors */
<> 160:d5399cc887bb 47 } flash_target_config_t;
<> 160:d5399cc887bb 48
AnnaBridge 184:08ed48f1de7f 49 /** Target flash configuration
Anna Bridge 186:707f6e361f3e 50 * For targets not supporting TrustZone, its flash_set_target_config must define target_config.
Anna Bridge 186:707f6e361f3e 51 * For targets supporting TrustZone, it has the following requirements:
Anna Bridge 186:707f6e361f3e 52 * -# Flash IAP H/W can only configure to secure. It can access both secure/non-secure flash.
Anna Bridge 186:707f6e361f3e 53 * -# Flash IAP port is for secure build only. It exports secure functions for non-secure build.
Anna Bridge 186:707f6e361f3e 54 * -# In Flash IAP port, flash_set_target_config must define both target_config/target_config_ns for secure/non-secure flash respectively.
Anna Bridge 186:707f6e361f3e 55 * -# Non-secure application can access its non-secure flash only through secure flash IAP functions. It cannot access secure flash.
AnnaBridge 184:08ed48f1de7f 56 */
<> 160:d5399cc887bb 57 struct flash_s {
Anna Bridge 186:707f6e361f3e 58 const flash_target_config_t *target_config; /**< Normal/secure flash configuration structure for targets not supporting/supporting TrustZone */
Anna Bridge 186:707f6e361f3e 59 #if defined(__CORTEX_M23) || defined(__CORTEX_M33)
Anna Bridge 186:707f6e361f3e 60 const flash_target_config_t *target_config_ns; /**< Non-secure flash configuration structure for targets supporting TrustZone */
Anna Bridge 186:707f6e361f3e 61 #endif
<> 160:d5399cc887bb 62 const flash_algo_t *flash_algo;
<> 160:d5399cc887bb 63 };
<> 160:d5399cc887bb 64
AnnaBridge 184:08ed48f1de7f 65 /** Flash algo argument structure
AnnaBridge 184:08ed48f1de7f 66 * Contains all registers that should be preserved
AnnaBridge 184:08ed48f1de7f 67 */
<> 160:d5399cc887bb 68 typedef struct {
<> 160:d5399cc887bb 69 uint32_t r0;
<> 160:d5399cc887bb 70 uint32_t r1;
<> 160:d5399cc887bb 71 uint32_t r2;
<> 160:d5399cc887bb 72 uint32_t r3;
<> 160:d5399cc887bb 73 uint32_t r9;
<> 160:d5399cc887bb 74 uint32_t pc;
<> 160:d5399cc887bb 75 } args_t;
<> 160:d5399cc887bb 76
<> 160:d5399cc887bb 77 typedef int32_t (*flash_algo_jump_t)(args_t*);
<> 160:d5399cc887bb 78
<> 160:d5399cc887bb 79 // prototypes for flash algo CMSIS API
<> 160:d5399cc887bb 80
<> 160:d5399cc887bb 81 typedef int (*CMSIS_Algo_Function_Init)(unsigned long adr, unsigned long clk, unsigned long fnc);
<> 160:d5399cc887bb 82 typedef int (*CMSIS_Algo_Function_UnInit)(unsigned long fnc);
<> 160:d5399cc887bb 83 typedef int (*CMSIS_Algo_Function_EraseSector)(unsigned long adr);
<> 160:d5399cc887bb 84 typedef int (*CMSIS_Algo_Function_EraseChip)(void);
<> 160:d5399cc887bb 85 typedef int (*CMSIS_Algo_Function_ProgramPage)(unsigned long adr, unsigned long sz, unsigned char *buf);
<> 160:d5399cc887bb 86 typedef unsigned long (*CMSIS_Algo_Function_Verify)(unsigned long adr, unsigned long sz, unsigned char *buf);
<> 160:d5399cc887bb 87
<> 160:d5399cc887bb 88 #ifdef __cplusplus
<> 160:d5399cc887bb 89 extern "C" {
<> 160:d5399cc887bb 90 #endif
<> 160:d5399cc887bb 91
<> 160:d5399cc887bb 92 /* Set target configuration
<> 160:d5399cc887bb 93 */
<> 160:d5399cc887bb 94 void flash_set_target_config(flash_t *obj);
<> 160:d5399cc887bb 95
<> 160:d5399cc887bb 96 #ifdef __cplusplus
<> 160:d5399cc887bb 97 };
<> 160:d5399cc887bb 98 #endif
<> 160:d5399cc887bb 99
<> 160:d5399cc887bb 100
<> 160:d5399cc887bb 101 #endif