diff --git a/vendor/build_sample.py b/vendor/build_sample.py new file mode 100644 index 0000000000000000000000000000000000000000..6ae22b45b7155a81f53ae7d7d987d352ccf8df89 --- /dev/null +++ b/vendor/build_sample.py @@ -0,0 +1,504 @@ +import os +import sys +import pathlib +from configparser import ConfigParser +import stat +import time +import shutil +import shlex +import subprocess +import platform +import hashlib +import json + +script_a_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/build')) +sys.path.append(script_a_path) + +from build_gn import read_json_file +from ide_entry import un_alltools +from build import remove_readonly + +#ws63编译配置 +BUILD_INFO_FILENAME = 'build_config.json' +# 定义要执行的脚本文件和目录 +build_directory_path = 'src' +ws63_log_image_target_directory = 'archives' +global_combined = '' +TIMEOUT = 5 * 60 + +# 获取本次git提交目录名称 +def get_changed_folders_in_vendor(): + folder_name= '' + src_folder_name= '' + print(f"start get_changed_folders_in_directory") + try: + # 执行git命令获取本次提交的变更文件列表,除去根目录src目录,其他目录提交都显示 + git_command = "git diff --name-only origin/HEAD..HEAD" + output = subprocess.check_output(git_command, shell=True, text=True) + # 将输出按行分割成文件路径列表 + changed_files = output.strip().split("\n") + # 初始化变量,用于记录是否有改变的文件类型 + has_c_or_h_files = False + # 遍历每个文件路径 + for file_path in changed_files: + if file_path.endswith(".c") or file_path.endswith(".h"): + has_c_or_h_files = True + break + changed_folders = set() + for file_path in changed_files: + # 提取文件夹名称 + if '/' in file_path: + src_folder_name = file_path.split('/')[0] + if '"src' in src_folder_name or 'src' in src_folder_name: + print(f"invalid modify, not allow modify src dir and build script") + sys.exit(0) + if has_c_or_h_files: + for file_path in changed_files: + if file_path.endswith(".c") or file_path.endswith(".h"): + folder_name = file_path.split('/')[1] + '+' + file_path.split('/')[2] + '+' + file_path.split('/')[3] + else: + '' + if folder_name: + changed_folders.add(folder_name) + print(f"[get_changed_folders_in_vendor] changed_folders: {changed_folders}") + return changed_folders + else: + print(f"not need build, only doc or readme been modified") + sys.exit(0) + except subprocess.CalledProcessError as e: + print(f"Error executing Git command: {e}") + return None + + +# 获取代码仓所有build_info.json文件内容,并拼接在一起 +def process_build_info_files(): + print(f"start process_build_info_files") + result_list = [] + # 遍历指定目录及其子目录下的所有文件和文件夹 + for root, dirs, files in os.walk("./"): + for file in files: + if file == BUILD_INFO_FILENAME: + file_path = os.path.join(root, file) + print(file_path) + # 读取JSON文件内容 + with open(file_path, 'r') as f: + try: + data = json.load(f) + for item in data: + # 提取需要的字段值 + build_target = item.get('buildTarget', '') + relative_path = item.get('relativePath', '').replace('/','-') + chip_name = item.get('chip', '') + # 组合成一个字符串并添加到结果列表 + if item.get('buildDef', ''): + build_def = item.get('buildDef', '') + combined_value = f"{file_path}+{build_target}+{relative_path}+{chip_name}+{build_def}" + else: + combined_value = f"{file_path}+{build_target}+{relative_path}+{chip_name}" + result_list.append(combined_value) + except json.JSONDecodeError: + print(f"Error decoding JSON in file: {file_path}") + sys.exit(-1) + return result_list + +# 对比git和json内容,一致则代表提交,不一样代表之前提交 +def extract_exact_match(input_list, match_list): + print(f"start extract_exact_match") + print(f"[extract_exact_match] input_list: {input_list}") + print(f"[extract_exact_match] match_list: {match_list}") + exact_matches = [] + try: + for string in input_list: + # 使用 split 方法获取第二个 + 和第三个 + 之间的内容 + parts = string.split('+') + if len(parts) >= 4: + sample_company_name = parts[0].split('/')[2] + sample_name_field = parts[2].replace('-','+') + combined_string = sample_company_name + "+" + sample_name_field + if combined_string in match_list: + exact_matches.append(string) + print(f"[extract_exact_match] exact_matches: {exact_matches}") + if not exact_matches: + print(f"build-config has not been synchronously updated") + exit(0) # 退出并返回非零状 + else: + print("exact_matche 列表不为空") + return exact_matches + except TypeError as e: + print(f"Error: {e}") + # 在捕获到异常后,可以选择退出程序 + exit(0) # 退出并返回非零状 + +# 如果代码编译cmakelist文件中通过宏控制编译哪些文件,则需要用宏重新组合编译配置信息 +def sample_meunconfig_modify(input_list): + print(f"start sample_meunconfig_modify{input_list}") + # 初始化结果列表 + result_list = [] + combined_string = "" + for string in input_list: + parts = string.split('+') + sample_file_path = parts[0] + build_target = parts[1] + sample_name = parts[2] + platform = parts[3] + if len(parts) == 5: + def_name = parts[4] + # 根据逗号分割字符串 + def_parts = def_name.split(',') + # 遍历分割后的每一个部分,添加到结果列表中,宏的个数,决定编译的次数 + if len(def_parts) == 1 and def_parts[0] == def_name: + result_list.append(sample_file_path+"+"+build_target+"+"+sample_name+"+"+platform+"+"+def_name) + else: + for idx, part in enumerate(def_parts): + if idx == 0: + combined_string = part + else: + combined_string += "+" + part # 在每个部分之前添加加号 + result_list.append(sample_file_path+"+"+build_target+"+"+sample_name+"+"+platform+"+"+combined_string) + # 如果没有逗号,则整个字符串保存到结果列表 + elif len(parts) == 4: + result_list.append(sample_file_path+"+"+build_target+"+"+sample_name+"+"+platform) + return result_list + + +def dest_path_cpoy(copy_path, dirprocesspath, dirpath, filenames): + dest_path = pathlib.Path(copy_path).joinpath(dirprocesspath) + if not dest_path.exists(): + os.makedirs(dest_path) + for file in filenames: + if 'entry.py' in file or 'trustlist.json' in file: + continue + source_file = pathlib.Path(dirpath).joinpath(file) + shutil.copy(source_file, dest_path) + +def filter_copy_adpater(copy_path, dirpath, filenames): + ''' + Function description: project creat. + ''' + ipbefore_list = [] + ipafter_list = [] + cur_sys = platform.system() + if cur_sys == 'Windows': + ipbefore_list = dirpath.split('\\') + elif cur_sys == 'Linux': + ipbefore_list = dirpath.split('/') + ipafter_list = [] + p_vindex = 0 + p_cindex = -1 + for v_index, ipdir in enumerate(ipbefore_list): + if ipdir.startswith('v') and '.' in ipdir: + continue + # Filtering files + if '_v' in ipdir: + p_vindex = v_index + if 'common_v' in ipdir: + p_cindex = v_index + ipafter_list.append(ipdir) + if ipafter_list[p_vindex - 1] + '_v' in ipafter_list[p_vindex]: + ipafter_list.pop(p_vindex) + if p_cindex >= 0: + ipafter_list[p_cindex] = 'common' + p_cindex = -1 + dirprocesspath = '/'.join(ipafter_list) + dest_path_cpoy(copy_path, dirprocesspath, dirpath, filenames) + +def traversal_path(copy_path, module_path, version): + ''' + Function description:creat and copy work + ''' + for (dirpath, _, filenames) in os.walk(module_path): + filter_copy_adpater(copy_path, dirpath, filenames) + +def copy_drive_modules(copy_abspath, product, ip_name, copyjson_content): + ''' + function description: copying drive modules + ''' + source_path = os.path.join('drivers', ip_name) + for ip_content in copyjson_content[ip_name]: + source_path = os.path.join(source_path, ip_content) + if pathlib.Path(source_path).is_dir(): + traversal_path(copy_abspath, source_path, product) + elif pathlib.Path(source_path).is_file(): + parent_path = pathlib.Path(source_path).parent_path + copy_parent_path = pathlib.Path(copy_abspath).joinpath(parent_path) + if not copy_parent_path.exists(): + os.makedirs(copy_parent_path) + shutil.copy(source_path, copy_parent_path) + source_path = '' + source_path = os.path.join('drivers', ip_name) + +def copy_code(product, copy_path): + ''' + Funcuntion + ''' + if not isinstance(copy_path, str): + raise TypeError("copy_path in para type error {}".format(type(copy_path))) + if not isinstance(product, str): + raise TypeError("product in para type error {}".format(type(product))) + # copy file path + if pathlib.Path(copy_path).exists(): + shutil.rmtree(os.path.realpath(copy_path), onerror=remove_readonly) + copy_abspath = pathlib.Path(copy_path).resolve() + copyjson_path = pathlib.Path.cwd().joinpath('chip', "{}".format(product), 'codecopy.json') + print(f"[sample_build_prepare] source_directory: {copyjson_path}") + copyjson_content = read_json_file(copyjson_path) + #Add the basic modules + for module_path in copyjson_content['modules']: + if pathlib.Path(module_path).is_dir(): + traversal_path(copy_abspath, module_path, product) + elif pathlib.Path(module_path).is_file(): + #File copy processing basic module + parent_path = pathlib.Path(module_path).parent + copy_parent_path = pathlib.Path(copy_abspath).joinpath(parent_path) + if not copy_parent_path.exists(): + os.makedirs(copy_parent_path) + shutil.copy(module_path, copy_parent_path) + if str(parent_path) == 'chip\\target' or str(parent_path) == 'chip/target': + userconfig_json_name = module_path.split('/')[-1] + os.rename(pathlib.Path(copy_parent_path).joinpath(userconfig_json_name)),pathlib.Path(copy_parent_path).joinpath('userconfig.json') + #Copying drive modules + for ip_name in copyjson_content['ip_drive_file']: + copy_drive_modules(copy_abspath, product, ip_name, copyjson_content) + +def differ_file_copy(copy_chip, copy_path, tools_path): + ''' + Function description: Projection generation for different chip + ''' + un_alltools(tools_path) + # Detach the chip package + copy_code(copy_chip, copy_path) + os.chdir(pathlib.Path(copy_path).resolve()) + target_pathconfigsource = pathlib.Path().cwd().joinpath('chip', copy_chip, 'target') + target_pathconfigdest = pathlib.Path().cwd().joinpath('chip', 'target') + # Target file replace + if pathlib.Path(target_pathconfigsource).exists(): + shutil.rmtree(target_pathconfigdest) + shutil.copytree(target_pathconfigsource, target_pathconfigdest) + # write the path of the full package tool to the config.ini file. + config_path = pathlib.Path().cwd().joinpath('build', 'config.ini') + config = ConfigParser() + config.read(config_path) + config.set('gn_args', 'tools_path', tools_path) + flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC + modes = stat.S_IWUSR | stat.S_IRUSR + flagsone = os.O_RDWR | os.O_CREAT + # File socket of the config.ini file. + with os.fdopen(os.open(config_path, flags, modes), 'w+') as configini: + config.write(configini) + # Executing Build and Compile Commands + cmd = shlex.split('python build/build.py build') + proc = subprocess.Popen(cmd) + proc.wait() + ret_code = proc.returncode + if ret_code != 0: + raise Exception("CI {} failed, return code is {}".format(cmd, ret_code)) + + +def move_file(source_file, new_filename): + print(f"start move_file") + target_file = os.path.join(f'../../archives', new_filename) + os.chmod(source_file, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) + try: + # 移动并重命名文件 + shutil.move(source_file, target_file) + os.chmod(target_file, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) + print(f"文件 {source_file} 移动并重命名为 {target_file} 成功。") + except FileNotFoundError: + print(f"找不到文件 {source_file}") + except PermissionError: + print(f"权限错误,无法移动文件。") + except Exception as e: + print(f"发生错误:{str(e)}") + +def delete_file(directory, filename): + # 拼接文件路径 + file_path = os.path.join(directory, filename) + + # 检查文件是否存在 + if os.path.isfile(file_path): + try: + # 删除文件 + os.remove(file_path) + print(f"文件 {filename} 已被成功删除。") + except Exception as e: + print(f"删除文件时出错: {e}") + else: + print(f"文件 {filename} 不存在于目录 {directory} 中。") + +def remove_lines(file_path, start_line, end_line): + try: + with open(file_path, 'r') as file: + lines = file.readlines() + + # 删除指定范围的行 + if start_line > 0 and end_line <= len(lines): + del lines[start_line-1:end_line] + else: + print("行号超出范围") + return + + with open(file_path, 'w') as file: + file.writelines(lines) + + print(f"已删除文件 {file_path} 中第 {start_line} 行到第 {end_line} 行的内容。") + except Exception as e: + print(f"处理文件时出错: {e}") + +def has_main_h(directory, file): + for root, dirs, files in os.walk(directory): + if file in files: + return True + return False + +def differ_file_copy(copy_chip, copy_path, tools_path, source_directory, targetname): + ''' + Function description: Projection generation for different chip + ''' + un_alltools(tools_path) + # Detach the chip package + + copy_code(copy_chip, copy_path) + os.chdir(pathlib.Path(copy_path).resolve()) + target_pathconfigsource = pathlib.Path().cwd().joinpath('chip', copy_chip, 'target') + target_pathconfigdest = pathlib.Path().cwd().joinpath('chip', 'target') + # Target file replace + if pathlib.Path(target_pathconfigsource).exists(): + shutil.rmtree(target_pathconfigdest) + shutil.copytree(target_pathconfigsource, target_pathconfigdest) + # write the path of the full package tool to the config.ini file. + config_path = pathlib.Path().cwd().joinpath('build', 'config.ini') + config = ConfigParser() + config.read(config_path) + config.set('gn_args', 'tools_path', tools_path) + flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC + modes = stat.S_IWUSR | stat.S_IRUSR + flagsone = os.O_RDWR | os.O_CREAT + # File socket of the config.ini file. + with os.fdopen(os.open(config_path, flags, modes), 'w+') as configini: + config.write(configini) + # Executing Build and Compile Commands + + print(f"start compile_sdk_and_save_log") + current_dir = os.getcwd() + print(f"Current working directory: {current_dir}") + delete_file("middleware/thirdparty/sysroot/lib", 'libnostask.a') + if copy_chip == '3061m' or copy_chip == '3065h': + remove_lines("middleware/hisilicon/nostask/kernel/nos_amp_task.c", 48, 63) + if has_main_h(source_directory, "main.h"): + delete_file("generatecode", "main.h") + if has_main_h(source_directory, "system_init.c"): + delete_file("generatecode", "system_init.c") + if has_main_h(source_directory, "feature.h"): + delete_file("generatecode", "feature.h") + if has_main_h(source_directory, "main.c"): + delete_file("application/user", "main.c") + shutil.copytree(source_directory, "generatecode", dirs_exist_ok=True) + # 创建目录archives + if not os.path.exists("../../archives"): + os.mkdir("../../archives") + args = ['build/build.py', "build"] + try: + # 打开日志文件准备写入 + # 使用 subprocess.Popen() 执行命令,并将标准输出和标准错误重定向到日志文件 + start_time = time.time() + proc = subprocess.Popen(['python'] + args, text=False) + #print(f"child.communicate()[0]: {proc.communicate()[0]}") + end_time = time.time() + # 计算运行时间 + elapsed_time = end_time - start_time + proc.wait(TIMEOUT) + with open('out/build.log', 'a') as file: + file.write(f"{targetname} takes {elapsed_time:.4f} s\n") + if proc.returncode == 0: + file.write(f"######### Build target:{targetname} success\n") + file.write("Finished: SUCCESS\n") + else: + file.write(f"######### Build target:{targetname} failed\n") + file.write("Finished: FAILURE\n") + move_file("out/build.log", f'build-{global_combined}.log') + time.sleep(1) + move_file("out/bin/target.bin", f'{global_combined}.bin') + parent_dir = os.path.abspath(os.path.join(current_dir, os.pardir)) + os.chdir(parent_dir) + shutil.rmtree(copy_path) + except Exception as e: + print(f"An error occurred: {str(e)}") + + +def bash_shell(filename_path): + # 定义要添加到 ~/.bashrc 的内容 + new_content = f""" + # Added by Python script + export TMPDIR={filename_path} + """ + # 获取用户的主目录 + home_dir = os.path.expanduser("~") + bashrc_path = os.path.join(home_dir, ".bashrc") + + # 向 ~/.bashrc 文件追加内容 + with open(bashrc_path, 'a') as file: + file.write(new_content) + # 提示用户 + print(f"Added new content to {bashrc_path}. Please run 'source ~/.bashrc' to apply changes.") + subprocess.run(['bash', '-c', 'source ~/.bashrc'], check=True) + +def ci_entry(input_list): + ''' + Function description: ci entry function + ''' + os.chdir(build_directory_path) + tools_path = str(pathlib.Path().cwd().joinpath('tools', 'toolchain')) + print(f"start sample_build_prepare") + print(f"[sample_build_prepare] input_list: {input_list}") + tmp_dir = os.getcwd() + if not os.path.exists("tmp"): + os.mkdir("tmp") + os.chmod("tmp", 0o777) + print(f'export TMPDIR={tmp_dir}/tmp') + bash_shell(f"{tmp_dir}/tmp") + global global_combined + for string in input_list: + parts = string.split('+') + sample_file_path = parts[0] + build_target = parts[1] + sample_name = parts[2] + platfor_name = parts[3] + remaining_parts = parts[1:4] + global_combined = '_'.join(remaining_parts) + if len(parts) >= 5: + global_combined += '_' + build_def_sha = hashlib.sha256('-'.join(parts[4:]).encode('utf-8',errors='ignore')) + global_combined += build_def_sha.hexdigest()[:32] + # 获取sample目录路径,并复制到指定目录 + # 截取目标内容 + target_string = sample_file_path.split('/build_config.json')[0] + '/' + samples = sample_name.replace('-','/') + source_directory = "../." + target_string + samples + print(f"[sample_build_prepare] source_directory: {source_directory}") + copy_path = 'mcu_' + platfor_name + '_project' + working_path = pathlib.Path.cwd() + if platfor_name == '3061M' or platfor_name == '3061m': + copy_chip = "3061m" + elif platfor_name == '3065H' or platfor_name == '3065h': + copy_chip = "3065h" + elif platfor_name == '3015' or platfor_name == '3015': + copy_chip = "3015" + elif platfor_name == '3066M' or platfor_name == '3066m': + copy_chip = "3066m" + else: + print(f"Wrong chip name\r\n") + exit(0) + differ_file_copy(copy_chip, copy_path, tools_path, source_directory, build_target) + + +def main(): + print(f"start main") + check_list = get_changed_folders_in_vendor() + input_list = process_build_info_files() + sample_name = extract_exact_match(input_list, check_list) + result_list = sample_meunconfig_modify(sample_name) + ci_entry(result_list) + print(f"all build step execute end") + +if __name__ == '__main__': + sys.exit(main()) \ No newline at end of file diff --git a/vendor/hispark/build_config.json b/vendor/hispark/build_config.json new file mode 100644 index 0000000000000000000000000000000000000000..efacebf74c233fa39e4da414550feed1efb7f363 --- /dev/null +++ b/vendor/hispark/build_config.json @@ -0,0 +1,23 @@ +[ + { + "buildTarget": "SolarA2_1.0.1", + "relativePath": "demo/sample_led", + "chip": "3061M", + "buildDef": "", + "needSmoke": "false" + }, + { + "buildTarget": "SolarA2_1.0.2", + "relativePath": "demo/sample_beep", + "chip": "3065h", + "buildDef": "", + "needSmoke": "false" + }, + { + "buildTarget": "SolarA2_1.0.2", + "relativePath": "demo/sample_thread", + "chip": "3061M", + "buildDef": "", + "needSmoke": "false" + } +] diff --git a/vendor/hispark/demo/sample_beep/feature.h b/vendor/hispark/demo/sample_beep/feature.h new file mode 100644 index 0000000000000000000000000000000000000000..44df0694e4928aaa757a3d4a37d5365483904aa9 --- /dev/null +++ b/vendor/hispark/demo/sample_beep/feature.h @@ -0,0 +1,89 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file feature.h + * @author MCU Driver Team + * @brief This file contains macro configurations related to the project. This file is generated by the IDE tool. + */ + +#ifndef MCU_MAGICTAG_FEATURE_H +#define MCU_MAGICTAG_FEATURE_H + + +/* Macro definitions --------------------------------------------------------- */ + +#define MACRO_ENABLE 1 +#define MACRO_DISABLE 0 + +/* Macro switch */ +#define BASE_DEFINE_USE_ASSERT MACRO_ENABLE +#ifndef FLASH_CRC_CONFIG +#define FLASH_CRC_CONFIG +#endif /* #ifndef FLASH_CRC_CONFIG */ +#define BASE_MATH_SINCOS_MIDDLE_TABLE MACRO_ENABLE /**< This macro is used to control the table type when the + BASE_MATH_GetSinCos() queries the table. When the value of + this macro is MACRO_ENABLE, the error value obtained by the + BASE_MATH_GetSinCos() is relatively small, and the return + value of the function may be greater than or less than the + actual value. When the value of this macro is MACRO_DISABLE, + the error value obtained by the BASE_MATH_GetSinCos() is + relatively large. However, in the range [0, 180) and + [180, 360), the return value of the function is either + greater than or less than the actual value. */ + +/* Peripheral module macro switch--------------------------------------------- */ +#define BOARD_DIM_NUM 1 /**< Number of dimming handle arrays. */ + +#define BOARD_KEY_NUM 10 /**< Number of key handle arrays. */ +#define BOARD_KEY_PRESS_ON GPIO_HIGH_LEVEL /**< GPIO status corresponding to long press valid. */ +#define BOARD_KEY_PRESS_OFF GPIO_LOW_LEVEL /**< GPIO status corresponding to short press valid. */ + +#define BOARD_LED_SEG_NUM 4 /**< Number of segments. */ +#define BOARD_LED_SEGMENT_ON GPIO_HIGH_LEVEL /**< GPIO level status corresponding to valid segments. */ +#define BOARD_LED_SEGMENT_OFF GPIO_LOW_LEVEL /**< GPIO level status corresponding to invalid segments. */ + +#define BOARD_MKEY_SCHEME_NUMBER BOARD_MKEY_SCHEME_NUMBER_ONE /**< Define the scheme to be adopted. */ +#define BOARD_MKEY_OUT_NUM 4 /**< Number of GPIO pins used as output during scanning. */ +#define BOARD_MKEY_IN_NUM 4 /**< Number of GPIO pins used as input during scanning. */ +#define BOARD_MKEY_OUT_PIN_VALID GPIO_LOW_LEVEL /**< GPIO level status corresponding to the valid \ + status of the output GPIO in the key matrix. */ +#define BOARD_MKEY_OUT_PIN_INVALID GPIO_HIGH_LEVEL /**< GPIO level status corresponding to the \ + invalid status of the output GPIO in the key matrix. */ +#define BOARD_MKEY_IN_PIN_VALID GPIO_LOW_LEVEL /**< Indicates the GPIO level corresponding to the \ + valid status of the input GPIO in the key matrix. */ +#define BOARD_MKEY_IN_PIN_INVALID GPIO_HIGH_LEVEL /**< Indicates the GPIO level corresponding to the \ + invalid status of the input GPIO in the key matrix. */ + +#define BOARD_PULSES_NUM 2 /**< Number of pulse handles. */ + +#define BASE_DEFINE_SLIPAVERAGE_NUM 2 /**< Sliding average array length. */ + +#define LISTNODE_MAX 20 + +#define BASE_DEFINE_DMA_QUICKSTART + +#define XTRAIL_FREQ 25000000U + +#define DBG_USE_NO_PRINTF 0U +#define DBG_USE_UART_PRINTF 1U + +#define DBG_PRINTF_USE DBG_USE_NO_PRINTF +#if (DBG_PRINTF_USE == DBG_USE_UART_PRINTF) +#define DBG_PRINTF_UART_PORT UART0 +#endif + +#endif /* McuMagicTag_FEATURE_H */ \ No newline at end of file diff --git a/vendor/hispark/demo/sample_beep/main.c b/vendor/hispark/demo/sample_beep/main.c new file mode 100644 index 0000000000000000000000000000000000000000..0c59b55c44256b470de5e89e17a93c6d093e03f5 --- /dev/null +++ b/vendor/hispark/demo/sample_beep/main.c @@ -0,0 +1,42 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file main.c + * @author MCU Driver Team + * @brief Main program body. + */ + +/* IDE Auto-generated Header files BEGIN. Don't Delete or Modify this comment and the following code */ +#include "typedefs.h" +#include "feature.h" +#include "main.h" +#include "stdio.h" +/* IDE Auto-generated Header files END */ + +/* IDE Auto-generated Driver's Module handles BEGIN. Don't Delete or Modify this comment and the following code */ +/* IDE Auto-generated Driver's Module handles END */ + +int main(void) +{ + /* IDE Auto-generated initialization code BEGIN. Don't Delete or Modify this comment and the following code */ + SystemInit(); + printf("1111111111111\r\n"); + /* IDE Auto-generated initialization code END */ + while (1) { + } + return BASE_STATUS_OK; +} \ No newline at end of file diff --git a/vendor/hispark/demo/sample_beep/main.h b/vendor/hispark/demo/sample_beep/main.h new file mode 100644 index 0000000000000000000000000000000000000000..1b5d796b8e2564f44877010cb2db4434c17b0a82 --- /dev/null +++ b/vendor/hispark/demo/sample_beep/main.h @@ -0,0 +1,29 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file main.h + * @author MCU Driver Team + * @brief This file contains driver init functions. + */ + +/* Define to prevent recursive inclusion ------------------------------------- */ +#ifndef MCU_MAGIC_TAG_SYSTEM_INIT_H +#define MCU_MAGIC_TAG_SYSTEM_INIT_H + +void SystemInit(void); + +#endif /* McuMagicTag_SYSTEM_INIT_H */ \ No newline at end of file diff --git a/vendor/hispark/demo/sample_beep/system_init.c b/vendor/hispark/demo/sample_beep/system_init.c new file mode 100644 index 0000000000000000000000000000000000000000..8e26ade4156006547d8ec6b6ec13016ea13314b1 --- /dev/null +++ b/vendor/hispark/demo/sample_beep/system_init.c @@ -0,0 +1,29 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file system_init.c + * @author MCU Driver Team + * @brief This file contains driver init functions. This file is generated by the IDE tool. + */ + +#include "main.h" + +void SystemInit(void) +{ + /* USER CODE BEGIN system_init */ + /* USER CODE END system_init */ +} \ No newline at end of file diff --git a/vendor/hispark/demo/sample_led/feature.h b/vendor/hispark/demo/sample_led/feature.h new file mode 100644 index 0000000000000000000000000000000000000000..44df0694e4928aaa757a3d4a37d5365483904aa9 --- /dev/null +++ b/vendor/hispark/demo/sample_led/feature.h @@ -0,0 +1,89 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file feature.h + * @author MCU Driver Team + * @brief This file contains macro configurations related to the project. This file is generated by the IDE tool. + */ + +#ifndef MCU_MAGICTAG_FEATURE_H +#define MCU_MAGICTAG_FEATURE_H + + +/* Macro definitions --------------------------------------------------------- */ + +#define MACRO_ENABLE 1 +#define MACRO_DISABLE 0 + +/* Macro switch */ +#define BASE_DEFINE_USE_ASSERT MACRO_ENABLE +#ifndef FLASH_CRC_CONFIG +#define FLASH_CRC_CONFIG +#endif /* #ifndef FLASH_CRC_CONFIG */ +#define BASE_MATH_SINCOS_MIDDLE_TABLE MACRO_ENABLE /**< This macro is used to control the table type when the + BASE_MATH_GetSinCos() queries the table. When the value of + this macro is MACRO_ENABLE, the error value obtained by the + BASE_MATH_GetSinCos() is relatively small, and the return + value of the function may be greater than or less than the + actual value. When the value of this macro is MACRO_DISABLE, + the error value obtained by the BASE_MATH_GetSinCos() is + relatively large. However, in the range [0, 180) and + [180, 360), the return value of the function is either + greater than or less than the actual value. */ + +/* Peripheral module macro switch--------------------------------------------- */ +#define BOARD_DIM_NUM 1 /**< Number of dimming handle arrays. */ + +#define BOARD_KEY_NUM 10 /**< Number of key handle arrays. */ +#define BOARD_KEY_PRESS_ON GPIO_HIGH_LEVEL /**< GPIO status corresponding to long press valid. */ +#define BOARD_KEY_PRESS_OFF GPIO_LOW_LEVEL /**< GPIO status corresponding to short press valid. */ + +#define BOARD_LED_SEG_NUM 4 /**< Number of segments. */ +#define BOARD_LED_SEGMENT_ON GPIO_HIGH_LEVEL /**< GPIO level status corresponding to valid segments. */ +#define BOARD_LED_SEGMENT_OFF GPIO_LOW_LEVEL /**< GPIO level status corresponding to invalid segments. */ + +#define BOARD_MKEY_SCHEME_NUMBER BOARD_MKEY_SCHEME_NUMBER_ONE /**< Define the scheme to be adopted. */ +#define BOARD_MKEY_OUT_NUM 4 /**< Number of GPIO pins used as output during scanning. */ +#define BOARD_MKEY_IN_NUM 4 /**< Number of GPIO pins used as input during scanning. */ +#define BOARD_MKEY_OUT_PIN_VALID GPIO_LOW_LEVEL /**< GPIO level status corresponding to the valid \ + status of the output GPIO in the key matrix. */ +#define BOARD_MKEY_OUT_PIN_INVALID GPIO_HIGH_LEVEL /**< GPIO level status corresponding to the \ + invalid status of the output GPIO in the key matrix. */ +#define BOARD_MKEY_IN_PIN_VALID GPIO_LOW_LEVEL /**< Indicates the GPIO level corresponding to the \ + valid status of the input GPIO in the key matrix. */ +#define BOARD_MKEY_IN_PIN_INVALID GPIO_HIGH_LEVEL /**< Indicates the GPIO level corresponding to the \ + invalid status of the input GPIO in the key matrix. */ + +#define BOARD_PULSES_NUM 2 /**< Number of pulse handles. */ + +#define BASE_DEFINE_SLIPAVERAGE_NUM 2 /**< Sliding average array length. */ + +#define LISTNODE_MAX 20 + +#define BASE_DEFINE_DMA_QUICKSTART + +#define XTRAIL_FREQ 25000000U + +#define DBG_USE_NO_PRINTF 0U +#define DBG_USE_UART_PRINTF 1U + +#define DBG_PRINTF_USE DBG_USE_NO_PRINTF +#if (DBG_PRINTF_USE == DBG_USE_UART_PRINTF) +#define DBG_PRINTF_UART_PORT UART0 +#endif + +#endif /* McuMagicTag_FEATURE_H */ \ No newline at end of file diff --git a/vendor/hispark/demo/sample_led/main.c b/vendor/hispark/demo/sample_led/main.c new file mode 100644 index 0000000000000000000000000000000000000000..0c59b55c44256b470de5e89e17a93c6d093e03f5 --- /dev/null +++ b/vendor/hispark/demo/sample_led/main.c @@ -0,0 +1,42 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file main.c + * @author MCU Driver Team + * @brief Main program body. + */ + +/* IDE Auto-generated Header files BEGIN. Don't Delete or Modify this comment and the following code */ +#include "typedefs.h" +#include "feature.h" +#include "main.h" +#include "stdio.h" +/* IDE Auto-generated Header files END */ + +/* IDE Auto-generated Driver's Module handles BEGIN. Don't Delete or Modify this comment and the following code */ +/* IDE Auto-generated Driver's Module handles END */ + +int main(void) +{ + /* IDE Auto-generated initialization code BEGIN. Don't Delete or Modify this comment and the following code */ + SystemInit(); + printf("1111111111111\r\n"); + /* IDE Auto-generated initialization code END */ + while (1) { + } + return BASE_STATUS_OK; +} \ No newline at end of file diff --git a/vendor/hispark/demo/sample_led/main.h b/vendor/hispark/demo/sample_led/main.h new file mode 100644 index 0000000000000000000000000000000000000000..1b5d796b8e2564f44877010cb2db4434c17b0a82 --- /dev/null +++ b/vendor/hispark/demo/sample_led/main.h @@ -0,0 +1,29 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file main.h + * @author MCU Driver Team + * @brief This file contains driver init functions. + */ + +/* Define to prevent recursive inclusion ------------------------------------- */ +#ifndef MCU_MAGIC_TAG_SYSTEM_INIT_H +#define MCU_MAGIC_TAG_SYSTEM_INIT_H + +void SystemInit(void); + +#endif /* McuMagicTag_SYSTEM_INIT_H */ \ No newline at end of file diff --git a/vendor/hispark/demo/sample_led/system_init.c b/vendor/hispark/demo/sample_led/system_init.c new file mode 100644 index 0000000000000000000000000000000000000000..8e26ade4156006547d8ec6b6ec13016ea13314b1 --- /dev/null +++ b/vendor/hispark/demo/sample_led/system_init.c @@ -0,0 +1,29 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file system_init.c + * @author MCU Driver Team + * @brief This file contains driver init functions. This file is generated by the IDE tool. + */ + +#include "main.h" + +void SystemInit(void) +{ + /* USER CODE BEGIN system_init */ + /* USER CODE END system_init */ +} \ No newline at end of file diff --git a/vendor/hispark/demo/sample_thread/feature.h b/vendor/hispark/demo/sample_thread/feature.h new file mode 100644 index 0000000000000000000000000000000000000000..44df0694e4928aaa757a3d4a37d5365483904aa9 --- /dev/null +++ b/vendor/hispark/demo/sample_thread/feature.h @@ -0,0 +1,89 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file feature.h + * @author MCU Driver Team + * @brief This file contains macro configurations related to the project. This file is generated by the IDE tool. + */ + +#ifndef MCU_MAGICTAG_FEATURE_H +#define MCU_MAGICTAG_FEATURE_H + + +/* Macro definitions --------------------------------------------------------- */ + +#define MACRO_ENABLE 1 +#define MACRO_DISABLE 0 + +/* Macro switch */ +#define BASE_DEFINE_USE_ASSERT MACRO_ENABLE +#ifndef FLASH_CRC_CONFIG +#define FLASH_CRC_CONFIG +#endif /* #ifndef FLASH_CRC_CONFIG */ +#define BASE_MATH_SINCOS_MIDDLE_TABLE MACRO_ENABLE /**< This macro is used to control the table type when the + BASE_MATH_GetSinCos() queries the table. When the value of + this macro is MACRO_ENABLE, the error value obtained by the + BASE_MATH_GetSinCos() is relatively small, and the return + value of the function may be greater than or less than the + actual value. When the value of this macro is MACRO_DISABLE, + the error value obtained by the BASE_MATH_GetSinCos() is + relatively large. However, in the range [0, 180) and + [180, 360), the return value of the function is either + greater than or less than the actual value. */ + +/* Peripheral module macro switch--------------------------------------------- */ +#define BOARD_DIM_NUM 1 /**< Number of dimming handle arrays. */ + +#define BOARD_KEY_NUM 10 /**< Number of key handle arrays. */ +#define BOARD_KEY_PRESS_ON GPIO_HIGH_LEVEL /**< GPIO status corresponding to long press valid. */ +#define BOARD_KEY_PRESS_OFF GPIO_LOW_LEVEL /**< GPIO status corresponding to short press valid. */ + +#define BOARD_LED_SEG_NUM 4 /**< Number of segments. */ +#define BOARD_LED_SEGMENT_ON GPIO_HIGH_LEVEL /**< GPIO level status corresponding to valid segments. */ +#define BOARD_LED_SEGMENT_OFF GPIO_LOW_LEVEL /**< GPIO level status corresponding to invalid segments. */ + +#define BOARD_MKEY_SCHEME_NUMBER BOARD_MKEY_SCHEME_NUMBER_ONE /**< Define the scheme to be adopted. */ +#define BOARD_MKEY_OUT_NUM 4 /**< Number of GPIO pins used as output during scanning. */ +#define BOARD_MKEY_IN_NUM 4 /**< Number of GPIO pins used as input during scanning. */ +#define BOARD_MKEY_OUT_PIN_VALID GPIO_LOW_LEVEL /**< GPIO level status corresponding to the valid \ + status of the output GPIO in the key matrix. */ +#define BOARD_MKEY_OUT_PIN_INVALID GPIO_HIGH_LEVEL /**< GPIO level status corresponding to the \ + invalid status of the output GPIO in the key matrix. */ +#define BOARD_MKEY_IN_PIN_VALID GPIO_LOW_LEVEL /**< Indicates the GPIO level corresponding to the \ + valid status of the input GPIO in the key matrix. */ +#define BOARD_MKEY_IN_PIN_INVALID GPIO_HIGH_LEVEL /**< Indicates the GPIO level corresponding to the \ + invalid status of the input GPIO in the key matrix. */ + +#define BOARD_PULSES_NUM 2 /**< Number of pulse handles. */ + +#define BASE_DEFINE_SLIPAVERAGE_NUM 2 /**< Sliding average array length. */ + +#define LISTNODE_MAX 20 + +#define BASE_DEFINE_DMA_QUICKSTART + +#define XTRAIL_FREQ 25000000U + +#define DBG_USE_NO_PRINTF 0U +#define DBG_USE_UART_PRINTF 1U + +#define DBG_PRINTF_USE DBG_USE_NO_PRINTF +#if (DBG_PRINTF_USE == DBG_USE_UART_PRINTF) +#define DBG_PRINTF_UART_PORT UART0 +#endif + +#endif /* McuMagicTag_FEATURE_H */ \ No newline at end of file diff --git a/vendor/hispark/demo/sample_thread/main.c b/vendor/hispark/demo/sample_thread/main.c new file mode 100644 index 0000000000000000000000000000000000000000..0c59b55c44256b470de5e89e17a93c6d093e03f5 --- /dev/null +++ b/vendor/hispark/demo/sample_thread/main.c @@ -0,0 +1,42 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file main.c + * @author MCU Driver Team + * @brief Main program body. + */ + +/* IDE Auto-generated Header files BEGIN. Don't Delete or Modify this comment and the following code */ +#include "typedefs.h" +#include "feature.h" +#include "main.h" +#include "stdio.h" +/* IDE Auto-generated Header files END */ + +/* IDE Auto-generated Driver's Module handles BEGIN. Don't Delete or Modify this comment and the following code */ +/* IDE Auto-generated Driver's Module handles END */ + +int main(void) +{ + /* IDE Auto-generated initialization code BEGIN. Don't Delete or Modify this comment and the following code */ + SystemInit(); + printf("1111111111111\r\n"); + /* IDE Auto-generated initialization code END */ + while (1) { + } + return BASE_STATUS_OK; +} \ No newline at end of file diff --git a/vendor/hispark/demo/sample_thread/main.h b/vendor/hispark/demo/sample_thread/main.h new file mode 100644 index 0000000000000000000000000000000000000000..1b5d796b8e2564f44877010cb2db4434c17b0a82 --- /dev/null +++ b/vendor/hispark/demo/sample_thread/main.h @@ -0,0 +1,29 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file main.h + * @author MCU Driver Team + * @brief This file contains driver init functions. + */ + +/* Define to prevent recursive inclusion ------------------------------------- */ +#ifndef MCU_MAGIC_TAG_SYSTEM_INIT_H +#define MCU_MAGIC_TAG_SYSTEM_INIT_H + +void SystemInit(void); + +#endif /* McuMagicTag_SYSTEM_INIT_H */ \ No newline at end of file diff --git a/vendor/hispark/demo/sample_thread/system_init.c b/vendor/hispark/demo/sample_thread/system_init.c new file mode 100644 index 0000000000000000000000000000000000000000..8e26ade4156006547d8ec6b6ec13016ea13314b1 --- /dev/null +++ b/vendor/hispark/demo/sample_thread/system_init.c @@ -0,0 +1,29 @@ +/** + * @copyright Copyright (c) 2022, HiSilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @file system_init.c + * @author MCU Driver Team + * @brief This file contains driver init functions. This file is generated by the IDE tool. + */ + +#include "main.h" + +void SystemInit(void) +{ + /* USER CODE BEGIN system_init */ + /* USER CODE END system_init */ +} \ No newline at end of file