Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers swd_host.h Source File

swd_host.h

Go to the documentation of this file.
00001 /**
00002  * @file    swd_host.h
00003  * @brief   Host driver for accessing the DAP
00004  *
00005  * DAPLink Interface Firmware
00006  * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
00007  * Copyright 2019, Cypress Semiconductor Corporation 
00008  * or a subsidiary of Cypress Semiconductor Corporation.
00009  * SPDX-License-Identifier: Apache-2.0
00010  *
00011  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00012  * not use this file except in compliance with the License.
00013  * You may obtain a copy of the License at
00014  *
00015  * http://www.apache.org/licenses/LICENSE-2.0
00016  *
00017  * Unless required by applicable law or agreed to in writing, software
00018  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00019  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020  * See the License for the specific language governing permissions and
00021  * limitations under the License.
00022  */
00023 
00024 #ifndef SWDHOST_CM_H
00025 #define SWDHOST_CM_H
00026 
00027 #include "flash_blob.h"
00028 #include "target_family.h"
00029 #ifdef TARGET_MCU_CORTEX_A
00030 #include "debug_ca.h"
00031 #else
00032 #include "debug_cm.h"
00033 #endif
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 typedef enum {
00040     CONNECT_NORMAL,
00041     CONNECT_UNDER_RESET,
00042 } SWD_CONNECT_TYPE;
00043 
00044 typedef enum {
00045     FLASHALGO_RETURN_BOOL,
00046     FLASHALGO_RETURN_POINTER
00047 } flash_algo_return_t;
00048 
00049 uint8_t swd_init(void);
00050 uint8_t swd_off(void);
00051 uint8_t swd_init_debug(void);
00052 uint8_t swd_clear_errors(void);
00053 uint8_t swd_read_dp(uint8_t adr, uint32_t *val);
00054 uint8_t swd_write_dp(uint8_t adr, uint32_t val);
00055 uint8_t swd_read_ap(uint32_t adr, uint32_t *val);
00056 uint8_t swd_write_ap(uint32_t adr, uint32_t val);
00057 uint8_t swd_read_word(uint32_t addr, uint32_t *val);
00058 uint8_t swd_write_word(uint32_t addr, uint32_t val);
00059 uint8_t swd_read_byte(uint32_t addr, uint8_t *val);
00060 uint8_t swd_write_byte(uint32_t addr, uint8_t val);
00061 uint8_t swd_read_memory(uint32_t address, uint8_t *data, uint32_t size);
00062 uint8_t swd_write_memory(uint32_t address, uint8_t *data, uint32_t size);
00063 uint8_t swd_read_core_register(uint32_t n, uint32_t *val);
00064 uint8_t swd_write_core_register(uint32_t n, uint32_t val);
00065 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);
00066 uint8_t swd_set_target_state_hw(target_state_t state);
00067 uint8_t swd_set_target_state_sw(target_state_t state);
00068 uint8_t swd_transfer_retry(uint32_t req, uint32_t *data);
00069 void int2array(uint8_t *res, uint32_t data, uint8_t len);
00070 void swd_set_reset_connect(SWD_CONNECT_TYPE type);
00071 void swd_set_soft_reset(uint32_t soft_reset_type);
00072 uint8_t JTAG2SWD(void);
00073 
00074 #ifdef __cplusplus
00075 }
00076 #endif
00077 
00078 #endif