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: hcc adapt bus completion. 15 * Author: 16 * Create: 2021-05-13 17 */ 18 19 #ifndef HCC_BUS_INTERFACE_HEADER 20 #define HCC_BUS_INTERFACE_HEADER 21 22 #include "td_type.h" 23 #include "hcc.h" 24 #include "hcc_cfg_comm.h" 25 #include "hcc_queue.h" 26 #include "hcc_bus_types.h" 27 28 #ifdef __cplusplus 29 #if __cplusplus 30 extern "C" { 31 #endif 32 #endif 33 34 typedef hcc_bus *(* hcc_bus_load_func)(hcc_handler *hcc); 35 typedef td_void (* hcc_bus_unload_func)(td_void); 36 typedef struct _bus_load_ { 37 hcc_bus_load_func load; 38 hcc_bus_unload_func unload; 39 } bus_load_unload; 40 41 hcc_bus *hcc_get_channel_bus(td_u8 chl); 42 bus_dev_ops *hcc_get_bus_ops(hcc_bus *bus); 43 td_void hcc_set_bus_ops(hcc_bus *bus, bus_dev_ops *dev_ops); 44 hcc_bus *hcc_alloc_bus(td_void); 45 td_void hcc_free_bus(hcc_bus *bus); 46 td_u32 hcc_bus_load(hcc_bus_type bus_type, hcc_handler *hcc); 47 td_void hcc_bus_unload(TD_CONST hcc_bus *bus); 48 td_u32 hcc_bus_tx_proc(hcc_bus *bus, hcc_trans_queue *queue, td_u16 *remain_pkt_nums); 49 td_bool hcc_bus_is_busy(hcc_bus *bus, hcc_queue_dir dir); 50 td_u32 hcc_bus_call_rx_message(hcc_bus *bus, hcc_rx_msg_type msg); 51 td_void hcc_bus_update_credit(hcc_bus *bus, td_u32 credit); 52 td_s32 hcc_bus_get_credit(hcc_bus *bus, td_u32 *credit); 53 td_s32 hcc_bus_reinit(hcc_bus *bus); 54 td_s32 hcc_bus_patch_read(hcc_bus *bus, td_u8 *buff, td_s32 len, td_u32 timeout); 55 td_s32 hcc_bus_patch_write(hcc_bus *bus, td_u8 *buff, td_s32 len); 56 td_void hcc_force_update_queue_id(hcc_bus *bus, td_u8 value); 57 td_s32 hcc_bus_power_action(hcc_bus *bus, hcc_bus_power_action_type action); 58 td_s32 hcc_bus_sleep_request(hcc_bus *bus); 59 td_s32 hcc_bus_wakeup_request(hcc_bus *bus); 60 td_s32 hcc_set_bus_func(td_u8 bus_type, bus_load_unload *bus_load_opt); 61 td_u32 hcc_get_pkt_max_len(td_u8 chl); 62 63 64 #define BUS_LOG_SYMBOL_SIZE 4 65 #define BUS_LOG_SYMBOL_NUM 5 66 extern td_s8 g_loglevel[BUS_LOG_SYMBOL_NUM][BUS_LOG_SYMBOL_SIZE]; 67 68 #ifdef __cplusplus 69 #if __cplusplus 70 } 71 #endif 72 #endif 73 74 #endif /* HCC_BUS_INTERFACE_HEADER */ 75