Functions
Functions
SYSTEM » Device Firmware Update

## Functions
void | dfu_init (dfu_func_t *p_app_dfu_func, uint8_t *p_dfu_buffer, dfu_pro_callback_t *p_dfu_callback)
| Function for initializing the DFU Used and Program State Callback. More...
void | dfu_cmd_parse_state_reset (void)
| Function for reset the DFU cmd parse state. 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_schedule (void)
| Function for checking DFU cmd. More...
void | dfu_start_jump (uint32_t start_addr)
| Function for jumping to address to run. More...
void | dfu_start_address (boot_info_t *p_boot_info)
| Function for changing the boot info and reseting device. More...
void | dfu_set_disable_cmd (uint16_t disable_cmd_bit_map)
| Function for set DFU disable cmd. 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_parse_state_reset()

void dfu_cmd_parse_state_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_init()

void dfu_init | ( | dfu_func_t * | p_app_dfu_func,
|  | uint8_t * | p_dfu_buffer,
|  | dfu_pro_callback_t * | p_dfu_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_dfu_func | DFU used functions.
  [in] | p_dfu_buffer | DFU data receiving buffer.
  [in] | p_dfu_callback | DFU program state callback functions.

## ◆ dfu_schedule()

void dfu_schedule | ( | void |  | ) |

Function for checking DFU cmd.

Note
  This function should be called in main loop.

## ◆ dfu_set_disable_cmd()

void dfu_set_disable_cmd | ( | uint16_t | disable_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] | disable_cmd_bit_map | The bitmask of DFU disable cmd See DFU cmd disable option (bitmask).

## ◆ 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_start_address()

void dfu_start_address | ( | boot_info_t * | p_boot_info | ) |

Function for changing the boot info and reseting device.

Note
  In Apps, if the user wants to jump to another APP or own a DFU bootloader and run the code, this function can be called (the boot info will be changed).

Parameters

  [in] | p_boot_info | The boot info of the APP you want to run.

## ◆ dfu_start_jump()

void dfu_start_jump | ( | uint32_t | start_addr | ) |

Function for jumping to address to run.

Note
  In Apps, if the user wants to jump to another APP or own a DFU bootloader and run the code, this function can be called. This function does not change the boot info, so the original APP will run after resetting.

Parameters

  [in] | start_addr | The jumped address.

## ◆ 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