![](/media/cache/group/arrow_temp_636x636.png.50x50_q85.png)
Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/daplink/cmsis-dap/DAP_queue.h@0:01f31e923fe2, 2020-04-07 (annotated)
- Committer:
- Pawel Zarembski
- Date:
- Tue Apr 07 12:55:42 2020 +0200
- Revision:
- 0:01f31e923fe2
hani: DAPLink with reset workaround
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pawel Zarembski |
0:01f31e923fe2 | 1 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * @file DAP_queue.h |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * @brief DAP processing queue |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * DAPLink Interface Firmware |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * Copyright (c) 2019, ARM Limited, All Rights Reserved |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * SPDX-License-Identifier: Apache-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * not use this file except in compliance with the License. |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * You may obtain a copy of the License at |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * Unless required by applicable law or agreed to in writing, software |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * See the License for the specific language governing permissions and |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * limitations under the License. |
Pawel Zarembski |
0:01f31e923fe2 | 20 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 21 | |
Pawel Zarembski |
0:01f31e923fe2 | 22 | #ifndef DAP_QUEUE_H |
Pawel Zarembski |
0:01f31e923fe2 | 23 | #define DAP_QUEUE_H |
Pawel Zarembski |
0:01f31e923fe2 | 24 | |
Pawel Zarembski |
0:01f31e923fe2 | 25 | #include "usb_def.h" |
Pawel Zarembski |
0:01f31e923fe2 | 26 | #include "DAP_config.h" |
Pawel Zarembski |
0:01f31e923fe2 | 27 | #include "DAP.h" |
Pawel Zarembski |
0:01f31e923fe2 | 28 | |
Pawel Zarembski |
0:01f31e923fe2 | 29 | #ifdef __cplusplus |
Pawel Zarembski |
0:01f31e923fe2 | 30 | extern "C" { |
Pawel Zarembski |
0:01f31e923fe2 | 31 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 32 | |
Pawel Zarembski |
0:01f31e923fe2 | 33 | #define FREE_COUNT_INIT (DAP_PACKET_COUNT) |
Pawel Zarembski |
0:01f31e923fe2 | 34 | #define SEND_COUNT_INIT 0 |
Pawel Zarembski |
0:01f31e923fe2 | 35 | |
Pawel Zarembski |
0:01f31e923fe2 | 36 | typedef struct _DAP_queue { |
Pawel Zarembski |
0:01f31e923fe2 | 37 | uint8_t USB_Request [DAP_PACKET_COUNT][DAP_PACKET_SIZE]; // Request Buffer |
Pawel Zarembski |
0:01f31e923fe2 | 38 | uint16_t resp_size[DAP_PACKET_COUNT]; //track the return response size |
Pawel Zarembski |
0:01f31e923fe2 | 39 | uint32_t free_count; |
Pawel Zarembski |
0:01f31e923fe2 | 40 | uint32_t send_count; |
Pawel Zarembski |
0:01f31e923fe2 | 41 | uint32_t recv_idx; |
Pawel Zarembski |
0:01f31e923fe2 | 42 | uint32_t send_idx; |
Pawel Zarembski |
0:01f31e923fe2 | 43 | } DAP_queue; |
Pawel Zarembski |
0:01f31e923fe2 | 44 | |
Pawel Zarembski |
0:01f31e923fe2 | 45 | void DAP_queue_init(DAP_queue * queue); |
Pawel Zarembski |
0:01f31e923fe2 | 46 | |
Pawel Zarembski |
0:01f31e923fe2 | 47 | /* |
Pawel Zarembski |
0:01f31e923fe2 | 48 | * Get the a buffer from the DAP_queue where the response to the request is stored |
Pawel Zarembski |
0:01f31e923fe2 | 49 | * Parameters: queue - DAP queue, buf = return the buffer location, len = return the len of the response |
Pawel Zarembski |
0:01f31e923fe2 | 50 | * Return Value: TRUE - Success, FALSE - Error |
Pawel Zarembski |
0:01f31e923fe2 | 51 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 52 | BOOL DAP_queue_get_send_buf(DAP_queue * queue, uint8_t ** buf, int * len); |
Pawel Zarembski |
0:01f31e923fe2 | 53 | |
Pawel Zarembski |
0:01f31e923fe2 | 54 | /* |
Pawel Zarembski |
0:01f31e923fe2 | 55 | * Execute a request and store result to the DAP_queue |
Pawel Zarembski |
0:01f31e923fe2 | 56 | * Parameters: queue - DAP queue, reqbuf = buffer with DAP request, len = of the request buffer, retbuf = buffer to peek on the result of the DAP operation |
Pawel Zarembski |
0:01f31e923fe2 | 57 | * Return Value: TRUE - Success, FALSE - Error |
Pawel Zarembski |
0:01f31e923fe2 | 58 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 59 | BOOL DAP_queue_execute_buf(DAP_queue * queue, const uint8_t *reqbuf, int len, uint8_t ** retbuf); |
Pawel Zarembski |
0:01f31e923fe2 | 60 | |
Pawel Zarembski |
0:01f31e923fe2 | 61 | #ifdef __cplusplus |
Pawel Zarembski |
0:01f31e923fe2 | 62 | } |
Pawel Zarembski |
0:01f31e923fe2 | 63 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 64 | |
Pawel Zarembski |
0:01f31e923fe2 | 65 | #endif |