DAP_vendor.c
1 /* 2 * Copyright (c) 2013-2017 ARM Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Licensed under the Apache License, Version 2.0 (the License); you may 7 * not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 * ---------------------------------------------------------------------- 19 * 20 * $Date: 1. December 2017 21 * $Revision: V2.0.0 22 * 23 * Project: CMSIS-DAP Source 24 * Title: DAP_vendor.c CMSIS-DAP Vendor Commands 25 * 26 *---------------------------------------------------------------------------*/ 27 28 #include "DAP_config.h" 29 #include "DAP.h" 30 31 //************************************************************************************************** 32 /** 33 \defgroup DAP_Vendor_Adapt_gr Adapt Vendor Commands 34 \ingroup DAP_Vendor_gr 35 @{ 36 37 The file DAP_vendor.c provides template source code for extension of a Debug Unit with 38 Vendor Commands. Copy this file to the project folder of the Debug Unit and add the 39 file to the MDK-ARM project under the file group Configuration. 40 */ 41 42 /** Process DAP Vendor Command and prepare Response Data 43 \param request pointer to request data 44 \param response pointer to response data 45 \return number of bytes in response (lower 16 bits) 46 number of bytes in request (upper 16 bits) 47 */ 48 uint32_t DAP_ProcessVendorCommand(const uint8_t *request, uint8_t *response) { 49 uint32_t num = (1U << 16) | 1U; 50 51 *response++ = *request; // copy Command ID 52 53 switch (*request++) { // first byte in request is Command ID 54 case ID_DAP_Vendor0: 55 #if 0 // example user command 56 num += 1U << 16; // increment request count 57 if (*request == 1U) { // when first command data byte is 1 58 *response++ = 'X'; // send 'X' as response 59 num++; // increment response count 60 } 61 #endif 62 break; 63 64 case ID_DAP_Vendor1: break; 65 case ID_DAP_Vendor2: break; 66 case ID_DAP_Vendor3: break; 67 case ID_DAP_Vendor4: break; 68 case ID_DAP_Vendor5: break; 69 case ID_DAP_Vendor6: break; 70 case ID_DAP_Vendor7: break; 71 case ID_DAP_Vendor8: break; 72 case ID_DAP_Vendor9: break; 73 case ID_DAP_Vendor10: break; 74 case ID_DAP_Vendor11: break; 75 case ID_DAP_Vendor12: break; 76 case ID_DAP_Vendor13: break; 77 case ID_DAP_Vendor14: break; 78 case ID_DAP_Vendor15: break; 79 case ID_DAP_Vendor16: break; 80 case ID_DAP_Vendor17: break; 81 case ID_DAP_Vendor18: break; 82 case ID_DAP_Vendor19: break; 83 case ID_DAP_Vendor20: break; 84 case ID_DAP_Vendor21: break; 85 case ID_DAP_Vendor22: break; 86 case ID_DAP_Vendor23: break; 87 case ID_DAP_Vendor24: break; 88 case ID_DAP_Vendor25: break; 89 case ID_DAP_Vendor26: break; 90 case ID_DAP_Vendor27: break; 91 case ID_DAP_Vendor28: break; 92 case ID_DAP_Vendor29: break; 93 case ID_DAP_Vendor30: break; 94 case ID_DAP_Vendor31: break; 95 } 96 97 return (num); 98 } 99 100 ///@}