EDGEAI API
DAP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2025-2026, Texas Instruments Incorporated
3  *
4  * All rights reserved not granted herein.
5  * Limited License.
6  *
7  * Texas Instruments Incorporated grants a world-wide, royalty-free,
8  * non-exclusive license under copyrights and patents it now or hereafter
9  * owns or controls to make, have made, use, import, offer to sell and sell
10  * ("Utilize") this software subject to the terms herein. With respect to the
11  * foregoing patent license, such license is granted solely to the extent that
12  * any such patent is necessary to Utilize the software alone. The patent
13  * license shall not apply to any combinations which include this software,
14  * other than combinations with devices manufactured by or for TI ("TI
15  * Devices"). No hardware patent is licensed hereunder.
16  *
17  * Redistributions must preserve existing copyright notices and reproduce
18  * this license (including the above copyright notice and the disclaimer and
19  * (if applicable) source code license limitations below) in the documentation
20  * and/or other materials provided with the distribution.
21  *
22  * Redistribution and use in binary form, without modification, are permitted
23  * provided that the following conditions are met:
24  *
25  * * No reverse engineering, decompilation, or disassembly of this software
26  * is permitted with respect to any software provided in binary form.
27  * * Any redistribution and use are licensed by TI for use only with TI Devices.
28  * * Nothing shall obligate TI to provide you with source code for the software
29  * licensed and provided to you in object code.
30  *
31  * If software source code is provided to you, modification and redistribution
32  * of the source code are permitted provided that the following conditions are
33  * met:
34  *
35  * * Any redistribution and use of the source code, including any resulting
36  * derivative works, are licensed by TI for use only with TI Devices.
37  * * Any redistribution and use of any object code compiled from the source
38  * code and any resulting derivative works, are licensed by TI for use
39  * only with TI Devices.
40  *
41  * Neither the name of Texas Instruments Incorporated nor the names of its
42  * suppliers may be used to endorse or promote products derived from this
43  * software without specific prior written permission.
44  *
45  * DISCLAIMER.
46  *
47  * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
48  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
49  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
50  * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
51  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
52  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
53  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
54  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
55  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
56  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57  */
58 /*!****************************************************************************
59  * @file DAP.h
60  * @brief <b>PRELIMINARY</b> DAP for EdgeAI
61  *
62  * <b>WARNING</b> These APIs are <b>PRELIMINARY</b>, and subject to change in
63  * the next few months.
64  *
65  * To use the DAP, include this header file in the application as follows:
66  * @code
67  * #include <ti/ai/edge_ai/DAP.h>
68  * @endcode
69  *
70  * @anchor ti_edgeai_DAP_Overview
71  * # Overview #
72  * The Device Agent Protocol (DAP) is a serial communication protocol using
73  * packets that facilitates interaction between Edge AI Studio (the host) and
74  * TI Microcontrollers (the target devices). This protocol is specifically
75  * designed to support edge AI applications.
76  *
77  * Communication follows a controller-responder model where the host initiates
78  * all transfers or commands, and the target device must acknowledge each
79  * command with a response. Depending on the command type, the target may send
80  * additional responses.
81  *
82  * Application execution is controlled by the host through a variety of
83  * commands. The application can be configured to operate in one of four
84  * distinct pipeline modes, as specified in the #DAP_PipelineMode enumeration.
85  *
86  * Configuration details specific to each pipeline mode are maintained in the
87  * #DAP_PipelineConfiguration structure. To retrieve this configuration
88  * information, the #DAP_getPipelineConfiguration() function can be utilized.
89  *
90  * Depending on the active operation mode, the host may request various types
91  * of data from the target device. The readiness for data streaming can be
92  * determined using the DAP_isReadyToStartStreaming function. When streaming is
93  * available, data transmission is performed via the #DAP_sendData() function.
94  * The #DAP_SendDataType enumeration defines the supported data types for
95  * transmission.
96  *
97  * # Design Architecture
98  * This protocol operates in duplex mode, enabling simultaneous transmission
99  * and reception of data packets. The implementation achieves this capability
100  * by separating functionality into dedicated RX (receiving) and TX
101  * (transmitting) tasks.
102  *
103  * The RX task is in charge of receiving the packets, decoding them and
104  * constructing the response packet. The response packet is then posted in a
105  * message queue shared with the TX task.
106  *
107  * The TX task is in charge of reading packets from the message queue and
108  * sending them over to the host through the transport layer.
109  *
110  * The transport layer utilizes a serial communication protocol, with its
111  * backend implementation located in the ti/ai/edge_ai/dap/core/DAP_core.h
112  * file.
113  *
114  * <hr>
115  * # Usage
116  * To use the DAP the application calls the following APIs:
117  * - DAP_init(): One time initialization of the DAP.
118  * - DAP_open(): Initializes the serial protocol, the message queue, and the
119  * RX and TX tasks.
120  *
121  ******************************************************************************
122  */
123 
124 #ifndef ti_edgeai_DAP__include
125 #define ti_edgeai_DAP__include
126 
127 #include <stdint.h>
128 #include <stdbool.h>
129 
130 #include <ti/drivers/UART2.h>
131 #include <ti/drivers/dpl/MessageQueueP.h>
132 
133 #ifdef __cplusplus
134 extern "C" {
135 #endif
136 
143 typedef enum
144 {
156 
163 typedef struct
164 {
165  /* Mode of operation. */
167  /* Index of the model to use for Sensor and Host Inferencing modes. */
169  /* Indices of the sensors to be used for Data Acquisition and Sensor
170  * Inferencing modes.
171  */
172  uint8_t inferenceSensorsIndex[10];
174 
182 typedef struct
183 {
185  UART2_Handle uartHandle;
186 
188  MessageQueueP_Handle messageQueueHandle;
189 
190  bool isCrc;
191 
193 
195 } DAP_Handle;
196 
197 typedef enum
198 {
211 
213 
221 float DAP_swapEndianness(float value);
222 
226 void DAP_init(void);
227 
233 void DAP_open(void);
234 
246 void DAP_openOnHandle(UART2_Handle handle);
247 
254 
260 uint32_t DAP_getSamplesToSend(void);
261 
267 uint32_t DAP_getSamplingFrequency(void);
268 
274 bool DAP_isReadyToStartStreaming(void);
275 
283 void DAP_clearStreamingFlag(void);
284 
294 void DAP_sendData(DAP_SendDataType sendDataType, void *data, size_t dataSize);
295 
296 #ifdef __cplusplus
297 }
298 #endif
299 #endif /* ti_edgeai_DAP__include */
float DAP_swapEndianness(float value)
Swap Endianess value to support the endianess format expected by EdgeAI Studio.
DAP_PipelineMode
DAP pipeline modes.
Definition: DAP.h:143
uint32_t DAP_getSamplingFrequency(void)
Get samplign frequency.
DAP configuration.
Definition: DAP.h:182
UART2_Handle uartHandle
Definition: DAP.h:185
MessageQueueP_Handle messageQueueHandle
Definition: DAP.h:188
DAP_PipelineConfiguration DAP_getPipelineConfiguration(void)
Get Pipeline Configuration.
DAP_SendDataType
Definition: DAP.h:197
void DAP_sendData(DAP_SendDataType sendDataType, void *data, size_t dataSize)
Send Data to host.
DAP_PipelineMode mode
Definition: DAP.h:166
Definition: DAP.h:146
DAP pipeline configuration.
Definition: DAP.h:163
void DAP_init(void)
Initialize the DAP.
uint8_t inferenceModelIndex
Definition: DAP.h:168
void DAP_open(void)
Open the DAP.
Definition: DAP.h:154
void DAP_openOnHandle(UART2_Handle handle)
Open the DAP on an already-open UART2 handle.
bool DAP_isReadyToStartStreaming(void)
Check if the DAP is ready for data streaming.
uint32_t DAP_getSamplesToSend(void)
Get samples to send.
DAP_PipelineConfiguration pipelineConfig
Definition: DAP.h:194
void DAP_clearStreamingFlag(void)
Clear the streaming flag after a one-shot data capture burst.
bool startStreamingFlag
Definition: DAP.h:192
bool isCrc
Definition: DAP.h:190
© Copyright 1995-2026, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale