Forked.
Fork of mbed-dev by
hal/TARGET_FLASH_CMSIS_ALGO/flash_data.h@174:ed647f63e28d, 2017-12-19 (annotated)
- Committer:
- Dollyparton
- Date:
- Tue Dec 19 12:50:13 2017 +0000
- Revision:
- 174:ed647f63e28d
- Parent:
- 160:d5399cc887bb
Added RAW socket.
Who changed what in which revision?
User | Revision | Line number | New 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 | |
<> | 160:d5399cc887bb | 21 | // Target flash algorithm structure |
<> | 160:d5399cc887bb | 22 | typedef struct { |
<> | 160:d5399cc887bb | 23 | const uint32_t init; |
<> | 160:d5399cc887bb | 24 | const uint32_t uninit; |
<> | 160:d5399cc887bb | 25 | const uint32_t erase_sector; |
<> | 160:d5399cc887bb | 26 | const uint32_t program_page; |
<> | 160:d5399cc887bb | 27 | const uint32_t static_base; |
<> | 160:d5399cc887bb | 28 | uint32_t *algo_blob; |
<> | 160:d5399cc887bb | 29 | } flash_algo_t; |
<> | 160:d5399cc887bb | 30 | |
<> | 160:d5399cc887bb | 31 | typedef struct { |
<> | 160:d5399cc887bb | 32 | const uint32_t start; |
<> | 160:d5399cc887bb | 33 | const uint32_t size; |
<> | 160:d5399cc887bb | 34 | } sector_info_t; |
<> | 160:d5399cc887bb | 35 | |
<> | 160:d5399cc887bb | 36 | typedef struct { |
<> | 160:d5399cc887bb | 37 | const uint32_t page_size; |
<> | 160:d5399cc887bb | 38 | const uint32_t flash_start; |
<> | 160:d5399cc887bb | 39 | const uint32_t flash_size; |
<> | 160:d5399cc887bb | 40 | const sector_info_t *sectors; |
<> | 160:d5399cc887bb | 41 | const uint32_t sector_info_count; |
<> | 160:d5399cc887bb | 42 | } flash_target_config_t; |
<> | 160:d5399cc887bb | 43 | |
<> | 160:d5399cc887bb | 44 | // Target flash configuration |
<> | 160:d5399cc887bb | 45 | struct flash_s { |
<> | 160:d5399cc887bb | 46 | const flash_target_config_t *target_config; |
<> | 160:d5399cc887bb | 47 | const flash_algo_t *flash_algo; |
<> | 160:d5399cc887bb | 48 | }; |
<> | 160:d5399cc887bb | 49 | |
<> | 160:d5399cc887bb | 50 | typedef struct { |
<> | 160:d5399cc887bb | 51 | uint32_t r0; |
<> | 160:d5399cc887bb | 52 | uint32_t r1; |
<> | 160:d5399cc887bb | 53 | uint32_t r2; |
<> | 160:d5399cc887bb | 54 | uint32_t r3; |
<> | 160:d5399cc887bb | 55 | uint32_t r9; |
<> | 160:d5399cc887bb | 56 | uint32_t pc; |
<> | 160:d5399cc887bb | 57 | } args_t; |
<> | 160:d5399cc887bb | 58 | |
<> | 160:d5399cc887bb | 59 | typedef int32_t (*flash_algo_jump_t)(args_t*); |
<> | 160:d5399cc887bb | 60 | |
<> | 160:d5399cc887bb | 61 | // prototypes for flash algo CMSIS API |
<> | 160:d5399cc887bb | 62 | |
<> | 160:d5399cc887bb | 63 | typedef int (*CMSIS_Algo_Function_Init)(unsigned long adr, unsigned long clk, unsigned long fnc); |
<> | 160:d5399cc887bb | 64 | typedef int (*CMSIS_Algo_Function_UnInit)(unsigned long fnc); |
<> | 160:d5399cc887bb | 65 | typedef int (*CMSIS_Algo_Function_EraseSector)(unsigned long adr); |
<> | 160:d5399cc887bb | 66 | typedef int (*CMSIS_Algo_Function_EraseChip)(void); |
<> | 160:d5399cc887bb | 67 | typedef int (*CMSIS_Algo_Function_ProgramPage)(unsigned long adr, unsigned long sz, unsigned char *buf); |
<> | 160:d5399cc887bb | 68 | typedef unsigned long (*CMSIS_Algo_Function_Verify)(unsigned long adr, unsigned long sz, unsigned char *buf); |
<> | 160:d5399cc887bb | 69 | |
<> | 160:d5399cc887bb | 70 | #ifdef __cplusplus |
<> | 160:d5399cc887bb | 71 | extern "C" { |
<> | 160:d5399cc887bb | 72 | #endif |
<> | 160:d5399cc887bb | 73 | |
<> | 160:d5399cc887bb | 74 | /* Set target configuration |
<> | 160:d5399cc887bb | 75 | */ |
<> | 160:d5399cc887bb | 76 | void flash_set_target_config(flash_t *obj); |
<> | 160:d5399cc887bb | 77 | |
<> | 160:d5399cc887bb | 78 | #ifdef __cplusplus |
<> | 160:d5399cc887bb | 79 | }; |
<> | 160:d5399cc887bb | 80 | #endif |
<> | 160:d5399cc887bb | 81 | |
<> | 160:d5399cc887bb | 82 | |
<> | 160:d5399cc887bb | 83 | #endif |