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 rom patch callback function. 15 * Author: 16 * Create: 2023-05-18 17 */ 18 19 #ifndef HCC_ROM_CALLBACK_H 20 #define HCC_ROM_CALLBACK_H 21 #include "hcc_types.h" 22 #include "hcc.h" 23 #include "hcc_queue.h" 24 25 #ifdef __cplusplus 26 #if __cplusplus 27 extern "C" { 28 #endif 29 #endif 30 31 typedef ext_errno (*hcc_tx_data_cb)(td_u8 chl, td_u8 *buf, td_u16 len, hcc_transfer_param *param); 32 typedef ext_errno (*hcc_tx_queue_cb)(hcc_handler *hcc, hcc_trans_queue *queue, hcc_transfer_param *param); 33 typedef td_void (*hcc_rx_enqueue_cb)(hcc_handler *hcc, hcc_queue_type queue_id, hcc_unc_struc *unc_buf); 34 typedef ext_errno (*hcc_rx_data_cb)(hcc_handler *hcc, hcc_trans_queue *queue, td_u16 *pkt_cnt); 35 typedef td_void (*hcc_rx_proc_cb)(hcc_header *hcc_head, td_u8 *buf, td_u8 *user_param, 36 hcc_adapt_priv_rx_process rx_proc); 37 typedef td_void (*hcc_thread_watchdog)(td_void); 38 39 typedef enum { 40 HCC_CB_TX = 0, 41 HCC_CB_TX_QUEUE, 42 HCC_CB_BT_TX, 43 HCC_CB_RX_ENQUE, 44 HCC_CB_RX_DATA, 45 HCC_CB_RX_PROC, 46 HCC_CB_WATCHDOG, 47 HCC_CB_BUTT, 48 } hcc_cb_offset; 49 50 typedef struct _hcc_rom_callback { 51 hcc_tx_data_cb tx_data; 52 hcc_tx_queue_cb tx_queue; 53 hcc_tx_data_cb bt_tx_data; 54 hcc_rx_enqueue_cb rx_enque; 55 hcc_rx_data_cb rx_data; 56 hcc_rx_proc_cb rx_proc; 57 hcc_thread_watchdog watchdog; 58 } hcc_rom_callback; 59 60 td_void hcc_rom_cb_register(hcc_rom_callback *cb); 61 td_void *hcc_get_rom_cb(hcc_cb_offset offset); 62 63 #ifdef __cplusplus 64 #if __cplusplus 65 } 66 #endif 67 #endif 68 69 #endif 70 71