1 /***************************************************************************/ /**
2  * @file  sli_siwx917_soc.h
3  *******************************************************************************
4  * # License
5  * <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b>
6  *******************************************************************************
7  *
8  * SPDX-License-Identifier: Zlib
9  *
10  * The licensor of this software is Silicon Laboratories Inc.
11  *
12  * This software is provided 'as-is', without any express or implied
13  * warranty. In no event will the authors be held liable for any damages
14  * arising from the use of this software.
15  *
16  * Permission is granted to anyone to use this software for any purpose,
17  * including commercial applications, and to alter it and redistribute it
18  * freely, subject to the following restrictions:
19  *
20  * 1. The origin of this software must not be misrepresented; you must not
21  *    claim that you wrote the original software. If you use this software
22  *    in a product, an acknowledgment in the product documentation would be
23  *    appreciated but is not required.
24  * 2. Altered source versions must be plainly marked as such, and must not be
25  *    misrepresented as being the original software.
26  * 3. This notice may not be removed or altered from any source distribution.
27  *
28  ******************************************************************************/
29 
30 #pragma once
31 
32 #include <stdint.h>
33 
34 // Upgrade images
35 #define RSI_JUMP_TO_PC 'J'
36 
37 //! Check CRC
38 #define CHECK_NWP_INTEGRITY 'K'
39 #define RSI_UPGRADE_BL      '#'
40 
41 #define HOST_INTF_REG_OUT 0x4105003C
42 #define HOST_INTF_REG_IN  0x41050034
43 #define BOARD_READY       0xABCD
44 #define REG_READ          0xD1
45 #define REG_WRITE         0xD2
46 #define PONG_WRITE        0xD4
47 #define PING_WRITE        0xD5
48 #define GPIO_RESET        0xD7
49 #define LOAD_BOOTLOADER   0xD8
50 #ifdef RS9116
51 #define HOST_INTERACT_REG_VALID      (0xA0 << 8)
52 #define HOST_INTERACT_REG_VALID_READ (0xAB << 8)
53 #else
54 #define HOST_INTERACT_REG_VALID      (0xAB << 8)
55 #define HOST_INTERACT_REG_VALID_READ (0xAB << 8)
56 #endif
57 
58 #define RSI_RESET_LOOP_COUNTER(X)     X = 0
59 #define RSI_WHILE_LOOP(X, Y)          while ((X++) < (uint32_t)Y)
60 #define RSI_LOOP_COUNT_UPGRADE_IMAGE  0xFFFF
61 #define RSI_LOOP_COUNT_WAKEUP_REQ     0xFFFFFFFF
62 #define RSI_LOOP_COUNT_WAKEUP_WAIT    0xFFFFFFFF
63 #define RSI_LOOP_COUNT_UPGRADE_REQ    0xFFFF
64 #define RSI_LOOP_COUNT_UPGRADE_CHUNK  0xFFFF
65 #define RSI_LOOP_COUNT_UPGRADE_STATUS 0xFFFF
66 #define RSI_LOOP_COUNT_SELECT_OPTION  0xFFFF
67 #define RSI_CHECK_LOOP_COUNTER(X, Y) \
68   do {                               \
69     if (X >= Y)                      \
70       return -1;                     \
71   } while (0)
72 
73 void sli_siwx917_update_system_core_clock(void);
74 void RSI_Set_Cntrls_To_M4(void);
75 void RSI_Set_Cntrls_To_TA(void);
76 
77 void sli_si91x_platform_init(void);
78 int16_t sli_si91x_send_boot_instruction(uint8_t type, uint16_t *data);
79 int16_t rsi_waitfor_boardready(void);
80 int16_t rsi_select_option(uint8_t cmd);
81 int16_t rsi_bl_select_option(uint8_t cmd);
82 int16_t rsi_boot_insn(uint8_t type, uint16_t *data);
83 int16_t rsi_mem_rd(uint32_t addr, uint16_t len, uint8_t *dBuf);
84 void sl_si91x_ulp_wakeup_init(void);
85