EDGEAI API

Data Structures | Enumerations | Functions
DAP.h File Reference

## Detailed Description

PRELIMINARY DAP for EdgeAI

PRELIMINARY DAP interface

WARNING These APIs are PRELIMINARY, and subject to change in the next few months.

To use the DAP, include this header file in the application as follows:

#include <ti/ai/edge_ai/DAP.h>

# Overview

The Device Agent Protocol (DAP) is a serial communication protocol using packets that facilitates interaction between Edge AI Studio (the host) and TI Microcontrollers (the target devices). This protocol is specifically designed to support edge AI applications.

Communication follows a controller-responder model where the host initiates all transfers or commands, and the target device must acknowledge each command with a response. Depending on the command type, the target may send additional responses.

Application execution is controlled by the host through a variety of commands. The application can be configured to operate in one of four distinct pipeline modes, as specified in the DAP_PipelineMode enumeration.

Configuration details specific to each pipeline mode are maintained in the DAP_PipelineConfiguration structure. To retrieve this configuration information, the DAP_getPipelineConfiguration() function can be utilized.

Depending on the active operation mode, the host may request various types of data from the target device. The readiness for data streaming can be determined using the DAP_isReadyToStartStreaming function. When streaming is available, data transmission is performed via the DAP_sendData() function. The DAP_SendDataType enumeration defines the supported data types for transmission.

# Design Architecture

This protocol operates in duplex mode, enabling simultaneous transmission and reception of data packets. The implementation achieves this capability by separating functionality into dedicated RX (receiving) and TX (transmitting) tasks.

The RX task is in charge of receiving the packets, decoding them and constructing the response packet. The response packet is then posted in a message queue shared with the TX task.

The TX task is in charge of reading packets from the message queue and sending them over to the host through the transport layer.

The transport layer utilizes a serial communication protocol, with its backend implementation located in the ti/ai/edge_ai/dap/core/DAP_core.h file.

# Usage

To use the DAP the application calls the following APIs:

- DAP_init(): One time initialization of the DAP.
- DAP_open(): Initializes the serial protocol, the message queue, and the RX and TX tasks.

This file contains data from the application, to be modified by the user.

`#include <stdint.h>`
`#include <stdbool.h>`
`#include <ti/drivers/UART2.h>`
`#include <ti/drivers/dpl/MessageQueueP.h>`
Include dependency graph for DAP.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | DAP_PipelineConfiguration
| DAP pipeline configuration. More...
struct | DAP_Handle
| DAP configuration. More...

## Enumerations
enum | DAP_PipelineMode { DAP_PIPELINE_MODE_UNINITIALIZED = 0x00, DAP_PIPELINE_MODE_DATA_ACQUISITION = 0x01, DAP_PIPELINE_MODE_SENSOR_INFERENCING = 0x02, DAP_PIPELINE_MODE_HOST_INFERENCING = 0x03, DAP_PIPELINE_MODE_LOOPBACK = 0x04 }
| DAP pipeline modes. More...
enum | DAP_SendDataType { DAP_SEND_DATA_TYPE_SENSOR_SIGNAL = 0x01, DAP_SEND_DATA_TYPE_INFERENCING_SIGNAL = 0x03, DAP_SEND_DATA_TYPE_INFERENCING_RESULT = 0x04, DAP_SEND_DATA_TYPE_INFERENCING_VALUE = 0x05, DAP_SEND_DATA_TYPE_INFERENCING_LOG = 0x06 }

## Functions
float | DAP_swapEndianness (float value)
| Swap Endianess value to support the endianess format expected by EdgeAI Studio. More...
void | DAP_init (void)
| Initialize the DAP. More...
void | DAP_open (void)
| Open the DAP. More...
DAP_PipelineConfiguration | DAP_getPipelineConfiguration (void)
| Get Pipeline Configuration. More...
uint32_t | DAP_getSamplesToSend (void)
| Get samples to send. More...
uint32_t | DAP_getSamplingFrequency (void)
| Get samplign frequency. More...
bool | DAP_isReadyToStartStreaming (void)
| Check if the DAP is ready for data streaming. More...
void | DAP_sendData (DAP_SendDataType sendDataType, void *data, size_t dataSize)
| Send Data to host. More...

## Enumeration Type Documentation

## § DAP_PipelineMode

enum DAP_PipelineMode

DAP pipeline modes.

This enum defines the modes of operation for the application inferencing pipeline.

Enumerator
DAP_PIPELINE_MODE_UNINITIALIZED | Mode not yet initialized
DAP_PIPELINE_MODE_DATA_ACQUISITION | Real time data acquisition streaming from a sensor.
DAP_PIPELINE_MODE_SENSOR_INFERENCING | Real time inferencing streaming from a sensor.
DAP_PIPELINE_MODE_HOST_INFERENCING | Non-real time inferencing streaming from the host.
DAP_PIPELINE_MODE_LOOPBACK | Non-real time streaming data from the host back to the host.

## § DAP_SendDataType

enum DAP_SendDataType

Enumerator
DAP_SEND_DATA_TYPE_SENSOR_SIGNAL | Raw sensor output sent from target device to the host.
DAP_SEND_DATA_TYPE_INFERENCING_SIGNAL | Output signal from inferencing, same format as sensor signal data.
DAP_SEND_DATA_TYPE_INFERENCING_RESULT | The result from inferencing, like object detection regions or classification class.
DAP_SEND_DATA_TYPE_INFERENCING_VALUE | Inferencing values like average cpu usage, or inferencing time.
DAP_SEND_DATA_TYPE_INFERENCING_LOG | Textual log for displaying to the user during live demo.

## Function Documentation

## § DAP_swapEndianness()

float DAP_swapEndianness | ( | float | value | ) |

Swap Endianess value to support the endianess format expected by EdgeAI Studio.

Parameters

  [in] | value | Scalar float value to be modified.

## § DAP_init()

void DAP_init | ( | void |  | ) |

Initialize the DAP.

## § DAP_open()

void DAP_open | ( | void |  | ) |

Open the DAP.

Initialize the serial protocol, the message queue, and the RX and TX tasks.

## § DAP_getPipelineConfiguration()

DAP_PipelineConfiguration DAP_getPipelineConfiguration | ( | void |  | ) |

Get Pipeline Configuration.

Returns
  Returns a structure with the pipeline configuration

## § DAP_getSamplesToSend()

uint32_t DAP_getSamplesToSend | ( | void |  | ) |

Get samples to send.

Returns
  Returns the number of samples to send to the host

## § DAP_getSamplingFrequency()

uint32_t DAP_getSamplingFrequency | ( | void |  | ) |

Get samplign frequency.

Returns
  Returns the sampling frequency in hertz

## § DAP_isReadyToStartStreaming()

bool DAP_isReadyToStartStreaming | ( | void |  | ) |

Check if the DAP is ready for data streaming.

Returns
  Returns if the DAP is ready for data streaming

## § DAP_sendData()

void DAP_sendData | ( | DAP_SendDataType | sendDataType,
|  | void * | data,
|  | size_t | dataSize
| ) |  |

Send Data to host.

Parameters

  [in] | sendDataType | Type of the data sent
  [in] | data | pointer to a buffer with the data
  [in] | dataSize | size of the data buffer in bytes

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