Functions
Functions
SYSTEM » Device Firmware Update » Structures

## Functions
sdk_err_t | dfu_init (dfu_func_t *p_app_func, dfu_buf_table_t *p_buffer, dfu_pro_callback_t *p_callback)
| Function for initializing the DFU Used and Program State Callback. More...
void | dfu_cmd_parse_reset (void)
| Function for reset the DFU cmd parse state. More...
void | dfu_receive_data_process (uint8_t *p_data, uint16_t length)
| This function should be called when dfu receives data. More...
void | dfu_schedule (void)
| Function for checking DFU cmd. More...
void | dfu_ble_set_mtu_size (uint16_t mtu_size)
| Function for setting the BLE MTU size. More...
void | dfu_ble_send_data_cmpl_process (void)
| This function should be called when BLE stack sends data completely. More...
void | dfu_ble_receive_data_process (uint8_t *p_data, uint16_t length)
| This function should be called when BLE receives data. More...
void | dfu_uart_receive_data_process (uint8_t *p_data, uint16_t length)
| This function should be called when UART receives data. More...
void | dfu_disable_cmd_set (uint16_t cmd_bit_map)
| Function for set DFU disable cmd. More...
bool | dfu_cmd_handler_set (uint8_t index, uint16_t cmd, dfu_receive_cmd_handler_t cmd_handler)
| Function for set DFU cmd handler. More...
void | dfu_spi_flash_func_config (dfu_spi_flash_func_t *spi_flash_func)
| Function for initializing the DFU SPI Flash Callback. More...

## Detailed Description

## Function Documentation

## ◆ dfu_ble_receive_data_process()

void dfu_ble_receive_data_process | ( | uint8_t * | p_data,
|  | uint16_t | length
| ) |  |

This function should be called when BLE receives data.

Note
  This function should be used when the user wants to create his or her own DFU bootloader.

Parameters

  [in] | p_data | The received data from BLE.
  [in] | length | The length of data.

## ◆ dfu_ble_send_data_cmpl_process()

void dfu_ble_send_data_cmpl_process | ( | void |  | ) |

This function should be called when BLE stack sends data completely.

Note
  This function should be used when the user wants to create his or her own DFU bootloader.

Return values

  void |

## ◆ dfu_ble_set_mtu_size()

void dfu_ble_set_mtu_size | ( | uint16_t | mtu_size | ) |

Function for setting the BLE MTU size.

Note
  If the user wants to create his or her own DFU bootloader, the DFU MTU size should be set by using this function (when the MTU size is updated, this function should be called).

Parameters

  [in] | mtu_size | The BLE MTU size.

## ◆ dfu_cmd_handler_set()

bool dfu_cmd_handler_set | ( | uint8_t | index,
|  | uint16_t | cmd,
|  | dfu_receive_cmd_handler_t | cmd_handler
| ) |  |

Function for set DFU cmd handler.

Parameters

  [in] | index | Index of DFU cmd.
  [in] | cmd | DFU cmd.
  [in] | cmd_handler | DFU cmd handler.

## ◆ dfu_cmd_parse_reset()

void dfu_cmd_parse_reset | ( | void |  | ) |

Function for reset the DFU cmd parse state.

Note
  When APP wants to add DFU timeout feature, shoulde reset DFU cmd parse state when timeout.

## ◆ dfu_disable_cmd_set()

void dfu_disable_cmd_set | ( | uint16_t | cmd_bit_map | ) |

Function for set DFU disable cmd.

Note
  In Apps, if the user wants to jump to ROM DFU run,but want to be able to control the operation permissions of DFU, this function can be called.

Parameters

  [in] | cmd_bit_map | The bitmask of DFU disable cmd.

## ◆ dfu_init()

sdk_err_t dfu_init | ( | dfu_func_t * | p_app_func,
|  | dfu_buf_table_t * | p_buffer,
|  | dfu_pro_callback_t * | p_callback
| ) |  |

Function for initializing the DFU Used and Program State Callback.

Note
  When APP wants to add DFU features, the flash_read and flash_write functions should be registered. To creat own DFU bootloaders, all functions in dfu_func_t should be registered. In order to show DFU program states by own DFU bootloaders, all functions in dfu_pro_callback_t should be registered.

Parameters

  [in] | p_app_func | DFU used functions.
  [in] | p_buffer | DFU data receiving buffer.
  [in] | p_callback | DFU program state callback functions.

Returns
  Result of service initialization.

## ◆ dfu_receive_data_process()

void dfu_receive_data_process | ( | uint8_t * | p_data,
|  | uint16_t | length
| ) |  |

This function should be called when dfu receives data.

Note
  This function should be used when the user wants to create his or her own DFU bootloader.

Parameters

  [in] | p_data | The received data
  [in] | length | The length of data

## ◆ dfu_schedule()

void dfu_schedule | ( | void |  | ) |

Function for checking DFU cmd.

Note
  This function should be called in main loop.

## ◆ dfu_spi_flash_func_config()

void dfu_spi_flash_func_config | ( | dfu_spi_flash_func_t * | spi_flash_func | ) |

Function for initializing the DFU SPI Flash Callback.

Note
  When APP wants to add DFU operationally external flash feature, the dfu_spi_flash_func_t should be registered.

Parameters

  [in] | spi_flash_func | DFU operationally external flash used functions.

## ◆ dfu_uart_receive_data_process()

void dfu_uart_receive_data_process | ( | uint8_t * | p_data,
|  | uint16_t | length
| ) |  |

This function should be called when UART receives data.

Note
  This function should be used when the user wants to create his or her own DFU bootloader.

Parameters

  [in] | p_data | The received data from UART
  [in] | length | The length of data