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 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 #include "hal_config.h" 22 #include "mailbox_ll.h" 23 24 #define mailbox_hal_struct mailbox_hal_t 25 26 bk_err_t mailbox_hal_addr_init(mailbox_hal_t *hal); 27 void mailbox_hal_set_identity(mailbox_hal_t *hal); 28 mailbox_box_num_t mailbox_hal_check_which_box_ready(mailbox_hal_t *hal); 29 mailbox_box_num_t mailbox_hal_check_which_box_trigger(mailbox_hal_t *hal); 30 31 32 #define mailbox_hal_box_init(hal) mailbox_ll_box_init((hal)->hw) 33 34 #define mailbox_hal_write_param0(hal, param0, box) mailbox_ll_write_param0((hal)->hw, param0, box) 35 #define mailbox_hal_write_param1(hal, param1, box) mailbox_ll_write_param1((hal)->hw, param1, box) 36 #define mailbox_hal_write_param2(hal, param2, box) mailbox_ll_write_param2((hal)->hw, param2, box) 37 #define mailbox_hal_write_param3(hal, param3, box) mailbox_ll_write_param3((hal)->hw, param3, box) 38 39 #define mailbox_hal_read_param0(hal, box) mailbox_ll_read_param0((hal)->hw, box) 40 #define mailbox_hal_read_param1(hal, box) mailbox_ll_read_param1((hal)->hw, box) 41 #define mailbox_hal_read_param2(hal, box) mailbox_ll_read_param2((hal)->hw, box) 42 #define mailbox_hal_read_param3(hal, box) mailbox_ll_read_param3((hal)->hw, box) 43 44 #define mailbox_hal_box_trigger(hal, box) mailbox_ll_box_trigger((hal)->hw, box) 45 #define mailbox_hal_box_trigger_ready(hal, box) mailbox_ll_box_trigger_ready((hal)->hw, box) 46 #define mailbox_hal_read_box_ready(hal, box) mailbox_ll_read_box_ready((hal)->hw, box) 47 48 #define mailbox_hal_box_clear(hal, box) mailbox_ll_box_clear((hal)->hw, box) 49 #define mailbox_hal_box_clear_ready(hal, box) mailbox_ll_box_clear_ready((hal)->hw, box) 50 #define mailbox_hal_read_box_erasure(hal, box) mailbox_ll_read_box_erasure((hal)->hw, box) 51 52 #ifdef __cplusplus 53 } 54 #endif 55