DAP_vendor.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. #include "DAP_config.h"
  28. #include "DAP.h"
  29. //**************************************************************************************************
  30. /**
  31. \defgroup DAP_Vendor_Adapt_gr Adapt Vendor Commands
  32. \ingroup DAP_Vendor_gr
  33. @{
  34. The file DAP_vendor.c provides template source code for extension of a Debug Unit with
  35. Vendor Commands. Copy this file to the project folder of the Debug Unit and add the
  36. file to the MDK-ARM project under the file group Configuration.
  37. */
  38. /** Process DAP Vendor Command and prepare Response Data
  39. \param request pointer to request data
  40. \param response pointer to response data
  41. \return number of bytes in response (lower 16 bits)
  42. number of bytes in request (upper 16 bits)
  43. */
  44. uint32_t DAP_ProcessVendorCommand(const uint8_t *request, uint8_t *response) {
  45. uint32_t num = (1U << 16) | 1U;
  46. *response++ = *request; // copy Command ID
  47. switch (*request++) { // first byte in request is Command ID
  48. case ID_DAP_Vendor0:
  49. #if 0 // example user command
  50. num += 1U << 16; // increment request count
  51. if (*request == 1U) { // when first command data byte is 1
  52. *response++ = 'X'; // send 'X' as response
  53. num++; // increment response count
  54. }
  55. #endif
  56. break;
  57. case ID_DAP_Vendor1: break;
  58. case ID_DAP_Vendor2: break;
  59. case ID_DAP_Vendor3: break;
  60. case ID_DAP_Vendor4: break;
  61. case ID_DAP_Vendor5: break;
  62. case ID_DAP_Vendor6: break;
  63. case ID_DAP_Vendor7: break;
  64. case ID_DAP_Vendor8: break;
  65. case ID_DAP_Vendor9: break;
  66. case ID_DAP_Vendor10: break;
  67. case ID_DAP_Vendor11: break;
  68. case ID_DAP_Vendor12: break;
  69. case ID_DAP_Vendor13: break;
  70. case ID_DAP_Vendor14: break;
  71. case ID_DAP_Vendor15: break;
  72. case ID_DAP_Vendor16: break;
  73. case ID_DAP_Vendor17: break;
  74. case ID_DAP_Vendor18: break;
  75. case ID_DAP_Vendor19: break;
  76. case ID_DAP_Vendor20: break;
  77. case ID_DAP_Vendor21: break;
  78. case ID_DAP_Vendor22: break;
  79. case ID_DAP_Vendor23: break;
  80. case ID_DAP_Vendor24: break;
  81. case ID_DAP_Vendor25: break;
  82. case ID_DAP_Vendor26: break;
  83. case ID_DAP_Vendor27: break;
  84. case ID_DAP_Vendor28: break;
  85. case ID_DAP_Vendor29: break;
  86. case ID_DAP_Vendor30: break;
  87. case ID_DAP_Vendor31: break;
  88. }
  89. return (num);
  90. }
  91. ///@}