The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Kojto
Date:
Wed Jul 19 16:46:19 2017 +0100
Revision:
147:a97add6d7e64
Parent:
138:093f2bd7b9eb
Child:
165:d1b4690b3f8b
Release 147 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 138:093f2bd7b9eb 1 /* mbed Microcontroller Library
<> 138:093f2bd7b9eb 2 * Copyright (c) 2017 ARM Limited
<> 138:093f2bd7b9eb 3 *
<> 138:093f2bd7b9eb 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 138:093f2bd7b9eb 5 * you may not use this file except in compliance with the License.
<> 138:093f2bd7b9eb 6 * You may obtain a copy of the License at
<> 138:093f2bd7b9eb 7 *
<> 138:093f2bd7b9eb 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 138:093f2bd7b9eb 9 *
<> 138:093f2bd7b9eb 10 * Unless required by applicable law or agreed to in writing, software
<> 138:093f2bd7b9eb 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 138:093f2bd7b9eb 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 138:093f2bd7b9eb 13 * See the License for the specific language governing permissions and
<> 138:093f2bd7b9eb 14 * limitations under the License.
<> 138:093f2bd7b9eb 15 */
<> 138:093f2bd7b9eb 16 #ifndef MBED_FLASH_DATA_H
<> 138:093f2bd7b9eb 17 #define MBED_FLASH_DATA_H
<> 138:093f2bd7b9eb 18
<> 138:093f2bd7b9eb 19 #include <stdint.h>
<> 138:093f2bd7b9eb 20
<> 138:093f2bd7b9eb 21 // Target flash algorithm structure
<> 138:093f2bd7b9eb 22 typedef struct {
<> 138:093f2bd7b9eb 23 const uint32_t init;
<> 138:093f2bd7b9eb 24 const uint32_t uninit;
<> 138:093f2bd7b9eb 25 const uint32_t erase_sector;
<> 138:093f2bd7b9eb 26 const uint32_t program_page;
<> 138:093f2bd7b9eb 27 const uint32_t static_base;
<> 138:093f2bd7b9eb 28 uint32_t *algo_blob;
<> 138:093f2bd7b9eb 29 } flash_algo_t;
<> 138:093f2bd7b9eb 30
<> 138:093f2bd7b9eb 31 typedef struct {
<> 138:093f2bd7b9eb 32 const uint32_t start;
<> 138:093f2bd7b9eb 33 const uint32_t size;
<> 138:093f2bd7b9eb 34 } sector_info_t;
<> 138:093f2bd7b9eb 35
<> 138:093f2bd7b9eb 36 typedef struct {
<> 138:093f2bd7b9eb 37 const uint32_t page_size;
<> 138:093f2bd7b9eb 38 const uint32_t flash_start;
<> 138:093f2bd7b9eb 39 const uint32_t flash_size;
<> 138:093f2bd7b9eb 40 const sector_info_t *sectors;
<> 138:093f2bd7b9eb 41 const uint32_t sector_info_count;
<> 138:093f2bd7b9eb 42 } flash_target_config_t;
<> 138:093f2bd7b9eb 43
<> 138:093f2bd7b9eb 44 // Target flash configuration
<> 138:093f2bd7b9eb 45 struct flash_s {
<> 138:093f2bd7b9eb 46 const flash_target_config_t *target_config;
<> 138:093f2bd7b9eb 47 const flash_algo_t *flash_algo;
<> 138:093f2bd7b9eb 48 };
<> 138:093f2bd7b9eb 49
<> 138:093f2bd7b9eb 50 typedef struct {
<> 138:093f2bd7b9eb 51 uint32_t r0;
<> 138:093f2bd7b9eb 52 uint32_t r1;
<> 138:093f2bd7b9eb 53 uint32_t r2;
<> 138:093f2bd7b9eb 54 uint32_t r3;
<> 138:093f2bd7b9eb 55 uint32_t r9;
<> 138:093f2bd7b9eb 56 uint32_t pc;
<> 138:093f2bd7b9eb 57 } args_t;
<> 138:093f2bd7b9eb 58
<> 138:093f2bd7b9eb 59 typedef int32_t (*flash_algo_jump_t)(args_t*);
<> 138:093f2bd7b9eb 60
<> 138:093f2bd7b9eb 61 // prototypes for flash algo CMSIS API
<> 138:093f2bd7b9eb 62
<> 138:093f2bd7b9eb 63 typedef int (*CMSIS_Algo_Function_Init)(unsigned long adr, unsigned long clk, unsigned long fnc);
<> 138:093f2bd7b9eb 64 typedef int (*CMSIS_Algo_Function_UnInit)(unsigned long fnc);
<> 138:093f2bd7b9eb 65 typedef int (*CMSIS_Algo_Function_EraseSector)(unsigned long adr);
<> 138:093f2bd7b9eb 66 typedef int (*CMSIS_Algo_Function_EraseChip)(void);
<> 138:093f2bd7b9eb 67 typedef int (*CMSIS_Algo_Function_ProgramPage)(unsigned long adr, unsigned long sz, unsigned char *buf);
<> 138:093f2bd7b9eb 68 typedef unsigned long (*CMSIS_Algo_Function_Verify)(unsigned long adr, unsigned long sz, unsigned char *buf);
<> 138:093f2bd7b9eb 69
<> 138:093f2bd7b9eb 70 #ifdef __cplusplus
<> 138:093f2bd7b9eb 71 extern "C" {
<> 138:093f2bd7b9eb 72 #endif
<> 138:093f2bd7b9eb 73
<> 138:093f2bd7b9eb 74 /* Set target configuration
<> 138:093f2bd7b9eb 75 */
<> 138:093f2bd7b9eb 76 void flash_set_target_config(flash_t *obj);
<> 138:093f2bd7b9eb 77
<> 138:093f2bd7b9eb 78 #ifdef __cplusplus
<> 138:093f2bd7b9eb 79 };
<> 138:093f2bd7b9eb 80 #endif
<> 138:093f2bd7b9eb 81
<> 138:093f2bd7b9eb 82
<> 138:093f2bd7b9eb 83 #endif