diff --git a/BUILD.gn b/BUILD.gn new file mode 100755 index 0000000..f743c17 --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if (ohos_kernel_type == "liteos_m") { + import("//kernel/liteos_m/liteos.gni") + module_name = get_path_info(rebase_path("."), "name") + module_group(module_name) { + modules = [ + "gr551x", + ] + } +} diff --git a/Kconfig.liteos_m.defconfig b/Kconfig.liteos_m.defconfig new file mode 100755 index 0000000..a9e04ab --- /dev/null +++ b/Kconfig.liteos_m.defconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +rsource "*/Kconfig.liteos_m.defconfig.series" \ No newline at end of file diff --git a/Kconfig.liteos_m.series b/Kconfig.liteos_m.series new file mode 100755 index 0000000..7c69d7f --- /dev/null +++ b/Kconfig.liteos_m.series @@ -0,0 +1,14 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +rsource "*/Kconfig.liteos_m.series" diff --git a/Kconfig.liteos_m.soc b/Kconfig.liteos_m.soc new file mode 100755 index 0000000..b3d1e4e --- /dev/null +++ b/Kconfig.liteos_m.soc @@ -0,0 +1,22 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +config SOC_COMPANY_GOODIX + bool + +if SOC_COMPANY_GOODIX +config SOC_COMPANY + default "goodix" + +rsource "*/Kconfig.liteos_m.soc" +endif # SOC_COMPANY_GOODIX \ No newline at end of file diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 index 4a45986..4947287 --- a/LICENSE +++ b/LICENSE @@ -1,177 +1,177 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/README.en.md b/README.en.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 2a4ea68..af7b776 --- a/README.md +++ b/README.md @@ -1,93 +1,207 @@ -# 快速上手GR5515 SK开发板 +# device_gr551x -## 开发板介绍 +## 介绍 -### 开发板概述 -GR5515 Starter Kit(以下简称GR5515 SK)套件是基于的GR551x芯片(支持Bluetooth 5.1)设计的开发平台,包含Starter Kit开发板(以下简称GR5515 SK板)、原理图和使用指南。用户可以在该平台上熟悉GR551x开发工具以及快速搭建自己的产品原型并验证相关功能。 +以下内容步骤参考[quickstart-lite-env-setup-linux](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-linux.md) -开发板如下图所示: +系统要求:Ubuntu16.04 和 Ubuntu18.04 64位系统版本。 -![](./figures/GR5515_SK_Board.png) - -### 开发板功能 - -* 支持Bluetooth 5.1的单模低功耗蓝牙SoC -* 多功能按键和LED指示灯 -* 支持Arduino模块插接接口,IO电压可以通过level shift灵活配置 -* 支持调试功能的SEGGER J-Link OB -* UART转USB接口 -* Micro USB接口连接PC -* 1.44寸TFT彩色显示屏 -* 板上集成QSPI Flash - -为了更好的使用GR5515 Starter Kit套件,建议参考下表相关资料。 - -| 名称 | 描述 | -| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| GR5515 Starter Kit用户指南 | 介绍GR5515 Starter Kit套件使用方法: [《GR5515 Starter Kit用户指南》]( https://docs.goodix.com/zh/online/detail/gr5515_starter_kit_user_guide/V1.7/42a03ba92cad1d63afd9baa8bb8c37df) | -| GR551x开发者指南 | GR551x软硬件介绍、快速使用及资源总览: [《GR551x开发者指南》]( https://docs.goodix.com/zh/online/detail/gr551x_develop_guide/V2.3/27f7d503bcd7ad1d63fa5b316b3bde4f) | -| J-Link用户指南 | J-Link使用说明:www.segger.com/downloads/jlink/UM08001_JLink.pdf | -| GR5515-SK-BASIC-RevC | GR5515 Starter Kit开发板原理图:[《GR5515-SK-BASIC-RevC.pdf》]( https://product.goodix.com/zh/docview/GR5515-SK-BASIC-RevC_Rev.1.5?objectId=100&objectType=document&version=133) | +编译环境搭建包含如下几步: -## 代码下载 +1. 安装必要的库和工具 +2. 安装python3 +3. 安装hb +4. 安装编译工具链 +5. 获取源码 +6. 确认目录结构 +7. 编译流程 +8. 烧录 + +## 工具安装 ### 安装repo 1. 创建repo安装目录:命令行输入`mkdir ~/bin` 2. 下载repo:命令行输入`wget https://storage.googleapis.com/git-repo-downloads/repo -P ~/bin/` 3. 改变执行权限:命令行输入`chmod a+x ~/bin/repo` -4. 设置环境变量:在~/.bashrc文件的最后输入`export PATH=~/bin:$PATH和export REPO_URL=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/` +4. 设置环境变量:在~/.bashrc文件的最后输入`export PATH=~/bin:$PATH`和`export REPO_URL=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/` 5. 重启shell -### 下载系统 -笔者使用的系统版本标签是3.0.0_LTS,仅在此版本进行了验证,建议读者下载此版本的源码。 +### 安装必要的库和工具 -源码下载步骤: +> - 通常系统默认安装samba、vim等常用软件,需要做适当适配以支持Linux服务器与Windows工作台之间的文件共享。 -1. 打包下载所有文件,此时默认的Harmony版本为3.0.0_LTS:`repo init -u https://gitee.com/openharmony-sig/manifest.git -b OpenHarmony-3.0-LTS --no-repo-verify -m devboard_gr5515.xml`。 +> - 使用如下apt-get命令安装编译所需的必要的库和工具: + +``` +sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi +``` + +### 安装Python3 + +1. 打开Linux编译服务器终端。 +2. 输入如下命令,查看python版本号: + + ``` + python3 --version + ``` + + 如果低于python3.7版本,不建议直接升级,请按照如下步骤重新安装。以python3.8为例,按照以下步骤安装python。 + + 1. 运行如下命令,查看Ubuntu版本: + + ``` + cat /etc/issue + ``` + + 1. 根据Ubuntu不同版本,安装python。 + - 如果Ubuntu 版本为18+,运行如下命令。 + + ``` + sudo apt-get install python3.8 + ``` + - 如果Ubuntu版本为16。 + + a. 安装依赖包 + + ``` + sudo apt update && sudo apt install software-properties-common + ``` + + b. 添加deadsnakes PPA 源,然后按回车键确认安装。 + + ``` + sudo add-apt-repository ppa:deadsnakes/ppa + ``` + + c. 安装python3.8 + + ``` + sudo apt upgrade && sudo apt install python3.8 + ``` +3. 设置python和python3软链接为python3.8。 + + ``` + sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 + sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 + ``` +4. 安装并升级Python包管理工具(pip3),任选如下一种方式。 + + - **命令行方式:** + + ``` + sudo apt-get install python3-setuptools python3-pip -y + sudo pip3 install --upgrade pip + ``` + - **安装包方式:** + + ``` + curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py + python get-pip.py + ``` + +### 安装hb + +#### 前提条件 + +请先安装Python 3.7.4及以上版本,请见[安装Python3](#section1238412211211)。 + +#### 安装方法 + +1. 运行如下命令安装hb + + ``` + python3 -m pip install --user ohos-build + ``` +2. 设置环境变量 + + ``` + vim ~/.bashrc + ``` + + 将以下命令拷贝到.bashrc文件的最后一行,保存并退出。 + + ``` + export PATH=~/.local/bin:$PATH + ``` + + 执行如下命令更新环境变量。 + + ``` + source ~/.bashrc + ``` +3. 执行"hb -h",有打印以下信息即表示安装成功: + + ``` + usage: hb + + OHOS build system + + positional arguments: + {build,set,env,clean} + build Build source code + set OHOS build settings + env Show OHOS build env + clean Clean output + + optional arguments: + -h, --help show this help message and exit + ``` + +### 安装编译工具链 + +1. 编译链工具推荐使用gcc-arm-none-eabi-10-2020-q4-major。(下载网站:https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads )。 +2. 执行`vim ~/.bashrc`。 +3. 将工具链的路径加入环境变量, 如:`export PATH=/home/tools/ARM/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH`。 +3. 保存后执行`source ~/.bashrc`使环境变量生效。 + +## 获取代码流程 + +1. 打包下载所有文件,此时默认的Harmony版本为Master:`repo init -u https://gitee.com/openharmony-sig/manifest.git -b OpenHarmony-3.0-LTS --no-repo-verify -m devboard_gr5515.xml`。 2. 下载好仓库后,输入:`repo sync -c`,也就是下载当前分支的代码。 3. 下载好代码后,输入:`repo forall -c 'git lfs pull'`,下载部分大容量二进制文件。 - - -### 下载GR5515源码 - -如果下载系统时选择了打包下载,可跳过此步。 - -1. 从https://gitee.com/openharmony-sig/devboard_device_goodix_gr551x.git 下载device仓内容。 -2. 从https://gitee.com/openharmony-sig/devboard_vendor_goodix_gr5515_sk_basic.git 下载vendor仓内容。 - - - ## 确认目录结构 在device文件夹下,确保device文件夹目录结构如下 ```shell -user:~/Harmony/device$ tree -L 3 +user:~/Harmony/device/soc$ tree -L 3 . └── goodix - └── gr551x - ├── adapter # 外设驱动、BLE、文件系统适配 - ├── BUILD.gn # GN构建脚本 - ├── components # 组件 - ├── drivers # HDF外设驱动 - ├── hcs # 设备描述文件 - ├── sdk_liteos # Liteos GR551x SDK适配 - └── tools # 固件生成工具 + ├── BUILD.gn # GN构建脚本 + ├── gr551x # gr551x soc适配目录 + │   ├── adapter # 外设驱动、BLE、文件系统适配 + │   ├── BUILD.gn # GN构建脚本 + │   ├── components # 组件 + │   ├── drivers # HDF外设驱动 + │   ├── hcs # 设备描述文件 + │   ├── Kconfig.liteos_m.defconfig.gr551x # gr551x Kconfig默认配置 + │   ├── Kconfig.liteos_m.defconfig.series # series Kconfig默认配置 + │   ├── Kconfig.liteos_m.series # series Kconfig配置项 + │   ├── Kconfig.liteos_m.soc # soc Kconfig配置项 + │   ├── sdk_liteos # Liteos GR551x SDK适配 + │   └── tools # 固件生成工具 + ├── Kconfig.liteos_m.defconfig # liteos_m Kconfig默认配置 + ├── Kconfig.liteos_m.series # liteos_m series配置项 + └── Kconfig.liteos_m.soc # liteos_m soc配置项 ``` + 在vendor文件夹下,确保vendor文件夹目录结构如下 ```shell user:~/Harmony/vendor$ tree -L 3 + . └── goodix ├── gr5515_sk_iotlink_demo # BLE IOT应用示例工程 │   ├── BUILD.gn # GN构建脚本 │   ├── config.json # 子系统裁配置裁剪脚本 │   ├── hals # 产品参数配置 + │   ├── hdf_config # HDF硬件描述配置 + │   ├── kernel_configs # Kconfig配置输出 │   ├── patches # 源码补丁 │   └── patch.yml # 补丁执行脚本 └── gr5515_sk_xts_demo # XTS测试示例工程 @@ -95,17 +209,12 @@ user:~/Harmony/vendor$ tree -L 3 ├── config.json # 子系统裁配置裁剪脚本 ├── tests # 测试用例 ├── hals # 产品参数配置 +    ├── hdf_config # HDF硬件描述配置 +    ├── kernel_configs # Kconfig配置输出 ├── patches # 源码补丁 └── patch.yml # 补丁执行脚本 ``` -## 设置编译工具链 - -1. 编译链工具推荐使用gcc-arm-none-eabi-10-2020-q4-major。(下载网站:https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads )。 -2. 执行`vim ~/.bashrc`。 -3. 将工具链的路径加入环境变量, 如:`export PATH=/home/tools/ARM/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH`。 -3. 保存后执行`source ~/.bashrc`使环境变量生效。 - ## 编译工程 进入源码根目录编译工程 @@ -120,6 +229,8 @@ user:~/Harmony/vendor$ tree -L 3 ​ `hb build -f --patch` 打patch并开始编译,后续修改了文件只需要执行`hb build -f`即可,不需要重复以上步骤。 +如果hb set命令提示报错,请先执行一次`pip3 install build/lite` + ## 固件烧录 生成的固件位于out/gr551x/${Project_name}/bin/application_fw.bin,固件烧录工具GProgrammer下载地址:https://product.goodix.com/zh/software_tool/gprogrammer 。 @@ -129,6 +240,7 @@ user:~/Harmony/vendor$ tree -L 3 ## 相关仓库 -[devboard_device_goodix_gr551x](https://gitee.com/openharmony-sig/devboard_device_goodix_gr551x) - [devboard_vendor_goodix_gr5515_sk_basic](https://gitee.com/openharmony-sig/devboard_vendor_goodix_gr5515_sk_basic) + +[device_board_goodix](https://gitee.com/openharmony-sig/device_board_goodix) + diff --git a/figures/GR5515_SK_Board.png b/figures/GR5515_SK_Board.png deleted file mode 100755 index 92763f2..0000000 Binary files a/figures/GR5515_SK_Board.png and /dev/null differ diff --git a/gr551x/BUILD.gn b/gr551x/BUILD.gn old mode 100644 new mode 100755 index 5d9d64d..9fc4e6f --- a/gr551x/BUILD.gn +++ b/gr551x/BUILD.gn @@ -13,22 +13,13 @@ import("//build/lite/config/subsystem/lite_subsystem.gni") import("//build/lite/config/component/lite_component.gni") +import("//kernel/liteos_m/liteos.gni") copy("link-script") { sources = [ "sdk_liteos/platform/startup/gr551x.ld"] outputs = [ "$root_build_dir/bin/link.ld" ] } -copy("hilink_btsdk_lib") { - sources = [ "components/hilink/debug/libhilinkbtsdk.a"] - outputs = [ "$root_build_dir/libs/libhilinkbtsdk.a" ] - } - -copy("hichain_lib") { - sources = [ "components/hichain/libhichain_account.a"] - outputs = [ "$root_build_dir/libs/libhichain_account.a" ] - } - copy("sdk_lib") { sources = [ "sdk_liteos/gr551x_sdk/components/sdk/linker/lib_gcc/libble_sdk.a"] outputs = [ "$root_build_dir/libs/libble_sdk.a" ] @@ -94,17 +85,24 @@ source_set("device_soc"){ deps = [ ":link-script", - ":sdk_lib", - ":hilink_btsdk_lib", - ":hichain_lib", - ":rom_symbol", - "//kernel/liteos_m:kernel", + ":sdk_lib", + ":rom_symbol", "//build/lite/config/component/cJSON:cjson_static", + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static" ] } -group("gr551x") { +source_set("hdf_drivers") { deps = [ - ":device_soc", + "drivers:drivers", + ] +} + +module_name = get_path_info(rebase_path("."), "name") +module_group(module_name) { + modules = [ ] + deps = [ + ":device_soc", + ":hdf_drivers", ] } diff --git a/gr551x/Kconfig.liteos_m.defconfig.gr551x b/gr551x/Kconfig.liteos_m.defconfig.gr551x new file mode 100755 index 0000000..eb1cd87 --- /dev/null +++ b/gr551x/Kconfig.liteos_m.defconfig.gr551x @@ -0,0 +1,17 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +config SOC + string + default "gr551x" + depends on SOC_GR551x diff --git a/gr551x/Kconfig.liteos_m.defconfig.series b/gr551x/Kconfig.liteos_m.defconfig.series new file mode 100755 index 0000000..5131304 --- /dev/null +++ b/gr551x/Kconfig.liteos_m.defconfig.series @@ -0,0 +1,31 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if SOC_SERIES_GR551x + +rsource "Kconfig.liteos_m.defconfig.gr551x" + +config SOC_SERIES + string + default "gr551x" + +config NUM_IRQS + int + default 45 + +config SYS_CLOCK_HW_CYCLES_PER_SEC + int + default 64000000 + +endif + diff --git a/gr551x/Kconfig.liteos_m.series b/gr551x/Kconfig.liteos_m.series new file mode 100755 index 0000000..56dd679 --- /dev/null +++ b/gr551x/Kconfig.liteos_m.series @@ -0,0 +1,21 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +config SOC_SERIES_GR551x + bool "Goodix gr551x Series" + select ARM + select SOC_COMPANY_GOODIX + select CPU_CORTEX_M4 + help + Enable support for goddix gr551x series + diff --git a/gr551x/Kconfig.liteos_m.soc b/gr551x/Kconfig.liteos_m.soc new file mode 100755 index 0000000..1dad0bb --- /dev/null +++ b/gr551x/Kconfig.liteos_m.soc @@ -0,0 +1,21 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +choice + prompt "goodix gr551x series SoC" + depends on SOC_SERIES_GR551x + +config SOC_GR551x + bool "SoC GR551x" + +endchoice diff --git a/gr551x/adapter/hals/bluetooth/hal_bt_evt_handler.c b/gr551x/adapter/hals/bluetooth/hal_bt_evt_handler.c old mode 100644 new mode 100755 index df4bee8..af66bbe --- a/gr551x/adapter/hals/bluetooth/hal_bt_evt_handler.c +++ b/gr551x/adapter/hals/bluetooth/hal_bt_evt_handler.c @@ -27,7 +27,7 @@ #define CN_BLE_EVENT_TASK_PRIOR 16 #define CN_BLE_EVENT_TASK_NAME "BLE_EVENT" -#define BLE_MSG_QUEUE_LEN 5 +#define BLE_MSG_QUEUE_LEN 16 #define BLE_MSG_INFO_SIZE sizeof(ble_msg_t) static uint32_t g_bleMsgHandle; diff --git a/gr551x/adapter/hals/bluetooth/hal_bt_evt_handler.h b/gr551x/adapter/hals/bluetooth/hal_bt_evt_handler.h old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/bluetooth/hal_bt_gatt.c b/gr551x/adapter/hals/bluetooth/hal_bt_gatt.c old mode 100644 new mode 100755 index 23f9be4..1ee72b9 --- a/gr551x/adapter/hals/bluetooth/hal_bt_gatt.c +++ b/gr551x/adapter/hals/bluetooth/hal_bt_gatt.c @@ -334,6 +334,29 @@ int BleGattSecurityRsp(BdAddr bdAddr, bool accept) return OHOS_BT_STATUS_SUCCESS; } +int HILINK_BT_GetMacAddr(unsigned char* result, unsigned int length) +{ + APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s--- Entry!!! ", __FUNCTION__); + uint8_t addr[6]; + uint16_t lenght = 6; + if (result == NULL) { + return OHOS_BT_STATUS_PARM_INVALID; + } + + if (nvds_get(0xC001, &lenght, (uint8_t*)addr)) + { + return OHOS_BT_STATUS_PARM_INVALID; + } + + result[0] = addr[5]; + result[1] = addr[4]; + result[2] = addr[3]; + result[3] = addr[2]; + result[4] = addr[1]; + result[5] = addr[0]; + return OHOS_BT_STATUS_SUCCESS; +} + int GetDeviceMacAddress(unsigned char* result) { APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s--- Entry!!! ", __FUNCTION__); @@ -468,7 +491,7 @@ int BleStartAdvEx(int *advId, const StartAdvRawData rawData, BleAdvParams advPar static void app_gap_adv_start_cb(uint8_t inst_idx, uint8_t status) { - APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---status:%d--- Entry!!! ", __FUNCTION__, status); + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---status:%d--- Entry!!! ", __FUNCTION__, status); if (s_gatt_callbacks && s_gatt_callbacks->advEnableCb) { ble_msg_t tx_msg = @@ -485,7 +508,7 @@ static void app_gap_adv_start_cb(uint8_t inst_idx, uint8_t status) static void app_gap_adv_stop_cb(uint8_t inst_idx, uint8_t status, gap_stopped_reason_t reason) { - APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s--- status:%d--- Entry!!! ", __FUNCTION__, status); + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s--- status:%d--- Entry!!! ", __FUNCTION__, status); if (s_gatt_callbacks && s_gatt_callbacks->advDisableCb && GAP_STOPPED_REASON_ON_USER == reason) { ble_msg_t tx_msg = @@ -501,9 +524,10 @@ static void app_gap_adv_stop_cb(uint8_t inst_idx, uint8_t status, gap_stopped_re static void app_gap_connect_cb(uint8_t conn_idx, uint8_t status, const gap_conn_cmp_t *p_conn_param) { - APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---conn_idx:%d--- Entry!!! ", __FUNCTION__, conn_idx); + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---conn_idx:%d--- Entry!!! ", __FUNCTION__, conn_idx); if (!status) { + ble_gap_phy_update(conn_idx, BLE_GAP_PHY_LE_2MBPS, BLE_GAP_PHY_LE_2MBPS, 0); memcpy(s_conn_info[conn_idx].peer_addr.addr, p_conn_param->peer_addr.addr, 6); if (g_gatt_server_callbacks && g_gatt_server_callbacks->connectServerCb) { @@ -523,7 +547,7 @@ static void app_gap_connect_cb(uint8_t conn_idx, uint8_t status, const gap_conn_ static void app_gap_disconnect_cb(uint8_t conn_idx, uint8_t status, uint8_t reason) { - APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---conn_idx:%d--- Entry!!! ", __FUNCTION__, conn_idx); + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---conn_idx:%d--- Entry!!! ", __FUNCTION__, conn_idx); if (!status) { if (g_gatt_server_callbacks && g_gatt_server_callbacks->disconnectServerCb) @@ -546,8 +570,14 @@ static void app_gap_disconnect_cb(uint8_t conn_idx, uint8_t status, uint8_t reas static void app_gap_connection_update_req_cb(uint8_t conn_idx, const gap_conn_param_t *p_conn_param_update_req) { - APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---conn_idx:%d--- Entry!!! ", __FUNCTION__, conn_idx); + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---conn_idx:%d--- Entry!!! ", __FUNCTION__, conn_idx); ble_gap_conn_param_update_reply(conn_idx, true); + gap_conn_update_param_t gap_conn_param; + gap_conn_param.interval_min = 6; + gap_conn_param.interval_max = 6; + gap_conn_param.slave_latency = 0; + gap_conn_param.sup_timeout = 400; + ble_gap_conn_param_update(conn_idx, &gap_conn_param); } static void app_gatt_mtu_exchange_cb(uint8_t conn_idx, uint8_t status, uint16_t mtu) @@ -570,7 +600,7 @@ static void app_gatt_mtu_exchange_cb(uint8_t conn_idx, uint8_t status, uint16_t static void app_sec_rcv_enc_req_cb(uint8_t conn_idx, sec_enc_req_t *p_enc_req) { - APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---conn_idx:%d--- Entry!!! ", __FUNCTION__, conn_idx); + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---conn_idx:%d--- Entry!!! ", __FUNCTION__, conn_idx); s_sec_enc_req_type = p_enc_req->req_type; diff --git a/gr551x/adapter/hals/bluetooth/hal_bt_gatt_server.c b/gr551x/adapter/hals/bluetooth/hal_bt_gatt_server.c old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/bluetooth/hal_bt_ota.c b/gr551x/adapter/hals/bluetooth/hal_bt_ota.c old mode 100644 new mode 100755 index 96962e8..5446b18 --- a/gr551x/adapter/hals/bluetooth/hal_bt_ota.c +++ b/gr551x/adapter/hals/bluetooth/hal_bt_ota.c @@ -12,10 +12,156 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +#include "gr551x_spi_flash.h" +#include "app_log.h" +#include "gr55xx_dfu.h" #include #include +#define FLASH_OP_PAGE_SIZE (0x1000) +#define FLASH_SIZE_MAX (0x000E1000) +#define IMG_INFO_DFU_ADDR (0x01002000UL) + +static uint32_t flash_op_save_offset = 0; +static uint32_t flash_op_erase_offset = 0; + +typedef struct +{ + uint16_t pattern; + uint16_t version; + boot_info_t boot_info; + uint8_t comments[12]; +} fw_img_info_t; + +bool HILINK_OtaAdapterFlashInit(void) +{ + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---Entry!!! ", __FUNCTION__); + flash_init_t flash_init; + + flash_init.spi_type = FLASH_QSPI_ID1; + flash_init.flash_io.spi_cs.gpio = APP_IO_TYPE_NORMAL; + flash_init.flash_io.spi_cs.pin = APP_IO_PIN_15; + flash_init.flash_io.spi_cs.mux = APP_IO_MUX_2; + flash_init.flash_io.spi_clk.gpio = APP_IO_TYPE_NORMAL; + flash_init.flash_io.spi_clk.pin = APP_IO_PIN_9; + flash_init.flash_io.spi_clk.mux = APP_IO_MUX_2; + flash_init.flash_io.spi_io0.qspi_io0.gpio = APP_IO_TYPE_NORMAL; + flash_init.flash_io.spi_io0.qspi_io0.pin = APP_IO_PIN_8; + flash_init.flash_io.spi_io0.qspi_io0.mux = APP_IO_MUX_2; + flash_init.flash_io.spi_io1.qspi_io1.gpio = APP_IO_TYPE_NORMAL; + flash_init.flash_io.spi_io1.qspi_io1.pin = APP_IO_PIN_14; + flash_init.flash_io.spi_io1.qspi_io1.mux = APP_IO_MUX_2; + flash_init.flash_io.qspi_io2.gpio = APP_IO_TYPE_NORMAL; + flash_init.flash_io.qspi_io2.pin = APP_IO_PIN_13; + flash_init.flash_io.qspi_io2.mux = APP_IO_MUX_2; + flash_init.flash_io.qspi_io3.gpio = APP_IO_TYPE_NORMAL; + flash_init.flash_io.qspi_io3.pin = APP_IO_PIN_12; + flash_init.flash_io.qspi_io3.mux = APP_IO_MUX_2; + + if (!spi_flash_init(&flash_init)) + { + APP_LOG_ERROR(">>>>>>>>>>>>>>>>>>>>>>>>>%s fail !!! ", __FUNCTION__); + return false; + } + + if (!spi_flash_sector_erase(flash_op_erase_offset, FLASH_OP_PAGE_SIZE)) + { + APP_LOG_ERROR(">>>>>>>>>>>>>>>>>>>>>>>>>>Erase Bank1 address: 0x%08x fail !!! ", flash_op_erase_offset); + return false; + } + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>Erase Bank1 address: 0x%08x ", flash_op_erase_offset); + flash_op_erase_offset += FLASH_OP_PAGE_SIZE; + + return true; +} + +unsigned int HILINK_OtaAdapterGetUpdateIndex(void) +{ + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s--- Entry!!! ", __FUNCTION__); + return 0; +} + + +int HILINK_OtaAdapterFlashErase(unsigned int size) +{ + APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---size:%d Entry!!! ", __FUNCTION__, size); + if(spi_flash_sector_erase(0, size)) + { + return 0; + } + + APP_LOG_ERROR(">>>>>>>>>>>>>>>>>>>>>>>>>>%s fail !!! ", __FUNCTION__); + return -1; +} + +int HILINK_OtaAdapterFlashWrite(const unsigned char *buf, unsigned int buflen) +{ + APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s--- buflen %d !!! ", __FUNCTION__, buflen); + + if ((flash_op_save_offset + buflen) > flash_op_erase_offset) + { + if (!spi_flash_sector_erase(flash_op_erase_offset, FLASH_OP_PAGE_SIZE)) + { + APP_LOG_ERROR(">>>>>>>>>>>>>>>>>>>>>>>>>>Erase Bank1 address: 0x%08x fail !!! ", flash_op_erase_offset); + return false; + } + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>Erase Bank1 address: 0x%08x ", flash_op_erase_offset); + flash_op_erase_offset += FLASH_OP_PAGE_SIZE; + } + + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>Write Bank1 address: 0x%08x len: 0x%08x", flash_op_save_offset, buflen); + if (buflen != spi_flash_write(flash_op_save_offset, (uint8_t *)buf, buflen)) + { + APP_LOG_ERROR(">>>>>>>>>>>>>>>>>>>>>>>>>>Write Bank1 address: 0x%08x fail !!! ", flash_op_save_offset); + return -1; + } + flash_op_save_offset += buflen; + + return 0; +} + +int HILINK_OtaAdapterFlashRead(unsigned int offset, unsigned char *buf, unsigned int buflen) +{ + APP_LOG_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---buflen:%d Entry!!! ", __FUNCTION__, buflen); + if (buflen == spi_flash_read(offset, buf, buflen)) + { + return 0; + } + + APP_LOG_ERROR(">>>>>>>>>>>>>>>>>>>>>>>>>>%s error: read size is not buflen !!! ", __FUNCTION__); + return -1; +} + +bool HILINK_OtaAdapterFlashFinish(void) +{ + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---Entry!!! ", __FUNCTION__); + return true; +} + +unsigned int HILINK_OtaAdapterFlashMaxSize(void) +{ + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s---0x%08x Entry!!! ", __FUNCTION__, FLASH_SIZE_MAX); + return FLASH_SIZE_MAX; +} + +void HILINK_OtaAdapterRestart(int flag) +{ + APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>%s--- Entry!!! ", __FUNCTION__); + (void)flag; + fw_img_info_t img_info; + + spi_flash_read(flash_op_save_offset - 48, (uint8_t *)&img_info, sizeof(fw_img_info_t)); + hal_flash_write(IMG_INFO_DFU_ADDR, (uint8_t *)&img_info, sizeof(fw_img_info_t)); + + hal_nvic_system_reset(); + return; +} + +int HilinkGetMcuVersion(char *version,unsigned int inlen, unsigned int *outlen) +{ + return 0; +} + int HilinkGetRebootFlag(void) { return 1; @@ -35,53 +181,8 @@ int HilinkOtaEndProcess(int status) return 0; } -void HILINK_OtaAdapterRestart(int flag) -{ - return; -} + int HilinkNotifyOtaStatus(int flag, unsigned int len, unsigned int type) { return 0; } - -unsigned int HILINK_OtaAdapterFlashMaxSize(void) -{ - return 0; -} -bool HILINK_OtaAdapterFlashFinish(void) -{ - return true; -} - -int HILINK_OtaAdapterFlashRead(unsigned int offset, unsigned char *buf, unsigned int buflen) -{ - return 0; -} - -int HILINK_OtaAdapterFlashWrite(const unsigned char *buf, unsigned int buflen) -{ - return 0; -} - -int HILINK_OtaAdapterFlashErase(unsigned int size) -{ - return 0; -} -unsigned int HILINK_OtaAdapterGetUpdateIndex(void) -{ - return 0; -} -bool HILINK_OtaAdapterFlashInit(void) -{ - return true; -} - -int getDeviceVersion(char **firmwareVer, unsigned int inlen, unsigned int *outlen) -{ - return 0; -} - -int HilinkGetMcuVersion(char *version,unsigned int inlen, unsigned int *outlen) -{ - return 0; -} \ No newline at end of file diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/BUILD.gn b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/BUILD.gn old mode 100644 new mode 100755 index d065984..90848f9 --- a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/BUILD.gn +++ b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/BUILD.gn @@ -12,7 +12,6 @@ # limitations under the License. static_library("hal_iothardware") { - if (board_name == "gr551x") { sources = [ "hal_iot_flash.c", "hal_iot_gpio.c", @@ -27,5 +26,4 @@ static_library("hal_iothardware") { "//utils/native/lite/include", "//base/iot_hardware/peripheral/interfaces/kits", ] - } } diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_flash.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_flash.c old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_gpio.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_gpio.c old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_i2c.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_i2c.c old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_pwm.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_pwm.c old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_uart.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_uart.c old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_watchdog.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_watchdog.c old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_lowpower.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_lowpower.c old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_reset.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_reset.c old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/update/BUILD.gn b/gr551x/adapter/hals/update/BUILD.gn old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/update/hal_hota_board.c b/gr551x/adapter/hals/update/hal_hota_board.c old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/utils/file/BUILD.gn b/gr551x/adapter/hals/utils/file/BUILD.gn old mode 100644 new mode 100755 diff --git a/gr551x/adapter/hals/utils/file/src/hal_file.c b/gr551x/adapter/hals/utils/file/src/hal_file.c old mode 100644 new mode 100755 index f702750..18654bd --- a/gr551x/adapter/hals/utils/file/src/hal_file.c +++ b/gr551x/adapter/hals/utils/file/src/hal_file.c @@ -21,6 +21,7 @@ #include "dirent.h" #include #include "app_log.h" +#include "config.h" #define MaxOpenFile 32 #define FR_OK 0 @@ -73,8 +74,8 @@ void FileSystemInit(void) APP_LOG_ERROR("[LFS] File system mutex init failed!!!"); } - //app_lfs_format(); - ret = app_lfs_init(); + app_lfs_format(); + ret = app_lfs_init(LOSCFG_LFS_MAX_BLOCK_COUNT); if (ret != 0) { APP_LOG_ERROR("[LFS] File system init failed! ret=%d", ret); } @@ -149,7 +150,7 @@ static char *get_file_name(const char *path) } int HalFileOpen(const char *path, int oflag, int mode) -{ +{ int ret = 0; int fd = 0; char *file_name; @@ -213,21 +214,12 @@ int HalFileRead(int fd, char *buf, unsigned int len) fs_lock(); ret = app_lfs_file_read(&File[fd - 1].file, (uint8_t *)buf, len); fs_unlock(); - for (int i = 0; i < ret; i++) - { - printf("0x%02x ", (unsigned char)buf[i]); - } - printf("\r\n"); + return ret; } int HalFileWrite(int fd, const char *buf, unsigned int len) { - for (int i = 0; i < len; i++) - { - printf("0x%02x ", (unsigned char)buf[i]); - } - printf("\r\n"); int ret = 0; if ((fd > MaxOpenFile) || (fd <= 0)) { @@ -285,7 +277,7 @@ int HalFileStat(const char *path, unsigned int *fileSize) ret = app_lfs_file_stat(file_name, &info); fs_unlock(); - *fileSize = info.size; + *fileSize = info.size; return ((ret == 0) ? 0 : -1); } diff --git a/gr551x/adapter/hals/utils/file/src/posix_fs.c b/gr551x/adapter/hals/utils/file/src/posix_fs.c old mode 100644 new mode 100755 diff --git a/gr551x/components/hichain/libhichain_account.a b/gr551x/components/hichain/libhichain_account.a deleted file mode 100755 index 7586a83..0000000 Binary files a/gr551x/components/hichain/libhichain_account.a and /dev/null differ diff --git a/gr551x/components/hilink/debug/libhilinkbtsdk.a b/gr551x/components/hilink/debug/libhilinkbtsdk.a deleted file mode 100755 index 841d728..0000000 Binary files a/gr551x/components/hilink/debug/libhilinkbtsdk.a and /dev/null differ diff --git a/gr551x/components/hilink/hilink_demo.c b/gr551x/components/hilink/hilink_demo.c deleted file mode 100755 index ade3419..0000000 --- a/gr551x/components/hilink/hilink_demo.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved. - * Description: 蓝牙SDK提供demo示例代码 - */ -#include "hilink_bt_api.h" -#include - -/* 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 */ -typedef struct { - const char* sn; /* 设备唯一标识,比如sn号,长度范围(0,40] */ - const char* prodId; /* 设备HiLink认证号,长度范围(0,5] */ - const char* model; /* 设备型号,长度范围(0,32] */ - const char* dev_t; /* 设备类型,长度范围(0,4] */ - const char* manu; /* 设备制造商,长度范围(0,4] */ - const char* mac; /* 设备MAC地址,固定32字节 */ - const char* hiv; /* 设备Hilink协议版本,长度范围(0,32] */ - const char* fwv; /* 设备固件版本,长度范围[0,64] */ - const char* hwv; /* 设备硬件版本,长度范围[0,64] */ - const char* swv; /* 设备软件版本,长度范围[0,64] */ - const int prot_t; /* 设备协议类型,取值范围[1,3] */ -} dev_info_t; - -/* - * 设备类型英文名和厂商英文名长度之和不能超过17字节 - * 如果需要发送蓝牙广播,设备类型英文名和厂商英文名长度分别不能超过4字节 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -typedef struct { - const char* devTypeName; /* 设备类型英文名称 */ - const char* manuName; /* 厂商英文名称 */ -} DevNameEn; - -/* - * 设备基本信息 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -#define DEVICE_SN "12345678" -#define PRODUCT_ID "2XXX" -#define DEVICE_MODEL "model-X" -#define DEVICE_TYPE "000" -#define MANUAFACTURER "000" -#define DEVICE_MAC "AABBCCDDEEFF" - -/* - * 请确保设备类型英文名和厂商英文名长度之和不超过17字节 - * 如果需要发送蓝牙广播,设备类型英文名和厂商英文名长度分别不能超过4字节 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -#define DEVICE_TYPE_NAME "other" -#define MANUAFACTURER_NAME "HW" - -/* - * 设备信息定义 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -dev_info_t dev_info = { - DEVICE_SN, - PRODUCT_ID, - DEVICE_MODEL, - DEVICE_TYPE, - MANUAFACTURER, - DEVICE_MAC, - "1.0.0", - "1.0.0", - "1.0.0", - "1.0.0", - 1 -}; - -/* - * 设备名称定义, 请确保设备类型英文名和厂商英文名长度之和不超过17字节 - * 如果需要发送蓝牙广播,设备类型英文名和厂商英文名长度分别不能超过4字节 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -DevNameEn g_devNameEn = { - DEVICE_TYPE_NAME, - MANUAFACTURER_NAME -}; - -/* 蓝牙sdk单独使用的定义 */ -#define SUB_PRODUCT_ID "00" -#define ADV_TX_POWER 0xF8 - -#define MIN_LEN(a, b) (((a) < (b)) ? (a) : (b)) - -static HILINK_BT_DevInfo g_btDevInfo; - -static int PutServiceOta(const void *svc, const unsigned char *in, unsigned int inLen, - unsigned char **out, unsigned int *outLen) -{ - (void)inLen; - (void)out; - (void)outLen; - printf("service:%s, payload:%s", (char *)svc, (char *)in); - return 0; -} - -static int GetServiceOta(const void *svc, const unsigned char *in, unsigned int inLen, - unsigned char **out, unsigned int *outLen) -{ - (void)inLen; - (void)out; - (void)outLen; - printf("service:%s, payload:%s", (char *)svc, (char *)in); - return 0; -} - -/* 服务信息 */ -static HILINK_BT_SvcInfo g_svcInfo[] = { - { 64, "ota", PutServiceOta, GetServiceOta, 0, NULL }, -}; - -/* Profile */ -static HILINK_BT_Profile g_profile = { - .svcNum = sizeof(g_svcInfo) / sizeof(g_svcInfo[0]), - .svcInfo = g_svcInfo, -}; - -/* 蓝牙发送数据接口打桩函数,由厂家实现 */ -static int HILINK_BT_FeedBackBtData(const unsigned char *buf, unsigned int len) -{ - (void)buf; - (void)len; - return 0; -} - -/* - * 功能: 获取设备sn号 - * 参数[in]: len sn的最大长度, 39字节 - * 参数[out]: sn 设备sn - * 注意: sn指针的字符串长度为0时将使用设备mac地址作为sn - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -void HilinkGetDeviceSn(unsigned int len, char *sn) -{ - if (sn == NULL) { - return; - } - const char *ptr = DEVICE_SN; - int tmp = MIN_LEN(len ,sizeof(DEVICE_SN)); - for (int i = 0; i < tmp; i++) { - sn[i] = ptr[i]; - } - return; -} - -/* - * 获取设备的子型号,长度固定两个字节 - * subProdId为保存子型号的缓冲区,len为缓冲区的长度 - * 如果产品定义有子型号,则填入两字节子型号,并以'\0'结束, 返回0 - * 没有定义子型号,则返回-1 - * 该接口需设备开发者实现 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -int HILINK_GetSubProdId(char *subProdId, int len) -{ - if (subProdId == NULL) { - return -1; - } - const char *ptr = SUB_PRODUCT_ID; - int tmp = MIN_LEN((unsigned int)len ,sizeof(SUB_PRODUCT_ID)); - for (int i = 0; i < tmp; i++) { - subProdId[i] = ptr[i]; - } - return 0; -} - -/* - * 获取设备表面的最强点信号发射功率强度,最强点位置的确定以及功率测试方 - * 法,参照hilink认证蓝牙靠近发现功率设置及测试方法指导文档,power为出参 - * ,单位dbm,返回设备表面的最强信号强度值,如果厂商不想使用蓝牙靠近发现功 - * 能,接口直接返-1,如果需要使用蓝牙靠近发现,则接口返回0,如需及时生效,需 - * 调用HILINK_BT_StartAdvertise()方法启动广播 - */ -int HILINK_BT_GetDevSurfacePower(char *power) -{ - if (power == NULL) { - return -1; - } - *power = ADV_TX_POWER; - return 0; -} - -/* 获取蓝牙SDK设备相关信息 */ -HILINK_BT_DevInfo *HILINK_BT_GetDevInfo(void) -{ - g_btDevInfo.manuName = (char *)g_devNameEn.manuName; - g_btDevInfo.devName = (char *)g_devNameEn.devTypeName; - g_btDevInfo.productId = (char *)dev_info.prodId; - g_btDevInfo.mac = (char *)dev_info.mac; - g_btDevInfo.model = (char *)dev_info.model; - g_btDevInfo.devType = (char *)dev_info.dev_t; - g_btDevInfo.hiv = (char *)dev_info.hiv; - g_btDevInfo.protType = dev_info.prot_t; - return &g_btDevInfo; -} - -int main(void) -{ - int ret; - - ret = HILINK_BT_Init(&g_profile); - if (ret != 0) { - printf("init fail"); - return ret; - } - - ret = HILINK_BT_Process(); - if (ret != 0) { - printf("process fail"); - return ret; - } - - /* 设置蓝牙发送接口 */ - ret = HILINK_BT_RegisterBtDataSendCallback(HILINK_BT_FeedBackBtData); - if (ret != 0) { - printf("set callback fail"); - return ret; - } - - return 0; -} - diff --git a/gr551x/components/hilink/include/ble_cfg_net_api.h b/gr551x/components/hilink/include/ble_cfg_net_api.h deleted file mode 100755 index 1dea5c4..0000000 --- a/gr551x/components/hilink/include/ble_cfg_net_api.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. - * Description: BLESDK APIͷļ - */ - -#ifndef BLE_CFG_NET_API_H -#define BLE_CFG_NET_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* WIFIϢȺ궨 */ -#define WIFI_SSID_MAX_LEN 32 -#define WIFI_PWD_MAX_LEN 64 -#define WIFI_PSK_LEN 32 -#define WIFI_BSSID_LEN 6 - -#define BLE_UUID_LEN 16 - -/* û͵ */ -typedef enum { - NETCFG_DATA, - CUSTOM_DATA, - CUSTOM_SEC_DATA, - DATA_TYPE_BUTT -} BLE_DataType; - -/* Ͷ */ -typedef enum { - ATTR_TYPE_SERVICE = 0, - ATTR_TYPE_CHAR, - ATTR_TYPE_CHAR_VALUE, - ATTR_TYPE_CHAR_CLIENT_CONFIG, - ATTR_TYPE_CHAR_USER_DESC, -} BLE_AttrType; - -/* UUIDȶ */ -typedef enum { - UUID_TYPE_NULL = 0, - UUID_TYPE_16_BIT, - UUID_TYPE_32_BIT, - UUID_TYPE_128_BIT, -} BLE_UuidType; - -/* BLE״̬ */ -typedef enum { - CFG_NET_PROCESS_SUCCESS = 0x00, - CFG_NET_BLE_CONNECT, - CFG_NET_BLE_DIS_CONNECT, - CFG_NET_SPEKE_SUCCESS, - CFG_NET_PROCESS_START, - CFG_NET_RECEIVE_PARA, - CFG_NET_WIFI_CONNECT, - CFG_NET_SESSIONKEY_SUCCESS, - CFG_NET_FAIL_UNKUNOWN = 0x100, - CFG_NET_FAIL_WIFI_SSID, - CFG_NET_FAIL_WIFI_PWD, - CFG_NET_FAIL_SESSIONKEY -} BLE_CfgNetStatus; - -/* ֻഫWIFIϢʽö̾ʽ */ -typedef struct { - unsigned char ssid[WIFI_SSID_MAX_LEN + 1]; - unsigned char pwd[WIFI_PWD_MAX_LEN + 1]; - unsigned char psk[WIFI_PSK_LEN + 1]; - unsigned char bssid[WIFI_BSSID_LEN + 1]; - unsigned char ssidLen; - unsigned char pwdLen; - unsigned char pskLen; - unsigned char bssidLen; - int authMode; - int wifiInfoSrc; - int channelNumber; -} BLE_WifiInfo; - -/* - * ȡ豸PIN뺯 - * pincode: pinĻ - * size: ij - * len: صpinʵʳ - */ -typedef int (*BLE_GetDevPinCode)(unsigned char *pinCode, unsigned int size, unsigned int *len); - -/* - * ȡ豸ϢͣlenҲdzΣδbuffȣδȡ豸Ϣʵʳ - * ʽҪ{"productId":"%s", "sn":"%s", "vendor":"%s"} - */ -typedef int (*BLE_GetDeviceInfo)(unsigned char *devInfo, unsigned int *len); - -/* - * Ϣ -.* ݸʽ{"ssid":"%s","password":"%s","devId":"%s","psk":"%s","code":"%s","random":"%s","vendorData":"%s"} - */ -typedef int (*BLE_SetCfgNetInfo)(const unsigned char *netInfo, unsigned int len); - -/* ûݺ */ -typedef int (*BLE_RcvCustomData)(unsigned char *buff, unsigned int len); - -/* ״̬ */ -typedef int (*BLE_CfgNetProcess)(BLE_CfgNetStatus status); - -/* BLE GATT */ -typedef int (*BLE_GattRead)(unsigned char *buff, unsigned int *len); - -/* BLE GATTд */ -typedef int (*BLE_GattWrite)(const unsigned char *buff, unsigned int len); - -/* BLE GATTָʾ */ -typedef int (*BLE_GattIndicate)(unsigned char *buff, unsigned int len); - -/* BLE GATTصָ */ -typedef struct { - BLE_GattRead readCb; - BLE_GattWrite writeCb; - BLE_GattIndicate indicateCb; -} BLE_GattOperateFunc; - -/* BLEò */ -typedef struct { - int isBlePair; - int isDeinitBleStack; - int data1; /* ΪòԤݲʹ */ - int data2; /* ΪòԤݲʹ */ - int data3; /* ΪòԤݲʹ */ -} BLE_ConfPara; - -/* BLE GATT */ -typedef struct { - BLE_AttrType attrType; - unsigned int permission; - BLE_UuidType uuidType; - unsigned char uuid[BLE_UUID_LEN]; - unsigned char *value; - unsigned char valLen; - unsigned char properties; - BLE_GattOperateFunc func; -} BLE_GattAttr; - -/* GATT(service¹ҵȫcharacteristicsdescriptions) */ -typedef struct { - unsigned int attrNum; - BLE_GattAttr *attrList; -} BLE_GattService; - -/* GATTб(servicesͷصhandle) */ -typedef struct { - unsigned int num; - BLE_GattService *service; - int *handle; -} BLE_GattList; - -/* GATTб */ -typedef struct { - unsigned int num; - int *handle; -} BLE_GattHandleList; - -/* BLEĹ㲥ݺɨӦ */ -typedef struct { - unsigned char *advData; - unsigned int advDataLen; - unsigned char *rspData; - unsigned int rspDataLen; -} BLE_AdvData; - -/* BLEĹ㲥 */ -typedef struct { - unsigned char advType; - unsigned char discMode; - unsigned char connMode; - unsigned int minInterval; - unsigned int maxInterval; - unsigned int channelMap; - unsigned int timeout; - int txPower; -} BLE_AdvPara; - -/* 㲥 */ -typedef struct { - BLE_AdvPara *advPara; - BLE_AdvData *advData; -} BLE_AdvInfo; - -/* BLEʼ */ -typedef struct { - BLE_ConfPara *confPara; - BLE_AdvInfo *advInfo; - BLE_GattList *gattList; -} BLE_InitPara; - -/* BLEص */ -typedef struct { - BLE_GetDevPinCode getDevPinCodeCb; - BLE_GetDeviceInfo getDeviceInfoCb; - BLE_SetCfgNetInfo setCfgNetInfoCb; - BLE_RcvCustomData rcvCustomDataCb; - BLE_CfgNetProcess cfgNetProcessCb; -} BLE_CfgNetCb; - -/* - * BLEԴ룺BLEЭջصҽ - * ΪʵЭջparaNULL,軪ΪʵЭջ踳ֵparaṹ - */ -int BLE_CfgNetInit(BLE_InitPara *para, BLE_CfgNetCb *cb); - -/* - * BLEԴעصBLEЭջ - * flagΪ0ֻٿƺ͵̣߳flagΪ1Эջ - */ -int BLE_CfgNetDeInit(const BLE_GattHandleList *handleList, unsigned int flag); - -/* BLE㲥ƣ㲥ʱ䣬0:ֹͣ0xFFFFFFFF:һֱ㲥㲥ָʱֹͣλ */ -int BLE_CfgNetAdvCtrl(unsigned int advSecond); - -/* - * ¹㲥ɺBLE_CfgNetAdvCtrl㲥 - * ֵʱhilinkĹ㲥 - */ -int BLE_CfgNetAdvUpdate(const BLE_AdvInfo *advInfo); - -/* BLEϿӣֹʱռBLE */ -int BLE_CfgNetDisConnect(void); - -/* BLEûݣûݷͣջصʹ */ -int BLE_SendCustomData(BLE_DataType dataType, const unsigned char *buff, unsigned int len); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/gr551x/components/hilink/include/hilink_bt_api.h b/gr551x/components/hilink/include/hilink_bt_api.h deleted file mode 100755 index 97f845e..0000000 --- a/gr551x/components/hilink/include/hilink_bt_api.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved. - * Description: SDK APIͷļ - */ -#ifndef HILINK_BT_API_H -#define HILINK_BT_API_H - -#include "ble_cfg_net_api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Эջ־ */ -#define BLE_DEINIT_FALG 0x1234ABCD - -/* ƷϢṹ */ -typedef struct { - char *manuName; /* 豸̣ȷΧ0,4] */ - char *devName; /* 豸 */ - char *productId; /* 豸HiLink֤ţȷΧ0,5] */ - char *sn; /* 豸ΨһʶsnţȷΧ0,40] */ - char *mac; /* 豸MAC̶ַ32ֽ */ - char *subProductId; /* 豸productId */ - char *model; /* 豸ͺţȷΧ0,32] */ - char *devType; /* 豸ͣȷΧ0,4] */ - char *hiv; /* 豸HilinkЭ汾ȷΧ0,32] */ - int protType; /* 豸ЭͣȡֵΧ[1,3] */ -} HILINK_BT_DevInfo; - -/* ݻص */ -typedef int (*HILINK_BT_SendBtDataCallback)(const unsigned char *buf, unsigned int len); - -/* ʵЭջʹãעݷͽӿ */ -int HILINK_BT_RegisterBtDataSendCallback(HILINK_BT_SendBtDataCallback callback); - -/* ʵЭջʹãעOTAݷͽӿ */ -int HILINK_BT_RegisterOtaDataSendCallback(HILINK_BT_SendBtDataCallback callback); - -/* ʵЭջʹã */ -int HILINK_BT_ProcessBtData(const unsigned char *buf, unsigned int len); - -/* ʵЭջʹãOTAĿ */ -int HILINK_BT_ProcessOtaCtrl(const unsigned char *buf, unsigned int len); - -/* ʵЭջʹãOTAĴ */ -int HILINK_BT_ProcessOtaData(const unsigned char *buf, unsigned int len); - -/* ʵЭջʹãϿʱͷͨռԴ */ -void HILINK_BT_DisconnectFreeResource(void); - -/* ֵ0ֱ֧ؿغͶֵ֧ */ -int HILINK_BT_SupportLocalControl(void); - -/* 豸Ӳʱ̵õĽӿ */ -int HILINK_BT_HardRevoke(void); - -/* - * ȡ豸ǿźŷ书ǿȣǿλõȷԼʲԷ - * hilinkֹ֤üԷָĵpowerΪ - * λdbm豸ǿźǿֵ̲ʹֹ - * ܣӿֱӷ-1Ҫʹ֣ӿڷ0輰ʱЧ - * HILINK_BT_StartAdvertise()㲥 - */ -int HILINK_BT_GetDevSurfacePower(char *power); - -/* - * ȡ豸ͺţȹ̶ֽ - * subProdIdΪͺŵĻlenΪij - * Ʒͺţֽͺţ'\0', 0 - * ûжͺţ򷵻-1 - * ýӿ豸ʵ - * hilink sdkͬ壬˫ģģʽֻһݣṩңݲ̹淶 - */ -int HILINK_GetSubProdId(char *subProdId, int len); - -/* - * ȡ豸SN - * hilink sdkͬ壬˫ģģʽֻһݣṩңݲ̹淶 - */ -void HilinkGetDeviceSn(unsigned int len, char *sn); - -/* - * ȡ豸ذ汾 - * 0ʾ汾Żȡɹʾ汾Żȡʧ - * ע⣬˽ӿΪHiLinkڲú - * hilink sdkͬ壬˫ģģʽֻһݣṩңݲ̹淶 - */ -int getDeviceVersion(char **firmwareVer, char **softwareVer, char **hardwareVer); - -/* - * linuxϵͳдļ·,·Ȳܳ33ֽ, - * Ҫ洢·ǷʧԵģ汾Ӱ·ļ - */ -void HILINK_BT_SetConfigDirPath(const char *configDirPath); - -/* - * Զʽַ - * 0ʾʧ,ʾʵֽ - */ -int HILINK_BT_Printf(const char *format, ...); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/gr551x/components/hilink/include/hilink_bt_function.h b/gr551x/components/hilink/include/hilink_bt_function.h deleted file mode 100755 index a5b5360..0000000 --- a/gr551x/components/hilink/include/hilink_bt_function.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved. - * Description: SDK ܺͷļ - */ -#ifndef HILINK_BT_FUNCTION_H -#define HILINK_BT_FUNCTION_H - -#include "hilink_bt_api.h" -#include "ble_cfg_net_api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* 㲥󳤶 */ -#define ADV_VALUE_MAX_LEN 31 - -typedef enum { - HILINK_BT_SDK_STATUS_SVC_RUNNING = 0, /* */ - HILINK_BT_SDK_STATUS_DEINIT, /* ע */ - HILINK_BT_SDK_STATUS_NAME_SET_ABNORM, /* 쳣 */ - HILINK_BT_SDK_STATUS_DISCOVER_MODE_SET_ABNORM, /* ɷģʽ쳣 */ - HILINK_BT_SDK_STATUS_REG_APP_ABNORM, /* עBLEӦ쳣 */ - HILINK_BT_SDK_STATUS_SVC_CREATE_ABNORM, /* 񴴽쳣 */ - HILINK_BT_SDK_STATUS_CHAR_ADD_ABNORM, /* 쳣 */ - HILINK_BT_SDK_STATUS_DESC_ADD_ABNORM, /* 쳣 */ - HILINK_BT_SDK_STATUS_SVC_START_ABNORM, /* 쳣 */ - HILINK_BT_SDK_STATUS_ADV_PARA_SET_ABNORM, /* 㲥쳣 */ - HILINK_BT_SDK_STATUS_ADV_DATA_SET_ABNORM, /* 㲥쳣 */ - HILINK_BT_SDK_STATUS_ADV_START_ABNORM, /* 㲥쳣 */ -} HILINK_BT_SdkStatus; - -/* GATTS charȡֵ */ -typedef enum { - HILINK_BT_CHAR_PROP_WRITE_WITHOUT_RESP = 0x04, - HILINK_BT_CHAR_PROP_WRITE = 0x08, - HILINK_BT_CHAR_PROP_READ = 0x02, - HILINK_BT_CHAR_PROP_NOTIFY = 0x10, - HILINK_BT_CHAR_PROP_INDICATE = 0x20 -} HILINK_BT_CharProperty; - -/* GATTS charȨȡֵ */ -typedef enum { - HILINK_BT_CHAR_PERM_READ = 0x01, - HILINK_BT_CHAR_PERM_READ_ENCRYPTED = 0x02, - HILINK_BT_CHAR_PERM_READ_ENCRYPTED_MITM = 0x04, - HILINK_BT_CHAR_PERM_WRITE = 0x10, - HILINK_BT_CHAR_PERM_WRITE_ENCRYPTED = 0x20, - HILINK_BT_CHAR_PERM_WRITE_ENCRYPTED_MITM = 0x40, - HILINK_BT_CHAR_PERM_WRITE_SIGNED = 0x80, - HILINK_BT_CHAR_PERM_WRITE_SIGNED_MITM = 0x100, -} HILINK_BT_CharPermission; - -/* GATTS descȡֵ */ -typedef enum { - HILINK_BT_DESC_PERM_WRITE = 0x01, - HILINK_BT_DESC_PERM_READ = 0x02 -} HILINK_BT_DescPermission; - -/* ֵ: ͺ */ -typedef enum { - HILINK_BT_CMD_DATA_TYPE_INT, - HILINK_BT_CMD_DATA_TYPE_STR, -} HILINK_BT_CmdDataType; - -/* hilinkӦòݱ */ -typedef enum { - HILINK_BT_CMD_DATA_MODE_TLV = 0x00, /* TLVʽ: ͱռõĿռ */ - HILINK_BT_CMD_DATA_MODE_JSON = 0x01 /* JSONʽ: չԸãĬϸʽ */ -} HILINK_BT_CmdDataMode; - -/* SDK״̬ص */ -typedef void (*HILINK_BT_SdkEventCallBack)(HILINK_BT_SdkStatus event, const void *param); - -/* Զgatt¼ص */ -typedef int (*HILINK_BT_GattReadCallback)(unsigned char *out, unsigned int *outLen); - -/* Զgattд¼ص */ -typedef int (*HILINK_BT_GattWriteCallback)(const unsigned char *in, unsigned int inLen); - -/* Ʒṹ */ -typedef struct { - unsigned char attrIdx; - char *attr; - HILINK_BT_CmdDataType dataType; - int (*putFunc)(const void *data, unsigned int len); - int (*getFunc)(void *buf, unsigned int *bufLen, unsigned int len); -} HILINK_BT_AttrInfo; - -/* Ʒܶṹ */ -typedef struct { - unsigned char svcIdx; - char *service; - int (*putFunc)(const void *svc, const unsigned char *in, unsigned int inLen, - unsigned char **out, unsigned int *outLen); - int (*getFunc)(const void *svc, const unsigned char *in, unsigned int inLen, - unsigned char **out, unsigned int *outLen); - unsigned char attrNum; - HILINK_BT_AttrInfo *attrInfo; -} HILINK_BT_SvcInfo; - -/* ƷProfileṹ */ -typedef struct { - unsigned int svcNum; - HILINK_BT_SvcInfo *svcInfo; -} HILINK_BT_Profile; - -/* gatt character */ -typedef struct { - char *descUuid; - /* gattдȨޣȡֵHILINK_BT_DescPermission͵ijԱó */ - unsigned int descPermission; -} HILINK_BT_GattProfileDesc; - -/* gatt character */ -typedef struct { - char *charUuid; - /* gatt charȨ:ȡֵHILINK_BT_CharPermission͵ijԱó */ - unsigned int charPermission; - /* gatt char:ȡֵHILINK_BT_CharProperty͵ijԱó */ - unsigned int charProperty; - HILINK_BT_GattReadCallback readFunc; - HILINK_BT_GattWriteCallback writeFunc; - HILINK_BT_GattProfileDesc *desc; - unsigned char descNum; -} HILINK_BT_GattProfileChar; - -/* gatt */ -typedef struct { - char *svcUuid; - int isPrimary; - HILINK_BT_GattProfileChar *character; - unsigned char charNum; -} HILINK_BT_GattProfileSvc; - -/* Զgattб */ -typedef struct { - HILINK_BT_GattProfileSvc *service; - unsigned char serviceNum; -} HILINK_BT_GattServiceList; - -/* ñصṹ */ -typedef struct { - int (*createItem)(const char *name, unsigned int size); - int (*readItem)(const char *name, unsigned char *buf, unsigned int len); - int (*writeItem)(const char *name, const unsigned char *buf, unsigned int len); - int (*deleteItem)(const char *name); - int (*destroyConfMgr)(void); - int (*getHichainFlashAddr)(unsigned int *start, unsigned int *size); -} HILINK_BT_ConfigInterface; - -/* ȡ㲥ݽṹ */ -typedef struct { - unsigned int advSvcDataLen; - unsigned char advSvcData[ADV_VALUE_MAX_LEN]; - unsigned int advRspDataLen; - unsigned char advRspData[ADV_VALUE_MAX_LEN]; -} HILINK_BT_AdvertiseData; - -/* Ӧòģʽ */ -int HILINK_BT_SetEncodeMode(HILINK_BT_CmdDataMode mode); - -/* ѯӦòģʽ */ -HILINK_BT_CmdDataMode HILINK_BT_GetEncodeMode(void); - -/* ʼHiLink Bluetooth SDK */ -int HILINK_BT_Init(const HILINK_BT_Profile *profile); - -/* HiLink BT SDKHiLinkЭջ */ -int HILINK_BT_Process(void); - -/* - * HiLink Bluetooth SDK - * flagΪ0ֻٿƺ͵̣߳flagΪ1Эջú - */ -int HILINK_BT_DeInit(unsigned int flag); - -/* HiLinkϢserviceϢ */ -int HILINK_BT_AddHiLilnkService(const HILINK_BT_SvcInfo *serviceArray, unsigned int serviceNum); - -/* ֪ͨ״̬ */ -int HILINK_BT_ReportServiceState(const void *service, const void *buf, unsigned int len); - -/* ֪ͨ״̬ */ -int HILINK_BT_ReportAttrState(const void *svc, const void *attr, const void *buf, unsigned int len); - -/* ѯݷͽӿ */ -HILINK_BT_SendBtDataCallback HILINK_BT_GetBtDataSendCallback(void); - -/* ѯOTAݷͽӿ */ -HILINK_BT_SendBtDataCallback HILINK_BT_GetOtaDataSendCallback(void); - -/* SDK¼ */ -int HILINK_BT_SetSdkEventCallback(HILINK_BT_SdkEventCallBack callback); - -/* - * BLE - * connNumķΧΪ[1,10] - * Ϊ101010ִ - * СΪ1С11ִ - * øýӿڣĬΪ1 - */ -void HILINK_BT_SetMaxConnNum(int connNum); - -/* ѯSDK */ -int HILINK_BT_GetMaxConnNum(void); - -/* SDKԶgatt */ -int HILINK_BT_SetGattProfile(HILINK_BT_GattServiceList *gattServiceList); - -/* עñصHiLink Bluetooth SDKøúĬʹHiLink Bluetooth SDKʵ */ -int HILINK_BT_RegisterConfigInterface(const HILINK_BT_ConfigInterface *interface); - -/* 㲥 */ -int HILINK_BT_StartAdvertise(void); - -/* ֹͣ㲥 */ -int HILINK_BT_StopAdvertise(void); - -/* ϱ */ -int HILINK_BT_IndicateSvcCharData(const char *svcUuid, const char *charUuid, const char *buf, unsigned int len); - -/* ȡSDK豸Ϣ */ -HILINK_BT_DevInfo *HILINK_BT_GetDevInfo(void); - -/* ȡй㲥 */ -int HILINK_BT_GetAdvertiseData(HILINK_BT_AdvertiseData *advertiseData); - -/* ȡBLEעĻص */ -BLE_CfgNetCb *GetBleCfgNetCallback(void); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/gr551x/components/hilink/include/hilink_bt_netcfg_api.h b/gr551x/components/hilink/include/hilink_bt_netcfg_api.h deleted file mode 100755 index 56fa3c1..0000000 --- a/gr551x/components/hilink/include/hilink_bt_netcfg_api.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved. - * Description: 蓝牙SDK配网API头文件 - */ - -#ifndef HILINK_BT_NETCFG_API_H -#define HILINK_BT_NETCFG_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef int (*HILINK_BT_ProcessNetCfgCb)(const unsigned char *in, unsigned int inLen, - unsigned char *out, unsigned int outLen); - -/* 启动配网 */ -int HILINK_BT_StartNetCfg(void); - -/* 停止配网 */ -int HILINK_BT_StopNetCfg(void); - -/* 通知配网状态 */ -int HILINK_BT_NotifyNetCfgStatus(int status); - -/* 注册接收到配网信息的处理函数 */ -int HILINK_BT_RegisterNetCfgDataCb(HILINK_BT_ProcessNetCfgCb callback); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/gr551x/components/hilink/release/libhilinkbtsdk.a b/gr551x/components/hilink/release/libhilinkbtsdk.a deleted file mode 100755 index 23984dd..0000000 Binary files a/gr551x/components/hilink/release/libhilinkbtsdk.a and /dev/null differ diff --git a/gr551x/components/watchdog/hi_watchdog.h b/gr551x/components/watchdog/hi_watchdog.h old mode 100644 new mode 100755 diff --git a/gr551x/drivers/BUILD.gn b/gr551x/drivers/BUILD.gn old mode 100644 new mode 100755 index e24ed96..256df5e --- a/gr551x/drivers/BUILD.gn +++ b/gr551x/drivers/BUILD.gn @@ -11,16 +11,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//drivers/adapter/khdf/liteos/hdf.gni") +import("//build/lite/config/component/lite_component.gni") +import("drivers.gni") + group("drivers") { - public_deps = [ - ] - deps = [ - "uart", - ] + + public_deps = [] + + if (hdf_drivers_gpio_enable) { + public_deps += [ "gpio:gpio" ] + } + + if (hdf_drivers_uart_enable) { + public_deps += [ "uart:uart" ] + } } -config("public") { - configs = [ "cfiflash:public" ] -} + diff --git a/gr551x/drivers/drivers.gni b/gr551x/drivers/drivers.gni new file mode 100755 index 0000000..62b8104 --- /dev/null +++ b/gr551x/drivers/drivers.gni @@ -0,0 +1,39 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/lite/config/component/lite_component.gni") + +declare_args() { + hdf_drivers_gpio_enable = true + hdf_drivers_uart_enable = true +} + +hdf_include_dirs = [ + "//drivers/adapter/khdf/liteos_m/osal/include/", + "//drivers/adapter/khdf/liteos/platform/include/", + "//drivers/framework/ability/sbuf/include", + "//drivers/framework/include", + "//drivers/framework/include/osal", + "//drivers/framework/include/config", + "//drivers/framework/include/core", + "//drivers/framework/include/platform", + "//drivers/framework/include/utils", + "//drivers/framework/core/host/include", + "//drivers/framework/core/shared/include", + "//drivers/framework/core/common/include/host", + "//drivers/framework/utils/include", + "//drivers/framework/include/platform", + "//drivers/framework/support/platform/include", + "//drivers/framework/support/platform/include/fwk", + "//drivers/framework/support/platform/include/common", +] diff --git a/gr551x/drivers/gpio/BUILD.gn b/gr551x/drivers/gpio/BUILD.gn new file mode 100755 index 0000000..47958e6 --- /dev/null +++ b/gr551x/drivers/gpio/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/lite/config/component/lite_component.gni") +import("../drivers.gni") + +static_library("gpio") { + sources = [ "gpio_gr55xx.c" ] + + include_dirs = hdf_include_dirs +} diff --git a/gr551x/drivers/gpio/gpio_gr55xx.c b/gr551x/drivers/gpio/gpio_gr55xx.c new file mode 100755 index 0000000..47e9fd1 --- /dev/null +++ b/gr551x/drivers/gpio/gpio_gr55xx.c @@ -0,0 +1,573 @@ +/* + * Copyright (c) 2021 GOODIX. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "app_io.h" +#include "app_gpiote.h" +#include "device_resource_if.h" +#include "gpio/gpio_core.h" +#include "hdf_device_desc.h" +#include "hdf_log.h" +#include "stdio.h" + +#define HDF_LOG_TAG gpio_gr55xx +#define GR55_IO_NUM_GPIO 32 +#define GR55_IO_NUM_AON 8 +#define GR55_IO_NUM_MSIO 5 +#define GR55_IO_NUM_MAX (GR55_IO_NUM_GPIO + GR55_IO_NUM_AON + GR55_IO_NUM_MSIO) + +#define GR55_IO_BASE_GPIO 0 +#define GR55_IO_BASE_AON GR55_IO_NUM_GPIO +#define GR55_IO_BASE_MSIO (GR55_IO_NUM_GPIO + GR55_IO_NUM_AON) + +#define GR55_IO_PULL_DEFAULT APP_IO_PULLUP +#define GR55_IO_MODE_DEFAULT APP_IO_MODE_OUT_PUT + +// #define HDF_LOGI printf +// #define HDF_LOGE printf +// #define GR55_GPIO_DEBUG + +struct Gr55xxGpioPortConfig { + app_io_mode_t mode; + app_io_pull_t pull; + GpioIrqFunc irqFunc; + app_handle_mode_t handleMode; + void *arg; +}; + +struct Gr55xxGpioCntlr { + struct GpioCntlr cntlr; +}; + +static struct Gr55xxGpioCntlr s_gr55xxGpioCntlr; + +struct Gr55xxGpioPortConfig s_portCfg[GR55_IO_NUM_MAX]; + +static inline struct Gr55xxGpioCntlr *ToGr55xxGpioCntlr(struct GpioCntlr *cntlr) +{ + return (struct Gr55xxGpioCntlr *)cntlr; +} + +static inline app_io_type_t Gr55xxPinMap(uint32_t id, uint32_t *pin) +{ + if (id < GR55_IO_BASE_AON) + { + *pin = 1 << (id - GR55_IO_BASE_GPIO); + return APP_IO_TYPE_NORMAL; + } + else if (id < GR55_IO_BASE_MSIO) + { + *pin = 1 << (id - GR55_IO_BASE_AON); + return APP_IO_TYPE_AON; + } + else + { + *pin = 1 << (id - GR55_IO_BASE_MSIO); + return APP_IO_TYPE_MSIO; + } +} + +static void Gr55xxPortConfigInit(void) +{ + uint16_t cnt; + + for (cnt = 0; cnt < GR55_IO_NUM_MAX; cnt++) + { + s_portCfg[cnt].irqFunc = NULL; + s_portCfg[cnt].arg = NULL; + s_portCfg[cnt].pull = GR55_IO_PULL_DEFAULT; + s_portCfg[cnt].mode = GR55_IO_MODE_DEFAULT; + s_portCfg[cnt].handleMode = APP_IO_NONE_WAKEUP; + } +} + +static int32_t Gr55xxGpioSetDir(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t dir) +{ + uint32_t pin = 0; + app_io_init_t io_init; + app_io_type_t io_type; + + if (gpio >= GR55_IO_NUM_MAX) + { + return HDF_ERR_INVALID_PARAM; + } + + io_type = Gr55xxPinMap(gpio, &pin); + io_init.pin = pin; + io_init.pull = s_portCfg[gpio].pull; + io_init.mux = APP_IO_MUX_7; + io_init.mode = GR55_IO_MODE_DEFAULT; + + if (dir == GPIO_DIR_IN) + { + io_init.mode = APP_IO_MODE_INPUT; + } + else if (dir == GPIO_DIR_OUT) + { + io_init.mode = APP_IO_MODE_OUT_PUT; + } + + s_portCfg[gpio].mode = io_init.mode; + + if (APP_DRV_SUCCESS == app_io_init(io_type, &io_init)) + { + return HDF_SUCCESS; + } + else + { + return HDF_FAILURE; + } +} + +static int32_t Gr55xxGpioGetDir(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t *dir) +{ + if (gpio >= GR55_IO_NUM_MAX) + { + return HDF_ERR_INVALID_PARAM; + } + + *dir = s_portCfg[gpio].mode; + + return HDF_SUCCESS; +} + +static int32_t Gr55xxGpioWrite(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t val) +{ + uint32_t pin = 0; + app_io_type_t io_type; + + if (gpio >= GR55_IO_NUM_MAX) + { + return HDF_ERR_INVALID_PARAM; + } + + io_type = Gr55xxPinMap(gpio, &pin); + + if (val == GPIO_VAL_LOW) + { + app_io_write_pin(io_type, pin, APP_IO_PIN_RESET); + } + else if (val == GPIO_VAL_HIGH) + { + app_io_write_pin(io_type, pin, APP_IO_PIN_SET); + } + + return HDF_SUCCESS; +} + +static int32_t Gr55xxGpioRead(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t *val) +{ + uint32_t pin = 0; + app_io_type_t io_type; + app_io_pin_state_t io_state; + + if (gpio >= GR55_IO_NUM_MAX) + { + return HDF_ERR_INVALID_PARAM; + } + + io_type = Gr55xxPinMap(gpio, &pin); + io_state = app_io_read_pin(io_type, pin); + + if (APP_IO_PIN_RESET == io_state) + { + *val = GPIO_VAL_LOW; + } + else + { + *val = GPIO_VAL_HIGH; + } + + return HDF_SUCCESS; +} + +static int get_pin_index(uint32_t pin) +{ + int index = 0; + while ((pin & 1) != 1) + { + index++; + pin = pin >> 1; + } + return index; +} + +static void app_io_callback(app_gpiote_evt_t *p_evt) +{ + uint32_t gpio = 0; + + if (p_evt->type == APP_IO_TYPE_NORMAL) + { + gpio = get_pin_index(p_evt->pin); + } + else if (p_evt->type == APP_IO_TYPE_AON) + { + gpio = get_pin_index(p_evt->pin) + GR55_IO_BASE_AON; + } + else + { + HDF_LOGE("%s, type error", __func__); + } + + if (s_portCfg[gpio].irqFunc != NULL) + { + HDF_LOGI("%s, Func@[%p], arg@[%p]\r\n", __func__, s_portCfg[gpio].irqFunc, s_portCfg[gpio].arg); + s_portCfg[gpio].irqFunc(gpio, s_portCfg[gpio].arg); + } +} + +static void Gr55xxGpioteDebug(const char *pfunc, app_gpiote_param_t *pgpiote_param) +{ +#ifdef GR55_GPIO_DEBUG + HDF_LOGI("%s, type: [%d]\r\n", pfunc, pgpiote_param->type); + HDF_LOGI("%s, pin : [%d]\r\n", pfunc, pgpiote_param->pin); + HDF_LOGI("%s, mode: [%d]\r\n", pfunc, pgpiote_param->mode); + HDF_LOGI("%s, handle_mode: [%d]\r\n", pfunc, pgpiote_param->handle_mode); + HDF_LOGI("%s, io_evt_cb: [%p]\r\n", pfunc, pgpiote_param->io_evt_cb); +#else + (void)pgpiote_param; +#endif +} + +static int32_t Gr55xxGpioEnableIrq(struct GpioCntlr *cntlr, uint16_t gpio) +{ + uint32_t pin = 0; + app_io_type_t io_type; + app_gpiote_param_t gpiote_param; + + if (gpio >= GR55_IO_NUM_MAX) + { + return HDF_ERR_INVALID_PARAM; + } + + if (NULL == s_portCfg[gpio].irqFunc) + { + return HDF_FAILURE; + } + + io_type = Gr55xxPinMap(gpio, &pin); + gpiote_param.type = io_type; + gpiote_param.pin = pin; + gpiote_param.pull = s_portCfg[gpio].pull; + gpiote_param.mode = s_portCfg[gpio].mode; + gpiote_param.handle_mode = s_portCfg[gpio].handleMode; + gpiote_param.io_evt_cb = app_io_callback; + + Gr55xxGpioteDebug(__func__, &gpiote_param); + + app_gpiote_init(&gpiote_param, 1); + + HDF_LOGI("%s: io irq(%u@%p) enabled!", __func__, gpio, s_portCfg[gpio].irqFunc); + return HDF_SUCCESS; +} + +static int32_t Gr55xxGpioDisableIrq(struct GpioCntlr *cntlr, uint16_t gpio) +{ + uint32_t pin = 0; + app_io_type_t io_type; + app_gpiote_param_t gpiote_param; + + if (gpio >= GR55_IO_NUM_MAX) + { + return HDF_ERR_INVALID_PARAM; + } + + if (NULL == s_portCfg[gpio].irqFunc) + { + return HDF_FAILURE; + } + + io_type = Gr55xxPinMap(gpio, &pin); + gpiote_param.type = io_type; + gpiote_param.pin = pin; + gpiote_param.pull = s_portCfg[gpio].pull; + gpiote_param.mode = s_portCfg[gpio].mode; + gpiote_param.handle_mode = APP_IO_NONE_WAKEUP; + gpiote_param.io_evt_cb = NULL; + + Gr55xxGpioteDebug(__func__, &gpiote_param); + + app_gpiote_init(&gpiote_param, 1); + + HDF_LOGI("%s: io irq(%u@%p) disabled!", __func__, gpio, s_portCfg[gpio].irqFunc); + return HDF_SUCCESS; +} + +static int32_t Gr55xxGpioSetIrq(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t mode, + GpioIrqFunc func, void *arg) +{ + uint32_t pin = 0; + app_io_type_t io_type; + app_gpiote_param_t gpiote_param; + + if ((gpio >= GR55_IO_NUM_MAX) || (NULL == func)) + { + return HDF_ERR_INVALID_PARAM; + } + + io_type = Gr55xxPinMap(gpio, &pin); + if (APP_IO_TYPE_MSIO == io_type) + { + HDF_LOGE("%s, IO type not support", __func__); + return HDF_ERR_INVALID_PARAM; + } + + switch (mode) + { + case GPIO_IRQ_TRIGGER_RISING: + s_portCfg[gpio].mode = APP_IO_MODE_IT_RISING; + break; + case GPIO_IRQ_TRIGGER_FALLING: + s_portCfg[gpio].mode = APP_IO_MODE_IT_FALLING; + break; + case GPIO_IRQ_TRIGGER_HIGH: + s_portCfg[gpio].mode = APP_IO_MODE_IT_HIGH; + break; + case GPIO_IRQ_TRIGGER_LOW: + s_portCfg[gpio].mode = APP_IO_MODE_IT_LOW; + break; + default: + HDF_LOGE("%s, IRQ mode not support", __func__); + return HDF_ERR_INVALID_PARAM; + } + + s_portCfg[gpio].irqFunc = func; + s_portCfg[gpio].arg = arg; + + gpiote_param.mode = s_portCfg[gpio].mode; + gpiote_param.io_evt_cb = app_io_callback; + + Gr55xxGpioteDebug(__func__, &gpiote_param); + //app_gpiote_init(&gpiote_param, 1); + + HDF_LOGI("%s: io irq(%u@%p) registered!", __func__, gpio, func); + return HDF_SUCCESS; +} + +static int32_t Gr55xxGpioUnsetIrq(struct GpioCntlr *cntlr, uint16_t gpio) +{ + uint32_t pin = 0; + app_io_type_t io_type; + app_gpiote_param_t gpiote_param; + + if (gpio >= GR55_IO_NUM_MAX) + { + return HDF_ERR_INVALID_PARAM; + } + + if (NULL == s_portCfg[gpio].irqFunc) + { + return HDF_SUCCESS; + } + + s_portCfg[gpio].irqFunc = NULL; + s_portCfg[gpio].arg = NULL; + + io_type = Gr55xxPinMap(gpio, &pin); + gpiote_param.type = io_type; + gpiote_param.pin = pin; + gpiote_param.mode = s_portCfg[gpio].mode; + gpiote_param.pull = s_portCfg[gpio].pull; + gpiote_param.handle_mode = APP_IO_NONE_WAKEUP; + gpiote_param.io_evt_cb = NULL; + + Gr55xxGpioteDebug(__func__, &gpiote_param); + app_gpiote_init(&gpiote_param, 1); + + return HDF_SUCCESS; +} + +static struct GpioMethod g_method = { + .request = NULL, + .release = NULL, + .write = Gr55xxGpioWrite, + .read = Gr55xxGpioRead, + .setDir = Gr55xxGpioSetDir, + .getDir = Gr55xxGpioGetDir, + .toIrq = NULL, + .setIrq = Gr55xxGpioSetIrq, + .unsetIrq = Gr55xxGpioUnsetIrq, + .enableIrq = Gr55xxGpioEnableIrq, + .disableIrq = Gr55xxGpioDisableIrq, +}; + +static int32_t Gr55xxGpioInitCntlrMem(struct Gr55xxGpioCntlr *gr55Gpio) +{ + (void)gr55Gpio; + return HDF_SUCCESS; +} + +static void Gr55xxGpioRleaseCntlrMem(struct Gr55xxGpioCntlr *gr55Gpio) +{ + (void)gr55Gpio; +} + +static int32_t Gr55xxGpioReadDrs(struct Gr55xxGpioCntlr *gr55Gpio, const struct DeviceResourceNode *node) +{ + int32_t ret; + uint16_t configNum = 0; + uint16_t gpioIndex; + uint16_t pullConfig; + uint16_t handleModeConfig; + struct DeviceResourceIface *drsOps = NULL; + + drsOps = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE); + if (drsOps == NULL || drsOps->GetUint16 == NULL || drsOps->GetUint16ArrayElem == NULL) { + HDF_LOGE("%s: invalid drs ops fail!", __func__); + return HDF_FAILURE; + } + + ret = drsOps->GetUint16(node, "configNum", &configNum, 0); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: read configNum fail!", __func__); + return ret; + } + + if (configNum >= GR55_IO_NUM_MAX) { + HDF_LOGE("%s: configNum(%d) invalid!", __func__, configNum); + return HDF_ERR_INVALID_PARAM; + } + + for (size_t i = 0; i < configNum; i++) + { + ret = drsOps->GetUint16ArrayElem(node, "gpioIndex", i, &gpioIndex, 0); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: read gpioIndex fail!", __func__); + return ret; + } + + ret = drsOps->GetUint16ArrayElem(node, "pull", i, &pullConfig, 0); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: read regStep fail!", __func__); + return ret; + } + + ret = drsOps->GetUint16ArrayElem(node, "handleMode", i, &handleModeConfig, 0); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: read handleModeConfig fail!", __func__); + return ret; + } + + if (gpioIndex >= GR55_IO_NUM_MAX) { + HDF_LOGE("%s: gpioIndex(%d) invalid!", __func__, gpioIndex); + return HDF_ERR_INVALID_PARAM; + } + + if (pullConfig >= APP_IO_PULL_MAX) { + HDF_LOGE("%s: pullConfig(%d) invalid!", __func__, pullConfig); + return HDF_ERR_INVALID_PARAM; + } + + if (handleModeConfig > APP_IO_ENABLE_WAKEUP) { + HDF_LOGE("%s: handleModeConfig(%d) invalid!", __func__, handleModeConfig); + return HDF_ERR_INVALID_PARAM; + } + + s_portCfg[gpioIndex].pull = pullConfig; + s_portCfg[gpioIndex].handleMode = handleModeConfig; + } + + return HDF_SUCCESS; +} + +static void Gr55xxGpioDebugCntlr(const struct Gr55xxGpioCntlr *gr55Gpio) +{ + (void)gr55Gpio; +} + +static int32_t GR55xxGpioBind(struct HdfDeviceObject *device) +{ + (void)device; + + HDF_LOGI("%s: Enter", __func__); + + return HDF_SUCCESS; +} + +static int32_t GR55xxGpioInit(struct HdfDeviceObject *device) +{ + int32_t ret; + struct Gr55xxGpioCntlr *gr55Gpio = &s_gr55xxGpioCntlr; + + HDF_LOGI("%s: Enter", __func__); + if (device == NULL || device->property == NULL) { + HDF_LOGE("%s: device or property null!", __func__); + return HDF_ERR_INVALID_OBJECT; + } + + Gr55xxPortConfigInit(); + + ret = Gr55xxGpioReadDrs(gr55Gpio, device->property); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: read drs fail:%d", __func__, ret); + return ret; + } + + ret = Gr55xxGpioInitCntlrMem(gr55Gpio); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: err init cntlr mem:%d", __func__, ret); + return ret; + } + + gr55Gpio->cntlr.count = GR55_IO_NUM_MAX; + gr55Gpio->cntlr.priv = (void *)device->property; + gr55Gpio->cntlr.ops = &g_method; + gr55Gpio->cntlr.device.hdfDev = device; + ret = GpioCntlrAdd(&gr55Gpio->cntlr); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: err add controller:%d", __func__, ret); + return ret; + } + + Gr55xxGpioDebugCntlr(gr55Gpio); + + HDF_LOGI("%s: dev service:%s init success!", __func__, HdfDeviceGetServiceName(device)); + return HDF_SUCCESS; +} + +static void GR55xxGpioRelease(struct HdfDeviceObject *device) +{ + struct GpioCntlr *cntlr = NULL; + struct Gr55xxGpioCntlr *gr55Gpio = NULL; + + HDF_LOGI("%s, Enter\r\n", __func__); + + if (device == NULL) { + HDF_LOGE("%s: device is null!", __func__); + return; + } + + cntlr = GpioCntlrFromDevice(device); + if (cntlr == NULL) { + HDF_LOGE("%s: no service binded!", __func__); + return; + } + + GpioCntlrRemove(cntlr); + + app_gpiote_deinit(); + + gr55Gpio = ToGr55xxGpioCntlr(cntlr); + Gr55xxGpioRleaseCntlrMem(gr55Gpio); +} + +struct HdfDriverEntry g_gpioDriverEntry = { + .moduleVersion = 1, + .moduleName = "HDF_PLATFORM_GPIO", + .Bind = GR55xxGpioBind, + .Init = GR55xxGpioInit, + .Release = GR55xxGpioRelease, +}; + +HDF_INIT(g_gpioDriverEntry); diff --git a/gr551x/drivers/uart/BUILD.gn b/gr551x/drivers/uart/BUILD.gn new file mode 100755 index 0000000..5b295d8 --- /dev/null +++ b/gr551x/drivers/uart/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/lite/config/component/lite_component.gni") +import("../drivers.gni") + +static_library("uart") { + sources = [ "uart_gr55xx.c" ] + + include_dirs = hdf_include_dirs +} + diff --git a/gr551x/drivers/uart/uart_gr55xx.c b/gr551x/drivers/uart/uart_gr55xx.c new file mode 100755 index 0000000..6f5bddf --- /dev/null +++ b/gr551x/drivers/uart/uart_gr55xx.c @@ -0,0 +1,681 @@ +/* + * Copyright (c) 2021 GOODIX. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "los_sem.h" +#include "device_resource_if.h" +#include "hdf_base.h" +#include "hdf_log.h" +#include "osal_mem.h" +#include "osal_time.h" +#include "uart/uart_core.h" +#include "uart_if.h" +#include "uart_gr55xx.h" + +#define HDF_LOG_TAG uart_gr55xx + +// #define HDF_LOGI printf +// #define HDF_LOGE printf +// #define GR55_UART_DEBUG + +static uint32_t uart_rx_sem[APP_UART_ID_MAX]; +static uint32_t uart_tx_mutex[APP_UART_ID_MAX]; +static uint32_t uart_rx_mutex[APP_UART_ID_MAX]; +static uint32_t g_rx_num[APP_UART_ID_MAX]; + +static void app_uart0_callback(app_uart_evt_t *p_evt); +static void app_uart1_callback(app_uart_evt_t *p_evt); +static void Gr55xxUartDeviceDump(struct UartDriverData *udd); + +static const app_uart_evt_handler_t *evt_handler[APP_UART_ID_MAX] = { + app_uart0_callback, + app_uart1_callback +}; + +static void app_uart0_callback(app_uart_evt_t *p_evt) +{ + if (p_evt->type == APP_UART_EVT_RX_DATA) { + g_rx_num[APP_UART_ID_0] = p_evt->data.size; + LOS_SemPost(uart_rx_sem[APP_UART_ID_0]); + } else if (p_evt->type == APP_UART_EVT_ERROR) { + LOS_SemPost(uart_rx_sem[APP_UART_ID_0]); + } +} + +static void app_uart1_callback(app_uart_evt_t *p_evt) +{ + if (p_evt->type == APP_UART_EVT_RX_DATA) { + g_rx_num[APP_UART_ID_1] = p_evt->data.size; + LOS_SemPost(uart_rx_sem[APP_UART_ID_1]); + } else if (p_evt->type == APP_UART_EVT_ERROR) { + LOS_SemPost(uart_rx_sem[APP_UART_ID_1]); + } +} + +static int32_t Gr55xxUartConfig(struct UartDriverData *udd) +{ + uint32_t ret; + app_uart_params_t *params = NULL; + if (NULL == udd) + return HDF_FAILURE; + + params = &udd->params; + params->id = udd->id; + params->init.baud_rate = udd->baudrate; + + switch (udd->attr.dataBits) + { + case UART_ATTR_DATABIT_5: + params->init.data_bits = UART_DATABITS_5; + break; + case UART_ATTR_DATABIT_6: + params->init.data_bits = UART_DATABITS_6; + break; + case UART_ATTR_DATABIT_7: + params->init.data_bits = UART_DATABITS_7; + break; + case UART_ATTR_DATABIT_8: + default: + params->init.data_bits = UART_DATABITS_8; + break; + } + + switch (udd->attr.stopBits) + { + default: + case UART_ATTR_STOPBIT_1: + params->init.stop_bits = UART_STOPBITS_1; + break; + case UART_ATTR_STOPBIT_1P5: + params->init.stop_bits = UART_STOPBITS_1_5; + break; + case UART_ATTR_STOPBIT_2: + params->init.stop_bits = UART_STOPBITS_2; + break; + } + + switch (udd->attr.parity) + { + default: + case UART_ATTR_PARITY_NONE: + params->init.parity = UART_PARITY_NONE; + break; + case UART_ATTR_PARITY_ODD: + params->init.parity = UART_PARITY_ODD; + break; + case UART_ATTR_PARITY_EVEN: + params->init.parity = UART_PARITY_EVEN; + break; + } + + ret = app_uart_init(params, udd->eventCallback, &udd->txBuffer); + if (ret != 0) { + HDF_LOGE("%s , app uart init failed\r\n", __func__); + return HDF_FAILURE; + } + + Gr55xxUartDeviceDump(udd); + + return HDF_SUCCESS; +} + +static int32_t Gr55xxRead(struct UartHost *host, uint8_t *data, uint32_t size) +{ + int32_t ret; + uint32_t uwRet = 0; + struct UartDriverData *udd = NULL; + + if (host == NULL || host->priv == NULL) { + HDF_LOGE("%s: invalid parameter", __func__); + return HDF_ERR_INVALID_PARAM; + } + udd = (struct UartDriverData *)host->priv; + if (udd->state != UART_STATE_USEABLE) { + return HDF_FAILURE; + } + + LOS_MuxPend(uart_rx_mutex[udd->id], LOS_WAIT_FOREVER); + + g_rx_num[udd->id] = 0; + LOS_SemPend(uart_rx_sem[udd->id], 0); + ret = app_uart_receive_async(udd->id, data, size); + if (ret != 0) { + LOS_MuxPost(uart_rx_mutex[udd->id]); + return HDF_FAILURE; + } + + uwRet = LOS_SemPend(uart_rx_sem[udd->id], LOS_WAIT_FOREVER); + if (uwRet != LOS_OK) { + LOS_MuxPost(uart_rx_mutex[udd->id]); + return HDF_FAILURE; + } + + LOS_MuxPost(uart_rx_mutex[udd->id]); + + return g_rx_num[udd->id]; +} + +static int32_t Gr55xxWrite(struct UartHost *host, uint8_t *data, uint32_t size) +{ + int32_t ret; + struct UartDriverData *udd = NULL; + + if (host == NULL || host->priv == NULL) { + HDF_LOGE("%s: invalid parameter", __func__); + return HDF_ERR_INVALID_PARAM; + } + udd = (struct UartDriverData *)host->priv; + if (udd->state != UART_STATE_USEABLE) { + return HDF_FAILURE; + } + + LOS_MuxPend(uart_tx_mutex[udd->id], LOS_WAIT_FOREVER); + ret = app_uart_transmit_sync(udd->id, data, size, 1000); + if (ret != 0) { + LOS_MuxPost(uart_tx_mutex[udd->id]); + HDF_LOGE("uart_%d send %d data failed", udd->id, size); + return HDF_FAILURE; + } + LOS_MuxPost(uart_tx_mutex[udd->id]); + + HDF_LOGI("uart_%d send %d data success", udd->id, size); + + return HDF_SUCCESS; +} + +static int32_t Gr55xxGetBaud(struct UartHost *host, uint32_t *baudRate) +{ + struct UartDriverData *udd = NULL; + + if (host == NULL || host->priv == NULL || baudRate == NULL) { + HDF_LOGE("%s: invalid parameter", __func__); + return HDF_ERR_INVALID_PARAM; + } + + udd = (struct UartDriverData *)host->priv; + if (udd->state != UART_STATE_USEABLE) { + return HDF_FAILURE; + } + *baudRate = udd->baudrate; + + return HDF_SUCCESS; +} + +static int32_t Gr55xxSetBaud(struct UartHost *host, uint32_t baudRate) +{ + struct UartDriverData *udd = NULL; + + if (host == NULL || host->priv == NULL) { + HDF_LOGE("%s: invalid parameter", __func__); + return HDF_ERR_INVALID_PARAM; + } + + udd = (struct UartDriverData *)host->priv; + if (udd->state != UART_STATE_USEABLE) { + return HDF_FAILURE; + } + if ((baudRate > 0) && (baudRate <= CONFIG_MAX_BAUDRATE)) { + udd->baudrate = baudRate; + if (udd->config == NULL) { + HDF_LOGE("%s: not support", __func__); + return HDF_ERR_NOT_SUPPORT; + } + if (udd->config(udd) != HDF_SUCCESS) { + HDF_LOGE("%s: config baudrate %d failed", __func__, baudRate); + return HDF_FAILURE; + } + } else { + HDF_LOGE("%s: invalid baudrate, which is:%d", __func__, baudRate); + return HDF_FAILURE; + } + + return HDF_SUCCESS; +} + +static int32_t Gr55xxGetAttribute(struct UartHost *host, struct UartAttribute *attribute) +{ + struct UartDriverData *udd = NULL; + + if (host == NULL || host->priv == NULL || attribute == NULL) { + HDF_LOGE("%s: invalid parameter", __func__); + return HDF_ERR_INVALID_PARAM; + } + udd = (struct UartDriverData *)host->priv; + if (udd->state != UART_STATE_USEABLE) { + return HDF_FAILURE; + } + + *attribute = udd->attr; + + return HDF_SUCCESS; +} + +static int32_t Gr55xxSetAttribute(struct UartHost *host, struct UartAttribute *attribute) +{ + struct UartDriverData *udd = NULL; + + if (host == NULL || host->priv == NULL || attribute == NULL) { + HDF_LOGE("%s: invalid parameter", __func__); + return HDF_ERR_INVALID_PARAM; + } + udd = (struct UartDriverData *)host->priv; + if (udd->state != UART_STATE_USEABLE) { + return HDF_FAILURE; + } + + udd->attr = *attribute; + if (udd->config == NULL) { + HDF_LOGE("%s: not support", __func__); + return HDF_ERR_NOT_SUPPORT; + } + if (udd->config(udd) != HDF_SUCCESS) { + HDF_LOGE("%s: config failed", __func__); + return HDF_FAILURE; + } + + return HDF_SUCCESS; +} + +static int32_t Gr55xxSetTransMode(struct UartHost *host, enum UartTransMode mode) +{ + struct UartDriverData *udd = NULL; + + if (host == NULL || host->priv == NULL) { + HDF_LOGE("%s: invalid parameter", __func__); + return HDF_ERR_INVALID_PARAM; + } + + udd = (struct UartDriverData *)host->priv; + if (udd->state != UART_STATE_USEABLE) { + return HDF_FAILURE; + } + if (mode == UART_MODE_RD_BLOCK) { + udd->flags |= UART_FLG_RD_BLOCK; + } else if (mode == UART_MODE_RD_NONBLOCK) { + // udd->flags &= ~UART_FLG_RD_BLOCK; + //only support block mode + return HDF_FAILURE; + } + + return HDF_SUCCESS; +} + +static int32_t Gr55xxInit(struct UartHost *host) +{ + struct UartDriverData *udd = NULL; + uint32_t uwRet = 0; + uint8_t *ptx_buf = NULL; + + if (host == NULL || host->priv == NULL) { + HDF_LOGE("%s: invalid parameter", __func__); + return HDF_ERR_INVALID_PARAM; + } + + udd = (struct UartDriverData *)host->priv; + if (udd->id >= APP_UART_ID_MAX) + return HDF_ERR_INVALID_PARAM; + + if (udd->state == UART_STATE_NOT_OPENED) { + udd->state = UART_STATE_OPENING; + + uwRet = LOS_BinarySemCreate(0, &uart_rx_sem[udd->id]); + if (uwRet != LOS_OK) { + return HDF_FAILURE; + } + + uwRet = LOS_MuxCreate(&uart_tx_mutex[udd->id]); + if (uwRet != LOS_OK) { + LOS_SemDelete(&uart_rx_sem[udd->id]); + return HDF_FAILURE; + } + + uwRet = LOS_MuxCreate(&uart_rx_mutex[udd->id]); + if (uwRet != LOS_OK) { + LOS_SemDelete(uart_rx_sem[udd->id]); + LOS_SemDelete(uart_tx_mutex[udd->id]); + return HDF_FAILURE; + } + + ptx_buf = (uint8_t *)OsalMemCalloc(TX_BUF_SIZE); + if (ptx_buf == NULL) { + HDF_LOGE("%s: alloc tx buffer failed", __func__); + + LOS_SemDelete(uart_rx_sem[udd->id]); + LOS_SemDelete(uart_tx_mutex[udd->id]); + LOS_SemDelete(uart_rx_mutex[udd->id]); + return HDF_ERR_MALLOC_FAIL; + } + udd->txBuffer.tx_buf = ptx_buf; + udd->txBuffer.tx_buf_size = TX_BUF_SIZE; + + udd->eventCallback = evt_handler[udd->id]; + udd->config = Gr55xxUartConfig; + if (udd->config(udd) != HDF_SUCCESS) { + goto FREE_INITALED_PARA; + } + } + + udd->state = UART_STATE_USEABLE; + udd->count++; + return HDF_SUCCESS; + +FREE_INITALED_PARA: + LOS_SemDelete(uart_rx_sem[udd->id]); + LOS_SemDelete(uart_tx_mutex[udd->id]); + LOS_SemDelete(uart_rx_mutex[udd->id]); + (void)OsalMemFree(udd->txBuffer.tx_buf); + udd->txBuffer.tx_buf = NULL; + return HDF_FAILURE; +} + +static int32_t Gr55xxDeinit(struct UartHost *host) +{ + struct UartDriverData *udd = NULL; + if (host == NULL || host->priv == NULL) { + HDF_LOGE("%s: invalid parameter", __func__); + return HDF_ERR_INVALID_PARAM; + } + + udd = (struct UartDriverData *)host->priv; + if ((--udd->count) != 0) { + return HDF_SUCCESS; + } + + LOS_SemDelete(uart_rx_sem[udd->id]); + LOS_SemDelete(uart_tx_mutex[udd->id]); + LOS_SemDelete(uart_rx_mutex[udd->id]); + if (NULL != udd->txBuffer.tx_buf) { + (void)OsalMemFree(udd->txBuffer.tx_buf); + udd->txBuffer.tx_buf = NULL; + } + + udd->state = UART_STATE_NOT_OPENED; + return HDF_SUCCESS; +} + +static int32_t Gr55xxPollEvent(struct UartHost *host, void *filep, void *table) +{ + struct UartDriverData *udd = NULL; + + if (host == NULL || host->priv == NULL) { + HDF_LOGE("%s: host is NULL", __func__); + return HDF_FAILURE; + } + udd = (struct UartDriverData *)host->priv; + if (UART_STATE_USEABLE != udd->state) { + return HDF_FAILURE; + } + + return 0; +} + +struct UartHostMethod g_uartHostMethod = { + .Init = Gr55xxInit, + .Deinit = Gr55xxDeinit, + .Read = Gr55xxRead, + .Write = Gr55xxWrite, + .SetBaud = Gr55xxSetBaud, + .GetBaud = Gr55xxGetBaud, + .SetAttribute = Gr55xxSetAttribute, + .GetAttribute = Gr55xxGetAttribute, + .SetTransMode = Gr55xxSetTransMode, + .pollEvent = Gr55xxPollEvent, +}; + +static int32_t UartGetConfigFromHcs(struct UartDriverData *udd, const struct DeviceResourceNode *node) +{ + uint32_t rcData; + struct DeviceResourceIface *iface = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE); + if (iface == NULL || iface->GetUint32 == NULL) { + HDF_LOGE("%s: face is invalid", __func__); + return HDF_FAILURE; + } + if (iface->GetUint32(node, "id", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read id fail", __func__); + return HDF_FAILURE; + } + udd->id = rcData; + + if (iface->GetUint32(node, "baudrate", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read baudrate fail", __func__); + return HDF_FAILURE; + } + udd->baudrate = rcData; + + if (iface->GetUint32(node, "pin_tx_type", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read pin_tx_type fail", __func__); + return HDF_FAILURE; + } + udd->params.pin_cfg.tx.type = rcData; + + if (iface->GetUint32(node, "pin_tx_pin", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read pin_tx_pin fail", __func__); + return HDF_FAILURE; + } + udd->params.pin_cfg.tx.pin = (1 << rcData); + + if (iface->GetUint32(node, "pin_tx_mux", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read pin_tx_pin fail", __func__); + return HDF_FAILURE; + } + udd->params.pin_cfg.tx.mux = rcData; + + if (iface->GetUint32(node, "pin_tx_pull", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read pin_tx_pin fail", __func__); + return HDF_FAILURE; + } + udd->params.pin_cfg.tx.pull = rcData; + + if (iface->GetUint32(node, "pin_rx_type", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read pin_rx_type fail", __func__); + return HDF_FAILURE; + } + udd->params.pin_cfg.rx.type = rcData; + + if (iface->GetUint32(node, "pin_rx_pin", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read pin_rx_pin fail", __func__); + return HDF_FAILURE; + } + udd->params.pin_cfg.rx.pin = (1 << rcData); + + if (iface->GetUint32(node, "pin_rx_mux", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read pin_rx_pin fail", __func__); + return HDF_FAILURE; + } + udd->params.pin_cfg.rx.mux = rcData; + + if (iface->GetUint32(node, "pin_rx_pull", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read pin_rx_pin fail", __func__); + return HDF_FAILURE; + } + udd->params.pin_cfg.rx.pull = rcData; + + if (iface->GetUint32(node, "use_mode_type", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read use_mode_type fail", __func__); + return HDF_FAILURE; + } + udd->params.use_mode.type = rcData; + + if (iface->GetUint32(node, "use_mode_tx_dma_ch", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read use_mode_tx_dma_ch fail", __func__); + return HDF_FAILURE; + } + udd->params.use_mode.tx_dma_channel = rcData; + + if (iface->GetUint32(node, "use_mode_rx_dma_ch", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read use_mode_rx_dma_ch fail", __func__); + return HDF_FAILURE; + } + udd->params.use_mode.rx_dma_channel = rcData; + + if (iface->GetUint32(node, "rx_timeout_mode", &rcData, 0) != HDF_SUCCESS) { + HDF_LOGE("%s: read rx_timeout_mode fail", __func__); + return HDF_FAILURE; + } + udd->params.init.rx_timeout_mode = rcData; + + return HDF_SUCCESS; +} + +static void Gr55xxUartDeviceDump(struct UartDriverData *udd) +{ +#ifdef GR55_UART_DEBUG + if (NULL == udd) { + HDF_LOGI("%s > dump error\r\n", __func__); + } + HDF_LOGI("%s > udd.id: %d\r\n", __func__, udd->id); + HDF_LOGI("%s > udd.baudrate: %d\r\n", __func__, udd->baudrate); + HDF_LOGI("%s > udd.count: %d\r\n", __func__, udd->count); + HDF_LOGI("%s > udd.state: %d\r\n", __func__, udd->state); + HDF_LOGI("%s > params.id: %d\r\n", __func__, udd->params.id); + HDF_LOGI("%s > params.init.baud_rate: %d\r\n", __func__, udd->params.init.baud_rate); + HDF_LOGI("%s > params.init.data_bits: %d\r\n", __func__, udd->params.init.data_bits); + HDF_LOGI("%s > params.init.hw_flow_ctrl: %d\r\n", __func__, udd->params.init.hw_flow_ctrl); + HDF_LOGI("%s > params.init.parity: %d\r\n", __func__, udd->params.init.parity); + HDF_LOGI("%s > params.init.rx_timeout_mode: %d\r\n", __func__, udd->params.init.rx_timeout_mode); + HDF_LOGI("%s > params.init.stop_bits: %d\r\n", __func__, udd->params.init.stop_bits); + + HDF_LOGI("%s > params.pin_cfg.tx.mux: %d\r\n", __func__, udd->params.pin_cfg.tx.mux); + HDF_LOGI("%s > params.pin_cfg.tx.pin: %d\r\n", __func__, udd->params.pin_cfg.tx.pin); + HDF_LOGI("%s > params.pin_cfg.tx.pull: %d\r\n", __func__, udd->params.pin_cfg.tx.pull); + HDF_LOGI("%s > params.pin_cfg.tx.type: %d\r\n", __func__, udd->params.pin_cfg.tx.type); + HDF_LOGI("%s > params.pin_cfg.rx.mux: %d\r\n", __func__, udd->params.pin_cfg.rx.mux); + HDF_LOGI("%s > params.pin_cfg.rx.pin: %d\r\n", __func__, udd->params.pin_cfg.rx.pin); + HDF_LOGI("%s > params.pin_cfg.rx.pull: %d\r\n", __func__, udd->params.pin_cfg.rx.pull); + HDF_LOGI("%s > params.pin_cfg.rx.type: %d\r\n", __func__, udd->params.pin_cfg.rx.type); + HDF_LOGI("%s > params.use_mode.type: %d\r\n", __func__, udd->params.use_mode.type); +#else + (void)udd; +#endif +} + +static int32_t Gr55xxAttach(struct UartHost *host, struct HdfDeviceObject *device) +{ + int32_t ret; + struct UartDriverData *udd = NULL; + + if (device->property == NULL) { + HDF_LOGE("%s: property is null", __func__); + return HDF_FAILURE; + } + udd = (struct UartDriverData *)OsalMemCalloc(sizeof(*udd)); + if (udd == NULL) { + HDF_LOGE("%s: OsalMemCalloc udd error", __func__); + return HDF_ERR_MALLOC_FAIL; + } + + ret = UartGetConfigFromHcs(udd, device->property); + if (ret != HDF_SUCCESS || udd->id >= APP_UART_ID_MAX) { + (void)OsalMemFree(udd); + return HDF_FAILURE; + } + + udd->state = UART_STATE_NOT_OPENED; + udd->config = NULL; + udd->eventCallback = NULL; + udd->count = 0; + + udd->params.id = udd->id; + udd->params.init.baud_rate = udd->baudrate; + udd->attr.dataBits = DEFAULT_DATABITS; + udd->attr.stopBits = DEFAULT_STOPBITS; + udd->attr.parity = DEFAULT_PARITY; + + host->priv = udd; + host->num = udd->id; + + // UartAddDev(host); + return HDF_SUCCESS; +} + +static void Gr55xxDetach(struct UartHost *host) +{ + struct UartDriverData *udd = NULL; + + if (host->priv == NULL) { + HDF_LOGE("%s: invalid parameter", __func__); + return; + } + udd = (struct UartDriverData *)host->priv; + if (udd->state != UART_STATE_NOT_OPENED) { + HDF_LOGE("%s: uart driver data state invalid", __func__); + return; + } + // UartRemoveDev(host); + (void)OsalMemFree(udd); + host->priv = NULL; +} + +static int32_t HdfUartDeviceBind(struct HdfDeviceObject *device) +{ + HDF_LOGI("%s: enter\r\n", __func__); + if (device == NULL) { + return HDF_ERR_INVALID_OBJECT; + } + return (UartHostCreate(device) == NULL) ? HDF_FAILURE : HDF_SUCCESS; +} + +int32_t HdfUartDeviceInit(struct HdfDeviceObject *device) +{ + int32_t ret; + struct UartHost *host = NULL; + + HDF_LOGI("%s: enter\r\n", __func__); + if (device == NULL) { + HDF_LOGE("%s: device is null", __func__); + return HDF_ERR_INVALID_OBJECT; + } + host = UartHostFromDevice(device); + if (host == NULL) { + HDF_LOGE("%s: host is null", __func__); + return HDF_FAILURE; + } + ret = Gr55xxAttach(host, device); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: attach error", __func__); + return HDF_FAILURE; + } + host->method = &g_uartHostMethod; + return ret; +} + +void HdfUartDeviceRelease(struct HdfDeviceObject *device) +{ + struct UartHost *host = NULL; + + HDF_LOGI("%s: enter", __func__); + if (device == NULL) { + HDF_LOGE("%s: device is null", __func__); + return; + } + host = UartHostFromDevice(device); + if (host == NULL) { + HDF_LOGE("%s: host is null", __func__); + return; + } + if (host->priv != NULL) { + Gr55xxDetach(host); + } + UartHostDestroy(host); +} + +struct HdfDriverEntry g_hdfUartDevice = { + .moduleVersion = 1, + .moduleName = "HDF_PLATFORM_UART", + .Bind = HdfUartDeviceBind, + .Init = HdfUartDeviceInit, + .Release = HdfUartDeviceRelease, +}; + +HDF_INIT(g_hdfUartDevice); diff --git a/gr551x/drivers/uart/uart_gr55xx.h b/gr551x/drivers/uart/uart_gr55xx.h new file mode 100755 index 0000000..7d49635 --- /dev/null +++ b/gr551x/drivers/uart/uart_gr55xx.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021 GOODIX. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UART_GR55XX_H +#define UART_GR55XX_H + +#include "poll.h" +#include "uart_if.h" +#include "app_uart.h" +#include "app_io.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +struct UartDriverData; +typedef int32_t (*app_uart_cfg_handler_t)(struct UartDriverData *udd); + +#define DEFAULT_BAUDRATE 115200 +#define DEFAULT_DATABITS UART_ATTR_DATABIT_8 +#define DEFAULT_STOPBITS UART_ATTR_STOPBIT_1 +#define DEFAULT_PARITY UART_ATTR_PARITY_NONE +#define CONFIG_MAX_BAUDRATE 921600 + +#define TX_BUF_SIZE 0X100 +struct UartDriverData { + uint32_t id; + uint32_t baudrate; + int32_t count; + struct UartAttribute attr; + app_uart_params_t params; + app_uart_evt_handler_t eventCallback; + app_uart_cfg_handler_t config; + app_uart_tx_buf_t txBuffer; + int32_t state; +#define UART_STATE_NOT_OPENED 0 +#define UART_STATE_OPENING 1 +#define UART_STATE_USEABLE 2 +#define UART_STATE_SUSPENED 3 + uint32_t flags; +#define UART_FLG_DMA_RX (1 << 0) +#define UART_FLG_DMA_TX (1 << 1) +#define UART_FLG_RD_BLOCK (1 << 2) +}; + + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* UART_PL011_H */ diff --git a/gr551x/hcs/BUILD.gn b/gr551x/hcs/BUILD.gn new file mode 100755 index 0000000..69d092d --- /dev/null +++ b/gr551x/hcs/BUILD.gn @@ -0,0 +1,19 @@ +# Copyright (c) 2021 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//drivers/adapter/khdf/liteos_m/hdf.gni") + +# module_name = "hdf_hcs" +# hdf_driver(module_name) { +# hcs_sources = [ "hdf.hcs" ] +# } diff --git a/gr551x/hcs/device_info/device_info.hcs b/gr551x/hcs/device_info/device_info.hcs new file mode 100755 index 0000000..c999686 --- /dev/null +++ b/gr551x/hcs/device_info/device_info.hcs @@ -0,0 +1,53 @@ +root { + module = "goodix,gr551x"; + device_info { + match_attr = "hdf_manager"; + template host { + hostName = ""; + priority = 100; + template device { + template deviceNode { + policy = 0; + priority = 100; + preload = 0; + permission = 0664; + moduleName = ""; + serviceName = ""; + deviceMatchAttr = ""; + } + } + } + platform :: host { + hostName = "platform_host"; + priority = 50; + device_gpio :: device { + device0 :: deviceNode { + policy = 0; + priority = 10; + permission = 0644; + moduleName = "HDF_PLATFORM_GPIO"; + serviceName = "HDF_PLATFORM_GPIO"; + deviceMatchAttr = "goodix_gr55xx_gpio"; + } + } + device_uart :: device { + device0 :: deviceNode { + policy = 1; + priority = 40; + permission = 0644; + moduleName = "HDF_PLATFORM_UART"; + serviceName = "HDF_PLATFORM_UART_0"; + deviceMatchAttr = "goodix_gr55xx_uart_0"; + } + device1 :: deviceNode { + policy = 2; + permission = 0644; + priority = 40; + moduleName = "HDF_PLATFORM_UART"; + serviceName = "HDF_PLATFORM_UART_1"; + deviceMatchAttr = "goodix_gr55xx_uart_1"; + } + } + } + } +} diff --git a/gr551x/hcs/gpio/gpio_config.hcs b/gr551x/hcs/gpio/gpio_config.hcs new file mode 100755 index 0000000..50511cd --- /dev/null +++ b/gr551x/hcs/gpio/gpio_config.hcs @@ -0,0 +1,12 @@ +root { + platform { + gpio_config { + match_attr = "goodix_gr55xx_gpio"; + configNum = 1; + gpioIndex = [0]; + pull = [0]; + handleMode = [0]; + } + } +} + diff --git a/gr551x/hcs/hdf.hcs b/gr551x/hcs/hdf.hcs index c69f1e6..95855d5 100755 --- a/gr551x/hcs/hdf.hcs +++ b/gr551x/hcs/hdf.hcs @@ -1,39 +1,3 @@ -#include "device_info.hcs" -root { - platform { - gpio_config { - match_attr = "gpio_config"; - pin = [0, 1]; - realPin = [5, 27]; - config = [5, 2]; - pinNum = 2; - } - i2c_config { - i2c0 { - match_attr = "i2c0_config"; - port = 0; - speed = 200000; - scl_pin = 4; - sda_pin = 5; - use_dma = 0; - use_sync = 1; - as_master = 1; - address_width = 8; - mode = 0; - } - i2c1 { - match_attr = "i2c1_config"; - port = 1; - speed = 200000; - scl_pin = 6; - sda_pin = 7; - use_dma = 0; - use_sync = 1; - as_master = 1; - address_width = 8; - mode = 0; - } - } - } -} - +#include "device_info/device_info.hcs" +#include "gpio/gpio_config.hcs" +#include "uart/uart_config.hcs" diff --git a/gr551x/hcs/uart/uart_config.hcs b/gr551x/hcs/uart/uart_config.hcs new file mode 100755 index 0000000..47b1b2d --- /dev/null +++ b/gr551x/hcs/uart/uart_config.hcs @@ -0,0 +1,63 @@ +root { + platform { + template uart_controller { + match_attr = ""; + id = 0; + baudrate = 115200; + + pin_tx_type = 0; + pin_tx_pin = 0; + pin_tx_mux = 0; + pin_tx_pull = 0; + + pin_rx_type = 0; + pin_rx_pin = 0; + pin_rx_mux = 0; + pin_rx_pull = 0; + + use_mode_type = 0; + use_mode_tx_dma_ch = 0; + use_mode_rx_dma_ch = 0; + + rx_timeout_mode = 1; + } + controller_uart0 :: uart_controller { + match_attr = "goodix_gr55xx_uart_0"; + id = 0; /* APP_UART_ID_0 */ + baudrate = 115200; + pin_tx_type = 0; /* APP_IO_TYPE_NORMAL */ + pin_tx_pin = 10; /* APP_IO_PIN_10 */ + pin_tx_mux = 2; /* APP_IO_MUX_2 */ + pin_tx_pull = 1; /* APP_IO_PULLUP */ + + pin_rx_type = 0; /* APP_IO_TYPE_NORMAL */ + pin_rx_pin = 11; /* APP_IO_PIN_11 */ + pin_rx_mux = 2; /* APP_IO_MUX_2 */ + pin_rx_pull = 1; /* APP_IO_PULLUP */ + + use_mode_type = 0; /* APP_UART_TYPE_INTERRUPT */ + use_mode_tx_dma_ch = 0; /* DMA_Channel0 */ + use_mode_rx_dma_ch = 1; /* DMA_Channel1 */ + + rx_timeout_mode = 1; /* UART_RECEIVER_TIMEOUT_ENABLE */ + } + controller_uart1 :: uart_controller { + match_attr = "goodix_gr55xx_uart_1"; + id = 1; /* APP_UART_ID_1 */ + baudrate = 115200; + pin_tx_type = 0; /* APP_IO_TYPE_NORMAL */ + pin_tx_pin = 9; /* APP_IO_PIN_7 */ + pin_tx_mux = 3; /* APP_IO_MUX_3 */ + pin_tx_pull = 1; /* APP_IO_PULLUP */ + + pin_rx_type = 0; /* APP_IO_TYPE_NORMAL */ + pin_rx_pin = 8; /* APP_IO_PIN_6 */ + pin_rx_mux = 3; /* APP_IO_MUX_3 */ + pin_rx_pull = 1; /* APP_IO_PULLUP */ + + use_mode_type = 0; /* APP_UART_TYPE_INTERRUPT */ + + rx_timeout_mode = 1; /* UART_RECEIVER_TIMEOUT_ENABLE */ + } + } +} diff --git a/gr551x/sdk_liteos/config.gni b/gr551x/sdk_liteos/config.gni deleted file mode 100644 index 79541ff..0000000 --- a/gr551x/sdk_liteos/config.gni +++ /dev/null @@ -1,182 +0,0 @@ -# Copyright (c) 2021 GOODIX. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Kernel type, e.g. "linux", "liteos_a", "liteos_m". -kernel_type = "liteos_m" - -# Kernel version. -kernel_version = "3.0.0" - -# Board CPU type, e.g. "cortex-a7", "riscv32". -board_cpu = "cortex-m4" - -# Board arch, e.g. "armv7-a", "rv32imac". -board_arch = "" - -# Toolchain name used for system compiling. -# E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang, riscv32-unknown-elf. -# Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toochain. -board_toolchain = "arm-none-eabi-gcc" - -use_board_toolchain = true - -# The toolchain path instatlled, it's not mandatory if you have added toolchian path to your ~/.bashrc. -board_toolchain_path = "" - -# Compiler prefix. -board_toolchain_prefix = "arm-none-eabi-" - -# Compiler type, "gcc" or "clang". -board_toolchain_type = "gcc" - -# Board related common compile flags. -board_cflags = [ - "-std=c99", - "--inline", - "-ggdb", - "-O1", - "-ffunction-sections", - "-fdata-sections", - "-mfloat-abi=softfp", - "-mfpu=fpv4-sp-d16", - "-mapcs-frame", - "-mcpu=cortex-m4", - "-mthumb", - "-mthumb-interwork", - "-gdwarf-2", - "-MD", - "-fno-stack-protector", - "-DAPP_LFS_BLOCK_COUNT=10", -] -board_cxx_flags = [ ] -board_ld_flags = [ - - "-nostartfiles", - "-mcpu=cortex-m4", - "-mfloat-abi=softfp", - "-mfpu=fpv4-sp-d16", - "-mapcs-frame", - "-mthumb", - "-mthumb-interwork", - "-Wl,--gc-sections", - "-Wl,--start-group", - "-Llibs", - "-lmusl-c", - "-lmusl-m", - "-Wl,--whole-archive", - - "-lhuks_3.0_sdk", - "-larch", - "-lbootstrap", - "-lexchook", - "-lsamgr", - "-lsamgr_adapter", - "-lsysparam", - "-ltoken_static", - "-lbroadcast", - "-lhilog_lite", - "-lhiview_lite", - "-lkernel", - "-lsamgr_source", - "-lutils", - "-lcmsis", - "-lhal_sysparam", - "-lposix", - "-lbacktrace", - "-lcpup", - "-lhal_token_static", - "-lutils_kv_store", - "-lble_sdk", - "-lhilinkbtsdk", - "-lhichain_account", - - "-Wl,--no-whole-archive", - "-Wl,--end-group", - "-Tbin/link.ld", - "-Trom_symbol_gcc.txt", - "-Wl,-Map=bin/application.map", -] - -# Board related headfiles search path. -board_include_dirs = [ - - "//kernel/liteos_m/kernel/arch/arm/cortex-m4/gcc", - "//kernel/liteos_m/kernel/arch/include", - "//kernel/liteos_m/kernel/include", - "//kernel/liteos_m/kal/cmsis", - "//kernel/liteos_m/kal/posix/include", - "//kernel/liteos_m/utils", - "//kernel/liteos_m/components/exchook", - "//utils/native/lite/kal/timer", - "//utils/native/lite/include", - - "//kernel/liteos_m/components/fs/fatfs", - "//third_party/FatFs/source", - "//third_party/cmsis/CMSIS/Core/Include", - "//third_party/musl/porting/liteos_m/kernel/include", - "//third_party/bounds_checking_function/include", - "//third_party/openssl", - "//third_party/openssl/include", - "//third_party/openssl/crypto/include", - "//third_party/openssl/crypto/ec", - "//third_party/mbedtls/include", - "//foundation/communication/bluetooth/interfaces/innerkits/native_c/include", - - "//device/goodix/gr551x/sdk_liteos/platform/include", - "//device/goodix/gr551x/adapter/hals/bluetooth", - "//device/goodix/gr551x/components/hilink/include", - "//device/goodix/gr551x/sdk_liteos/config", - "//device/goodix/gr551x/sdk_liteos/liteos_m", - "//device/goodix/gr551x/components/watchdog", - - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/app_drivers/inc", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/boards", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/st7735", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/vs1005", - - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_lfs", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_alarm", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_queue", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/bsp", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_master", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_port", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hci_uart", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/sensorsim", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/patch/ind", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/components/sdk/", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/drivers/inc", - "//device/goodix/gr551x/sdk_liteos/gr551x_sdk/toolchain/gr551x/include", -] - -# Board adapter dir for OHOS components. -board_adapter_dir = "" - -# Sysroot path. -board_configed_sysroot = "" - -# Board storage type, it used for file system generation. -storage_type = "" - diff --git a/gr551x/sdk_liteos/config/custom_config.h b/gr551x/sdk_liteos/config/custom_config.h index 4e15720..c1631d1 100755 --- a/gr551x/sdk_liteos/config/custom_config.h +++ b/gr551x/sdk_liteos/config/custom_config.h @@ -172,11 +172,11 @@ // Code load address // Default: 0x01002000 -#define APP_CODE_LOAD_ADDR 0x01002000 +#define APP_CODE_LOAD_ADDR 0x0100b000 // Code run address // Default: 0x01002000 -#define APP_CODE_RUN_ADDR 0x01002000 +#define APP_CODE_RUN_ADDR 0x0100b000 // System clock // <0=> 64MHZ diff --git a/gr551x/sdk_liteos/config/flash_scatter_config.h b/gr551x/sdk_liteos/config/flash_scatter_config.h old mode 100644 new mode 100755 diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_adc_voltage_api.c b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_adc_voltage_api.c new file mode 100755 index 0000000..d93c843 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_adc_voltage_api.c @@ -0,0 +1,225 @@ +/** + **************************************************************************************** + * + * @file gr551x_adc_voltage_api.c + * + * @brief GR551x ADC voltage module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of GOODIX 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 COPYRIGHT HOLDERS AND 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. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "gr55xx_hal.h" +#include "gr55xx_sys.h" +#include "gr551x_adc_voltage_api.h" + +/* + * DEFINE + ***************************************************************************************** + */ +#define ADC_UNUSED_CONV_LENGTH (16UL) /**< Invaild calibrated buffer. */ +#define ADC_USED_CONV_LENGTH (16UL) /**< Used calibrated buffer. */ + +/* + * STRUCTURES + ***************************************************************************************** + */ +typedef struct { + uint32_t offset_int_0p8; + uint32_t slope_int_0p8; + uint32_t offset_int_1p2; + uint32_t slope_int_1p2; + uint32_t offset_int_1p6; + uint32_t slope_int_1p6; + uint32_t offset_int_2p0; + uint32_t slope_int_2p0; + uint32_t offset_ext_1p0; + uint32_t slope_ext_1p0; +} adc_trim_params_t; + +/* + * GLOBAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ + +/* + * STATIC VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static uint32_t diff_int_vref = 0; +static uint16_t diff_int_offset = 0; +static double diff_ext_vref = 0; +static uint16_t diff_ext_offset = 0; + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static void load_trim_for_sdk(adc_trim_params_t *param) +{ + adc_trim_info_t adc_trim = {0}; + + if(SDK_SUCCESS == sys_adc_trim_get(&adc_trim)) + { + param->offset_int_0p8 = adc_trim.offset_int_0p8; + param->slope_int_0p8 = adc_trim.slope_int_0p8; + param->offset_int_1p2 = adc_trim.offset_int_1p2; + param->slope_int_1p2 = adc_trim.slope_int_1p2; + param->offset_int_1p6 = adc_trim.offset_int_1p6; + param->slope_int_1p6 = adc_trim.slope_int_1p6; + param->offset_int_2p0 = adc_trim.offset_int_2p0; + param->slope_int_2p0 = adc_trim.slope_int_2p0; + param->offset_ext_1p0 = adc_trim.offset_ext_1p0; + param->slope_ext_1p0 = adc_trim.slope_ext_1p0; + } + + return; +} + +static uint16_t diff_calculate_offset(adc_handle_t *hadc) +{ + uint32_t sum = 0; + uint32_t adc_channel_n = 0; + uint32_t adc_channel_p = 0; + uint16_t conversion_avg = 0; + uint16_t conversion[ADC_UNUSED_CONV_LENGTH + ADC_USED_CONV_LENGTH] = {0}; + + adc_channel_n = hadc->init.channel_n; + adc_channel_p = hadc->init.channel_p; + hadc->init.channel_n = ADC_INPUT_SRC_REF; + hadc->init.channel_p = ADC_INPUT_SRC_REF; + + hal_adc_deinit(hadc); + hal_adc_init(hadc); + hal_adc_poll_for_conversion(hadc, conversion, ADC_UNUSED_CONV_LENGTH + ADC_USED_CONV_LENGTH); + for(uint16_t i = ADC_UNUSED_CONV_LENGTH; i < ADC_UNUSED_CONV_LENGTH + ADC_USED_CONV_LENGTH; i++) + { + sum += conversion[i]; + } + conversion_avg = sum / ADC_USED_CONV_LENGTH; + hadc->init.channel_n = adc_channel_n; + hadc->init.channel_p = adc_channel_p; + + hal_adc_deinit(hadc); + hal_adc_init(hadc); + + return (conversion_avg << 1); +} + +void hal_gr551x_adc_voltage_intern(adc_handle_t *hadc, uint16_t *inbuf, double *outbuf, uint32_t buflen) +{ + double cslope = 0, coffset = 0; + adc_trim_params_t trim = {0}; + + load_trim_for_sdk(&trim); + + if (ADC_REF_VALUE_0P8 == hadc->init.ref_value) + { + coffset = (double)trim.offset_int_0p8; + cslope = (-1) * (double)trim.slope_int_0p8; + } + else if (ADC_REF_VALUE_1P2 == hadc->init.ref_value) + { + coffset = (double)trim.offset_int_1p2; + cslope = (-1) * (double)trim.slope_int_1p2; + } + else if (ADC_REF_VALUE_1P6 == hadc->init.ref_value) + { + coffset = (double)trim.offset_int_1p6; + cslope = (-1) * (double)trim.slope_int_1p6; + } +// else if (ADC_REF_VALUE_2P0 == hadc->init.ref_value) +// { +// coffset = (double)trim.offset_int_2p0; +// cslope = (-1) * (double)trim.slope_int_2p0; +// } + + if (ADC_INPUT_SINGLE == hadc->init.input_mode) + { + for (uint32_t i = 0; i < buflen; i++) + { + outbuf[i] = ((double)inbuf[i] - coffset) / cslope; + } + } + else + { + if (diff_int_vref != hadc->init.ref_value) + { + diff_int_vref = hadc->init.ref_value; + diff_int_offset = diff_calculate_offset(hadc); + } + coffset = (double)diff_int_offset; + for (uint32_t i = 0; i < buflen; i++) + { + outbuf[i] = (coffset - (double)inbuf[i] * 2) / cslope; + } + } + + return; +} + +void hal_gr551x_adc_voltage_extern(adc_handle_t *hadc, double vref, uint16_t *inbuf, double *outbuf, uint32_t buflen) +{ + double cslope = 0, coffset = 0; + adc_trim_params_t trim = {0}; + + load_trim_for_sdk(&trim); + + if (ADC_INPUT_SINGLE == hadc->init.input_mode) + { + coffset = (double)trim.offset_ext_1p0; + cslope = ((-1) * (double)trim.slope_ext_1p0) * 1.0f / vref; + for (uint32_t i = 0; i < buflen; i++) + { + outbuf[i] = ((double)inbuf[i] - coffset) / cslope; + } + } + else + { + if (fabs(diff_ext_vref - vref) > 0.00001) + { + diff_ext_vref = vref; + diff_ext_offset = diff_calculate_offset(hadc); + } + coffset = (double)diff_ext_offset; + cslope = ((-1) * (double)trim.slope_ext_1p0) * 1.0f / vref; + for (uint32_t i = 0; i < buflen; i++) + { + outbuf[i] = (coffset - (double)inbuf[i] * 2) / cslope; + } + } + + return; +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_adc_voltage_api.h b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_adc_voltage_api.h new file mode 100755 index 0000000..d9ab31a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_adc_voltage_api.h @@ -0,0 +1,90 @@ +/** + **************************************************************************************** + * + * @file gr551x_adc_voltage_api.h + * + * @brief Header file - GR551x ADC voltage module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of GOODIX 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 COPYRIGHT HOLDERS AND 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. + ***************************************************************************************** + */ +#ifndef __GR551X_ADC_VOLTAGE_API_H__ +#define __GR551X_ADC_VOLTAGE_API_H__ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "gr55xx_hal_adc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Convert the ADC conversion results to a voltage value(internal reference). + * + * @param[in] hadc: Pointer to a ADC handle which contains the configuration information for + * the specified ADC module. + * @param[in] inbuf: Pointer to data buffer which storage ADC conversion results. + * @param[out] outbuf: Pointer to data buffer which to storage voltage results. + * @param[in] length: Length of data buffer, ranging between 0 and 4095. + * + * @return Result of operation. + **************************************************************************************** + */ +void hal_gr551x_adc_voltage_intern(adc_handle_t *hadc, uint16_t *inbuf, double *outbuf, uint32_t buflen); + +/** + **************************************************************************************** + * @brief Convert the ADC conversion results to a voltage value(external reference). + * + * @param[in] hadc: Pointer to a ADC handle which contains the configuration information for + * the specified ADC module. + * @param[in] ref: slope of ADC. + * @param[in] inbuf: Pointer to data buffer which storage ADC conversion results. + * @param[out] outbuf: Pointer to data buffer which to storage voltage results. + * @param[in] length: Length of data buffer, ranging between 0 and 4095. + * + * @return Result of operation. + **************************************************************************************** + */ +void hal_gr551x_adc_voltage_extern(adc_handle_t *hadc, double vref, uint16_t *inbuf, double *outbuf, uint32_t buflen); + +#ifdef __cplusplus +} +#endif + +#endif // __GR551X_ADC_VOLTAGE_API_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_spi_flash.c b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_spi_flash.c new file mode 100755 index 0000000..16cabb8 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_spi_flash.c @@ -0,0 +1,647 @@ +/** + **************************************************************************************** + * @file gr551x_spi_flash.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of GOODIX 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 COPYRIGHT HOLDERS AND 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. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "gr55xx_hal.h" +#include "gr551x_spi_flash.h" + +/* + * DEFINES + ***************************************************************************************** + */ +#define SPI_SPEED_1M (1000000) +#define SPI_SPEED_2M (2000000) +#define SPI_SPEED_4M (4000000) +#define SPI_SPEED_8M (8000000) +#define SPI_SPEED_16M (16000000) +#define SPI_SPEED_32M (32000000) + +#define DEFAULT_QSPI_SPEED (SPI_SPEED_8M) +#define DEFAULT_QSPI_IO_CONFIG { { APP_IO_TYPE_NORMAL, APP_IO_MUX_2, APP_IO_PIN_15 }, { APP_IO_TYPE_NORMAL, APP_IO_MUX_2, APP_IO_PIN_9 },\ + { APP_IO_TYPE_NORMAL, APP_IO_MUX_2, APP_IO_PIN_8 }, { APP_IO_TYPE_NORMAL, APP_IO_MUX_2, APP_IO_PIN_14 },\ + { APP_IO_TYPE_NORMAL, APP_IO_MUX_2, APP_IO_PIN_13 }, { APP_IO_TYPE_NORMAL, APP_IO_MUX_2, APP_IO_PIN_12 } } +#define DEFAULT_QSPI_MODE_CONFIG { APP_QSPI_TYPE_DMA, DMA_Channel7 } +#define DEFAULT_QSPI_CONFIG { (SystemCoreClock / DEFAULT_QSPI_SPEED), QSPI_CLOCK_MODE_3, 0} +#define DEFAULT_QSPI_PARAM_CONFIG { APP_QSPI_ID_1, DEFAULT_QSPI_IO_CONFIG, DEFAULT_QSPI_MODE_CONFIG, DEFAULT_QSPI_CONFIG} + +#define DEFAULT_SPIM_SPEED (SPI_SPEED_8M) +#define DEFAULT_SPIM_IO_CONFIG {{APP_IO_TYPE_NORMAL, APP_IO_MUX_7, APP_IO_PIN_15}, {APP_IO_TYPE_NORMAL, APP_IO_MUX_1, APP_IO_PIN_12},\ + {APP_IO_TYPE_NORMAL, APP_IO_MUX_1, APP_IO_PIN_13}, {APP_IO_TYPE_NORMAL, APP_IO_MUX_1, APP_IO_PIN_14}} +#define DEFAULT_SPIM_MODE_CONFIG {APP_SPI_TYPE_DMA, DMA_Channel5, DMA_Channel6} +#define DEFAULT_SPIM_CONFIG {SPI_DATASIZE_8BIT, SPI_POLARITY_LOW, SPI_PHASE_1EDGE, (SystemCoreClock / DEFAULT_SPIM_SPEED), SPI_TIMODE_DISABLE, SPI_SLAVE_SELECT_0} +#define DEFAULT_SPIM_PARAM_CONFIG {APP_SPI_ID_MASTER, DEFAULT_SPIM_IO_CONFIG, DEFAULT_SPIM_MODE_CONFIG, DEFAULT_SPIM_CONFIG} + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static volatile qspi_control_t g_qspi_ctl; +static dma_handle_t g_dma_handle; +static spi_handle_t g_spim_handle; +static qspi_handle_t g_qspi_handle; +static flash_init_t g_flash_init; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static void spi_app_qspi_callback(app_qspi_evt_t *p_evt) +{ + if (p_evt->type == APP_QSPI_EVT_TX_CPLT) + { + g_qspi_ctl.qspi_tmt_done = 1; + } + if (p_evt->type == APP_QSPI_EVT_RX_DATA) + { + g_qspi_ctl.qspi_rcv_done = 1; + } + if (p_evt->type == APP_QSPI_EVT_ERROR) + { + g_qspi_ctl.qspi_tmt_done = 1; + g_qspi_ctl.qspi_rcv_done = 1; + } +} + +void spi_app_spim_callback(app_spi_evt_t *p_evt) +{ + if (p_evt->type == APP_SPI_EVT_TX_CPLT) + { + g_qspi_ctl.spi_tmt_done = 1; + } + if (p_evt->type == APP_SPI_EVT_RX_DATA) + { + g_qspi_ctl.spi_rcv_done = 1; + } + if (p_evt->type == APP_SPI_EVT_ERROR) + { + g_qspi_ctl.spi_tmt_done = 1; + g_qspi_ctl.spi_rcv_done = 1; + } +} + +static void spi_flash_write_enable(void) +{ + uint8_t control_frame[1] = {SPI_FLASH_CMD_WREN}; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + g_qspi_ctl.spi_tmt_done = 0; + app_spi_transmit_async(g_qspi_ctl.spi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.spi_tmt_done == 0); + } + else + { + g_qspi_ctl.qspi_tmt_done = 0; + app_qspi_transmit_async(g_qspi_ctl.qspi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.qspi_tmt_done == 0); + } + + return; +} + +static uint8_t spi_flash_read_status(void) +{ + uint8_t status = 0; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + uint8_t control_frame[1] = {SPI_FLASH_CMD_RDSR}; + + g_qspi_ctl.spi_rcv_done = 0; + app_spi_read_memory_async(g_qspi_ctl.spi_id, control_frame, (uint8_t*)&status, sizeof(control_frame), 1); + while(g_qspi_ctl.spi_rcv_done == 0); + } + else + { + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_RDSR, + .address = 0, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_00_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 0, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = 1, + }; + + g_qspi_ctl.qspi_rcv_done = 0; + app_qspi_command_receive_async(g_qspi_ctl.qspi_id, &command, (uint8_t*)&status); + while(g_qspi_ctl.qspi_rcv_done == 0); + } + + return status; +} + +static uint32_t spi_flash_device_size(void) +{ + uint32_t flash_size = 0; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + uint8_t data[5] = {0}; + uint8_t control_frame[5] = {SPI_FLASH_CMD_SFUD, 0, 0, 0x34, DUMMY_BYTE}; + + g_qspi_ctl.spi_rcv_done = 0; + app_spi_read_memory_async(g_qspi_ctl.spi_id, control_frame, data, sizeof(control_frame), sizeof(data)); + while(g_qspi_ctl.spi_rcv_done == 0); + + if (data[0] != 0 && data[3] < 0xFF) + { + flash_size = ((data[3] << 24) + (data[2] << 16) + (data[1] << 8) + (data[0] << 0) + 1) / 8; + } + } + else + { + uint8_t data[4] = {0}; + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_SFUD, // SPI_FLASH_CMD_SFUD //SPI_FLASH_CMD_RDSR + .address = 0x000034, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_24_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 8, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = sizeof(data), + }; + + g_qspi_ctl.qspi_rcv_done = 0; + app_qspi_command_receive_async(g_qspi_ctl.qspi_id, &command, data); + while(g_qspi_ctl.qspi_rcv_done == 0); + + if (data[0] != 0 && data[3] < 0xFF) + { + flash_size = ((data[3] << 24) + (data[2] << 16) + (data[1] << 8) + (data[0] << 0) + 1) / 8; + } + } + + return flash_size; +} + + +static uint32_t spim_flash_write(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint8_t control_frame[4] = {0}; + + control_frame[0] = SPI_FLASH_CMD_PP; + control_frame[1] = (address >> 16) & 0xFF; + control_frame[2] = (address >> 8) & 0xFF; + control_frame[3] = address & 0xFF; + + g_qspi_ctl.spi_tmt_done = 0; + app_spi_write_memory_async(g_qspi_ctl.spi_id, control_frame, buffer, sizeof(control_frame), nbytes); + while(g_qspi_ctl.spi_tmt_done == 0); + + return nbytes; +} + +static uint32_t qspi_flash_write(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_PP, + .address = address, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_24_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 0, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = nbytes, + }; + + g_qspi_ctl.qspi_tmt_done = 0; + app_qspi_command_transmit_async(g_qspi_ctl.qspi_id, &command, buffer); + while(g_qspi_ctl.qspi_tmt_done == 0); + + return nbytes; +} + +static uint32_t spim_flash_read(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint8_t control_frame[4] = {0}; + + control_frame[0] = SPI_FLASH_CMD_READ; + control_frame[1] = (address >> 16) & 0xFF; + control_frame[2] = (address >> 8) & 0xFF; + control_frame[3] = address & 0xFF; + + g_qspi_ctl.spi_rcv_done = 0; + app_spi_read_memory_async(g_qspi_ctl.spi_id, control_frame, buffer, sizeof(control_frame), nbytes); + while(g_qspi_ctl.spi_rcv_done == 0); + + return nbytes; +} + +static uint32_t qspi_flash_read(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_READ, + .address = address, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_24_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 0, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = nbytes, + }; + + g_qspi_ctl.qspi_rcv_done = 0; + app_qspi_command_receive_async(g_qspi_ctl.qspi_id, &command, buffer); + while(g_qspi_ctl.qspi_rcv_done == 0); + + return nbytes; +} + +bool spim_flash_sector_erase(uint32_t address) +{ + uint8_t control_frame[4] = {0}; + + control_frame[0] = SPI_FLASH_CMD_SE; + control_frame[1] = (address >> 16) & 0xFF; + control_frame[2] = (address >> 8) & 0xFF; + control_frame[3] = address & 0xFF; + + g_qspi_ctl.spi_tmt_done = 0; + app_spi_transmit_async(g_qspi_ctl.spi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.spi_tmt_done == 0); + + return true; +} + +bool qspi_flash_sector_erase(uint32_t address) +{ + uint8_t control_frame[4] = {0}; + + control_frame[0] = SPI_FLASH_CMD_SE; + control_frame[1] = (address >> 16) & 0xFF; + control_frame[2] = (address >> 8) & 0xFF; + control_frame[3] = address & 0xFF; + + g_qspi_ctl.qspi_tmt_done = 0; + app_qspi_transmit_async(g_qspi_ctl.qspi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.qspi_tmt_done == 0); + + return true; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +bool spi_flash_init(flash_init_t *p_flash_init) +{ + memcpy(&g_flash_init, p_flash_init, sizeof(flash_init_t)); + + if (FLASH_SPIM_ID == p_flash_init->spi_type) + { + app_spi_params_t spim_params = DEFAULT_SPIM_PARAM_CONFIG; + + spim_params.pin_cfg.cs.type = p_flash_init->flash_io.spi_cs.gpio; + spim_params.pin_cfg.cs.pin = p_flash_init->flash_io.spi_cs.pin; + spim_params.pin_cfg.cs.mux = p_flash_init->flash_io.spi_cs.mux; + spim_params.pin_cfg.cs.pull = APP_IO_NOPULL; + spim_params.pin_cfg.cs.enable = APP_SPI_PIN_ENABLE; + spim_params.pin_cfg.clk.type = p_flash_init->flash_io.spi_clk.gpio; + spim_params.pin_cfg.clk.pin = p_flash_init->flash_io.spi_clk.pin; + spim_params.pin_cfg.clk.mux = p_flash_init->flash_io.spi_clk.mux; + spim_params.pin_cfg.clk.pull = APP_IO_NOPULL; + spim_params.pin_cfg.clk.enable = APP_SPI_PIN_ENABLE; + spim_params.pin_cfg.mosi.type = p_flash_init->flash_io.spi_io0.qspi_io0.gpio; + spim_params.pin_cfg.mosi.pin = p_flash_init->flash_io.spi_io0.qspi_io0.pin; + spim_params.pin_cfg.mosi.mux = p_flash_init->flash_io.spi_io0.qspi_io0.mux; + spim_params.pin_cfg.mosi.pull = APP_IO_NOPULL; + spim_params.pin_cfg.mosi.enable = APP_SPI_PIN_ENABLE; + spim_params.pin_cfg.miso.type = p_flash_init->flash_io.spi_io1.qspi_io1.gpio; + spim_params.pin_cfg.miso.pin = p_flash_init->flash_io.spi_io1.qspi_io1.pin; + spim_params.pin_cfg.miso.mux = p_flash_init->flash_io.spi_io1.qspi_io1.mux; + spim_params.pin_cfg.miso.pull = APP_IO_NOPULL; + spim_params.pin_cfg.miso.enable = APP_SPI_PIN_ENABLE; + + g_qspi_ctl.spi_id = APP_SPI_ID_MASTER; + + app_spi_deinit(g_qspi_ctl.spi_id); + + if (app_spi_init(&spim_params, spi_app_spim_callback)) + { + return false; + } + } + else if ((FLASH_QSPI_ID0 == p_flash_init->spi_type) || (FLASH_QSPI_ID1 == p_flash_init->spi_type)) + { + app_qspi_params_t qspi_params = DEFAULT_QSPI_PARAM_CONFIG; + + if(FLASH_QSPI_ID0 == p_flash_init->spi_type){ + g_qspi_ctl.qspi_id = APP_QSPI_ID_0; + }else{ + g_qspi_ctl.qspi_id = APP_QSPI_ID_1; + } + + qspi_params.id = g_qspi_ctl.qspi_id; + qspi_params.pin_cfg.cs.type = p_flash_init->flash_io.spi_cs.gpio; + qspi_params.pin_cfg.cs.pin = p_flash_init->flash_io.spi_cs.pin; + qspi_params.pin_cfg.cs.mux = p_flash_init->flash_io.spi_cs.mux; + qspi_params.pin_cfg.cs.pull = APP_IO_NOPULL; + qspi_params.pin_cfg.cs.enable = APP_SPI_PIN_ENABLE; + qspi_params.pin_cfg.clk.type = p_flash_init->flash_io.spi_clk.gpio; + qspi_params.pin_cfg.clk.pin = p_flash_init->flash_io.spi_clk.pin; + qspi_params.pin_cfg.clk.mux = p_flash_init->flash_io.spi_clk.mux; + qspi_params.pin_cfg.clk.pull = APP_IO_NOPULL; + qspi_params.pin_cfg.clk.enable = APP_SPI_PIN_ENABLE; + qspi_params.pin_cfg.io_0.type = p_flash_init->flash_io.spi_io0.qspi_io0.gpio; + qspi_params.pin_cfg.io_0.pin = p_flash_init->flash_io.spi_io0.qspi_io0.pin; + qspi_params.pin_cfg.io_0.mux = p_flash_init->flash_io.spi_io0.qspi_io0.mux; + qspi_params.pin_cfg.io_0.pull = APP_IO_NOPULL; + qspi_params.pin_cfg.io_0.enable = APP_SPI_PIN_ENABLE; + qspi_params.pin_cfg.io_1.type = p_flash_init->flash_io.spi_io1.qspi_io1.gpio; + qspi_params.pin_cfg.io_1.pin = p_flash_init->flash_io.spi_io1.qspi_io1.pin; + qspi_params.pin_cfg.io_1.mux = p_flash_init->flash_io.spi_io1.qspi_io1.mux; + qspi_params.pin_cfg.io_1.pull = APP_IO_NOPULL; + qspi_params.pin_cfg.io_1.enable = APP_SPI_PIN_ENABLE; + qspi_params.pin_cfg.io_2.type = p_flash_init->flash_io.qspi_io2.gpio; + qspi_params.pin_cfg.io_2.pin = p_flash_init->flash_io.qspi_io2.pin; + qspi_params.pin_cfg.io_2.mux = p_flash_init->flash_io.qspi_io2.mux; + qspi_params.pin_cfg.io_2.pull = APP_IO_NOPULL; + qspi_params.pin_cfg.io_2.enable = APP_SPI_PIN_ENABLE; + qspi_params.pin_cfg.io_3.type = p_flash_init->flash_io.qspi_io3.gpio; + qspi_params.pin_cfg.io_3.pin = p_flash_init->flash_io.qspi_io3.pin; + qspi_params.pin_cfg.io_3.mux = p_flash_init->flash_io.qspi_io3.mux; + qspi_params.pin_cfg.io_3.pull = APP_IO_NOPULL; + qspi_params.pin_cfg.io_3.enable = APP_SPI_PIN_ENABLE; + + app_qspi_deinit(g_qspi_ctl.qspi_id); + if (app_qspi_init(&qspi_params, spi_app_qspi_callback)) + { + return false; + } + + //set qspi hold/wp pin to high + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + + io_init.mode = APP_IO_MODE_OUT_PUT; + io_init.pull = APP_IO_PULLUP; + io_init.pin = qspi_params.pin_cfg.io_2.pin; + io_init.mux = APP_IO_MUX_7; + if (app_io_init(qspi_params.pin_cfg.io_2.type, &io_init)) + { + return false; + } + + io_init.mode = APP_IO_MODE_OUT_PUT; + io_init.pull = APP_IO_PULLUP; + io_init.pin = qspi_params.pin_cfg.io_3.pin; + io_init.mux = APP_IO_MUX_7; + if (app_io_init(qspi_params.pin_cfg.io_3.type , &io_init)) + { + return false; + } + + if (app_io_write_pin(qspi_params.pin_cfg.io_2.type, qspi_params.pin_cfg.io_2.pin, APP_IO_PIN_SET)) + { + return false; + } + + if (app_io_write_pin(qspi_params.pin_cfg.io_3.type, qspi_params.pin_cfg.io_3.pin, APP_IO_PIN_SET)) + { + return false; + } + } + + return true; +} + +uint32_t spi_flash_write(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint32_t page_ofs, write_size, write_cont = nbytes; + hal_status_t status = HAL_OK; + + while (write_cont) + { + page_ofs = address & 0xFF; + write_size = EXFLASH_SIZE_PAGE_BYTES - page_ofs; + + if (write_cont < write_size) + { + write_size = write_cont; + write_cont = 0; + } + else + { + write_cont -= write_size; + } + + spi_flash_write_enable(); + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + spim_flash_write(address, buffer, write_size); + } + else + { + qspi_flash_write(address, buffer, write_size); + } + + while(spi_flash_read_status() & 0x1); + + address += write_size; + buffer += write_size; + } + + return ((status == HAL_OK) ? nbytes : 0); +} + +uint32_t spi_flash_read(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint32_t count = 0; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + count = spim_flash_read(address, buffer, nbytes); + } + else + { + count = qspi_flash_read(address, buffer, nbytes); + } + + return count; +} + +bool spi_flash_sector_erase(uint32_t address, uint32_t size) +{ + bool status = true; + + uint32_t erase_addr = address; + uint32_t sector_ofs, erase_size, erase_cont = size; + + while (erase_cont) + { + sector_ofs = erase_addr & 0xFFF; + erase_size = EXFLASH_SIZE_SECTOR_BYTES - sector_ofs; + + if (erase_cont < erase_size) + { + erase_size = erase_cont; + erase_cont = 0; + } + else + { + erase_cont -= erase_size; + } + + spi_flash_write_enable(); + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + status = spim_flash_sector_erase(erase_addr); + } + else + { + status = qspi_flash_sector_erase(erase_addr); + } + + while(spi_flash_read_status() & 0x1); + + erase_addr += erase_size; + } + + return status; +} + +bool spi_flash_chip_erase(void) +{ + hal_status_t status = HAL_OK; + uint8_t control_frame[1] = {SPI_FLASH_CMD_CE}; + + spi_flash_write_enable(); + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + g_qspi_ctl.spi_tmt_done = 0; + app_spi_transmit_async(g_qspi_ctl.spi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.spi_tmt_done == 0); + } + else + { + g_qspi_ctl.qspi_tmt_done = 0; + app_qspi_transmit_async(g_qspi_ctl.qspi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.qspi_tmt_done == 0); + } + while(spi_flash_read_status() & 0x1); + + return ((status == HAL_OK) ? true : false); +} + +void spi_flash_chip_reset(void) +{ + uint8_t control_frame[1] = {SPI_FLASH_CMD_RSTEN}; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + g_qspi_ctl.spi_tmt_done = 0; + app_spi_transmit_async(g_qspi_ctl.spi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.spi_tmt_done == 0); + } + else + { + hal_qspi_transmit(&g_qspi_handle, control_frame, sizeof(control_frame), 5000); + } + + control_frame[0] = SPI_FLASH_CMD_RST; + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + g_qspi_ctl.spi_tmt_done = 0; + app_spi_transmit_async(g_qspi_ctl.spi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.spi_tmt_done == 0); + } + else + { + hal_qspi_transmit(&g_qspi_handle, control_frame, sizeof(control_frame), 5000); + } + + return; +} + +uint32_t spi_flash_device_id(void) +{ + uint8_t data[3] = {0}; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + uint8_t control_frame[1] = {SPI_FLASH_CMD_RDID}; + + g_qspi_ctl.spi_rcv_done = 0; + app_spi_read_memory_async(g_qspi_ctl.spi_id, control_frame, data, sizeof(control_frame), sizeof(data)); + while(g_qspi_ctl.spi_rcv_done == 0); + } + else + { + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_RDID, + .address = 0, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_00_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 0, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = 3, + }; + + g_qspi_ctl.qspi_rcv_done = 0; + app_qspi_command_receive_async(g_qspi_ctl.qspi_id, &command, data); + while(g_qspi_ctl.qspi_rcv_done == 0); + } + + return (((uint32_t)data[0] << 16) + ((uint32_t)data[1] << 8) + data[2]); +} + +void spi_flash_device_info(uint32_t *id, uint32_t *size) +{ + if (NULL == id || NULL == size) + { + return; + } + + *id = spi_flash_device_id(); + *size = spi_flash_device_size(); + + return; +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_spi_flash.h b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_spi_flash.h new file mode 100755 index 0000000..35fe328 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_spi_flash.h @@ -0,0 +1,272 @@ +/** + **************************************************************************************** + * @file gr551x_spi_flash.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of spi flash library. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of GOODIX 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 COPYRIGHT HOLDERS AND 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. + **************************************************************************************** + */ +#ifndef __GR551X_SPI_FLASH_H__ +#define __GR551X_SPI_FLASH_H__ + +#include +#include "gr55xx_hal.h" +#include "app_io.h" +#include "app_qspi.h" +#include "app_spi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup Flash operation instruction macro definition + * @{ + */ + +#define SPI_FLASH_CMD_WRSR 0x01 +#define SPI_FLASH_CMD_WRSR1 0x31 +#define SPI_FLASH_CMD_RDSR 0x05 + +#define SPI_FLASH_CMD_WREN 0x06 +#define SPI_FLASH_CMD_WRDI 0x04 + +#define SPI_FLASH_CMD_READ 0x03 +#define SPI_FLASH_CMD_FREAD 0x0B +#define SPI_FLASH_CMD_DOFR 0x3B +#define SPI_FLASH_CMD_DIOFR 0xBB +#define SPI_FLASH_CMD_QOFR 0x6B +#define SPI_FLASH_CMD_QIOFR 0xEB +#define SPI_FLASH_CMD_READ_RESET 0xFF + +#define SPI_FLASH_CMD_PP 0x02 +#define SPI_FLASH_CMD_SE 0x20 +#define SPI_FLASH_CMD_BE_32 0x52 +#define SPI_FLASH_CMD_BE_64 0xD8 +#define SPI_FLASH_CMD_CE 0xC7 +#define SPI_FLASH_CMD_PES 0x75 +#define SPI_FLASH_CMD_PER 0x7A + +#define SPI_FLASH_CMD_RDI 0xAB +#define SPI_FLASH_CMD_REMS 0x90 +#define SPI_FLASH_CMD_RDID 0x9F + +#define SPI_FLASH_CMD_RSTEN 0x66 +#define SPI_FLASH_CMD_RST 0x99 +#define SPI_FLASH_CMD_DP 0xB9 +#define SPI_FLASH_CMD_RDP 0xAB + +#define SPI_FLASH_CMD_SFUD 0x5A + +#define DUMMY_BYTE 0xFF + +#define SPI_FLASH_PAGE_SIZE 0x00100 +#define SPI_FLASH_SECTOR_SIZE 0x01000 +#define SPI_FLASH_BLOCK_SIZE 0x10000 +#define SPI_FLASH_ADDRESS_MAX 0xFFFFF + +/** @} */ + + +/** @addtogroup Flash hardware interface default parameters + * @{ + */ + +#define DEFAULT_SPIM_GROUP0 {{APP_IO_TYPE_NORMAL, APP_IO_PIN_6, APP_IO_MUX_7}, {APP_IO_TYPE_NORMAL, APP_IO_PIN_3, APP_IO_MUX_2},\ + {APP_IO_TYPE_NORMAL, APP_IO_PIN_4, APP_IO_MUX_2}, {APP_IO_TYPE_NORMAL, APP_IO_PIN_5, APP_IO_MUX_2}} +#define DEFAULT_SPIM_GROUP1 {{APP_IO_TYPE_NORMAL, APP_IO_PIN_4, APP_IO_MUX_7}, {APP_IO_TYPE_NORMAL, APP_IO_PIN_7, APP_IO_MUX_4},\ + {APP_IO_TYPE_NORMAL, APP_IO_PIN_6, APP_IO_MUX_4}, {APP_IO_TYPE_NORMAL, APP_IO_PIN_5, APP_IO_MUX_4}} +#define DEFAULT_SPIM_GROUP2 {{APP_IO_TYPE_NORMAL, APP_IO_PIN_15, APP_IO_MUX_7}, {APP_IO_TYPE_NORMAL, APP_IO_PIN_12, APP_IO_MUX_1},\ + {APP_IO_TYPE_NORMAL, APP_IO_PIN_13, APP_IO_MUX_1}, {APP_IO_TYPE_NORMAL, APP_IO_PIN_14, APP_IO_MUX_1}} +#define DEFAULT_SPIM_GROUP3 {{APP_IO_TYPE_NORMAL, APP_IO_PIN_17, APP_IO_MUX_7}, {APP_IO_TYPE_NORMAL, APP_IO_PIN_24, APP_IO_MUX_0},\ + {APP_IO_TYPE_NORMAL, APP_IO_PIN_25, APP_IO_MUX_0}, {APP_IO_TYPE_NORMAL, APP_IO_PIN_16, APP_IO_MUX_0}} + +/** @} */ + +/** + * @addtogroup Spi Flash IO configuration Structures + * @{ + */ +typedef enum +{ + FLASH_SPIM_ID, /**< SPI master module. */ + FLASH_QSPI_ID0, /**< QSPI master module 0. */ + FLASH_QSPI_ID1, /**< QSPI master module 1. */ + FLASH_SPI_ID_MAX, /**< Only for check parameter, not used as input parameters. */ +} spi_type_t; + +typedef struct _spi_io +{ + app_io_type_t gpio; + uint32_t pin; + app_io_mux_t mux; +} spi_io_t; + +typedef struct _flash_io +{ + spi_io_t spi_cs; + spi_io_t spi_clk; + union + { + spi_io_t spim_mosi; + spi_io_t qspi_io0; + } spi_io0; + union + { + spi_io_t spim_miso; + spi_io_t qspi_io1; + } spi_io1; + spi_io_t qspi_io2; + spi_io_t qspi_io3; +} flash_io_t; + +typedef struct _flash_init +{ + spi_type_t spi_type; + flash_io_t flash_io; +} flash_init_t; + +typedef struct flash_control +{ + uint8_t qspi_tmt_done; + uint8_t qspi_rcv_done; + app_qspi_id_t qspi_id; + uint8_t spi_tmt_done; + uint8_t spi_rcv_done; + app_spi_id_t spi_id; +} qspi_control_t; + + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_SPI_FLASH_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the SPI FLASH DRIVER according to the specified parameters + * in the spi_flash_io_t. + * + * @param[in] p_params: Pointer to spi_flash_io_t parameter. + * + **************************************************************************************** + */ +bool spi_flash_init(flash_init_t *p_flash_init); + +/** + ******************************************************************************* + * @brief Write flash Memory. + * + * @param[in] address: start address in flash to write data to. + * @param[in,out] buffer: buffer of data to write. + * @param[in] nbytes: number of bytes to write. + * + * @return number of bytes written + ******************************************************************************* + */ +uint32_t spi_flash_write(uint32_t address, uint8_t *buffer, uint32_t nbytes); + +/** + ******************************************************************************* + * @brief Read flash Memory. + * + * @param[in] address: start address in flash to read data. + * @param[in,out] buffer: buffer to read data to. + * @param[in] nbytes: number of bytes to read. + * + * @return number of bytes read + ******************************************************************************* + */ +uint32_t spi_flash_read(uint32_t address, uint8_t *buffer, uint32_t nbytes); + +/** + ******************************************************************************* + * @brief Erase flash region. + * + * @note All sectors that have address in range of [addr, addr+len] + * will be erased. If addr is not sector aligned, preceding data + * on the sector that addr belongs to will also be erased. + * If (addr + size) is not sector aligned, the whole sector + * will also be erased. + * + * @param[in] address: start address in flash to write data to. + * @param[in] size: number of bytes to write. + * + * @retval true: If successful. + * @retval false: If failure. + ******************************************************************************* + */ +bool spi_flash_sector_erase(uint32_t address, uint32_t size); + +/** + ******************************************************************************* + * @brief Erase flash chip. + * + * @retval true: If successful. + * @retval false: If failure. + ******************************************************************************* + */ +bool spi_flash_chip_erase(void); + +/** + ******************************************************************************* + * @brief Reset flash chip. + * + ******************************************************************************* + */ +void spi_flash_chip_reset(void); + +/** + ******************************************************************************* + * @brief Get flash chip id. + * + * @retval Flash chip id. + ******************************************************************************* + */ +uint32_t spi_flash_device_id(void); + +/** + ******************************************************************************* + * @brief Get Flash information. + * + * @param[in,out] id: Pointer to flash id. + * @param[in,out] size: Pointer to flash size. + * + ******************************************************************************* + */ +void spi_flash_device_info(uint32_t *id, uint32_t *size); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif // __GR551X_SPI_FLASH_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_temp_api.c b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_temp_api.c new file mode 100755 index 0000000..d9eaaf6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_temp_api.c @@ -0,0 +1,101 @@ +/** + **************************************************************************************** + * + * @file gr551x_temp_api.c + * + * @brief GR551x temperature module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of GOODIX 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 COPYRIGHT HOLDERS AND 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. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "gr55xx_hal.h" +#include "gr55xx_sys.h" +#include "gr551x_temp_api.h" + +/* + * GLOBAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ + +/* + * STATIC VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static adc_handle_t gr551x_temp_handle = {0}; +static double adc_temp = 0; +static double adc_slope = 0; + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +void hal_gr551x_temp_init(void) +{ + adc_trim_info_t adc_trim = {0}; + + gr551x_temp_handle.init.channel_n = ADC_INPUT_SRC_TMP; + gr551x_temp_handle.init.channel_p = ADC_INPUT_SRC_TMP; + gr551x_temp_handle.init.input_mode = ADC_INPUT_SINGLE; + gr551x_temp_handle.init.ref_source = ADC_REF_SRC_BUF_INT; + gr551x_temp_handle.init.ref_value = ADC_REF_VALUE_0P8; + gr551x_temp_handle.init.clock = ADC_CLK_1P6M; + hal_adc_init(&gr551x_temp_handle); + + if(SDK_SUCCESS == sys_adc_trim_get(&adc_trim)) + { + adc_temp = (double)adc_trim.adc_temp; + adc_slope = (-1) * (double)adc_trim.slope_int_0p8; + } + else + { + adc_temp = 4979; + adc_slope = -4932; + } + return; +} + +double hal_gr551x_temp_read(void) +{ + uint16_t conver_buff[16] = {0}; + uint16_t average = 0; + + /* Got the average of Temp */ + hal_adc_poll_for_conversion(&gr551x_temp_handle, conver_buff, 16); + for(uint8_t i = 0; i < 8; i++) + { + average += conver_buff[8 + i]; + } + average = average >> 3; + return (((double)average - adc_temp) / adc_slope) / (-0.00175) + 25.0; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_temp_api.h b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_temp_api.h new file mode 100755 index 0000000..4114cac --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_temp_api.h @@ -0,0 +1,75 @@ +/** + **************************************************************************************** + * + * @file gr551x_temp_api.h + * + * @brief Header file - GR551x temperature module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of GOODIX 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 COPYRIGHT HOLDERS AND 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. + ***************************************************************************************** + */ +#ifndef __GR551X_TEMP_API_H__ +#define __GR551X_TEMP_API_H__ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Initialize ADC temperature detection. + * + **************************************************************************************** + */ +void hal_gr551x_temp_init(void); + +/** + **************************************************************************************** + * @brief Get the chip internal temperature. + * + * @return The value of temperature. Unit (Centigrade). + **************************************************************************************** + */ +double hal_gr551x_temp_read(void); + +#ifdef __cplusplus +} +#endif + +#endif // __GR551X_TEMP_API_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_tim_delay.c b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_tim_delay.c new file mode 100755 index 0000000..3552dc3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_tim_delay.c @@ -0,0 +1,88 @@ +/** + **************************************************************************************** + * + * @file gr551x_tim_delay.c + * + * @brief GR551x tim delay. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of GOODIX 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 COPYRIGHT HOLDERS AND 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. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "gr551x_tim_delay.h" + +/* + * STATIC VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static uint32_t fus = 0; +static uint32_t fms = 0; +static dual_timer_regs_t *tim_regs; + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +void tim_delay_init(dual_timer_regs_t *timx) +{ + fus = SystemCoreClock / 1000000; + fms = SystemCoreClock / 1000; + tim_regs = timx; + tim_regs->RELOAD = 0xFFFFFFFF; + /* Disable tim, period mode, 32-bit counter, one-shot mdoe */ + tim_regs->CTRL = 0x43; +} + +void tim_delay_us(uint32_t us) +{ + uint32_t load = us * fus - 1; + tim_regs->RELOAD = load; + /* Enable tim */ + tim_regs->CTRL |= 0x80; + while(tim_regs->VALUE != 0); + tim_regs->CTRL &= ~0x80; + /* Clear flag */ + tim_regs->INTCLR = 1; +} + +void tim_delay_ms(uint32_t ms) +{ + uint32_t load = ms * fms - 1; + tim_regs->RELOAD = load; + /* Enable tim */ + tim_regs->CTRL |= 0x80; + while(tim_regs->VALUE != 0); + tim_regs->CTRL &= ~0x80; + /* Clear flag */ + tim_regs->INTCLR = 1; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_tim_delay.h b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_tim_delay.h new file mode 100755 index 0000000..2815076 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_tim_delay.h @@ -0,0 +1,85 @@ +/** + **************************************************************************************** + * + * @file gr551x_tim_delay.h + * + * @brief Header file - GR551x tim delay. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of GOODIX 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 COPYRIGHT HOLDERS AND 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. + ***************************************************************************************** + */ +#ifndef __GR551X_TIM_DELAY_H__ +#define __GR551X_TIM_DELAY_H__ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "gr55xx.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Initialize the DUAL TIM according to the specified register + * in the dual_timer_regs_t. + **************************************************************************************** + */ +void tim_delay_init(dual_timer_regs_t *timx); + +/** + ***************************************************************************************** + * @brief Delay the function execution. + * + * @param[in] us: Microsecond. + ***************************************************************************************** + */ +void tim_delay_us(uint32_t us); + +/** + ***************************************************************************************** + * @brief Delay the function execution. + * + * @param[in] ms: Millisecond. + ***************************************************************************************** + */ +void tim_delay_ms(uint32_t ms); + +#ifdef __cplusplus +} +#endif + +#endif // __GR551X_TIM_DELAY_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_vbat_api.c b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_vbat_api.c new file mode 100755 index 0000000..eddeccc --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_vbat_api.c @@ -0,0 +1,103 @@ +/** + **************************************************************************************** + * + * @file gr551x_vbat_api.c + * + * @brief GR551x battery module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of GOODIX 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 COPYRIGHT HOLDERS AND 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. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "gr55xx_hal.h" +#include "gr55xx_sys.h" +#include "gr551x_vbat_api.h" + +/* + * GLOBAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ + +/* + * STATIC VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static adc_handle_t gr551x_vbat_handle = {0}; +static double adc_offset = 0; +static double adc_slope = 0; + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +void hal_gr551x_vbat_init(void) +{ + adc_trim_info_t adc_trim = {0}; + + gr551x_vbat_handle.init.channel_n = ADC_INPUT_SRC_BAT; + gr551x_vbat_handle.init.channel_p = ADC_INPUT_SRC_BAT; + gr551x_vbat_handle.init.input_mode = ADC_INPUT_SINGLE; + gr551x_vbat_handle.init.ref_source = ADC_REF_SRC_BUF_INT; + gr551x_vbat_handle.init.ref_value = ADC_REF_VALUE_0P8; + gr551x_vbat_handle.init.clock = ADC_CLK_1P6M; + hal_adc_init(&gr551x_vbat_handle); + + if(SDK_SUCCESS == sys_adc_trim_get(&adc_trim)) + { + adc_offset = (double)adc_trim.offset_int_0p8; + adc_slope = (-1) * (double)adc_trim.slope_int_0p8; + } + else + { + adc_offset = 8362; + adc_slope = -4754; + } + return; +} + +double hal_gr551x_vbat_read(void) +{ + uint16_t conver_buff[16] = {0}; + uint16_t average = 0; + + /* Got the average of Vbat */ + SET_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_VBAT_EN_Msk); + hal_adc_poll_for_conversion(&gr551x_vbat_handle, conver_buff, 16); + CLEAR_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_VBAT_EN_Msk);//disable vbat for power save + for(uint8_t i = 0; i < 8; i++) + { + average += conver_buff[8 + i]; + } + average = average >> 3; + return (((double)average - adc_offset) / adc_slope) * (27.0 / 7.0); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_vbat_api.h b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_vbat_api.h new file mode 100755 index 0000000..9dac110 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr551x/gr551x_vbat_api.h @@ -0,0 +1,75 @@ +/** + **************************************************************************************** + * + * @file gr551x_vbat_api.h + * + * @brief Header file - GR551x battery module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * 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. + * Neither the name of GOODIX 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 COPYRIGHT HOLDERS AND 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. + ***************************************************************************************** + */ +#ifndef __GR551X_VBAT_API_H__ +#define __GR551X_VBAT_API_H__ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Initialize ADC battery voltage detection. + * + **************************************************************************************** + */ +void hal_gr551x_vbat_init(void); + +/** + **************************************************************************************** + * @brief Get the battery voltage. + * + * @return The volatge of battery. Unit (volt). + **************************************************************************************** + */ +double hal_gr551x_vbat_read(void); + +#ifdef __cplusplus +} +#endif + +#endif // __GR551X_VBAT_API_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_lfs/app_lfs.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_lfs/app_lfs.c index 3d959d8..b4545c1 100755 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_lfs/app_lfs.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_lfs/app_lfs.c @@ -60,8 +60,7 @@ int app_lfs_device_sync(const struct lfs_config *c); static uint32_t s_app_lfs_start_addr; static lfs_t s_app_lfs_instance; - -static const struct lfs_config s_app_lfs_cfg = +static struct lfs_config s_app_lfs_cfg = { .context = NULL, .read = app_lfs_block_read, @@ -71,7 +70,6 @@ static const struct lfs_config s_app_lfs_cfg = .read_size = APP_LFS_READ_SIZE, .prog_size = APP_LFS_PROG_SIZE, .block_size = APP_LFS_BLOCK_SIZE, - .block_count = APP_LFS_BLOCK_COUNT, .block_cycles = APP_LFS_BLOCK_CYCLES, .cache_size = APP_LFS_CACHE_SIZE, .lookahead_size = APP_LFS_LOOKAHEAD_SIZE, @@ -90,8 +88,8 @@ static void s_lfs_start_addr_get(void) hal_flash_get_info(&flash_id, &flash_size); nvds_start_addr = APP_LFS_FLASH_BASE + flash_size - hal_flash_sector_size() * NVDS_NUM_SECTOR; - s_app_lfs_start_addr = nvds_start_addr - APP_LFS_BLOCK_COUNT * APP_LFS_BLOCK_SIZE; - APP_LOG_INFO("LFS Flash start addr=0x%x, All size=%dKB", s_app_lfs_start_addr, APP_LFS_BLOCK_COUNT * APP_LFS_BLOCK_SIZE / 1024); + s_app_lfs_start_addr = nvds_start_addr - s_app_lfs_cfg.block_count * APP_LFS_BLOCK_SIZE; + APP_LOG_INFO("LFS Flash start addr=0x%x, All size=%dKB", s_app_lfs_start_addr, s_app_lfs_cfg.block_count * APP_LFS_BLOCK_SIZE / 1024); } int app_lfs_block_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size) @@ -147,10 +145,11 @@ int app_lfs_device_sync(const struct lfs_config *c) * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ -int app_lfs_init(void) +int app_lfs_init(int lfs_block_count) { int error_code = APP_LFS_ERR_OK; + s_app_lfs_cfg.block_count = lfs_block_count; error_code = lfs_mount(&s_app_lfs_instance, &s_app_lfs_cfg); if (LFS_ERR_OK != error_code) { diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_lfs/app_lfs.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_lfs/app_lfs.h index 6d54558..2e210bf 100755 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_lfs/app_lfs.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_lfs/app_lfs.h @@ -71,10 +71,6 @@ #define APP_LFS_BLOCK_CYCLES 500 #endif -#ifndef APP_LFS_BLOCK_COUNT -#define APP_LFS_BLOCK_COUNT 10 -#endif - #ifndef APP_LFS_LOOKAHEAD_SIZE #define APP_LFS_LOOKAHEAD_SIZE 32 #endif @@ -137,10 +133,12 @@ typedef void (*app_lfs_traverse_cb_t)(char *name, uint32_t size); ***************************************************************************************** * @brief Initialize APP Little File System instance. * + * @param[in] lfs_block_count: Number of flash blocks used by the LFS file system. + * * @return Result of initialization. ***************************************************************************************** */ -int app_lfs_init(void); +int app_lfs_init(int lfs_block_count); /** ***************************************************************************************** diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/patch/symbol_table/rom_symbol.txt b/gr551x/sdk_liteos/gr551x_sdk/components/patch/symbol_table/rom_symbol.txt deleted file mode 100755 index 21102b8..0000000 --- a/gr551x/sdk_liteos/gr551x_sdk/components/patch/symbol_table/rom_symbol.txt +++ /dev/null @@ -1,1303 +0,0 @@ -## ARM Linker -0x00801f84 D func_env -0x00800c40 D g_dbg_rwip_info -0x00800654 D g_scan_watch_period_hs -0x0002fbc9 T ke_free -0x000301a1 T ke_msg_alloc -0x00030225 T ke_msg_free -0x00030239 T ke_msg_send -0x000416a9 T lld_calc_aux_rx -0x00801274 D lld_env -0x0004bcd1 T lld_rxdesc_check -0x0004bd05 T lld_rxdesc_free -0x0002faa5 T ke_event_get_all -0x0004bddd T lld_scan_end -0x00800660 D lld_scan_env -0x00800658 D lld_scan_frm_cbk -0x0004c3a5 T lld_scan_frm_skip_isr -0x0004c4d5 T lld_scan_get_adv_data_len -0x0005eba8 D lld_scan_map_legacy_pdu_to_evt_type -0x0004d165 T lld_scan_sched_func -0x0004db35 T lld_scan_sync_accept -0x0004dc49 T lld_scan_sync_info_unpack -0x0004dcd5 T lld_scan_trunc_ind -0x00800664 D lld_scan_sync_env -0x0080065c D lld_scan_sched -0x00800bbc D rwip_rf -0x00055269 T sch_arb_remove -0x00800808 D sw_to_hw -0x00802378 D rf_init_callback -0x00065f97 T ble_env_get -0x0006aa8d T ble_h4tl_stop -0x0006e831 T ble_wait_for_bleslpstat_signal -0x00802446 D g_sleep_complement_us -0x0080246c D g_sleep_param_cfg -0x00075bc9 T get_rf_api -0x00079ec5 T rwip_lpcycles_2_hus -0x00079f11 T rwip_us_2_lpcycles -0x00079f71 T sdk_blecore_presleep_task -0x0007bf79 T sys_sleep_enter -0x0007bf7d T sys_sleep_env_get -0x0080244c D update_lpclk -0x0080237c D rf_wakeup_init_callback -0x000374dd T llc_disconnect -0x00801238 D llc_env -0x00037a99 T llc_hci_enc_evt_send -0x00037ba9 T llc_hci_ltk_request_evt_send -0x00037cd5 T llc_iv_skd_rand_gen -0x00037e29 T llc_le_ping_restart -0x00038079 T llc_ll_enc_rsp_ack_handler -0x000380a1 T llc_ll_enc_rsp_pdu_send -0x00038209 T llc_ll_pause_enc_rsp_pdu_send -0x00038291 T llc_ll_reject_ind_ack_handler -0x000382b9 T llc_ll_reject_ind_pdu_send -0x00038315 T llc_ll_start_enc_req_pdu_send -0x0003832d T llc_ll_start_enc_rsp_ack_handler -0x00038355 T llc_ll_start_enc_rsp_pdu_send -0x0003852d T llc_llcp_state_set -0x00038dcd T llc_loc_encrypt_proc_continue_func -0x00039d31 T llc_proc_get -0x00039e19 T llc_proc_state_get -0x00039e1d T llc_proc_state_set -0x00039e21 T llc_proc_timer_pause_set -0x00039ed5 T llc_proc_timer_set -0x00039f89 T llc_proc_unreg -0x0003a3e5 T llc_rem_encrypt_proc_continue_func -0x0003aaf9 T llc_sk_gen -0x00044aa5 T lld_con_data_flow_set -0x00044e01 T lld_con_enc_key_load -0x00046605 T lld_con_rx_enc -0x00047239 T lld_con_tx_enc -0x0004474d T lld_con_activity_offset_compute -0x00045d11 T lld_con_offset_get -0x00052189 T llm_le_evt_mask_check -0x0080067c D lld_test_env -0x00052391 T llm_rx_path_comp_get -0x0004f2d9 T lld_test_rx_isr -0x00070281 T fpb_load_state -0x000702ed T fpb_save_state -0x0004f1f5 T lld_test_frm_isr -0x00800704 D bb_watch_timer_start -0x0000a601 T bb_watch_timer_start_func -0x0004f1b1 T lld_test_frm_cbk -0x00801ac0 D sch_prog_env -0x00054335 T rwip_time_get -0x000544bd T rwip_timer_hus_set -0x00803212 D efuse_trim -0x00802384 D efuse_config -0x0007b94d T sys_ble_heartbeat_period_set -0x0006c3b9 T ble_rwip_wakeup -0x0006c6e5 T ble_sdk_core_reinit -0x0006e121 T ble_sdk_rf_wakeup_init -0x00802468 D ble_sleep_irq_handler -0x00802444 D g_b_merge_slp_wakeup -0x00802454 D g_lpclkper -0x00802448 D g_merge_threshold_us -0x00079f57 T sdk_blecore_postsleep_task -0x0007bf21 T sys_prevent_sleep_set -0x0001797c T hal_aon_gpio_br_callback -0x0007bf1d T sys_prevent_sleep_clear -0x0080095c D h4tl_env -0x000169a5 T h4tl_read_start -0x008006b2 D g_rsvd_before_abort_hus -0x008003d2 D rwip_prog_delay -0x008006d8 D sch_arb_event_start_isr -0x00054bc9 T sch_arb_event_start_isr_func -0x008006b0 D g_sch_arb_prog_delay_hus -0x008006d4 D sch_arb_insert -0x00054e41 T sch_arb_insert_func -0x008013b4 D lld_con_env -0x0080062c D lld_con_evt_time_update -0x000455cd T lld_con_evt_time_update_func -0x00049915 T lld_iso_hop_accel_isr -0x00053b61 T rwip_isr -0x00802380 D ble_irq_handler -0x0006f581 T dfu_flash_type_set -0x00802490 D all_check_sum -0x0006faed T dfu_send_frame -0x0006f919 T dfu_program_end -0x0006f235 T dfu_copy_flash_process -0x00802485 D xip_copy_flag -0x0006fa2d T dfu_reset_device -0x00802548 D cmd_receive_flag -0x00803588 D now_img_info -0x0006fa4d T dfu_security_check_enable -0x0006f569 T dfu_flash_set_security -0x0006f4b5 T dfu_flash_get_security -0x0006fb69 T dfu_set_cmd_handler -0x0080256c D FLASH_OP_START_ADDR -0x00802488 D file_size -0x008026a0 D p_func_shutdown -0x000794f5 T restore_sys_context -0x0007c2c9 T ultra_wfe -0x008026ac D g_msp_context_bl -0x000787ad T pwr_mgmt_check_ble_timer -0x00078c41 T pwr_mgmt_locker -0x00062dc9 T pwr_mgmt_save_ctx_lvl_two -0x00078fed T pwr_mgmt_unlocker -0x00079f35 T save_context_and_enter_sleep -0x0080239c D ble_sdk_handler -0x00030363 T ke_sleep_check -0x008026a4 D ultra_wfe_is_allowed -0x008026b0 D pwr_mgmt_var_box -0x00065cd1 T ble_core_sleep_func -0x000636c9 T BLESLEEP_IRQHandler_func -0x0007db28 D RF_100OHM_LP_TX_PW_CONV_TBL -0x0007db7c D RF_100OHM_ULP_TX_PW_CONV_TBL -0x0007dae8 D RF_25OHM_ULP_TX_PW_CONV_TBL -0x008023fa D g_rf_tx_power_dbm_default -0x0007963d T rf_agc_init -0x00079659 T rf_api_init -0x000796f5 T rf_communication_core_init -0x000797f1 T rf_em_init -0x00079809 T rf_freq_table_init -0x00079979 T rf_mat_cir_get -0x00079991 T rf_misc_init -0x00079a05 T rf_modulation_accuracy_calibration -0x00079c1d T rf_trim_calibration -0x00079c59 T rf_tx_mode_get -0x00802400 D tx_power_offset -0x0005dcf0 D rom_gapc_msg_handler_tab -0x008002c0 D TASK_DESC_GAPC -0x00800dcc D gapc_env -0x0000f2a9 T gapc_get_conidx -0x0000f591 T gapc_get_operation -0x000586a9 T smpc_generate_stk -0x0005aaf9 T smpc_secure_connections_enabled -0x0005abbd T smpc_send_ltk_req_rsp -0x0005ac39 T smpc_send_pairing_ind -0x008006fc D ble_rf_calibration_func -0x0005dc70 D hci_le_event_handler_tab -0x008023f8 D g_rf_tx_power_level_max -0x00079945 T rf_init -0x008023e8 D g_bond_list -0x0000be99 T co_bdaddr_compare -0x0005d0d4 D co_null_bdaddr -0x00800680 D g_max_con_intv -0x00800682 D g_max_con_sup_to -0x0003afe7 T lld_addr_is_in_ral_list -0x00800648 D lld_init_start -0x00051569 T llm_activity_free_get -0x00051bc5 T llm_cmd_stat_send -0x008014a4 D llm_env -0x00800298 D llm_hci_cmd_handler_tab_info -0x00051f25 T llm_is_dev_connected -0x0005d0b4 D one_bits -0x0005592d T sch_plan_req -0x0005546d T sch_plan_chk -0x00004bb9 T bl1_srand -0x00063339 T sdk_srand -0x00802348 D ble_sdk_init -0x0006dbe5 T ble_sdk_init_func -0x00802354 D TASK_DESC_SDK -0x0006596d T ble_bm_init -0x00068e7d T ble_gatt_init -0x0006b9c5 T ble_ke_state_set -0x0006b9c9 T ble_ke_task_create -0x0006c241 T ble_nvds_initialized -0x0006c529 T ble_sdk_adap_config_get -0x0006dfcd T ble_sdk_iso_init -0x0006e09d T ble_sdk_l2cap_init -0x0006e0b9 T ble_sdk_prf_init -0x0006e1a5 T ble_sdk_sec_init -0x00802344 D default_sdk_adapt_present -0x0007a1f1 T sdk_timer_init -0x00802209 D add_whitelist_bong_flag -0x0006c215 T ble_nvds_get -0x0007d388 D default_device_name -0x00071079 T gap_cache_data_init -0x00073079 T gap_reset -0x0080272a D sdk_gapc_env -0x0007a251 T sec_build_rand16 -0x00802208 D set_privacy_mode_flag -0x0080220c D gap_device_config_params_init -0x00030891 T ke_timer_clear -0x0004b901 T lld_res_list_is_empty -0x0004c561 T lld_scan_params_update -0x0004dab1 T lld_scan_stop -0x00051ba9 T llm_cmd_cmp_send -0x0005204d T llm_is_wl_empty -0x000523e5 T llm_scan_start -0x00052575 T llm_update_dbg_act_state_info -0x00800692 D scan_host_params -0x0006c465 T ble_rwip_wakeup_end -0x000536a1 T register_rwip_wakeup -0x0004f795 T lld_white_list_add -0x00051be1 T llm_dev_list_empty_entry -0x00051c05 T llm_dev_list_search -0x0004f831 T lld_white_list_rem -0x00068789 T ble_gap_static_random_addr_set -;0x0006c24d T ble_nvds_put -0x0000a5fd T bb_watch_timer_cbk_func -0x0004c07d T lld_scan_evt_start_cbk -0x008006e4 D g_bb_watch_period_times -0x0004c205 T lld_scan_frm_eof_isr -0x0004c339 T lld_scan_frm_rx_isr -0x00053879 T rwble_recovery -0x0005db83 D rwip_priority -0x00054771 T sch_alarm_clear -0x00054861 T sch_alarm_set -0x00800708 D sch_prog_push -0x000566a9 T sch_slice_bg_add -0x008006e8 D g_bb_crush_wa_cnt -0x008006f8 D ble_activity_end_notify_func -0x0000a9dd T ble_get_role_and_cs_idx_from_et -0x00801ab4 D g_bb_watch_alarm -0x0080070c D sch_prog_activity_isr -0x00055ba9 T sch_prog_convert_cs_idx_to_handle -0x00055bb9 T sch_prog_end_isr -0x00056295 T sch_prog_rx_iso_isr -0x00056309 T sch_prog_rx_isr -0x000563dd T sch_prog_skip_isr -0x00056561 T sch_prog_tx_iso_isr -0x000565d5 T sch_prog_tx_isr -0x00800700 D bb_watch_timer_cbk -0x0007b95d T sys_ble_timer_10ms_handler -0x0007b961 T sys_ble_timer_hs_handler -0x0007b965 T sys_ble_timer_hus_handler -0x0007bf81 T sys_sleep_wakeup_end -0x00037905 T llc_hci_con_param_req_evt_send -0x0003793d T llc_hci_con_upd_info_send -0x00037f95 T llc_ll_connection_param_rsp_pdu_send -0x00038bb5 T llc_loc_con_upd_proc_err_cb -0x008005d8 D llc_pref_param_compute -0x008005d4 D llc_rem_con_upd_proc_continue -0x00045f2d T lld_con_param_update -0x0004739d T lld_con_tx_len_update_for_intv -0x00054319 T rwip_sw_int_req -0x0000c125 T co_list_extract_sublist -0x0000c231 T co_list_insert_after -0x0000c54d T co_list_push_back_sublist -0x0000c60d T co_list_push_front -0x000549b1 T sch_arb_conflict_check -0x00054aa5 T sch_arb_elt_cancel -0x008019b4 D sch_arb_env -0x00054dd1 T sch_arb_idle_time_notify -0x0005516d T sch_arb_prog_timer -0x00055321 T sch_arb_sched_act_margin -0x008006f0 D g_bb_watch_period_hs -0x008006ec D g_debug_push_cnt -0x008006ea D g_prefetch_wa_cnt -0x000166b1 T get_time_before_instant_by_hus -0x0000c1bd T co_list_find -0x00801c34 D sch_alarm_env -0x000096d1 T atts_mtu_exc_req -0x0000917d T atts_find_info_req -0x00008ef9 T atts_find_by_type_req -0x00009cf5 T atts_read_by_type_req -0x00009ac5 T atts_read_by_grp_type_req -0x0000a0b1 T atts_read_req -0x00009991 T atts_read_blob_req -0x0000a369 T atts_write_cmd -0x0000a3f9 T atts_write_req -0x0000a4d9 T atts_write_signed -0x0000976d T atts_prepare_write_req -0x00008ce9 T atts_execute_write_req -0x008002d8 D TASK_DESC_GATTC -0x000072c5 T attc_l2cc_pdu_recv_handler -0x0005e424 D gattc_msg_handler_tab -0x00030375 T ke_state_get -0x00032629 T l2cc_pdu_alloc -0x0003108b T l2cc_pdu_send -0x00008c95 T atts_clear_read_cache -0x000093fd T atts_get_att_chk_perm -0x000094f5 T atts_get_value -0x000095c1 T atts_hdl_value_cfm -0x0080057c D atts_pdu_handler_info -0x000098c9 T atts_process_pdu -0x0000a1b9 T atts_send_error -0x0000a273 T atts_send_pdu -0x0000c4c5 T co_list_push_back -0x0000c68d T co_list_size -0x00800ec4 D gattc_env -0x0001501d T gattc_get_mtu -0x0002fec9 T ke_malloc -0x0007bd5d T sys_first_regs_save -0x0000add9 T ble_util_buf_rx_alloc -0x0000ae15 T ble_util_buf_rx_free -0x00800604 D lld_exp_sync_pos_tab -0x0004dddd T lld_sync_cleanup -0x00801474 D lld_sync_env -0x00800664 D __lld_sync_env -0x00800670 D lld_sync_frm_cbk -0x0004e00d T lld_sync_frm_eof_isr -0x0004e10d T lld_sync_frm_rx_isr -0x0004e175 T lld_sync_frm_skip_isr -0x00801414 D lld_sync_rx_info -0x0080066c D lld_sync_sched -0x0004ef79 T lld_sync_trunc_ind -0x00800f58 D ble_util_buf_env -0x0000bf45 T co_list_extract -0x0080060c D lld_init -0x0004851d T lld_init_func -0x0003f1a1 T lld_bi_frm_cbk -0x000421e5 T lld_ci_frm_cbk -0x0007d5ac D NVDS_MAGIC -0x0006ed9d T cp_hdr_incr -0x0006edbd T dec_flash_read -0x0006edf1 T dec_flash_write -0x000700bd T find_item -0x000757b9 T get_align_bytes -0x008023d0 D m_nvds_end_addr -0x008023c8 D m_nvds_initialized -0x008032d8 D m_nvds_mgr -0x008023cc D m_nvds_start_addr -0x00079395 T read_incr -0x0007c0b5 T tags_cache_clean -0x0007c109 T tags_cache_rec_del -0x0007c631 T verify_hdr_checksum -0x0007c671 T write_compacted_items -0x0007c845 T write_item -0x0005be59 T svc_get_nvds_api_entry -0x008005e0 D llc_rem_encrypt_proc_continue -0x0000ab09 T ble_util_buf_acl_tx_free -0x00065825 T ble_bm_get_ral_dev_list -0x00802718 D g_conn_cmp_info -0x00802198 D g_gap_cb_fun -0x00073105 T gap_reslv_addr -0x00802200 D gapc_msg_handler_desc -0x00074ccf T gatt_on_connection -0x0007a3b9 T sec_on_conn_complete -0x00078971 T pwr_mgmt_force_wakeup_ble_done -0x00079efd T rwip_prevent_sleep_get -0x008022b4 D ble_sdk_gattc_cb_env -0x008022bc D gatt_msg_handler_desc -0x008002fc D TASK_DESC_LLC -0x008026bc D g_sleep_env -0x00802674 D s_is_need_to_care_about_app_timer -0x008006cc D ble_activity_start_notify_func -0x00052a65 T prevent_sleep_get -0x000539dd T rwip_crypt_isr_handler -0x00054309 T rwip_sw_int_handler -0x00054395 T rwip_timer_10ms_handler -0x00054435 T rwip_timer_hs_handler -0x00054499 T rwip_timer_hus_handler -0x000545b9 T rwip_wakeup -0x000546b1 T rwip_wakeup_end -0x00054995 T sch_arb_allow_activity_notify -0x000448bd T lld_con_cleanup -0x000449f5 T lld_con_clear_ccmcnt_rx -0x00044a11 T lld_con_clear_ccmcnt_tx -0x00045c29 T lld_con_max_lat_calc -0x00800630 D lld_con_sched -0x0004dd49 T lld_supervision_to_cb -0x000538f9 T rwip_active_check -0x0000c47b T co_list_pop_front -0x00801384 D lld_adv_env -0x00800644 D lld_init_env -0x00800634 D lld_con_start -0x00045021 T lld_con_frm_cbk_func -0x00046add T lld_con_start_func -0x00049805 T lld_instant_proc_end -0x00069029 T ble_gattc_mtu_exchange_rom -0x00068f91 T ble_gattc_char_desc_discover_rom -0x00068f9b T ble_gattc_char_discover_rom -0x00068fab T ble_gattc_included_services_discover_rom -0x00068fb5 T ble_gattc_indicate_cfm_rom -0x000699b9 T ble_gattc_primary_services_discover_rom -0x00069a6d T ble_gattc_read_rom -0x00069af5 T ble_gattc_read_by_uuid_rom -0x00069bb1 T ble_gattc_read_multiple_rom -0x00069c49 T ble_gattc_services_browse_rom -0x00069d05 T ble_gattc_write_rom -0x00069ddd T ble_gattc_write_execute_rom -0x00069e55 T ble_gattc_write_no_resp_rom -0x00069edd T ble_gattc_write_prepare_rom -0x0006909d T ble_gattc_prf_char_desc_discover_rom -0x0006913d T ble_gattc_prf_char_discover_rom -0x00069215 T ble_gattc_prf_evt_handle_register_rom -0x0006921b T ble_gattc_prf_evt_handle_unregister_rom -0x00069221 T ble_gattc_prf_included_services_discover_rom -0x000692c1 T ble_gattc_prf_indicate_cfm_rom -0x00069349 T ble_gattc_prf_primary_services_discover_rom -0x0006940d T ble_gattc_prf_read_rom -0x000694a9 T ble_gattc_prf_read_by_uuid_rom -0x00069581 T ble_gattc_prf_read_multiple_rom -0x00069625 T ble_gattc_prf_services_browse_rom -0x000696e9 T ble_gattc_prf_write_rom -0x000697cd T ble_gattc_prf_write_execute_rom -0x00069859 T ble_gattc_prf_write_no_resp_rom -0x000698f9 T ble_gattc_prf_write_prepare_rom -0x0006a10d T ble_gatts_noti_ind_rom -0x0006a271 T ble_gatts_prepare_write_cfm_rom -0x0006a399 T ble_gatts_read_cfm_rom -0x0006a971 T ble_gatts_write_cfm_rom -0x00068ec5 T ble_gatt_mtu_get_rom -0x0007a4e9 T sec_on_disconn -0x00074dd9 T gatt_on_disconnection -0x0007a2f9 T sec_clear_bond_info_env -0x000418c9 T lld_ch_map_upd_cfm_handler -0x0004b67d T lld_phy_upd_cfm_handler -0x00045da1 T lld_con_offset_upd_ind_handler -0x00800320 D llcp_pdu_handler -0x00036855 T llc_ch_map_up_proc_err_cb -0x00039d65 T llc_proc_id_get -0x00039d99 T llc_proc_reg -0x0003a00d T llc_rem_ch_map_proc_continue_func -0x0002bac1 T hci_send_2_host -0x008006e6 D g_et_correct_cnt -0x008006b6 D g_max_evt_start_cbk_run_hus -0x008006ba D g_max_evt_start_rsvd_hus -0x008006b8 D g_min_evt_start_cbk_run_hus -0x008006bc D g_min_evt_start_rsvd_hus -0x008006ac D g_sch_arb_pick_limit -0x00037491 T llc_con_upd_param_in_range -0x008005d0 D llc_loc_con_upd_proc_continue -0x00039cb5 T llc_proc_collision_check -0x0003a2b1 T llc_rem_con_upd_proc_err_cb -0x008005f0 D llc_loc_phy_upd_proc_continue -0x008005ec D llc_rem_phy_upd_proc_continue -0x0003a9c5 T llc_rem_phy_upd_proc_err_cb -0x0005c801 T xqspi_wait_flag_state_until_retry -0x00021f19 T hal_xqspi_msp_init -0x00801f28 D g_xqspi_handle -0x008023c9 D m_encryption_enabled -0x0007d529 D rom_prf_unint -0x0007d52a D sdk_prf_unint -0x0007afed T set_sdk_schedule_event -0x0006ed25 T config_1M_tx_gain_value -0x0006ed45 T config_2M_tx_gain_value -0x0006ed65 T config_coded_tx_gain_value -0x000668f1 T ble_gap_callback_register -0x00068e2d T ble_gatt_common_callback_register -0x00068f7d T ble_gattc_callback_register -0x0006c3ad T ble_rom_prf_init -0x0006c51d T ble_schedule_start -0x0006e101 T ble_sdk_rf_init -0x0006e235 T ble_sec_callback_register -0x00802680 D local_mem_pwr_mgmt_check_proc -0x00053601 T register_config_1M_tx_gain_value -0x0005360d T register_config_2M_tx_gain_value -0x00053619 T register_config_coded_tx_gain_value -0x00053695 T register_rwip_us_2_lpcycles -0x000536ad T register_rwip_wakeup_end -0x00079b79 T rf_recalibrate -0x0005be71 T svc_rwip_init -0x0005bead T svc_set_heaps_table_entry -0x0000e495 T exflash_enable_quad -0x0000e6a5 T exflash_resume -0x0000e6c1 T exflash_suspend -0x0001941d T hal_exflash_msp_init -0x00049a6d T lld_llcp_rx_ind_handler -0x00049c95 T lld_llcp_tx_cfm_handler -0x0003aed9 T lld_acl_rx_ind_handler -0x00045e6d T lld_con_param_upd_cfm_handler -0x00803528 D g_ble_slp_reg -0x0006e8a9 T calc_checksum -0x0003679d T llc_auth_payl_nearly_to_handler -0x00036801 T llc_auth_payl_real_to_handler -0x00075d4d T hal_efuse_deinit -0x00075d65 T hal_efuse_init -0x00802268 D gap_actv_type_str -0x00802210 D gap_adv_fsm_next -0x0007269d T gap_get_adv_idx_by_actv_idx -0x00072761 T gap_get_per_sync_idx_by_actv_idx -0x00802218 D gap_init_fsm_next -0x0080221c D gap_per_sync_fsm_next -0x00802214 D gap_scan_fsm_next -0x00802298 D gapm_msg_handler_desc -0x008003e0 D gapc_auth_get -0x0000f2f5 T gapc_get_dest_task -0x0000f8e1 T gapc_link_encrypted -0x0000fe49 T gapc_send_complete_evt -0x000104c5 T gapc_update_state -0x00800514 D smpc_handle_enc_change_evt -0x0005b5b5 T smpc_tkdp_rcp_start -0x0005b78d T smpc_tkdp_send_start -0x0007bd9b T sys_get_heap_info -0x008023ec D g_sec_cb_fun -0x0007106d T gap_cache_data_get -0x00008449 T attmdb_get_attribute -0x00008bed T attmdb_uuid16_comp -0x00074235 T gapm_cmp_evt_handler -0x000123c9 T gapm_get_att_handle -0x00077d35 T operate_system_info -0x00068dc1 T ble_gapc_auth_get -0x00800628 D lld_con_tx_prog -0x00038679 T llc_llcp_tx_check -0x00044ec1 T lld_con_event_counter_get -0x008006ae D g_sch_arb_insert_run_hus - -0x0002f989 T ke_event_callback_set -0x0002f9c5 T ke_event_clear -0x0002fb11 T ke_event_set -0x00800598 D l2cc_data_send -0x00800e00 D gapm_env -0x00800f4c D l2cm_env - -0x008002f0 D TASK_DESC_L2CC -0x00800f18 D l2cc_env -0x00033d85 T l2cm_get_nb_buffer_available -0x00800624 D lld_con_frm_cbk - -0x00065501 T ble_bm_clear_bond_devs -0x000655f1 T ble_bm_del_bond_dev -0x00065749 T ble_bm_get_bond_devs -0x000686ad T ble_gap_set_ral_list -0x00071049 T gap_bm_error_to_sdk_error -0x00071159 T gap_check_modify_bondlist -0x0080233c D bonds -0x00070141 T find_peer_addr -0x000701c9 T find_unused_bond_idx -0x00802338 D g_bond_num -0x0007c469 T update_lru_bond_list - -0x000705a5 T gap_activity_opera_start -0x00010025 T gapc_set_local_addr -0x00010f7d T gapm_actv_alloc -0x00010fbd T gapm_actv_created -0x000111d5 T gapm_actv_retrieve_cmd_cmp_evt -0x000112b9 T gapm_actv_started -0x000123b9 T gapm_get_address_type -0x000126b1 T gapm_get_requester -0x0001287d T gapm_init_check_param -0x008004c8 D gapm_init_connection_ind -0x00012a1d T gapm_init_delete -0x00012a21 T gapm_init_send_hci_le_create_con_cancel_cmd -0x00012a33 T gapm_init_send_hci_le_ext_create_con_cmd -0x00012bbd T gapm_init_stopped -0x00012c0d T gapm_is_addr_type_valid -0x00025295 T hci_le_cmd_cmp_evt_started_handler -0x00025481 T hci_le_cmd_cmp_evt_stopping_handler -0x000309b1 T ke_timer_set -0x0005de90 D gapm_hci_cmd_cmp_event_handler_tab -0x0005e010 D gapm_hci_cmd_stat_event_handler_tab -0x0005e080 D gapm_msg_handler_tab -0x00010fad T gapm_actv_check_create_param -0x000110c5 T gapm_actv_get_free_idx -0x00011a19 T gapm_adv_create -0x000133fd T gapm_per_sync_create -0x00013649 T gapm_process_op -0x000139bd T gapm_scan_create -0x008003ec D gapm_send_complete_evt -0x008002cc D TASK_DESC_GAPM -0x008004e8 D gapm_hci_cmd_cmp_event_handler_tab_info -0x008004e0 D gapm_hci_cmd_stat_event_handler_tab_info -0x00803414 D HP_Gain_1M -0x000537c5 T rwble_init -0x00053ddd T rwip_prevent_sleep_set -0x00053dad T rwip_prevent_sleep_clear -0x00056931 T set_master_gclk -0x000795a5 T rf_SX_Tune -0x00079559 T rf_SX_Enable -0x00079601 T rf_SX_reset -0x00075745 T get_F_value -0x00802228 D actv_state_str -0x00070479 T gap_activity_opera_end -0x000719c5 T gap_create_initiating -0x00071da1 T gap_delete_initiating -0x00073b45 T gap_start_initiating -0x00073de9 T gap_stop_initiating -0x00075825 T get_conn_idx_by_hdl -0x00800618 D lld_adv_start -0x0003dc09 T lld_adv_start_func -0x0004f319 T lld_test_start -0x000658ed T ble_bm_get_sec_info_by_peer_irk -0x00071095 T gap_cache_data_save -0x0007265d T gap_get_actv_type_by_actv_idx -0x0003aff9 T lld_adv_adv_data_set -0x0003b11d T lld_adv_aux_ch_idx_set -0x0003b5b1 T lld_adv_end -0x0003bdc5 T lld_adv_ext_chain_construct -0x00800614 D lld_adv_frm_cbk -0x0003cd81 T lld_adv_frm_skip_isr -0x0003cf49 T lld_adv_pkt_rx -0x0003daa1 T lld_adv_scan_rsp_data_set -0x0000ab69 T ble_util_buf_adv_tx_free -0x0004efa5 T lld_test_cleanup -## ROM_SYMBOL -0x00801f10 D boot_info -0x0002f831 T jump_app -0x0000bdf5 T check_boot_info -0x0000be3d T check_image_crc -0x00016e71 T hal_adc_get_dma_threshold -0x00016e81 T hal_adc_get_error -0x00016e85 T hal_adc_get_state -0x00017021 T hal_adc_register_callback -0x00017055 T hal_adc_set_dma_threshold -0x00005edd T adc_dma_error -0x00005ef1 T adc_wait_notempty_until_timeout -0x00800364 D p_adc_callback -0x00800368 D p_aes_callback -0x00800384 D p_efuse_callback -0x008003ac D p_rng_callback -0x000171d9 T hal_aes_abort -0x000171f9 T hal_aes_abort_it -0x000171fd T hal_aes_cbc_decrypt -0x000172b5 T hal_aes_cbc_decrypt_it -0x0001730d T hal_aes_cbc_encrypt -0x000173c9 T hal_aes_cbc_encrypt_it -0x00017475 T hal_aes_ecb_decrypt -0x00017525 T hal_aes_ecb_decrypt_it -0x00017579 T hal_aes_ecb_encrypt -0x0001762d T hal_aes_ecb_encrypt_it -0x0001769d T hal_aes_get_error -0x000176a1 T hal_aes_get_state -0x0001772d T hal_aes_irq_handler -0x00017831 T hal_aes_register_callback -0x0001783d T hal_aes_resume_reg -0x000178d9 T hal_aes_set_timeout -0x000178dd T hal_aes_suspend_reg -0x00017a75 T hal_aon_gpio_read_pin -0x00017a8d T hal_aon_gpio_register_callback -0x00017b39 T hal_aon_wdt_deinit_ext -0x00017ba9 T hal_aon_wdt_irq_handler -0x00017c19 T hal_aon_wdt_register_callback -0x00017e95 T hal_calendar_register_callback -0x000180a7 T hal_comp_get_error -0x000180ab T hal_comp_get_state -0x0001815d T hal_comp_register_callback -0x00018169 T hal_comp_resume_reg -0x00018179 T hal_comp_start -0x000181bd T hal_comp_stop -0x00018205 T hal_comp_suspend_reg -0x00018249 T hal_deinit_ext -0x0001824d T hal_delay -0x00018265 T hal_dma_abort -0x00018345 T hal_dma_abort_it -0x00018459 T hal_dma_get_error -0x0001845d T hal_dma_get_state -0x000184f1 T hal_dma_irq_handler -0x00018639 T hal_dma_poll_for_transfer -0x00018729 T hal_dma_register_callback -0x00018775 T hal_dma_resume_reg -0x000187bd T hal_dma_start -0x00018839 T hal_dma_start_it -0x00018911 T hal_dma_suspend_reg -0x0001893d T hal_dma_unregister_callback -0x00018a7d T hal_dual_timer_base_start -0x00018ab7 T hal_dual_timer_base_start_it -0x00018af1 T hal_dual_timer_base_stop -0x00018b2b T hal_dual_timer_base_stop_it -0x00018b6f T hal_dual_timer_deinit_ext -0x00018b73 T hal_dual_timer_get_state -0x00018b77 T hal_dual_timer_init_ext -0x00018bcd T hal_dual_timer_register_callback -0x00018c2d T hal_efuse_crc_calculate -0x00018d75 T hal_efuse_initial_value_check -0x00018e01 T hal_efuse_read -0x00018e79 T hal_efuse_read_trim -0x00018f05 T hal_efuse_register_callback -0x00018f11 T hal_efuse_set_main_backup -0x00018f2d T hal_efuse_write -0x0001902d T hal_efuse_write_keyram -0x0001907d T hal_exflash_deepsleep -0x000190f3 T hal_exflash_deinit_ext -0x00019245 T hal_exflash_get_error -0x00019249 T hal_exflash_get_state -0x0001935d T hal_exflash_init_ext -0x00019361 T hal_exflash_lock -0x00019435 T hal_exflash_read_rom -0x0001958d T hal_exflash_register_callback -0x00019599 T hal_exflash_reset -;0x000195db T hal_exflash_resume -0x0001962d T hal_exflash_set_retry -;0x00019631 T hal_exflash_suspend -0x00019683 T hal_exflash_unlock -0x00019723 T hal_exflash_wakeup -0x000199c1 T hal_get_tick -0x00019a71 T hal_gpio_deinit_ext -0x00019a91 T hal_gpio_exti_irq_handler -0x00019acb T hal_gpio_init_ext -0x00019acf T hal_gpio_read_pin -0x00019ae1 T hal_gpio_register_callback -0x00019aed T hal_gpio_toggle_pin -0x00019af5 T hal_gpio_write_pin -0x00019dbd T hal_hmac_register_callback -0x0001ae51 T hal_i2c_register_callback -0x0001b299 T hal_i2s_abort -0x0001b3e1 T hal_i2s_deinit_ext -0x0001b401 T hal_i2s_get_error -0x0001b405 T hal_i2s_get_rx_fifo_threshold -0x0001b40f T hal_i2s_get_state -0x0001b415 T hal_i2s_get_tx_fifo_threshold -0x0001b515 T hal_i2s_init_ext -0x0001b519 T hal_i2s_irq_handler -0x0001b661 T hal_i2s_receive -0x0001b6f9 T hal_i2s_receive_dma -0x0001b825 T hal_i2s_receive_it -0x0001b8fd T hal_i2s_register_callback -0x0001b909 T hal_i2s_resume_reg -0x0001b969 T hal_i2s_set_rx_fifo_threshold -0x0001b9b7 T hal_i2s_set_tx_fifo_threshold -0x0001ba05 T hal_i2s_start_clock -0x0001ba2d T hal_i2s_stop_clock -0x0001ba55 T hal_i2s_suspend_reg -0x0001bb19 T hal_i2s_transmit_dma -0x0001bc59 T hal_i2s_transmit_it -0x0001bd31 T hal_i2s_transmit_receive -0x0001bdc9 T hal_i2s_transmit_receive_dma -0x0001bf3d T hal_i2s_transmit_receive_it -0x0001c051 T hal_increment_tick -0x0001c071 T hal_init_ext -0x0001c075 T hal_init_tick -0x0001c095 T hal_mpu_config_region -0x0001c0ed T hal_mpu_disable -0x0001c105 T hal_mpu_enable -0x0001c18d T hal_msio_read_pin -0x0001c1a5 T hal_msio_toggle_pin -0x0001c1bd T hal_msio_write_pin -0x0001c219 T hal_nvic_clear_pending_irq -0x0001c233 T hal_nvic_disable_irq -0x0001c255 T hal_nvic_enable_irq -0x0001c26f T hal_nvic_get_active -0x0001c297 T hal_nvic_get_pending_irq -0x0001c2bf T hal_nvic_get_priority -#0x0001c315 T hal_nvic_get_priority_grouping -0x0001c325 T hal_nvic_set_pending_irq -0x0001c341 T hal_nvic_set_priority -0x0001c399 T hal_nvic_set_priority_grouping -0x0001d971 T hal_pkc_register_callback -0x0001df01 T hal_pwr_config_timer_wakeup_ext -0x0001df05 T hal_pwr_enter_chip_deepsleep -0x0001df81 T hal_pwr_register_timer_elaspsed_handler -0x0001df8d T hal_pwr_set_comm_mode -0x0001dfc1 T hal_pwr_set_comm_power -0x0001e035 T hal_pwr_set_mem_current_power -0x0001e071 T hal_pwr_set_mem_deepsleep_power -0x0001e091 T hal_pwr_set_mem_wakeup_power -0x0001e0b1 T hal_pwr_set_wakeup_condition -0x0001e0d9 T hal_pwr_sleep_timer_irq_handler -0x0001f4c5 T hal_qspi_register_callback -0x0001f921 T hal_register_callback -0x0001f92d T hal_resume_tick -0x0001fb23 T hal_rng_get_state -0x0001fb95 T hal_rng_irq_handler -0x0001fc01 T hal_rng_read_last_random_number -0x0001fc21 T hal_rng_register_callback -0x0001fc2d T hal_rng_resume_reg -0x0001fc47 T hal_rng_suspend_reg -0x0001fc51 T hal_sha256_digest -0x0001fcb3 T hal_sha256_digest_dma -0x0001fd09 T hal_sha256_digest_it -0x0001fd5f T hal_spi_abort -0x0001fe0d T hal_spi_abort_it -0x0001ff4d T hal_spi_deinit_ext -0x0001ff6d T hal_spi_get_error -0x0001ff71 T hal_spi_get_rx_fifo_threshold -0x0001ff7b T hal_spi_get_state -0x0001ff81 T hal_spi_get_tx_fifo_threshold -0x0002013d T hal_spi_init_ext -0x00020141 T hal_spi_irq_handler -0x000202d5 T hal_spi_read_eeprom -0x00020369 T hal_spi_read_eeprom_dma -0x000205e1 T hal_spi_receive -0x00020669 T hal_spi_receive_dma -0x00020829 T hal_spi_register_callback -0x00020835 T hal_spi_resume_reg -0x00020891 T hal_spi_set_rx_fifo_threshold -0x000208bf T hal_spi_set_timeout -0x000208c3 T hal_spi_set_tx_fifo_threshold -0x000208f1 T hal_spi_suspend_reg -0x00020917 T hal_spi_transmit -0x0002098d T hal_spi_transmit_dma -0x00020b3b T hal_spi_transmit_receive -0x00020bb5 T hal_spi_transmit_receive_dma -0x00020e21 T hal_suspend_tick -0x00020e2f T hal_systick_callback -0x00020e31 T hal_systick_clk_source_config -0x00020e4d T hal_systick_config -0x00020e75 T hal_systick_irq_handler -0x00020f25 T hal_timer_base_start -0x00020f5f T hal_timer_base_start_it -0x00020f99 T hal_timer_base_stop -0x00020fd3 T hal_timer_base_stop_it -0x00021017 T hal_timer_base_deinit_ext -0x0002101b T hal_timer_get_state -0x0002101f T hal_timer_base_init_ext -0x00021023 T hal_timer_irq_handler -0x0002104d T hal_timer_register_callback -0x00021059 T hal_timer_set_config -0x00021081 T hal_uart_abort -0x00021119 T hal_uart_abort_it -0x000211c5 T hal_uart_abort_receive -0x00021225 T hal_uart_abort_receive_it -0x000212c9 T hal_uart_abort_transmit -0x00021325 T hal_uart_abort_transmit_it -0x00021479 T hal_uart_deinit_ext -0x0002147d T hal_uart_dma_pause -0x000214e5 T hal_uart_dma_resume -0x00021545 T hal_uart_dma_stop -0x00021595 T hal_uart_get_error -0x00021655 T hal_uart_init_ext -0x00021659 T hal_uart_irq_handler -0x00021749 T hal_uart_receive -0x000217ad T hal_uart_receive_dma -0x000218a9 T hal_uart_receive_it -0x00021911 T hal_uart_register_callback -0x0002191d T hal_uart_resume_reg -0x00021981 T hal_uart_suspend_reg -0x000219bf T hal_uart_transmit -0x00021a35 T hal_uart_transmit_dma -0x00021ac1 T hal_uart_transmit_it -0x00021b79 T hal_wdt_deinit_ext -0x00021be1 T hal_wdt_init_ext -0x00021be5 T hal_wdt_irq_handler -0x00021c7d T hal_wdt_refresh -0x00021cb9 T hal_wdt_register_callback -0x00021cc5 T hal_xqspi_command_receive -0x00021d53 T hal_xqspi_command_transmit -0x00021e17 T hal_xqspi_deinit_ext -0x00021e1b T hal_xqspi_get_error -0x00021e1f T hal_xqspi_get_rx_fifo_threshold -0x00021e2b T hal_xqspi_get_state -0x00021e31 T hal_xqspi_get_tx_fifo_threshold -0x00021ef5 T hal_xqspi_init_ext_rom -0x00021f31 T hal_xqspi_receive -0x00021fbd T hal_xqspi_register_callback -0x00021fc9 T hal_xqspi_set_retry -0x00021fcd T hal_xqspi_set_rx_fifo_threshold -0x0002200b T hal_xqspi_set_tx_fifo_threshold -;0x00022049 T hal_xqspi_set_xip_present_status -0x00022139 T hal_xqspi_transmit -0x0005c697 T xqspi_send_inst_addr -0x00031095 T ll_clock_accuracy_req_handler -0x00033f3d T ll_adc_struct_init -0x00033f55 T ll_aes_deinit -0x00033f63 T ll_aes_init -0x00033f77 T ll_aes_struct_init -0x000340bd T ll_aon_gpio_struct_init -0x0003413d T ll_cgc_deinit -0x00034151 T ll_cgc_init -0x00034199 T ll_cgc_struct_init -0x000341a9 T ll_channel_map_ind_handler -0x0003426d T ll_cis_ind_handler -0x000342e1 T ll_cis_req_handler -0x00034535 T ll_cis_rsp_handler -0x0003460d T ll_cis_terminate_ind_handler -0x00034625 T ll_clock_accuracy_rsp_handler -0x00034651 T ll_comp_deinit -0x00034661 T ll_comp_init -0x000346ad T ll_comp_struct_init -0x000346b9 T ll_connection_param_req_handler -0x00034795 T ll_connection_param_rsp_handler -0x0003482d T ll_connection_update_ind_handler -0x00034955 T ll_dbg_is_opcode_supported -0x00034e49 T ll_dma_struct_init -0x00034e99 T ll_dual_timer_deinit -0x00034ea9 T ll_dual_timer_init -0x00034ed5 T ll_dual_timer_struct_init -0x00034efd T ll_enc_req_handler -0x00034fc5 T ll_enc_rsp_handler -0x00035039 T ll_feature_req_handler -0x00035051 T ll_feature_rsp_handler -0x000350a1 T ll_get_event_cnt -0x000350b1 T ll_gpio_deinit -0x0003516d T ll_gpio_init -0x00035381 T ll_gpio_struct_init -0x00035395 T ll_hmac_deinit -0x000353a3 T ll_hmac_init -0x000353cb T ll_hmac_struct_init -0x0003543d T ll_i2c_init -0x00035501 T ll_i2c_struct_init -0x00035515 T ll_i2s_deinit -0x0003561d T ll_i2s_init -0x00035769 T ll_i2s_struct_init -0x00035783 T ll_length_req_handler -0x000357d9 T ll_length_rsp_handler -0x00035859 T ll_min_used_channels_ind_handler -0x00035a0d T ll_msio_struct_init -0x00035a21 T ll_pause_enc_req_handler -0x00035a95 T ll_pause_enc_rsp_handler -0x00035af9 T ll_phy_req_handler -0x00035bad T ll_phy_rsp_handler -0x00035c2d T ll_phy_update_ind_handler -0x00035cc5 T ll_ping_req_handler -0x00035ccf T ll_ping_rsp_handler -0x00035ced T ll_pkc_deinit -0x00035d13 T ll_pkc_init -0x00035d49 T ll_pkc_struct_init -0x00035f2d T ll_qspi_deinit -0x00035f4d T ll_qspi_init -0x00035ff5 T ll_qspi_struct_init -0x00036075 T ll_rng_deinit -0x0003609b T ll_rng_init -0x000360e3 T ll_rng_struct_init -0x000360f9 T ll_slave_feature_req_handler -0x0003612d T ll_spim_deinit -0x00036149 T ll_spim_init -0x000361a9 T ll_spim_struct_init -0x000361d9 T ll_spis_deinit -0x000361ef T ll_spis_init -0x0003623d T ll_spis_struct_init -0x0003624d T ll_start_enc_req_handler -0x000362a5 T ll_start_enc_rsp_handler -0x000362fd T ll_terminate_ind_handler -0x00036339 T ll_timer_deinit -0x00036347 T ll_timer_init -0x0003634f T ll_timer_struct_init -0x00036357 T ll_uart_deinit -0x00036361 T ll_uart_init -0x000363e5 T ll_uart_struct_init -0x00036409 T ll_version_ind_handler -0x00036461 T ll_xqspi_deinit -0x000364dd T ll_xqspi_init -0x00036749 T ll_xqspi_struct_init -0x0080035c D diag_shutdown_func -0x008005e4 D g_bqb_test_en -0x0080061e D g_lld_con_heap_used_ratio_limit -0x008006c0 D diag_evt_start_cbk_start_func -0x008006c4 D diag_evt_start_cbk_done_func -0x008023fb D g_b_rf_bqb_test_enable -0x00006f01 T assert_err -0x00006f2d T assert_param -0x00006f5d T assert_warn -0x0000aa4d T ble_sdk_default_prf_config_set -0x0000cd9d T dbg_log_printf -0x0005bf05 T sys_signal_handler_register -0x0005c889 T rom_init -0x00062d69 T pwr_mgmt_save_context -0x00062d99 T pwr_mgmt_load_context -0x000637d1 T BLESLP_IRQHandler -0x000637dd T BLE_IRQHandler -0x00063839 T BLE_SDK_Handler -0x000637e9 T BLE_IRQHandler_func -0x000638b5 T SVC_handler_proc -0x00064dbd T ble_activity_end_notify_cb_register -0x00064dfd T ble_activity_start_notify_cb_register -0x00064e19 T ble_aes_ccm -0x00064e49 T ble_aes_cmac -0x00064e55 T ble_aes_encrypt -0x00064e65 T ble_aes_k1 -0x00064e79 T ble_aes_k2 -0x00064e85 T ble_aes_k3 -0x00064e89 T ble_aes_k4 -0x00064e8d T ble_aes_rand -0x00064e91 T ble_aes_result_handler -0x00064e95 T ble_aes_s1 -0x00064ea5 T ble_attm_reserve_handle_range -0x00064ea9 T ble_attm_svc_create_db -0x00064f0d T ble_attmdb_svc_visibility_set -0x00064f15 T ble_audio_callback_register -0x00064f25 T ble_audio_event_count_read -0x00065015 T ble_audio_role_switch -0x00065131 T ble_audio_sniffer_create -0x00065225 T ble_audio_sync_info_send -0x000652b9 T ble_audio_time_sync -0x00065b29 T ble_client_prf_add -0x00065c29 T ble_co_list_extract -0x00065c2d T ble_co_list_init -0x00065c31 T ble_co_list_insert_before -0x00065c35 T ble_co_list_pop_front -0x00065c39 T ble_co_list_push_back -0x00065c3d T ble_co_list_push_back_sublist -0x00065c41 T ble_co_list_push_front -0x00065c45 T ble_co_util_pack -0x00065c51 T ble_co_util_unpack -0x00065c5d T ble_core_is_powered_on -0x00065f9d T ble_gap_active_link_set -0x00065fb1 T ble_gap_addr_get -;0x0006602d T ble_gap_addr_set -0x00066121 T ble_gap_adv_data_set -0x00066231 T ble_gap_adv_param_set -0x0006647d T ble_gap_adv_start -0x00066695 T ble_gap_adv_stop -0x00066729 T ble_gap_appearance_get -0x00066779 T ble_gap_appearance_set -;0x000667bd T ble_gap_bond_dev_del -;0x00066835 T ble_gap_bond_devs_clear -0x0006689d T ble_gap_bond_devs_get -0x00066909 T ble_gap_chnl_map_set -0x000669ad T ble_gap_con_plan_consult -0x00066a05 T ble_gap_conn_info_get -0x00066ac5 T ble_gap_conn_param_update -0x00066ba9 T ble_gap_conn_param_update_reply -;0x00066c59 T ble_gap_connect -0x00066d51 T ble_gap_connect_cancel -0x00066dad T ble_gap_data_length_set -0x00066e21 T ble_gap_data_length_update -0x00066ec1 T ble_gap_default_tx_power_get -0x00066ec5 T ble_gap_default_tx_power_set -0x00066ec9 T ble_gap_dev_info_get -0x00066f91 T ble_gap_device_name_get -0x00067021 T ble_gap_device_name_set -0x000670c5 T ble_gap_disconnect -0x00067149 T ble_gap_ext_adv_param_set -0x00067429 T ble_gap_ext_connect -0x00067561 T ble_gap_ext_scan_param_set -0x00067621 T ble_gap_irk_set -0x00067689 T ble_gap_l2cap_params_set -0x0006771d T ble_gap_lepsm_register -0x000678a1 T ble_gap_lepsm_unregister -0x00067941 T ble_gap_pair_enable -0x00067999 T ble_gap_path_compensation_set -0x000679ed T ble_gap_peer_info_get -0x00067aa1 T ble_gap_per_adv_list_add -0x00067bc1 T ble_gap_per_adv_list_clear -0x00067c25 T ble_gap_per_adv_list_del -0x00067d09 T ble_gap_per_adv_list_get -0x00067d8d T ble_gap_per_sync_param_set -0x00067e85 T ble_gap_per_sync_start -0x00067f51 T ble_gap_per_sync_stop -0x00067ff5 T ble_gap_phy_update -0x00068099 T ble_gap_ppcp_get -0x000680f5 T ble_gap_ppcp_present_set -0x00068159 T ble_gap_ppcp_set -0x000681b5 T ble_gap_pref_phy_set -0x00068209 T ble_gap_privacy_mode_set -0x0006828d T ble_gap_privacy_params_set -0x00068375 T ble_gap_role_set -0x000683c1 T ble_gap_rpa_list_get -0x00068415 T ble_gap_rslv_addr_read -0x000684b5 T ble_gap_scan_param_set -0x0006859d T ble_gap_scan_start -0x00068629 T ble_gap_scan_stop -0x00068841 T ble_gap_tx_power_get -0x00068919 T ble_gap_tx_power_set -0x00068a01 T ble_gap_update_adv_data -0x00068abd T ble_gap_whitelist_add -0x00068bf1 T ble_gap_whitelist_clear -0x00068c55 T ble_gap_whitelist_del -0x00068d3d T ble_gap_whitelist_get -0x00068dd5 T ble_gapc_role_get -0x00068ddd T ble_gapm_bdaddr_get -0x00068f25 T ble_gatt_mtu_set -0x00068fa7 T ble_gattc_get_mtu -0x00069f91 T ble_gatts_attr_permission_get -0x0006a09d T ble_gatts_attr_permission_set -0x0006a4e9 T ble_gatts_service_changed -0x0006a555 T ble_gatts_srvc_db_create -0x0006a861 T ble_gatts_value_get -0x0006a90d T ble_gatts_value_set -0x0006aaa9 T bl1_hci_uart_register -0x0006aab1 T ble_idle_time_notify_cb_register -0x0006aad1 T ble_init_cmp_callback_register -0x0006ab01 T ble_iso_accept_cis_req -0x0006abdd T ble_iso_create_big -0x0006acd5 T ble_iso_create_big_sync -0x0006ade1 T ble_iso_create_cis -0x0006af01 T ble_iso_disc_cis -0x0006af5d T ble_iso_discover_ann -0x0006afe9 T ble_iso_get_core_bts -0x0006afed T ble_iso_read_tx_sync -0x0006aff1 T ble_iso_reg_rcv_data_cb -0x0006b007 T ble_iso_register_ascp_gap_callback -0x0006b00d T ble_iso_register_callback -0x0006b021 T ble_iso_reject_cis_req -0x0006b089 T ble_iso_req_peer_sca -0x0006b105 T ble_iso_rm_cig -0x0006b171 T ble_iso_rm_data_path -0x0006b1ed T ble_iso_send_data -0x0006b231 T ble_iso_set_cig_param -0x0006b41d T ble_iso_set_data_path -0x0006b49d T ble_iso_start_bd_ann -0x0006b569 T ble_iso_start_gen_ann -0x0006b619 T ble_iso_start_target_ann -0x0006b6fd T ble_iso_stop_ann -0x0006b709 T ble_iso_stop_discover_ann -0x0006b70d T ble_iso_stop_sync_bd_ann -0x0006b711 T ble_iso_sync_bd_ann -0x0006b7e1 T ble_iso_terminate_big -0x0006b851 T ble_iso_terminate_big_sync -0x0006b8d9 T ble_ke_event_callback_set -0x0006b8dd T ble_ke_event_clear -0x0006b8e1 T ble_ke_event_set -0x0006b8e5 T ble_ke_free -0x0006b8e9 T ble_ke_malloc -0x0006b935 T ble_ke_msg_alloc -0x0006b9b9 T ble_ke_msg_forward -0x0006b9bd T ble_ke_msg_free -0x0006b9c1 T ble_ke_msg_send -0x0006b9cd T ble_ke_time -0x0006b9d1 T ble_l2cap_lecb_cb_register -0x0006bb3d T ble_l2cap_lecb_conn_cfm -0x0006bc8d T ble_l2cap_lecb_conn_create -0x0006be85 T ble_l2cap_lecb_credits_add -0x0006bf9d T ble_l2cap_lecb_disconnect -0x0006c069 T ble_l2cap_lecb_sdu_send -0x0006c205 T ble_mesh_prf_cbs_register -0x0006c27d T ble_prf_env_get -0x0006c34d T ble_prf_src_task_get -0x0006c351 T ble_prf_task_env_get -0x0006c355 T ble_rf_calibration_func_cb_register -0x0006c371 T ble_rf_match_circuit_get -0x0006c375 T ble_rf_match_circuit_set -0x0006c379 T ble_rf_tx_mode_get -0x0006c37d T ble_rf_tx_mode_set -0x0006c3b1 T ble_rwip_reset -0x0006c3b5 T ble_rwip_time_get -0x0006c511 T ble_sch_alarm_clear -0x0006c515 T ble_sch_alarm_prog -0x0006c519 T ble_sch_alarm_set -0x0006e1a1 T ble_sdk_schedule -0x0006e249 T ble_sec_enc_cfm -;0x0006e361 T ble_sec_enc_start -0x0006e429 T ble_sec_keypress_notify_send -0x0006e4ad T ble_sec_params_set -0x0006e569 T ble_server_prf_add -0x0006e67d T ble_stack_debug_setup -;0x0006e6fd T ble_stack_init -0x0006ef31 T dfu_ble_receive_data_process -0x0006ef59 T dfu_ble_send_data_cmpl_process -0x0006ef95 T dfu_ble_set_mtu_size -0x0006f15d T dfu_cmd_parse_state_reset -0x0006f011 T dfu_cmd_disable_config -0x0006f535 T dfu_flash_read -0x0006f42d T dfu_flash_erase -0x0006f675 T dfu_flash_write -0x0006f5a5 T dfu_flash_update -0x0006f6a9 T dfu_init -0x0006fa3d T dfu_schedule -0x0006fbf1 T dfu_spi_flash_func_config -0x0006fc5d T dfu_start_jump -0x0006fe75 T dfu_uart_receive_data_process -0x0006f71d T dfu_port_flash_init -0x00075c51 T get_system_config_info -0x00077bd1 T operate_nvds -;0x000701f5 T fpb_enable -0x00070229 T fpb_init -0x000702e1 T fpb_register_patch_init_func -;0x00070331 T fun_replace_by_svc -0x000736d5 T gap_set_device_config -;0x00075db5 T hal_flash_erase -;0x00075dd1 T hal_flash_erase_chip -0x00075ded T hal_flash_get_info -0x00075e05 T hal_flash_get_security -;0x00075e15 T hal_flash_init -;0x00075e79 T hal_flash_read -0x00075e99 T hal_flash_sector_size -0x00075ea1 T hal_flash_set_security -;0x00075ead T hal_flash_write -0x00077569 T mesh_init_callback_register -0x000775c1 T mesh_prf_config -0x0007760d T nvds_del -0x000776f5 T nvds_get -0x00077839 T nvds_get_start_addr -0x00077845 T nvds_init -0x00077a7d T nvds_tag_length -0x00078739 T pwr_mgmt_baseband_state_get -;0x0006aadd T ble_is_ready -0x00078791 T pwr_mgmt_check_ble_event -0x000788e1 T pwr_mgmt_check_pend_irq -0x00078905 T pwr_mgmt_dev_init -0x00078915 T pwr_mgmt_dev_resume -0x00078925 T pwr_mgmt_dev_suspend -0x000789b9 T pwr_mgmt_get_sleep_mode -0x00078af1 T pwr_mgmt_get_wakeup_flag -0x00078b05 T pwr_mgmt_init -0x00078c4d T pwr_mgmt_mem_check_process_reg -0x00078c59 T pwr_mgmt_mode_get -0x00078c65 T pwr_mgmt_mode_set -0x00078c7d T pwr_mgmt_notify_timer_event -0x00078c95 T pwr_mgmt_rtc_timer_thrd_set -;0x00078ca1 T pwr_mgmt_schedule -0x00078dc9 T pwr_mgmt_set_callback -0x00078dd5 T pwr_mgmt_set_wakeup_flag -0x00078ded T pwr_mgmt_shutdown -0x00078ff5 T pwr_mgmt_update_wkup_param -0x000790dd T pwr_mgmt_wakeup_source_clear -0x000790f1 T pwr_mgmt_wakeup_source_setup -0x00079105 T pwr_mgmt_wfe_sleep -0x00079ba1 T rf_recalibration_handler_register -0x00079939 T rf_get_recalibration_flag -0x00079bed T rf_set_recalibration_flag -0x00079e1d T rom_simu -0x0007a02d T sdk_register_assert_cb -0x0007b759 T svc_func_register -0x0007b79d T svc_table_register -0x0007b879 T sys_assert_cb_register -0x0007b985 T sys_context_save -0x0007bb65 T sys_context_save_register -0x0007bbf5 T sys_delay_ms -0x0007bbff T sys_delay_us -0x0007bd79 T sys_free -0x0007bdab T sys_ke_sleep_check -0x0007bdb7 T sys_ke_timer_clear -0x0007bdbb T sys_ke_timer_set -0x0007bdc1 T sys_link_quality_clear -0x0007bde1 T sys_link_quality_get -0x0007be21 T sys_lpclk_set -0x0007be3d T sys_lpclk_update_func_register -0x0007be49 T sys_lpcycles_2_hus -0x0007be5d T sys_malloc -0x0007be69 T sys_max_msg_usage_ratio_set -0x00001b75 T gm_drv_present_encrypt -0x0007bf5d T sys_security_data_use_present -0x0007bf6d T sys_security_enable_status_check -0x0007bf85 T sys_swd_disable -0x0007bf95 T sys_swd_enable -0x0007bfa5 T sys_timer_clear -0x0007bfd5 T sys_timer_set -0x0007c059 T sys_us_2_lpcycles -0x0007c345 T ultra_wfi -0x0007be15 T sys_lpclk_get -0x0007be51 T sys_lpper_get -0x0007af95 T set_comm_wkup_time -0x00078e85 T pwr_mgmt_sleep_param_get -0x00078985 T pwr_mgmt_get_counter_A_B -0x00801f64 D g_exflash_handle -0x00802364 D diag_ble_isr_start_func -0x00802368 D diag_ble_isr_done_func -0x00802458 D diag_ble_core_sleep_status_func -0x0080245c D diag_ble_core_sleep_break_func -0x00802460 D diag_no25_isr_start_func -0x00802464 D diag_no25_isr_done_func -0x0080247c D g_lpcalibcyclecount -0x00802480 D ble_core_sleep -0x00802684 D pwr_mgmt_status_chk_func -0x00802688 D pwr_mgmt_sched_ret_func -0x0080268c D pwr_mgmt_before_enter_sleep_fun -0x00802690 D pwr_mgmt_device_state_check -0x008026a8 D ultra_wfi_or_wfe -0x0080277c D sdk_gap_env -0x00803d64 D patch_func_table -0x00800500 D rom_callback -0x00802675 D s_sys_clk -0x0080267c D s_pwr_mgmt_table -0x008006b4 D g_evt_start_cbk_run_hus -0x008006a3 D hci_ext_host -0x00801950 D hci_env -0x00801f10 D bl1_boot_info -0x00800000 D bl0_boot_info -0x0002b1b5 T hci_look_for_cmd_desc -0x000531b5 T qspi_config -0x00053475 T qspi_send_inst_addr -0x00053545 T qspi_wait_flag_state_until_timeout -0x0000e78d T exflash_wakeup -0x0000e3fd T exflash_check_id -0x0000e479 T exflash_deepsleep -0x0000e515 T exflash_erase_chip -0x0000e571 T exflash_erase_sector -0x0000e5d9 T exflash_page_program -0x0000e4f9 T exflash_enable_write -0x0000e715 T exflash_wait_busy -0x0000e7a9 T exflash_write_status -0x00065a49 T ble_bm_set_gatt_info -0x00069f8d T ble_gattm_svc_start_hdl_get -0x0007475d T gatt_add_bond_cccd -0x00074b99 T gatt_find_item -0x0007a37d T sec_get_bond_dev_addr -0x008022d8 D gatt_on_disconnection_fp -0x00075075 T gatt_remove_item -0x00075509 T gattc_on_disconnection -0x00064f05 T ble_attmdb_get_attribute -0x00064f11 T ble_attmdb_uuid16_comp -0x0006c341 T ble_prf_get_id_from_task -0x00802308 D prf_default_msg_handler_tab -0x00078221 T prf_get_prf_cb_by_task_id -0x0006e8c0 T calculate_hmac -0x000658b9 T ble_bm_get_sec_info -0x008023f0 D g_sec_param -0x0007a341 T sec_enc_link -0x0007ae21 T sec_send_pair_req -0x0007ae51 T sec_send_security_req -0x0080343c D HP_Gain_2M -0x00067709 T ble_gap_latency_set - - -0x00800638 D g_master_chsel_2_supported -0x0003ae59 T lld_aa_gen -0x00047b6d T lld_init_connect_req_pack -0x0004800d T lld_init_evt_canceled_cbk -0x00048105 T lld_init_evt_start_cbk -0x0004b6bd T lld_ral_search -0x0004b71d T lld_read_clock -0x00800710 D sch_slice_params -0x0080063c D lld_init_frm_cbk -0x00047b21 T lld_init_compute_winoffset - -0x0000e8ad T force_dpad_le_high -0x0080076c D restore_sys_env_callback - -0x00800668 D lld_scan_start -0x0004d561 T lld_scan_start_func \ No newline at end of file diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/patch/symbol_table/rom_symbol_iar.txt b/gr551x/sdk_liteos/gr551x_sdk/components/patch/symbol_table/rom_symbol_iar.txt deleted file mode 100755 index d9c7180..0000000 --- a/gr551x/sdk_liteos/gr551x_sdk/components/patch/symbol_table/rom_symbol_iar.txt +++ /dev/null @@ -1,1273 +0,0 @@ ---define_symbol func_env=0x00801f84 ---define_symbol g_dbg_rwip_info=0x00800c40 ---define_symbol g_scan_watch_period_hs=0x00800654 ---define_symbol ke_free=0x0002fbc9 ---define_symbol ke_msg_alloc=0x000301a1 ---define_symbol ke_msg_free=0x00030225 ---define_symbol ke_msg_send=0x00030239 ---define_symbol lld_calc_aux_rx=0x000416a9 ---define_symbol lld_env=0x00801274 ---define_symbol lld_rxdesc_check=0x0004bcd1 ---define_symbol lld_rxdesc_free=0x0004bd05 ---define_symbol ke_event_get_all=0x0002faa5 ---define_symbol lld_scan_end=0x0004bddd ---define_symbol lld_scan_env=0x00800660 ---define_symbol lld_scan_frm_cbk=0x00800658 ---define_symbol lld_scan_frm_skip_isr=0x0004c3a5 ---define_symbol lld_scan_get_adv_data_len=0x0004c4d5 ---define_symbol lld_scan_map_legacy_pdu_to_evt_type=0x0005eba8 ---define_symbol lld_scan_sched_func=0x0004d165 ---define_symbol lld_scan_sync_accept=0x0004db35 ---define_symbol lld_scan_sync_info_unpack=0x0004dc49 ---define_symbol lld_scan_trunc_ind=0x0004dcd5 ---define_symbol lld_scan_sync_env=0x00800664 ---define_symbol lld_scan_sched=0x0080065c ---define_symbol rwip_rf=0x00800bbc ---define_symbol sch_arb_remove=0x00055269 ---define_symbol sw_to_hw=0x00800808 ---define_symbol rf_init_callback=0x00802378 ---define_symbol ble_env_get=0x00065f97 ---define_symbol ble_h4tl_stop=0x0006aa8d ---define_symbol ble_wait_for_bleslpstat_signal=0x0006e831 ---define_symbol g_sleep_complement_us=0x00802446 ---define_symbol g_sleep_param_cfg=0x0080246c ---define_symbol get_rf_api=0x00075bc9 ---define_symbol rwip_lpcycles_2_hus=0x00079ec5 ---define_symbol rwip_us_2_lpcycles=0x00079f11 ---define_symbol sdk_blecore_presleep_task=0x00079f71 ---define_symbol sys_sleep_enter=0x0007bf79 ---define_symbol sys_sleep_env_get=0x0007bf7d ---define_symbol update_lpclk=0x0080244c ---define_symbol rf_wakeup_init_callback=0x0080237c ---define_symbol llc_disconnect=0x000374dd ---define_symbol llc_env=0x00801238 ---define_symbol llc_hci_enc_evt_send=0x00037a99 ---define_symbol llc_hci_ltk_request_evt_send=0x00037ba9 ---define_symbol llc_iv_skd_rand_gen=0x00037cd5 ---define_symbol llc_le_ping_restart=0x00037e29 ---define_symbol llc_ll_enc_rsp_ack_handler=0x00038079 ---define_symbol llc_ll_enc_rsp_pdu_send=0x000380a1 ---define_symbol llc_ll_pause_enc_rsp_pdu_send=0x00038209 ---define_symbol llc_ll_reject_ind_ack_handler=0x00038291 ---define_symbol llc_ll_reject_ind_pdu_send=0x000382b9 ---define_symbol llc_ll_start_enc_req_pdu_send=0x00038315 ---define_symbol llc_ll_start_enc_rsp_ack_handler=0x0003832d ---define_symbol llc_ll_start_enc_rsp_pdu_send=0x00038355 ---define_symbol llc_llcp_state_set=0x0003852d ---define_symbol llc_loc_encrypt_proc_continue_func=0x00038dcd ---define_symbol llc_proc_get=0x00039d31 ---define_symbol llc_proc_state_get=0x00039e19 ---define_symbol llc_proc_state_set=0x00039e1d ---define_symbol llc_proc_timer_pause_set=0x00039e21 ---define_symbol llc_proc_timer_set=0x00039ed5 ---define_symbol llc_proc_unreg=0x00039f89 ---define_symbol llc_rem_encrypt_proc_continue_func=0x0003a3e5 ---define_symbol llc_sk_gen=0x0003aaf9 ---define_symbol lld_con_data_flow_set=0x00044aa5 ---define_symbol lld_con_enc_key_load=0x00044e01 ---define_symbol lld_con_rx_enc=0x00046605 ---define_symbol lld_con_tx_enc=0x00047239 ---define_symbol lld_con_activity_offset_compute=0x0004474d ---define_symbol lld_con_offset_get=0x00045d11 ---define_symbol llm_le_evt_mask_check=0x00052189 ---define_symbol lld_test_env=0x0080067c ---define_symbol llm_rx_path_comp_get=0x00052391 ---define_symbol lld_test_rx_isr=0x0004f2d9 ---define_symbol fpb_load_state=0x00070281 ---define_symbol fpb_save_state=0x000702ed ---define_symbol lld_test_frm_isr=0x0004f1f5 ---define_symbol bb_watch_timer_start=0x00800704 ---define_symbol bb_watch_timer_start_func=0x0000a601 ---define_symbol lld_test_frm_cbk=0x0004f1b1 ---define_symbol sch_prog_env=0x00801ac0 ---define_symbol rwip_time_get=0x00054335 ---define_symbol rwip_timer_hus_set=0x000544bd ---define_symbol efuse_trim=0x00803212 ---define_symbol efuse_config=0x00802384 ---define_symbol sys_ble_heartbeat_period_set=0x0007b94d ---define_symbol ble_rwip_wakeup=0x0006c3b9 ---define_symbol ble_sdk_core_reinit=0x0006c6e5 ---define_symbol ble_sdk_rf_wakeup_init=0x0006e121 ---define_symbol ble_sleep_irq_handler=0x00802468 ---define_symbol g_b_merge_slp_wakeup=0x00802444 ---define_symbol g_lpclkper=0x00802454 ---define_symbol g_merge_threshold_us=0x00802448 ---define_symbol sdk_blecore_postsleep_task=0x00079f57 ---define_symbol sys_prevent_sleep_set=0x0007bf21 ---define_symbol hal_aon_gpio_br_callback=0x0001797d ---define_symbol sys_prevent_sleep_clear=0x0007bf1d ---define_symbol h4tl_env=0x0080095c ---define_symbol h4tl_read_start=0x000169a5 ---define_symbol g_rsvd_before_abort_hus=0x008006b2 ---define_symbol rwip_prog_delay=0x008003d2 ---define_symbol sch_arb_event_start_isr=0x008006d8 ---define_symbol sch_arb_event_start_isr_func=0x00054bc9 ---define_symbol g_sch_arb_prog_delay_hus=0x008006b0 ---define_symbol sch_arb_insert=0x008006d4 ---define_symbol sch_arb_insert_func=0x00054e41 ---define_symbol lld_con_env=0x008013b4 ---define_symbol lld_con_evt_time_update=0x0080062c ---define_symbol lld_con_evt_time_update_func=0x000455cd ---define_symbol lld_iso_hop_accel_isr=0x00049915 ---define_symbol rwip_isr=0x00053b61 ---define_symbol ble_irq_handler=0x00802380 ---define_symbol dfu_flash_type_set=0x0006f581 ---define_symbol all_check_sum=0x00802490 ---define_symbol dfu_send_frame=0x0006faed ---define_symbol dfu_program_end=0x0006f919 ---define_symbol dfu_copy_flash_process=0x0006f235 ---define_symbol xip_copy_flag=0x00802485 ---define_symbol dfu_reset_device=0x0006fa2d ---define_symbol cmd_receive_flag=0x00802548 ---define_symbol now_img_info=0x00803588 ---define_symbol dfu_security_check_enable=0x0006fa4d ---define_symbol dfu_flash_set_security=0x0006f569 ---define_symbol dfu_flash_get_security=0x0006f4b5 ---define_symbol dfu_set_cmd_handler=0x0006fb69 ---define_symbol FLASH_OP_START_ADDR=0x0080256c ---define_symbol file_size=0x00802488 ---define_symbol p_func_shutdown=0x008026a0 ---define_symbol restore_sys_context=0x000794f5 ---define_symbol ultra_wfe=0x0007c2c9 ---define_symbol g_msp_context_bl=0x008026ac ---define_symbol pwr_mgmt_check_ble_timer=0x000787ad ---define_symbol pwr_mgmt_locker=0x00078c41 ---define_symbol pwr_mgmt_save_ctx_lvl_two=0x00062dc9 ---define_symbol pwr_mgmt_unlocker=0x00078fed ---define_symbol save_context_and_enter_sleep=0x00079f35 ---define_symbol ble_sdk_handler=0x0080239c ---define_symbol ke_sleep_check=0x00030363 ---define_symbol ultra_wfe_is_allowed=0x008026a4 ---define_symbol pwr_mgmt_var_box=0x008026b0 ---define_symbol ble_core_sleep_func=0x00065cd1 ---define_symbol BLESLEEP_IRQHandler_func=0x000636c9 ---define_symbol RF_100OHM_LP_TX_PW_CONV_TBL=0x0007db28 ---define_symbol RF_100OHM_ULP_TX_PW_CONV_TBL=0x0007db7c ---define_symbol RF_25OHM_ULP_TX_PW_CONV_TBL=0x0007dae8 ---define_symbol g_rf_tx_power_dbm_default=0x008023fa ---define_symbol rf_agc_init=0x0007963d ---define_symbol rf_api_init=0x00079659 ---define_symbol rf_communication_core_init=0x000796f5 ---define_symbol rf_em_init=0x000797f1 ---define_symbol rf_freq_table_init=0x00079809 ---define_symbol rf_mat_cir_get=0x00079979 ---define_symbol rf_misc_init=0x00079991 ---define_symbol rf_modulation_accuracy_calibration=0x00079a05 ---define_symbol rf_trim_calibration=0x00079c1d ---define_symbol rf_tx_mode_get=0x00079c59 ---define_symbol tx_power_offset=0x00802400 ---define_symbol rom_gapc_msg_handler_tab=0x0005dcf0 ---define_symbol TASK_DESC_GAPC=0x008002c0 ---define_symbol gapc_env=0x00800dcc ---define_symbol gapc_get_conidx=0x0000f2a9 ---define_symbol gapc_get_operation=0x0000f591 ---define_symbol smpc_generate_stk=0x000586a9 ---define_symbol smpc_secure_connections_enabled=0x0005aaf9 ---define_symbol smpc_send_ltk_req_rsp=0x0005abbd ---define_symbol smpc_send_pairing_ind=0x0005ac39 ---define_symbol ble_rf_calibration_func=0x008006fc ---define_symbol hci_le_event_handler_tab=0x0005dc70 ---define_symbol g_rf_tx_power_level_max=0x008023f8 ---define_symbol rf_init=0x00079945 ---define_symbol g_bond_list=0x008023e8 ---define_symbol co_bdaddr_compare=0x0000be99 ---define_symbol co_null_bdaddr=0x0005d0d4 ---define_symbol g_max_con_intv=0x00800680 ---define_symbol g_max_con_sup_to=0x00800682 ---define_symbol lld_addr_is_in_ral_list=0x0003afe7 ---define_symbol lld_init_start=0x00800648 ---define_symbol llm_activity_free_get=0x00051569 ---define_symbol llm_cmd_stat_send=0x00051bc5 ---define_symbol llm_env=0x008014a4 ---define_symbol llm_hci_cmd_handler_tab_info=0x00800298 ---define_symbol llm_is_dev_connected=0x00051f25 ---define_symbol one_bits=0x0005d0b4 ---define_symbol sch_plan_req=0x0005592d ---define_symbol sch_plan_chk=0x0005546d ---define_symbol bl1_srand=0x00004bb9 ---define_symbol sdk_srand=0x00063339 ---define_symbol ble_sdk_init=0x00802348 ---define_symbol ble_sdk_init_func=0x0006dbe5 ---define_symbol TASK_DESC_SDK=0x00802354 ---define_symbol ble_bm_init=0x0006596d ---define_symbol ble_gatt_init=0x00068e7d ---define_symbol ble_ke_state_set=0x0006b9c5 ---define_symbol ble_ke_task_create=0x0006b9c9 ---define_symbol ble_nvds_initialized=0x0006c241 ---define_symbol ble_sdk_adap_config_get=0x0006c529 ---define_symbol ble_sdk_iso_init=0x0006dfcd ---define_symbol ble_sdk_l2cap_init=0x0006e09d ---define_symbol ble_sdk_prf_init=0x0006e0b9 ---define_symbol ble_sdk_sec_init=0x0006e1a5 ---define_symbol default_sdk_adapt_present=0x00802344 ---define_symbol sdk_timer_init=0x0007a1f1 ---define_symbol add_whitelist_bong_flag=0x00802209 ---define_symbol ble_nvds_get=0x0006c215 ---define_symbol default_device_name=0x0007d388 ---define_symbol gap_cache_data_init=0x00071079 ---define_symbol gap_reset=0x00073079 ---define_symbol sdk_gapc_env=0x0080272a ---define_symbol sec_build_rand16=0x0007a251 ---define_symbol set_privacy_mode_flag=0x00802208 ---define_symbol gap_device_config_params_init=0x0080220c ---define_symbol ke_timer_clear=0x00030891 ---define_symbol lld_res_list_is_empty=0x0004b901 ---define_symbol lld_scan_params_update=0x0004c561 ---define_symbol lld_scan_stop=0x0004dab1 ---define_symbol llm_cmd_cmp_send=0x00051ba9 ---define_symbol llm_is_wl_empty=0x0005204d ---define_symbol llm_scan_start=0x000523e5 ---define_symbol llm_update_dbg_act_state_info=0x00052575 ---define_symbol scan_host_params=0x00800692 ---define_symbol ble_rwip_wakeup_end=0x0006c465 ---define_symbol register_rwip_wakeup=0x000536a1 ---define_symbol lld_white_list_add=0x0004f795 ---define_symbol llm_dev_list_empty_entry=0x00051be1 ---define_symbol llm_dev_list_search=0x00051c05 ---define_symbol lld_white_list_rem=0x0004f831 ---define_symbol ble_gap_static_random_addr_set=0x00068789 ---define_symbol bb_watch_timer_cbk_func=0x0000a5fd ---define_symbol lld_scan_evt_start_cbk=0x0004c07d ---define_symbol g_bb_watch_period_times=0x008006e4 ---define_symbol lld_scan_frm_eof_isr=0x0004c205 ---define_symbol lld_scan_frm_rx_isr=0x0004c339 ---define_symbol rwble_recovery=0x00053879 ---define_symbol rwip_priority=0x0005db83 ---define_symbol sch_alarm_clear=0x00054771 ---define_symbol sch_alarm_set=0x00054861 ---define_symbol sch_prog_push=0x00800708 ---define_symbol sch_slice_bg_add=0x000566a9 ---define_symbol g_bb_crush_wa_cnt=0x008006e8 ---define_symbol ble_activity_end_notify_func=0x008006f8 ---define_symbol ble_get_role_and_cs_idx_from_et=0x0000a9dd ---define_symbol g_bb_watch_alarm=0x00801ab4 ---define_symbol sch_prog_activity_isr=0x0080070c ---define_symbol sch_prog_convert_cs_idx_to_handle=0x00055ba9 ---define_symbol sch_prog_end_isr=0x00055bb9 ---define_symbol sch_prog_rx_iso_isr=0x00056295 ---define_symbol sch_prog_rx_isr=0x00056309 ---define_symbol sch_prog_skip_isr=0x000563dd ---define_symbol sch_prog_tx_iso_isr=0x00056561 ---define_symbol sch_prog_tx_isr=0x000565d5 ---define_symbol bb_watch_timer_cbk=0x00800700 ---define_symbol sys_ble_timer_10ms_handler=0x0007b95d ---define_symbol sys_ble_timer_hs_handler=0x0007b961 ---define_symbol sys_ble_timer_hus_handler=0x0007b965 ---define_symbol sys_sleep_wakeup_end=0x0007bf81 ---define_symbol llc_hci_con_param_req_evt_send=0x00037905 ---define_symbol llc_hci_con_upd_info_send=0x0003793d ---define_symbol llc_ll_connection_param_rsp_pdu_send=0x00037f95 ---define_symbol llc_loc_con_upd_proc_err_cb=0x00038bb5 ---define_symbol llc_pref_param_compute=0x008005d8 ---define_symbol llc_rem_con_upd_proc_continue=0x008005d4 ---define_symbol lld_con_param_update=0x00045f2d ---define_symbol lld_con_tx_len_update_for_intv=0x0004739d ---define_symbol rwip_sw_int_req=0x00054319 ---define_symbol co_list_extract_sublist=0x0000c125 ---define_symbol co_list_insert_after=0x0000c231 ---define_symbol co_list_push_back_sublist=0x0000c54d ---define_symbol co_list_push_front=0x0000c60d ---define_symbol sch_arb_conflict_check=0x000549b1 ---define_symbol sch_arb_elt_cancel=0x00054aa5 ---define_symbol sch_arb_env=0x008019b4 ---define_symbol sch_arb_idle_time_notify=0x00054dd1 ---define_symbol sch_arb_prog_timer=0x0005516d ---define_symbol sch_arb_sched_act_margin=0x00055321 ---define_symbol g_bb_watch_period_hs=0x008006f0 ---define_symbol g_debug_push_cnt=0x008006ec ---define_symbol g_prefetch_wa_cnt=0x008006ea ---define_symbol get_time_before_instant_by_hus=0x000166b1 ---define_symbol co_list_find=0x0000c1bd ---define_symbol sch_alarm_env=0x00801c34 ---define_symbol atts_mtu_exc_req=0x000096d1 ---define_symbol atts_find_info_req=0x0000917d ---define_symbol atts_find_by_type_req=0x00008ef9 ---define_symbol atts_read_by_type_req=0x00009cf5 ---define_symbol atts_read_by_grp_type_req=0x00009ac5 ---define_symbol atts_read_req=0x0000a0b1 ---define_symbol atts_read_blob_req=0x00009991 ---define_symbol atts_write_cmd=0x0000a369 ---define_symbol atts_write_req=0x0000a3f9 ---define_symbol atts_write_signed=0x0000a4d9 ---define_symbol atts_prepare_write_req=0x0000976d ---define_symbol atts_execute_write_req=0x00008ce9 ---define_symbol TASK_DESC_GATTC=0x008002d8 ---define_symbol attc_l2cc_pdu_recv_handler=0x000072c5 ---define_symbol gattc_msg_handler_tab=0x0005e424 ---define_symbol ke_state_get=0x00030375 ---define_symbol l2cc_pdu_alloc=0x00032629 ---define_symbol l2cc_pdu_send=0x0003108b ---define_symbol atts_clear_read_cache=0x00008c95 ---define_symbol atts_get_att_chk_perm=0x000093fd ---define_symbol atts_get_value=0x000094f5 ---define_symbol atts_hdl_value_cfm=0x000095c1 ---define_symbol atts_pdu_handler_info=0x0080057c ---define_symbol atts_process_pdu=0x000098c9 ---define_symbol atts_send_error=0x0000a1b9 ---define_symbol atts_send_pdu=0x0000a273 ---define_symbol co_list_push_back=0x0000c4c5 ---define_symbol co_list_size=0x0000c68d ---define_symbol gattc_env=0x00800ec4 ---define_symbol gattc_get_mtu=0x0001501d ---define_symbol ke_malloc=0x0002fec9 ---define_symbol sys_first_regs_save=0x0007bd5d ---define_symbol ble_util_buf_rx_alloc=0x0000add9 ---define_symbol ble_util_buf_rx_free=0x0000ae15 ---define_symbol lld_exp_sync_pos_tab=0x00800604 ---define_symbol lld_sync_cleanup=0x0004dddd ---define_symbol lld_sync_env=0x00801474 ---define_symbol __lld_sync_env=0x00800664 ---define_symbol lld_sync_frm_cbk=0x00800670 ---define_symbol lld_sync_frm_eof_isr=0x0004e00d ---define_symbol lld_sync_frm_rx_isr=0x0004e10d ---define_symbol lld_sync_frm_skip_isr=0x0004e175 ---define_symbol lld_sync_rx_info=0x00801414 ---define_symbol lld_sync_sched=0x0080066c ---define_symbol lld_sync_trunc_ind=0x0004ef79 ---define_symbol ble_util_buf_env=0x00800f58 ---define_symbol co_list_extract=0x0000bf45 ---define_symbol lld_init=0x0080060c ---define_symbol lld_init_func=0x0004851d ---define_symbol lld_bi_frm_cbk=0x0003f1a1 ---define_symbol lld_ci_frm_cbk=0x000421e5 ---define_symbol NVDS_MAGIC=0x0007d5ac ---define_symbol cp_hdr_incr=0x0006ed9d ---define_symbol dec_flash_read=0x0006edbd ---define_symbol dec_flash_write=0x0006edf1 ---define_symbol find_item=0x000700bd ---define_symbol get_align_bytes=0x000757b9 ---define_symbol m_nvds_end_addr=0x008023d0 ---define_symbol m_nvds_initialized=0x008023c8 ---define_symbol m_nvds_mgr=0x008032d8 ---define_symbol m_nvds_start_addr=0x008023cc ---define_symbol read_incr=0x00079395 ---define_symbol tags_cache_clean=0x0007c0b5 ---define_symbol tags_cache_rec_del=0x0007c109 ---define_symbol verify_hdr_checksum=0x0007c631 ---define_symbol write_compacted_items=0x0007c671 ---define_symbol write_item=0x0007c845 ---define_symbol svc_get_nvds_api_entry=0x0005be59 ---define_symbol llc_rem_encrypt_proc_continue=0x008005e0 ---define_symbol ble_util_buf_acl_tx_free=0x0000ab09 ---define_symbol ble_bm_get_ral_dev_list=0x00065825 ---define_symbol g_conn_cmp_info=0x00802718 ---define_symbol g_gap_cb_fun=0x00802198 ---define_symbol gap_reslv_addr=0x00073105 ---define_symbol gapc_msg_handler_desc=0x00802200 ---define_symbol gatt_on_connection=0x00074ccf ---define_symbol sec_on_conn_complete=0x0007a3b9 ---define_symbol pwr_mgmt_force_wakeup_ble_done=0x00078971 ---define_symbol rwip_prevent_sleep_get=0x00079efd ---define_symbol ble_sdk_gattc_cb_env=0x008022b4 ---define_symbol gatt_msg_handler_desc=0x008022bc ---define_symbol TASK_DESC_LLC=0x008002fc ---define_symbol g_sleep_env=0x008026bc ---define_symbol s_is_need_to_care_about_app_timer=0x00802674 ---define_symbol ble_activity_start_notify_func=0x008006cc ---define_symbol prevent_sleep_get=0x00052a65 ---define_symbol rwip_crypt_isr_handler=0x000539dd ---define_symbol rwip_sw_int_handler=0x00054309 ---define_symbol rwip_timer_10ms_handler=0x00054395 ---define_symbol rwip_timer_hs_handler=0x00054435 ---define_symbol rwip_timer_hus_handler=0x00054499 ---define_symbol rwip_wakeup=0x000545b9 ---define_symbol rwip_wakeup_end=0x000546b1 ---define_symbol sch_arb_allow_activity_notify=0x00054995 ---define_symbol lld_con_cleanup=0x000448bd ---define_symbol lld_con_clear_ccmcnt_rx=0x000449f5 ---define_symbol lld_con_clear_ccmcnt_tx=0x00044a11 ---define_symbol lld_con_max_lat_calc=0x00045c29 ---define_symbol lld_con_sched=0x00800630 ---define_symbol lld_supervision_to_cb=0x0004dd49 ---define_symbol rwip_active_check=0x000538f9 ---define_symbol co_list_pop_front=0x0000c47b ---define_symbol lld_adv_env=0x00801384 ---define_symbol lld_init_env=0x00800644 ---define_symbol lld_con_start=0x00800634 ---define_symbol lld_con_frm_cbk_func=0x00045021 ---define_symbol lld_con_start_func=0x00046add ---define_symbol lld_instant_proc_end=0x00049805 ---define_symbol ble_gattc_mtu_exchange_rom=0x00069029 ---define_symbol ble_gattc_char_desc_discover_rom=0x00068f91 ---define_symbol ble_gattc_char_discover_rom=0x00068f9b ---define_symbol ble_gattc_included_services_discover_rom=0x00068fab ---define_symbol ble_gattc_indicate_cfm_rom=0x00068fb5 ---define_symbol ble_gattc_primary_services_discover_rom=0x000699b9 ---define_symbol ble_gattc_read_rom=0x00069a6d ---define_symbol ble_gattc_read_by_uuid_rom=0x00069af5 ---define_symbol ble_gattc_read_multiple_rom=0x00069bb1 ---define_symbol ble_gattc_services_browse_rom=0x00069c49 ---define_symbol ble_gattc_write_rom=0x00069d05 ---define_symbol ble_gattc_write_execute_rom=0x00069ddd ---define_symbol ble_gattc_write_no_resp_rom=0x00069e55 ---define_symbol ble_gattc_write_prepare_rom=0x00069edd ---define_symbol ble_gattc_prf_char_desc_discover_rom=0x0006909d ---define_symbol ble_gattc_prf_char_discover_rom=0x0006913d ---define_symbol ble_gattc_prf_evt_handle_register_rom=0x00069215 ---define_symbol ble_gattc_prf_evt_handle_unregister_rom=0x0006921b ---define_symbol ble_gattc_prf_included_services_discover_rom=0x00069221 ---define_symbol ble_gattc_prf_indicate_cfm_rom=0x000692c1 ---define_symbol ble_gattc_prf_primary_services_discover_rom=0x00069349 ---define_symbol ble_gattc_prf_read_rom=0x0006940d ---define_symbol ble_gattc_prf_read_by_uuid_rom=0x000694a9 ---define_symbol ble_gattc_prf_read_multiple_rom=0x00069581 ---define_symbol ble_gattc_prf_services_browse_rom=0x00069625 ---define_symbol ble_gattc_prf_write_rom=0x000696e9 ---define_symbol ble_gattc_prf_write_execute_rom=0x000697cd ---define_symbol ble_gattc_prf_write_no_resp_rom=0x00069859 ---define_symbol ble_gattc_prf_write_prepare_rom=0x000698f9 ---define_symbol ble_gatts_noti_ind_rom=0x0006a10d ---define_symbol ble_gatts_prepare_write_cfm_rom=0x0006a271 ---define_symbol ble_gatts_read_cfm_rom=0x0006a399 ---define_symbol ble_gatts_write_cfm_rom=0x0006a971 ---define_symbol ble_gatt_mtu_get_rom=0x00068ec5 ---define_symbol sec_on_disconn=0x0007a4e9 ---define_symbol gatt_on_disconnection=0x00074dd9 ---define_symbol sec_clear_bond_info_env=0x0007a2f9 ---define_symbol lld_ch_map_upd_cfm_handler=0x000418c9 ---define_symbol lld_phy_upd_cfm_handler=0x0004b67d ---define_symbol lld_con_offset_upd_ind_handler=0x00045da1 ---define_symbol llcp_pdu_handler=0x00800320 ---define_symbol llc_ch_map_up_proc_err_cb=0x00036855 ---define_symbol llc_proc_id_get=0x00039d65 ---define_symbol llc_proc_reg=0x00039d99 ---define_symbol llc_rem_ch_map_proc_continue_func=0x0003a00d ---define_symbol hci_send_2_host=0x0002bac1 ---define_symbol g_et_correct_cnt=0x008006e6 ---define_symbol g_max_evt_start_cbk_run_hus=0x008006b6 ---define_symbol g_max_evt_start_rsvd_hus=0x008006ba ---define_symbol g_min_evt_start_cbk_run_hus=0x008006b8 ---define_symbol g_min_evt_start_rsvd_hus=0x008006bc ---define_symbol g_sch_arb_pick_limit=0x008006ac ---define_symbol llc_con_upd_param_in_range=0x00037491 ---define_symbol llc_loc_con_upd_proc_continue=0x008005d0 ---define_symbol llc_proc_collision_check=0x00039cb5 ---define_symbol llc_rem_con_upd_proc_err_cb=0x0003a2b1 ---define_symbol llc_loc_phy_upd_proc_continue=0x008005f0 ---define_symbol llc_rem_phy_upd_proc_continue=0x008005ec ---define_symbol llc_rem_phy_upd_proc_err_cb=0x0003a9c5 ---define_symbol xqspi_wait_flag_state_until_retry=0x0005c801 ---define_symbol hal_xqspi_msp_init=0x00021f19 ---define_symbol g_xqspi_handle=0x00801f28 ---define_symbol m_encryption_enabled=0x008023c9 ---define_symbol rom_prf_unint=0x0007d529 ---define_symbol sdk_prf_unint=0x0007d52a ---define_symbol set_sdk_schedule_event=0x0007afed ---define_symbol config_1M_tx_gain_value=0x0006ed25 ---define_symbol config_2M_tx_gain_value=0x0006ed45 ---define_symbol config_coded_tx_gain_value=0x0006ed65 ---define_symbol ble_gap_callback_register=0x000668f1 ---define_symbol ble_gatt_common_callback_register=0x00068e2d ---define_symbol ble_gattc_callback_register=0x00068f7d ---define_symbol ble_rom_prf_init=0x0006c3ad ---define_symbol ble_schedule_start=0x0006c51d ---define_symbol ble_sdk_rf_init=0x0006e101 ---define_symbol ble_sec_callback_register=0x0006e235 ---define_symbol local_mem_pwr_mgmt_check_proc=0x00802680 ---define_symbol register_config_1M_tx_gain_value=0x00053601 ---define_symbol register_config_2M_tx_gain_value=0x0005360d ---define_symbol register_config_coded_tx_gain_value=0x00053619 ---define_symbol register_rwip_us_2_lpcycles=0x00053695 ---define_symbol register_rwip_wakeup_end=0x000536ad ---define_symbol rf_recalibrate=0x00079b79 ---define_symbol svc_rwip_init=0x0005be71 ---define_symbol svc_set_heaps_table_entry=0x0005bead ---define_symbol exflash_enable_quad=0x0000e495 ---define_symbol exflash_resume=0x0000e6a5 ---define_symbol exflash_suspend=0x0000e6c1 ---define_symbol hal_exflash_msp_init=0x0001941d ---define_symbol lld_llcp_rx_ind_handler=0x00049a6d ---define_symbol lld_llcp_tx_cfm_handler=0x00049c95 ---define_symbol lld_acl_rx_ind_handler=0x0003aed9 ---define_symbol lld_con_param_upd_cfm_handler=0x00045e6d ---define_symbol g_ble_slp_reg=0x00803528 ---define_symbol calc_checksum=0x0006e8a9 ---define_symbol llc_auth_payl_nearly_to_handler=0x0003679d ---define_symbol llc_auth_payl_real_to_handler=0x00036801 ---define_symbol hal_efuse_deinit=0x00075d4d ---define_symbol hal_efuse_init=0x00075d65 ---define_symbol gap_actv_type_str=0x00802268 ---define_symbol gap_adv_fsm_next=0x00802210 ---define_symbol gap_get_adv_idx_by_actv_idx=0x0007269d ---define_symbol gap_get_per_sync_idx_by_actv_idx=0x00072761 ---define_symbol gap_init_fsm_next=0x00802218 ---define_symbol gap_per_sync_fsm_next=0x0080221c ---define_symbol gap_scan_fsm_next=0x00802214 ---define_symbol gapm_msg_handler_desc=0x00802298 ---define_symbol gapc_auth_get=0x008003e0 ---define_symbol gapc_get_dest_task=0x0000f2f5 ---define_symbol gapc_link_encrypted=0x0000f8e1 ---define_symbol gapc_send_complete_evt=0x0000fe49 ---define_symbol gapc_update_state=0x000104c5 ---define_symbol smpc_handle_enc_change_evt=0x00800514 ---define_symbol smpc_tkdp_rcp_start=0x0005b5b5 ---define_symbol smpc_tkdp_send_start=0x0005b78d ---define_symbol sys_get_heap_info=0x0007bd9b ---define_symbol g_sec_cb_fun=0x008023ec ---define_symbol gap_cache_data_get=0x0007106d ---define_symbol attmdb_get_attribute=0x00008449 ---define_symbol attmdb_uuid16_comp=0x00008bed ---define_symbol gapm_cmp_evt_handler=0x00074235 ---define_symbol gapm_get_att_handle=0x000123c9 ---define_symbol operate_system_info=0x00077d35 ---define_symbol ble_gapc_auth_get=0x00068dc1 ---define_symbol lld_con_tx_prog=0x00800628 ---define_symbol llc_llcp_tx_check=0x00038679 ---define_symbol lld_con_event_counter_get=0x00044ec1 ---define_symbol g_sch_arb_insert_run_hus=0x008006ae ---define_symbol ke_event_callback_set=0x0002f989 ---define_symbol ke_event_clear=0x0002f9c5 ---define_symbol ke_event_set=0x0002fb11 ---define_symbol l2cc_data_send=0x00800598 ---define_symbol gapm_env=0x00800e00 ---define_symbol l2cm_env=0x00800f4c ---define_symbol TASK_DESC_L2CC=0x008002f0 ---define_symbol l2cc_env=0x00800f18 ---define_symbol l2cm_get_nb_buffer_available=0x00033d85 ---define_symbol lld_con_frm_cbk=0x00800624 ---define_symbol ble_bm_clear_bond_devs=0x00065501 ---define_symbol ble_bm_del_bond_dev=0x000655f1 ---define_symbol ble_bm_get_bond_devs=0x00065749 ---define_symbol ble_gap_set_ral_list=0x000686ad ---define_symbol gap_bm_error_to_sdk_error=0x00071049 ---define_symbol gap_check_modify_bondlist=0x00071159 ---define_symbol bonds=0x0080233c ---define_symbol find_peer_addr=0x00070141 ---define_symbol find_unused_bond_idx=0x000701c9 ---define_symbol g_bond_num=0x00802338 ---define_symbol update_lru_bond_list=0x0007c469 ---define_symbol gap_activity_opera_start=0x000705a5 ---define_symbol gapc_set_local_addr=0x00010025 ---define_symbol gapm_actv_alloc=0x00010f7d ---define_symbol gapm_actv_created=0x00010fbd ---define_symbol gapm_actv_retrieve_cmd_cmp_evt=0x000111d5 ---define_symbol gapm_actv_started=0x000112b9 ---define_symbol gapm_get_address_type=0x000123b9 ---define_symbol gapm_get_requester=0x000126b1 ---define_symbol gapm_init_check_param=0x0001287d ---define_symbol gapm_init_connection_ind=0x008004c8 ---define_symbol gapm_init_delete=0x00012a1d ---define_symbol gapm_init_send_hci_le_create_con_cancel_cmd=0x00012a21 ---define_symbol gapm_init_send_hci_le_ext_create_con_cmd=0x00012a33 ---define_symbol gapm_init_stopped=0x00012bbd ---define_symbol gapm_is_addr_type_valid=0x00012c0d ---define_symbol hci_le_cmd_cmp_evt_started_handler=0x00025295 ---define_symbol hci_le_cmd_cmp_evt_stopping_handler=0x00025481 ---define_symbol ke_timer_set=0x000309b1 ---define_symbol gapm_hci_cmd_cmp_event_handler_tab=0x0005de90 ---define_symbol gapm_hci_cmd_stat_event_handler_tab=0x0005e010 ---define_symbol gapm_msg_handler_tab=0x0005e080 ---define_symbol gapm_actv_check_create_param=0x00010fad ---define_symbol gapm_actv_get_free_idx=0x000110c5 ---define_symbol gapm_adv_create=0x00011a19 ---define_symbol gapm_per_sync_create=0x000133fd ---define_symbol gapm_process_op=0x00013649 ---define_symbol gapm_scan_create=0x000139bd ---define_symbol gapm_send_complete_evt=0x008003ec ---define_symbol TASK_DESC_GAPM=0x008002cc ---define_symbol gapm_hci_cmd_cmp_event_handler_tab_info=0x008004e8 ---define_symbol gapm_hci_cmd_stat_event_handler_tab_info=0x008004e0 ---define_symbol HP_Gain_1M=0x00803414 ---define_symbol rwble_init=0x000537c5 ---define_symbol rwip_prevent_sleep_set=0x00053ddd ---define_symbol rwip_prevent_sleep_clear=0x00053dad ---define_symbol set_master_gclk=0x00056931 ---define_symbol rf_SX_Tune=0x000795a5 ---define_symbol rf_SX_Enable=0x00079559 ---define_symbol rf_SX_reset=0x00079601 ---define_symbol get_F_value=0x00075745 ---define_symbol actv_state_str=0x00802228 ---define_symbol gap_activity_opera_end=0x00070479 ---define_symbol gap_create_initiating=0x000719c5 ---define_symbol gap_delete_initiating=0x00071da1 ---define_symbol gap_start_initiating=0x00073b45 ---define_symbol gap_stop_initiating=0x00073de9 ---define_symbol get_conn_idx_by_hdl=0x00075825 ---define_symbol lld_adv_start=0x00800618 ---define_symbol lld_adv_start_func=0x0003dc09 ---define_symbol lld_test_start=0x0004f319 ---define_symbol ble_bm_get_sec_info_by_peer_irk=0x000658ed ---define_symbol gap_cache_data_save=0x00071095 ---define_symbol gap_get_actv_type_by_actv_idx=0x0007265d ---define_symbol lld_adv_adv_data_set=0x0003aff9 ---define_symbol lld_adv_aux_ch_idx_set=0x0003b11d ---define_symbol lld_adv_end=0x0003b5b1 ---define_symbol lld_adv_ext_chain_construct=0x0003bdc5 ---define_symbol lld_adv_frm_cbk=0x00800614 ---define_symbol lld_adv_frm_skip_isr=0x0003cd81 ---define_symbol lld_adv_pkt_rx=0x0003cf49 ---define_symbol lld_adv_scan_rsp_data_set=0x0003daa1 ---define_symbol ble_util_buf_adv_tx_free=0x0000ab69 ---define_symbol lld_test_cleanup=0x0004efa5 ---define_symbol boot_info=0x00801f10 ---define_symbol jump_app=0x0002f831 ---define_symbol check_boot_info=0x0000bdf5 ---define_symbol check_image_crc=0x0000be3d ---define_symbol hal_adc_get_dma_threshold=0x00016e71 ---define_symbol hal_adc_get_error=0x00016e81 ---define_symbol hal_adc_get_state=0x00016e85 ---define_symbol hal_adc_register_callback=0x00017021 ---define_symbol hal_adc_set_dma_threshold=0x00017055 ---define_symbol adc_dma_error=0x00005edd ---define_symbol adc_wait_notempty_until_timeout=0x00005ef1 ---define_symbol p_adc_callback=0x00800364 ---define_symbol p_aes_callback=0x00800368 ---define_symbol p_efuse_callback=0x00800384 ---define_symbol p_rng_callback=0x008003ac ---define_symbol hal_aes_abort=0x000171d9 ---define_symbol hal_aes_abort_it=0x000171f9 ---define_symbol hal_aes_cbc_decrypt=0x000171fd ---define_symbol hal_aes_cbc_decrypt_it=0x000172b5 ---define_symbol hal_aes_cbc_encrypt=0x0001730d ---define_symbol hal_aes_cbc_encrypt_it=0x000173c9 ---define_symbol hal_aes_ecb_decrypt=0x00017475 ---define_symbol hal_aes_ecb_decrypt_it=0x00017525 ---define_symbol hal_aes_ecb_encrypt=0x00017579 ---define_symbol hal_aes_ecb_encrypt_it=0x0001762d ---define_symbol hal_aes_get_error=0x0001769d ---define_symbol hal_aes_get_state=0x000176a1 ---define_symbol hal_aes_irq_handler=0x0001772d ---define_symbol hal_aes_register_callback=0x00017831 ---define_symbol hal_aes_resume_reg=0x0001783d ---define_symbol hal_aes_set_timeout=0x000178d9 ---define_symbol hal_aes_suspend_reg=0x000178dd ---define_symbol hal_aon_gpio_read_pin=0x00017a75 ---define_symbol hal_aon_gpio_register_callback=0x00017a8d ---define_symbol hal_aon_wdt_deinit_ext=0x00017b39 ---define_symbol hal_aon_wdt_irq_handler=0x00017ba9 ---define_symbol hal_aon_wdt_register_callback=0x00017c19 ---define_symbol hal_calendar_register_callback=0x00017e95 ---define_symbol hal_comp_get_error=0x000180a7 ---define_symbol hal_comp_get_state=0x000180ab ---define_symbol hal_comp_register_callback=0x0001815d ---define_symbol hal_comp_resume_reg=0x00018169 ---define_symbol hal_comp_start=0x00018179 ---define_symbol hal_comp_stop=0x000181bd ---define_symbol hal_comp_suspend_reg=0x00018205 ---define_symbol hal_deinit_ext=0x00018249 ---define_symbol hal_delay=0x0001824d ---define_symbol hal_dma_abort=0x00018265 ---define_symbol hal_dma_abort_it=0x00018345 ---define_symbol hal_dma_get_error=0x00018459 ---define_symbol hal_dma_get_state=0x0001845d ---define_symbol hal_dma_irq_handler=0x000184f1 ---define_symbol hal_dma_poll_for_transfer=0x00018639 ---define_symbol hal_dma_register_callback=0x00018729 ---define_symbol hal_dma_resume_reg=0x00018775 ---define_symbol hal_dma_start=0x000187bd ---define_symbol hal_dma_start_it=0x00018839 ---define_symbol hal_dma_suspend_reg=0x00018911 ---define_symbol hal_dma_unregister_callback=0x0001893d ---define_symbol hal_dual_timer_base_start=0x00018a7d ---define_symbol hal_dual_timer_base_start_it=0x00018ab7 ---define_symbol hal_dual_timer_base_stop=0x00018af1 ---define_symbol hal_dual_timer_base_stop_it=0x00018b2b ---define_symbol hal_dual_timer_deinit_ext=0x00018b6f ---define_symbol hal_dual_timer_get_state=0x00018b73 ---define_symbol hal_dual_timer_init_ext=0x00018b77 ---define_symbol hal_dual_timer_register_callback=0x00018bcd ---define_symbol hal_efuse_crc_calculate=0x00018c2d ---define_symbol hal_efuse_initial_value_check=0x00018d75 ---define_symbol hal_efuse_read=0x00018e01 ---define_symbol hal_efuse_read_trim=0x00018e79 ---define_symbol hal_efuse_register_callback=0x00018f05 ---define_symbol hal_efuse_set_main_backup=0x00018f11 ---define_symbol hal_efuse_write=0x00018f2d ---define_symbol hal_efuse_write_keyram=0x0001902d ---define_symbol hal_exflash_deepsleep=0x0001907d ---define_symbol hal_exflash_deinit_ext=0x000190f3 ---define_symbol hal_exflash_get_error=0x00019245 ---define_symbol hal_exflash_get_state=0x00019249 ---define_symbol hal_exflash_init_ext=0x0001935d ---define_symbol hal_exflash_lock=0x00019361 ---define_symbol hal_exflash_read_rom=0x00019435 ---define_symbol hal_exflash_register_callback=0x0001958d ---define_symbol hal_exflash_reset=0x00019599 ---define_symbol hal_exflash_set_retry=0x0001962d ---define_symbol hal_exflash_unlock=0x00019683 ---define_symbol hal_exflash_wakeup=0x00019723 ---define_symbol hal_get_tick=0x000199c1 ---define_symbol hal_gpio_deinit_ext=0x00019a71 ---define_symbol hal_gpio_exti_irq_handler=0x00019a91 ---define_symbol hal_gpio_init_ext=0x00019acb ---define_symbol hal_gpio_read_pin=0x00019acf ---define_symbol hal_gpio_register_callback=0x00019ae1 ---define_symbol hal_gpio_toggle_pin=0x00019aed ---define_symbol hal_gpio_write_pin=0x00019af5 ---define_symbol hal_hmac_register_callback=0x00019dbd ---define_symbol hal_i2c_register_callback=0x0001ae51 ---define_symbol hal_i2s_abort=0x0001b299 ---define_symbol hal_i2s_deinit_ext=0x0001b3e1 ---define_symbol hal_i2s_get_error=0x0001b401 ---define_symbol hal_i2s_get_rx_fifo_threshold=0x0001b405 ---define_symbol hal_i2s_get_state=0x0001b40f ---define_symbol hal_i2s_get_tx_fifo_threshold=0x0001b415 ---define_symbol hal_i2s_init_ext=0x0001b515 ---define_symbol hal_i2s_irq_handler=0x0001b519 ---define_symbol hal_i2s_receive=0x0001b661 ---define_symbol hal_i2s_receive_dma=0x0001b6f9 ---define_symbol hal_i2s_receive_it=0x0001b825 ---define_symbol hal_i2s_register_callback=0x0001b8fd ---define_symbol hal_i2s_resume_reg=0x0001b909 ---define_symbol hal_i2s_set_rx_fifo_threshold=0x0001b969 ---define_symbol hal_i2s_set_tx_fifo_threshold=0x0001b9b7 ---define_symbol hal_i2s_start_clock=0x0001ba05 ---define_symbol hal_i2s_stop_clock=0x0001ba2d ---define_symbol hal_i2s_suspend_reg=0x0001ba55 ---define_symbol hal_i2s_transmit_dma=0x0001bb19 ---define_symbol hal_i2s_transmit_it=0x0001bc59 ---define_symbol hal_i2s_transmit_receive=0x0001bd31 ---define_symbol hal_i2s_transmit_receive_dma=0x0001bdc9 ---define_symbol hal_i2s_transmit_receive_it=0x0001bf3d ---define_symbol hal_increment_tick=0x0001c051 ---define_symbol hal_init_ext=0x0001c071 ---define_symbol hal_init_tick=0x0001c075 ---define_symbol hal_mpu_config_region=0x0001c095 ---define_symbol hal_mpu_disable=0x0001c0ed ---define_symbol hal_mpu_enable=0x0001c105 ---define_symbol hal_msio_read_pin=0x0001c18d ---define_symbol hal_msio_toggle_pin=0x0001c1a5 ---define_symbol hal_msio_write_pin=0x0001c1bd ---define_symbol hal_nvic_clear_pending_irq=0x0001c219 ---define_symbol hal_nvic_disable_irq=0x0001c233 ---define_symbol hal_nvic_enable_irq=0x0001c255 ---define_symbol hal_nvic_get_active=0x0001c26f ---define_symbol hal_nvic_get_pending_irq=0x0001c297 ---define_symbol hal_nvic_get_priority=0x0001c2bf ---define_symbol hal_nvic_set_pending_irq=0x0001c325 ---define_symbol hal_nvic_set_priority=0x0001c341 ---define_symbol hal_nvic_set_priority_grouping=0x0001c399 ---define_symbol hal_pkc_register_callback=0x0001d971 ---define_symbol hal_pwr_config_timer_wakeup_ext=0x0001df01 ---define_symbol hal_pwr_enter_chip_deepsleep=0x0001df05 ---define_symbol hal_pwr_register_timer_elaspsed_handler=0x0001df81 ---define_symbol hal_pwr_set_comm_mode=0x0001df8d ---define_symbol hal_pwr_set_comm_power=0x0001dfc1 ---define_symbol hal_pwr_set_mem_current_power=0x0001e035 ---define_symbol hal_pwr_set_mem_deepsleep_power=0x0001e071 ---define_symbol hal_pwr_set_mem_wakeup_power=0x0001e091 ---define_symbol hal_pwr_set_wakeup_condition=0x0001e0b1 ---define_symbol hal_pwr_sleep_timer_irq_handler=0x0001e0d9 ---define_symbol hal_qspi_register_callback=0x0001f4c5 ---define_symbol hal_register_callback=0x0001f921 ---define_symbol hal_resume_tick=0x0001f92d ---define_symbol hal_rng_get_state=0x0001fb23 ---define_symbol hal_rng_irq_handler=0x0001fb95 ---define_symbol hal_rng_read_last_random_number=0x0001fc01 ---define_symbol hal_rng_register_callback=0x0001fc21 ---define_symbol hal_rng_resume_reg=0x0001fc2d ---define_symbol hal_rng_suspend_reg=0x0001fc47 ---define_symbol hal_sha256_digest=0x0001fc51 ---define_symbol hal_sha256_digest_dma=0x0001fcb3 ---define_symbol hal_sha256_digest_it=0x0001fd09 ---define_symbol hal_spi_abort=0x0001fd5f ---define_symbol hal_spi_abort_it=0x0001fe0d ---define_symbol hal_spi_deinit_ext=0x0001ff4d ---define_symbol hal_spi_get_error=0x0001ff6d ---define_symbol hal_spi_get_rx_fifo_threshold=0x0001ff71 ---define_symbol hal_spi_get_state=0x0001ff7b ---define_symbol hal_spi_get_tx_fifo_threshold=0x0001ff81 ---define_symbol hal_spi_init_ext=0x0002013d ---define_symbol hal_spi_irq_handler=0x00020141 ---define_symbol hal_spi_read_eeprom=0x000202d5 ---define_symbol hal_spi_read_eeprom_dma=0x00020369 ---define_symbol hal_spi_receive=0x000205e1 ---define_symbol hal_spi_receive_dma=0x00020669 ---define_symbol hal_spi_register_callback=0x00020829 ---define_symbol hal_spi_resume_reg=0x00020835 ---define_symbol hal_spi_set_rx_fifo_threshold=0x00020891 ---define_symbol hal_spi_set_timeout=0x000208bf ---define_symbol hal_spi_set_tx_fifo_threshold=0x000208c3 ---define_symbol hal_spi_suspend_reg=0x000208f1 ---define_symbol hal_spi_transmit=0x00020917 ---define_symbol hal_spi_transmit_dma=0x0002098d ---define_symbol hal_spi_transmit_receive=0x00020b3b ---define_symbol hal_spi_transmit_receive_dma=0x00020bb5 ---define_symbol hal_suspend_tick=0x00020e21 ---define_symbol hal_systick_callback=0x00020e2f ---define_symbol hal_systick_clk_source_config=0x00020e31 ---define_symbol hal_systick_config=0x00020e4d ---define_symbol hal_systick_irq_handler=0x00020e75 ---define_symbol hal_timer_base_start=0x00020f25 ---define_symbol hal_timer_base_start_it=0x00020f5f ---define_symbol hal_timer_base_stop=0x00020f99 ---define_symbol hal_timer_base_stop_it=0x00020fd3 ---define_symbol hal_timer_base_deinit_ext=0x00021017 ---define_symbol hal_timer_get_state=0x0002101b ---define_symbol hal_timer_base_init_ext=0x0002101f ---define_symbol hal_timer_irq_handler=0x00021023 ---define_symbol hal_timer_register_callback=0x0002104d ---define_symbol hal_timer_set_config=0x00021059 ---define_symbol hal_uart_abort=0x00021081 ---define_symbol hal_uart_abort_it=0x00021119 ---define_symbol hal_uart_abort_receive=0x000211c5 ---define_symbol hal_uart_abort_receive_it=0x00021225 ---define_symbol hal_uart_abort_transmit=0x000212c9 ---define_symbol hal_uart_abort_transmit_it=0x00021325 ---define_symbol hal_uart_deinit_ext=0x00021479 ---define_symbol hal_uart_dma_pause=0x0002147d ---define_symbol hal_uart_dma_resume=0x000214e5 ---define_symbol hal_uart_dma_stop=0x00021545 ---define_symbol hal_uart_get_error=0x00021595 ---define_symbol hal_uart_init_ext=0x00021655 ---define_symbol hal_uart_irq_handler=0x00021659 ---define_symbol hal_uart_receive=0x00021749 ---define_symbol hal_uart_receive_dma=0x000217ad ---define_symbol hal_uart_receive_it=0x000218a9 ---define_symbol hal_uart_register_callback=0x00021911 ---define_symbol hal_uart_resume_reg=0x0002191d ---define_symbol hal_uart_suspend_reg=0x00021981 ---define_symbol hal_uart_transmit=0x000219bf ---define_symbol hal_uart_transmit_dma=0x00021a35 ---define_symbol hal_uart_transmit_it=0x00021ac1 ---define_symbol hal_wdt_deinit_ext=0x00021b79 ---define_symbol hal_wdt_init_ext=0x00021be1 ---define_symbol hal_wdt_irq_handler=0x00021be5 ---define_symbol hal_wdt_refresh=0x00021c7d ---define_symbol hal_wdt_register_callback=0x00021cb9 ---define_symbol hal_xqspi_command_receive=0x00021cc5 ---define_symbol hal_xqspi_command_transmit=0x00021d53 ---define_symbol hal_xqspi_deinit_ext=0x00021e17 ---define_symbol hal_xqspi_get_error=0x00021e1b ---define_symbol hal_xqspi_get_rx_fifo_threshold=0x00021e1f ---define_symbol hal_xqspi_get_state=0x00021e2b ---define_symbol hal_xqspi_get_tx_fifo_threshold=0x00021e31 ---define_symbol hal_xqspi_init_ext_rom=0x00021ef5 ---define_symbol hal_xqspi_receive=0x00021f31 ---define_symbol hal_xqspi_register_callback=0x00021fbd ---define_symbol hal_xqspi_set_retry=0x00021fc9 ---define_symbol hal_xqspi_set_rx_fifo_threshold=0x00021fcd ---define_symbol hal_xqspi_set_tx_fifo_threshold=0x0002200b ---define_symbol hal_xqspi_transmit=0x00022139 ---define_symbol xqspi_send_inst_addr=0x0005c697 ---define_symbol ll_clock_accuracy_req_handler=0x00031095 ---define_symbol ll_adc_struct_init=0x00033f3d ---define_symbol ll_aes_deinit=0x00033f55 ---define_symbol ll_aes_init=0x00033f63 ---define_symbol ll_aes_struct_init=0x00033f77 ---define_symbol ll_aon_gpio_struct_init=0x000340bd ---define_symbol ll_cgc_deinit=0x0003413d ---define_symbol ll_cgc_init=0x00034151 ---define_symbol ll_cgc_struct_init=0x00034199 ---define_symbol ll_channel_map_ind_handler=0x000341a9 ---define_symbol ll_cis_ind_handler=0x0003426d ---define_symbol ll_cis_req_handler=0x000342e1 ---define_symbol ll_cis_rsp_handler=0x00034535 ---define_symbol ll_cis_terminate_ind_handler=0x0003460d ---define_symbol ll_clock_accuracy_rsp_handler=0x00034625 ---define_symbol ll_comp_deinit=0x00034651 ---define_symbol ll_comp_init=0x00034661 ---define_symbol ll_comp_struct_init=0x000346ad ---define_symbol ll_connection_param_req_handler=0x000346b9 ---define_symbol ll_connection_param_rsp_handler=0x00034795 ---define_symbol ll_connection_update_ind_handler=0x0003482d ---define_symbol ll_dbg_is_opcode_supported=0x00034955 ---define_symbol ll_dma_struct_init=0x00034e49 ---define_symbol ll_dual_timer_deinit=0x00034e99 ---define_symbol ll_dual_timer_init=0x00034ea9 ---define_symbol ll_dual_timer_struct_init=0x00034ed5 ---define_symbol ll_enc_req_handler=0x00034efd ---define_symbol ll_enc_rsp_handler=0x00034fc5 ---define_symbol ll_feature_req_handler=0x00035039 ---define_symbol ll_feature_rsp_handler=0x00035051 ---define_symbol ll_get_event_cnt=0x000350a1 ---define_symbol ll_gpio_deinit=0x000350b1 ---define_symbol ll_gpio_init=0x0003516d ---define_symbol ll_gpio_struct_init=0x00035381 ---define_symbol ll_hmac_deinit=0x00035395 ---define_symbol ll_hmac_init=0x000353a3 ---define_symbol ll_hmac_struct_init=0x000353cb ---define_symbol ll_i2c_init=0x0003543d ---define_symbol ll_i2c_struct_init=0x00035501 ---define_symbol ll_i2s_deinit=0x00035515 ---define_symbol ll_i2s_init=0x0003561d ---define_symbol ll_i2s_struct_init=0x00035769 ---define_symbol ll_length_req_handler=0x00035783 ---define_symbol ll_length_rsp_handler=0x000357d9 ---define_symbol ll_min_used_channels_ind_handler=0x00035859 ---define_symbol ll_msio_struct_init=0x00035a0d ---define_symbol ll_pause_enc_req_handler=0x00035a21 ---define_symbol ll_pause_enc_rsp_handler=0x00035a95 ---define_symbol ll_phy_req_handler=0x00035af9 ---define_symbol ll_phy_rsp_handler=0x00035bad ---define_symbol ll_phy_update_ind_handler=0x00035c2d ---define_symbol ll_ping_req_handler=0x00035cc5 ---define_symbol ll_ping_rsp_handler=0x00035ccf ---define_symbol ll_pkc_deinit=0x00035ced ---define_symbol ll_pkc_init=0x00035d13 ---define_symbol ll_pkc_struct_init=0x00035d49 ---define_symbol ll_qspi_deinit=0x00035f2d ---define_symbol ll_qspi_init=0x00035f4d ---define_symbol ll_qspi_struct_init=0x00035ff5 ---define_symbol ll_rng_deinit=0x00036075 ---define_symbol ll_rng_init=0x0003609b ---define_symbol ll_rng_struct_init=0x000360e3 ---define_symbol ll_slave_feature_req_handler=0x000360f9 ---define_symbol ll_spim_deinit=0x0003612d ---define_symbol ll_spim_init=0x00036149 ---define_symbol ll_spim_struct_init=0x000361a9 ---define_symbol ll_spis_deinit=0x000361d9 ---define_symbol ll_spis_init=0x000361ef ---define_symbol ll_spis_struct_init=0x0003623d ---define_symbol ll_start_enc_req_handler=0x0003624d ---define_symbol ll_start_enc_rsp_handler=0x000362a5 ---define_symbol ll_terminate_ind_handler=0x000362fd ---define_symbol ll_timer_deinit=0x00036339 ---define_symbol ll_timer_init=0x00036347 ---define_symbol ll_timer_struct_init=0x0003634f ---define_symbol ll_uart_deinit=0x00036357 ---define_symbol ll_uart_init=0x00036361 ---define_symbol ll_uart_struct_init=0x000363e5 ---define_symbol ll_version_ind_handler=0x00036409 ---define_symbol ll_xqspi_deinit=0x00036461 ---define_symbol ll_xqspi_init=0x000364dd ---define_symbol ll_xqspi_struct_init=0x00036749 ---define_symbol diag_shutdown_func=0x0080035c ---define_symbol g_bqb_test_en=0x008005e4 ---define_symbol g_lld_con_heap_used_ratio_limit=0x0080061e ---define_symbol diag_evt_start_cbk_start_func=0x008006c0 ---define_symbol diag_evt_start_cbk_done_func=0x008006c4 ---define_symbol g_b_rf_bqb_test_enable=0x008023fb ---define_symbol assert_err=0x00006f01 ---define_symbol assert_param=0x00006f2d ---define_symbol assert_warn=0x00006f5d ---define_symbol ble_sdk_default_prf_config_set=0x0000aa4d ---define_symbol dbg_log_printf=0x0000cd9d ---define_symbol sys_signal_handler_register=0x0005bf05 ---define_symbol rom_init=0x0005c889 ---define_symbol pwr_mgmt_save_context=0x00062d69 ---define_symbol pwr_mgmt_load_context=0x00062d99 ---define_symbol BLESLP_IRQHandler=0x000637d1 ---define_symbol BLE_IRQHandler=0x000637dd ---define_symbol BLE_SDK_Handler=0x00063839 ---define_symbol BLE_IRQHandler_func=0x000637e9 ---define_symbol SVC_Table=0x008026f0 ---define_symbol ble_activity_end_notify_cb_register=0x00064dbd ---define_symbol ble_activity_start_notify_cb_register=0x00064dfd ---define_symbol ble_aes_ccm=0x00064e19 ---define_symbol ble_aes_cmac=0x00064e49 ---define_symbol ble_aes_encrypt=0x00064e55 ---define_symbol ble_aes_k1=0x00064e65 ---define_symbol ble_aes_k2=0x00064e79 ---define_symbol ble_aes_k3=0x00064e85 ---define_symbol ble_aes_k4=0x00064e89 ---define_symbol ble_aes_rand=0x00064e8d ---define_symbol ble_aes_result_handler=0x00064e91 ---define_symbol ble_aes_s1=0x00064e95 ---define_symbol ble_attm_reserve_handle_range=0x00064ea5 ---define_symbol ble_attm_svc_create_db=0x00064ea9 ---define_symbol ble_attmdb_svc_visibility_set=0x00064f0d ---define_symbol ble_audio_callback_register=0x00064f15 ---define_symbol ble_audio_event_count_read=0x00064f25 ---define_symbol ble_audio_role_switch=0x00065015 ---define_symbol ble_audio_sniffer_create=0x00065131 ---define_symbol ble_audio_sync_info_send=0x00065225 ---define_symbol ble_audio_time_sync=0x000652b9 ---define_symbol ble_client_prf_add=0x00065b29 ---define_symbol ble_co_list_extract=0x00065c29 ---define_symbol ble_co_list_init=0x00065c2d ---define_symbol ble_co_list_insert_before=0x00065c31 ---define_symbol ble_co_list_pop_front=0x00065c35 ---define_symbol ble_co_list_push_back=0x00065c39 ---define_symbol ble_co_list_push_back_sublist=0x00065c3d ---define_symbol ble_co_list_push_front=0x00065c41 ---define_symbol ble_co_util_pack=0x00065c45 ---define_symbol ble_co_util_unpack=0x00065c51 ---define_symbol ble_core_is_powered_on=0x00065c5d ---define_symbol ble_gap_active_link_set=0x00065f9d ---define_symbol ble_gap_addr_get=0x00065fb1 ---define_symbol ble_gap_adv_data_set=0x00066121 ---define_symbol ble_gap_adv_param_set=0x00066231 ---define_symbol ble_gap_adv_start=0x0006647d ---define_symbol ble_gap_adv_stop=0x00066695 ---define_symbol ble_gap_appearance_get=0x00066729 ---define_symbol ble_gap_appearance_set=0x00066779 ---define_symbol ble_gap_bond_devs_get=0x0006689d ---define_symbol ble_gap_chnl_map_set=0x00066909 ---define_symbol ble_gap_con_plan_consult=0x000669ad ---define_symbol ble_gap_conn_info_get=0x00066a05 ---define_symbol ble_gap_conn_param_update=0x00066ac5 ---define_symbol ble_gap_conn_param_update_reply=0x00066ba9 ---define_symbol ble_gap_connect_cancel=0x00066d51 ---define_symbol ble_gap_data_length_set=0x00066dad ---define_symbol ble_gap_data_length_update=0x00066e21 ---define_symbol ble_gap_default_tx_power_get=0x00066ec1 ---define_symbol ble_gap_default_tx_power_set=0x00066ec5 ---define_symbol ble_gap_dev_info_get=0x00066ec9 ---define_symbol ble_gap_device_name_get=0x00066f91 ---define_symbol ble_gap_device_name_set=0x00067021 ---define_symbol ble_gap_disconnect=0x000670c5 ---define_symbol ble_gap_ext_adv_param_set=0x00067149 ---define_symbol ble_gap_ext_connect=0x00067429 ---define_symbol ble_gap_ext_scan_param_set=0x00067561 ---define_symbol ble_gap_irk_set=0x00067621 ---define_symbol ble_gap_l2cap_params_set=0x00067689 ---define_symbol ble_gap_lepsm_register=0x0006771d ---define_symbol ble_gap_lepsm_unregister=0x000678a1 ---define_symbol ble_gap_pair_enable=0x00067941 ---define_symbol ble_gap_path_compensation_set=0x00067999 ---define_symbol ble_gap_peer_info_get=0x000679ed ---define_symbol ble_gap_per_adv_list_add=0x00067aa1 ---define_symbol ble_gap_per_adv_list_clear=0x00067bc1 ---define_symbol ble_gap_per_adv_list_del=0x00067c25 ---define_symbol ble_gap_per_adv_list_get=0x00067d09 ---define_symbol ble_gap_per_sync_param_set=0x00067d8d ---define_symbol ble_gap_per_sync_start=0x00067e85 ---define_symbol ble_gap_per_sync_stop=0x00067f51 ---define_symbol ble_gap_phy_update=0x00067ff5 ---define_symbol ble_gap_ppcp_get=0x00068099 ---define_symbol ble_gap_ppcp_present_set=0x000680f5 ---define_symbol ble_gap_ppcp_set=0x00068159 ---define_symbol ble_gap_pref_phy_set=0x000681b5 ---define_symbol ble_gap_privacy_mode_set=0x00068209 ---define_symbol ble_gap_privacy_params_set=0x0006828d ---define_symbol ble_gap_role_set=0x00068375 ---define_symbol ble_gap_rpa_list_get=0x000683c1 ---define_symbol ble_gap_rslv_addr_read=0x00068415 ---define_symbol ble_gap_scan_param_set=0x000684b5 ---define_symbol ble_gap_scan_start=0x0006859d ---define_symbol ble_gap_scan_stop=0x00068629 ---define_symbol ble_gap_tx_power_get=0x00068841 ---define_symbol ble_gap_tx_power_set=0x00068919 ---define_symbol ble_gap_update_adv_data=0x00068a01 ---define_symbol ble_gap_whitelist_add=0x00068abd ---define_symbol ble_gap_whitelist_clear=0x00068bf1 ---define_symbol ble_gap_whitelist_del=0x00068c55 ---define_symbol ble_gap_whitelist_get=0x00068d3d ---define_symbol ble_gapc_role_get=0x00068dd5 ---define_symbol ble_gapm_bdaddr_get=0x00068ddd ---define_symbol ble_gatt_mtu_set=0x00068f25 ---define_symbol ble_gattc_get_mtu=0x00068fa7 ---define_symbol ble_gatts_attr_permission_get=0x00069f91 ---define_symbol ble_gatts_attr_permission_set=0x0006a09d ---define_symbol ble_gatts_service_changed=0x0006a4e9 ---define_symbol ble_gatts_srvc_db_create=0x0006a555 ---define_symbol ble_gatts_value_get=0x0006a861 ---define_symbol ble_gatts_value_set=0x0006a90d ---define_symbol bl1_hci_uart_register=0x0006aaa9 ---define_symbol ble_idle_time_notify_cb_register=0x0006aab1 ---define_symbol ble_init_cmp_callback_register=0x0006aad1 ---define_symbol ble_iso_accept_cis_req=0x0006ab01 ---define_symbol ble_iso_create_big=0x0006abdd ---define_symbol ble_iso_create_big_sync=0x0006acd5 ---define_symbol ble_iso_create_cis=0x0006ade1 ---define_symbol ble_iso_disc_cis=0x0006af01 ---define_symbol ble_iso_discover_ann=0x0006af5d ---define_symbol ble_iso_get_core_bts=0x0006afe9 ---define_symbol ble_iso_read_tx_sync=0x0006afed ---define_symbol ble_iso_reg_rcv_data_cb=0x0006aff1 ---define_symbol ble_iso_register_ascp_gap_callback=0x0006b007 ---define_symbol ble_iso_register_callback=0x0006b00d ---define_symbol ble_iso_reject_cis_req=0x0006b021 ---define_symbol ble_iso_req_peer_sca=0x0006b089 ---define_symbol ble_iso_rm_cig=0x0006b105 ---define_symbol ble_iso_rm_data_path=0x0006b171 ---define_symbol ble_iso_send_data=0x0006b1ed ---define_symbol ble_iso_set_cig_param=0x0006b231 ---define_symbol ble_iso_set_data_path=0x0006b41d ---define_symbol ble_iso_start_bd_ann=0x0006b49d ---define_symbol ble_iso_start_gen_ann=0x0006b569 ---define_symbol ble_iso_start_target_ann=0x0006b619 ---define_symbol ble_iso_stop_ann=0x0006b6fd ---define_symbol ble_iso_stop_discover_ann=0x0006b709 ---define_symbol ble_iso_stop_sync_bd_ann=0x0006b70d ---define_symbol ble_iso_sync_bd_ann=0x0006b711 ---define_symbol ble_iso_terminate_big=0x0006b7e1 ---define_symbol ble_iso_terminate_big_sync=0x0006b851 ---define_symbol ble_ke_event_callback_set=0x0006b8d9 ---define_symbol ble_ke_event_clear=0x0006b8dd ---define_symbol ble_ke_event_set=0x0006b8e1 ---define_symbol ble_ke_free=0x0006b8e5 ---define_symbol ble_ke_malloc=0x0006b8e9 ---define_symbol ble_ke_msg_alloc=0x0006b935 ---define_symbol ble_ke_msg_forward=0x0006b9b9 ---define_symbol ble_ke_msg_free=0x0006b9bd ---define_symbol ble_ke_msg_send=0x0006b9c1 ---define_symbol ble_ke_time=0x0006b9cd ---define_symbol ble_l2cap_lecb_cb_register=0x0006b9d1 ---define_symbol ble_l2cap_lecb_conn_cfm=0x0006bb3d ---define_symbol ble_l2cap_lecb_conn_create=0x0006bc8d ---define_symbol ble_l2cap_lecb_credits_add=0x0006be85 ---define_symbol ble_l2cap_lecb_disconnect=0x0006bf9d ---define_symbol ble_l2cap_lecb_sdu_send=0x0006c069 ---define_symbol ble_mesh_prf_cbs_register=0x0006c205 ---define_symbol ble_prf_env_get=0x0006c27d ---define_symbol ble_prf_src_task_get=0x0006c34d ---define_symbol ble_prf_task_env_get=0x0006c351 ---define_symbol ble_rf_calibration_func_cb_register=0x0006c355 ---define_symbol ble_rf_match_circuit_get=0x0006c371 ---define_symbol ble_rf_match_circuit_set=0x0006c375 ---define_symbol ble_rf_tx_mode_get=0x0006c379 ---define_symbol ble_rf_tx_mode_set=0x0006c37d ---define_symbol ble_rwip_reset=0x0006c3b1 ---define_symbol ble_rwip_time_get=0x0006c3b5 ---define_symbol ble_sch_alarm_clear=0x0006c511 ---define_symbol ble_sch_alarm_prog=0x0006c515 ---define_symbol ble_sch_alarm_set=0x0006c519 ---define_symbol ble_sdk_schedule=0x0006e1a1 ---define_symbol ble_sec_enc_cfm=0x0006e249 ---define_symbol ble_sec_keypress_notify_send=0x0006e429 ---define_symbol ble_sec_params_set=0x0006e4ad ---define_symbol ble_server_prf_add=0x0006e569 ---define_symbol ble_stack_debug_setup=0x0006e67d ---define_symbol dfu_ble_receive_data_process=0x0006ef31 ---define_symbol dfu_ble_send_data_cmpl_process=0x0006ef59 ---define_symbol dfu_ble_set_mtu_size=0x0006ef95 ---define_symbol dfu_cmd_parse_state_reset=0x0006f15d ---define_symbol dfu_cmd_disable_config=0x0006f011 ---define_symbol dfu_flash_read=0x0006f535 ---define_symbol dfu_flash_erase=0x0006f42d ---define_symbol dfu_flash_write=0x0006f675 ---define_symbol dfu_flash_update=0x0006f5a5 ---define_symbol dfu_init=0x0006f6a9 ---define_symbol dfu_schedule=0x0006fa3d ---define_symbol dfu_spi_flash_func_config=0x0006fbf1 ---define_symbol dfu_start_jump=0x0006fc5d ---define_symbol dfu_uart_receive_data_process=0x0006fe75 ---define_symbol dfu_port_flash_init=0x0006f71d ---define_symbol get_system_config_info=0x00075c51 ---define_symbol operate_nvds=0x00077bd1 ---define_symbol fpb_init=0x00070229 ---define_symbol fpb_register_patch_init_func=0x000702e1 ---define_symbol gap_set_device_config=0x000736d5 ---define_symbol hal_flash_get_info=0x00075ded ---define_symbol hal_flash_get_security=0x00075e05 ---define_symbol hal_flash_sector_size=0x00075e99 ---define_symbol hal_flash_set_security=0x00075ea1 ---define_symbol mesh_init_callback_register=0x00077569 ---define_symbol mesh_prf_config=0x000775c1 ---define_symbol nvds_del=0x0007760d ---define_symbol nvds_get=0x000776f5 ---define_symbol nvds_get_start_addr=0x00077839 ---define_symbol nvds_init=0x00077845 ---define_symbol nvds_tag_length=0x00077a7d ---define_symbol pwr_mgmt_baseband_state_get=0x00078739 ---define_symbol pwr_mgmt_check_ble_event=0x00078791 ---define_symbol pwr_mgmt_check_pend_irq=0x000788e1 ---define_symbol pwr_mgmt_dev_init=0x00078905 ---define_symbol pwr_mgmt_dev_resume=0x00078915 ---define_symbol pwr_mgmt_dev_suspend=0x00078925 ---define_symbol pwr_mgmt_get_sleep_mode=0x000789b9 ---define_symbol pwr_mgmt_get_wakeup_flag=0x00078af1 ---define_symbol pwr_mgmt_init=0x00078b05 ---define_symbol pwr_mgmt_mem_check_process_reg=0x00078c4d ---define_symbol pwr_mgmt_mode_get=0x00078c59 ---define_symbol pwr_mgmt_mode_set=0x00078c65 ---define_symbol pwr_mgmt_notify_timer_event=0x00078c7d ---define_symbol pwr_mgmt_rtc_timer_thrd_set=0x00078c95 ---define_symbol pwr_mgmt_set_callback=0x00078dc9 ---define_symbol pwr_mgmt_set_wakeup_flag=0x00078dd5 ---define_symbol pwr_mgmt_shutdown=0x00078ded ---define_symbol pwr_mgmt_update_wkup_param=0x00078ff5 ---define_symbol pwr_mgmt_wakeup_source_clear=0x000790dd ---define_symbol pwr_mgmt_wakeup_source_setup=0x000790f1 ---define_symbol pwr_mgmt_wfe_sleep=0x00079105 ---define_symbol rf_recalibration_handler_register=0x00079ba1 ---define_symbol rf_get_recalibration_flag=0x00079939 ---define_symbol rf_set_recalibration_flag=0x00079bed ---define_symbol rom_simu=0x00079e1d ---define_symbol sdk_register_assert_cb=0x0007a02d ---define_symbol svc_func_register=0x0007b759 ---define_symbol svc_table_register=0x0007b79d ---define_symbol sys_assert_cb_register=0x0007b879 ---define_symbol sys_context_save=0x0007b985 ---define_symbol sys_context_save_register=0x0007bb65 ---define_symbol sys_delay_ms=0x0007bbf5 ---define_symbol sys_delay_us=0x0007bbff ---define_symbol sys_free=0x0007bd79 ---define_symbol sys_ke_sleep_check=0x0007bdab ---define_symbol sys_ke_timer_clear=0x0007bdb7 ---define_symbol sys_ke_timer_set=0x0007bdbb ---define_symbol sys_link_quality_clear=0x0007bdc1 ---define_symbol sys_link_quality_get=0x0007bde1 ---define_symbol sys_lpclk_set=0x0007be21 ---define_symbol sys_lpclk_update_func_register=0x0007be3d ---define_symbol sys_lpcycles_2_hus=0x0007be49 ---define_symbol sys_malloc=0x0007be5d ---define_symbol sys_max_msg_usage_ratio_set=0x0007be69 ---define_symbol gm_drv_present_encrypt=0x00001b75 ---define_symbol sys_security_data_use_present=0x0007bf5d ---define_symbol sys_security_enable_status_check=0x0007bf6d ---define_symbol sys_swd_disable=0x0007bf85 ---define_symbol sys_swd_enable=0x0007bf95 ---define_symbol sys_timer_clear=0x0007bfa5 ---define_symbol sys_timer_set=0x0007bfd5 ---define_symbol sys_us_2_lpcycles=0x0007c059 ---define_symbol ultra_wfi=0x0007c345 ---define_symbol sys_lpclk_get=0x0007be15 ---define_symbol sys_lpper_get=0x0007be51 ---define_symbol set_comm_wkup_time=0x0007af95 ---define_symbol pwr_mgmt_sleep_param_get=0x00078e85 ---define_symbol pwr_mgmt_get_counter_A_B=0x00078985 ---define_symbol g_exflash_handle=0x00801f64 ---define_symbol diag_ble_isr_start_func=0x00802364 ---define_symbol diag_ble_isr_done_func=0x00802368 ---define_symbol diag_ble_core_sleep_status_func=0x00802458 ---define_symbol diag_ble_core_sleep_break_func=0x0080245c ---define_symbol diag_no25_isr_start_func=0x00802460 ---define_symbol diag_no25_isr_done_func=0x00802464 ---define_symbol g_lpcalibcyclecount=0x0080247c ---define_symbol ble_core_sleep=0x00802480 ---define_symbol pwr_mgmt_status_chk_func=0x00802684 ---define_symbol pwr_mgmt_sched_ret_func=0x00802688 ---define_symbol pwr_mgmt_before_enter_sleep_fun=0x0080268c ---define_symbol pwr_mgmt_device_state_check=0x00802690 ---define_symbol ultra_wfi_or_wfe=0x008026a8 ---define_symbol sdk_gap_env=0x0080277c ---define_symbol patch_func_table=0x00803d64 ---define_symbol rom_callback=0x00800500 ---define_symbol s_sys_clk=0x00802675 ---define_symbol s_pwr_mgmt_table=0x0080267c ---define_symbol g_evt_start_cbk_run_hus=0x008006b4 ---define_symbol hci_ext_host=0x008006a3 ---define_symbol hci_env=0x00801950 ---define_symbol bl1_boot_info=0x00801f10 ---define_symbol bl0_boot_info=0x00800000 ---define_symbol hci_look_for_cmd_desc=0x0002b1b5 ---define_symbol qspi_config=0x000531b5 ---define_symbol qspi_send_inst_addr=0x00053475 ---define_symbol qspi_wait_flag_state_until_timeout=0x00053545 ---define_symbol exflash_wakeup=0x0000e78d ---define_symbol exflash_check_id=0x0000e3fd ---define_symbol exflash_deepsleep=0x0000e479 ---define_symbol exflash_erase_chip=0x0000e515 ---define_symbol exflash_erase_sector=0x0000e571 ---define_symbol exflash_page_program=0x0000e5d9 ---define_symbol exflash_enable_write=0x0000e4f9 ---define_symbol exflash_wait_busy=0x0000e715 ---define_symbol exflash_write_status=0x0000e7a9 ---define_symbol ble_bm_set_gatt_info=0x00065a49 ---define_symbol ble_gattm_svc_start_hdl_get=0x00069f8d ---define_symbol gatt_add_bond_cccd=0x0007475d ---define_symbol gatt_find_item=0x00074b99 ---define_symbol sec_get_bond_dev_addr=0x0007a37d ---define_symbol gatt_on_disconnection_fp=0x008022d8 ---define_symbol gatt_remove_item=0x00075075 ---define_symbol gattc_on_disconnection=0x00075509 ---define_symbol ble_attmdb_get_attribute=0x00064f05 ---define_symbol ble_attmdb_uuid16_comp=0x00064f11 ---define_symbol ble_prf_get_id_from_task=0x0006c341 ---define_symbol prf_default_msg_handler_tab=0x00802308 ---define_symbol prf_get_prf_cb_by_task_id=0x00078221 ---define_symbol calculate_hmac=0x0006e8c0 ---define_symbol ble_bm_get_sec_info=0x000658b9 ---define_symbol g_sec_param=0x008023f0 ---define_symbol sec_enc_link=0x0007a341 ---define_symbol sec_send_pair_req=0x0007ae21 ---define_symbol sec_send_security_req=0x0007ae51 ---define_symbol HP_Gain_2M=0x0080343c ---define_symbol ble_gap_latency_set=0x00067709 ---define_symbol g_master_chsel_2_supported=0x00800638 ---define_symbol lld_aa_gen=0x0003ae59 ---define_symbol lld_init_connect_req_pack=0x00047b6d ---define_symbol lld_init_evt_canceled_cbk=0x0004800d ---define_symbol lld_init_evt_start_cbk=0x00048105 ---define_symbol lld_ral_search=0x0004b6bd ---define_symbol lld_read_clock=0x0004b71d ---define_symbol sch_slice_params=0x00800710 ---define_symbol lld_init_frm_cbk=0x0080063c ---define_symbol lld_init_compute_winoffset=0x00047b21 ---define_symbol force_dpad_le_high=0x0000e8ad ---define_symbol restore_sys_env_callback=0x0080076c ---define_symbol lld_scan_start=0x00800668 ---define_symbol lld_scan_start_func=0x0004d561 diff --git a/gr551x/sdk_liteos/liteos_m/target_config.h b/gr551x/sdk_liteos/liteos_m/target_config.h old mode 100644 new mode 100755 diff --git a/gr551x/sdk_liteos/platform/include/log_serial.h b/gr551x/sdk_liteos/platform/include/log_serial.h old mode 100644 new mode 100755 diff --git a/gr551x/sdk_liteos/platform/include/main.h b/gr551x/sdk_liteos/platform/include/main.h old mode 100644 new mode 100755 diff --git a/gr551x/sdk_liteos/platform/main/main.c b/gr551x/sdk_liteos/platform/main/main.c old mode 100644 new mode 100755 index 80343f5..ae8d825 --- a/gr551x/sdk_liteos/platform/main/main.c +++ b/gr551x/sdk_liteos/platform/main/main.c @@ -42,7 +42,7 @@ void SystemPeripheralsInit(void) } bsp_log_init(); - APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>GR551x system start!!!"); + APP_LOG_INFO("GR551x system start!!!"); } /* Initialize Hardware RNG peripherals. */ diff --git a/gr551x/sdk_liteos/platform/main/sdk_main.c b/gr551x/sdk_liteos/platform/main/sdk_main.c old mode 100644 new mode 100755 index bb0c818..44dc157 --- a/gr551x/sdk_liteos/platform/main/sdk_main.c +++ b/gr551x/sdk_liteos/platform/main/sdk_main.c @@ -12,198 +12,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "los_task.h" -#include "los_interrupt.h" -#include "los_compiler.h" -#include "los_arch_interrupt.h" #include "cmsis_os2.h" #include "gr55xx.h" #include "main.h" #include "log_serial.h" -#include "core_cm4.h" -#include "ble_cfg_net_api.h" -#include "hilink_bt_api.h" -#include "hilink_bt_function.h" -#include "hilink_bt_netcfg_api.h" - #include "app_log.h" -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cpluscplus */ -#endif /* __cpluscplus */ - #define CN_MINISECONDS_IN_SECOND 1000 #define CN_MAINBOOT_TASK_STACKSIZE 0X4000 #define CN_MAINBOOT_TASK_PRIOR 2 #define CN_MAINBOOT_TASK_NAME "MainBoot" -#define DEVICE_SN "12345678" - -/* - * 设备基本信息 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -#define DEVICE_SN "12345678" -#define PRODUCT_ID "2EKT" -#define DEVICE_MODEL "D12" -#define DEVICE_TYPE "000" -#define MANUAFACTURER "832" -#define DEVICE_MAC "AABBCCDDEEFF" -/* - * 请确保设备类型英文名和厂商英文名长度之和不超过17字节 - * 如果需要发送蓝牙广播,设备类型英文名和厂商英文名长度分别不能超过4字节 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -#define DEVICE_TYPE_NAME "YH" -#define MANUAFACTURER_NAME "L" - -/* 蓝牙sdk单独使用的定义 */ -#define SUB_PRODUCT_ID "00" -#define ADV_TX_POWER 0xF8 - - - -/* 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 */ -typedef struct { - const char* sn; /* 设备唯一标识,比如sn号,长度范围(0,40] */ - const char* prodId; /* 设备HiLink认证号,长度范围(0,5] */ - const char* model; /* 设备型号,长度范围(0,32] */ - const char* dev_t; /* 设备类型,长度范围(0,4] */ - const char* manu; /* 设备制造商,长度范围(0,4] */ - const char* mac; /* 设备MAC地址,固定32字节 */ - const char* hiv; /* 设备Hilink协议版本,长度范围(0,32] */ - const char* fwv; /* 设备固件版本,长度范围[0,64] */ - const char* hwv; /* 设备硬件版本,长度范围[0,64] */ - const char* swv; /* 设备软件版本,长度范围[0,64] */ - const int prot_t; /* 设备协议类型,取值范围[1,3] */ -} dev_info_t; - -/* - * 设备类型英文名和厂商英文名长度之和不能超过17字节 - * 如果需要发送蓝牙广播,设备类型英文名和厂商英文名长度分别不能超过4字节 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -typedef struct { - const char* devTypeName; /* 设备类型英文名称 */ - const char* manuName; /* 厂商英文名称 */ -} DevNameEn; - - -#define MIN_LEN(a, b) (((a) < (b)) ? (a) : (b)) - -/* - * 设备名称定义, 请确保设备类型英文名和厂商英文名长度之和不超过17字节 - * 如果需要发送蓝牙广播,设备类型英文名和厂商英文名长度分别不能超过4字节 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -DevNameEn g_devNameEn = { - DEVICE_TYPE_NAME, - MANUAFACTURER_NAME -}; - -/* - * 设备信息定义 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -dev_info_t dev_info = { - DEVICE_SN, - PRODUCT_ID, - DEVICE_MODEL, - DEVICE_TYPE, - MANUAFACTURER, - DEVICE_MAC, - "1.0.0", - "1.0.0", - "1.0.0", - "1.0.0", - 1 -}; - - -static int PutServiceOta(const void *svc, const unsigned char *in, unsigned int inLen, - unsigned char **out, unsigned int *outLen); -static int GetServiceOta(const void *svc, const unsigned char *in, unsigned int inLen, - unsigned char **out, unsigned int *outLen); - -static int ble_rcv_custom_data(unsigned char *buff, unsigned int len) -{ - APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>custom data: %s", buff); - return 0; -} - -static BLE_ConfPara isblepair = -{ - .isBlePair = 1, -}; - -static BLE_InitPara ble_init_param = -{ - .confPara = &isblepair, - .advInfo = NULL, - .gattList = NULL, -}; - -static BLE_CfgNetCb ble_cfg_net_cb = -{ - .rcvCustomDataCb = ble_rcv_custom_data, -}; - - -static HILINK_BT_DevInfo g_btDevInfo; - - -/* 服务信息 */ -static HILINK_BT_SvcInfo g_svcInfo[] = -{ - { 64, "ota", PutServiceOta, GetServiceOta, 0, NULL }, -}; - -/* Profile */ -static HILINK_BT_Profile g_profile = -{ - .svcNum = sizeof(g_svcInfo) / sizeof(g_svcInfo[0]), - .svcInfo = g_svcInfo, -}; - -/* 蓝牙发送数据接口打桩函数,由厂家实现 */ -static int HILINK_BT_FeedBackBtData(const unsigned char *buf, unsigned int len) -{ - (void)buf; - (void)len; - return 0; -} - -static int PutServiceOta(const void *svc, const unsigned char *in, unsigned int inLen, - unsigned char **out, unsigned int *outLen) -{ - (void)inLen; - (void)out; - (void)outLen; - APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>service:%s, payload:%s", (char *)svc, (char *)in); - return 0; -} - -static int GetServiceOta(const void *svc, const unsigned char *in, unsigned int inLen, - unsigned char **out, unsigned int *outLen) -{ - (void)inLen; - (void)out; - (void)outLen; - APP_LOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>service:%s, payload:%s", (char *)svc, (char *)in); - return 0; -} - -static void hilink_bt_event_handler(HILINK_BT_SdkStatus event, const void *param) -{ - if (HILINK_BT_SDK_STATUS_SVC_RUNNING == event) - { - BLE_CfgNetAdvCtrl(0xfffffffe); - } -} - static void MainBoot(void) { UINT32 uwRet; @@ -216,35 +36,25 @@ static void MainBoot(void) stTask.usTaskPrio = CN_MAINBOOT_TASK_PRIOR; /* Os task priority is 6 */ uwRet = LOS_TaskCreate(&taskID, &stTask); if (uwRet != LOS_OK) { - APP_LOG_ERROR(">>>>>>>>>>>>>>>>>>>>>>>>>>MainBoot task create failed!!!"); + APP_LOG_ERROR("MainBoot task create failed!!!"); } } -static void BleAdapterPreInit(void) -{ - //The device name must be set here - ble_gap_device_name_set(BLE_GAP_WRITE_PERM_NOAUTH, DEVICE_TYPE_NAME, strlen(DEVICE_TYPE_NAME)); - BleEventTaskInit(); -} - - /*** * @brief This is the ohos entry, and you could call this in your main funciton after the * necessary hardware has been initialized. */ void OHOS_Boot(void) { - UINT32 ret; + UINT32 ret; ret = LOS_KernelInit(); if (ret == LOS_OK) { OSVectorInit(); SystemPeripheralsInit(); FileSystemInit(); - BleAdapterPreInit(); - HILINK_BT_SetSdkEventCallback(hilink_bt_event_handler); - BLE_CfgNetInit(&ble_init_param, &ble_cfg_net_cb); HardwareRandomInit(); + DeviceManagerStart(); MainBoot(); LOS_Start(); } @@ -256,109 +66,4 @@ VOID HalDelay(UINT32 ticks) delay_ms(ticks); } -/** - * @brief Convert miniseconds to system ticks - * @param ms Indicates the mimiseconds to convert - * @return Returns the corresponding ticks of specified time - */ -uint32_t Time2Tick(uint32_t ms) -{ - uint64_t ret; - ret = ((uint64_t)ms * osKernelGetTickFreq()) / CN_MINISECONDS_IN_SECOND; - return (uint32_t)ret; -} - -/* 获取蓝牙SDK设备相关信息 */ -HILINK_BT_DevInfo *HILINK_BT_GetDevInfo(void) -{ - g_btDevInfo.manuName = (char *)g_devNameEn.manuName; - g_btDevInfo.devName = (char *)g_devNameEn.devTypeName; - g_btDevInfo.productId = (char *)dev_info.prodId; - g_btDevInfo.mac = (char *)dev_info.mac; - g_btDevInfo.model = (char *)dev_info.model; - g_btDevInfo.devType = (char *)dev_info.dev_t; - g_btDevInfo.hiv = (char *)dev_info.hiv; - g_btDevInfo.protType = dev_info.prot_t; - return &g_btDevInfo; -} - -unsigned char A_C[48] = -{ - 0x49, 0x3F, 0x45, 0x4a, 0x3a, 0x72, 0x38, 0x7b, 0x36, 0x32, 0x50, 0x3c, 0x49, 0x39, 0x63, 0x38, - 0x72, 0xcb, 0x6d, 0xc5, 0xae, 0xe5, 0x4a, 0x82, 0xd3, 0xe5, 0x6d, 0xf5, 0x36, 0x82, 0x62, 0xeb, - 0x89, 0x30, 0x6c, 0x88, 0x32, 0x56, 0x23, 0xfd, 0xb8, 0x67, 0x90, 0xa7, 0x7b, 0x61, 0x1e, 0xae -}; - -unsigned char *HILINK_GetAutoAc(void) -{ - return A_C; -} - -int HiLinkGetPinCode(void) -{ - return -1; -} - -/* - * 功能: 获取设备sn号 - * 参数[in]: len sn的最大长度, 39字节 - * 参数[out]: sn 设备sn - * 注意: sn指针的字符串长度为0时将使用设备mac地址作为sn - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -void HILINK_GetDeviceSn(unsigned int len, char *sn) -{ - if (sn == NULL) { - return; - } - const char *ptr = DEVICE_SN; - int tmp = MIN_LEN(len ,sizeof(DEVICE_SN)); - for (int i = 0; i < tmp; i++) { - sn[i] = ptr[i]; - } - return; -} - -/* - * 获取设备的子型号,长度固定两个字节 - * subProdId为保存子型号的缓冲区,len为缓冲区的长度 - * 如果产品定义有子型号,则填入两字节子型号,并以'\0'结束, 返回0 - * 没有定义子型号,则返回-1 - * 该接口需设备开发者实现 - * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 - */ -int HILINK_GetSubProdId(char *subProdId, int len) -{ - if (subProdId == NULL) { - return -1; - } - const char *ptr = SUB_PRODUCT_ID; - int tmp = MIN_LEN((unsigned int)len ,sizeof(SUB_PRODUCT_ID)); - for (int i = 0; i < tmp; i++) { - subProdId[i] = ptr[i]; - } - return 0; -} - -/* - * 获取设备表面的最强点信号发射功率强度,最强点位置的确定以及功率测试方 - * 法,参照hilink认证蓝牙靠近发现功率设置及测试方法指导文档,power为出参 - * ,单位dbm,返回设备表面的最强信号强度值,如果厂商不想使用蓝牙靠近发现功 - * 能,接口直接返-1,如果需要使用蓝牙靠近发现,则接口返回0,如需及时生效,需 - * 调用HILINK_BT_StartAdvertise()方法启动广播 - */ -int HILINK_BT_GetDevSurfacePower(char *power) -{ - if (power == NULL) { - return -1; - } - *power = ADV_TX_POWER; - return 0; -} - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cpluscplus */ -#endif /* __cpluscplus */ diff --git a/gr551x/sdk_liteos/platform/startup/gr551x.ld b/gr551x/sdk_liteos/platform/startup/gr551x.ld old mode 100644 new mode 100755 index 42d2711..7b840ac --- a/gr551x/sdk_liteos/platform/startup/gr551x.ld +++ b/gr551x/sdk_liteos/platform/startup/gr551x.ld @@ -25,12 +25,13 @@ /* Entry Point */ ENTRY(Reset_Handler) -/* Highest address of the user mode stack */ -_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ - _Min_Heap_Size = 0x800; /* required amount of heap */ _Min_Stack_Size = 0x2000; /* required amount of stack */ +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ +_sstack = _estack - _Min_Stack_Size; + /* Memories definition */ MEMORY { @@ -54,7 +55,7 @@ SECTIONS .text : { . = ALIGN(4); - + _stext = .; *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.glue_7) /* glue arm to thumb code */ @@ -191,6 +192,12 @@ SECTIONS . = ALIGN(4); } >FLASH + .hdf_drivers_entry : + { + _hdf_drivers_start = .; + KEEP(*(.hdf.driver)) + _hdf_drivers_end = .; + } >FLASH /* Used by the startup to initialize data */ _sidata = LOADADDR(.data); diff --git a/gr551x/sdk_liteos/platform/startup/startup_gr55xx.s b/gr551x/sdk_liteos/platform/startup/startup_gr55xx.s old mode 100644 new mode 100755 index 56ef418..5aa3185 --- a/gr551x/sdk_liteos/platform/startup/startup_gr55xx.s +++ b/gr551x/sdk_liteos/platform/startup/startup_gr55xx.s @@ -287,6 +287,6 @@ SVC_Handler: BLXNE R12 BX LR -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ +/*****END OF FILE****/ diff --git a/gr551x/sdk_liteos/platform/system/log_serial.c b/gr551x/sdk_liteos/platform/system/log_serial.c old mode 100644 new mode 100755 index d66815d..3ef8c85 --- a/gr551x/sdk_liteos/platform/system/log_serial.c +++ b/gr551x/sdk_liteos/platform/system/log_serial.c @@ -82,12 +82,28 @@ void bsp_log_init(void) __attribute__((weak)) int _read(int file, char *ptr, int len) { - return 0; + return 0; } __attribute__((weak)) int _write(int file, char *ptr, int len) { bsp_uart_send(ptr, len); - return len; + return len; } +int HiLogWriteInternal(const char *buffer, size_t bufLen) +{ + if (!buffer) + return -1; + // because it's called as HiLogWriteInternal(buf, strlen(buf) + 1) + if (bufLen < 2) + return 0; + if (buffer[bufLen - 2] != '\n') { + *((char *)buffer + bufLen - 1) = '\n'; + } else { + bufLen--; + } + int ret = app_uart_transmit_sync(LOG_UART_ID, buffer, bufLen, 1000); + + return ret; +} diff --git a/gr551x/sdk_liteos/platform/system/syscalls.c b/gr551x/sdk_liteos/platform/system/syscalls.c old mode 100644 new mode 100755 diff --git a/gr551x/sdk_liteos/platform/system/sysmem.c b/gr551x/sdk_liteos/platform/system/sysmem.c old mode 100644 new mode 100755 diff --git a/gr551x/tools/bin_create.py b/gr551x/tools/bin_create.py old mode 100644 new mode 100755 index e99fc3a..9b1519c --- a/gr551x/tools/bin_create.py +++ b/gr551x/tools/bin_create.py @@ -1,7 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# author: zhangqf - # Copyright (c) 2021 GOODIX. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# author: zhangqf + """ This module use arm-none-eabi-xxx function to deal the xxx.elf file. we recept two parameters, and the format of the usage: bin_create.py input_file.elf out_file.bin. Thanks for use this module @@ -29,8 +29,7 @@ import re import os import json -TARGET_IMG_NAME = "application_fw" -CUSTOM_CONFIG = "../../../device/goodix/gr551x/sdk_liteos/config/custom_config.h" +CUSTOM_CONFIG = "../../../device/soc/goodix/gr551x/sdk_liteos/config/custom_config.h" BufSize = 1024 PatternValue = 0x4744 @@ -323,8 +322,12 @@ class GenFirmware(): img_info_byte = self.img_info.to_bytes() for x in img_info_byte: f_w.write(x) - for i in range(MaxCommentsLen): + for i in range(len(self.img_info.comments)): f_w.write(self.img_info.comments[i].encode('utf-8')) + if (len(self.img_info.comments) < MaxCommentsLen): + for i in range(MaxCommentsLen - len(self.img_info.comments)): + pad=' '; + f_w.write(str(pad).encode('utf-8')) for i in range(8): a = 0 f_w.write(a.to_bytes(1, byteorder='little', signed=False)) @@ -386,11 +389,14 @@ def main(input = ""): def make_bin(input_file = "", output_file = "", list_file=""): shell_script = '''arm-none-eabi-objcopy -O binary -S {src_file} {dst_file}'''.format(src_file = input_file, dst_file = output_file) cmd_output = os.system(shell_script) + main(output_file) + shell_script = '''arm-none-eabi-size {src_file} arm-none-eabi-objdump -D {src_file} > {list_file}'''.format(src_file = input_file, dst_file = output_file, list_file=list_file) cmd_output = os.system(shell_script) + return if __name__ == "__main__":