1 /******************************************************************************* 2 * @file rsi_common_apis.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 #ifndef RSI_COMMON_APIS_H 31 #define RSI_COMMON_APIS_H 32 33 #if defined(SL_SI91X_PRINT_DBG_LOG) 34 #include <stdio.h> 35 #include "rsi_common.h" 36 #endif 37 /****************************************************** 38 * * Macros 39 * ******************************************************/ 40 #if !(defined(FRDM_K28F) || defined(MXRT_595s)) 41 #if defined(SL_SI91X_PRINT_DBG_LOG) 42 #define LOG_PRINT(...) \ 43 { \ 44 osMutexAcquire(rsi_driver_cb->debug_prints_mutex, 0xFFFFFFFFUL); \ 45 printf(__VA_ARGS__); \ 46 osMutexRelease(rsi_driver_cb->debug_prints_mutex); \ 47 } 48 #elif defined(DEBUGOUT) 49 #define LOG_PRINT(...) DEBUGOUT(__VA_ARGS__) 50 #else 51 #define LOG_PRINT(...) 52 #endif 53 #endif 54 55 // success return value 56 #define RSI_SUCCESS 0 57 58 // failure return value 59 #define RSI_FAILURE -1 60 61 // Feature not supported 62 #define RSI_FEATURE_NOT_SUPPORTED 0x00F7 63 64 //Load Image types 65 #define LOAD_NWP_FW '1' 66 #define LOAD_DEFAULT_NWP_FW_ACTIVE_LOW 0x71 67 68 // Upgrade images 69 #define BURN_NWP_FW 'B' 70 71 // Upgrade images 72 #define RSI_JUMP_TO_PC 'J' 73 74 #define RSI_ACTIVE_LOW_INTR 0x2 75 #define RSI_ACTIVE_HIGH_INTR 0x0 76 #define RSI_RX_BUFFER_CHECK 0x15 77 // TX buffer full macro 78 #define RSI_TX_BUFFER_FULL -2 79 #define RSI_SOFT_RESET 0 80 #define RSI_HARD_RESET 1 81 82 /****************************************************** 83 * * Constants 84 * ******************************************************/ 85 /****************************************************** 86 * * Enumerations 87 * ******************************************************/ 88 // enumerations for power save profile modes 89 typedef enum rsi_power_save_profile_mode_e { 90 RSI_ACTIVE = 0, 91 RSI_SLEEP_MODE_1 = 1, 92 RSI_SLEEP_MODE_2 = 2, 93 RSI_SLEEP_MODE_8 = 8, 94 RSI_SLEEP_MODE_10 = 10, 95 } rsi_power_save_profile_mode_t; 96 97 // enumerations for power save profile types 98 typedef enum rsi_power_save_profile_type_e { 99 RSI_MAX_PSP = 0, 100 RSI_FAST_PSP = 1, 101 RSI_UAPSD = 2 102 } rsi_power_save_profile_type_t; 103 104 /****************************************************** 105 * * Type Definitions 106 * ******************************************************/ 107 /****************************************************** 108 * * Structures 109 * ******************************************************/ 110 /****************************************************** 111 * * Global Variables 112 * ******************************************************/ 113 /****************************************************** 114 * * Function Declarations 115 * ******************************************************/ 116 #include <stdint.h> 117 extern int32_t rsi_ble_driver_init(uint8_t *buffer, uint32_t length); 118 extern int32_t rsi_ble_driver_deinit(void); 119 extern int32_t rsi_get_fw_version(uint8_t *response, uint16_t length); 120 extern int32_t rsi_get_module_type(uint8_t *response); 121 extern int32_t rsi_common_debug_log(int32_t assertion_type, int32_t assertion_level); 122 extern int32_t rsi_get_ram_log(uint32_t addr, uint32_t length); 123 extern int32_t rsi_driver_version(uint8_t *request); 124 125 /** 126 * @brief Wait for BT card ready 127 * @return void 128 * */ 129 void rsi_bt_common_init(void); 130 131 #endif 132