1 // Copyright (C) 2022 Beken Corporation 2 // 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 #pragma once 16 17 #include <components/log.h> 18 #include <driver/hal/hal_qspi_types.h> 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 typedef struct { 25 uint32_t qspi_int_cnt; 26 uint32_t sw_op_int_cnt; 27 } qspi_statis_t; 28 29 #if CONFIG_QSPI_STATIS 30 31 #define QSPI_STATIS_DEC() qspi_statis_t *qspi_statis = NULL 32 #define QSPI_STATIS_GET(_statis) (_statis) = qspi_statis_get_statis() 33 #define QSPI_STATIS_SET(_statis, _v) (_statis) = (_v) 34 #define QSPI_STATIS_ADD(_statis, _v) (_statis) += (_v); 35 #define QSPI_STATIS_INC(_statis) QSPI_STATIS_ADD((_statis), 1) 36 bk_err_t qspi_statis_init(void); 37 qspi_statis_t* qspi_statis_get_statis(void); 38 void qspi_statis_dump(void); 39 40 #else 41 42 #define QSPI_STATIS_DEC() 43 #define QSPI_STATIS_GET(_statis) 44 #define QSPI_STATIS_SET(_id, _v) 45 #define QSPI_STATIS_ADD(_statis, _v) 46 #define QSPI_STATIS_INC(_statis) 47 #define qspi_statis_init() 48 #define qspi_statis_dump() 49 #define qspi_statis_get_statis() 50 51 #endif 52 53 #ifdef __cplusplus 54 } 55 #endif 56 57 58