Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
USB DFU device update API

USB DFU device update API. More...

Macros

#define USBD_DFU_DEFINE_IMG(id, iname, ipriv, iread, iwrite, inext)
 Define USB DFU image.

Detailed Description

USB DFU device update API.

Since
4.1
Version
0.1.0

Macro Definition Documentation

◆ USBD_DFU_DEFINE_IMG

#define USBD_DFU_DEFINE_IMG ( id,
iname,
ipriv,
iread,
iwrite,
inext )

#include <usbd_dfu.h>

Value:
static __noinit struct usb_if_descriptor usbd_dfu_iface_##id; \
\
USBD_DESC_STRING_DEFINE(usbd_dfu_str_##id, iname, USBD_DUT_STRING_INTERFACE); \
\
static const STRUCT_SECTION_ITERABLE(usbd_dfu_image, usbd_dfu_image_##id) = { \
.name = iname, \
.if_desc = &usbd_dfu_iface_##id, \
.priv = ipriv, \
.sd_nd = &usbd_dfu_str_##id, \
.read_cb = iread, \
.write_cb = iwrite, \
.next_cb = inext, \
}
#define STRUCT_SECTION_ITERABLE(struct_type, varname)
Defines a new element for an iterable section.
Definition iterable_sections.h:242
USB Standard Interface Descriptor.
Definition usb_ch9.h:382
Definition usbd_dfu.h:95

Define USB DFU image.

Use this macro to create USB DFU image

The callbacks must be in form:

static int read(void *const priv, const uint32_t block, const uint16_t size,
uint8_t buf[static CONFIG_USBD_DFU_TRANSFER_SIZE])
{
int len;
return len;
}
static int write(void *const priv, const uint32_t block, const uint16_t size,
const uint8_t buf[static CONFIG_USBD_DFU_TRANSFER_SIZE])
{
return 0;
}
static bool next(void *const priv,
const enum usb_dfu_state state, const enum usb_dfu_state next)
{
return true;
}
state
Definition parser_state.h:29
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
usb_dfu_state
Definition usbd_dfu.h:80
Parameters
idIdentifier by which the linker sorts registered images
inameImage name as used in interface descriptor
iprivPointer to private data passed to the callbacks
ireadImage read callback
iwriteImage write callback
inextNotify/confirm next state