Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/hic_hal/FlashOS.h@0:01f31e923fe2, 2020-04-07 (annotated)
- Committer:
- Pawel Zarembski
- Date:
- Tue Apr 07 12:55:42 2020 +0200
- Revision:
- 0:01f31e923fe2
hani: DAPLink with reset workaround
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pawel Zarembski |
0:01f31e923fe2 | 1 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * @file FlashOS.h |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * @brief |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * DAPLink Interface Firmware |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * SPDX-License-Identifier: Apache-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * not use this file except in compliance with the License. |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * You may obtain a copy of the License at |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * Unless required by applicable law or agreed to in writing, software |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * See the License for the specific language governing permissions and |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * limitations under the License. |
Pawel Zarembski |
0:01f31e923fe2 | 20 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 21 | |
Pawel Zarembski |
0:01f31e923fe2 | 22 | #ifndef FLASHOS_H |
Pawel Zarembski |
0:01f31e923fe2 | 23 | #define FLASHOS_H |
Pawel Zarembski |
0:01f31e923fe2 | 24 | |
Pawel Zarembski |
0:01f31e923fe2 | 25 | #include <stdint.h> |
Pawel Zarembski |
0:01f31e923fe2 | 26 | |
Pawel Zarembski |
0:01f31e923fe2 | 27 | #ifdef __cplusplus |
Pawel Zarembski |
0:01f31e923fe2 | 28 | extern "C" { |
Pawel Zarembski |
0:01f31e923fe2 | 29 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 30 | |
Pawel Zarembski |
0:01f31e923fe2 | 31 | #define VERS 1 // Interface Version 1.01 |
Pawel Zarembski |
0:01f31e923fe2 | 32 | #define NAME_MAX 128 // Max size of the routine name |
Pawel Zarembski |
0:01f31e923fe2 | 33 | #define PAGE_MAX 65536 // Max Page Size for Programming |
Pawel Zarembski |
0:01f31e923fe2 | 34 | #define SECTOR_NUM 512 // Max Number of Sector Items |
Pawel Zarembski |
0:01f31e923fe2 | 35 | #define SECTOR_END 0xFFFFFFFF, 0xFFFFFFFF |
Pawel Zarembski |
0:01f31e923fe2 | 36 | |
Pawel Zarembski |
0:01f31e923fe2 | 37 | // FlashDevice.devType interface mechanism |
Pawel Zarembski |
0:01f31e923fe2 | 38 | #define UNKNOWN 0 |
Pawel Zarembski |
0:01f31e923fe2 | 39 | #define ONCHIP 1 |
Pawel Zarembski |
0:01f31e923fe2 | 40 | #define EXT8BIT 2 |
Pawel Zarembski |
0:01f31e923fe2 | 41 | #define EXT16BIT 3 |
Pawel Zarembski |
0:01f31e923fe2 | 42 | #define EXT32BIT 4 |
Pawel Zarembski |
0:01f31e923fe2 | 43 | #define EXTSPI 5 |
Pawel Zarembski |
0:01f31e923fe2 | 44 | |
Pawel Zarembski |
0:01f31e923fe2 | 45 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 46 | @struct FlashSector |
Pawel Zarembski |
0:01f31e923fe2 | 47 | @brief A structure to describe the size and start address of a flash sector |
Pawel Zarembski |
0:01f31e923fe2 | 48 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 49 | struct FlashSector { |
Pawel Zarembski |
0:01f31e923fe2 | 50 | uint32_t szSector; /*!< Sector Size in Bytes */ |
Pawel Zarembski |
0:01f31e923fe2 | 51 | uint32_t adrSector; /*!< Address of Sector */ |
Pawel Zarembski |
0:01f31e923fe2 | 52 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 53 | |
Pawel Zarembski |
0:01f31e923fe2 | 54 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 55 | @struct FlashDevice |
Pawel Zarembski |
0:01f31e923fe2 | 56 | @brief A structure to describe particulars of a flash memory sub-system |
Pawel Zarembski |
0:01f31e923fe2 | 57 | and requirements of the driver |
Pawel Zarembski |
0:01f31e923fe2 | 58 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 59 | struct FlashDevice { |
Pawel Zarembski |
0:01f31e923fe2 | 60 | uint16_t vers; /*!< Version Number and Architecture */ |
Pawel Zarembski |
0:01f31e923fe2 | 61 | char devName[NAME_MAX]; /*!< Device Name and Description */ |
Pawel Zarembski |
0:01f31e923fe2 | 62 | uint16_t devType; /*!< Device Type: ONCHIP, EXT8BIT, EXT16BIT, ... */ |
Pawel Zarembski |
0:01f31e923fe2 | 63 | uint32_t devAdr; /*!< Default Device Start Address */ |
Pawel Zarembski |
0:01f31e923fe2 | 64 | uint32_t szDev; /*!< Total Size of Device */ |
Pawel Zarembski |
0:01f31e923fe2 | 65 | uint32_t szPage; /*!< Programming Page Size */ |
Pawel Zarembski |
0:01f31e923fe2 | 66 | uint32_t res; /*!< Reserved for future Extension */ |
Pawel Zarembski |
0:01f31e923fe2 | 67 | uint8_t valEmpty; /*!< Content of Erased Memory */ |
Pawel Zarembski |
0:01f31e923fe2 | 68 | uint32_t toProg; /*!< Time Out of Program Page Function */ |
Pawel Zarembski |
0:01f31e923fe2 | 69 | uint32_t toErase; /*!< Time Out of Erase Sector Function */ |
Pawel Zarembski |
0:01f31e923fe2 | 70 | struct FlashSector sectors[SECTOR_NUM]; /*!< Entries to describe flash memory layout */ |
Pawel Zarembski |
0:01f31e923fe2 | 71 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 72 | |
Pawel Zarembski |
0:01f31e923fe2 | 73 | #ifdef __cplusplus |
Pawel Zarembski |
0:01f31e923fe2 | 74 | } |
Pawel Zarembski |
0:01f31e923fe2 | 75 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 76 | |
Pawel Zarembski |
0:01f31e923fe2 | 77 | #endif |