EDGEAI API

DAP_core.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2025, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifndef ti_edgeai_DAP_core__include
34 #define ti_edgeai_DAP_core__include
35
36 #include <stdint.h>
37 #include <stdbool.h>
38 #include <string.h>
39
40 #include <ti/ai/edge_ai/dap/DAP.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 #define DAP_MAX_FRAME_SIZE_BYTES (200)
47
48 typedef struct
49 {
51 uint8_t buffer[DAP_MAX_FRAME_SIZE_BYTES];
52
54 size_t length;
55
57 uint8_t index;
58 } DAP_Frame;
59
63 typedef enum
64 {
66 DAP_ERROR_TYPE_NONE = 0x00,
68 DAP_ERROR_TYPE_MISMATCH_START_BYTE = 0xE1,
70 DAP_ERROR_TYPE_MISMATCH_END_BYTE = 0xE2,
72 DAP_ERROR_TYPE_ADDR_RANGE = 0xE3,
74 DAP_ERROR_TYPE_MISMATCH_CRC = 0xE4,
76 DAP_ERROR_TYPE_MISMATCH_TARGET_ADDR = 0xE5
77 } DAP_ErrorType;
78
85 typedef enum
86 {
88 DAP_ERROR_COMMAND = 0x00,
90 DAP_GET_CAPABILITIES_COMMAND = 0x01,
92 DAP_LIST_SENSORS_COMMAND = 0x02,
94 DAP_CONFIGURE_PIPELINE_COMMAND = 0x03,
96 DAP_LIST_MODELS_COMMAND = 0x04,
98 DAP_REMOVE_MODEL_COMMAND = 0x05,
100 DAP_START_MODEL_UPLOAD_COMMAND = 0x06,
102 DAP_END_MODEL_UPLOAD_COMMAND = 0x07,
104 DAP_START_STREAMING_COMMAND = 0x08,
106 DAP_STOP_STREAMING_COMMAND = 0x09,
108 DAP_LIST_INFERENCING_VALUES_COMMAND = 0x0a,
109 // reserved1 = 0x0b,
111 DAP_READ_PROPERTY_COMMAND = 0x0c,
113 DAP_WRITE_PROPERTY_COMMAND = 0x0d,
115 DAP_LIST_PROPERTIES_COMMAND = 0x0e,
117 DAP_SEND_DATA_COMMAND = 0x10,
119 DAP_RECEIVE_DATA_COMMAND = 0x10,
120 } DAP_CommandType;
121
126 typedef enum
127 {
129 DAP_GET_CAPABILITIES_CMD_FIXED_LENGHT = 0,
131 DAP_LIST_SENSORS_FIXED_CMD_LENGHT = 0,
133 DAP_CONFIGURE_PIPELINE_CMD_FIXED_LENGHT = 2,
135 DAP_LIST_MODELS_CMD_FIXED_LENGHT = 0,
137 DAP_REMOVE_MODEL_CMD_FIXED_LENGTH = 1,
139 DAP_START_MODEL_UPLOAD_CMD_FIXED_LENGTH = 0,
141 DAP_END_MODEL_UPLOAD_CMD_FIXED_LENGTH = 4,
143 DAP_START_STREAMING_CMD_FIXED_LENGHT = 0,
145 DAP_STOP_STREAMING_CMD_FIXED_LENGHT = 0,
147 DAP_LIST_INFERENCING_VALUES_CMD_FIXED_LENGTH = 0,
149 DAP_READ_PROPERTY_CMD_FIXED_LENGHT = 1,
151 DAP_WRITE_PROPERTY_CMD_FIXED_LENGHT = 1,
153 DAP_LIST_PROPERTIES_CMD_FIXED_LENGHT = 0,
155 DAP_DATA_CMD_FIXED_LENGTH = 0
156 } DAP_CommandPayloadFixedLength;
157
162 typedef enum
163 {
165 DAP_ERROR_FIXED_LENGHT = 2,
167 DAP_GET_CAPABILITIES_FIXED_LENGHT = 4,
169 DAP_LIST_SENSORS_FIXED_LENGHT = 2,
171 DAP_CONFIGURE_PIPELINE_FIXED_LENGHT = 0,
173 DAP_LIST_MODELS_FIXED_LENGHT = 2,
175 DAP_REMOVE_MODEL_FIXED_LENGTH = 0,
177 DAP_START_MODEL_UPLOAD_FIXED_LENGTH = 0,
179 DAP_END_MODEL_UPLOAD_FIXED_LENGTH = 0,
181 DAP_START_STREAMING_FIXED_LENGHT = 0,
183 DAP_STOP_STREAMING_FIXED_LENGHT = 0,
185 DAP_LIST_INFERENCING_VALUES_FIXED_LENGTH = 3,
187 DAP_READ_PROPERTY_FIXED_LENGHT = 1,
189 DAP_WRITE_PROPERTY_FIXED_LENGHT = 1,
191 DAP_LIST_PROPERTIES_FIXED_LENGHT = 3,
193 DAP_DATA_FIXED_LENGTH = 0
194 } DAP_ResponsePayloadFixedLength;
195
199 typedef enum
200 {
202 DAP_DATA_TYPE_INT8 = 0x01,
204 DAP_DATA_TYPE_INT16 = 0x02,
206 DAP_DATA_TYPE_INT32 = 0x03,
208 DAP_DATA_TYPE_UINT8 = 0x04,
210 DAP_DATA_TYPE_UINT16 = 0x05,
212 DAP_DATA_TYPE_UINT32 = 0x06,
214 DAP_DATA_TYPE_FLOAT16 = 0x07,
216 DAP_DATA_TYPE_FLOAT32 = 0x08,
218 DAP_DATA_TYPE_FLOAT64 = 0x09,
219 } DAP_DataTypes;
220
224 typedef struct
225 {
226 const char *name;
227 DAP_DataTypes dataFormat;
228 union
229 {
230 uint8_t u8;
231 uint16_t u16;
232 uint32_t u32;
233 int8_t i8;
234 int16_t i16;
235 int32_t i32;
236 float f16;
237 float f32;
238 double f64;
239 } value;
240 } DAP_Property;
241
242 typedef struct
243 {
244 const char *info;
245 DAP_DataTypes dataFormat;
246 } DAP_Inference;
247
257 DAP_ErrorType DAP_verifyFrame(DAP_Frame *frame);
258
269 void DAP_serviceCommand(DAP_Handle *dapHandle, DAP_Frame *commandFrame);
270
285 void DAP_sendError(DAP_Handle *dapHandle, DAP_CommandType command, const char errorMessage[]);
286
300 void DAP_receiveDataCommand(DAP_Handle *dapHandle, DAP_SendDataType sendDataType, void *data, size_t dataSize);
301
302 #ifdef __cplusplus
303 }
304 #endif
305 #endif /* ti_edgeai_DAP_core__include */
DAP_DATA_TYPE_INT16
Definition: DAP_core.h:204
DAP_WRITE_PROPERTY_COMMAND
Definition: DAP_core.h:113
DAP_START_MODEL_UPLOAD_CMD_FIXED_LENGTH
Definition: DAP_core.h:139
DAP_ERROR_TYPE_MISMATCH_START_BYTE
Definition: DAP_core.h:68
DAP_Property
Data Types for the inferences and properties.
Definition: DAP_core.h:224
DAP_Property::u16
uint16_t u16
Definition: DAP_core.h:231
DAP_sendError
void DAP_sendError(DAP_Handle *dapHandle, DAP_CommandType command, const char errorMessage[])
Send error to host.
DAP_CommandPayloadFixedLength
DAP_CommandPayloadFixedLength
Minimum payload length of commands sent from the host to the target.
Definition: DAP_core.h:126
DAP_CONFIGURE_PIPELINE_CMD_FIXED_LENGHT
Definition: DAP_core.h:133
DAP_Inference::dataFormat
DAP_DataTypes dataFormat
Definition: DAP_core.h:245
DAP_Handle
DAP configuration.
Definition: DAP.h:156
DAP_STOP_STREAMING_CMD_FIXED_LENGHT
Definition: DAP_core.h:145
DAP_DATA_TYPE_FLOAT32
Definition: DAP_core.h:216
DAP_DATA_TYPE_INT32
Definition: DAP_core.h:206
DAP_LIST_INFERENCING_VALUES_COMMAND
Definition: DAP_core.h:108
DAP_READ_PROPERTY_COMMAND
Definition: DAP_core.h:111
DAP_ERROR_FIXED_LENGHT
Definition: DAP_core.h:165
DAP_GET_CAPABILITIES_CMD_FIXED_LENGHT
Definition: DAP_core.h:129
DAP_LIST_MODELS_FIXED_LENGHT
Definition: DAP_core.h:173
DAP_WRITE_PROPERTY_FIXED_LENGHT
Definition: DAP_core.h:189
DAP_REMOVE_MODEL_COMMAND
Definition: DAP_core.h:98
DAP_ERROR_TYPE_ADDR_RANGE
Definition: DAP_core.h:72
DAP_DATA_TYPE_UINT8
Definition: DAP_core.h:208
DAP_SendDataType
DAP_SendDataType
Definition: DAP.h:171
DAP_Frame::index
uint8_t index
Definition: DAP_core.h:57
DAP_LIST_PROPERTIES_COMMAND
Definition: DAP_core.h:115
DAP_CommandType
DAP_CommandType
DAP command types.
Definition: DAP_core.h:85
DAP_ERROR_TYPE_MISMATCH_END_BYTE
Definition: DAP_core.h:70
DAP_DATA_FIXED_LENGTH
Definition: DAP_core.h:193
DAP_LIST_PROPERTIES_CMD_FIXED_LENGHT
Definition: DAP_core.h:153
DAP_END_MODEL_UPLOAD_CMD_FIXED_LENGTH
Definition: DAP_core.h:141
DAP_ErrorType
DAP_ErrorType
DAP error types.
Definition: DAP_core.h:63
DAP_verifyFrame
DAP_ErrorType DAP_verifyFrame(DAP_Frame *frame)
Verify a frame.
DAP_Property::i8
int8_t i8
Definition: DAP_core.h:233
DAP_REMOVE_MODEL_FIXED_LENGTH
Definition: DAP_core.h:175
DAP_ResponsePayloadFixedLength
DAP_ResponsePayloadFixedLength
Minimum payload length of commands sent from the target to the host.
Definition: DAP_core.h:162
DAP_GET_CAPABILITIES_COMMAND
Definition: DAP_core.h:90
DAP_LIST_INFERENCING_VALUES_FIXED_LENGTH
Definition: DAP_core.h:185
DAP_LIST_SENSORS_COMMAND
Definition: DAP_core.h:92
DAP_LIST_PROPERTIES_FIXED_LENGHT
Definition: DAP_core.h:191
DAP_Property::f32
float f32
Definition: DAP_core.h:237
DAP_Property::name
const char * name
Definition: DAP_core.h:226
DAP_WRITE_PROPERTY_CMD_FIXED_LENGHT
Definition: DAP_core.h:151
DAP_Property::f64
double f64
Definition: DAP_core.h:238
DAP_Frame::length
size_t length
Definition: DAP_core.h:54
DAP_Property::i16
int16_t i16
Definition: DAP_core.h:234
DAP_Property::u8
uint8_t u8
Definition: DAP_core.h:230
DAP_MAX_FRAME_SIZE_BYTES
#define DAP_MAX_FRAME_SIZE_BYTES
Definition: DAP_core.h:46
DAP_Inference
Definition: DAP_core.h:242
DAP_LIST_MODELS_COMMAND
Definition: DAP_core.h:96
DAP_CONFIGURE_PIPELINE_FIXED_LENGHT
Definition: DAP_core.h:171
DAP_STOP_STREAMING_COMMAND
Definition: DAP_core.h:106
DAP_READ_PROPERTY_FIXED_LENGHT
Definition: DAP_core.h:187
DAP_DATA_TYPE_FLOAT64
Definition: DAP_core.h:218
DAP_REMOVE_MODEL_CMD_FIXED_LENGTH
Definition: DAP_core.h:137
DAP.h
PRELIMINARY DAP for EdgeAI
DAP_START_STREAMING_COMMAND
Definition: DAP_core.h:104
DAP_START_MODEL_UPLOAD_FIXED_LENGTH
Definition: DAP_core.h:177
DAP_DATA_TYPE_UINT16
Definition: DAP_core.h:210
DAP_Property::f16
float f16
Definition: DAP_core.h:236
DAP_DATA_CMD_FIXED_LENGTH
Definition: DAP_core.h:155
DAP_DATA_TYPE_FLOAT16
Definition: DAP_core.h:214
DAP_Frame
Definition: DAP_core.h:48
DAP_END_MODEL_UPLOAD_FIXED_LENGTH
Definition: DAP_core.h:179
DAP_GET_CAPABILITIES_FIXED_LENGHT
Definition: DAP_core.h:167
DAP_serviceCommand
void DAP_serviceCommand(DAP_Handle *dapHandle, DAP_Frame *commandFrame)
Service a command sent by the host.
DAP_receiveDataCommand
void DAP_receiveDataCommand(DAP_Handle *dapHandle, DAP_SendDataType sendDataType, void *data, size_t dataSize)
Send data to host.
DAP_Property::i32
int32_t i32
Definition: DAP_core.h:235
DAP_Inference::info
const char * info
Definition: DAP_core.h:244
DAP_READ_PROPERTY_CMD_FIXED_LENGHT
Definition: DAP_core.h:149
DAP_LIST_SENSORS_FIXED_CMD_LENGHT
Definition: DAP_core.h:131
DAP_ERROR_TYPE_MISMATCH_CRC
Definition: DAP_core.h:74
DAP_Property::dataFormat
DAP_DataTypes dataFormat
Definition: DAP_core.h:227
DAP_END_MODEL_UPLOAD_COMMAND
Definition: DAP_core.h:102
DAP_DATA_TYPE_INT8
Definition: DAP_core.h:202
DAP_DATA_TYPE_UINT32
Definition: DAP_core.h:212
DAP_STOP_STREAMING_FIXED_LENGHT
Definition: DAP_core.h:183
DAP_START_MODEL_UPLOAD_COMMAND
Definition: DAP_core.h:100
DAP_RECEIVE_DATA_COMMAND
Definition: DAP_core.h:119
DAP_SEND_DATA_COMMAND
Definition: DAP_core.h:117
DAP_ERROR_COMMAND
Definition: DAP_core.h:88
DAP_ERROR_TYPE_NONE
Definition: DAP_core.h:66
DAP_START_STREAMING_FIXED_LENGHT
Definition: DAP_core.h:181
DAP_LIST_SENSORS_FIXED_LENGHT
Definition: DAP_core.h:169
DAP_DataTypes
DAP_DataTypes
Data Types for the inferences and properties.
Definition: DAP_core.h:199
DAP_LIST_INFERENCING_VALUES_CMD_FIXED_LENGTH
Definition: DAP_core.h:147
DAP_START_STREAMING_CMD_FIXED_LENGHT
Definition: DAP_core.h:143
DAP_LIST_MODELS_CMD_FIXED_LENGHT
Definition: DAP_core.h:135
DAP_Property::u32
uint32_t u32
Definition: DAP_core.h:232
DAP_CONFIGURE_PIPELINE_COMMAND
Definition: DAP_core.h:94
DAP_ERROR_TYPE_MISMATCH_TARGET_ADDR
Definition: DAP_core.h:76

© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale