gr533x_dfu.h File Reference

Device Firmware Update API. More...

#include "gr533x_sys.h"
#include <stdbool.h>
#include <stdint.h>
#include "ble_error.h"

Go to the source code of this file.

Classes

struct  dfu_receive_frame_t
 DFU frame information definition. More...
 
struct  dfu_boot_info_t
 Boot information definition. More...
 
struct  dfu_image_info_t
 Image information definition. More...
 
struct  dfu_func_t
 DFU used functions config definition. More...
 
struct  dfu_spi_flash_func_t
 SPI used functions config definition. More...
 
struct  dfu_buf_table_t
 DFU used buffers definition. More...
 
struct  dfu_pro_callback_t
 DFU program state callback definition. More...
 

Macros

#define DFU_MAX_HEADER_LEN   20
 
#define DFU_MAX_BUFFER_LEN   8192
 
#define DFU_FW_COPY_PATTERN   0x434f5059
 
#define DFU_INFO_ADDR   0x0027E000
 
#define DFU_FRAME_RECEIVE_MAX_LENGTH   2048
 
#define DFU_IMG_INFO_PATTERN   0x4744
 

Typedefs

typedef void(* dfu_receive_cmd_handler_t) (dfu_receive_frame_t *p_frame)
 DFU CMD handler typed. More...
 

Enumerations

enum  {
  BLE_GATT_COMMON_EVT_MTU_EXCHANGE = BLE_GATT_COMMON_EVT_BASE,
  BLE_GATT_COMMON_EVT_PRF_REGISTER,
  BLE_GATT_COMMON_EVT_MAX,
  ISO_GPIO_MASK_0 = 0x1,
  ISO_GPIO_MASK_1 = 0x2,
  ISO_GPIO_MASK_2 = 0x4,
  ISO_GPIO_MASK_3 = 0x8,
  ISO_GPIO_MASK_4 = 0x10,
  ISO_GPIO_MASK_5 = 0x20,
  ISO_GPIO_MASK_6 = 0x40,
  ISO_GPIO_MASK_7 = 0x80,
  AMS_PLAYER_ATTR_ID_NAME,
  AMS_PLAYER_ATTR_ID_PLAYBACK_INFO,
  AMS_PLAYER_ATTR_ID_VOLUME,
  IAS_ALERT_NONE,
  IAS_ALERT_MILD,
  IAS_ALERT_HIGH,
  EXFLASH_CONFIG_CACHE_MODE = 0x00,
  EXFLASH_CONFIG_READ_CMD = 0x01,
  EXFLASH_CONFIG_BAUD_RATE = 0x02,
  EXFLASH_CONFIG_CLOCK_MODE = 0x03,
  EXFLASH_CONFIG_CACHE_FLUSH = 0x04,
  EXFLASH_CONFIG_PAGE_TYPE = 0x05,
  DFU_CACHE_TYPE_CALL_STACK = 0x00,
  DFU_CACHE_TYPE_REG,
  TRC_PWR_WFE_MODE = 0,
  TRC_PWR_DSLEEP_MODE,
  TRC_PWR_ACTIVE_MODE,
  TRC_PWR_BLE_RET_DSLEEP,
  TRC_PWR_APP_TIMER_REFUSE,
  TRC_PWR_APP_TIMER_PASS,
  TRC_PWR_BLE_TIMER_REFUSE,
  TRC_PWR_BLE_TIMER_PASS,
  TRC_PWR_RTC_TIMER_REFUSE,
  TRC_PWR_RTC_TIMER_PASS,
  TRC_PWR_RTC1_TIMER_REFUSE,
  TRC_PWR_RTC1_TIMER_PASS,
  TRC_PWR_WDT_TIMER_REFUSE,
  TRC_PWR_WDT_TIMER_PASS
}
 

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

Device Firmware Update API.

Attention
#####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file gr533x_dfu.h.