Device Agent Protocol (DAP) API
Module: AI libraries
Structures
Name |
|
|---|---|
struct |
Dap_PipelineConfigType |
struct |
Dap_InterfaceConfigType |
struct |
Dap_StreamingContextType |
struct |
Dap_InitParamsType |
struct |
Dap_InstanceType |
Types
Name |
|
|---|---|
enum |
Dap_PipelineModeType { DAP_PIPELINE_MODE_UNINITIALIZED = 0x00U, DAP_PIPELINE_MODE_DATA_ACQUISITION = 0x01U, DAP_PIPELINE_MODE_SENSOR_INFERENCE = 0x02U, DAP_PIPELINE_MODE_HOST_INFERENCE = 0x03U, DAP_PIPELINE_MODE_LOOPBACK = 0x04U} |
enum |
Dap_DataChannelType { DAP_DATA_CHANNEL_SENSOR_SIGNAL = DAP_CHANNEL_SENSOR_SIGNAL, DAP_DATA_CHANNEL_INF_SIGNAL = DAP_CHANNEL_INF_SIGNAL, DAP_DATA_CHANNEL_INF_RESULT = DAP_CHANNEL_INF_RESULT, DAP_DATA_CHANNEL_INF_VALUE = DAP_CHANNEL_INF_VALUE, DAP_DATA_CHANNEL_INF_LOG = DAP_CHANNEL_INF_LOG} |
Functions
Name |
|
|---|---|
Dap_InitParamsSetDefault(Dap_InitParamsType * paramsPtr) |
|
Dap_Init(Dap_InstanceType * instancePtr, const Dap_InitParamsType * paramsPtr) |
|
Dap_Open(Dap_InstanceType * instancePtr) |
|
Dap_Process(Dap_InstanceType * instancePtr) |
|
Dap_StartSensorStream(Dap_InstanceType * instancePtr, const uint16 * sampleSizesBytesPtr, uint32 sampleSizesCount, uint32 totalSamples, Dap_DataChannelType channel) |
|
Dap_StreamSensorSample(Dap_InstanceType * instancePtr, uint8 sensorIndex, const uint8 * dataPtr, uint32 sizeInBytes) |
|
Dap_StopSensorStream(Dap_InstanceType * instancePtr) |
|
Dap_IsStreaming(const Dap_InstanceType * instancePtr, boolean * isStreamingPtr) |
|
Dap_IsFrameReady(const Dap_InstanceType * instancePtr, boolean * isFrameReadyPtr) |
|
Dap_GetPipelineConfig(const Dap_InstanceType * instancePtr, Dap_PipelineConfigType * configPtr) |
|
Dap_DeInit(Dap_InstanceType * instancePtr) |
|
void |
Dap_ReceiveCallback(Uart_Hal_InstanceType * instancePtr, Uart_Hal_RxStatusType * statusPtr, void * userArgsPtr) |
void |
Dap_TransmitCallback(Uart_Hal_InstanceType * instancePtr, Uart_Hal_TxStatusType * statusPtr, void * userArgsPtr) |
Defines
Name |
|
|---|---|
DAP_ERROR_NONE |
|
DAP_ERROR_INVALID_INSTANCE |
|
DAP_ERROR_INVALID_PARAMS |
|
DAP_ERROR_NOT_INITIALIZED |
|
DAP_ERROR_INVALID_START_BYTE |
|
DAP_ERROR_INVALID_END_BYTE |
|
DAP_ERROR_INVALID_CRC |
|
DAP_ERROR_INVALID_PAYLOAD |
|
DAP_ERROR_BUFFER_OVERFLOW |
|
DAP_ERROR_HW_BUSY |
|
DAP_ERROR_LINK_TIMEOUT |
|
DAP_ERROR_UNSUPPORTED_MODE |
|
DAP_ERROR_NOT_STREAMING |
|
DAP_ERROR_STREAM_NOT_STARTED |
|
DAP_ERROR_INVALID_SENSOR_INDEX |
Detailed Description
Device Agent Protocol (DAP) for Edge AI Studio communication.
The DAP component provides a communication interface between Edge AI Studio (host) and TI devices (target) for data acquisition and sensor streaming.
Types Documentation
enum Dap_PipelineModeType
Enumerator |
Value |
Description |
|---|---|---|
DAP_PIPELINE_MODE_UNINITIALIZED |
0x00U |
Pipeline not yet initialized |
DAP_PIPELINE_MODE_DATA_ACQUISITION |
0x01U |
Data acquisition mode |
DAP_PIPELINE_MODE_SENSOR_INFERENCE |
0x02U |
Sensor inference mode |
DAP_PIPELINE_MODE_HOST_INFERENCE |
0x03U |
Host inference mode |
DAP_PIPELINE_MODE_LOOPBACK |
0x04U |
Loopback mode |
Pipeline mode enumeration.
Defines the operating mode for the data pipeline.
enum Dap_DataChannelType
Enumerator |
Value |
Description |
|---|---|---|
DAP_DATA_CHANNEL_SENSOR_SIGNAL |
DAP_CHANNEL_SENSOR_SIGNAL |
Sensor signal data channel |
DAP_DATA_CHANNEL_INF_SIGNAL |
DAP_CHANNEL_INF_SIGNAL |
Inference signal data channel |
DAP_DATA_CHANNEL_INF_RESULT |
DAP_CHANNEL_INF_RESULT |
Inference result data channel |
DAP_DATA_CHANNEL_INF_VALUE |
DAP_CHANNEL_INF_VALUE |
Inference value data channel |
DAP_DATA_CHANNEL_INF_LOG |
DAP_CHANNEL_INF_LOG |
Inference log data channel |
Data channel type for streaming.
Identifies the data channel for streaming operations. Maps to [Dap_Core_DataChannels] values.
Functions Documentation
function Dap_InitParamsSetDefault
sint32 Dap_InitParamsSetDefault(
Dap_InitParamsType * paramsPtr
)
Set default initialization parameters.
Parameters:
paramsPtr Pointer to initialization parameters structure
Return: DAP_ERROR_NONE on success, positive error code on failure
Sets all fields in the initialization parameters structure to default values. Application should call this before modifying specific fields.
function Dap_Init
sint32 Dap_Init(
Dap_InstanceType * instancePtr,
const Dap_InitParamsType * paramsPtr
)
Initialize DAP instance.
Parameters:
instancePtr Pointer to DAP instance structure
paramsPtr Pointer to initialization parameters
Return: DAP_ERROR_NONE on success, positive error code on failure
Initializes all DAP layers (link, core, interface) and prepares for communication with the host. The communication hardware is initialized internally by the link layer.
function Dap_Open
sint32 Dap_Open(
Dap_InstanceType * instancePtr
)
Start DAP instance.
Parameters:
instancePtr Pointer to DAP instance structure
Return: DAP_ERROR_NONE on success, positive error code on failure
Start receiving incoming frames from host. Dap_Init must be called prior to calling this function
function Dap_Process
sint32 Dap_Process(
Dap_InstanceType * instancePtr
)
Process DAP communication.
Parameters:
instancePtr Pointer to DAP instance
Return: DAP_ERROR_NONE on success, positive error code on failure
Main processing function to be called in the application’s main loop. Checks for received commands, processes them, and sends responses.
function Dap_StartSensorStream
sint32 Dap_StartSensorStream(
Dap_InstanceType * instancePtr,
const uint16 * sampleSizesBytesPtr,
uint32 sampleSizesCount,
uint32 totalSamples,
Dap_DataChannelType channel
)
Start continuous sensor streaming.
Parameters:
instancePtr Pointer to DAP instance
sampleSizesBytesPtr Array of sample sizes in bytes per sensor (indexed by sensor slot)
sampleSizesCount Number of elements in sampleSizesBytesPtr array
totalSamples Total number of samples to stream
channel Data channel to stream on (Dap_DataChannelType)
Return: DAP_ERROR_NONE on success, positive error code on failure
Initializes the streaming context, resets sequence numbers, and sends the stream header. After calling this function, use Dap_StreamSensorSample() to send individual sensor samples without per-packet framing.
function Dap_StreamSensorSample
sint32 Dap_StreamSensorSample(
Dap_InstanceType * instancePtr,
uint8 sensorIndex,
const uint8 * dataPtr,
uint32 sizeInBytes
)
Stream a single sensor sample.
Parameters:
instancePtr Pointer to DAP instance
sensorIndex Index into pipeline sensor configuration (0-based)
dataPtr Pointer to sensor sample data
sizeInBytes Size of sample data in bytes
Return: DAP_ERROR_NONE on success, positive error code on failure
Sends a sensor sample in continuous streaming mode. The sample is sent without per-packet framing. Sequence header is sent per-sample if DAP_INTERFACE_USE_SEQUENCE_HEADERS is enabled. Must call Dap_StartSensorStream() first.
function Dap_StopSensorStream
sint32 Dap_StopSensorStream(
Dap_InstanceType * instancePtr
)
Stop continuous sensor streaming.
Parameters:
instancePtr Pointer to DAP instance
Return: DAP_ERROR_NONE on success, positive error code on failure
Sends the stream end byte and resets the streaming context.
function Dap_IsStreaming
sint32 Dap_IsStreaming(
const Dap_InstanceType * instancePtr,
boolean * isStreamingPtr
)
Check if streaming is active.
Parameters:
instancePtr Pointer to DAP instance
isStreamingPtr Pointer to store streaming status
Return: DAP_ERROR_NONE on success, positive error code on failure
function Dap_IsFrameReady
sint32 Dap_IsFrameReady(
const Dap_InstanceType * instancePtr,
boolean * isFrameReadyPtr
)
Check if command frame is ready to process.
Parameters:
instancePtr Pointer to DAP instance
isFrameReadyPtr Pointer to store frame ready status
Return: DAP_ERROR_NONE on success, positive error code on failure
function Dap_GetPipelineConfig
sint32 Dap_GetPipelineConfig(
const Dap_InstanceType * instancePtr,
Dap_PipelineConfigType * configPtr
)
Get current pipeline configuration.
Parameters:
instancePtr Pointer to DAP instance
configPtr Pointer to store pipeline configuration
Return: DAP_ERROR_NONE on success, positive error code on failure
function Dap_DeInit
sint32 Dap_DeInit(
Dap_InstanceType * instancePtr
)
De-initialize DAP instance.
Parameters:
instancePtr Pointer to DAP instance
Return: DAP_ERROR_NONE on success, positive error code on failure
Stops any active streaming, de-initializes all layers, and releases resources.
function Dap_ReceiveCallback
void Dap_ReceiveCallback(
Uart_Hal_InstanceType * instancePtr,
Uart_Hal_RxStatusType * statusPtr,
void * userArgsPtr
)
UART receive completion callback.
Parameters:
instancePtr Pointer to UART HAL instance (from callback)
statusPtr Pointer to RX status structure (from callback)
userArgsPtr User arguments pointer (points to DAP link instance)
This function must be invoked in UART HAL RX complete callback It continues the DAP frame reception state machine by calling Dap_Link_ContinueReceive.
function Dap_TransmitCallback
void Dap_TransmitCallback(
Uart_Hal_InstanceType * instancePtr,
Uart_Hal_TxStatusType * statusPtr,
void * userArgsPtr
)
UART transmit completion callback.
Parameters:
instancePtr Pointer to UART HAL instance (from callback)
statusPtr Pointer to TX status structure (from callback)
userArgsPtr User arguments pointer (points to DAP link instance)
This function must be invoked in UART HAL TX complete callback It updates the DAP link layer transmit state by calling Dap_Link_ContinueTransmit.
Macros Documentation
define DAP_ERROR_NONE
#define DAP_ERROR_NONE (0)
No error.
define DAP_ERROR_INVALID_INSTANCE
#define DAP_ERROR_INVALID_INSTANCE (1)
Invalid instance pointer.
define DAP_ERROR_INVALID_PARAMS
#define DAP_ERROR_INVALID_PARAMS (2)
Invalid parameters.
define DAP_ERROR_NOT_INITIALIZED
#define DAP_ERROR_NOT_INITIALIZED (3)
Not initialized.
define DAP_ERROR_INVALID_START_BYTE
#define DAP_ERROR_INVALID_START_BYTE (10)
Frame start byte incorrect.
define DAP_ERROR_INVALID_END_BYTE
#define DAP_ERROR_INVALID_END_BYTE (11)
Frame end byte incorrect.
define DAP_ERROR_INVALID_CRC
#define DAP_ERROR_INVALID_CRC (12)
Frame CRC mismatch.
define DAP_ERROR_INVALID_PAYLOAD
#define DAP_ERROR_INVALID_PAYLOAD (13)
Frame payload malformed.
define DAP_ERROR_BUFFER_OVERFLOW
#define DAP_ERROR_BUFFER_OVERFLOW (14)
Buffer overflow.
define DAP_ERROR_HW_BUSY
#define DAP_ERROR_HW_BUSY (20)
Hardware busy.
define DAP_ERROR_LINK_TIMEOUT
#define DAP_ERROR_LINK_TIMEOUT (21)
Transfer timeout.
define DAP_ERROR_UNSUPPORTED_MODE
#define DAP_ERROR_UNSUPPORTED_MODE (22)
Unsupported operation mode.
define DAP_ERROR_NOT_STREAMING
#define DAP_ERROR_NOT_STREAMING (30)
Streaming not active.
define DAP_ERROR_STREAM_NOT_STARTED
#define DAP_ERROR_STREAM_NOT_STARTED (31)
Stream not started - header not sent yet.
define DAP_ERROR_INVALID_SENSOR_INDEX
#define DAP_ERROR_INVALID_SENSOR_INDEX (32)
Invalid sensor index.