1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 15 * Description: Provides SSI driver \n 16 * 17 * History: \n 18 * 2022-08-21, Create file. \n 19 */ 20 #ifndef SSI_H 21 #define SSI_H 22 23 #include <stdint.h> 24 #include "ssi_porting.h" 25 #include "errcode.h" 26 27 #ifdef __cplusplus 28 #if __cplusplus 29 extern "C" { 30 #endif /* __cplusplus */ 31 #endif /* __cplusplus */ 32 33 /** 34 * @defgroup drivers_driver_ssi SSI 35 * @ingroup drivers_driver 36 * @{ 37 */ 38 39 /** 40 * @if Eng 41 * @brief Initialize the SSI. 42 * @else 43 * @brief 初始化SSI。 44 * @endif 45 */ 46 void uapi_ssi_init(void); 47 48 /** 49 * @if Eng 50 * @brief Deinitialize the SSI. 51 * @else 52 * @brief 去初始化SSI。 53 * @endif 54 */ 55 void uapi_ssi_deinit(void); 56 57 /** 58 * @if Eng 59 * @brief Read SSI 16 bit register. 60 * @param [in] addr Addr to read. 61 * @param [in] data Value of register. 62 * @retval ERRCODE_SUCC Success. 63 * @retval Other Failure. For details, see @ref errcode_t. 64 * @else 65 * @brief 读SSI 16位寄存器。 66 * @param [in] addr 读的地址。 67 * @param [in] data 寄存器的值。 68 * @retval ERRCODE_SUCC 成功。 69 * @retval Other 失败,参考 @ref errcode_t 。 70 * @endif 71 */ 72 errcode_t uapi_ssi_read_addr16_data16(uint16_t addr, uint16_t *data); 73 74 /** 75 * @if Eng 76 * @brief Write SSI 16 bit register. 77 * @param [in] addr Addr to write. 78 * @param [in] value Value to write. 79 * @retval ERRCODE_SUCC Success. 80 * @retval Other Failure. For details, see @ref errcode_t. 81 * @else 82 * @brief 写SSI 16位寄存器。 83 * @param [in] addr 写的地址。 84 * @param [in] value 写入的值。 85 * @retval ERRCODE_SUCC 成功。 86 * @retval Other 失败,参考 @ref errcode_t 。 87 * @endif 88 */ 89 errcode_t uapi_ssi_write_addr16_data16(uint16_t addr, uint16_t value); 90 91 /** 92 * @if Eng 93 * @brief Read SSI 32 bit register. 94 * @param [in] addr Addr to read. 95 * @param [in] data data of register. 96 * @retval ERRCODE_SUCC Success. 97 * @retval Other Failure. For details, see @ref errcode_t. 98 * @else 99 * @brief 读SSI 32位寄存器。 100 * @param [in] addr 读的地址。 101 * @param [in] data 寄存器的值。 102 * @retval ERRCODE_SUCC 成功。 103 * @retval Other 失败,参考 @ref errcode_t 。 104 * @endif 105 */ 106 errcode_t uapi_ssi_read_addr32_data16(uint32_t addr, uint16_t *data); 107 108 /** 109 * @if Eng 110 * @brief Write SSI 32 bit register. 111 * @param [in] addr Addr to write. 112 * @param [in] value Value to write. 113 * @retval ERRCODE_SUCC Success. 114 * @retval Other Failure. For details, see @ref errcode_t. 115 * @else 116 * @brief 写SSI 32位寄存器。 117 * @param [in] addr 写的地址。 118 * @param [in] value 写入的值。 119 * @retval ERRCODE_SUCC 成功。 120 * @retval Other 失败,参考 @ref errcode_t 。 121 * @endif 122 */ 123 errcode_t uapi_ssi_write_addr32_data16(uint32_t addr, uint16_t value); 124 125 /** 126 * @if Eng 127 * @brief Read SSI 32 bit register with 32 bit value. 128 * @param [in] addr Addr to read. 129 * @param [in] data Value of register. 130 * @retval ERRCODE_SUCC Success. 131 * @retval Other Failure. For details, see @ref errcode_t. 132 * @else 133 * @brief 读SSI 32位寄存器,32位值。 134 * @param [in] addr 读的地址。 135 * @param [in] data 寄存器的值。 136 * @retval ERRCODE_SUCC 成功。 137 * @retval Other 失败,参考 @ref errcode_t 。 138 * @endif 139 */ 140 errcode_t uapi_ssi_read_addr32_data32(uint32_t addr, uint32_t *data); 141 142 /** 143 * @if Eng 144 * @brief Write SSI 32 bit register with 32 bit value. 145 * @param [in] addr Addr to write. 146 * @param [in] value Value to write. 147 * @retval ERRCODE_SUCC Success. 148 * @retval Other Failure. For details, see @ref errcode_t. 149 * @else 150 * @brief 写入SSI 32位寄存器,32位值。 151 * @param [in] addr 写的地址。 152 * @param [in] value 写入的值。 153 * @retval ERRCODE_SUCC 成功。 154 * @retval Other 失败,参考 @ref errcode_t 。 155 * @endif 156 */ 157 errcode_t uapi_ssi_write_addr32_data32(uint32_t addr, uint32_t value); 158 159 /** 160 * @} 161 */ 162 163 #ifdef __cplusplus 164 #if __cplusplus 165 } 166 #endif /* __cplusplus */ 167 #endif /* __cplusplus */ 168 169 #endif