Open FFBoard
Open source force feedback firmware
dfu_device.c File Reference

Go to the source code of this file.

Classes

struct  dfu_state_ctx_t
 

Functions

static void reset_state (void)
 
static bool reply_getstatus (uint8_t rhport, tusb_control_request_t const *request, dfu_state_t state, dfu_status_t status, uint32_t timeout)
 
static bool process_download_get_status (uint8_t rhport, uint8_t stage, tusb_control_request_t const *request)
 
static bool process_manifest_get_status (uint8_t rhport, uint8_t stage, tusb_control_request_t const *request)
 
void dfu_moded_reset (uint8_t rhport)
 
void dfu_moded_init (void)
 
bool dfu_moded_deinit (void)
 
uint16_t dfu_moded_open (uint8_t rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len)
 
bool dfu_moded_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t const *request)
 
void tud_dfu_finish_flashing (uint8_t status)
 

Variables

CFG_TUD_MEM_SECTION tu_static dfu_state_ctx_t _dfu_ctx
 
tu_static tu_lookup_entry_t const _dfu_request_lookup []
 
tu_static tu_lookup_table_t const _dfu_request_table
 
tu_static tu_lookup_entry_t const _dfu_state_lookup []
 
tu_static tu_lookup_table_t const _dfu_state_table
 
tu_static tu_lookup_entry_t const _dfu_status_lookup []
 
tu_static tu_lookup_table_t const _dfu_status_table
 

Function Documentation

◆ dfu_moded_control_xfer_cb()

bool dfu_moded_control_xfer_cb ( uint8_t  rhport,
uint8_t  stage,
tusb_control_request_t const *  request 
)

Definition at line 214 of file dfu_device.c.

◆ dfu_moded_deinit()

bool dfu_moded_deinit ( void  )

Definition at line 167 of file dfu_device.c.

◆ dfu_moded_init()

void dfu_moded_init ( void  )

Definition at line 163 of file dfu_device.c.

◆ dfu_moded_open()

uint16_t dfu_moded_open ( uint8_t  rhport,
tusb_desc_interface_t const *  itf_desc,
uint16_t  max_len 
)

Definition at line 171 of file dfu_device.c.

◆ dfu_moded_reset()

void dfu_moded_reset ( uint8_t  rhport)

Definition at line 153 of file dfu_device.c.

◆ process_download_get_status()

static bool process_download_get_status ( uint8_t  rhport,
uint8_t  stage,
tusb_control_request_t const *  request 
)
static

Definition at line 384 of file dfu_device.c.

◆ process_manifest_get_status()

static bool process_manifest_get_status ( uint8_t  rhport,
uint8_t  stage,
tusb_control_request_t const *  request 
)
static

Definition at line 420 of file dfu_device.c.

◆ reply_getstatus()

static bool reply_getstatus ( uint8_t  rhport,
tusb_control_request_t const *  request,
dfu_state_t  state,
dfu_status_t  status,
uint32_t  timeout 
)
static

Definition at line 457 of file dfu_device.c.

◆ reset_state()

static void reset_state ( void  )
static

Definition at line 68 of file dfu_device.c.

◆ tud_dfu_finish_flashing()

void tud_dfu_finish_flashing ( uint8_t  status)

Definition at line 360 of file dfu_device.c.

Variable Documentation

◆ _dfu_ctx

CFG_TUD_MEM_SECTION tu_static dfu_state_ctx_t _dfu_ctx

Definition at line 66 of file dfu_device.c.

◆ _dfu_request_lookup

tu_static tu_lookup_entry_t const _dfu_request_lookup[]
Initial value:
=
{
{ .key = DFU_REQUEST_DETACH , .data = "DETACH" },
{ .key = DFU_REQUEST_DNLOAD , .data = "DNLOAD" },
{ .key = DFU_REQUEST_UPLOAD , .data = "UPLOAD" },
{ .key = DFU_REQUEST_GETSTATUS , .data = "GETSTATUS" },
{ .key = DFU_REQUEST_CLRSTATUS , .data = "CLRSTATUS" },
{ .key = DFU_REQUEST_GETSTATE , .data = "GETSTATE" },
{ .key = DFU_REQUEST_ABORT , .data = "ABORT" },
}
@ DFU_REQUEST_UPLOAD
Definition: dfu.h:57
@ DFU_REQUEST_GETSTATUS
Definition: dfu.h:58
@ DFU_REQUEST_ABORT
Definition: dfu.h:61
@ DFU_REQUEST_GETSTATE
Definition: dfu.h:60
@ DFU_REQUEST_CLRSTATUS
Definition: dfu.h:59
@ DFU_REQUEST_DETACH
Definition: dfu.h:55
@ DFU_REQUEST_DNLOAD
Definition: dfu.h:56

Definition at line 84 of file dfu_device.c.

◆ _dfu_request_table

tu_static tu_lookup_table_t const _dfu_request_table
Initial value:
=
{
.count = TU_ARRAY_SIZE(_dfu_request_lookup),
}
tu_static tu_lookup_entry_t const _dfu_request_lookup[]
Definition: dfu_device.c:84

Definition at line 95 of file dfu_device.c.

◆ _dfu_state_lookup

tu_static tu_lookup_entry_t const _dfu_state_lookup[]
Initial value:
=
{
{ .key = APP_IDLE , .data = "APP_IDLE" },
{ .key = APP_DETACH , .data = "APP_DETACH" },
{ .key = DFU_IDLE , .data = "IDLE" },
{ .key = DFU_DNLOAD_SYNC , .data = "DNLOAD_SYNC" },
{ .key = DFU_DNBUSY , .data = "DNBUSY" },
{ .key = DFU_DNLOAD_IDLE , .data = "DNLOAD_IDLE" },
{ .key = DFU_MANIFEST_SYNC , .data = "MANIFEST_SYNC" },
{ .key = DFU_MANIFEST , .data = "MANIFEST" },
{ .key = DFU_MANIFEST_WAIT_RESET , .data = "MANIFEST_WAIT_RESET" },
{ .key = DFU_UPLOAD_IDLE , .data = "UPLOAD_IDLE" },
{ .key = DFU_ERROR , .data = "ERROR" },
}
@ APP_DETACH
Definition: dfu.h:67
@ DFU_IDLE
Definition: dfu.h:68
@ DFU_DNBUSY
Definition: dfu.h:70
@ DFU_MANIFEST
Definition: dfu.h:73
@ APP_IDLE
Definition: dfu.h:66
@ DFU_DNLOAD_SYNC
Definition: dfu.h:69
@ DFU_MANIFEST_SYNC
Definition: dfu.h:72
@ DFU_MANIFEST_WAIT_RESET
Definition: dfu.h:74
@ DFU_UPLOAD_IDLE
Definition: dfu.h:75
@ DFU_DNLOAD_IDLE
Definition: dfu.h:71
@ DFU_ERROR
Definition: dfu.h:76

Definition at line 101 of file dfu_device.c.

◆ _dfu_state_table

tu_static tu_lookup_table_t const _dfu_state_table
Initial value:
=
{
.count = TU_ARRAY_SIZE(_dfu_state_lookup),
}
tu_static tu_lookup_entry_t const _dfu_state_lookup[]
Definition: dfu_device.c:101

Definition at line 116 of file dfu_device.c.

◆ _dfu_status_lookup

tu_static tu_lookup_entry_t const _dfu_status_lookup[]
Initial value:
=
{
{ .key = DFU_STATUS_OK , .data = "OK" },
{ .key = DFU_STATUS_ERR_TARGET , .data = "errTARGET" },
{ .key = DFU_STATUS_ERR_FILE , .data = "errFILE" },
{ .key = DFU_STATUS_ERR_WRITE , .data = "errWRITE" },
{ .key = DFU_STATUS_ERR_ERASE , .data = "errERASE" },
{ .key = DFU_STATUS_ERR_CHECK_ERASED , .data = "errCHECK_ERASED" },
{ .key = DFU_STATUS_ERR_PROG , .data = "errPROG" },
{ .key = DFU_STATUS_ERR_VERIFY , .data = "errVERIFY" },
{ .key = DFU_STATUS_ERR_ADDRESS , .data = "errADDRESS" },
{ .key = DFU_STATUS_ERR_NOTDONE , .data = "errNOTDONE" },
{ .key = DFU_STATUS_ERR_FIRMWARE , .data = "errFIRMWARE" },
{ .key = DFU_STATUS_ERR_VENDOR , .data = "errVENDOR" },
{ .key = DFU_STATUS_ERR_USBR , .data = "errUSBR" },
{ .key = DFU_STATUS_ERR_POR , .data = "errPOR" },
{ .key = DFU_STATUS_ERR_UNKNOWN , .data = "errUNKNOWN" },
{ .key = DFU_STATUS_ERR_STALLEDPKT , .data = "errSTALLEDPKT" },
}
@ DFU_STATUS_ERR_CHECK_ERASED
Definition: dfu.h:86
@ DFU_STATUS_ERR_PROG
Definition: dfu.h:87
@ DFU_STATUS_OK
Definition: dfu.h:81
@ DFU_STATUS_ERR_POR
Definition: dfu.h:94
@ DFU_STATUS_ERR_FILE
Definition: dfu.h:83
@ DFU_STATUS_ERR_ERASE
Definition: dfu.h:85
@ DFU_STATUS_ERR_WRITE
Definition: dfu.h:84
@ DFU_STATUS_ERR_STALLEDPKT
Definition: dfu.h:96
@ DFU_STATUS_ERR_TARGET
Definition: dfu.h:82
@ DFU_STATUS_ERR_NOTDONE
Definition: dfu.h:90
@ DFU_STATUS_ERR_FIRMWARE
Definition: dfu.h:91
@ DFU_STATUS_ERR_VERIFY
Definition: dfu.h:88
@ DFU_STATUS_ERR_ADDRESS
Definition: dfu.h:89
@ DFU_STATUS_ERR_USBR
Definition: dfu.h:93
@ DFU_STATUS_ERR_VENDOR
Definition: dfu.h:92
@ DFU_STATUS_ERR_UNKNOWN
Definition: dfu.h:95

Definition at line 122 of file dfu_device.c.

◆ _dfu_status_table

tu_static tu_lookup_table_t const _dfu_status_table
Initial value:
=
{
.count = TU_ARRAY_SIZE(_dfu_status_lookup),
}
tu_static tu_lookup_entry_t const _dfu_status_lookup[]
Definition: dfu_device.c:122

Definition at line 142 of file dfu_device.c.