Skip to content

Commit a17524c

Browse files
author
Marian Savchuk
committed
expand DAPLink Vendor Command IDs to range 0xA0U-0xFEU
1 parent e51b506 commit a17524c

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

source/daplink/cmsis-dap/DAP.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/*
22
* Copyright (c) 2013-2017 ARM Limited. All rights reserved.
3+
* Copyright 2019, Cypress Semiconductor Corporation
4+
* or a subsidiary of Cypress Semiconductor Corporation.
35
*
46
* SPDX-License-Identifier: Apache-2.0
57
*
@@ -1616,6 +1618,16 @@ __WEAK uint32_t DAP_ProcessVendorCommand(const uint8_t *request, uint8_t *respon
16161618
return ((1U << 16) | 1U);
16171619
}
16181620

1621+
// Process DAP Vendor extended command request and prepare response
1622+
// Default function (can be overridden)
1623+
// request: pointer to request data
1624+
// response: pointer to response data
1625+
// return: number of bytes in response (lower 16 bits)
1626+
// number of bytes in request (upper 16 bits)
1627+
__weak uint32_t DAP_ProcessVendorCommandEx(const uint8_t *request, uint8_t *response) {
1628+
*response = ID_DAP_Invalid;
1629+
return ((1U << 16) | 1U);
1630+
}
16191631

16201632
// Process DAP command request and prepare response
16211633
// request: pointer to request data
@@ -1629,6 +1641,10 @@ uint32_t DAP_ProcessCommand(const uint8_t *request, uint8_t *response) {
16291641
return DAP_ProcessVendorCommand(request, response);
16301642
}
16311643

1644+
if ((*request >= ID_DAP_VendorExFirst) && (*request <= ID_DAP_VendorExLast)) {
1645+
return DAP_ProcessVendorCommandEx(request, response);
1646+
}
1647+
16321648
*response++ = *request;
16331649

16341650
switch (*request++) {

source/daplink/cmsis-dap/DAP.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/*
22
* Copyright (c) 2013-2019 ARM Limited. All rights reserved.
3+
* Copyright 2019, Cypress Semiconductor Corporation
4+
* or a subsidiary of Cypress Semiconductor Corporation.
35
*
46
* SPDX-License-Identifier: Apache-2.0
57
*
@@ -101,6 +103,11 @@
101103
#define ID_DAP_Vendor30 0x9EU
102104
#define ID_DAP_Vendor31 0x9FU
103105

106+
// DAP Extended range of Vendor Command IDs
107+
108+
#define ID_DAP_VendorExFirst 0xA0U
109+
#define ID_DAP_VendorExLast 0xFEU
110+
104111
#define ID_DAP_Invalid 0xFFU
105112

106113
// DAP Status Code

0 commit comments

Comments
 (0)