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 flash_intf.h
Pawel Zarembski 0:01f31e923fe2 3 * @brief Interface for implementing differet ways to write an image into memory
Pawel Zarembski 0:01f31e923fe2 4 *
Pawel Zarembski 0:01f31e923fe2 5 * DAPLink Interface Firmware
Pawel Zarembski 0:01f31e923fe2 6 * Copyright (c) 2009-2019, 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 FLASH_INTF_H
Pawel Zarembski 0:01f31e923fe2 23 #define FLASH_INTF_H
Pawel Zarembski 0:01f31e923fe2 24
Pawel Zarembski 0:01f31e923fe2 25 #include <stdint.h>
Pawel Zarembski 0:01f31e923fe2 26
Pawel Zarembski 0:01f31e923fe2 27 #include "error.h"
Pawel Zarembski 0:01f31e923fe2 28
Pawel Zarembski 0:01f31e923fe2 29 #ifdef __cplusplus
Pawel Zarembski 0:01f31e923fe2 30 extern "C" {
Pawel Zarembski 0:01f31e923fe2 31 #endif
Pawel Zarembski 0:01f31e923fe2 32
Pawel Zarembski 0:01f31e923fe2 33 typedef enum {
Pawel Zarembski 0:01f31e923fe2 34 FLASH_FUNC_NOP,
Pawel Zarembski 0:01f31e923fe2 35 FLASH_FUNC_ERASE,
Pawel Zarembski 0:01f31e923fe2 36 FLASH_FUNC_PROGRAM,
Pawel Zarembski 0:01f31e923fe2 37 FLASH_FUNC_VERIFY
Pawel Zarembski 0:01f31e923fe2 38 } flash_func_t;
Pawel Zarembski 0:01f31e923fe2 39
Pawel Zarembski 0:01f31e923fe2 40 typedef error_t (*flash_intf_init_cb_t)(void);
Pawel Zarembski 0:01f31e923fe2 41 typedef error_t (*flash_intf_uninit_cb_t)(void);
Pawel Zarembski 0:01f31e923fe2 42 typedef error_t (*flash_intf_program_page_cb_t)(uint32_t addr, const uint8_t *buf, uint32_t size);
Pawel Zarembski 0:01f31e923fe2 43 typedef error_t (*flash_intf_erase_sector_cb_t)(uint32_t sector);
Pawel Zarembski 0:01f31e923fe2 44 typedef error_t (*flash_intf_erase_chip_cb_t)(void);
Pawel Zarembski 0:01f31e923fe2 45 typedef uint32_t (*flash_program_page_min_size_cb_t)(uint32_t addr);
Pawel Zarembski 0:01f31e923fe2 46 typedef uint32_t (*flash_erase_sector_size_cb_t)(uint32_t addr);
Pawel Zarembski 0:01f31e923fe2 47 typedef uint8_t (*flash_busy_cb_t)(void);
Pawel Zarembski 0:01f31e923fe2 48 typedef error_t (*flash_algo_set_cb_t)(uint32_t addr);
Pawel Zarembski 0:01f31e923fe2 49
Pawel Zarembski 0:01f31e923fe2 50 typedef struct {
Pawel Zarembski 0:01f31e923fe2 51 flash_intf_init_cb_t init;
Pawel Zarembski 0:01f31e923fe2 52 flash_intf_uninit_cb_t uninit;
Pawel Zarembski 0:01f31e923fe2 53 flash_intf_program_page_cb_t program_page;
Pawel Zarembski 0:01f31e923fe2 54 flash_intf_erase_sector_cb_t erase_sector;
Pawel Zarembski 0:01f31e923fe2 55 flash_intf_erase_chip_cb_t erase_chip;
Pawel Zarembski 0:01f31e923fe2 56 flash_program_page_min_size_cb_t program_page_min_size;
Pawel Zarembski 0:01f31e923fe2 57 flash_erase_sector_size_cb_t erase_sector_size;
Pawel Zarembski 0:01f31e923fe2 58 flash_busy_cb_t flash_busy;
Pawel Zarembski 0:01f31e923fe2 59 flash_algo_set_cb_t flash_algo_set;
Pawel Zarembski 0:01f31e923fe2 60 } flash_intf_t;
Pawel Zarembski 0:01f31e923fe2 61
Pawel Zarembski 0:01f31e923fe2 62 // All flash interfaces. Unsupported interfaces are NULL.
Pawel Zarembski 0:01f31e923fe2 63 extern const flash_intf_t *const flash_intf_iap_protected;
Pawel Zarembski 0:01f31e923fe2 64 extern const flash_intf_t *const flash_intf_target;
Pawel Zarembski 0:01f31e923fe2 65 extern const flash_intf_t *const flash_intf_target_custom;
Pawel Zarembski 0:01f31e923fe2 66
Pawel Zarembski 0:01f31e923fe2 67 #ifdef __cplusplus
Pawel Zarembski 0:01f31e923fe2 68 }
Pawel Zarembski 0:01f31e923fe2 69 #endif
Pawel Zarembski 0:01f31e923fe2 70
Pawel Zarembski 0:01f31e923fe2 71 #endif