DPU Host API  2025.1.0
dpu_checkpoint.h File Reference

C API to create and manage DPU checkpoints. More...

#include <dpu_error.h>
#include <dpu_types.h>
Include dependency graph for dpu_checkpoint.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DPU_CHECKPOINT_ALL
 Option for a DPU checkpoint to save the whole DPU state.
 

Typedefs

typedef enum _dpu_checkpoint_flags_t dpu_checkpoint_flags_t
 Options for a DPU checkpoint.
 

Enumerations

enum  _dpu_checkpoint_flags_t {
  DPU_CHECKPOINT_NONE = 0x0, DPU_CHECKPOINT_INTERNAL = 0x1, DPU_CHECKPOINT_IRAM = 0x2, DPU_CHECKPOINT_MRAM = 0x8,
  DPU_CHECKPOINT_WRAM = 0x10
}
 Options for a DPU checkpoint. More...
 

Functions

dpu_error_t dpu_checkpoint_save (struct dpu_set_t set, dpu_checkpoint_flags_t flags, struct dpu_context_t *context)
 Extracts the DPU state. More...
 
dpu_error_t dpu_checkpoint_restore (struct dpu_set_t set, dpu_checkpoint_flags_t flags, struct dpu_context_t *context)
 Restores a DPU state. More...
 
uint32_t dpu_checkpoint_get_serialized_context_size (struct dpu_context_t *context)
 Computes the size of the context once serialized. More...
 
dpu_error_t dpu_checkpoint_serialize (struct dpu_context_t *context, uint8_t **serialized_context, uint32_t *serialized_context_size)
 Serializes a DPU state. More...
 
dpu_error_t dpu_checkpoint_deserialize (const uint8_t *serialized_context, uint32_t serialized_context_size, struct dpu_context_t *context)
 Deserializes a DPU state. More...
 
dpu_error_t dpu_checkpoint_free (struct dpu_context_t *context)
 Free a DPU context allocated by dpu_checkpoint. More...
 

Detailed Description

C API to create and manage DPU checkpoints.

Enumeration Type Documentation

◆ _dpu_checkpoint_flags_t

Options for a DPU checkpoint.

Enumerator
DPU_CHECKPOINT_INTERNAL 

Saves the internal state of the DPU.

DPU_CHECKPOINT_IRAM 

Saves the Instruction RAM of the DPU.

DPU_CHECKPOINT_MRAM 

Saves the Main RAM of the DPU.

DPU_CHECKPOINT_WRAM 

Saves the Work RAM of the DPU.

Function Documentation

◆ dpu_checkpoint_deserialize()

dpu_error_t dpu_checkpoint_deserialize ( const uint8_t *  serialized_context,
uint32_t  serialized_context_size,
struct dpu_context_t context 
)

Deserializes a DPU state.

Parameters
serialized_contextthe serialized DPU state
serialized_context_sizethe number of bytes of the serialized DPU state
contextstorage for the DPU state
Returns
Whether the operation was successful.

◆ dpu_checkpoint_free()

dpu_error_t dpu_checkpoint_free ( struct dpu_context_t context)

Free a DPU context allocated by dpu_checkpoint.

Parameters
contextthe DPU context to free
Returns
Whether the operation was successful.

◆ dpu_checkpoint_get_serialized_context_size()

uint32_t dpu_checkpoint_get_serialized_context_size ( struct dpu_context_t context)

Computes the size of the context once serialized.

Parameters
contextthe DPU state to serialize
Returns
The serialized context size.

◆ dpu_checkpoint_restore()

dpu_error_t dpu_checkpoint_restore ( struct dpu_set_t  set,
dpu_checkpoint_flags_t  flags,
struct dpu_context_t context 
)

Restores a DPU state.

Parameters
setthe identifier of the DPU set (must be a single DPU)
flagsoptions on what to restore from the DPU state
contextthe DPU state to restore
Returns
Whether the operation was successful.

◆ dpu_checkpoint_save()

dpu_error_t dpu_checkpoint_save ( struct dpu_set_t  set,
dpu_checkpoint_flags_t  flags,
struct dpu_context_t context 
)

Extracts the DPU state.

Parameters
setthe identifier of the DPU set (must be a single DPU)
flagsoptions on what to extract from the DPU state
contextstorage for the DPU state
Returns
Whether the operation was successful.

◆ dpu_checkpoint_serialize()

dpu_error_t dpu_checkpoint_serialize ( struct dpu_context_t context,
uint8_t **  serialized_context,
uint32_t *  serialized_context_size 
)

Serializes a DPU state.

Parameters
contextthe DPU state to serialize
serialized_contextstorage for the DPU state content
serialized_context_sizestorage for the number of bytes of the DPU state content
Returns
Whether the operation was successful.