USBIP C library 0.7.0
Virtual USB devices & host drivers over USB/IP
Loading...
Searching...
No Matches
dfu_target Struct Reference

One DFU target == one alternate setting == one app-supplied linear byte store. More...

#include <classes/dfu.h>

Data Fields

const char * name
 iInterface name shown by dfu-util -l (e.g.
 
void * ctx
 Backend context, passed to every callback below.
 
int(* write )(void *ctx, uint32_t off, const uint8_t *data, uint32_t len)
 Store firmware bytes at a byte offset (DOWNLOAD).
 
int(* read )(void *ctx, uint32_t off, uint8_t *buf, uint32_t want)
 Return firmware bytes at a byte offset (UPLOAD).
 
void(* begin )(void *ctx)
 A fresh download is starting - discard any old image (optional).
 
void(* finish )(void *ctx)
 Download complete - commit/flush the image (optional).
 
uint32_t(* size )(void *ctx)
 Report bytes currently stored, for the log (optional).
 

Detailed Description

One DFU target == one alternate setting == one app-supplied linear byte store.

The class calls these with byte offsets (a multiple of wTransferSize); ctx is passed back to each. begin/finish/size may be NULL.

Field Documentation

◆ name

const char* dfu_target::name

iInterface name shown by dfu-util -l (e.g.

"fw0")

◆ ctx

void* dfu_target::ctx

Backend context, passed to every callback below.

◆ write

int(* dfu_target::write) (void *ctx, uint32_t off, const uint8_t *data, uint32_t len)

Store firmware bytes at a byte offset (DOWNLOAD).

Parameters
ctxthe target's ctx pointer.
offbyte offset (a multiple of the DFU wTransferSize).
datathe bytes to store.
lennumber of bytes in data.
Returns
DFU_STATUS_OK (0) on success, or a DFU_STATUS_* code reported to the host via GETSTATUS (any other non-zero is treated as DFU_STATUS_errWRITE).

◆ read

int(* dfu_target::read) (void *ctx, uint32_t off, uint8_t *buf, uint32_t want)

Return firmware bytes at a byte offset (UPLOAD).

Parameters
ctxthe target's ctx pointer.
offbyte offset (a multiple of the DFU wTransferSize).
bufdestination buffer.
wantmaximum number of bytes to return.
Returns
bytes read; 0 signals end-of-image and terminates the upload.

◆ begin

void(* dfu_target::begin) (void *ctx)

A fresh download is starting - discard any old image (optional).

Parameters
ctxthe target's ctx pointer.

◆ finish

void(* dfu_target::finish) (void *ctx)

Download complete - commit/flush the image (optional).

Parameters
ctxthe target's ctx pointer.

◆ size

uint32_t(* dfu_target::size) (void *ctx)

Report bytes currently stored, for the log (optional).

Parameters
ctxthe target's ctx pointer.
Returns
stored byte count.

The documentation for this struct was generated from the following file: