Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
target_reset_lpc4088.c
00001 /** 00002 * @file target_reset.c 00003 * @brief Target reset for the lpc4088 00004 * 00005 * DAPLink Interface Firmware 00006 * Copyright (c) 2009-2019, 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 "gpio.h" 00024 #include "target_family.h" 00025 00026 #define PIN_ISPCTRL1 (1<<12) 00027 #define PIN_ISPCTRL2 (1<<15) 00028 00029 static void gpio_set_isp_pin(uint8_t state) { 00030 if (state) { 00031 // High => Both pins are inputs 00032 LPC_GPIO->DIR[0] &= ~(PIN_ISPCTRL1); 00033 LPC_GPIO->DIR[1] &= ~(PIN_ISPCTRL2); 00034 } else { 00035 // Low => Both pins are outputs with 0 00036 LPC_GPIO->CLR[0] = (PIN_ISPCTRL1); 00037 LPC_GPIO->CLR[1] = (PIN_ISPCTRL2); 00038 LPC_GPIO->DIR[0] |= (PIN_ISPCTRL1); 00039 LPC_GPIO->DIR[1] |= (PIN_ISPCTRL2); 00040 } 00041 } 00042 00043 static void prerun_target_config(void) 00044 { 00045 // Configure ISPCTRL as output and high 00046 // We use two ISP pins to cover different hardware versions 00047 LPC_IOCON->TMS_PIO0_12 |= 0x01; 00048 LPC_IOCON->PIO1_15 &= ~0x07; 00049 gpio_set_isp_pin(1); 00050 } 00051 00052 00053 static uint8_t lpc4088_target_set_state(target_state_t state) 00054 { 00055 //return swd_set_target_state_hw(state); 00056 uint8_t res; 00057 if (state == RESET_PROGRAM) 00058 { 00059 gpio_set_isp_pin(0); 00060 res = swd_set_target_state_hw(state); 00061 gpio_set_isp_pin(1); 00062 } 00063 else 00064 { 00065 gpio_set_isp_pin(1); 00066 res = swd_set_target_state_hw(state); 00067 } 00068 return res; 00069 } 00070 00071 const target_family_descriptor_t g_nxp_lpc4088 = { 00072 .family_id = VENDOR_TO_FAMILY(kNXP_VendorID, 0), //ID not maching the predefined family ids 00073 .prerun_target_config = prerun_target_config, 00074 .target_set_state = lpc4088_target_set_state, 00075 }; 00076 00077 const target_family_descriptor_t *g_target_family = &g_nxp_lpc4088; 00078
Generated on Tue Jul 12 2022 15:37:25 by
1.7.2