Welcome to mirror list, hosted at ThFree Co, Russian Federation.

app_zigbee.h « App « STM32_WPAN « Zigbee_OTA_Server_Coord « Zigbee « Applications « P-NUCLEO-WB55.Nucleo « Projects - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d8cf7e2741d2a38517f0bf733205c3c1b02386a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * File Name          : app_zigbee.h
  * Description        : Header for Zigbee Application.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under Ultimate Liberty license
  * SLA0044, the "License"; You may not use this file except in compliance with
  * the License. You may obtain a copy of the License at:
  *                             www.st.com/SLA0044
  *
  ******************************************************************************
 */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef APP_ZIGBEE_H
#define APP_ZIGBEE_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
/* Private includes ----------------------------------------------------------*/
#include "tl.h"
#include "tl_zigbee_hci.h"
#include "stdbool.h"
#include "zcl/zcl.h"
#include "zcl/general/zcl.ota.h"
  
/* FUOTA specific defines ----------------------------------------------------*/

/* Keyword found at the end of Zigbee Ota compatible application binaries */
#define FUOTA_MAGIC_KEYWORD_APP                0x94448A29

/* Keyword found at the end of encrypted Copro Wireless binaries */
#define FUOTA_MAGIC_KEYWORD_COPRO_WIRELESS     0xD3A12C5E

/* Define Address for Application FW Update */
#define FUOTA_APP_FW_BINARY_ADDRESS            (FLASH_BASE + CFG_APP_START_SECTOR_INDEX*0x1000)

/* Define Address for Copro Wireless FW Update */
#define FUOTA_COPRO_FW_BINARY_ADDRESS          (FLASH_BASE + CFG_APP_START_SECTOR_INDEX*0x1000)

#define FUOTA_NUMBER_WORDS_64BITS              50
#define FUOTA_PAYLOAD_SIZE                     (FUOTA_NUMBER_WORDS_64BITS * 8)

/* ZCL OTA specific defines ------------------------------------------------------*/
#define ST_ZIGBEE_MANUFACTURER_CODE            0x1041
#define IMAGE_TYPE_FW_COPRO_WIRELESS           0x01    /* M0 binary  */
#define IMAGE_TYPE_FW_APP                      0x02    /* M4 binary  */
#define FILE_VERSION_FW_COPRO_WIRELESS         0x02
#define FILE_VERSION_FW_APP                    0x02
#define RAM_FIRMWARE_BUFFER_SIZE               1024

/* Exported types ------------------------------------------------------------*/

/*
 *  List of all errors tracked by the Thread application
 *  running on M4. Some of these errors may be fatal
 *  or just warnings
 */
typedef enum {
    ERR_REC_MULTI_MSG_FROM_M0,
    ERR_ZIGBE_CMD_TO_M0,
    ERR_ZIGBEE_CHECK_WIRELESS
} ErrAppliIdEnum_t;

/*
 *  OTA structures definition
 */
enum APP_ZIGBEE_OtaFileTypeDef_t{
  fileType_COPRO_WIRELESS = IMAGE_TYPE_FW_COPRO_WIRELESS,
  fileType_APP = IMAGE_TYPE_FW_APP,
};

struct APP_ZIGBEE_OtaContext_t{
  enum APP_ZIGBEE_OtaFileTypeDef_t  file_type;
  uint8_t file_version;
  uint32_t binary_size;
  uint32_t base_address;
  uint32_t magic_keyword;
};

struct APP_ZIGBEE_OtaBlocTransfer_t{
  uint32_t flash_addr;  
  bool OTA_FileDataGenerated;
  uint64_t max_buffer_offset;
  uint8_t firmware_buffer[RAM_FIRMWARE_BUFFER_SIZE];
};

/* OTA server data */
struct APP_ZIGBEE_OtaServerInfo {
  struct ZbZclOtaHeader requested_image_header;
  struct APP_ZIGBEE_OtaContext_t ctx;
  struct APP_ZIGBEE_OtaBlocTransfer_t block_transfer;
};

/* Exported constants --------------------------------------------------------*/

/* Exported functions ------------------------------------------------------- */
void APP_ZIGBEE_Init(void);
void APP_ZIGBEE_Error(uint32_t ErrId, uint32_t ErrCode);
void APP_ZIGBEE_RegisterCmdBuffer(TL_CmdPacket_t *p_buffer);
void APP_ZIGBEE_ProcessNotifyM0ToM4(void);
void APP_ZIGBEE_ProcessRequestM0ToM4(void);
void APP_ZIGBEE_TL_INIT(void);
void Pre_ZigbeeCmdProcessing(void);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* APP_ZIGBEE_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/