Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/daplink/interface/swd_host.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 swd_host.h |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * @brief Host driver for accessing the DAP |
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 | * Copyright 2019, Cypress Semiconductor Corporation |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * or a subsidiary of Cypress Semiconductor Corporation. |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * SPDX-License-Identifier: Apache-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * not use this file except in compliance with the License. |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * You may obtain a copy of the License at |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * http://www.apache.org/licenses/LICENSE-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * Unless required by applicable law or agreed to in writing, software |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Pawel Zarembski |
0:01f31e923fe2 | 20 | * See the License for the specific language governing permissions and |
Pawel Zarembski |
0:01f31e923fe2 | 21 | * limitations under the License. |
Pawel Zarembski |
0:01f31e923fe2 | 22 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 23 | |
Pawel Zarembski |
0:01f31e923fe2 | 24 | #ifndef SWDHOST_CM_H |
Pawel Zarembski |
0:01f31e923fe2 | 25 | #define SWDHOST_CM_H |
Pawel Zarembski |
0:01f31e923fe2 | 26 | |
Pawel Zarembski |
0:01f31e923fe2 | 27 | #include "flash_blob.h" |
Pawel Zarembski |
0:01f31e923fe2 | 28 | #include "target_family.h" |
Pawel Zarembski |
0:01f31e923fe2 | 29 | #ifdef TARGET_MCU_CORTEX_A |
Pawel Zarembski |
0:01f31e923fe2 | 30 | #include "debug_ca.h" |
Pawel Zarembski |
0:01f31e923fe2 | 31 | #else |
Pawel Zarembski |
0:01f31e923fe2 | 32 | #include "debug_cm.h" |
Pawel Zarembski |
0:01f31e923fe2 | 33 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 34 | |
Pawel Zarembski |
0:01f31e923fe2 | 35 | #ifdef __cplusplus |
Pawel Zarembski |
0:01f31e923fe2 | 36 | extern "C" { |
Pawel Zarembski |
0:01f31e923fe2 | 37 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 38 | |
Pawel Zarembski |
0:01f31e923fe2 | 39 | typedef enum { |
Pawel Zarembski |
0:01f31e923fe2 | 40 | CONNECT_NORMAL, |
Pawel Zarembski |
0:01f31e923fe2 | 41 | CONNECT_UNDER_RESET, |
Pawel Zarembski |
0:01f31e923fe2 | 42 | } SWD_CONNECT_TYPE; |
Pawel Zarembski |
0:01f31e923fe2 | 43 | |
Pawel Zarembski |
0:01f31e923fe2 | 44 | typedef enum { |
Pawel Zarembski |
0:01f31e923fe2 | 45 | FLASHALGO_RETURN_BOOL, |
Pawel Zarembski |
0:01f31e923fe2 | 46 | FLASHALGO_RETURN_POINTER |
Pawel Zarembski |
0:01f31e923fe2 | 47 | } flash_algo_return_t; |
Pawel Zarembski |
0:01f31e923fe2 | 48 | |
Pawel Zarembski |
0:01f31e923fe2 | 49 | uint8_t swd_init(void); |
Pawel Zarembski |
0:01f31e923fe2 | 50 | uint8_t swd_off(void); |
Pawel Zarembski |
0:01f31e923fe2 | 51 | uint8_t swd_init_debug(void); |
Pawel Zarembski |
0:01f31e923fe2 | 52 | uint8_t swd_clear_errors(void); |
Pawel Zarembski |
0:01f31e923fe2 | 53 | uint8_t swd_read_dp(uint8_t adr, uint32_t *val); |
Pawel Zarembski |
0:01f31e923fe2 | 54 | uint8_t swd_write_dp(uint8_t adr, uint32_t val); |
Pawel Zarembski |
0:01f31e923fe2 | 55 | uint8_t swd_read_ap(uint32_t adr, uint32_t *val); |
Pawel Zarembski |
0:01f31e923fe2 | 56 | uint8_t swd_write_ap(uint32_t adr, uint32_t val); |
Pawel Zarembski |
0:01f31e923fe2 | 57 | uint8_t swd_read_word(uint32_t addr, uint32_t *val); |
Pawel Zarembski |
0:01f31e923fe2 | 58 | uint8_t swd_write_word(uint32_t addr, uint32_t val); |
Pawel Zarembski |
0:01f31e923fe2 | 59 | uint8_t swd_read_byte(uint32_t addr, uint8_t *val); |
Pawel Zarembski |
0:01f31e923fe2 | 60 | uint8_t swd_write_byte(uint32_t addr, uint8_t val); |
Pawel Zarembski |
0:01f31e923fe2 | 61 | uint8_t swd_read_memory(uint32_t address, uint8_t *data, uint32_t size); |
Pawel Zarembski |
0:01f31e923fe2 | 62 | uint8_t swd_write_memory(uint32_t address, uint8_t *data, uint32_t size); |
Pawel Zarembski |
0:01f31e923fe2 | 63 | uint8_t swd_read_core_register(uint32_t n, uint32_t *val); |
Pawel Zarembski |
0:01f31e923fe2 | 64 | uint8_t swd_write_core_register(uint32_t n, uint32_t val); |
Pawel Zarembski |
0:01f31e923fe2 | 65 | uint8_t swd_flash_syscall_exec(const program_syscall_t *sysCallParam, uint32_t entry, uint32_t arg1, uint32_t arg2, uint32_t arg3, uint32_t arg4, flash_algo_return_t return_type); |
Pawel Zarembski |
0:01f31e923fe2 | 66 | uint8_t swd_set_target_state_hw(target_state_t state); |
Pawel Zarembski |
0:01f31e923fe2 | 67 | uint8_t swd_set_target_state_sw(target_state_t state); |
Pawel Zarembski |
0:01f31e923fe2 | 68 | uint8_t swd_transfer_retry(uint32_t req, uint32_t *data); |
Pawel Zarembski |
0:01f31e923fe2 | 69 | void int2array(uint8_t *res, uint32_t data, uint8_t len); |
Pawel Zarembski |
0:01f31e923fe2 | 70 | void swd_set_reset_connect(SWD_CONNECT_TYPE type); |
Pawel Zarembski |
0:01f31e923fe2 | 71 | void swd_set_soft_reset(uint32_t soft_reset_type); |
Pawel Zarembski |
0:01f31e923fe2 | 72 | uint8_t JTAG2SWD(void); |
Pawel Zarembski |
0:01f31e923fe2 | 73 | |
Pawel Zarembski |
0:01f31e923fe2 | 74 | #ifdef __cplusplus |
Pawel Zarembski |
0:01f31e923fe2 | 75 | } |
Pawel Zarembski |
0:01f31e923fe2 | 76 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 77 | |
Pawel Zarembski |
0:01f31e923fe2 | 78 | #endif |