LR1121 FSK (#2789)
[ExpressLRS.git] / src / lib / SerialUpdate / stub_commands.cpp
blobdbd79857db2c1402e8a2e327d6e9171af785c6f6
1 /*
2 * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
7 #include "targets.h"
9 #if defined(PLATFORM_ESP32) && defined(TARGET_RX)
11 #include "soc_support.h"
12 #include "stub_commands.h"
13 #include "stub_flasher.h"
14 #include "slip.h"
16 #if defined(HAS_SECURITY_INFO)
17 #if defined(PLATFORM_ESP32_S3)
18 uint32_t (* GetSecurityInfoProc)(int* pMsg, int* pnErr, uint8_t *buf) = (uint32_t (*)(int* pMsg, int* pnErr, uint8_t *buf))0x40048174; // pMsg and pnErr unused in ROM
19 #elif defined(PLATFORM_ESP32_C3)
20 uint32_t (* GetSecurityInfoProc)(int* pMsg, int* pnErr, uint8_t *buf) = (uint32_t (*)(int* pMsg, int* pnErr, uint8_t *buf))0x4004b9da; // pMsg and pnErr unused in ROM
21 extern uint32_t _rom_eco_version; // rom constant to define ECO version
22 uint32_t (*GetSecurityInfoProcNewEco)(int* pMsg, int* pnErr, uint8_t *buf) = (uint32_t (*)(int* pMsg, int* pnErr, uint8_t *buf))0x4004d51e; // GetSecurityInfo for C3 ECO7+
23 #endif
25 esp_command_error handle_get_security_info()
27 uint8_t buf[SECURITY_INFO_BYTES];
28 esp_command_error ret;
30 #if defined(PLATFORM_ESP32_C3)
31 if (_rom_eco_version >= 7)
32 ret = (esp_command_error)GetSecurityInfoProcNewEco(NULL, NULL, buf);
33 else
34 ret = (esp_command_error)GetSecurityInfoProc(NULL, NULL, buf);
35 #else
36 ret = (esp_command_error)(*GetSecurityInfoProc)(NULL, NULL, buf);
37 #endif // ESP32C3
38 if (ret == ESP_UPDATE_OK)
39 SLIP_send_frame_data_buf(buf, sizeof(buf));
40 return ret;
42 #endif
43 #endif