Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

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