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

« Back to documentation index

Show/hide line numbers target_reset_rza.c Source File

target_reset_rza.c

00001 /**
00002  * @file    target_reset.c
00003  * @brief   Target reset for the rza1h
00004  *
00005  * DAPLink Interface Firmware
00006  * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
00007  * SPDX-License-Identifier: Apache-2.0
00008  *
00009  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00010  * not use this file except in compliance with the License.
00011  * You may obtain a copy of the License at
00012  *
00013  * http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing, software
00016  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00017  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00022 #include "swd_host.h"
00023 #include "target_family.h"
00024 
00025 static uint8_t target_set_state_rza(target_state_t state)
00026 {
00027     return swd_set_target_state_hw(state);
00028 }
00029 
00030 #define BINARY_DETECTION    (0xE59FF000)
00031 
00032 static uint8_t validate_bin_nvic_rza(const uint8_t *buf)
00033 {
00034     // Very dirty hacking here for ARMv7-A (non Cortex-M) binary detection
00035     // This returns validated result when start instrunction
00036     // of the buffer is BINARY_DETECTION (LDR  PC, Label)
00037     // Compared with the high-order 3byte
00038     if ((buf[1] == ((BINARY_DETECTION >> 8)  & 0xFF))
00039      && (buf[2] == ((BINARY_DETECTION >> 16) & 0xFF))
00040      && (buf[3] == ((BINARY_DETECTION >> 24) & 0xFF))) {
00041         return 1;
00042     } else {
00043         return 0;
00044     }
00045 }
00046 
00047 static uint8_t validate_hexfile_rza(const uint8_t *buf)
00048 {
00049     return 0;
00050 }
00051 
00052 const target_family_descriptor_t g_renesas_family = {
00053     .family_id  = kRenesas_FamilyID,
00054     .target_set_state = target_set_state_rza,
00055     .validate_bin_nvic = validate_bin_nvic_rza,
00056     .validate_hexfile = validate_hexfile_rza,
00057 };
00058