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 16 #include <common/bk_include.h> 17 #include "fft_hal.h" 18 #include "fft_ll_macro_def.h" 19 #include <driver/fft_types.h> 20 21 22 fft_hal_status_get(fft_status_t * fft_status)23bk_err_t fft_hal_status_get(fft_status_t *fft_status) 24 { 25 fft_status->fft_done = (bool)fft_ll_get_status_fft_done(); 26 fft_status->fir_done = (bool)fft_ll_get_status_fir_done(); 27 fft_status->self_proc_done = (bool)fft_ll_get_status_self_proc_done(); 28 fft_status->start_trigger = (bool)fft_ll_get_start_trigger_start_trigger(); 29 fft_status->bit_ext = fft_ll_get_status_bit_ext(); 30 31 return BK_OK; 32 } 33 fft_hal_int_enable_status_get(fft_int_status * int_status)34bk_err_t fft_hal_int_enable_status_get(fft_int_status *int_status) 35 { 36 int_status->fft_int_enable = (bool)fft_ll_get_fft_config_fft_int_en(); 37 int_status->fir_int_enable = (bool)fft_ll_get_fir_config_fir_int_en(); 38 39 return BK_OK; 40 } 41 fft_hal_fft_mode_set(uint32_t value)42bk_err_t fft_hal_fft_mode_set(uint32_t value) 43 { 44 fft_ll_set_fft_config_fft_mode(value); 45 46 return BK_OK; 47 } 48 fft_hal_fft_config_reset(uint32_t value)49bk_err_t fft_hal_fft_config_reset(uint32_t value) 50 { 51 fft_ll_set_fft_config_value(value); 52 53 return BK_OK; 54 } 55 fft_hal_fir_config_reset(uint32_t value)56bk_err_t fft_hal_fir_config_reset(uint32_t value) 57 { 58 fft_ll_set_fir_config_value(value); 59 60 return BK_OK; 61 } 62 fft_hal_ifft_en(uint32_t value)63bk_err_t fft_hal_ifft_en(uint32_t value) 64 { 65 fft_ll_set_fft_config_ifft(value); 66 67 return BK_OK; 68 } 69 fft_hal_fft_int_en(uint32_t value)70bk_err_t fft_hal_fft_int_en(uint32_t value) 71 { 72 fft_ll_set_fft_config_fft_int_en(value); 73 74 return BK_OK; 75 } 76 fft_hal_fft_en(uint32_t value)77bk_err_t fft_hal_fft_en(uint32_t value) 78 { 79 fft_ll_set_fft_config_fft_enable(value); 80 81 return BK_OK; 82 } 83 fft_hal_fir_length_set(uint32_t value)84bk_err_t fft_hal_fir_length_set(uint32_t value) 85 { 86 fft_ll_set_fir_config_fir_length(value); 87 88 return BK_OK; 89 } 90 fft_hal_fir_mode_set(uint32_t value)91bk_err_t fft_hal_fir_mode_set(uint32_t value) 92 { 93 fft_ll_set_fir_config_fir_mode(value); 94 95 return BK_OK; 96 } 97 fft_hal_fir_int_en(uint32_t value)98bk_err_t fft_hal_fir_int_en(uint32_t value) 99 { 100 fft_ll_set_fir_config_fir_int_en(value); 101 102 return BK_OK; 103 } 104 fft_hal_fir_en(uint32_t value)105bk_err_t fft_hal_fir_en(uint32_t value) 106 { 107 fft_ll_set_fir_config_fir_enable(value); 108 109 return BK_OK; 110 } 111 fft_hal_data_read(void)112int32 fft_hal_data_read(void) 113 { 114 return fft_ll_get_data_ports_value(); 115 } 116 fft_hal_data_write(uint32_t value)117bk_err_t fft_hal_data_write(uint32_t value) 118 { 119 fft_ll_set_data_ports_value(value); 120 121 return BK_OK; 122 } 123 fft_hal_fir_coef_write(int32 value)124bk_err_t fft_hal_fir_coef_write(int32 value) 125 { 126 fft_ll_set_coef_ports_coef_port(value); 127 128 return BK_OK; 129 } 130 fft_hal_start_trigger_set(uint32_t value)131bk_err_t fft_hal_start_trigger_set(uint32_t value) 132 { 133 fft_ll_set_start_trigger_start_trigger(value); 134 135 return BK_OK; 136 } 137 138