Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.

Upstream: https://github.com/ARMmbed/DAPLink

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?

UserRevisionLine numberNew contents of line
Pawel Zarembski 0:01f31e923fe2 1 /**
Pawel Zarembski 0:01f31e923fe2 2 * @file FlashPrg.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 FLASHPRG_H
Pawel Zarembski 0:01f31e923fe2 23 #define FLASHPRG_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 /** Initialize programming functions
Pawel Zarembski 0:01f31e923fe2 32 * @param adr device base address
Pawel Zarembski 0:01f31e923fe2 33 * @param clk clock frequency (Hz)
Pawel Zarembski 0:01f31e923fe2 34 * @param fnc function code (1 - Erase, 2 - Program, 3 - Verify)
Pawel Zarembski 0:01f31e923fe2 35 * @return 0 on success, an error code otherwise
Pawel Zarembski 0:01f31e923fe2 36 */
Pawel Zarembski 0:01f31e923fe2 37 uint32_t Init(uint32_t adr, uint32_t clk, uint32_t fnc);
Pawel Zarembski 0:01f31e923fe2 38
Pawel Zarembski 0:01f31e923fe2 39 /** De-Initialize programming functions [optional]
Pawel Zarembski 0:01f31e923fe2 40 * @param fnc function code (1 - Erase, 2 - Program, 3 - Verify)
Pawel Zarembski 0:01f31e923fe2 41 * @return 0 on success, an error code otherwise
Pawel Zarembski 0:01f31e923fe2 42 */
Pawel Zarembski 0:01f31e923fe2 43 uint32_t UnInit(uint32_t fnc);
Pawel Zarembski 0:01f31e923fe2 44
Pawel Zarembski 0:01f31e923fe2 45 /** Check region for erased memory
Pawel Zarembski 0:01f31e923fe2 46 * @param adr address to start from
Pawel Zarembski 0:01f31e923fe2 47 * @param sz the amount of memory to check
Pawel Zarembski 0:01f31e923fe2 48 * @param pat the pattern of erased memory (usually 0xff)
Pawel Zarembski 0:01f31e923fe2 49 * @return 0 on success, an error code otherwise
Pawel Zarembski 0:01f31e923fe2 50 */
Pawel Zarembski 0:01f31e923fe2 51 uint32_t BlankCheck(uint32_t adr, uint32_t sz, uint8_t pat);
Pawel Zarembski 0:01f31e923fe2 52
Pawel Zarembski 0:01f31e923fe2 53 /** Perform a full chip erase
Pawel Zarembski 0:01f31e923fe2 54 * @return 0 on success, an error code otherwise
Pawel Zarembski 0:01f31e923fe2 55 */
Pawel Zarembski 0:01f31e923fe2 56 uint32_t EraseChip(void);
Pawel Zarembski 0:01f31e923fe2 57
Pawel Zarembski 0:01f31e923fe2 58 /** Erase a single sector of memory
Pawel Zarembski 0:01f31e923fe2 59 * @param adr address of a sector to erase
Pawel Zarembski 0:01f31e923fe2 60 * @return 0 on success, an error code otherwise
Pawel Zarembski 0:01f31e923fe2 61 */
Pawel Zarembski 0:01f31e923fe2 62 uint32_t EraseSector(uint32_t adr);
Pawel Zarembski 0:01f31e923fe2 63
Pawel Zarembski 0:01f31e923fe2 64 /** Program data into memory
Pawel Zarembski 0:01f31e923fe2 65 * @param adr address to start programming from
Pawel Zarembski 0:01f31e923fe2 66 * @param sz the amount of data to program
Pawel Zarembski 0:01f31e923fe2 67 * @param buf memory contents to be programmed
Pawel Zarembski 0:01f31e923fe2 68 * @return 0 on success, an error code otherwise
Pawel Zarembski 0:01f31e923fe2 69 */
Pawel Zarembski 0:01f31e923fe2 70 uint32_t ProgramPage(uint32_t adr, uint32_t sz, uint32_t *buf);
Pawel Zarembski 0:01f31e923fe2 71
Pawel Zarembski 0:01f31e923fe2 72 /** Verify contents in memory
Pawel Zarembski 0:01f31e923fe2 73 * @param adr start address of the verification
Pawel Zarembski 0:01f31e923fe2 74 * @param sz the amount of data to be verified
Pawel Zarembski 0:01f31e923fe2 75 * @param buf memory contents to be compared against
Pawel Zarembski 0:01f31e923fe2 76 * @return 0 on success, an error code otherwise
Pawel Zarembski 0:01f31e923fe2 77 */
Pawel Zarembski 0:01f31e923fe2 78 uint32_t Verify(uint32_t adr, uint32_t sz, uint32_t *buf);
Pawel Zarembski 0:01f31e923fe2 79
Pawel Zarembski 0:01f31e923fe2 80 #ifdef __cplusplus
Pawel Zarembski 0:01f31e923fe2 81 }
Pawel Zarembski 0:01f31e923fe2 82 #endif
Pawel Zarembski 0:01f31e923fe2 83
Pawel Zarembski 0:01f31e923fe2 84 #endif