├── Code ├── Algorithm │ ├── Controller.cpp │ ├── Controller.h │ ├── IMU.cpp │ ├── IMU.h │ ├── MsgThread.cpp │ ├── MsgThread.h │ ├── QCSLite.cpp │ ├── QCSLite.h │ ├── QuaternionEKF.c │ ├── QuaternionEKF.h │ ├── kalman_filter.c │ ├── kalman_filter.h │ ├── main.cpp │ └── main.h ├── DSP │ ├── Include │ │ ├── arm_common_tables.h │ │ ├── arm_common_tables_f16.h │ │ ├── arm_const_structs.h │ │ ├── arm_const_structs_f16.h │ │ ├── arm_helium_utils.h │ │ ├── arm_math.h │ │ ├── arm_math_f16.h │ │ ├── arm_math_memory.h │ │ ├── arm_math_types.h │ │ ├── arm_math_types_f16.h │ │ ├── arm_mve_tables.h │ │ ├── arm_mve_tables_f16.h │ │ ├── arm_vec_math.h │ │ ├── arm_vec_math_f16.h │ │ └── dsp │ │ │ ├── basic_math_functions.h │ │ │ ├── basic_math_functions_f16.h │ │ │ ├── bayes_functions.h │ │ │ ├── bayes_functions_f16.h │ │ │ ├── complex_math_functions.h │ │ │ ├── complex_math_functions_f16.h │ │ │ ├── controller_functions.h │ │ │ ├── controller_functions_f16.h │ │ │ ├── debug.h │ │ │ ├── distance_functions.h │ │ │ ├── distance_functions_f16.h │ │ │ ├── fast_math_functions.h │ │ │ ├── fast_math_functions_f16.h │ │ │ ├── filtering_functions.h │ │ │ ├── filtering_functions_f16.h │ │ │ ├── interpolation_functions.h │ │ │ ├── interpolation_functions_f16.h │ │ │ ├── matrix_functions.h │ │ │ ├── matrix_functions_f16.h │ │ │ ├── matrix_utils.h │ │ │ ├── none.h │ │ │ ├── quaternion_math_functions.h │ │ │ ├── statistics_functions.h │ │ │ ├── statistics_functions_f16.h │ │ │ ├── support_functions.h │ │ │ ├── support_functions_f16.h │ │ │ ├── svm_defines.h │ │ │ ├── svm_functions.h │ │ │ ├── svm_functions_f16.h │ │ │ ├── transform_functions.h │ │ │ ├── transform_functions_f16.h │ │ │ ├── utils.h │ │ │ └── window_functions.h │ ├── PrivateInclude │ │ ├── arm_sorting.h │ │ ├── arm_vec_fft.h │ │ └── arm_vec_filtering.h │ └── Source │ │ ├── BasicMathFunctions │ │ ├── BasicMathFunctions.c │ │ ├── BasicMathFunctionsF16.c │ │ ├── Config.cmake │ │ ├── arm_abs_f16.c │ │ ├── arm_abs_f32.c │ │ ├── arm_abs_f64.c │ │ ├── arm_abs_q15.c │ │ ├── arm_abs_q31.c │ │ ├── arm_abs_q7.c │ │ ├── arm_add_f16.c │ │ ├── arm_add_f32.c │ │ ├── arm_add_f64.c │ │ ├── arm_add_q15.c │ │ ├── arm_add_q31.c │ │ ├── arm_add_q7.c │ │ ├── arm_and_u16.c │ │ ├── arm_and_u32.c │ │ ├── arm_and_u8.c │ │ ├── arm_clip_f16.c │ │ ├── arm_clip_f32.c │ │ ├── arm_clip_q15.c │ │ ├── arm_clip_q31.c │ │ ├── arm_clip_q7.c │ │ ├── arm_dot_prod_f16.c │ │ ├── arm_dot_prod_f32.c │ │ ├── arm_dot_prod_f64.c │ │ ├── arm_dot_prod_q15.c │ │ ├── arm_dot_prod_q31.c │ │ ├── arm_dot_prod_q7.c │ │ ├── arm_mult_f16.c │ │ ├── arm_mult_f32.c │ │ ├── arm_mult_f64.c │ │ ├── arm_mult_q15.c │ │ ├── arm_mult_q31.c │ │ ├── arm_mult_q7.c │ │ ├── arm_negate_f16.c │ │ ├── arm_negate_f32.c │ │ ├── arm_negate_f64.c │ │ ├── arm_negate_q15.c │ │ ├── arm_negate_q31.c │ │ ├── arm_negate_q7.c │ │ ├── arm_not_u16.c │ │ ├── arm_not_u32.c │ │ ├── arm_not_u8.c │ │ ├── arm_offset_f16.c │ │ ├── arm_offset_f32.c │ │ ├── arm_offset_f64.c │ │ ├── arm_offset_q15.c │ │ ├── arm_offset_q31.c │ │ ├── arm_offset_q7.c │ │ ├── arm_or_u16.c │ │ ├── arm_or_u32.c │ │ ├── arm_or_u8.c │ │ ├── arm_scale_f16.c │ │ ├── arm_scale_f32.c │ │ ├── arm_scale_f64.c │ │ ├── arm_scale_q15.c │ │ ├── arm_scale_q31.c │ │ ├── arm_scale_q7.c │ │ ├── arm_shift_q15.c │ │ ├── arm_shift_q31.c │ │ ├── arm_shift_q7.c │ │ ├── arm_sub_f16.c │ │ ├── arm_sub_f32.c │ │ ├── arm_sub_f64.c │ │ ├── arm_sub_q15.c │ │ ├── arm_sub_q31.c │ │ ├── arm_sub_q7.c │ │ ├── arm_xor_u16.c │ │ ├── arm_xor_u32.c │ │ └── arm_xor_u8.c │ │ ├── CommonTables │ │ ├── CommonTables.c │ │ ├── CommonTablesF16.c │ │ ├── Config.cmake │ │ ├── arm_common_tables.c │ │ ├── arm_common_tables_f16.c │ │ ├── arm_const_structs.c │ │ ├── arm_const_structs_f16.c │ │ ├── arm_mve_tables.c │ │ └── arm_mve_tables_f16.c │ │ ├── ControllerFunctions │ │ ├── Config.cmake │ │ ├── ControllerFunctions.c │ │ ├── arm_pid_init_f32.c │ │ ├── arm_pid_init_q15.c │ │ ├── arm_pid_init_q31.c │ │ ├── arm_pid_reset_f32.c │ │ ├── arm_pid_reset_q15.c │ │ ├── arm_pid_reset_q31.c │ │ ├── arm_sin_cos_f32.c │ │ └── arm_sin_cos_q31.c │ │ ├── FastMathFunctions │ │ ├── Config.cmake │ │ ├── FastMathFunctions.c │ │ ├── FastMathFunctionsF16.c │ │ ├── arm_atan2_f16.c │ │ ├── arm_atan2_f32.c │ │ ├── arm_atan2_q15.c │ │ ├── arm_atan2_q31.c │ │ ├── arm_cos_f32.c │ │ ├── arm_cos_q15.c │ │ ├── arm_cos_q31.c │ │ ├── arm_divide_q15.c │ │ ├── arm_divide_q31.c │ │ ├── arm_sin_f32.c │ │ ├── arm_sin_q15.c │ │ ├── arm_sin_q31.c │ │ ├── arm_sqrt_q15.c │ │ ├── arm_sqrt_q31.c │ │ ├── arm_vexp_f16.c │ │ ├── arm_vexp_f32.c │ │ ├── arm_vexp_f64.c │ │ ├── arm_vinverse_f16.c │ │ ├── arm_vlog_f16.c │ │ ├── arm_vlog_f32.c │ │ ├── arm_vlog_f64.c │ │ ├── arm_vlog_q15.c │ │ └── arm_vlog_q31.c │ │ ├── FilteringFunctions │ │ ├── Config.cmake │ │ ├── FilteringFunctions.c │ │ ├── FilteringFunctionsF16.c │ │ ├── arm_biquad_cascade_df1_32x64_init_q31.c │ │ ├── arm_biquad_cascade_df1_32x64_q31.c │ │ ├── arm_biquad_cascade_df1_f16.c │ │ ├── arm_biquad_cascade_df1_f32.c │ │ ├── arm_biquad_cascade_df1_fast_q15.c │ │ ├── arm_biquad_cascade_df1_fast_q31.c │ │ ├── arm_biquad_cascade_df1_init_f16.c │ │ ├── arm_biquad_cascade_df1_init_f32.c │ │ ├── arm_biquad_cascade_df1_init_q15.c │ │ ├── arm_biquad_cascade_df1_init_q31.c │ │ ├── arm_biquad_cascade_df1_q15.c │ │ ├── arm_biquad_cascade_df1_q31.c │ │ ├── arm_biquad_cascade_df2T_f16.c │ │ ├── arm_biquad_cascade_df2T_f32.c │ │ ├── arm_biquad_cascade_df2T_f64.c │ │ ├── arm_biquad_cascade_df2T_init_f16.c │ │ ├── arm_biquad_cascade_df2T_init_f32.c │ │ ├── arm_biquad_cascade_df2T_init_f64.c │ │ ├── arm_biquad_cascade_stereo_df2T_f16.c │ │ ├── arm_biquad_cascade_stereo_df2T_f32.c │ │ ├── arm_biquad_cascade_stereo_df2T_init_f16.c │ │ ├── arm_biquad_cascade_stereo_df2T_init_f32.c │ │ ├── arm_conv_f32.c │ │ ├── arm_conv_fast_opt_q15.c │ │ ├── arm_conv_fast_q15.c │ │ ├── arm_conv_fast_q31.c │ │ ├── arm_conv_opt_q15.c │ │ ├── arm_conv_opt_q7.c │ │ ├── arm_conv_partial_f32.c │ │ ├── arm_conv_partial_fast_opt_q15.c │ │ ├── arm_conv_partial_fast_q15.c │ │ ├── arm_conv_partial_fast_q31.c │ │ ├── arm_conv_partial_opt_q15.c │ │ ├── arm_conv_partial_opt_q7.c │ │ ├── arm_conv_partial_q15.c │ │ ├── arm_conv_partial_q31.c │ │ ├── arm_conv_partial_q7.c │ │ ├── arm_conv_q15.c │ │ ├── arm_conv_q31.c │ │ ├── arm_conv_q7.c │ │ ├── arm_correlate_f16.c │ │ ├── arm_correlate_f32.c │ │ ├── arm_correlate_f64.c │ │ ├── arm_correlate_fast_opt_q15.c │ │ ├── arm_correlate_fast_q15.c │ │ ├── arm_correlate_fast_q31.c │ │ ├── arm_correlate_opt_q15.c │ │ ├── arm_correlate_opt_q7.c │ │ ├── arm_correlate_q15.c │ │ ├── arm_correlate_q31.c │ │ ├── arm_correlate_q7.c │ │ ├── arm_fir_decimate_f32.c │ │ ├── arm_fir_decimate_fast_q15.c │ │ ├── arm_fir_decimate_fast_q31.c │ │ ├── arm_fir_decimate_init_f32.c │ │ ├── arm_fir_decimate_init_q15.c │ │ ├── arm_fir_decimate_init_q31.c │ │ ├── arm_fir_decimate_q15.c │ │ ├── arm_fir_decimate_q31.c │ │ ├── arm_fir_f16.c │ │ ├── arm_fir_f32.c │ │ ├── arm_fir_f64.c │ │ ├── arm_fir_fast_q15.c │ │ ├── arm_fir_fast_q31.c │ │ ├── arm_fir_init_f16.c │ │ ├── arm_fir_init_f32.c │ │ ├── arm_fir_init_f64.c │ │ ├── arm_fir_init_q15.c │ │ ├── arm_fir_init_q31.c │ │ ├── arm_fir_init_q7.c │ │ ├── arm_fir_interpolate_f32.c │ │ ├── arm_fir_interpolate_init_f32.c │ │ ├── arm_fir_interpolate_init_q15.c │ │ ├── arm_fir_interpolate_init_q31.c │ │ ├── arm_fir_interpolate_q15.c │ │ ├── arm_fir_interpolate_q31.c │ │ ├── arm_fir_lattice_f32.c │ │ ├── arm_fir_lattice_init_f32.c │ │ ├── arm_fir_lattice_init_q15.c │ │ ├── arm_fir_lattice_init_q31.c │ │ ├── arm_fir_lattice_q15.c │ │ ├── arm_fir_lattice_q31.c │ │ ├── arm_fir_q15.c │ │ ├── arm_fir_q31.c │ │ ├── arm_fir_q7.c │ │ ├── arm_fir_sparse_f32.c │ │ ├── arm_fir_sparse_init_f32.c │ │ ├── arm_fir_sparse_init_q15.c │ │ ├── arm_fir_sparse_init_q31.c │ │ ├── arm_fir_sparse_init_q7.c │ │ ├── arm_fir_sparse_q15.c │ │ ├── arm_fir_sparse_q31.c │ │ ├── arm_fir_sparse_q7.c │ │ ├── arm_iir_lattice_f32.c │ │ ├── arm_iir_lattice_init_f32.c │ │ ├── arm_iir_lattice_init_q15.c │ │ ├── arm_iir_lattice_init_q31.c │ │ ├── arm_iir_lattice_q15.c │ │ ├── arm_iir_lattice_q31.c │ │ ├── arm_levinson_durbin_f16.c │ │ ├── arm_levinson_durbin_f32.c │ │ ├── arm_levinson_durbin_q31.c │ │ ├── arm_lms_f32.c │ │ ├── arm_lms_init_f32.c │ │ ├── arm_lms_init_q15.c │ │ ├── arm_lms_init_q31.c │ │ ├── arm_lms_norm_f32.c │ │ ├── arm_lms_norm_init_f32.c │ │ ├── arm_lms_norm_init_q15.c │ │ ├── arm_lms_norm_init_q31.c │ │ ├── arm_lms_norm_q15.c │ │ ├── arm_lms_norm_q31.c │ │ ├── arm_lms_q15.c │ │ └── arm_lms_q31.c │ │ ├── InterpolationFunctions │ │ ├── Config.cmake │ │ ├── InterpolationFunctions.c │ │ ├── InterpolationFunctionsF16.c │ │ ├── arm_bilinear_interp_f16.c │ │ ├── arm_bilinear_interp_f32.c │ │ ├── arm_bilinear_interp_q15.c │ │ ├── arm_bilinear_interp_q31.c │ │ ├── arm_bilinear_interp_q7.c │ │ ├── arm_linear_interp_f16.c │ │ ├── arm_linear_interp_f32.c │ │ ├── arm_linear_interp_q15.c │ │ ├── arm_linear_interp_q31.c │ │ ├── arm_linear_interp_q7.c │ │ ├── arm_spline_interp_f32.c │ │ └── arm_spline_interp_init_f32.c │ │ ├── MatrixFunctions │ │ ├── Config.cmake │ │ ├── MatrixFunctions.c │ │ ├── MatrixFunctionsF16.c │ │ ├── arm_householder_f16.c │ │ ├── arm_householder_f32.c │ │ ├── arm_householder_f64.c │ │ ├── arm_mat_add_f16.c │ │ ├── arm_mat_add_f32.c │ │ ├── arm_mat_add_q15.c │ │ ├── arm_mat_add_q31.c │ │ ├── arm_mat_cholesky_f16.c │ │ ├── arm_mat_cholesky_f32.c │ │ ├── arm_mat_cholesky_f64.c │ │ ├── arm_mat_cmplx_mult_f16.c │ │ ├── arm_mat_cmplx_mult_f32.c │ │ ├── arm_mat_cmplx_mult_q15.c │ │ ├── arm_mat_cmplx_mult_q31.c │ │ ├── arm_mat_cmplx_trans_f16.c │ │ ├── arm_mat_cmplx_trans_f32.c │ │ ├── arm_mat_cmplx_trans_q15.c │ │ ├── arm_mat_cmplx_trans_q31.c │ │ ├── arm_mat_init_f16.c │ │ ├── arm_mat_init_f32.c │ │ ├── arm_mat_init_f64.c │ │ ├── arm_mat_init_q15.c │ │ ├── arm_mat_init_q31.c │ │ ├── arm_mat_inverse_f16.c │ │ ├── arm_mat_inverse_f32.c │ │ ├── arm_mat_inverse_f64.c │ │ ├── arm_mat_ldlt_f32.c │ │ ├── arm_mat_ldlt_f64.c │ │ ├── arm_mat_mult_f16.c │ │ ├── arm_mat_mult_f32.c │ │ ├── arm_mat_mult_f64.c │ │ ├── arm_mat_mult_fast_q15.c │ │ ├── arm_mat_mult_fast_q31.c │ │ ├── arm_mat_mult_opt_q31.c │ │ ├── arm_mat_mult_q15.c │ │ ├── arm_mat_mult_q31.c │ │ ├── arm_mat_mult_q7.c │ │ ├── arm_mat_qr_f16.c │ │ ├── arm_mat_qr_f32.c │ │ ├── arm_mat_qr_f64.c │ │ ├── arm_mat_scale_f16.c │ │ ├── arm_mat_scale_f32.c │ │ ├── arm_mat_scale_q15.c │ │ ├── arm_mat_scale_q31.c │ │ ├── arm_mat_solve_lower_triangular_f16.c │ │ ├── arm_mat_solve_lower_triangular_f32.c │ │ ├── arm_mat_solve_lower_triangular_f64.c │ │ ├── arm_mat_solve_upper_triangular_f16.c │ │ ├── arm_mat_solve_upper_triangular_f32.c │ │ ├── arm_mat_solve_upper_triangular_f64.c │ │ ├── arm_mat_sub_f16.c │ │ ├── arm_mat_sub_f32.c │ │ ├── arm_mat_sub_f64.c │ │ ├── arm_mat_sub_q15.c │ │ ├── arm_mat_sub_q31.c │ │ ├── arm_mat_trans_f16.c │ │ ├── arm_mat_trans_f32.c │ │ ├── arm_mat_trans_f64.c │ │ ├── arm_mat_trans_q15.c │ │ ├── arm_mat_trans_q31.c │ │ ├── arm_mat_trans_q7.c │ │ ├── arm_mat_vec_mult_f16.c │ │ ├── arm_mat_vec_mult_f32.c │ │ ├── arm_mat_vec_mult_q15.c │ │ ├── arm_mat_vec_mult_q31.c │ │ └── arm_mat_vec_mult_q7.c │ │ ├── QuaternionMathFunctions │ │ ├── Config.cmake │ │ ├── QuaternionMathFunctions.c │ │ ├── arm_quaternion2rotation_f32.c │ │ ├── arm_quaternion_conjugate_f32.c │ │ ├── arm_quaternion_inverse_f32.c │ │ ├── arm_quaternion_norm_f32.c │ │ ├── arm_quaternion_normalize_f32.c │ │ ├── arm_quaternion_product_f32.c │ │ ├── arm_quaternion_product_single_f32.c │ │ └── arm_rotation2quaternion_f32.c │ │ ├── StatisticsFunctions │ │ ├── Config.cmake │ │ ├── StatisticsFunctions.c │ │ ├── StatisticsFunctionsF16.c │ │ ├── arm_absmax_f16.c │ │ ├── arm_absmax_f32.c │ │ ├── arm_absmax_f64.c │ │ ├── arm_absmax_no_idx_f16.c │ │ ├── arm_absmax_no_idx_f32.c │ │ ├── arm_absmax_no_idx_f64.c │ │ ├── arm_absmax_no_idx_q15.c │ │ ├── arm_absmax_no_idx_q31.c │ │ ├── arm_absmax_no_idx_q7.c │ │ ├── arm_absmax_q15.c │ │ ├── arm_absmax_q31.c │ │ ├── arm_absmax_q7.c │ │ ├── arm_absmin_f16.c │ │ ├── arm_absmin_f32.c │ │ ├── arm_absmin_f64.c │ │ ├── arm_absmin_no_idx_f16.c │ │ ├── arm_absmin_no_idx_f32.c │ │ ├── arm_absmin_no_idx_f64.c │ │ ├── arm_absmin_no_idx_q15.c │ │ ├── arm_absmin_no_idx_q31.c │ │ ├── arm_absmin_no_idx_q7.c │ │ ├── arm_absmin_q15.c │ │ ├── arm_absmin_q31.c │ │ ├── arm_absmin_q7.c │ │ ├── arm_accumulate_f16.c │ │ ├── arm_accumulate_f32.c │ │ ├── arm_accumulate_f64.c │ │ ├── arm_entropy_f16.c │ │ ├── arm_entropy_f32.c │ │ ├── arm_entropy_f64.c │ │ ├── arm_kullback_leibler_f16.c │ │ ├── arm_kullback_leibler_f32.c │ │ ├── arm_kullback_leibler_f64.c │ │ ├── arm_logsumexp_dot_prod_f16.c │ │ ├── arm_logsumexp_dot_prod_f32.c │ │ ├── arm_logsumexp_f16.c │ │ ├── arm_logsumexp_f32.c │ │ ├── arm_max_f16.c │ │ ├── arm_max_f32.c │ │ ├── arm_max_f64.c │ │ ├── arm_max_no_idx_f16.c │ │ ├── arm_max_no_idx_f32.c │ │ ├── arm_max_no_idx_f64.c │ │ ├── arm_max_no_idx_q15.c │ │ ├── arm_max_no_idx_q31.c │ │ ├── arm_max_no_idx_q7.c │ │ ├── arm_max_q15.c │ │ ├── arm_max_q31.c │ │ ├── arm_max_q7.c │ │ ├── arm_mean_f16.c │ │ ├── arm_mean_f32.c │ │ ├── arm_mean_f64.c │ │ ├── arm_mean_q15.c │ │ ├── arm_mean_q31.c │ │ ├── arm_mean_q7.c │ │ ├── arm_min_f16.c │ │ ├── arm_min_f32.c │ │ ├── arm_min_f64.c │ │ ├── arm_min_no_idx_f16.c │ │ ├── arm_min_no_idx_f32.c │ │ ├── arm_min_no_idx_f64.c │ │ ├── arm_min_no_idx_q15.c │ │ ├── arm_min_no_idx_q31.c │ │ ├── arm_min_no_idx_q7.c │ │ ├── arm_min_q15.c │ │ ├── arm_min_q31.c │ │ ├── arm_min_q7.c │ │ ├── arm_mse_f16.c │ │ ├── arm_mse_f32.c │ │ ├── arm_mse_f64.c │ │ ├── arm_mse_q15.c │ │ ├── arm_mse_q31.c │ │ ├── arm_mse_q7.c │ │ ├── arm_power_f16.c │ │ ├── arm_power_f32.c │ │ ├── arm_power_f64.c │ │ ├── arm_power_q15.c │ │ ├── arm_power_q31.c │ │ ├── arm_power_q7.c │ │ ├── arm_rms_f16.c │ │ ├── arm_rms_f32.c │ │ ├── arm_rms_q15.c │ │ ├── arm_rms_q31.c │ │ ├── arm_std_f16.c │ │ ├── arm_std_f32.c │ │ ├── arm_std_f64.c │ │ ├── arm_std_q15.c │ │ ├── arm_std_q31.c │ │ ├── arm_var_f16.c │ │ ├── arm_var_f32.c │ │ ├── arm_var_f64.c │ │ ├── arm_var_q15.c │ │ └── arm_var_q31.c │ │ └── SupportFunctions │ │ ├── Config.cmake │ │ ├── SupportFunctions.c │ │ ├── SupportFunctionsF16.c │ │ ├── arm_barycenter_f16.c │ │ ├── arm_barycenter_f32.c │ │ ├── arm_bitonic_sort_f32.c │ │ ├── arm_bubble_sort_f32.c │ │ ├── arm_copy_f16.c │ │ ├── arm_copy_f32.c │ │ ├── arm_copy_f64.c │ │ ├── arm_copy_q15.c │ │ ├── arm_copy_q31.c │ │ ├── arm_copy_q7.c │ │ ├── arm_f16_to_f64.c │ │ ├── arm_f16_to_float.c │ │ ├── arm_f16_to_q15.c │ │ ├── arm_f64_to_f16.c │ │ ├── arm_f64_to_float.c │ │ ├── arm_f64_to_q15.c │ │ ├── arm_f64_to_q31.c │ │ ├── arm_f64_to_q7.c │ │ ├── arm_fill_f16.c │ │ ├── arm_fill_f32.c │ │ ├── arm_fill_f64.c │ │ ├── arm_fill_q15.c │ │ ├── arm_fill_q31.c │ │ ├── arm_fill_q7.c │ │ ├── arm_float_to_f16.c │ │ ├── arm_float_to_f64.c │ │ ├── arm_float_to_q15.c │ │ ├── arm_float_to_q31.c │ │ ├── arm_float_to_q7.c │ │ ├── arm_heap_sort_f32.c │ │ ├── arm_insertion_sort_f32.c │ │ ├── arm_merge_sort_f32.c │ │ ├── arm_merge_sort_init_f32.c │ │ ├── arm_q15_to_f16.c │ │ ├── arm_q15_to_f64.c │ │ ├── arm_q15_to_float.c │ │ ├── arm_q15_to_q31.c │ │ ├── arm_q15_to_q7.c │ │ ├── arm_q31_to_f64.c │ │ ├── arm_q31_to_float.c │ │ ├── arm_q31_to_q15.c │ │ ├── arm_q31_to_q7.c │ │ ├── arm_q7_to_f64.c │ │ ├── arm_q7_to_float.c │ │ ├── arm_q7_to_q15.c │ │ ├── arm_q7_to_q31.c │ │ ├── arm_quick_sort_f32.c │ │ ├── arm_selection_sort_f32.c │ │ ├── arm_sort_f32.c │ │ ├── arm_sort_init_f32.c │ │ ├── arm_weighted_sum_f16.c │ │ └── arm_weighted_sum_f32.c ├── Drivers │ ├── CRC8.c │ ├── CRC8.h │ ├── Data_Exchange.c │ ├── Data_Exchange.h │ ├── Flash_GD.c │ ├── Flash_GD.h │ ├── ICM42688.cpp │ ├── ICM42688.h │ ├── PID.cpp │ ├── PID.h │ ├── SPI_GD.cpp │ ├── SPI_GD.h │ ├── UART_GD.cpp │ ├── UART_GD.h │ ├── WS281x.cpp │ ├── WS281x.h │ ├── gd32f30x_it.c │ ├── gd32f30x_it.h │ └── gd32f30x_libopt.h ├── GD32F30x_standard_peripheral │ ├── GD32F30x │ │ ├── Include │ │ │ ├── gd32f30x.h │ │ │ └── system_gd32f30x.h │ │ └── Source │ │ │ ├── ARM │ │ │ ├── startup_gd32f30x_cl.s │ │ │ ├── startup_gd32f30x_hd.s │ │ │ └── startup_gd32f30x_xd.s │ │ │ ├── IAR │ │ │ ├── startup_gd32f30x_cl.s │ │ │ ├── startup_gd32f30x_hd.s │ │ │ └── startup_gd32f30x_xd.s │ │ │ └── system_gd32f30x.c │ ├── Include │ │ ├── gd32f30x_adc.h │ │ ├── gd32f30x_bkp.h │ │ ├── gd32f30x_can.h │ │ ├── gd32f30x_crc.h │ │ ├── gd32f30x_ctc.h │ │ ├── gd32f30x_dac.h │ │ ├── gd32f30x_dbg.h │ │ ├── gd32f30x_dma.h │ │ ├── gd32f30x_enet.h │ │ ├── gd32f30x_exmc.h │ │ ├── gd32f30x_exti.h │ │ ├── gd32f30x_fmc.h │ │ ├── gd32f30x_fwdgt.h │ │ ├── gd32f30x_gpio.h │ │ ├── gd32f30x_i2c.h │ │ ├── gd32f30x_misc.h │ │ ├── gd32f30x_pmu.h │ │ ├── gd32f30x_rcu.h │ │ ├── gd32f30x_rtc.h │ │ ├── gd32f30x_sdio.h │ │ ├── gd32f30x_spi.h │ │ ├── gd32f30x_timer.h │ │ ├── gd32f30x_usart.h │ │ └── gd32f30x_wwdgt.h │ └── Source │ │ ├── gd32f30x_adc.c │ │ ├── gd32f30x_bkp.c │ │ ├── gd32f30x_can.c │ │ ├── gd32f30x_crc.c │ │ ├── gd32f30x_ctc.c │ │ ├── gd32f30x_dac.c │ │ ├── gd32f30x_dbg.c │ │ ├── gd32f30x_dma.c │ │ ├── gd32f30x_enet.c │ │ ├── gd32f30x_exmc.c │ │ ├── gd32f30x_exti.c │ │ ├── gd32f30x_fmc.c │ │ ├── gd32f30x_fwdgt.c │ │ ├── gd32f30x_gpio.c │ │ ├── gd32f30x_i2c.c │ │ ├── gd32f30x_misc.c │ │ ├── gd32f30x_pmu.c │ │ ├── gd32f30x_rcu.c │ │ ├── gd32f30x_rtc.c │ │ ├── gd32f30x_sdio.c │ │ ├── gd32f30x_spi.c │ │ ├── gd32f30x_timer.c │ │ ├── gd32f30x_usart.c │ │ └── gd32f30x_wwdgt.c ├── GD32F30x_usbd_library │ ├── class │ │ └── device │ │ │ └── cdc │ │ │ ├── Include │ │ │ ├── cdc_acm_core.h │ │ │ ├── usbd_conf.h │ │ │ └── usbd_hw.h │ │ │ └── Source │ │ │ └── cdc_acm_core.c │ ├── device │ │ ├── Include │ │ │ ├── usb_ch9_std.h │ │ │ ├── usbd_core.h │ │ │ ├── usbd_enum.h │ │ │ ├── usbd_pwr.h │ │ │ └── usbd_transc.h │ │ └── Source │ │ │ ├── usbd_core.c │ │ │ ├── usbd_enum.c │ │ │ ├── usbd_pwr.c │ │ │ └── usbd_transc.c │ └── usbd │ │ ├── Include │ │ ├── usbd_lld_core.h │ │ ├── usbd_lld_int.h │ │ └── usbd_lld_regs.h │ │ └── Source │ │ ├── usbd_lld_core.c │ │ └── usbd_lld_int.c ├── GY_H1_V1.3.0.axf ├── GY_H1_V1.3.0.hex ├── MDK-Arm │ ├── EventRecorderStub.scvd │ ├── GY_H1.uvguix.千万 │ ├── GY_H1.uvoptx │ ├── GY_H1.uvprojx │ ├── Keil5_disp_size_bar_v0.4.exe │ ├── Listings │ │ ├── GY_H1.map │ │ └── rtthread.map │ ├── Objects │ │ ├── GY_H1.axf │ │ ├── GY_H1.hex │ │ └── GY_H1.sct │ └── RTE │ │ ├── _GY-H1 │ │ └── RTE_Components.h │ │ └── _Target_1 │ │ └── RTE_Components.h └── RT-Thread │ ├── bsp │ ├── board.c │ └── rtconfig.h │ ├── components │ ├── device │ │ └── device.c │ └── finsh │ │ ├── cmd.c │ │ ├── finsh.h │ │ ├── finsh_api.h │ │ ├── finsh_config.h │ │ ├── finsh_port.c │ │ ├── msh.c │ │ ├── msh.h │ │ ├── shell.c │ │ └── shell.h │ ├── include │ ├── libc │ │ ├── libc_dirent.h │ │ ├── libc_errno.h │ │ ├── libc_fcntl.h │ │ ├── libc_fdset.h │ │ ├── libc_ioctl.h │ │ ├── libc_signal.h │ │ └── libc_stat.h │ ├── rtdbg.h │ ├── rtdebug.h │ ├── rtdef.h │ ├── rthw.h │ ├── rtlibc.h │ ├── rtm.h │ ├── rtservice.h │ └── rtthread.h │ ├── libcpu │ └── arm │ │ └── cortex-m4 │ │ ├── context_gcc.S │ │ ├── context_iar.S │ │ ├── context_rvds.S │ │ └── cpuport.c │ └── src │ ├── clock.c │ ├── components.c │ ├── cpu.c │ ├── idle.c │ ├── ipc.c │ ├── irq.c │ ├── kservice.c │ ├── mem.c │ ├── memheap.c │ ├── mempool.c │ ├── object.c │ ├── scheduler.c │ ├── slab.c │ ├── thread.c │ └── timer.c ├── Document ├── ASM_V1.1.pdf ├── BOM_V1.1.xlsx ├── Board_Shape.dxf ├── Calibration_Fixture.stl ├── GerberV1.1.zip ├── PlaceV1.1.csv ├── Render.png └── SCH_V1.1.pdf ├── README.md └── Upper ├── GY-H1_Assistance_V1.1.exe ├── SourceCode ├── DataProcess.py ├── Upper.py └── Upper.spec └── Test └── test.py /Code/Algorithm/Controller.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Algorithm/Controller.cpp -------------------------------------------------------------------------------- /Code/Algorithm/Controller.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Algorithm/Controller.h -------------------------------------------------------------------------------- /Code/Algorithm/IMU.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Algorithm/IMU.cpp -------------------------------------------------------------------------------- /Code/Algorithm/IMU.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Algorithm/IMU.h -------------------------------------------------------------------------------- /Code/Algorithm/MsgThread.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Algorithm/MsgThread.cpp -------------------------------------------------------------------------------- /Code/Algorithm/MsgThread.h: -------------------------------------------------------------------------------- 1 | #ifndef MSG_THREAD 2 | #define MSG_THREAD 3 | #include 4 | #include "UART_GD.h" 5 | #include "usbd_core.h" 6 | #include "cdc_acm_core.h" 7 | #include "usbd_lld_int.h" 8 | #include "usbd_lld_core.h" 9 | #ifdef __cplusplus 10 | #define CMD_PACG_HEAD 0x30 11 | class cMSG : public cUART 12 | { 13 | 14 | public: 15 | uint8_t UartRecBuf[10]; 16 | usb_cdc_handler *USB_COM = RT_NULL; 17 | can_receive_message_struct *CAN_RecMsg = RT_NULL; 18 | 19 | uint8_t UartTx(uint8_t *pdata, uint16_t Length, rt_int32_t WaitTime); 20 | uint8_t UartTx(uint8_t Head, uint8_t *pdata, uint16_t Length, rt_int32_t WaitTime); 21 | void Printf(const char * format, ...); 22 | 23 | uint8_t USBTx(uint8_t *pdata, uint16_t Length, rt_int32_t WaitTime); 24 | void CANTx(uint16_t CAN_ID, uint8_t* data, uint8_t len); 25 | }; 26 | extern cMSG *Msg; 27 | 28 | extern "C" { 29 | void DMA0_Channel3_IRQHandler(void); 30 | void USART0_IRQHandler(void); 31 | void rt_hw_console_output(const char *str); 32 | void USBD_LP_CAN0_RX0_IRQHandler(void); 33 | void USBD_WKUP_IRQHandler(void); 34 | void CAN0_RX1_IRQHandler(void); 35 | } 36 | 37 | #endif 38 | #endif -------------------------------------------------------------------------------- /Code/Algorithm/QCSLite.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Algorithm/QCSLite.h -------------------------------------------------------------------------------- /Code/Algorithm/QuaternionEKF.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file kalman filter.c 4 | * @author Wang Hongxi 5 | * @version V1.2.2 6 | * @date 2022/1/8 7 | * @brief C implementation of kalman filter 8 | 9 | * @author qianwan 10 | * @version V2.0.0 11 | * @date 2023/07/31 12 | * @brief Remove accel lowpass;Remove quaternion from struct; 13 | ****************************************************************************** 14 | * @attention 15 | * 16 | ****************************************************************************** 17 | */ 18 | #ifndef _QUAT_EKF_H 19 | #define _QUAT_EKF_H 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | #include "main.h" 24 | #include "arm_math.h" 25 | #include "kalman_filter.h" 26 | 27 | /* boolean type definitions */ 28 | #ifndef TRUE 29 | #define TRUE 1 /**< boolean true */ 30 | #endif 31 | 32 | #ifndef FALSE 33 | #define FALSE 0 /**< boolean fails */ 34 | #endif 35 | 36 | typedef struct 37 | { 38 | KalmanFilter_t IMU_QuaternionEKF; 39 | uint8_t ConvergeFlag; 40 | uint8_t StableFlag; 41 | uint64_t ErrorCount; 42 | uint64_t UpdateCount; 43 | 44 | float GyroBias[3]; // 陀螺仪零偏估计值 45 | 46 | float Gyro[3]; 47 | float Accel[3]; 48 | 49 | float OrientationCosine[3]; 50 | 51 | float gyro_norm; 52 | float accl_norm; 53 | float AdaptiveGainScale; 54 | 55 | float YawTotalAngle; 56 | 57 | float Q1; // 四元数更新过程噪声 58 | float Q2; // 陀螺仪零偏过程噪声 59 | float R; // 加速度计量测噪声 60 | 61 | float dt; // 姿态更新周期 62 | mat ChiSquare; 63 | float ChiSquare_Data[1]; // 卡方检验检测函数 64 | float ChiSquareTestThreshold; // 卡方检验阈值 65 | float lambda; // 渐消因子 66 | 67 | } QEKF_INS_t; 68 | 69 | extern QEKF_INS_t QEKF_INS; 70 | extern float chiSquare; 71 | extern float ChiSquareTestThreshold; 72 | void IMU_QuaternionEKF_Init(float process_noise1, float process_noise2, float measure_noise, float lambda, float dt); 73 | void IMU_QuaternionEKF_Update(float *q, float gx, float gy, float gz, float ax, float ay, float az); 74 | void IMU_QuaternionEKF_Reset(void); 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | #endif 79 | 80 | -------------------------------------------------------------------------------- /Code/Algorithm/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Algorithm/main.cpp -------------------------------------------------------------------------------- /Code/Algorithm/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | #include "gd32f30x_it.h" 4 | #include "rthw.h" 5 | #include "rtthread.h" 6 | #include "usbd_core.h" 7 | #define GD32_LIB 8 | #define FLASH_USERDATA_ADDRESS ((uint32_t)0x803F800U)//Page 127 9 | #define FLASH_USERDATA_DATAWORDS ((uint16_t)0x05)); 10 | /* 11 | Word[0]: Config 12 | Word[1]: GyroCali-X GyroCali-Y 13 | Word[2]: GyroCali-Z ACCLCali-X 14 | Word[3]: ACCLCali-Y ACCLCali-Z 15 | Word[4]: CRC 16 | */ 17 | 18 | 19 | #ifdef __cplusplus 20 | 21 | extern "C" { 22 | int main(void); 23 | void DMA1_Channel1_IRQHandler(void); 24 | long list_thread(void); 25 | long list_sem(void); 26 | long list_msgqueue(void); 27 | 28 | //extern uint16_t TxNum; 29 | //extern uint16_t TxTask; 30 | //extern uint16_t TxDir; 31 | //extern uint16_t TxBuf; 32 | //extern uint8_t Test0; 33 | //extern uint8_t Test1; 34 | //extern uint8_t Test2; 35 | //extern uint8_t Test3; 36 | } 37 | #endif 38 | #endif -------------------------------------------------------------------------------- /Code/DSP/Include/arm_math_f16.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file arm_math_f16.h 3 | * @brief Public header file for f16 function of the CMSIS DSP Library 4 | * @version V1.10.0 5 | * @date 08 July 2021 6 | * Target Processor: Cortex-M and Cortex-A cores 7 | ******************************************************************************/ 8 | /* 9 | * Copyright (c) 2010-2021 Arm Limited or its affiliates. All rights reserved. 10 | * 11 | * SPDX-License-Identifier: Apache-2.0 12 | * 13 | * Licensed under the Apache License, Version 2.0 (the License); you may 14 | * not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at 16 | * 17 | * www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 21 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | */ 25 | 26 | #ifndef _ARM_MATH_F16_H 27 | #define _ARM_MATH_F16_H 28 | 29 | #include "arm_math.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" 33 | { 34 | #endif 35 | 36 | #include "arm_math_types_f16.h" 37 | #include "dsp/none.h" 38 | #include "dsp/utils.h" 39 | #include "dsp/basic_math_functions_f16.h" 40 | #include "dsp/interpolation_functions_f16.h" 41 | #include "dsp/bayes_functions_f16.h" 42 | #include "dsp/matrix_functions_f16.h" 43 | #include "dsp/complex_math_functions_f16.h" 44 | #include "dsp/statistics_functions_f16.h" 45 | #include "dsp/controller_functions_f16.h" 46 | #include "dsp/support_functions_f16.h" 47 | #include "dsp/distance_functions_f16.h" 48 | #include "dsp/svm_functions_f16.h" 49 | #include "dsp/fast_math_functions_f16.h" 50 | #include "dsp/transform_functions_f16.h" 51 | #include "dsp/filtering_functions_f16.h" 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* _ARM_MATH_F16_H */ 58 | 59 | 60 | -------------------------------------------------------------------------------- /Code/DSP/Include/dsp/bayes_functions_f16.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file bayes_functions_f16.h 3 | * @brief Public header file for CMSIS DSP Library 4 | * @version V1.10.0 5 | * @date 08 July 2021 6 | * Target Processor: Cortex-M and Cortex-A cores 7 | ******************************************************************************/ 8 | /* 9 | * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved. 10 | * 11 | * SPDX-License-Identifier: Apache-2.0 12 | * 13 | * Licensed under the Apache License, Version 2.0 (the License); you may 14 | * not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at 16 | * 17 | * www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 21 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | */ 25 | 26 | 27 | #ifndef _BAYES_FUNCTIONS_F16_H_ 28 | #define _BAYES_FUNCTIONS_F16_H_ 29 | 30 | #include "arm_math_types_f16.h" 31 | #include "arm_math_memory.h" 32 | 33 | #include "dsp/none.h" 34 | #include "dsp/utils.h" 35 | 36 | #include "dsp/statistics_functions_f16.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C" 40 | { 41 | #endif 42 | 43 | #if defined(ARM_FLOAT16_SUPPORTED) 44 | 45 | /** 46 | * @brief Instance structure for Naive Gaussian Bayesian estimator. 47 | */ 48 | typedef struct 49 | { 50 | uint32_t vectorDimension; /**< Dimension of vector space */ 51 | uint32_t numberOfClasses; /**< Number of different classes */ 52 | const float16_t *theta; /**< Mean values for the Gaussians */ 53 | const float16_t *sigma; /**< Variances for the Gaussians */ 54 | const float16_t *classPriors; /**< Class prior probabilities */ 55 | float16_t epsilon; /**< Additive value to variances */ 56 | } arm_gaussian_naive_bayes_instance_f16; 57 | 58 | /** 59 | * @brief Naive Gaussian Bayesian Estimator 60 | * 61 | * @param[in] S points to a naive bayes instance structure 62 | * @param[in] in points to the elements of the input vector. 63 | * @param[out] *pOutputProbabilities points to a buffer of length numberOfClasses containing estimated probabilities 64 | * @param[out] *pBufferB points to a temporary buffer of length numberOfClasses 65 | * @return The predicted class 66 | * 67 | */ 68 | 69 | 70 | uint32_t arm_gaussian_naive_bayes_predict_f16(const arm_gaussian_naive_bayes_instance_f16 *S, 71 | const float16_t * in, 72 | float16_t *pOutputProbabilities, 73 | float16_t *pBufferB); 74 | 75 | #endif /*defined(ARM_FLOAT16_SUPPORTED)*/ 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* ifndef _BAYES_FUNCTIONS_F16_H_ */ 81 | -------------------------------------------------------------------------------- /Code/DSP/Include/dsp/controller_functions_f16.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file controller_functions_f16.h 3 | * @brief Public header file for CMSIS DSP Library 4 | * @version V1.10.0 5 | * @date 08 July 2021 6 | * Target Processor: Cortex-M and Cortex-A cores 7 | ******************************************************************************/ 8 | /* 9 | * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved. 10 | * 11 | * SPDX-License-Identifier: Apache-2.0 12 | * 13 | * Licensed under the Apache License, Version 2.0 (the License); you may 14 | * not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at 16 | * 17 | * www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 21 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | */ 25 | 26 | 27 | #ifndef _CONTROLLER_FUNCTIONS_F16_H_ 28 | #define _CONTROLLER_FUNCTIONS_F16_H_ 29 | 30 | #ifdef __cplusplus 31 | extern "C" 32 | { 33 | #endif 34 | 35 | #if defined(ARM_FLOAT16_SUPPORTED) 36 | #endif /*defined(ARM_FLOAT16_SUPPORTED)*/ 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* ifndef _CONTROLLER_FUNCTIONS_F16_H_ */ 42 | -------------------------------------------------------------------------------- /Code/DSP/Include/dsp/svm_defines.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file svm_defines.h 3 | * @brief Public header file for CMSIS DSP Library 4 | * @version V1.10.0 5 | * @date 08 July 2021 6 | * 7 | * Target Processor: Cortex-M and Cortex-A cores 8 | ******************************************************************************/ 9 | /* 10 | * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved. 11 | * 12 | * SPDX-License-Identifier: Apache-2.0 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the License); you may 15 | * not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | */ 26 | 27 | 28 | #ifndef _SVM_DEFINES_H_ 29 | #define _SVM_DEFINES_H_ 30 | 31 | /** 32 | * @brief Struct for specifying SVM Kernel 33 | */ 34 | typedef enum 35 | { 36 | ARM_ML_KERNEL_LINEAR = 0, 37 | /**< Linear kernel */ 38 | ARM_ML_KERNEL_POLYNOMIAL = 1, 39 | /**< Polynomial kernel */ 40 | ARM_ML_KERNEL_RBF = 2, 41 | /**< Radial Basis Function kernel */ 42 | ARM_ML_KERNEL_SIGMOID = 3 43 | /**< Sigmoid kernel */ 44 | } arm_ml_kernel_type; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Code/DSP/Source/BasicMathFunctions/BasicMathFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: BasicMathFunctions.c 4 | * Description: Combination of all basic math function source files. 5 | * 6 | * $Date: 16. March 2020 7 | * $Revision: V1.1.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_abs_f32.c" 30 | #include "arm_abs_f64.c" 31 | #include "arm_abs_q15.c" 32 | #include "arm_abs_q31.c" 33 | #include "arm_abs_q7.c" 34 | #include "arm_add_f32.c" 35 | #include "arm_add_f64.c" 36 | #include "arm_add_q15.c" 37 | #include "arm_add_q31.c" 38 | #include "arm_add_q7.c" 39 | #include "arm_and_u16.c" 40 | #include "arm_and_u32.c" 41 | #include "arm_and_u8.c" 42 | #include "arm_dot_prod_f32.c" 43 | #include "arm_dot_prod_f64.c" 44 | #include "arm_dot_prod_q15.c" 45 | #include "arm_dot_prod_q31.c" 46 | #include "arm_dot_prod_q7.c" 47 | #include "arm_mult_f32.c" 48 | #include "arm_mult_f64.c" 49 | #include "arm_mult_q15.c" 50 | #include "arm_mult_q31.c" 51 | #include "arm_mult_q7.c" 52 | #include "arm_negate_f32.c" 53 | #include "arm_negate_f64.c" 54 | #include "arm_negate_q15.c" 55 | #include "arm_negate_q31.c" 56 | #include "arm_negate_q7.c" 57 | #include "arm_not_u16.c" 58 | #include "arm_not_u32.c" 59 | #include "arm_not_u8.c" 60 | #include "arm_offset_f32.c" 61 | #include "arm_offset_f64.c" 62 | #include "arm_offset_q15.c" 63 | #include "arm_offset_q31.c" 64 | #include "arm_offset_q7.c" 65 | #include "arm_or_u16.c" 66 | #include "arm_or_u32.c" 67 | #include "arm_or_u8.c" 68 | #include "arm_scale_f32.c" 69 | #include "arm_scale_f64.c" 70 | #include "arm_scale_q15.c" 71 | #include "arm_scale_q31.c" 72 | #include "arm_scale_q7.c" 73 | #include "arm_shift_q15.c" 74 | #include "arm_shift_q31.c" 75 | #include "arm_shift_q7.c" 76 | #include "arm_sub_f32.c" 77 | #include "arm_sub_f64.c" 78 | #include "arm_sub_q15.c" 79 | #include "arm_sub_q31.c" 80 | #include "arm_sub_q7.c" 81 | #include "arm_xor_u16.c" 82 | #include "arm_xor_u32.c" 83 | #include "arm_xor_u8.c" 84 | #include "arm_clip_f32.c" 85 | #include "arm_clip_q31.c" 86 | #include "arm_clip_q15.c" 87 | #include "arm_clip_q7.c" 88 | -------------------------------------------------------------------------------- /Code/DSP/Source/BasicMathFunctions/BasicMathFunctionsF16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: BasicMathFunctionsF16.c 4 | * Description: Combination of all basic math function f16 source files. 5 | * 6 | * $Date: 20. April 2020 7 | * $Revision: V1.1.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_abs_f16.c" 30 | #include "arm_add_f16.c" 31 | #include "arm_dot_prod_f16.c" 32 | #include "arm_mult_f16.c" 33 | #include "arm_negate_f16.c" 34 | #include "arm_offset_f16.c" 35 | #include "arm_scale_f16.c" 36 | #include "arm_sub_f16.c" 37 | #include "arm_clip_f16.c" 38 | -------------------------------------------------------------------------------- /Code/DSP/Source/BasicMathFunctions/arm_abs_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_abs_f64.c 4 | * Description: Floating-point vector absolute value 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/basic_math_functions.h" 30 | #include 31 | 32 | /** 33 | @ingroup groupMath 34 | */ 35 | 36 | /** 37 | @addtogroup BasicAbs 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Floating-point vector absolute value. 43 | @param[in] pSrc points to the input vector 44 | @param[out] pDst points to the output vector 45 | @param[in] blockSize number of samples in each vector 46 | @return none 47 | */ 48 | 49 | void arm_abs_f64( 50 | const float64_t * pSrc, 51 | float64_t * pDst, 52 | uint32_t blockSize) 53 | { 54 | uint32_t blkCnt; /* Loop counter */ 55 | 56 | /* Initialize blkCnt with number of samples */ 57 | blkCnt = blockSize; 58 | 59 | while (blkCnt > 0U) 60 | { 61 | /* C = |A| */ 62 | 63 | /* Calculate absolute and store result in destination buffer. */ 64 | *pDst++ = fabs(*pSrc++); 65 | 66 | /* Decrement loop counter */ 67 | blkCnt--; 68 | } 69 | 70 | } 71 | 72 | /** 73 | @} end of BasicAbs group 74 | */ 75 | -------------------------------------------------------------------------------- /Code/DSP/Source/BasicMathFunctions/arm_add_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_add_f64.c 4 | * Description: Floating-point vector addition 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/basic_math_functions.h" 30 | 31 | /** 32 | @ingroup groupMath 33 | */ 34 | 35 | /** 36 | @addtogroup BasicAdd 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Floating-point vector addition. 42 | @param[in] pSrcA points to first input vector 43 | @param[in] pSrcB points to second input vector 44 | @param[out] pDst points to output vector 45 | @param[in] blockSize number of samples in each vector 46 | @return none 47 | */ 48 | 49 | void arm_add_f64( 50 | const float64_t * pSrcA, 51 | const float64_t * pSrcB, 52 | float64_t * pDst, 53 | uint32_t blockSize) 54 | { 55 | uint32_t blkCnt; /* Loop counter */ 56 | 57 | /* Initialize blkCnt with number of samples */ 58 | blkCnt = blockSize; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = A + B */ 63 | 64 | /* Add and store result in destination buffer. */ 65 | *pDst++ = (*pSrcA++) + (*pSrcB++); 66 | 67 | /* Decrement loop counter */ 68 | blkCnt--; 69 | } 70 | 71 | } 72 | 73 | /** 74 | @} end of BasicAdd group 75 | */ 76 | -------------------------------------------------------------------------------- /Code/DSP/Source/BasicMathFunctions/arm_mult_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mult_f64.c 4 | * Description: Floating-point vector multiplication 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/basic_math_functions.h" 30 | 31 | /** 32 | @ingroup groupMath 33 | */ 34 | 35 | /** 36 | @addtogroup BasicMult 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Floating-point vector multiplication. 42 | @param[in] pSrcA points to the first input vector. 43 | @param[in] pSrcB points to the second input vector. 44 | @param[out] pDst points to the output vector. 45 | @param[in] blockSize number of samples in each vector. 46 | @return none 47 | */ 48 | 49 | void arm_mult_f64( 50 | const float64_t * pSrcA, 51 | const float64_t * pSrcB, 52 | float64_t * pDst, 53 | uint32_t blockSize) 54 | { 55 | uint32_t blkCnt; /* Loop counter */ 56 | 57 | /* Initialize blkCnt with number of samples */ 58 | blkCnt = blockSize; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = A * B */ 63 | 64 | /* Multiply input and store result in destination buffer. */ 65 | *pDst++ = (*pSrcA++) * (*pSrcB++); 66 | 67 | /* Decrement loop counter */ 68 | blkCnt--; 69 | } 70 | 71 | } 72 | 73 | /** 74 | @} end of BasicMult group 75 | */ 76 | -------------------------------------------------------------------------------- /Code/DSP/Source/BasicMathFunctions/arm_negate_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_negate_f64.c 4 | * Description: Negates floating-point vectors 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/basic_math_functions.h" 30 | 31 | /** 32 | @ingroup groupMath 33 | */ 34 | 35 | /** 36 | @addtogroup BasicNegate 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Negates the elements of a floating-point vector. 42 | @param[in] pSrc points to input vector. 43 | @param[out] pDst points to output vector. 44 | @param[in] blockSize number of samples in each vector. 45 | @return none 46 | */ 47 | 48 | void arm_negate_f64( 49 | const float64_t * pSrc, 50 | float64_t * pDst, 51 | uint32_t blockSize) 52 | { 53 | uint32_t blkCnt; /* Loop counter */ 54 | 55 | /* Initialize blkCnt with number of samples */ 56 | blkCnt = blockSize; 57 | 58 | while (blkCnt > 0U) 59 | { 60 | /* C = -A */ 61 | 62 | /* Negate and store result in destination buffer. */ 63 | *pDst++ = -*pSrc++; 64 | 65 | /* Decrement loop counter */ 66 | blkCnt--; 67 | } 68 | 69 | } 70 | 71 | /** 72 | @} end of BasicNegate group 73 | */ 74 | -------------------------------------------------------------------------------- /Code/DSP/Source/BasicMathFunctions/arm_offset_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_offset_f64.c 4 | * Description: Floating-point vector offset 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/basic_math_functions.h" 30 | 31 | /** 32 | @ingroup groupMath 33 | */ 34 | 35 | /** 36 | @addtogroup BasicOffset 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Adds a constant offset to a floating-point vector. 42 | @param[in] pSrc points to the input vector 43 | @param[in] offset is the offset to be added 44 | @param[out] pDst points to the output vector 45 | @param[in] blockSize number of samples in each vector 46 | @return none 47 | */ 48 | 49 | void arm_offset_f64( 50 | const float64_t * pSrc, 51 | float64_t offset, 52 | float64_t * pDst, 53 | uint32_t blockSize) 54 | { 55 | uint32_t blkCnt; /* Loop counter */ 56 | 57 | /* Initialize blkCnt with number of samples */ 58 | blkCnt = blockSize; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = A + offset */ 63 | 64 | /* Add offset and store result in destination buffer. */ 65 | *pDst++ = (*pSrc++) + offset; 66 | 67 | /* Decrement loop counter */ 68 | blkCnt--; 69 | } 70 | 71 | } 72 | 73 | /** 74 | @} end of BasicOffset group 75 | */ 76 | -------------------------------------------------------------------------------- /Code/DSP/Source/BasicMathFunctions/arm_scale_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_scale_f64.c 4 | * Description: Multiplies a floating-point vector by a scalar 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/basic_math_functions.h" 30 | 31 | /** 32 | @ingroup groupMath 33 | */ 34 | 35 | /** 36 | @addtogroup BasicScale 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Multiplies a floating-point vector by a scalar. 42 | @param[in] pSrc points to the input vector 43 | @param[in] scale scale factor to be applied 44 | @param[out] pDst points to the output vector 45 | @param[in] blockSize number of samples in each vector 46 | @return none 47 | */ 48 | 49 | void arm_scale_f64( 50 | const float64_t *pSrc, 51 | float64_t scale, 52 | float64_t *pDst, 53 | uint32_t blockSize) 54 | { 55 | uint32_t blkCnt; /* Loop counter */ 56 | 57 | /* Initialize blkCnt with number of samples */ 58 | blkCnt = blockSize; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = A * scale */ 63 | 64 | /* Scale input and store result in destination buffer. */ 65 | *pDst++ = (*pSrc++) * scale; 66 | 67 | /* Decrement loop counter */ 68 | blkCnt--; 69 | } 70 | 71 | } 72 | 73 | /** 74 | @} end of BasicScale group 75 | */ 76 | -------------------------------------------------------------------------------- /Code/DSP/Source/BasicMathFunctions/arm_sub_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_sub_f64.c 4 | * Description: Floating-point vector subtraction 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/basic_math_functions.h" 30 | 31 | /** 32 | @ingroup groupMath 33 | */ 34 | 35 | /** 36 | @addtogroup BasicSub 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Floating-point vector subtraction. 42 | @param[in] pSrcA points to the first input vector 43 | @param[in] pSrcB points to the second input vector 44 | @param[out] pDst points to the output vector 45 | @param[in] blockSize number of samples in each vector 46 | @return none 47 | */ 48 | 49 | void arm_sub_f64( 50 | const float64_t * pSrcA, 51 | const float64_t * pSrcB, 52 | float64_t * pDst, 53 | uint32_t blockSize) 54 | { 55 | uint32_t blkCnt; /* Loop counter */ 56 | 57 | /* Initialize blkCnt with number of samples */ 58 | blkCnt = blockSize; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = A - B */ 63 | 64 | /* Subtract and store result in destination buffer. */ 65 | *pDst++ = (*pSrcA++) - (*pSrcB++); 66 | 67 | /* Decrement loop counter */ 68 | blkCnt--; 69 | } 70 | 71 | } 72 | 73 | /** 74 | @} end of BasicSub group 75 | */ 76 | -------------------------------------------------------------------------------- /Code/DSP/Source/CommonTables/CommonTables.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: CommonTables.c 4 | * Description: Combination of all common table source files. 5 | * 6 | * $Date: 08. January 2020 7 | * $Revision: V1.1.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_common_tables.c" 30 | #include "arm_const_structs.c" 31 | #include "arm_mve_tables.c" 32 | -------------------------------------------------------------------------------- /Code/DSP/Source/CommonTables/CommonTablesF16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: CommonTables.c 4 | * Description: Combination of all common table source files. 5 | * 6 | * $Date: 08. January 2020 7 | * $Revision: V1.1.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_common_tables_f16.c" 30 | #include "arm_const_structs_f16.c" 31 | #include "arm_mve_tables_f16.c" 32 | -------------------------------------------------------------------------------- /Code/DSP/Source/CommonTables/Config.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.14) 2 | 3 | 4 | 5 | target_sources(CMSISDSP PRIVATE CommonTables/arm_common_tables.c 6 | CommonTables/arm_common_tables_f16.c) 7 | 8 | if (CONFIGTABLE AND ALLFFT) 9 | target_compile_definitions(CMSISDSP PUBLIC ARM_ALL_FFT_TABLES) 10 | endif() 11 | 12 | if (CONFIGTABLE AND ALLFAST) 13 | target_compile_definitions(CMSISDSP PUBLIC ARM_ALL_FAST_TABLES) 14 | endif() 15 | 16 | 17 | 18 | target_sources(CMSISDSP PRIVATE CommonTables/arm_const_structs.c) 19 | target_sources(CMSISDSP PRIVATE CommonTables/arm_const_structs_f16.c) 20 | 21 | 22 | 23 | if (NEON OR NEONEXPERIMENTAL) 24 | target_sources(CMSISDSP PRIVATE "${DSP}/ComputeLibrary/Source/arm_cl_tables.c") 25 | endif() 26 | 27 | if (HELIUM OR MVEF) 28 | target_sources(CMSISDSP PRIVATE "CommonTables/arm_mve_tables.c") 29 | target_sources(CMSISDSP PRIVATE "CommonTables/arm_mve_tables_f16.c") 30 | endif() 31 | 32 | 33 | if (WRAPPER) 34 | target_compile_definitions(CMSISDSP PUBLIC ARM_TABLE_BITREV_1024) 35 | target_compile_definitions(CMSISDSP PUBLIC ARM_TABLE_TWIDDLECOEF_F32_4096) 36 | target_compile_definitions(CMSISDSP PUBLIC ARM_TABLE_TWIDDLECOEF_Q31_4096) 37 | target_compile_definitions(CMSISDSP PUBLIC ARM_TABLE_TWIDDLECOEF_Q15_4096) 38 | if ((NOT ARMAC5) AND (NOT DISABLEFLOAT16)) 39 | target_compile_definitions(CMSISDSP PUBLIC ARM_TABLE_TWIDDLECOEF_F16_4096) 40 | endif() 41 | endif() -------------------------------------------------------------------------------- /Code/DSP/Source/ControllerFunctions/Config.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.14) 2 | 3 | 4 | 5 | 6 | 7 | if (CONFIGTABLE AND ALLFAST) 8 | target_compile_definitions(CMSISDSP PUBLIC ARM_ALL_FAST_TABLES) 9 | endif() 10 | 11 | target_sources(CMSISDSP PRIVATE ControllerFunctions/arm_pid_init_f32.c) 12 | target_sources(CMSISDSP PRIVATE ControllerFunctions/arm_pid_init_q15.c) 13 | target_sources(CMSISDSP PRIVATE ControllerFunctions/arm_pid_init_q31.c) 14 | target_sources(CMSISDSP PRIVATE ControllerFunctions/arm_pid_reset_f32.c) 15 | target_sources(CMSISDSP PRIVATE ControllerFunctions/arm_pid_reset_q15.c) 16 | target_sources(CMSISDSP PRIVATE ControllerFunctions/arm_pid_reset_q31.c) 17 | 18 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SIN_COS_F32) 19 | target_sources(CMSISDSP PRIVATE ControllerFunctions/arm_sin_cos_f32.c) 20 | endif() 21 | 22 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SIN_COS_Q31) 23 | target_sources(CMSISDSP PRIVATE ControllerFunctions/arm_sin_cos_q31.c) 24 | endif() 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Code/DSP/Source/ControllerFunctions/ControllerFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: ControllerFunctions.c 4 | * Description: Combination of all controller function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_pid_init_f32.c" 30 | #include "arm_pid_init_q15.c" 31 | #include "arm_pid_init_q31.c" 32 | #include "arm_pid_reset_f32.c" 33 | #include "arm_pid_reset_q15.c" 34 | #include "arm_pid_reset_q31.c" 35 | 36 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FAST_ALLOW_TABLES) 37 | 38 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_F32) 39 | #include "arm_sin_cos_f32.c" 40 | #endif 41 | 42 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_Q31) 43 | #include "arm_sin_cos_q31.c" 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Code/DSP/Source/ControllerFunctions/arm_pid_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_init_f32.c 4 | * Description: Floating-point PID Control initialization function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/controller_functions.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Initialization function for the floating-point PID Control. 38 | @param[in,out] S points to an instance of the PID structure 39 | @param[in] resetStateFlag 40 | - value = 0: no change in state 41 | - value = 1: reset state 42 | @return none 43 | 44 | @par Details 45 | The resetStateFlag specifies whether to set state to zero or not. \n 46 | The function computes the structure fields: A0, A1 A2 47 | using the proportional gain( \c Kp), integral gain( \c Ki) and derivative gain( \c Kd) 48 | also sets the state variables to all zeros. 49 | */ 50 | 51 | void arm_pid_init_f32( 52 | arm_pid_instance_f32 * S, 53 | int32_t resetStateFlag) 54 | { 55 | /* Derived coefficient A0 */ 56 | S->A0 = S->Kp + S->Ki + S->Kd; 57 | 58 | /* Derived coefficient A1 */ 59 | S->A1 = (-S->Kp) - ((float32_t) 2.0f * S->Kd); 60 | 61 | /* Derived coefficient A2 */ 62 | S->A2 = S->Kd; 63 | 64 | /* Check whether state needs reset or not */ 65 | if (resetStateFlag) 66 | { 67 | /* Reset state to zero, The size will be always 3 samples */ 68 | memset(S->state, 0, 3U * sizeof(float32_t)); 69 | } 70 | 71 | } 72 | 73 | /** 74 | @} end of PID group 75 | */ 76 | -------------------------------------------------------------------------------- /Code/DSP/Source/ControllerFunctions/arm_pid_reset_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_f32.c 4 | * Description: Floating-point PID Control reset function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/controller_functions.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the floating-point PID Control. 38 | @param[in,out] S points to an instance of the floating-point PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_f32( 46 | arm_pid_instance_f32 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(float32_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /Code/DSP/Source/ControllerFunctions/arm_pid_reset_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_q15.c 4 | * Description: Q15 PID Control reset function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/controller_functions.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the Q15 PID Control. 38 | @param[in,out] S points to an instance of the Q15 PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_q15( 46 | arm_pid_instance_q15 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(q15_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /Code/DSP/Source/ControllerFunctions/arm_pid_reset_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_q31.c 4 | * Description: Q31 PID Control reset function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/controller_functions.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the Q31 PID Control. 38 | @param[in,out] S points to an instance of the Q31 PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_q31( 46 | arm_pid_instance_q31 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(q31_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/Config.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.14) 2 | 3 | 4 | 5 | if (CONFIGTABLE AND ALLFAST) 6 | target_compile_definitions(CMSISDSP PUBLIC ARM_ALL_FAST_TABLES) 7 | endif() 8 | 9 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_COS_F32) 10 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_cos_f32.c) 11 | endif() 12 | 13 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_COS_Q15) 14 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_cos_q15.c) 15 | endif() 16 | 17 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_COS_Q31) 18 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_cos_q31.c) 19 | endif() 20 | 21 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SIN_F32) 22 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_sin_f32.c) 23 | endif() 24 | 25 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SIN_Q15) 26 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_sin_q15.c) 27 | endif() 28 | 29 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SIN_Q31) 30 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_sin_q31.c) 31 | endif() 32 | 33 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SQRT_Q31) 34 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_sqrt_q31.c) 35 | endif() 36 | 37 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SQRT_Q15) 38 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_sqrt_q15.c) 39 | endif() 40 | 41 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_vlog_f32.c) 42 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_vlog_f64.c) 43 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_vexp_f32.c) 44 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_vexp_f64.c) 45 | 46 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_vlog_q31.c) 47 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_vlog_q15.c) 48 | 49 | 50 | if ((NOT ARMAC5) AND (NOT DISABLEFLOAT16)) 51 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_vlog_f16.c) 52 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_vexp_f16.c) 53 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_vinverse_f16.c) 54 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_atan2_f16.c) 55 | endif() 56 | 57 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_divide_q15.c) 58 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_divide_q31.c) 59 | 60 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_atan2_f32.c) 61 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_atan2_q31.c) 62 | target_sources(CMSISDSP PRIVATE FastMathFunctions/arm_atan2_q15.c) 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/FastMathFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: FastMathFunctions.c 4 | * Description: Combination of all fast math function source files. 5 | * 6 | * $Date: 16. March 2020 7 | * $Revision: V1.1.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FAST_ALLOW_TABLES) 30 | 31 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_F32) 32 | #include "arm_cos_f32.c" 33 | #endif 34 | 35 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_Q15) 36 | #include "arm_cos_q15.c" 37 | #endif 38 | 39 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_Q31) 40 | #include "arm_cos_q31.c" 41 | #endif 42 | 43 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_F32) 44 | #include "arm_sin_f32.c" 45 | #endif 46 | 47 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_Q15) 48 | #include "arm_sin_q15.c" 49 | #endif 50 | 51 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_Q31) 52 | #include "arm_sin_q31.c" 53 | #endif 54 | 55 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SQRT_Q31) 56 | #include "arm_sqrt_q31.c" 57 | #endif 58 | 59 | #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SQRT_Q15) 60 | #include "arm_sqrt_q15.c" 61 | #endif 62 | 63 | #endif 64 | 65 | #include "arm_vexp_f32.c" 66 | #include "arm_vexp_f64.c" 67 | #include "arm_vlog_f32.c" 68 | #include "arm_vlog_f64.c" 69 | #include "arm_divide_q15.c" 70 | #include "arm_divide_q31.c" 71 | #include "arm_vlog_q31.c" 72 | #include "arm_vlog_q15.c" 73 | #include "arm_atan2_f32.c" 74 | #include "arm_atan2_q31.c" 75 | #include "arm_atan2_q15.c" 76 | -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/FastMathFunctionsF16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: FastMathFunctions.c 4 | * Description: Combination of all fast math function source files. 5 | * 6 | * $Date: 16. March 2020 7 | * $Revision: V1.1.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_vexp_f16.c" 30 | #include "arm_vlog_f16.c" 31 | #include "arm_vinverse_f16.c" 32 | #include "arm_atan2_f16.c" 33 | -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/arm_cos_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_cos_q15.c 4 | * Description: Fast cosine calculation for Q15 values 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/fast_math_functions.h" 30 | #include "arm_common_tables.h" 31 | 32 | /** 33 | @ingroup groupFastMath 34 | */ 35 | 36 | /** 37 | @addtogroup cos 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Fast approximation to the trigonometric cosine function for Q15 data. 43 | @param[in] x Scaled input value in radians 44 | @return cos(x) 45 | 46 | The Q15 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*PI). 47 | */ 48 | 49 | q15_t arm_cos_q15( 50 | q15_t x) 51 | { 52 | q15_t cosVal; /* Temporary input, output variables */ 53 | int32_t index; /* Index variable */ 54 | q15_t a, b; /* Two nearest output values */ 55 | q15_t fract; /* Temporary values for fractional values */ 56 | 57 | /* add 0.25 (pi/2) to read sine table */ 58 | x = (uint16_t)x + 0x2000; 59 | if (x < 0) 60 | { /* convert negative numbers to corresponding positive ones */ 61 | x = (uint16_t)x + 0x8000; 62 | } 63 | 64 | /* Calculate the nearest index */ 65 | index = (uint32_t)x >> FAST_MATH_Q15_SHIFT; 66 | 67 | /* Calculation of fractional value */ 68 | fract = (x - (index << FAST_MATH_Q15_SHIFT)) << 9; 69 | 70 | /* Read two nearest values of input value from the sin table */ 71 | a = sinTable_q15[index]; 72 | b = sinTable_q15[index+1]; 73 | 74 | /* Linear interpolation process */ 75 | cosVal = (q31_t) (0x8000 - fract) * a >> 16; 76 | cosVal = (q15_t) ((((q31_t) cosVal << 16) + ((q31_t) fract * b)) >> 16); 77 | 78 | /* Return output value */ 79 | return (cosVal << 1); 80 | } 81 | 82 | /** 83 | @} end of cos group 84 | */ 85 | -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/arm_cos_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_cos_q31.c 4 | * Description: Fast cosine calculation for Q31 values 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/fast_math_functions.h" 30 | #include "arm_common_tables.h" 31 | 32 | /** 33 | @ingroup groupFastMath 34 | */ 35 | 36 | /** 37 | @addtogroup cos 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Fast approximation to the trigonometric cosine function for Q31 data. 43 | @param[in] x Scaled input value in radians 44 | @return cos(x) 45 | 46 | The Q31 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*PI). 47 | */ 48 | 49 | q31_t arm_cos_q31( 50 | q31_t x) 51 | { 52 | q31_t cosVal; /* Temporary input, output variables */ 53 | int32_t index; /* Index variable */ 54 | q31_t a, b; /* Two nearest output values */ 55 | q31_t fract; /* Temporary values for fractional values */ 56 | 57 | /* add 0.25 (pi/2) to read sine table */ 58 | x = (uint32_t)x + 0x20000000; 59 | if (x < 0) 60 | { /* convert negative numbers to corresponding positive ones */ 61 | x = (uint32_t)x + 0x80000000; 62 | } 63 | 64 | /* Calculate the nearest index */ 65 | index = (uint32_t)x >> FAST_MATH_Q31_SHIFT; 66 | 67 | /* Calculation of fractional value */ 68 | fract = (x - (index << FAST_MATH_Q31_SHIFT)) << 9; 69 | 70 | /* Read two nearest values of input value from the sin table */ 71 | a = sinTable_q31[index]; 72 | b = sinTable_q31[index+1]; 73 | 74 | /* Linear interpolation process */ 75 | cosVal = (q63_t) (0x80000000 - fract) * a >> 32; 76 | cosVal = (q31_t) ((((q63_t) cosVal << 32) + ((q63_t) fract * b)) >> 32); 77 | 78 | /* Return output value */ 79 | return (cosVal << 1); 80 | } 81 | 82 | /** 83 | @} end of cos group 84 | */ 85 | -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/arm_sin_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_sin_q15.c 4 | * Description: Fast sine calculation for Q15 values 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/fast_math_functions.h" 30 | #include "arm_common_tables.h" 31 | 32 | /** 33 | @ingroup groupFastMath 34 | */ 35 | 36 | /** 37 | @addtogroup sin 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Fast approximation to the trigonometric sine function for Q15 data. 43 | @param[in] x Scaled input value in radians 44 | @return sin(x) 45 | 46 | The Q15 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*PI). 47 | */ 48 | 49 | q15_t arm_sin_q15( 50 | q15_t x) 51 | { 52 | q15_t sinVal; /* Temporary input, output variables */ 53 | int32_t index; /* Index variable */ 54 | q15_t a, b; /* Two nearest output values */ 55 | q15_t fract; /* Temporary values for fractional values */ 56 | 57 | 58 | if (x < 0) 59 | { /* convert negative numbers to corresponding positive ones */ 60 | x = (uint16_t)x + 0x8000; 61 | } 62 | 63 | /* Calculate the nearest index */ 64 | index = (uint32_t)x >> FAST_MATH_Q15_SHIFT; 65 | 66 | /* Calculation of fractional value */ 67 | fract = (x - (index << FAST_MATH_Q15_SHIFT)) << 9; 68 | 69 | /* Read two nearest values of input value from the sin table */ 70 | a = sinTable_q15[index]; 71 | b = sinTable_q15[index+1]; 72 | 73 | /* Linear interpolation process */ 74 | sinVal = (q31_t) (0x8000 - fract) * a >> 16; 75 | sinVal = (q15_t) ((((q31_t) sinVal << 16) + ((q31_t) fract * b)) >> 16); 76 | 77 | /* Return output value */ 78 | return (sinVal << 1); 79 | } 80 | 81 | /** 82 | @} end of sin group 83 | */ 84 | -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/arm_sin_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_sin_q31.c 4 | * Description: Fast sine calculation for Q31 values 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/fast_math_functions.h" 30 | #include "arm_common_tables.h" 31 | 32 | /** 33 | @ingroup groupFastMath 34 | */ 35 | 36 | /** 37 | @addtogroup sin 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Fast approximation to the trigonometric sine function for Q31 data. 43 | @param[in] x Scaled input value in radians 44 | @return sin(x) 45 | 46 | The Q31 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*PI). 47 | */ 48 | 49 | q31_t arm_sin_q31( 50 | q31_t x) 51 | { 52 | q31_t sinVal; /* Temporary variables for input, output */ 53 | int32_t index; /* Index variable */ 54 | q31_t a, b; /* Two nearest output values */ 55 | q31_t fract; /* Temporary values for fractional values */ 56 | 57 | if (x < 0) 58 | { /* convert negative numbers to corresponding positive ones */ 59 | x = (uint32_t)x + 0x80000000; 60 | } 61 | 62 | /* Calculate the nearest index */ 63 | index = (uint32_t)x >> FAST_MATH_Q31_SHIFT; 64 | 65 | /* Calculation of fractional value */ 66 | fract = (x - (index << FAST_MATH_Q31_SHIFT)) << 9; 67 | 68 | /* Read two nearest values of input value from the sin table */ 69 | a = sinTable_q31[index]; 70 | b = sinTable_q31[index+1]; 71 | 72 | /* Linear interpolation process */ 73 | sinVal = (q63_t) (0x80000000 - fract) * a >> 32; 74 | sinVal = (q31_t) ((((q63_t) sinVal << 32) + ((q63_t) fract * b)) >> 32); 75 | 76 | /* Return output value */ 77 | return (sinVal << 1); 78 | } 79 | 80 | /** 81 | @} end of sin group 82 | */ 83 | -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/arm_vexp_f16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_vlog_f16.c 4 | * Description: Fast vectorized log 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/fast_math_functions_f16.h" 30 | 31 | #if defined(ARM_FLOAT16_SUPPORTED) 32 | 33 | #include "arm_common_tables.h" 34 | 35 | #include "arm_vec_math_f16.h" 36 | 37 | /** 38 | @addtogroup vexp 39 | @{ 40 | */ 41 | 42 | /** 43 | @brief Floating-point vector of exp values. 44 | @param[in] pSrc points to the input vector 45 | @param[out] pDst points to the output vector 46 | @param[in] blockSize number of samples in each vector 47 | @return none 48 | */ 49 | void arm_vexp_f16( 50 | const float16_t * pSrc, 51 | float16_t * pDst, 52 | uint32_t blockSize) 53 | { 54 | uint32_t blkCnt; 55 | 56 | #if defined(ARM_MATH_MVE_FLOAT16) && !defined(ARM_MATH_AUTOVECTORIZE) 57 | 58 | f16x8_t src; 59 | f16x8_t dst; 60 | 61 | blkCnt = blockSize >> 3; 62 | 63 | while (blkCnt > 0U) 64 | { 65 | src = vld1q(pSrc); 66 | dst = vexpq_f16(src); 67 | vst1q(pDst, dst); 68 | 69 | pSrc += 8; 70 | pDst += 8; 71 | /* Decrement loop counter */ 72 | blkCnt--; 73 | } 74 | 75 | blkCnt = blockSize & 7; 76 | #else 77 | blkCnt = blockSize; 78 | #endif 79 | 80 | while (blkCnt > 0U) 81 | { 82 | /* C = log(A) */ 83 | 84 | /* Calculate log and store result in destination buffer. */ 85 | *pDst++ = (_Float16)expf((float32_t)*pSrc++); 86 | 87 | /* Decrement loop counter */ 88 | blkCnt--; 89 | } 90 | } 91 | 92 | #endif /* #if defined(ARM_FLOAT16_SUPPORTED) */ 93 | 94 | /** 95 | @} end of vexp group 96 | */ -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/arm_vexp_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_vlog_f64.c 4 | * Description: Fast vectorized log 5 | * 6 | * $Date: 10 August 2022 7 | * $Revision: V1.10.1 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/fast_math_functions.h" 30 | #include "arm_common_tables.h" 31 | 32 | 33 | void arm_vexp_f64( 34 | const float64_t * pSrc, 35 | float64_t * pDst, 36 | uint32_t blockSize) 37 | { 38 | uint32_t blkCnt; 39 | 40 | blkCnt = blockSize; 41 | 42 | while (blkCnt > 0U) 43 | { 44 | /* C = log(A) */ 45 | 46 | 47 | /* Calculate log and store result in destination buffer. */ 48 | *pDst++ = exp(*pSrc++); 49 | 50 | /* Decrement loop counter */ 51 | blkCnt--; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/arm_vinverse_f16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_vinverse_f16.c 4 | * Description: Fast vectorized inverse 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/fast_math_functions_f16.h" 30 | 31 | #if defined(ARM_FLOAT16_SUPPORTED) 32 | 33 | #include "arm_common_tables.h" 34 | 35 | #include "arm_vec_math_f16.h" 36 | 37 | void arm_vinverse_f16( 38 | const float16_t * pSrc, 39 | float16_t * pDst, 40 | uint32_t blockSize) 41 | { 42 | uint32_t blkCnt; 43 | 44 | #if defined(ARM_MATH_MVE_FLOAT16) && !defined(ARM_MATH_AUTOVECTORIZE) 45 | 46 | f16x8_t src; 47 | f16x8_t dst; 48 | 49 | blkCnt = blockSize >> 3; 50 | 51 | while (blkCnt > 0U) 52 | { 53 | src = vld1q(pSrc); 54 | dst = vrecip_hiprec_f16(src); 55 | vst1q(pDst, dst); 56 | 57 | pSrc += 8; 58 | pDst += 8; 59 | /* Decrement loop counter */ 60 | blkCnt--; 61 | } 62 | 63 | blkCnt = blockSize & 7; 64 | #else 65 | blkCnt = blockSize; 66 | #endif 67 | 68 | while (blkCnt > 0U) 69 | { 70 | 71 | *pDst++ = 1.0f16 / (_Float16)*pSrc++; 72 | 73 | /* Decrement loop counter */ 74 | blkCnt--; 75 | } 76 | } 77 | 78 | #endif /* #if defined(ARM_FLOAT16_SUPPORTED) */ 79 | 80 | -------------------------------------------------------------------------------- /Code/DSP/Source/FastMathFunctions/arm_vlog_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_vlog_f64.c 4 | * Description: Fast vectorized log 5 | * 6 | * $Date: 10 August 2022 7 | * $Revision: V1.10.1 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/fast_math_functions.h" 30 | #include "arm_common_tables.h" 31 | 32 | void arm_vlog_f64( 33 | const float64_t * pSrc, 34 | float64_t * pDst, 35 | uint32_t blockSize) 36 | { 37 | uint32_t blkCnt; 38 | 39 | blkCnt = blockSize; 40 | 41 | 42 | while (blkCnt > 0U) 43 | { 44 | /* C = log(A) */ 45 | 46 | /* Calculate log and store result in destination buffer. */ 47 | *pDst++ = log(*pSrc++); 48 | 49 | /* Decrement loop counter */ 50 | blkCnt--; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Code/DSP/Source/FilteringFunctions/FilteringFunctionsF16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: FilteringFunctions.c 4 | * Description: Combination of all filtering function f16 source files. 5 | * 6 | * 7 | * Target Processor: Cortex-M cores 8 | * -------------------------------------------------------------------- */ 9 | /* 10 | * Copyright (C) 2020 ARM Limited or its affiliates. All rights reserved. 11 | * 12 | * SPDX-License-Identifier: Apache-2.0 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the License); you may 15 | * not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | */ 26 | 27 | #include "arm_fir_f16.c" 28 | #include "arm_fir_init_f16.c" 29 | #include "arm_biquad_cascade_df1_f16.c" 30 | #include "arm_biquad_cascade_df1_init_f16.c" 31 | #include "arm_biquad_cascade_df2T_f16.c" 32 | #include "arm_biquad_cascade_df2T_init_f16.c" 33 | #include "arm_biquad_cascade_stereo_df2T_f16.c" 34 | #include "arm_biquad_cascade_stereo_df2T_init_f16.c" 35 | #include "arm_correlate_f16.c" 36 | #include "arm_levinson_durbin_f16.c" 37 | -------------------------------------------------------------------------------- /Code/DSP/Source/FilteringFunctions/arm_fir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_f32.c 4 | * Description: Floating-point FIR Lattice filter initialization function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/filtering_functions.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the floating-point FIR lattice filter. 42 | @param[in] S points to an instance of the floating-point FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_f32( 50 | arm_fir_lattice_instance_f32 * S, 51 | uint16_t numStages, 52 | const float32_t * pCoeffs, 53 | float32_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(float32_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /Code/DSP/Source/FilteringFunctions/arm_fir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_q15.c 4 | * Description: Q15 FIR Lattice filter initialization function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/filtering_functions.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q15 FIR lattice filter. 42 | @param[in] S points to an instance of the Q15 FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_q15( 50 | arm_fir_lattice_instance_q15 * S, 51 | uint16_t numStages, 52 | const q15_t * pCoeffs, 53 | q15_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(q15_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /Code/DSP/Source/FilteringFunctions/arm_fir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_q31.c 4 | * Description: Q31 FIR lattice filter initialization function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/filtering_functions.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q31 FIR lattice filter. 42 | @param[in] S points to an instance of the Q31 FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_q31( 50 | arm_fir_lattice_instance_q31 * S, 51 | uint16_t numStages, 52 | const q31_t * pCoeffs, 53 | q31_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(q31_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /Code/DSP/Source/FilteringFunctions/arm_iir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_iir_lattice_init_f32.c 4 | * Description: Floating-point IIR lattice filter initialization function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/filtering_functions.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup IIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the floating-point IIR lattice filter. 42 | @param[in] S points to an instance of the floating-point IIR lattice structure 43 | @param[in] numStages number of stages in the filter 44 | @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages 45 | @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1 46 | @param[in] pState points to state buffer. The array is of length numStages+blockSize 47 | @param[in] blockSize number of samples to process 48 | @return none 49 | */ 50 | 51 | void arm_iir_lattice_init_f32( 52 | arm_iir_lattice_instance_f32 * S, 53 | uint16_t numStages, 54 | float32_t * pkCoeffs, 55 | float32_t * pvCoeffs, 56 | float32_t * pState, 57 | uint32_t blockSize) 58 | { 59 | /* Assign filter taps */ 60 | S->numStages = numStages; 61 | 62 | /* Assign reflection coefficient pointer */ 63 | S->pkCoeffs = pkCoeffs; 64 | 65 | /* Assign ladder coefficient pointer */ 66 | S->pvCoeffs = pvCoeffs; 67 | 68 | /* Clear state buffer and size is always blockSize + numStages */ 69 | memset(pState, 0, (numStages + blockSize) * sizeof(float32_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | } 74 | 75 | /** 76 | @} end of IIR_Lattice group 77 | */ 78 | -------------------------------------------------------------------------------- /Code/DSP/Source/FilteringFunctions/arm_iir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_iir_lattice_init_q15.c 4 | * Description: Q15 IIR lattice filter initialization function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/filtering_functions.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup IIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q15 IIR lattice filter. 42 | @param[in] S points to an instance of the Q15 IIR lattice structure 43 | @param[in] numStages number of stages in the filter 44 | @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages 45 | @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1 46 | @param[in] pState points to state buffer. The array is of length numStages+blockSize 47 | @param[in] blockSize number of samples to process 48 | @return none 49 | */ 50 | 51 | void arm_iir_lattice_init_q15( 52 | arm_iir_lattice_instance_q15 * S, 53 | uint16_t numStages, 54 | q15_t * pkCoeffs, 55 | q15_t * pvCoeffs, 56 | q15_t * pState, 57 | uint32_t blockSize) 58 | { 59 | /* Assign filter taps */ 60 | S->numStages = numStages; 61 | 62 | /* Assign reflection coefficient pointer */ 63 | S->pkCoeffs = pkCoeffs; 64 | 65 | /* Assign ladder coefficient pointer */ 66 | S->pvCoeffs = pvCoeffs; 67 | 68 | /* Clear state buffer and size is always blockSize + numStages */ 69 | memset(pState, 0, (numStages + blockSize) * sizeof(q15_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | } 74 | 75 | /** 76 | @} end of IIR_Lattice group 77 | */ 78 | -------------------------------------------------------------------------------- /Code/DSP/Source/FilteringFunctions/arm_iir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_iir_lattice_init_q31.c 4 | * Description: Initialization function for the Q31 IIR lattice filter 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/filtering_functions.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup IIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q31 IIR lattice filter. 42 | @param[in] S points to an instance of the Q31 IIR lattice structure 43 | @param[in] numStages number of stages in the filter 44 | @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages 45 | @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1 46 | @param[in] pState points to state buffer. The array is of length numStages+blockSize 47 | @param[in] blockSize number of samples to process 48 | @return none 49 | */ 50 | 51 | void arm_iir_lattice_init_q31( 52 | arm_iir_lattice_instance_q31 * S, 53 | uint16_t numStages, 54 | q31_t * pkCoeffs, 55 | q31_t * pvCoeffs, 56 | q31_t * pState, 57 | uint32_t blockSize) 58 | { 59 | /* Assign filter taps */ 60 | S->numStages = numStages; 61 | 62 | /* Assign reflection coefficient pointer */ 63 | S->pkCoeffs = pkCoeffs; 64 | 65 | /* Assign ladder coefficient pointer */ 66 | S->pvCoeffs = pvCoeffs; 67 | 68 | /* Clear state buffer and size is always blockSize + numStages */ 69 | memset(pState, 0, (numStages + blockSize) * sizeof(q31_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | } 74 | 75 | /** 76 | @} end of IIR_Lattice group 77 | */ 78 | -------------------------------------------------------------------------------- /Code/DSP/Source/InterpolationFunctions/Config.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.14) 2 | 3 | 4 | 5 | 6 | 7 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_bilinear_interp_f32.c) 8 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_bilinear_interp_q15.c) 9 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_bilinear_interp_q31.c) 10 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_bilinear_interp_q7.c) 11 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_linear_interp_f32.c) 12 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_linear_interp_q15.c) 13 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_linear_interp_q31.c) 14 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_linear_interp_q7.c) 15 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_spline_interp_f32.c) 16 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_spline_interp_init_f32.c) 17 | 18 | 19 | 20 | if ((NOT ARMAC5) AND (NOT DISABLEFLOAT16)) 21 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_bilinear_interp_f16.c) 22 | target_sources(CMSISDSP PRIVATE InterpolationFunctions/arm_linear_interp_f16.c) 23 | endif() -------------------------------------------------------------------------------- /Code/DSP/Source/InterpolationFunctions/InterpolationFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: InterpolationFunctions.c 4 | * Description: Combination of all interpolation function source files. 5 | * 6 | * $Date: 22. July 2020 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_bilinear_interp_f32.c" 30 | #include "arm_bilinear_interp_q15.c" 31 | #include "arm_bilinear_interp_q31.c" 32 | #include "arm_bilinear_interp_q7.c" 33 | #include "arm_linear_interp_f32.c" 34 | #include "arm_linear_interp_q15.c" 35 | #include "arm_linear_interp_q31.c" 36 | #include "arm_linear_interp_q7.c" 37 | #include "arm_spline_interp_f32.c" 38 | #include "arm_spline_interp_init_f32.c" 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Code/DSP/Source/InterpolationFunctions/InterpolationFunctionsF16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: InterpolationFunctions.c 4 | * Description: Combination of all interpolation function source files. 5 | * 6 | * $Date: 22. July 2020 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_bilinear_interp_f16.c" 30 | #include "arm_linear_interp_f16.c" 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Code/DSP/Source/MatrixFunctions/MatrixFunctionsF16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: MatrixFunctions.c 4 | * Description: Combination of all matrix function f16 source files. 5 | * 6 | * $Date: 18. March 2020 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_mat_add_f16.c" 30 | #include "arm_mat_sub_f16.c" 31 | #include "arm_mat_trans_f16.c" 32 | #include "arm_mat_scale_f16.c" 33 | #include "arm_mat_mult_f16.c" 34 | #include "arm_mat_vec_mult_f16.c" 35 | #include "arm_mat_cmplx_trans_f16.c" 36 | #include "arm_mat_cmplx_mult_f16.c" 37 | #include "arm_mat_inverse_f16.c" 38 | #include "arm_mat_init_f16.c" 39 | #include "arm_mat_cholesky_f16.c" 40 | #include "arm_mat_solve_upper_triangular_f16.c" 41 | #include "arm_mat_solve_lower_triangular_f16.c" 42 | #include "arm_mat_qr_f16.c" 43 | #include "arm_householder_f16.c" -------------------------------------------------------------------------------- /Code/DSP/Source/MatrixFunctions/arm_mat_init_f16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_f16.c 4 | * Description: Floating-point matrix initialization 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/matrix_functions_f16.h" 30 | 31 | #if defined(ARM_FLOAT16_SUPPORTED) 32 | 33 | 34 | /** 35 | @ingroup groupMatrix 36 | */ 37 | 38 | 39 | /** 40 | @addtogroup MatrixInit 41 | @{ 42 | */ 43 | 44 | /** 45 | @brief Floating-point matrix initialization. 46 | @param[in,out] S points to an instance of the floating-point matrix structure 47 | @param[in] nRows number of rows in the matrix 48 | @param[in] nColumns number of columns in the matrix 49 | @param[in] pData points to the matrix data array 50 | @return none 51 | */ 52 | 53 | void arm_mat_init_f16( 54 | arm_matrix_instance_f16 * S, 55 | uint16_t nRows, 56 | uint16_t nColumns, 57 | float16_t * pData) 58 | { 59 | /* Assign Number of Rows */ 60 | S->numRows = nRows; 61 | 62 | /* Assign Number of Columns */ 63 | S->numCols = nColumns; 64 | 65 | /* Assign Data pointer */ 66 | S->pData = pData; 67 | } 68 | 69 | /** 70 | @} end of MatrixInit group 71 | */ 72 | 73 | #endif /* #if defined(ARM_FLOAT16_SUPPORTED) */ 74 | 75 | -------------------------------------------------------------------------------- /Code/DSP/Source/MatrixFunctions/arm_mat_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_f32.c 4 | * Description: Floating-point matrix initialization 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/matrix_functions.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @defgroup MatrixInit Matrix Initialization 37 | 38 | Initializes the underlying matrix data structure. 39 | The functions set the numRows, 40 | numCols, and pData fields 41 | of the matrix data structure. 42 | */ 43 | 44 | /** 45 | @addtogroup MatrixInit 46 | @{ 47 | */ 48 | 49 | /** 50 | @brief Floating-point matrix initialization. 51 | @param[in,out] S points to an instance of the floating-point matrix structure 52 | @param[in] nRows number of rows in the matrix 53 | @param[in] nColumns number of columns in the matrix 54 | @param[in] pData points to the matrix data array 55 | @return none 56 | */ 57 | 58 | void arm_mat_init_f32( 59 | arm_matrix_instance_f32 * S, 60 | uint16_t nRows, 61 | uint16_t nColumns, 62 | float32_t * pData) 63 | { 64 | /* Assign Number of Rows */ 65 | S->numRows = nRows; 66 | 67 | /* Assign Number of Columns */ 68 | S->numCols = nColumns; 69 | 70 | /* Assign Data pointer */ 71 | S->pData = pData; 72 | } 73 | 74 | /** 75 | @} end of MatrixInit group 76 | */ 77 | -------------------------------------------------------------------------------- /Code/DSP/Source/MatrixFunctions/arm_mat_init_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_f32.c 4 | * Description: Floating-point matrix initialization 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/matrix_functions.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @defgroup MatrixInit Matrix Initialization 37 | 38 | Initializes the underlying matrix data structure. 39 | The functions set the numRows, 40 | numCols, and pData fields 41 | of the matrix data structure. 42 | */ 43 | 44 | /** 45 | @addtogroup MatrixInit 46 | @{ 47 | */ 48 | 49 | /** 50 | @brief Floating-point matrix initialization. 51 | @param[in,out] S points to an instance of the floating-point matrix structure 52 | @param[in] nRows number of rows in the matrix 53 | @param[in] nColumns number of columns in the matrix 54 | @param[in] pData points to the matrix data array 55 | @return none 56 | */ 57 | 58 | void arm_mat_init_f64( 59 | arm_matrix_instance_f64 * S, 60 | uint16_t nRows, 61 | uint16_t nColumns, 62 | float64_t * pData) 63 | { 64 | /* Assign Number of Rows */ 65 | S->numRows = nRows; 66 | 67 | /* Assign Number of Columns */ 68 | S->numCols = nColumns; 69 | 70 | /* Assign Data pointer */ 71 | S->pData = pData; 72 | } 73 | 74 | /** 75 | @} end of MatrixInit group 76 | */ 77 | -------------------------------------------------------------------------------- /Code/DSP/Source/MatrixFunctions/arm_mat_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_q15.c 4 | * Description: Q15 matrix initialization 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/matrix_functions.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @addtogroup MatrixInit 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Q15 matrix initialization. 42 | @param[in,out] S points to an instance of the floating-point matrix structure 43 | @param[in] nRows number of rows in the matrix 44 | @param[in] nColumns number of columns in the matrix 45 | @param[in] pData points to the matrix data array 46 | @return none 47 | */ 48 | 49 | void arm_mat_init_q15( 50 | arm_matrix_instance_q15 * S, 51 | uint16_t nRows, 52 | uint16_t nColumns, 53 | q15_t * pData) 54 | { 55 | /* Assign Number of Rows */ 56 | S->numRows = nRows; 57 | 58 | /* Assign Number of Columns */ 59 | S->numCols = nColumns; 60 | 61 | /* Assign Data pointer */ 62 | S->pData = pData; 63 | } 64 | 65 | /** 66 | @} end of MatrixInit group 67 | */ 68 | -------------------------------------------------------------------------------- /Code/DSP/Source/MatrixFunctions/arm_mat_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_q31.c 4 | * Description: Q31 matrix initialization 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/matrix_functions.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | 36 | 37 | /** 38 | @addtogroup MatrixInit 39 | @{ 40 | */ 41 | 42 | /** 43 | @brief Q31 matrix initialization. 44 | @param[in,out] S points to an instance of the Q31 matrix structure 45 | @param[in] nRows number of rows in the matrix 46 | @param[in] nColumns number of columns in the matrix 47 | @param[in] pData points to the matrix data array 48 | @return none 49 | */ 50 | 51 | void arm_mat_init_q31( 52 | arm_matrix_instance_q31 * S, 53 | uint16_t nRows, 54 | uint16_t nColumns, 55 | q31_t * pData) 56 | { 57 | /* Assign Number of Rows */ 58 | S->numRows = nRows; 59 | 60 | /* Assign Number of Columns */ 61 | S->numCols = nColumns; 62 | 63 | /* Assign Data pointer */ 64 | S->pData = pData; 65 | } 66 | 67 | /** 68 | @} end of MatrixInit group 69 | */ 70 | -------------------------------------------------------------------------------- /Code/DSP/Source/QuaternionMathFunctions/Config.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.14) 2 | 3 | 4 | 5 | 6 | 7 | 8 | target_sources(CMSISDSP PRIVATE QuaternionMathFunctions/arm_quaternion_norm_f32.c) 9 | target_sources(CMSISDSP PRIVATE QuaternionMathFunctions/arm_quaternion_inverse_f32.c) 10 | target_sources(CMSISDSP PRIVATE QuaternionMathFunctions/arm_quaternion_conjugate_f32.c) 11 | target_sources(CMSISDSP PRIVATE QuaternionMathFunctions/arm_quaternion_normalize_f32.c) 12 | target_sources(CMSISDSP PRIVATE QuaternionMathFunctions/arm_quaternion_product_single_f32.c) 13 | target_sources(CMSISDSP PRIVATE QuaternionMathFunctions/arm_quaternion_product_f32.c) 14 | target_sources(CMSISDSP PRIVATE QuaternionMathFunctions/arm_quaternion2rotation_f32.c) 15 | target_sources(CMSISDSP PRIVATE QuaternionMathFunctions/arm_rotation2quaternion_f32.c) 16 | 17 | 18 | if ((NOT ARMAC5) AND (NOT DISABLEFLOAT16)) 19 | endif() 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Code/DSP/Source/QuaternionMathFunctions/QuaternionMathFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: QuaternionMathFunctions.c 4 | * Description: Combination of all quaternion math function source files. 5 | * 6 | * 7 | * Target Processor: Cortex-M cores 8 | * -------------------------------------------------------------------- */ 9 | /* 10 | * Copyright (C) 2019-2021 ARM Limited or its affiliates. All rights reserved. 11 | * 12 | * SPDX-License-Identifier: Apache-2.0 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the License); you may 15 | * not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | */ 26 | 27 | #include "arm_quaternion_norm_f32.c" 28 | #include "arm_quaternion_inverse_f32.c" 29 | #include "arm_quaternion_conjugate_f32.c" 30 | #include "arm_quaternion_normalize_f32.c" 31 | #include "arm_quaternion_product_single_f32.c" 32 | #include "arm_quaternion_product_f32.c" 33 | #include "arm_quaternion2rotation_f32.c" 34 | #include "arm_rotation2quaternion_f32.c" 35 | -------------------------------------------------------------------------------- /Code/DSP/Source/StatisticsFunctions/StatisticsFunctionsF16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: StatisticsFunctions.c 4 | * Description: Combination of all statistics function source files. 5 | * 6 | * $Date: 14 July 2022 7 | * $Revision: V1.1.1 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_max_f16.c" 30 | #include "arm_min_f16.c" 31 | #include "arm_mean_f16.c" 32 | #include "arm_power_f16.c" 33 | #include "arm_rms_f16.c" 34 | #include "arm_std_f16.c" 35 | #include "arm_var_f16.c" 36 | #include "arm_entropy_f16.c" 37 | #include "arm_kullback_leibler_f16.c" 38 | #include "arm_logsumexp_dot_prod_f16.c" 39 | #include "arm_logsumexp_f16.c" 40 | #include "arm_max_no_idx_f16.c" 41 | #include "arm_min_no_idx_f16.c" 42 | #include "arm_absmax_f16.c" 43 | #include "arm_absmin_f16.c" 44 | #include "arm_absmax_no_idx_f16.c" 45 | #include "arm_absmin_no_idx_f16.c" 46 | #include "arm_mse_f16.c" 47 | #include "arm_accumulate_f16.c" 48 | -------------------------------------------------------------------------------- /Code/DSP/Source/StatisticsFunctions/arm_entropy_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_logsumexp_f64.c 4 | * Description: LogSumExp 5 | * 6 | * $Date: 10 August 2022 7 | * $Revision: V1.9.1 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/statistics_functions.h" 30 | #include 31 | #include 32 | #if defined(ARM_MATH_NEON) && defined(__aarch64__) 33 | #include "arm_vec_math.h" 34 | #endif 35 | 36 | /** 37 | * @addtogroup Entropy 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @brief Entropy 43 | * 44 | * @param[in] pSrcA Array of input values. 45 | * @param[in] blockSize Number of samples in the input array. 46 | * @return Entropy -Sum(p ln p) 47 | * 48 | */ 49 | 50 | float64_t arm_entropy_f64(const float64_t * pSrcA, uint32_t blockSize) 51 | { 52 | const float64_t *pIn; 53 | uint32_t blkCnt; 54 | float64_t accum, p; 55 | 56 | pIn = pSrcA; 57 | 58 | accum = 0.0; 59 | 60 | blkCnt = blockSize; 61 | 62 | while(blkCnt > 0) 63 | { 64 | p = *pIn++; 65 | 66 | accum += p * log(p); 67 | 68 | blkCnt--; 69 | 70 | } 71 | 72 | return(-accum); 73 | } 74 | 75 | /** 76 | * @} end of Entropy group 77 | */ 78 | -------------------------------------------------------------------------------- /Code/DSP/Source/StatisticsFunctions/arm_kullback_leibler_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_logsumexp_f64.c 4 | * Description: LogSumExp 5 | * 6 | * $Date: 10 August 2022 7 | * $Revision: V1.9.1 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/statistics_functions.h" 30 | #include 31 | #include 32 | 33 | /** 34 | * @addtogroup Kullback-Leibler 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @brief Kullback-Leibler 40 | * 41 | * @param[in] *pSrcA points to an array of input values for probaility distribution A. 42 | * @param[in] *pSrcB points to an array of input values for probaility distribution B. 43 | * @param[in] blockSize number of samples in the input array. 44 | * @return Kullback-Leibler divergence D(A || B) 45 | * 46 | */ 47 | 48 | 49 | float64_t arm_kullback_leibler_f64(const float64_t * pSrcA, const float64_t * pSrcB, uint32_t blockSize) 50 | { 51 | const float64_t *pInA, *pInB; 52 | uint32_t blkCnt; 53 | float64_t accum, pA,pB; 54 | 55 | pInA = pSrcA; 56 | pInB = pSrcB; 57 | blkCnt = blockSize; 58 | 59 | accum = 0.0; 60 | 61 | while(blkCnt > 0) 62 | { 63 | pA = *pInA++; 64 | pB = *pInB++; 65 | 66 | accum += pA * log(pB / pA); 67 | 68 | blkCnt--; 69 | } 70 | 71 | return(-accum); 72 | } 73 | /** 74 | * @} end of Kullback-Leibler group 75 | */ 76 | -------------------------------------------------------------------------------- /Code/DSP/Source/StatisticsFunctions/arm_logsumexp_dot_prod_f16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_logsumexp_f16.c 4 | * Description: LogSumExp 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/statistics_functions_f16.h" 30 | 31 | #if defined(ARM_FLOAT16_SUPPORTED) 32 | 33 | #include 34 | #include 35 | 36 | /** 37 | @ingroup groupStats 38 | */ 39 | 40 | /** 41 | @defgroup LogSumExp LogSumExp 42 | 43 | LogSumExp optimizations to compute sum of probabilities with Gaussian distributions 44 | 45 | */ 46 | 47 | /** 48 | * @addtogroup LogSumExp 49 | * @{ 50 | */ 51 | 52 | 53 | /** 54 | * @brief Dot product with log arithmetic 55 | * 56 | * Vectors are containing the log of the samples 57 | * 58 | * @param[in] *pSrcA points to the first input vector 59 | * @param[in] *pSrcB points to the second input vector 60 | * @param[in] blockSize number of samples in each vector 61 | * @param[in] *pTmpBuffer temporary buffer of length blockSize 62 | * @return The log of the dot product. 63 | * 64 | */ 65 | 66 | 67 | float16_t arm_logsumexp_dot_prod_f16(const float16_t * pSrcA, 68 | const float16_t * pSrcB, 69 | uint32_t blockSize, 70 | float16_t *pTmpBuffer) 71 | { 72 | float16_t result; 73 | arm_add_f16((float16_t*)pSrcA, (float16_t*)pSrcB, pTmpBuffer, blockSize); 74 | 75 | result = arm_logsumexp_f16(pTmpBuffer, blockSize); 76 | return(result); 77 | } 78 | 79 | /** 80 | * @} end of LogSumExp group 81 | */ 82 | 83 | #endif /* #if defined(ARM_FLOAT16_SUPPORTED) */ 84 | 85 | -------------------------------------------------------------------------------- /Code/DSP/Source/StatisticsFunctions/arm_logsumexp_dot_prod_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_logsumexp_f32.c 4 | * Description: LogSumExp 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/statistics_functions.h" 30 | #include 31 | #include 32 | 33 | 34 | /** 35 | * @addtogroup LogSumExp 36 | * @{ 37 | */ 38 | 39 | 40 | /** 41 | * @brief Dot product with log arithmetic 42 | * 43 | * Vectors are containing the log of the samples 44 | * 45 | * @param[in] *pSrcA points to the first input vector 46 | * @param[in] *pSrcB points to the second input vector 47 | * @param[in] blockSize number of samples in each vector 48 | * @param[in] *pTmpBuffer temporary buffer of length blockSize 49 | * @return The log of the dot product. 50 | * 51 | */ 52 | 53 | 54 | float32_t arm_logsumexp_dot_prod_f32(const float32_t * pSrcA, 55 | const float32_t * pSrcB, 56 | uint32_t blockSize, 57 | float32_t *pTmpBuffer) 58 | { 59 | float32_t result; 60 | arm_add_f32((float32_t*)pSrcA, (float32_t*)pSrcB, pTmpBuffer, blockSize); 61 | 62 | result = arm_logsumexp_f32(pTmpBuffer, blockSize); 63 | return(result); 64 | } 65 | 66 | /** 67 | * @} end of LogSumExp group 68 | */ 69 | -------------------------------------------------------------------------------- /Code/DSP/Source/StatisticsFunctions/arm_max_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_max_f64.c 4 | * Description: Maximum value of a floating-point vector 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/statistics_functions.h" 30 | 31 | /** 32 | @ingroup groupStats 33 | */ 34 | 35 | /** 36 | @addtogroup Max 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Maximum value of a floating-point vector. 42 | @param[in] pSrc points to the input vector 43 | @param[in] blockSize number of samples in input vector 44 | @param[out] pResult maximum value returned here 45 | @param[out] pIndex index of maximum value returned here 46 | @return none 47 | */ 48 | void arm_max_f64( 49 | const float64_t * pSrc, 50 | uint32_t blockSize, 51 | float64_t * pResult, 52 | uint32_t * pIndex) 53 | { 54 | float64_t maxVal, out; /* Temporary variables to store the output value. */ 55 | uint32_t blkCnt, outIndex; /* Loop counter */ 56 | 57 | /* Initialise index value to zero. */ 58 | outIndex = 0U; 59 | 60 | /* Load first input value that act as reference value for comparision */ 61 | out = *pSrc++; 62 | 63 | /* Initialize blkCnt with number of samples */ 64 | blkCnt = (blockSize - 1U); 65 | 66 | while (blkCnt > 0U) 67 | { 68 | /* Initialize maxVal to the next consecutive values one by one */ 69 | maxVal = *pSrc++; 70 | 71 | /* compare for the maximum value */ 72 | if (out < maxVal) 73 | { 74 | /* Update the maximum value and it's index */ 75 | out = maxVal; 76 | outIndex = blockSize - blkCnt; 77 | } 78 | 79 | /* Decrement loop counter */ 80 | blkCnt--; 81 | } 82 | 83 | /* Store the maximum value and it's index into destination pointers */ 84 | *pResult = out; 85 | *pIndex = outIndex; 86 | } 87 | 88 | /** 89 | @} end of Max group 90 | */ 91 | -------------------------------------------------------------------------------- /Code/DSP/Source/StatisticsFunctions/arm_min_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_min_f64.c 4 | * Description: Minimum value of a floating-point vector 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/statistics_functions.h" 30 | 31 | /** 32 | @ingroup groupStats 33 | */ 34 | 35 | /** 36 | @addtogroup Min 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Minimum value of a floating-point vector. 42 | @param[in] pSrc points to the input vector 43 | @param[in] blockSize number of samples in input vector 44 | @param[out] pResult minimum value returned here 45 | @param[out] pIndex index of minimum value returned here 46 | @return none 47 | */ 48 | void arm_min_f64( 49 | const float64_t * pSrc, 50 | uint32_t blockSize, 51 | float64_t * pResult, 52 | uint32_t * pIndex) 53 | { 54 | float64_t minVal, out; /* Temporary variables to store the output value. */ 55 | uint32_t blkCnt, outIndex; /* Loop counter */ 56 | 57 | /* Initialise index value to zero. */ 58 | outIndex = 0U; 59 | 60 | /* Load first input value that act as reference value for comparision */ 61 | out = *pSrc++; 62 | 63 | /* Initialize blkCnt with number of samples */ 64 | blkCnt = (blockSize - 1U); 65 | 66 | while (blkCnt > 0U) 67 | { 68 | /* Initialize minVal to the next consecutive values one by one */ 69 | minVal = *pSrc++; 70 | 71 | /* compare for the minimum value */ 72 | if (out > minVal) 73 | { 74 | /* Update the minimum value and it's index */ 75 | out = minVal; 76 | outIndex = blockSize - blkCnt; 77 | } 78 | 79 | /* Decrement loop counter */ 80 | blkCnt--; 81 | } 82 | 83 | /* Store the minimum value and it's index into destination pointers */ 84 | *pResult = out; 85 | *pIndex = outIndex; 86 | } 87 | 88 | /** 89 | @} end of Min group 90 | */ 91 | -------------------------------------------------------------------------------- /Code/DSP/Source/StatisticsFunctions/arm_std_f16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_std_f16.c 4 | * Description: Standard deviation of the elements of a floating-point vector 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/statistics_functions_f16.h" 30 | 31 | #if defined(ARM_FLOAT16_SUPPORTED) 32 | 33 | 34 | /** 35 | @ingroup groupStats 36 | */ 37 | 38 | 39 | 40 | /** 41 | @addtogroup STD 42 | @{ 43 | */ 44 | 45 | /** 46 | @brief Standard deviation of the elements of a floating-point vector. 47 | @param[in] pSrc points to the input vector 48 | @param[in] blockSize number of samples in input vector 49 | @param[out] pResult standard deviation value returned here 50 | @return none 51 | */ 52 | void arm_std_f16( 53 | const float16_t * pSrc, 54 | uint32_t blockSize, 55 | float16_t * pResult) 56 | { 57 | float16_t var; 58 | arm_var_f16(pSrc,blockSize,&var); 59 | arm_sqrt_f16(var, pResult); 60 | } 61 | 62 | /** 63 | @} end of STD group 64 | */ 65 | 66 | #endif /* #if defined(ARM_FLOAT16_SUPPORTED) */ 67 | 68 | -------------------------------------------------------------------------------- /Code/DSP/Source/StatisticsFunctions/arm_std_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_std_f32.c 4 | * Description: Standard deviation of the elements of a floating-point vector 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/statistics_functions.h" 30 | 31 | /** 32 | @ingroup groupStats 33 | */ 34 | 35 | /** 36 | @defgroup STD Standard deviation 37 | 38 | Calculates the standard deviation of the elements in the input vector. 39 | 40 | The float implementation is relying on arm_var_f32 which is using a two-pass algorithm 41 | to avoid problem of numerical instabilities and cancellation errors. 42 | 43 | Fixed point versions are using the standard textbook algorithm since the fixed point 44 | numerical behavior is different from the float one. 45 | 46 | Algorithm for fixed point versions is summarized below: 47 | 48 | 49 |
50 |       Result = sqrt((sumOfSquares - sum2 / blockSize) / (blockSize - 1))
51 | 
52 |       sumOfSquares = pSrc[0] * pSrc[0] + pSrc[1] * pSrc[1] + ... + pSrc[blockSize-1] * pSrc[blockSize-1]
53 |       sum = pSrc[0] + pSrc[1] + pSrc[2] + ... + pSrc[blockSize-1]
54 |   
55 | 56 | There are separate functions for floating point, Q31, and Q15 data types. 57 | */ 58 | 59 | /** 60 | @addtogroup STD 61 | @{ 62 | */ 63 | 64 | /** 65 | @brief Standard deviation of the elements of a floating-point vector. 66 | @param[in] pSrc points to the input vector 67 | @param[in] blockSize number of samples in input vector 68 | @param[out] pResult standard deviation value returned here 69 | @return none 70 | */ 71 | void arm_std_f32( 72 | const float32_t * pSrc, 73 | uint32_t blockSize, 74 | float32_t * pResult) 75 | { 76 | float32_t var; 77 | arm_var_f32(pSrc,blockSize,&var); 78 | arm_sqrt_f32(var, pResult); 79 | } 80 | 81 | /** 82 | @} end of STD group 83 | */ 84 | -------------------------------------------------------------------------------- /Code/DSP/Source/StatisticsFunctions/arm_std_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_std_f64.c 4 | * Description: Standard deviation of the elements of a floating-point vector 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/statistics_functions.h" 30 | 31 | /** 32 | @ingroup groupStats 33 | */ 34 | 35 | /** 36 | @addtogroup STD 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Standard deviation of the elements of a floating-point vector. 42 | @param[in] pSrc points to the input vector 43 | @param[in] blockSize number of samples in input vector 44 | @param[out] pResult standard deviation value returned here 45 | @return none 46 | */ 47 | void arm_std_f64( 48 | const float64_t * pSrc, 49 | uint32_t blockSize, 50 | float64_t * pResult) 51 | { 52 | float64_t var; 53 | arm_var_f64(pSrc,blockSize,&var); 54 | *pResult = sqrt(var); 55 | } 56 | 57 | /** 58 | @} end of STD group 59 | */ 60 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/Config.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.14) 2 | 3 | 4 | 5 | 6 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_barycenter_f32.c 7 | SupportFunctions/arm_bitonic_sort_f32.c 8 | SupportFunctions/arm_bubble_sort_f32.c 9 | SupportFunctions/arm_copy_f32.c 10 | SupportFunctions/arm_copy_f64.c 11 | SupportFunctions/arm_copy_q15.c 12 | SupportFunctions/arm_copy_q31.c 13 | SupportFunctions/arm_copy_q7.c 14 | SupportFunctions/arm_f16_to_float.c 15 | SupportFunctions/arm_f16_to_q15.c 16 | SupportFunctions/arm_fill_f32.c 17 | SupportFunctions/arm_fill_f64.c 18 | SupportFunctions/arm_fill_q15.c 19 | SupportFunctions/arm_fill_q31.c 20 | SupportFunctions/arm_fill_q7.c 21 | SupportFunctions/arm_f64_to_float.c 22 | SupportFunctions/arm_f64_to_q31.c 23 | SupportFunctions/arm_f64_to_q15.c 24 | SupportFunctions/arm_f64_to_q7.c 25 | SupportFunctions/arm_float_to_f64.c 26 | SupportFunctions/arm_float_to_q15.c 27 | SupportFunctions/arm_float_to_q31.c 28 | SupportFunctions/arm_float_to_q7.c 29 | SupportFunctions/arm_heap_sort_f32.c 30 | SupportFunctions/arm_insertion_sort_f32.c 31 | SupportFunctions/arm_merge_sort_f32.c 32 | SupportFunctions/arm_merge_sort_init_f32.c 33 | SupportFunctions/arm_q15_to_f64.c 34 | SupportFunctions/arm_q15_to_float.c 35 | SupportFunctions/arm_q15_to_q31.c 36 | SupportFunctions/arm_q15_to_q7.c 37 | SupportFunctions/arm_q31_to_f64.c 38 | SupportFunctions/arm_q31_to_float.c 39 | SupportFunctions/arm_q31_to_q15.c 40 | SupportFunctions/arm_q31_to_q7.c 41 | SupportFunctions/arm_q7_to_f64.c 42 | SupportFunctions/arm_q7_to_float.c 43 | SupportFunctions/arm_q7_to_q15.c 44 | SupportFunctions/arm_q7_to_q31.c 45 | SupportFunctions/arm_quick_sort_f32.c 46 | SupportFunctions/arm_selection_sort_f32.c 47 | SupportFunctions/arm_sort_f32.c 48 | SupportFunctions/arm_sort_init_f32.c 49 | SupportFunctions/arm_weighted_sum_f32.c 50 | ) 51 | 52 | 53 | 54 | 55 | if ((NOT ARMAC5) AND (NOT DISABLEFLOAT16)) 56 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_copy_f16.c) 57 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_fill_f16.c) 58 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_f16_to_q15.c) 59 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_q15_to_f16.c) 60 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_float_to_f16.c) 61 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_f16_to_float.c) 62 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_weighted_sum_f16.c) 63 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_barycenter_f16.c) 64 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_f16_to_f64.c) 65 | target_sources(CMSISDSP PRIVATE SupportFunctions/arm_f64_to_f16.c) 66 | endif() 67 | 68 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/SupportFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: SupportFunctions.c 4 | * Description: Combination of all support function source files. 5 | * 6 | * $Date: 18 August 2022 7 | * $Revision: V1.1.1 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_barycenter_f32.c" 30 | #include "arm_bitonic_sort_f32.c" 31 | #include "arm_bubble_sort_f32.c" 32 | #include "arm_copy_f32.c" 33 | #include "arm_copy_f64.c" 34 | #include "arm_copy_q15.c" 35 | #include "arm_copy_q31.c" 36 | #include "arm_copy_q7.c" 37 | #include "arm_fill_f32.c" 38 | #include "arm_fill_f64.c" 39 | #include "arm_fill_q15.c" 40 | #include "arm_fill_q31.c" 41 | #include "arm_fill_q7.c" 42 | #include "arm_heap_sort_f32.c" 43 | #include "arm_insertion_sort_f32.c" 44 | #include "arm_merge_sort_f32.c" 45 | #include "arm_merge_sort_init_f32.c" 46 | #include "arm_quick_sort_f32.c" 47 | #include "arm_selection_sort_f32.c" 48 | #include "arm_sort_f32.c" 49 | #include "arm_sort_init_f32.c" 50 | #include "arm_weighted_sum_f32.c" 51 | 52 | #include "arm_f64_to_float.c" 53 | #include "arm_f64_to_q31.c" 54 | #include "arm_f64_to_q15.c" 55 | #include "arm_f64_to_q7.c" 56 | #include "arm_float_to_f64.c" 57 | #include "arm_float_to_q15.c" 58 | #include "arm_float_to_q31.c" 59 | #include "arm_float_to_q7.c" 60 | #include "arm_q15_to_f64.c" 61 | #include "arm_q15_to_float.c" 62 | #include "arm_q15_to_q31.c" 63 | #include "arm_q15_to_q7.c" 64 | #include "arm_q31_to_f64.c" 65 | #include "arm_q31_to_float.c" 66 | #include "arm_q31_to_q15.c" 67 | #include "arm_q31_to_q7.c" 68 | #include "arm_q7_to_f64.c" 69 | #include "arm_q7_to_float.c" 70 | #include "arm_q7_to_q15.c" 71 | #include "arm_q7_to_q31.c" 72 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/SupportFunctionsF16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: SupportFunctions.c 4 | * Description: Combination of all support function source files. 5 | * 6 | * $Date: 18 August 2022 7 | * $Revision: V1.1.1 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_copy_f16.c" 30 | #include "arm_fill_f16.c" 31 | #include "arm_f16_to_q15.c" 32 | #include "arm_f16_to_float.c" 33 | #include "arm_f16_to_f64.c" 34 | #include "arm_f64_to_f16.c" 35 | #include "arm_q15_to_f16.c" 36 | #include "arm_float_to_f16.c" 37 | #include "arm_weighted_sum_f16.c" 38 | #include "arm_barycenter_f16.c" 39 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/arm_copy_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_copy_f64.c 4 | * Description: Copies the elements of a floating-point vector 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/support_functions.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup copy 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Copies the elements of a floating-point vector. 42 | @param[in] pSrc points to input vector 43 | @param[out] pDst points to output vector 44 | @param[in] blockSize number of samples in each vector 45 | @return none 46 | */ 47 | void arm_copy_f64( 48 | const float64_t * pSrc, 49 | float64_t * pDst, 50 | uint32_t blockSize) 51 | { 52 | uint32_t blkCnt; /* Loop counter */ 53 | 54 | /* Initialize blkCnt with number of samples */ 55 | blkCnt = blockSize; 56 | 57 | while (blkCnt > 0U) 58 | { 59 | /* C = A */ 60 | 61 | /* Copy and store result in destination buffer */ 62 | *pDst++ = *pSrc++; 63 | 64 | /* Decrement loop counter */ 65 | blkCnt--; 66 | } 67 | } 68 | 69 | /** 70 | @} end of BasicCopy group 71 | */ 72 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/arm_f16_to_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_f16_to_f64.c 4 | * Description: Converts the elements of the floating-point 16 bit vector to floating-point 64 bit vector 5 | * 6 | * $Date: 18 August 2022 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2022 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/support_functions_f16.h" 30 | 31 | #if defined(ARM_FLOAT16_SUPPORTED) 32 | 33 | /** 34 | @ingroup groupSupport 35 | */ 36 | 37 | /** 38 | @addtogroup f16_to_x 39 | @{ 40 | */ 41 | 42 | /** 43 | @brief Converts the elements of the f16 vector to f64 vector. 44 | @param[in] pSrc points to the f16 input vector 45 | @param[out] pDst points to the f64 output vector 46 | @param[in] blockSize number of samples in each vector 47 | @return none 48 | 49 | */ 50 | 51 | void arm_f16_to_f64( 52 | const float16_t * pSrc, 53 | float64_t * pDst, 54 | uint32_t blockSize) 55 | 56 | { 57 | const float16_t *pIn = pSrc; /* Src pointer */ 58 | uint32_t blkCnt; /* loop counter */ 59 | 60 | /* 61 | * Loop over blockSize number of values 62 | */ 63 | blkCnt = blockSize; 64 | 65 | while (blkCnt > 0U) 66 | { 67 | 68 | *pDst++ = (float64_t) * pIn++; 69 | /* 70 | * Decrement the loop counter 71 | */ 72 | blkCnt--; 73 | } 74 | } 75 | 76 | 77 | 78 | /** 79 | @} end of f16_to_x group 80 | */ 81 | 82 | 83 | 84 | #endif /* #if defined(ARM_FLOAT16_SUPPORTED) */ 85 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/arm_f64_to_f16.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_f64_to_f16.c 4 | * Description: Converts the elements of the 64 bit floating-point vector to 16 bit floating-point vector 5 | * 6 | * $Date: 18 August 2022 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2022 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/support_functions_f16.h" 30 | 31 | #if defined(ARM_FLOAT16_SUPPORTED) 32 | 33 | /** 34 | @ingroup groupSupport 35 | */ 36 | 37 | /** 38 | * @defgroup f64_to_x Convert 64-bit floating point value 39 | */ 40 | 41 | /** 42 | @addtogroup f64_to_x 43 | @{ 44 | */ 45 | 46 | /** 47 | @brief Converts the elements of the f64 vector to f16 vector. 48 | @param[in] pSrc points to the f64 input vector 49 | @param[out] pDst points to the f16 output vector 50 | @param[in] blockSize number of samples in each vector 51 | @return none 52 | 53 | */ 54 | 55 | 56 | void arm_f64_to_f16( 57 | const float64_t * pSrc, 58 | float16_t * pDst, 59 | uint32_t blockSize) 60 | { 61 | const float64_t *pIn = pSrc; /* Src pointer */ 62 | uint32_t blkCnt; /* loop counter */ 63 | 64 | /* 65 | * Loop over blockSize number of values 66 | */ 67 | blkCnt = blockSize; 68 | 69 | while (blkCnt > 0U) 70 | { 71 | 72 | *pDst++ = (float16_t) * pIn++; 73 | /* 74 | * Decrement the loop counter 75 | */ 76 | blkCnt--; 77 | } 78 | } 79 | /** 80 | @} end of f64_to_x group 81 | */ 82 | 83 | #endif /* #if defined(ARM_FLOAT16_SUPPORTED) */ 84 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/arm_f64_to_float.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_f64_to_float.c 4 | * Description: Converts the elements of the floating-point 64 bit vector to floating-point vector 5 | * 6 | * $Date: 18 August 2022 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2022 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/support_functions.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | 36 | /** 37 | @addtogroup f64_to_x 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Converts the elements of the f64 vector to f32 vector. 43 | @param[in] pSrc points to the f64 input vector 44 | @param[out] pDst points to the f32 output vector 45 | @param[in] blockSize number of samples in each vector 46 | @return none 47 | 48 | */ 49 | 50 | 51 | void arm_f64_to_float( 52 | const float64_t * pSrc, 53 | float32_t * pDst, 54 | uint32_t blockSize) 55 | { 56 | const float64_t *pIn = pSrc; /* Src pointer */ 57 | uint32_t blkCnt; /* loop counter */ 58 | 59 | /* 60 | * Loop over blockSize number of values 61 | */ 62 | blkCnt = blockSize; 63 | 64 | while (blkCnt > 0U) 65 | { 66 | 67 | *pDst++ = (float32_t) * pIn++; 68 | /* 69 | * Decrement the loop counter 70 | */ 71 | blkCnt--; 72 | } 73 | } 74 | /** 75 | @} end of f64_to_x group 76 | */ 77 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/arm_fill_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fill_f64.c 4 | * Description: Fills a constant value into a floating-point vector 5 | * 6 | * $Date: 13 September 2021 7 | * $Revision: V1.10.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/support_functions.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup Fill 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Fills a constant value into a floating-point vector. 42 | @param[in] value input value to be filled 43 | @param[out] pDst points to output vector 44 | @param[in] blockSize number of samples in each vector 45 | @return none 46 | */ 47 | void arm_fill_f64( 48 | float64_t value, 49 | float64_t * pDst, 50 | uint32_t blockSize) 51 | { 52 | uint32_t blkCnt; /* Loop counter */ 53 | 54 | /* Initialize blkCnt with number of samples */ 55 | blkCnt = blockSize; 56 | 57 | while (blkCnt > 0U) 58 | { 59 | /* C = value */ 60 | 61 | /* Fill value in destination buffer */ 62 | *pDst++ = value; 63 | 64 | /* Decrement loop counter */ 65 | blkCnt--; 66 | } 67 | } 68 | 69 | /** 70 | @} end of Fill group 71 | */ 72 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/arm_float_to_f64.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_float_to_f64.c 4 | * Description: Converts the elements of the floating-point vector to floating-point 64 bit vector 5 | * 6 | * $Date: 18 August 2022 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2022 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/support_functions.h" 30 | 31 | 32 | 33 | 34 | /** 35 | @ingroup groupSupport 36 | */ 37 | 38 | /** 39 | @addtogroup float_to_x 40 | @{ 41 | */ 42 | 43 | /** 44 | @brief Converts the elements of the floating-point vector to f64 vector. 45 | @param[in] pSrc points to the f32 input vector 46 | @param[out] pDst points to the f64 output vector 47 | @param[in] blockSize number of samples in each vector 48 | @return none 49 | 50 | */ 51 | 52 | void arm_float_to_f64( 53 | const float32_t * pSrc, 54 | float64_t * pDst, 55 | uint32_t blockSize) 56 | 57 | { 58 | const float32_t *pIn = pSrc; /* Src pointer */ 59 | uint32_t blkCnt; /* loop counter */ 60 | 61 | /* 62 | * Loop over blockSize number of values 63 | */ 64 | blkCnt = blockSize; 65 | 66 | while (blkCnt > 0U) 67 | { 68 | 69 | *pDst++ = (float64_t) * pIn++; 70 | /* 71 | * Decrement the loop counter 72 | */ 73 | blkCnt--; 74 | } 75 | } 76 | 77 | 78 | 79 | /** 80 | @} end of float_to_x group 81 | */ 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/arm_merge_sort_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_merge_sort_init_f32.c 4 | * Description: Floating point merge sort initialization function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "dsp/support_functions.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup Sorting 37 | @{ 38 | */ 39 | 40 | 41 | /** 42 | * @param[in,out] S points to an instance of the sorting structure. 43 | * @param[in] dir Sorting order. 44 | * @param[in] buffer Working buffer. 45 | */ 46 | void arm_merge_sort_init_f32(arm_merge_sort_instance_f32 * S, arm_sort_dir dir, float32_t * buffer) 47 | { 48 | S->dir = dir; 49 | S->buffer = buffer; 50 | } 51 | /** 52 | @} end of Sorting group 53 | */ 54 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/arm_sort_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_sort_f32.c 4 | * Description: Floating point sort 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_sorting.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup Sorting 37 | @{ 38 | */ 39 | 40 | 41 | /** 42 | * @brief Generic sorting function 43 | * 44 | * @param[in] S points to an instance of the sorting structure. 45 | * @param[in] pSrc points to the block of input data. 46 | * @param[out] pDst points to the block of output data. 47 | * @param[in] blockSize number of samples to process. 48 | */ 49 | 50 | void arm_sort_f32( 51 | const arm_sort_instance_f32 * S, 52 | float32_t * pSrc, 53 | float32_t * pDst, 54 | uint32_t blockSize) 55 | { 56 | switch(S->alg) 57 | { 58 | case ARM_SORT_BITONIC: 59 | arm_bitonic_sort_f32(S, pSrc, pDst, blockSize); 60 | break; 61 | 62 | case ARM_SORT_BUBBLE: 63 | arm_bubble_sort_f32(S, pSrc, pDst, blockSize); 64 | break; 65 | 66 | case ARM_SORT_HEAP: 67 | arm_heap_sort_f32(S, pSrc, pDst, blockSize); 68 | break; 69 | 70 | case ARM_SORT_INSERTION: 71 | arm_insertion_sort_f32(S, pSrc, pDst, blockSize); 72 | break; 73 | 74 | case ARM_SORT_QUICK: 75 | arm_quick_sort_f32(S, pSrc, pDst, blockSize); 76 | break; 77 | 78 | case ARM_SORT_SELECTION: 79 | arm_selection_sort_f32(S, pSrc, pDst, blockSize); 80 | break; 81 | } 82 | } 83 | 84 | /** 85 | @} end of Sorting group 86 | */ 87 | -------------------------------------------------------------------------------- /Code/DSP/Source/SupportFunctions/arm_sort_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_sort_init_f32.c 4 | * Description: Floating point sort initialization function 5 | * 6 | * $Date: 23 April 2021 7 | * $Revision: V1.9.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_sorting.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup Sorting 37 | @{ 38 | */ 39 | 40 | 41 | /** 42 | * @param[in,out] S points to an instance of the sorting structure. 43 | * @param[in] alg Selected algorithm. 44 | * @param[in] dir Sorting order. 45 | */ 46 | void arm_sort_init_f32(arm_sort_instance_f32 * S, arm_sort_alg alg, arm_sort_dir dir) 47 | { 48 | S->alg = alg; 49 | S->dir = dir; 50 | } 51 | 52 | /** 53 | @} end of Sorting group 54 | */ 55 | -------------------------------------------------------------------------------- /Code/Drivers/CRC8.c: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *FileName: CRC8.c 3 | *Author: qianwan 4 | *Details: 查表法计算CRC 5 | *Mode: CRC-8/MAXIM 6 | *Polynomial: X8+X5+X4+1(0x31) 7 | *Init: 0x00 8 | *XOROUT: 0x00 9 | 10 | *Version: 1.0 11 | *Date: 2023/03/15 12 | *Describe: 创建代码 13 | **********************************************************************************/ 14 | #include "CRC8.h" 15 | const uint8_t CRC8_table[256] = 16 | { 17 | 0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41, 18 | 0x9d, 0xc3, 0x21, 0x7f, 0xfc, 0xa2, 0x40, 0x1e, 0x5f, 0x01, 0xe3, 0xbd, 0x3e, 0x60, 0x82, 0xdc, 19 | 0x23, 0x7d, 0x9f, 0xc1, 0x42, 0x1c, 0xfe, 0xa0, 0xe1, 0xbf, 0x5d, 0x03, 0x80, 0xde, 0x3c, 0x62, 20 | 0xbe, 0xe0, 0x02, 0x5c, 0xdf, 0x81, 0x63, 0x3d, 0x7c, 0x22, 0xc0, 0x9e, 0x1d, 0x43, 0xa1, 0xff, 21 | 0x46, 0x18, 0xfa, 0xa4, 0x27, 0x79, 0x9b, 0xc5, 0x84, 0xda, 0x38, 0x66, 0xe5, 0xbb, 0x59, 0x07, 22 | 0xdb, 0x85, 0x67, 0x39, 0xba, 0xe4, 0x06, 0x58, 0x19, 0x47, 0xa5, 0xfb, 0x78, 0x26, 0xc4, 0x9a, 23 | 0x65, 0x3b, 0xd9, 0x87, 0x04, 0x5a, 0xb8, 0xe6, 0xa7, 0xf9, 0x1b, 0x45, 0xc6, 0x98, 0x7a, 0x24, 24 | 0xf8, 0xa6, 0x44, 0x1a, 0x99, 0xc7, 0x25, 0x7b, 0x3a, 0x64, 0x86, 0xd8, 0x5b, 0x05, 0xe7, 0xb9, 25 | 0x8c, 0xd2, 0x30, 0x6e, 0xed, 0xb3, 0x51, 0x0f, 0x4e, 0x10, 0xf2, 0xac, 0x2f, 0x71, 0x93, 0xcd, 26 | 0x11, 0x4f, 0xad, 0xf3, 0x70, 0x2e, 0xcc, 0x92, 0xd3, 0x8d, 0x6f, 0x31, 0xb2, 0xec, 0x0e, 0x50, 27 | 0xaf, 0xf1, 0x13, 0x4d, 0xce, 0x90, 0x72, 0x2c, 0x6d, 0x33, 0xd1, 0x8f, 0x0c, 0x52, 0xb0, 0xee, 28 | 0x32, 0x6c, 0x8e, 0xd0, 0x53, 0x0d, 0xef, 0xb1, 0xf0, 0xae, 0x4c, 0x12, 0x91, 0xcf, 0x2d, 0x73, 29 | 0xca, 0x94, 0x76, 0x28, 0xab, 0xf5, 0x17, 0x49, 0x08, 0x56, 0xb4, 0xea, 0x69, 0x37, 0xd5, 0x8b, 30 | 0x57, 0x09, 0xeb, 0xb5, 0x36, 0x68, 0x8a, 0xd4, 0x95, 0xcb, 0x29, 0x77, 0xf4, 0xaa, 0x48, 0x16, 31 | 0xe9, 0xb7, 0x55, 0x0b, 0x88, 0xd6, 0x34, 0x6a, 0x2b, 0x75, 0x97, 0xc9, 0x4a, 0x14, 0xf6, 0xa8, 32 | 0x74, 0x2a, 0xc8, 0x96, 0x15, 0x4b, 0xa9, 0xf7, 0xb6, 0xe8, 0x0a, 0x54, 0xd7, 0x89, 0x6b, 0x35, 33 | }; 34 | 35 | /** 36 | * @brief 计算CRC8 37 | * @param[in] ptr: 数据指针 38 | * @param[in] len: 校验长度 39 | * @retval CRC-8值 40 | */ 41 | uint8_t cal_crc8_table(uint8_t *ptr, uint8_t len) 42 | { 43 | uint8_t uc_index; 44 | uint8_t ucCRC8 = 0x00; 45 | while (len--) 46 | { 47 | uc_index = ucCRC8^(*ptr++); 48 | ucCRC8 = CRC8_table[uc_index]; 49 | } 50 | return(ucCRC8); 51 | } -------------------------------------------------------------------------------- /Code/Drivers/CRC8.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *FileName: CRC8.h 3 | *Author: qianwan 4 | *Details: 查表法计算CRC 5 | *Mode: CRC-8/MAXIM 6 | *Polynomial: X8+X5+X4+1(0x31) 7 | *Init: 0x00 8 | *XOROUT: 0x00 9 | 10 | *Version: 1.0 11 | *Date: 2023/03/15 12 | *Describe: 创建代码 13 | **********************************************************************************/ 14 | #ifndef CRC8_H 15 | #define CRC8_H 16 | #include "main.h" 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | uint8_t cal_crc8_table(uint8_t *ptr, uint8_t len); 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif -------------------------------------------------------------------------------- /Code/Drivers/Data_Exchange.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Drivers/Data_Exchange.c -------------------------------------------------------------------------------- /Code/Drivers/Data_Exchange.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Drivers/Data_Exchange.h -------------------------------------------------------------------------------- /Code/Drivers/Flash_GD.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Drivers/Flash_GD.c -------------------------------------------------------------------------------- /Code/Drivers/Flash_GD.h: -------------------------------------------------------------------------------- 1 | #ifndef FLASH_GD 2 | #define FLASH_GD 3 | #include "main.h" 4 | 5 | 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /*! 11 | \brief read Data at Addr 12 | \param[in] Addr: Address Data:Read data buf Words:Number of words 13 | \param[out] none 14 | \retval Word at Addr 15 | */ 16 | inline void fmc_read_u32(uint32_t Addr, uint32_t *Data, uint16_t Words) 17 | { 18 | for(uint16_t i=0;iCS_0(); 16 | this->SPI_ExchangeOneByte(Reg); 17 | Read = this->SPI_ExchangeOneByte(0xFF); 18 | this->CS_1(); 19 | return Read; 20 | } 21 | 22 | void cICM42688::ReadReg(uint8_t Reg, uint8_t* Data, uint8_t num) 23 | { 24 | Reg |= 0x80; 25 | 26 | this->CS_0(); 27 | this->SPI_ExchangeOneByte(Reg); 28 | for(uint8_t i = 0; i < num; i++) 29 | {Data[i] = this->SPI_ExchangeOneByte(0x00);} 30 | this->CS_1(); 31 | } 32 | 33 | void cICM42688::WriteReg( uint8_t Reg, uint8_t Data) 34 | { 35 | this->CS_0(); 36 | this->SPI_ExchangeOneByte(Reg); 37 | this->SPI_ExchangeOneByte(Data); 38 | this->CS_1(); 39 | } 40 | 41 | void cICM42688::WriteReg( uint8_t Reg, uint8_t *Data, uint8_t num) 42 | { 43 | this->CS_0(); 44 | this->SPI_ExchangeOneByte(Reg); 45 | for(uint8_t i = 0; i < num; i++) 46 | {this->SPI_ExchangeOneByte(Data[i]);} 47 | this->CS_1(); 48 | } 49 | 50 | void cICM42688::ReadAccel(void) 51 | { 52 | uint8_t AccelBuf[6]; 53 | this->ReadReg(0x1F,AccelBuf,6); 54 | this->Accel[0] = (AccelBuf[0]<<8 | AccelBuf[1]); 55 | this->Accel[1] = (AccelBuf[2]<<8 | AccelBuf[3]); 56 | this->Accel[2] = (AccelBuf[4]<<8 | AccelBuf[5]); 57 | } 58 | 59 | void cICM42688::ReadGyro(void) 60 | { 61 | uint8_t GyroBuf[6]; 62 | this->ReadReg(0x25,GyroBuf,6); 63 | this->Gyro[0] = (GyroBuf[0]<<8 | GyroBuf[1]); 64 | this->Gyro[1] = (GyroBuf[2]<<8 | GyroBuf[3]); 65 | this->Gyro[2] = (GyroBuf[4]<<8 | GyroBuf[5]); 66 | }; 67 | 68 | void cICM42688::ReadAccelGyro(void) 69 | { 70 | uint8_t Buf[12]; 71 | this->ReadReg(0x1F,Buf,12); 72 | this->Accel[0] = (int16_t)(Buf[0]<<8 | Buf[1]); 73 | this->Accel[1] = (int16_t)(Buf[2]<<8 | Buf[3]); 74 | this->Accel[2] = (int16_t)(Buf[4]<<8 | Buf[5]); 75 | this->Gyro[0] = (int16_t)(Buf[6]<<8 | Buf[7]); 76 | this->Gyro[1] = (int16_t)(Buf[8]<<8 | Buf[9]); 77 | this->Gyro[2] = (int16_t)(Buf[10]<<8| Buf[11]); 78 | } 79 | 80 | void cICM42688::ReadTem(void) 81 | { 82 | uint8_t buf[2]={0}; 83 | int16_t raw_tmp; 84 | 85 | this->ReadReg(0x1D,buf,2); 86 | 87 | raw_tmp = (int16_t)((buf[0]<<8)|(buf[1])); 88 | //低通滤波器截止频率:100Hz 89 | //this->Temperature = 0.1*(((float)raw_tmp/132.48f)+25.0f) + 0.9*this->Temperature; 90 | this->Temperature = ((float)raw_tmp/1324.8f)+ 2.5f + 0.9*this->Temperature; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /Code/Drivers/ICM42688.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *FileName: ICM42688.h 3 | *Author: qianwan 4 | *Detail: ICM42688-P驱动 5 | 6 | *Version: 1.0 7 | *Date: 2023/03/10 8 | *Describe: 新建项目 9 | **********************************************************************************/ 10 | #ifndef ICM42688_H 11 | #define ICM42688_H 12 | #include 13 | #include "SPI_GD.h" 14 | #ifdef __cplusplus 15 | 16 | /*G = 9.8011 in Dalian*/ 17 | #define LSB_ACC_16G 0.0047856934f 18 | #define LSB_ACC_8G 0.0023928467f 19 | #define LSB_ACC_4G 0.0011964233f 20 | #define LSB_ACC_2G 0.00059821167f 21 | 22 | /*Turn Into Radian*/ 23 | #define LSB_GYRO_2000_R 0.0010652644f 24 | #define LSB_GYRO_1000_R 0.00053263222f 25 | #define LSB_GYRO_500_R 0.00026631611f 26 | #define LSB_GYRO_250_R 0.00013315805f 27 | #define LSB_GYRO_125D_R 0.000066579027f 28 | 29 | class cICM42688 : public cSPI 30 | { 31 | 32 | public: 33 | 34 | int16_t Accel[3]={0};//XYZ 35 | int16_t Gyro[3]={0};//XYZ 36 | float Temperature=0; 37 | float LSB_ACC_GYRO[2]={0}; 38 | 39 | uint8_t ReadReg( uint8_t Reg); 40 | void ReadReg( uint8_t Reg, uint8_t* Data, uint8_t num); 41 | void WriteReg( uint8_t Reg, uint8_t Data); 42 | void WriteReg( uint8_t Reg, uint8_t* Data, uint8_t num); 43 | 44 | void ReadAccel(void); 45 | void ReadGyro(void); 46 | void ReadAccelGyro(void); 47 | void ReadTem(void); 48 | 49 | }; 50 | 51 | 52 | extern "C" { 53 | 54 | } 55 | 56 | #endif 57 | #endif -------------------------------------------------------------------------------- /Code/Drivers/PID.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Drivers/PID.cpp -------------------------------------------------------------------------------- /Code/Drivers/PID.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Drivers/PID.h -------------------------------------------------------------------------------- /Code/Drivers/SPI_GD.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Drivers/SPI_GD.cpp -------------------------------------------------------------------------------- /Code/Drivers/SPI_GD.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Drivers/SPI_GD.h -------------------------------------------------------------------------------- /Code/Drivers/UART_GD.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Drivers/UART_GD.cpp -------------------------------------------------------------------------------- /Code/Drivers/UART_GD.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/Drivers/UART_GD.h -------------------------------------------------------------------------------- /Code/Drivers/WS281x.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *FileName: WS281x.cpp 3 | *Author: qianwan 4 | *Details: WS281x SPI 驱动 API 5 | 依赖SPI软件或硬件驱动,时钟频率=2.4MHz 6 | *CharaterCode: UTF-8 7 | 8 | *Version: 1.0 9 | *Date: 2023/03/05 10 | *Describe: 创建代码 11 | **********************************************************************************/ 12 | #include "WS281x.h" 13 | 14 | /*发送缓冲区长度应当为 9x灯+1 ,最后一位恒为0*/ 15 | void cWS281x::Init(uint8_t *TransmitBuf) 16 | { 17 | this->TransmitBuf = TransmitBuf; 18 | } 19 | 20 | void cWS281x::Color_Transform(LEDColor_t *ColorTable, uint8_t *buf, uint16_t num) 21 | { 22 | for(uint16_t i=0;i>=1; 33 | } 34 | buf[9*i+3*j] = (uint8_t)((tem_led >> 19)&0xFF); 35 | buf[9*i+3*j+1] = (uint8_t)((tem_led >> 11)&0xFF); 36 | buf[9*i+3*j+2] = (uint8_t)((tem_led >> 3)&0xFF); 37 | } 38 | } 39 | buf[9*num]=0; 40 | } 41 | 42 | uint8_t cWS281x::LED_Update(LEDColor_t *ColorTable,uint16_t num) 43 | { 44 | if(ColorTable==0){return 1;} 45 | 46 | this->Color_Transform(ColorTable,this->TransmitBuf,num); 47 | 48 | for(uint16_t i=0;i<9*num;i++) 49 | {this->SPI_ExchangeOneByte(this->TransmitBuf[i]);} 50 | 51 | this->SPI_ExchangeOneByte(0); 52 | return 0; 53 | } 54 | 55 | uint8_t cWS281x::LED_UpdateDMA(LEDColor_t *ColorTable,uint16_t num) 56 | { 57 | if(ColorTable==0){return 1;} 58 | 59 | this->Color_Transform(ColorTable,this->TransmitBuf,num); 60 | 61 | return this->Transmit_DMA(this->TransmitBuf,9*num+1); 62 | } -------------------------------------------------------------------------------- /Code/Drivers/WS281x.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************* 2 | *FileName: WS281x.h 3 | *Author: qianwan 4 | *Details: WS281x SPI 驱动 API 5 | 依赖SPI软件或硬件驱动,时钟频率=2.4MHz 6 | *CharaterCode: UTF-8 7 | 8 | *Version: 1.0 9 | *Date: 2023/03/05 10 | *Describe: 创建代码 11 | **********************************************************************************/ 12 | #ifndef WS281X_H 13 | #define WS281X_H 14 | #include 15 | #include "SPI_GD.h" 16 | #ifdef __cplusplus 17 | struct LEDColor_t 18 | { 19 | uint8_t GRB[3]; 20 | }; 21 | 22 | class cWS281x:public cSPI 23 | { 24 | protected: 25 | uint8_t *TransmitBuf; 26 | void Color_Transform(LEDColor_t *ColorTable, uint8_t *buf, uint16_t num); 27 | 28 | public: 29 | void Init(uint8_t *TransmitBuf); 30 | uint8_t LED_Update(LEDColor_t *ColorTable,uint16_t num); 31 | uint8_t LED_UpdateDMA(LEDColor_t *ColorTable,uint16_t num); 32 | }; 33 | 34 | #endif 35 | #endif -------------------------------------------------------------------------------- /Code/Drivers/gd32f30x_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32f30x_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2017-02-10, V1.0.0, firmware for GD32F30x 6 | \version 2018-10-10, V1.1.0, firmware for GD32F30x 7 | \version 2018-12-25, V2.0.0, firmware for GD32F30x 8 | \version 2020-09-30, V2.1.0, firmware for GD32F30x 9 | */ 10 | 11 | /* 12 | Copyright (c) 2020, GigaDevice Semiconductor Inc. 13 | 14 | Redistribution and use in source and binary forms, with or without modification, 15 | are permitted provided that the following conditions are met: 16 | 17 | 1. Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright notice, 20 | this list of conditions and the following disclaimer in the documentation 21 | and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holder nor the names of its contributors 23 | may be used to endorse or promote products derived from this software without 24 | specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 29 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 30 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 31 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 32 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 33 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | OF SUCH DAMAGE. 36 | */ 37 | 38 | #ifndef GD32F30X_IT_H 39 | #define GD32F30X_IT_H 40 | 41 | #include "gd32f30x.h" 42 | 43 | /* function declarations */ 44 | /* this function handles NMI exception */ 45 | void NMI_Handler(void); 46 | /* this function handles HardFault exception */ 47 | void HardFault_Handler(void); 48 | /* this function handles MemManage exception */ 49 | void MemManage_Handler(void); 50 | /* this function handles BusFault exception */ 51 | void BusFault_Handler(void); 52 | /* this function handles UsageFault exception */ 53 | void UsageFault_Handler(void); 54 | /* this function handles SVC exception */ 55 | void SVC_Handler(void); 56 | /* this function handles DebugMon exception */ 57 | void DebugMon_Handler(void); 58 | /* this function handles PendSV exception */ 59 | void PendSV_Handler(void); 60 | /* this function handles SysTick exception */ 61 | void SysTick_Handler(void); 62 | 63 | #endif /* GD32F30X_IT_H */ 64 | -------------------------------------------------------------------------------- /Code/Drivers/gd32f30x_libopt.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32f30x_libopt.h 3 | \brief library optional for gd32f30x 4 | 5 | \version 2017-02-10, V1.0.0, firmware for GD32F30x 6 | \version 2018-10-10, V1.1.0, firmware for GD32F30x 7 | \version 2018-12-25, V2.0.0, firmware for GD32F30x 8 | \version 2020-09-30, V2.1.0, firmware for GD32F30x 9 | */ 10 | 11 | /* 12 | Copyright (c) 2020, GigaDevice Semiconductor Inc. 13 | 14 | Redistribution and use in source and binary forms, with or without modification, 15 | are permitted provided that the following conditions are met: 16 | 17 | 1. Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright notice, 20 | this list of conditions and the following disclaimer in the documentation 21 | and/or other materials provided with the distribution. 22 | 3. Neither the name of the copyright holder nor the names of its contributors 23 | may be used to endorse or promote products derived from this software without 24 | specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 29 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 30 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 31 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 32 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 33 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | OF SUCH DAMAGE. 36 | */ 37 | 38 | #ifndef GD32F30X_LIBOPT_H 39 | #define GD32F30X_LIBOPT_H 40 | 41 | #include "gd32f30x_rcu.h" 42 | #include "gd32f30x_adc.h" 43 | #include "gd32f30x_can.h" 44 | #include "gd32f30x_crc.h" 45 | #include "gd32f30x_ctc.h" 46 | #include "gd32f30x_dac.h" 47 | #include "gd32f30x_dbg.h" 48 | #include "gd32f30x_dma.h" 49 | #include "gd32f30x_exti.h" 50 | #include "gd32f30x_fmc.h" 51 | #include "gd32f30x_fwdgt.h" 52 | #include "gd32f30x_gpio.h" 53 | #include "gd32f30x_i2c.h" 54 | #include "gd32f30x_pmu.h" 55 | #include "gd32f30x_bkp.h" 56 | #include "gd32f30x_rtc.h" 57 | #include "gd32f30x_sdio.h" 58 | #include "gd32f30x_spi.h" 59 | #include "gd32f30x_timer.h" 60 | #include "gd32f30x_usart.h" 61 | #include "gd32f30x_wwdgt.h" 62 | #include "gd32f30x_misc.h" 63 | #include "gd32f30x_enet.h" 64 | #include "gd32f30x_exmc.h" 65 | 66 | #endif /* GD32F30X_LIBOPT_H */ 67 | -------------------------------------------------------------------------------- /Code/GD32F30x_standard_peripheral/GD32F30x/Include/system_gd32f30x.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file system_gd32f30x.h 3 | \brief CMSIS Cortex-M4 Device Peripheral Access Layer Header File for 4 | GD32F30x Device Series 5 | */ 6 | 7 | /* Copyright (c) 2012 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | /* This file refers the CMSIS standard, some adjustments are made according to GigaDevice chips */ 34 | 35 | #ifndef SYSTEM_GD32F30X_H 36 | #define SYSTEM_GD32F30X_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | #include 43 | 44 | /* system clock frequency (core clock) */ 45 | extern uint32_t SystemCoreClock; 46 | 47 | /* function declarations */ 48 | /* initialize the system and update the SystemCoreClock variable */ 49 | extern void SystemInit (void); 50 | /* update the SystemCoreClock with current core clock retrieved from cpu registers */ 51 | extern void SystemCoreClockUpdate (void); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* SYSTEM_GD32F30X_H */ 58 | -------------------------------------------------------------------------------- /Code/GD32F30x_usbd_library/class/device/cdc/Include/usbd_hw.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file usbd_hw.h 3 | \brief usb hardware configuration file 4 | 5 | \version 2020-08-01, V3.0.0, firmware for GD32F30x 6 | \version 2022-06-10, V3.1.0, firmware for GD32F30x 7 | */ 8 | 9 | /* 10 | Copyright (c) 2022, GigaDevice Semiconductor Inc. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holder nor the names of its contributors 21 | may be used to endorse or promote products derived from this software without 22 | specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef __USBD_HW_H 37 | #define __USBD_HW_H 38 | 39 | #include "usbd_conf.h" 40 | 41 | /* function declarations */ 42 | /* configure rcu clock */ 43 | void rcu_config(void); 44 | /* configure gpio */ 45 | void gpio_config(void); 46 | /* configure nvic */ 47 | void nvic_config(void); 48 | 49 | #endif /* __USBD_HW_H */ 50 | -------------------------------------------------------------------------------- /Code/GD32F30x_usbd_library/class/device/cdc/Source/cdc_acm_core.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/GD32F30x_usbd_library/class/device/cdc/Source/cdc_acm_core.c -------------------------------------------------------------------------------- /Code/GD32F30x_usbd_library/device/Include/usbd_pwr.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file usbd_pwr.h 3 | \brief USB device power management functions prototype 4 | 5 | \version 2020-08-01, V3.0.0, firmware for GD32F30x 6 | \version 2022-06-10, V3.1.0, firmware for GD32F30x 7 | */ 8 | 9 | /* 10 | Copyright (c) 2022, GigaDevice Semiconductor Inc. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holder nor the names of its contributors 21 | may be used to endorse or promote products derived from this software without 22 | specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef __USBD_PWR_H 37 | #define __USBD_PWR_H 38 | 39 | #include "usbd_core.h" 40 | 41 | /* static inline function definitions */ 42 | /*! 43 | \brief first operation of USB wakeup is to wakeup MCU 44 | \param[in] udev: pointer to USB core instance 45 | \param[out] none 46 | \retval none 47 | */ 48 | __STATIC_INLINE void resume_mcu (usb_dev *udev) 49 | { 50 | udev->drv_handler->suspend_leave(); 51 | } 52 | 53 | /*! 54 | \brief set USB device to suspend mode 55 | \param[in] udev: pointer to USB core instance 56 | \param[out] none 57 | \retval none 58 | */ 59 | __STATIC_INLINE void usbd_to_suspend (usb_dev *udev) 60 | { 61 | udev->drv_handler->suspend(); 62 | } 63 | 64 | /* function declarations */ 65 | /* start to remote wakeup */ 66 | void usbd_remote_wakeup_active (usb_dev *udev); 67 | 68 | #endif /* __USBD_PWR_H */ 69 | -------------------------------------------------------------------------------- /Code/GD32F30x_usbd_library/device/Source/usbd_pwr.c: -------------------------------------------------------------------------------- 1 | /*! 2 | \file usbd_pwr.c 3 | \brief USB device power management driver 4 | 5 | \version 2020-08-01, V3.0.0, firmware for GD32F30x 6 | \version 2022-06-10, V3.1.0, firmware for GD32F30x 7 | */ 8 | 9 | /* 10 | Copyright (c) 2022, GigaDevice Semiconductor Inc. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holder nor the names of its contributors 21 | may be used to endorse or promote products derived from this software without 22 | specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | OF SUCH DAMAGE. 34 | */ 35 | 36 | #include "usbd_pwr.h" 37 | 38 | /*! 39 | \brief start to remote wakeup 40 | \param[in] udev: pointer to USB core instance 41 | \param[out] none 42 | \retval none 43 | */ 44 | void usbd_remote_wakeup_active(usb_dev *udev) 45 | { 46 | resume_mcu(udev); 47 | 48 | #ifdef LPM_ENABLED 49 | if(1 == udev->lpm.L1_remote_wakeup){ 50 | udev->drv_handler->resume(udev); 51 | 52 | udev->lpm.L1_resume = 1U; 53 | } 54 | #endif /* LPM_ENABLED */ 55 | 56 | if(1U == udev->pm.remote_wakeup){ 57 | udev->pm.remote_wakeup_on = 1U; 58 | udev->pm.esof_count = 15U; 59 | udev->drv_handler->resume(udev); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Code/GD32F30x_usbd_library/usbd/Include/usbd_lld_int.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file usbd_lld_int.h 3 | \brief USB device low level interrupt handler 4 | 5 | \version 2020-08-01, V3.0.0, firmware for GD32F30x 6 | \version 2022-06-10, V3.1.0, firmware for GD32F30x 7 | */ 8 | 9 | /* 10 | Copyright (c) 2022, GigaDevice Semiconductor Inc. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holder nor the names of its contributors 21 | may be used to endorse or promote products derived from this software without 22 | specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef __USBD_LLD_INT_H 37 | #define __USBD_LLD_INT_H 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | #include "usbd_core.h" 42 | #include "usbd_enum.h" 43 | #include "usbd_pwr.h" 44 | 45 | /* function declarations */ 46 | /* USB device interrupt service routine */ 47 | void usbd_isr (void); 48 | /* handle USB high priority successful transfer event */ 49 | void usbd_int_hpst (usb_dev *udev); 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | #endif /* __USBD_LLD_INT_H */ 54 | -------------------------------------------------------------------------------- /Code/GY_H1_V1.3.0.axf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/GY_H1_V1.3.0.axf -------------------------------------------------------------------------------- /Code/MDK-Arm/EventRecorderStub.scvd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Code/MDK-Arm/Keil5_disp_size_bar_v0.4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/MDK-Arm/Keil5_disp_size_bar_v0.4.exe -------------------------------------------------------------------------------- /Code/MDK-Arm/Objects/GY_H1.axf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/MDK-Arm/Objects/GY_H1.axf -------------------------------------------------------------------------------- /Code/MDK-Arm/Objects/GY_H1.sct: -------------------------------------------------------------------------------- 1 | ; ************************************************************* 2 | ; *** Scatter-Loading Description File generated by uVision *** 3 | ; ************************************************************* 4 | 5 | LR_IROM1 0x08000000 0x00080000 { ; load region size_region 6 | ER_IROM1 0x08000000 0x00080000 { ; load address = execution address 7 | *.o (RESET, +First) 8 | *(InRoot$$Sections) 9 | .ANY (+RO) 10 | .ANY (+XO) 11 | } 12 | RW_IRAM1 0x20000000 0x00010000 { ; RW data 13 | .ANY (+RW +ZI) 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Code/MDK-Arm/RTE/_GY-H1/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'GY_H1' 7 | * Target: 'GY-H1' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "gd32f30x.h" 18 | 19 | 20 | 21 | #endif /* RTE_COMPONENTS_H */ 22 | -------------------------------------------------------------------------------- /Code/MDK-Arm/RTE/_Target_1/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'GY_H1' 7 | * Target: 'Target 1' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "gd32f30x.h" 18 | 19 | 20 | 21 | #endif /* RTE_COMPONENTS_H */ 22 | -------------------------------------------------------------------------------- /Code/RT-Thread/bsp/board.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Code/RT-Thread/bsp/board.c -------------------------------------------------------------------------------- /Code/RT-Thread/components/finsh/finsh_config.h: -------------------------------------------------------------------------------- 1 | /* FinSH config file */ 2 | 3 | #ifndef __MSH_CFG_H__ 4 | #define __MSH_CFG_H__ 5 | 6 | // <<< Use Configuration Wizard in Context Menu >>> 7 | #define RT_USING_FINSH 8 | #define FINSH_USING_MSH 9 | #define FINSH_USING_MSH_ONLY 10 | // FinSH Configuration 11 | // the priority of finsh thread <1-30> 12 | // the priority of finsh thread 13 | // Default: 21 14 | #define FINSH_THREAD_PRIORITY 21 15 | // the stack of finsh thread <1-4096> 16 | // the stack of finsh thread 17 | // Default: 4096 (4096Byte) 18 | #define FINSH_THREAD_STACK_SIZE 1024 19 | 20 | #define FINSH_USING_SYMTAB 21 | // Enable command description 22 | // Enable command description 23 | #define FINSH_USING_DESCRIPTION 24 | // 25 | // 26 | 27 | // <<< end of configuration section >>> 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /Code/RT-Thread/components/finsh/finsh_port.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2021, RT-Thread Development Team 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Change Logs: 7 | * Date Author Notes 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | #ifndef RT_USING_FINSH 14 | #error Please uncomment the line <#include "finsh_config.h"> in the rtconfig.h 15 | #endif 16 | 17 | #ifdef RT_USING_FINSH 18 | 19 | RT_WEAK char rt_hw_console_getchar(void) 20 | { 21 | /* Note: the initial value of ch must < 0 */ 22 | int ch = -1; 23 | 24 | #error "TODO 4: Read a char from the uart and assign it to 'ch'." 25 | 26 | return ch; 27 | } 28 | 29 | #endif /* RT_USING_FINSH */ 30 | 31 | -------------------------------------------------------------------------------- /Code/RT-Thread/components/finsh/msh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2021, RT-Thread Development Team 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Change Logs: 7 | * Date Author Notes 8 | * 2013-03-30 Bernard the first verion for FinSH 9 | */ 10 | 11 | #ifndef __M_SHELL__ 12 | #define __M_SHELL__ 13 | 14 | #include 15 | 16 | rt_bool_t msh_is_used(void); 17 | int msh_exec(char *cmd, rt_size_t length); 18 | void msh_auto_complete(char *prefix); 19 | 20 | int msh_exec_module(const char *cmd_line, int size); 21 | int msh_exec_script(const char *cmd_line, int size); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /Code/RT-Thread/components/finsh/shell.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2021, RT-Thread Development Team 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Change Logs: 7 | * Date Author Notes 8 | * 2011-06-02 Bernard Add finsh_get_prompt function declaration 9 | */ 10 | 11 | #ifndef __SHELL_H__ 12 | #define __SHELL_H__ 13 | 14 | #include 15 | #include "finsh.h" 16 | 17 | #ifndef FINSH_THREAD_PRIORITY 18 | #define FINSH_THREAD_PRIORITY 20 19 | #endif 20 | #ifndef FINSH_THREAD_STACK_SIZE 21 | #define FINSH_THREAD_STACK_SIZE 2048 22 | #endif 23 | #ifndef FINSH_CMD_SIZE 24 | #define FINSH_CMD_SIZE 80 25 | #endif 26 | 27 | #define FINSH_OPTION_ECHO 0x01 28 | 29 | #define FINSH_PROMPT finsh_get_prompt() 30 | const char* finsh_get_prompt(void); 31 | int finsh_set_prompt(const char * prompt); 32 | 33 | #ifdef FINSH_USING_HISTORY 34 | #ifndef FINSH_HISTORY_LINES 35 | #define FINSH_HISTORY_LINES 5 36 | #endif 37 | #endif 38 | 39 | #ifdef FINSH_USING_AUTH 40 | #ifndef FINSH_PASSWORD_MAX 41 | #define FINSH_PASSWORD_MAX RT_NAME_MAX 42 | #endif 43 | #ifndef FINSH_PASSWORD_MIN 44 | #define FINSH_PASSWORD_MIN 6 45 | #endif 46 | #ifndef FINSH_DEFAULT_PASSWORD 47 | #define FINSH_DEFAULT_PASSWORD "rtthread" 48 | #endif 49 | #endif /* FINSH_USING_AUTH */ 50 | 51 | #ifndef FINSH_THREAD_NAME 52 | #define FINSH_THREAD_NAME "tshell" 53 | #endif 54 | 55 | enum input_stat 56 | { 57 | WAIT_NORMAL, 58 | WAIT_SPEC_KEY, 59 | WAIT_FUNC_KEY, 60 | }; 61 | struct finsh_shell 62 | { 63 | struct rt_semaphore rx_sem; 64 | 65 | enum input_stat stat; 66 | 67 | rt_uint8_t echo_mode:1; 68 | rt_uint8_t prompt_mode: 1; 69 | 70 | #ifdef FINSH_USING_HISTORY 71 | rt_uint16_t current_history; 72 | rt_uint16_t history_count; 73 | 74 | char cmd_history[FINSH_HISTORY_LINES][FINSH_CMD_SIZE]; 75 | #endif 76 | 77 | #ifndef FINSH_USING_MSH_ONLY 78 | struct finsh_parser parser; 79 | #endif 80 | 81 | char line[FINSH_CMD_SIZE]; 82 | rt_uint16_t line_position; 83 | rt_uint16_t line_curpos; 84 | 85 | #if !defined(RT_USING_POSIX) && defined(RT_USING_DEVICE) 86 | rt_device_t device; 87 | #endif 88 | 89 | #ifdef FINSH_USING_AUTH 90 | char password[FINSH_PASSWORD_MAX]; 91 | #endif 92 | }; 93 | 94 | void finsh_set_echo(rt_uint32_t echo); 95 | rt_uint32_t finsh_get_echo(void); 96 | 97 | int finsh_system_init(void); 98 | void finsh_set_device(const char* device_name); 99 | const char* finsh_get_device(void); 100 | 101 | rt_uint32_t finsh_get_prompt_mode(void); 102 | void finsh_set_prompt_mode(rt_uint32_t prompt_mode); 103 | 104 | #ifdef FINSH_USING_AUTH 105 | rt_err_t finsh_set_password(const char *password); 106 | const char *finsh_get_password(void); 107 | #endif 108 | 109 | #endif 110 | 111 | -------------------------------------------------------------------------------- /Code/RT-Thread/include/libc/libc_dirent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2018, RT-Thread Development Team 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #ifndef LIBC_DIRENT_H__ 8 | #define LIBC_DIRENT_H__ 9 | 10 | #define DT_UNKNOWN 0x00 11 | #define DT_REG 0x01 12 | #define DT_DIR 0x02 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /Code/RT-Thread/include/libc/libc_fcntl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2018, RT-Thread Development Team 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | /* 8 | * File : libc_fcntl.h 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2018-02-07 Bernard Add O_DIRECTORY definition in NEWLIB mode. 13 | * 2018-02-09 Bernard Add O_BINARY definition 14 | */ 15 | 16 | #ifndef LIBC_FCNTL_H__ 17 | #define LIBC_FCNTL_H__ 18 | 19 | #if defined(RT_USING_NEWLIB) || defined(_WIN32) 20 | #include 21 | 22 | #ifndef O_NONBLOCK 23 | #define O_NONBLOCK 0x4000 24 | #endif 25 | 26 | #if defined(_WIN32) 27 | #define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR) 28 | #endif 29 | 30 | #ifndef F_GETFL 31 | #define F_GETFL 3 32 | #endif 33 | #ifndef F_SETFL 34 | #define F_SETFL 4 35 | #endif 36 | 37 | #ifndef O_DIRECTORY 38 | #define O_DIRECTORY 0x200000 39 | #endif 40 | 41 | #ifndef O_BINARY 42 | #ifdef _O_BINARY 43 | #define O_BINARY _O_BINARY 44 | #else 45 | #define O_BINARY 0 46 | #endif 47 | #endif 48 | 49 | #else 50 | #define O_RDONLY 00 51 | #define O_WRONLY 01 52 | #define O_RDWR 02 53 | 54 | #define O_CREAT 0100 55 | #define O_EXCL 0200 56 | #define O_NOCTTY 0400 57 | #define O_TRUNC 01000 58 | #define O_APPEND 02000 59 | #define O_NONBLOCK 04000 60 | #define O_DSYNC 010000 61 | #define O_SYNC 04010000 62 | #define O_RSYNC 04010000 63 | #define O_BINARY 0100000 64 | #define O_DIRECTORY 0200000 65 | #define O_NOFOLLOW 0400000 66 | #define O_CLOEXEC 02000000 67 | 68 | #define O_ASYNC 020000 69 | #define O_DIRECT 040000 70 | #define O_LARGEFILE 0100000 71 | #define O_NOATIME 01000000 72 | #define O_PATH 010000000 73 | #define O_TMPFILE 020200000 74 | #define O_NDELAY O_NONBLOCK 75 | 76 | #define O_SEARCH O_PATH 77 | #define O_EXEC O_PATH 78 | 79 | #define O_ACCMODE (03|O_SEARCH) 80 | 81 | #define F_DUPFD 0 82 | #define F_GETFD 1 83 | #define F_SETFD 2 84 | #define F_GETFL 3 85 | #define F_SETFL 4 86 | 87 | #define F_SETOWN 8 88 | #define F_GETOWN 9 89 | #define F_SETSIG 10 90 | #define F_GETSIG 11 91 | 92 | #define F_GETLK 12 93 | #define F_SETLK 13 94 | #define F_SETLKW 14 95 | 96 | #define F_SETOWN_EX 15 97 | #define F_GETOWN_EX 16 98 | 99 | #define F_GETOWNER_UIDS 17 100 | #endif 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /Code/RT-Thread/include/libc/libc_fdset.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2018, RT-Thread Development Team 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | /* 8 | * File : libc_errno.h 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2017-10-30 Bernard The first version 13 | */ 14 | 15 | #ifndef LIBC_FDSET_H__ 16 | #define LIBC_FDSET_H__ 17 | 18 | #include 19 | 20 | #if defined(RT_USING_NEWLIB) || defined(_WIN32) 21 | #include 22 | #if defined(HAVE_SYS_SELECT_H) 23 | #include 24 | #endif 25 | 26 | #else 27 | 28 | #ifdef SAL_USING_POSIX 29 | 30 | #ifdef FD_SETSIZE 31 | #undef FD_SETSIZE 32 | #endif 33 | 34 | #define FD_SETSIZE DFS_FD_MAX 35 | #endif 36 | 37 | # ifndef FD_SETSIZE 38 | # define FD_SETSIZE 32 39 | # endif 40 | 41 | # define NBBY 8 /* number of bits in a byte */ 42 | 43 | typedef long fd_mask; 44 | # define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ 45 | # ifndef howmany 46 | # define howmany(x,y) (((x)+((y)-1))/(y)) 47 | # endif 48 | 49 | /* We use a macro for fd_set so that including Sockets.h afterwards 50 | can work. */ 51 | typedef struct _types_fd_set { 52 | fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; 53 | } _types_fd_set; 54 | 55 | #define fd_set _types_fd_set 56 | 57 | # define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) 58 | # define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) 59 | # define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) 60 | # define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) 61 | 62 | #endif 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Code/RT-Thread/include/rtlibc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2018, RT-Thread Development Team 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Change Logs: 7 | * Date Author Notes 8 | * 2017-01-21 Bernard the first version 9 | */ 10 | 11 | #ifndef RTLIBC_H__ 12 | #define RTLIBC_H__ 13 | 14 | /* definitions for libc if toolchain has no these definitions */ 15 | #include "libc/libc_stat.h" 16 | #include "libc/libc_errno.h" 17 | 18 | #include "libc/libc_fcntl.h" 19 | #include "libc/libc_ioctl.h" 20 | #include "libc/libc_dirent.h" 21 | #include "libc/libc_signal.h" 22 | #include "libc/libc_fdset.h" 23 | 24 | #if defined(__CC_ARM) || defined(__CLANG_ARM) || defined(__IAR_SYSTEMS_ICC__) 25 | typedef signed long off_t; 26 | typedef int mode_t; 27 | #endif 28 | 29 | #if defined(__MINGW32__) || defined(_WIN32) 30 | typedef signed long off_t; 31 | typedef int mode_t; 32 | #endif 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /Code/RT-Thread/include/rtm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2018, RT-Thread Development Team 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #ifndef __RTM_H__ 8 | #define __RTM_H__ 9 | 10 | #include 11 | #include 12 | 13 | #ifdef RT_USING_MODULE 14 | struct rt_module_symtab 15 | { 16 | void *addr; 17 | const char *name; 18 | }; 19 | 20 | #if defined(_MSC_VER) 21 | #pragma section("RTMSymTab$f",read) 22 | #define RTM_EXPORT(symbol) \ 23 | __declspec(allocate("RTMSymTab$f"))const char __rtmsym_##symbol##_name[] = "__vs_rtm_"#symbol; 24 | #pragma comment(linker, "/merge:RTMSymTab=mytext") 25 | 26 | #elif defined(__MINGW32__) 27 | #define RTM_EXPORT(symbol) 28 | 29 | #else 30 | #define RTM_EXPORT(symbol) \ 31 | const char __rtmsym_##symbol##_name[] SECTION(".rodata.name") = #symbol; \ 32 | const struct rt_module_symtab __rtmsym_##symbol SECTION("RTMSymTab")= \ 33 | { \ 34 | (void *)&symbol, \ 35 | __rtmsym_##symbol##_name \ 36 | }; 37 | #endif 38 | 39 | #else 40 | #define RTM_EXPORT(symbol) 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /Code/RT-Thread/src/cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2021, RT-Thread Development Team 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Change Logs: 7 | * Date Author Notes 8 | * 2018-10-30 Bernard The first version 9 | */ 10 | 11 | #include 12 | #include 13 | 14 | /* nothing on non-smp version */ 15 | -------------------------------------------------------------------------------- /Document/ASM_V1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Document/ASM_V1.1.pdf -------------------------------------------------------------------------------- /Document/BOM_V1.1.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Document/BOM_V1.1.xlsx -------------------------------------------------------------------------------- /Document/Calibration_Fixture.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Document/Calibration_Fixture.stl -------------------------------------------------------------------------------- /Document/GerberV1.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Document/GerberV1.1.zip -------------------------------------------------------------------------------- /Document/Render.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Document/Render.png -------------------------------------------------------------------------------- /Document/SCH_V1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Document/SCH_V1.1.pdf -------------------------------------------------------------------------------- /Upper/GY-H1_Assistance_V1.1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q1anWan/GY-H1/b3425c6cc95656581013ff677b1fe94c56836f5a/Upper/GY-H1_Assistance_V1.1.exe -------------------------------------------------------------------------------- /Upper/SourceCode/DataProcess.py: -------------------------------------------------------------------------------- 1 | import time 2 | import numpy as np 3 | from math import * 4 | from scipy import signal 5 | ''' 6 | # 3标准差法清除可疑数据 7 | data : 传入列表 8 | metheod : rm去除异常值 place替换为线性插值 9 | ''' 10 | def Dataculling(data,metheod = 'rm'): 11 | while True: 12 | #计算样本标准差 13 | stdV = np.std(data,ddof=1) 14 | meanV = np.mean(data) 15 | maxV = max(data) 16 | minV = min(data) 17 | isOk = 0 18 | 19 | #去除可疑数据 20 | if maxV > meanV + 3*stdV : 21 | if metheod == 'rm' : 22 | data.remove(maxV) 23 | elif metheod == 'replace': 24 | dataIndex = data.index(maxV) 25 | if dataIndex == len(data): 26 | data[dataIndex] = data[dataIndex-1] 27 | elif dataIndex == 0: 28 | data[dataIndex] = data[dataIndex+1] 29 | else: 30 | data[dataIndex] = (data[dataIndex-1] + data[dataIndex+1])/2 31 | 32 | else: 33 | isOk += 1 34 | 35 | if minV < meanV - 3*stdV : 36 | if metheod == 'rm' : 37 | data.remove(minV) 38 | elif metheod == 'replace': 39 | dataIndex = data.index(minV) 40 | if dataIndex == len(data): 41 | data[dataIndex] = data[dataIndex-1] 42 | elif dataIndex == 0: 43 | data[dataIndex] = data[dataIndex+1] 44 | else: 45 | data[dataIndex] = (data[dataIndex-1] + data[dataIndex+1])/2 46 | else: 47 | isOk += 1 48 | 49 | if isOk == 2: 50 | return data 51 | 52 | ''' 53 | # 3标准差法清除可疑数据 带时间序列版 54 | data : 传入列表 55 | metheod : rm去除异常值 place替换为均值 56 | ''' 57 | def DatacullingTicker(data,tick): 58 | while True: 59 | #计算样本标准差 60 | stdV = np.std(data,ddof=1) 61 | meanV = np.mean(data) 62 | maxV = max(data) 63 | minV = min(data) 64 | isOk = 0 65 | 66 | #去除可疑数据 67 | if maxV > meanV + 3*stdV : 68 | tick.remove(data.index(maxV)) 69 | data.remove(maxV) 70 | else: 71 | isOk += 1 72 | 73 | if minV < meanV - 3*stdV : 74 | tick.remove(data.index(minV)) 75 | data.remove(minV) 76 | 77 | else: 78 | isOk += 1 79 | 80 | if isOk == 2: 81 | return data 82 | 83 | 84 | -------------------------------------------------------------------------------- /Upper/SourceCode/Upper.spec: -------------------------------------------------------------------------------- 1 | # -*- mode: python ; coding: utf-8 -*- 2 | 3 | 4 | block_cipher = None 5 | 6 | 7 | a = Analysis( 8 | ['Upper.py'], 9 | pathex=[], 10 | binaries=[], 11 | datas=[], 12 | hiddenimports=[], 13 | hookspath=[], 14 | hooksconfig={}, 15 | runtime_hooks=[], 16 | excludes=[], 17 | win_no_prefer_redirects=False, 18 | win_private_assemblies=False, 19 | cipher=block_cipher, 20 | noarchive=False, 21 | ) 22 | pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) 23 | 24 | exe = EXE( 25 | pyz, 26 | a.scripts, 27 | a.binaries, 28 | a.zipfiles, 29 | a.datas, 30 | [], 31 | name='Upper', 32 | debug=False, 33 | bootloader_ignore_signals=False, 34 | strip=False, 35 | upx=True, 36 | upx_exclude=[], 37 | runtime_tmpdir=None, 38 | console=True, 39 | disable_windowed_traceback=False, 40 | argv_emulation=False, 41 | target_arch=None, 42 | codesign_identity=None, 43 | entitlements_file=None, 44 | ) 45 | -------------------------------------------------------------------------------- /Upper/Test/test.py: -------------------------------------------------------------------------------- 1 | # # import time 2 | 3 | # # import matplotlib.pyplot as plt 4 | # import numpy as np 5 | # # import math 6 | 7 | # import DataProcess as DP 8 | # # from scipy import signal 9 | # import time 10 | # x = [1,2,1,1,0,1,2,10,3,1,2,3,1] 11 | # print(x) 12 | # x = DP.Dataculling(data=x,metheod='replace') 13 | # print(x) 14 | # x = x[int(len(x)*0.05):-1] 15 | # print(x) 16 | # x[0:3] = 0 17 | # print(x) 18 | # y = np.average(x) 19 | # print(y) 20 | # print(round(y)) 21 | 22 | # # x = np.arange(0,2*np.pi,0.01) 23 | # # y = np.sin(x) 24 | 25 | # # def Gnoisegen(x, snr): 26 | # # Nx = len(x) # 求出信号的长度 27 | # # noise = np.random.randn(Nx)# 用randn产生正态分布随机数 28 | # # signal_power = np.sum(x*x)/Nx# 求信号的平均能量 29 | # # noise_power = np.sum(noise*noise)/Nx# 求信号的平均能量 30 | # # noise_variance = signal_power/(math.pow(10., (snr/10)))#计算噪声设定的方差值 31 | # # noise = math.sqrt(noise_variance/noise_power)*noise# 按照噪声能量构成相应的白噪声 32 | 33 | # # return x+noise 34 | 35 | 36 | # # y_noise = Gnoisegen(x=y,snr=2) 37 | 38 | # # for i in range(20): 39 | # # n = np.random.randint(0,2*np.pi*100) 40 | # # y_noise[n] *= np.random.randint(-100,100) 41 | 42 | # # plt.figure(1) 43 | # # plt.plot(x,y) 44 | # # plt.plot(x,y_noise) 45 | 46 | # # plt.figure(2) 47 | # # y2 = DP.Dataculling(y_noise.tolist(),'place') 48 | # # plt.plot(x,y) 49 | # # plt.plot(x,y2) 50 | 51 | # # plt.figure(3) 52 | # # b,a = signal.butter(1,0.01,'lowpass') 53 | # # y3 = signal.filtfilt(b,a,y2) 54 | # # plt.plot(x,y) 55 | # # plt.plot(x,y3) 56 | 57 | # # plt.show() 58 | 59 | 60 | # # a = 1123 61 | # # b = a.to_bytes(2,byteorder='big',signed=True) 62 | # # c = a.to_bytes(2,byteorder='little',signed=True) 63 | # # b = bytes.hex(b) 64 | # # c = bytes.hex(c) 65 | # # print(b[0:2],' ',b[2:4]) 66 | 67 | # import pandas as pd 68 | 69 | # # a = open('Demo.csv','a+') 70 | # b = list() 71 | # c = list() 72 | # d = list() 73 | # e = list() 74 | # for i in range(100): 75 | # b.append(i) 76 | # c.append(i) 77 | # d.append(i) 78 | # e.append(i) 79 | 80 | 81 | # datas = {'ticker':e,'X':b,'Y':c,'Z':d} 82 | 83 | # test = pd.DataFrame(datas) 84 | # test = test.set_index('ticker') 85 | # t = time.localtime() 86 | # name = 'Demo'+'_'+str(t.tm_hour)+'h'+str(t.tm_min)+'min'+str(t.tm_min)+'sec.csv' 87 | # test.to_csv(name) 88 | # print(float()) 89 | 90 | # a = list() 91 | # a.append(1) 92 | # print(a) 93 | # a=list() 94 | # print(a) 95 | # b = [0,0,0,0,0,0] 96 | 97 | # print(b) 98 | times = 0 99 | Accel_Rate = 0 100 | while times < 20: 101 | times += 0.005 102 | Accel_Rate += 0.00416 103 | print(Accel_Rate) --------------------------------------------------------------------------------