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

« Back to documentation index

Show/hide line numbers target_reset_realtek_rtl8195am.c Source File

target_reset_realtek_rtl8195am.c

00001 /* CMSIS-DAP Interface Firmware
00002  * Copyright (c) 2015-2019 Realtek Semiconductor Corp.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #include <string.h>
00017 #include "swd_host.h"
00018 #include "DAP_config.h"
00019 #include "target_family.h"
00020 
00021 static void swd_set_target_reset_realtek(uint8_t asserted)
00022 {
00023     if (asserted) {
00024         swd_write_word(0xE000ED0C, 0x05FA0004);
00025     }
00026 }
00027 
00028 static uint8_t validate_bin_nvic_realtek(const uint8_t *buf)
00029 {
00030     const char header[] = {0x99, 0x99, 0x96, 0x96, 0x3F, 0xCC, 0x66, 0xFC,
00031                            0xC0, 0x33, 0xCC, 0x03, 0xE5, 0xDC, 0x31, 0x62};
00032 
00033     return !memcmp(header, buf, sizeof(header));
00034 }
00035 
00036 const target_family_descriptor_t g_realtek_rtl8195am = {
00037     .family_id  = kRealtek_Rtl8195am_FamilyID,
00038     .default_reset_type = kHardwareReset,
00039     .swd_set_target_reset = swd_set_target_reset_realtek,
00040     .validate_bin_nvic = validate_bin_nvic_realtek,
00041 };