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 * Description: LOG oam reg query MODULE 15 * Author: 16 * Create: 17 */ 18 19 #ifndef LOG_OAM_REG_QUERY_H 20 #define LOG_OAM_REG_QUERY_H 21 #include "product.h" 22 23 #if SYS_DEBUG_MODE_ENABLE == YES 24 25 #ifndef LIB_LOG_READER_LOG_OAM_REG_QUERY_H 26 #define LIB_LOG_READER_LOG_OAM_REG_QUERY_H 27 28 #include "log_oam_logger.h" 29 #ifdef SUPPORT_IPC 30 #include "ipc_actions.h" 31 #endif 32 33 #if USE_COMPRESS_LOG_INSTEAD_OF_SDT_LOG == NO 34 typedef struct { 35 om_msg_header_stru_t header; 36 uint32_t reg_addr; 37 uint16_t reg_len; 38 uint8_t mode; 39 uint8_t reserver; 40 uint32_t reg_value; 41 uint8_t msg_tailer; 42 } __attribute__((packed)) om_reg_data_stru_t; 43 #endif 44 45 #if MCU_ONLY 46 #ifdef USE_GPIO_SIMULATE_SSI 47 typedef struct { 48 om_msg_header_stru_t header; 49 uint8_t reg_num; 50 uint8_t mode; 51 uint16_t reserver; 52 }om_msg_ssi_header_t; 53 54 typedef struct { 55 uint32_t reg_addr; 56 uint32_t reg_value; 57 } om_reg_addr_val_t; 58 59 typedef struct { 60 om_msg_header_stru_t header; 61 uint8_t reg_num; 62 uint8_t mode; 63 uint8_t reg_result; 64 uint8_t reserver; 65 uint8_t msg_tailer; 66 } __attribute__((packed)) om_msg_ssi_write_rport_t; 67 68 typedef struct { 69 om_msg_header_stru_t header; 70 uint8_t reg_num; 71 uint8_t mode; 72 uint8_t query_reg_result; 73 uint8_t reserver; 74 uint8_t msg_tail; 75 } __attribute__((packed)) om_msg_ssi_read_rport_t; 76 77 typedef struct { 78 om_msg_header_stru_t header; 79 uint32_t addr; 80 uint16_t length; 81 uint8_t operate_mode; 82 uint8_t operate_result; 83 uint8_t msg_tailer; 84 } om_ssi_block_stru_t; 85 #else 86 typedef struct { 87 om_msg_header_stru_t header; 88 uint32_t reg_addr; 89 uint16_t output_value; 90 uint8_t mode; // unused 91 uint8_t reserver; // unused 92 uint32_t reg_value; // unused 93 uint8_t msg_tailer; 94 } __attribute__((packed)) om_ssi_reg_output_stru_t; 95 96 struct om_rdssi_reg_data_stru_t { 97 om_msg_header_stru_t header; 98 uint32_t unused_bit8; 99 uint32_t reg_addr; 100 uint8_t msg_tailer; 101 }; 102 103 struct om_wrssi_reg_data_stru_t { 104 om_msg_header_stru_t header; 105 uint32_t unused_bit8; 106 uint32_t reg_addr; 107 uint32_t reg_value; 108 uint8_t msg_tailer; 109 }; 110 #endif 111 #endif 112 113 enum REG_QUERY_ACTION { 114 REG_ACTION_WRITE, 115 REG_ACTION_READ, 116 }; 117 118 void oml_reg_command(uint8_t *data, uint16_t length); 119 void oml_ssi_reg_command(uint8_t *data, uint16_t length); 120 121 #if CORE == MASTER_BY_ALL 122 void oml_reg_register_callback(void); 123 #endif 124 125 #if MCU_ONLY 126 #ifdef USE_GPIO_SIMULATE_SSI 127 void oml_ssi_block_callback(void); 128 void oml_ssi_reg32_register_callback(void); 129 #endif 130 void oml_ssi_reg_register_callback(void); 131 #endif 132 133 #endif /* end of log_oam_reg_query.h */ 134 135 #endif /* end of SYS_DEBUG_MODE_ENABLE == YES */ 136 #endif