蜂鸟L系列离线方案开发指导手册: ReleaseNote

蜂鸟L系列离线方案开发指导手册 v1.0.1
ReleaseNote

版本历史记录

版本：V1.0.1，发布时间：2021/4/30

适配环境：

  • 硬件：蜂鸟L US513 V0-1开发板
  • 软件：hb_l v1.0.6

修改记录：

  1. 《烧录固件》章节中增加烧录外置flash方法说明
  2. 《二次开发》章节中增加编译“录音调试”版本和“外置flash”版本方法说明

版本：V1.0.0，发布时间：2021/3/18

适配环境：

  • 硬件：蜂鸟L US513 V0-1开发板
  • 软件：hb_l v1.0.0

修改记录：

  1. 第一版发布


蜂鸟L系列离线方案开发指导手册: 1、简介

1、简介

1. 引言

云知声总部位于北京，在上海、深圳、厦门设有全资子公司。是一家专注物联网人工智能服务、拥有完全自主知识产权的世界顶尖的智能语音识别和语义理解技术的高新技术企业。自2012年由智能语音技术起家，云知声多年来不断拓展技术边界，技术能力不仅涵盖了感知、认知、交互等方面的人工智能语音语义技术，更是在突破了 AI 芯片设计技术后，一举打造出了自主研发、自主知识产权、自主可控的全栈式人工智能技术链条（深度学习算法+大数据+超级计算+芯片能力）。

以强大的计算平台为基础，云知声构建了“云端芯”生态体系，提供跨硬件平台、跨应用场景的软硬件一体化云端+本地智能的芯片终端解决方案。目前云知声是迄今为止行业内唯一实现芯片落地应用的公司、国内白色家电领域领先AI芯片供应商、国内首家推出医疗云服务并完成数百家医院系统测试的语音服务商、我国后装车机市场占有量行业第一、教育云社会化口语评测服务市场占有量第一。还在智慧生活（家居、车载、机器人等）和智慧服务（医疗、教育、司法等）等多个垂直场景均有落地应用。

2. 产品简介

云知声提供标准化软硬件一体离线语音解决方案，支持单麦拾音、前端降噪、语音唤醒、离线识别等。用户使用方案中的标准化硬件模组配合云知声设备平台与相关工具，快速定制语音产品，为空调、冰箱、灯具、开关等家居设备赋能，无需联网即可使其具备智能语音交互能力。

- 硬件：基于云知声蜂鸟L系列芯片为核心的标准硬件板，集成离线识别算法

- 开放平台：可进行语音相关配置并生成软件版本的云知声智能设备平台

- 软件与源码：可直接使用，也可修改代码进行二次编译的软件版本

- 文档与工具：使用指南与技术开发文档，配套测试工具


蜂鸟L系列离线方案开发指导手册: 2、产品说明

2、产品说明

1. 硬件说明

蜂鸟L系列芯片是亚毫瓦级超低功耗面向带电池和便携式产品以及对功耗有严苛要求的各类产品推出的智能纯离线语音识别芯片，依托于云知声在语音识别技术上的积累和算法的不断优化和创新，将离线识别算法与芯片架构深度融合，为客户提供 Turnkey 语音识别方案，可广泛且快速应用于各类带电池的小家电，可穿戴，玩具以及单火线供电 86 盒等需要语音操控的产品。

蜂鸟L系列芯片采用 MCU+语音识别专用 NPU 架构内核，采用超低功耗制程工艺，内置高精度语音检测模块配合系统多级启动模式使芯片待机功耗进入亚毫瓦级，工作功耗几毫瓦级别，芯片内置 SRAM 和 FLASH 只需少量外围器件即可形成完整解决方案。

蜂鸟L系列芯片通用开发板

蜂鸟L系列芯片通用开发板板

蜂鸟L系列芯片主要特性：

配置

规格

蜂鸟L系列芯片

高速SRAM

1MB FLASH(US513U61)
512KB FLASH(US513U6)

mic数量

1

UART通信接口

2

LED接口

有

音频接口

I2S, ADC, DAC

控制接口

UART, GPIO, I2C, SPI, PWM 等

2. 软件功能

序号 | 功能 | 功能描述
1 | 单麦拾音 | · 单麦克风方案 · 支持家居场景3~5m远讲
2 | 语音唤醒 | · 高性能唤醒引擎 · 低功耗 · 支持带口音的普通话 · 低误唤醒率 (< 1 false in 24 hours)
3 | 离线识别 | · 支持本地50条控制指令识别
4 | 多轮对话 | 一次唤醒连续对话，语音操作更加便捷自然。
5 | 多种发音人音色 | · 提供标准女声、甜美女声、可爱女声、台湾女声、标准男声、女童声、男童声七种音色可选 · 提供标准蜂鸣器支持
6 | UART主板对接 | 云知声提供标准UART协议，也支持对接用户自有协议
7 | 智能设备平台 | 云知声设备平台提供：唤醒词自定义，命令词自定义，回复播报语自定义，个性化声学模型，发音人音色选择等产品自定义配置


蜂鸟L系列离线方案开发指导手册: 3、获取源码

3、获取源码

1. 前期准备

1.1 账号创建

• 进入云知声开放平台：http://dev.hivoice.cn/

• 点击右上角的 登陆/注册，弹出如下窗口：

• 如无账号，请点击 去注册；

• 注册方式有“手机账号注册”、“邮箱账号注册”两种方式

• 如已有云知声开发账号请忽略本步骤；

• 选择邮箱账号注册需点击激活邮件后才能正常登陆

1.2 完善资料

注册成功后，为确保账号可用，请登陆云知声账号；

登陆后，点击右上角的 完善资料，输入相关必填信息。

1.3 开通权限

1. 联系云知声商务，申请开通云知声智能设备平台权限，获取离线标准开发板；

2. 开通权限后，产品控制台入口可见，在控制台-产品接入下。

2. 配置并生成产品版本

2.1 创建产品

（1）用户登陆云知声开放平台（http://dev.hivoice.cn/），点击导航栏中的 控制台，点击 产品接入 进入产品接入控制台。

（2）进入产品控制台后，点击 创建产品。

（3）云知声智能设备平台提供不同场景，用以定制不同语音产品形态，此处选择智能家居（纯离线）

（4）选择系统与芯片平台，选择 蜂鸟L芯片 或 蜂鸟L-Pro芯片

该页面点击芯片旁的？按钮，可以获取芯片产品手册。

选择设备类型：

1） 选择具体产品，云知声针对细分的终端产品类型进行了初始功能定义，提供了更准确的语音识别性能与预置的控制指令。

联系商务，获取具体产品方案权限。

2） 选择通用，根据开发者需求，自主合成终端产品能力 ，覆盖的使用场景更加广泛。

（5）填写产品信息，包括名称与描述

（6）确认所选项无问题，点击 保存且下一步，即初步创建产品成功

2.2 产品版本开发

2.2.1 创建产品版本

（1）创建产品版本，填写版本号及版本信息，点击下一步

• 产品创建成功后，系统会自动为该产品分配Appkey与AppSecret，此为该产品唯一识别ID和密匙

• 一个产品可维护多个版本，可通过版本号与版本描述来区分

2.2.2 配置终端能力

（1） 选择前端信号处理方案

蜂鸟L系列芯片通用板支持单麦克风收音，开发者针对不同的使用场景，选择识别距离，实现对声音信号的处理方式，提升识别结果的准确率。

（2）PIN脚配置

蜂鸟L系列芯片支持无代码实现芯片引脚配置，通过参数配置自定义GPIO、PWM、UART等端口的输出信号，直接控制外围电路。

（3）自定义产品唤醒词，以及唤醒回复语

• 支持3-6个字的唤醒词自定义配置，最多支持5组唤醒词的添加；

• 为保证语音产品有最佳唤醒体验，平台针对唤醒词的发音提供打分功能，并会提供具体指导信息；

• 涉及黄赌毒、政治敏感、低俗辱骂等不合规内容的唤醒词不可使用；

• 完整唤醒词定义规则可点击界面上《唤醒词自定义规则》；

• 支持按照产品使用场景自定义唤醒灵敏度；

• 自定义设置唤醒回复语，唤醒回复最多支持3条，设置后将随机播报。（需使用外挂flash存储）

（4）按照规则填写命令词与应答语（自定义应答语需使用外挂flash存储）

如下图所示，点击“如何自定义”为语法格式说明与规则介绍；

点击“点这里添加”则弹出输入框，可以在页面内直接输入命令词与应答语的定义；

如不满足语法格式要求平台则会进行实时提示。输入完成后选择命令词识别灵敏度，点击“确定”即可提交。

提交后仍可对词表基础信息进行编辑；

点击“控制详情”切换TAB，将控制行为与引脚输出信号进行对应，实现对控制指令的信号输出的配置。

语法格式说明与规则介绍

为方便产品构建，平台定义了一套语法格式，语法格式组成为：

action=命令词1|命令词2...@回复语

举例：TempSet15=设置十五度|十五度@已设为十五度

action 为一个控制指令的唯一标识，用户对着设备说出“设置十五度”“十五度”并被语义理解时，如已对接设备，语义理解模块会将TempSet15传给设备。

命令词 为想要定义的语音话术，用户必须按照定义的话术说出才有效。如用户可以使用“设置十五度”“十五度”来实现同一个设置温度15度的控制。

回复语 为针对该条控制指令的设备回复播报。（自定义回复语需使用外挂flash存储）

action、命令词、回复语均由用户定义。等号前的action为唯一值；等号后的命令词可输入多个，以 | 符号分割；@后为回复语，每个控制指令可以定义对应的回复。

点击语法格式后的 问号，可看到语法格式要求：

Ø action由英文、下划线“_”和数字组成，必须英文开头，不区分大小写，15个字符内

Ø 命令词最多支持150条，每条限 2 - 10 个字符，仅支持中文

Ø 一个action仅支持一条回复语，回复语总字数不得超过500个字符，支持中文、数字、逗号、句号、问号

点击语法句式后的 问号，可以看到针对回复播报特殊读音的标签使用说明：

Ø <py>：需要对单个汉字的发音进行纠正的场合。

注：拼音声调范围为 1 - 5，1 - 4 对应一声到四声，5对应轻声。

例：已调<py>tiao2</py>至中<py>zhong1</py>风档

播报为：已调(tiao2)至中(zhong1)风档

Ø <value>：需要将数字按照数值读法播报

例：已设为<value>15</value>度

播报为：已设为十五度

Ø <code>：需要将数字按照数字串逐位播报

例：已设为<code>15</code>度

播报为：已设为一五度

开发者注意：

1. 产品默认支持音量大小调节，音量调节控制默认句式如下：

 volumeUpUni=增大音量

 volumeDownUni=减小音量

如需自定义音量与主动退出的控制话术与应答播报，可在语法文件内添加以上控制句式，只需保持=号前的action不变，修改=后的内容即可。

举例如下：

volumeUpUni=大声一点|调大声点@已为您调高音量

exitUni=拜拜|再见@好的，那我先退下了

2. 产品内置音量等级三档控制逻辑，默认不开启。如需使用该逻辑，可在定义离线命令词与播报语处，添加词条后生效：

 最大音量 volumeMaxUni

 中等音量 volumeMidUni

 最小音量 volumeMinUni

如希望添加最大音量调节，可参考下方举例添加句式：

volumeMaxUni=最大音量|音量调到最大@已调至最大音量

3. 用户可以在离线命令词自定义部分，指定特定的action，定义非语音交互的应答语播报，用于非正常语音交互的情景。

开发者需从指定文件夹获取此部分定制的语音音频文件，并根据产品定义修改源码。可参见文内 5.3 播报逻辑开发。

格式如下：

Special_Replies@回复语1|回复语2|回复语3

如警报播报：以智能烧水壶为例，产品内传感器检测到缺水状态，自动语音警报；

如极限播报：空调指令“升高温度”，正常播报为“温度已升高”；当温度到上限时，播报“温度已调至最高”。

举例如下：

Special_Replies@内丹干烧|水壶缺水|没水啦|主人请加水

4. 用户可以在离线命令词自定义部分，指定特定的竞争词（可理解为无效命令词），防止一定概率的误识别。

格式如下：

Special_Gabages=命令词1|命令词2|命令词3|...

以空调产品为例，并没有高于32度的温控指令，用户说出“三十六度”时，不希望空调识别到“十六度”；
以空调产品为例，没有自动风的指令，当用户说说出“自动风”时，不希望空调识别到“自然风”（如果阈值设置较低）。

举例如下：

举例：Special_Gabages=三十六度|四十六度|五十六度|六十六度

（5）选择语音识别模型

蜂鸟L芯片方案支持对声学模型进行选择，默认为云知声针对蜂鸟L芯片定制的经过算法优化的通用声学模型。

如当前系统默认的声学模型性能无法满足用户需求时（注：此处用户需求，指经过语音性能量化测试的明确指标），可以使用云知声模型训练平台，采集特定离线命令词的语音训练数据并进行模型定制。

（6）针对产品定位，选择适合产品形态的发音人

• 活泼可爱的萱萱和KiYo，童真童趣的糖糖和天天，温柔可亲的玲玲，庄重严肃的小雯与小峰，七种音色可供选择；

• 可调节音量、语速与声音亮度；

• 提供在线试听，方便用户进行决策；

• 根据产品定位，亦可选择蜂鸣器实现提醒功能；

（7）其它配置

1) 开机音配置（开机音需使用外挂flash存储）

系统自带默认开机铃声，可在页面点击试听。

如需进行开机欢迎语的自定义，也可以选择自定义内容，产品则会在开机后自动进行播报，欢迎语播报自定义限中文，可输入30个字符；也可选择不使用开机音。

2) 识别状态退出相关配置

语音产品为保证用户体验，唤醒后一段时间内无语音输入产品会主动退出识别状态，如需输入命令词，则需再次唤醒。

此段等待用户输入语音命令的有效时间，即为“唤醒超时退出时间”。

• 为确保产品有较好的用户体验，支持5s – 60s的超时退出时间设置，默认为10秒

• 超时退出回复最多可设置2条（回复音需使用外挂flash存储）

当用户想要结束对话时，也可以主动要求退出识别状态。

• 默认退出命令为“退下”“再见”，可根据产品定义修改，最多可设置3条

• 主动退出回复最多可设置2条（回复音需使用外挂flash存储）

如配置完成，则可点击下一步，进入版本发布页面。

2.2.3 下载版本

（1）产品配置开发完成，进入发布页面后，可点击 立即发布

（2）产品发布需要一定时间，可以有两种方法获取到发布成功的产品

• 发布界面下，版本发布成功后，会有下载提示

• 也可以直接返回产品详情，或关闭页面一段时间再进入智能设备平台的产品详情，页面中的版本列表处点击下载

2.3 产品版本维护

产品详情页面可以查看已创建的产品，可以查看每个版本的配置信息，也可以对已发布成功的版本进行下载或者删除操作

2.3.1 新版本迭代

同一个产品如有新需求的修改或迭代，可在产品详情页面点击产品方案的“编辑” +开发新版本，后续的操作步骤同创建产品版本时的流程一致。

提供选择任一历史版本进行迭代开发的选项，默认为基于最新修改的版本，也可根据需求进行其它版本的选择。


蜂鸟L系列离线方案开发指导手册: 4、烧录固件

4、烧录固件

1. 文件介绍

• 产品的软件烧录包下载成功后，解压文件，可以看到如下方文件目录

• 如想直接使用，体验语音功能，请打开“image_demo/Hummingbird-L-Production-Tool”文件夹，双击“UnisoundDownloader”，运行烧录工具

• 烧录工具配置界面如下图所示：

2. 烧录指南

详见#1所示说明文档《L_Download_Tool_User_Guide.pdf》

2.1 烧录前介绍

开始烧录之前，需要准备：

- Micro USB连接线，用于供电

- usb to ttl转接器，用于烧录

- 蜂鸟L系列开发板

- 固件包

蜂鸟L开发板烧录接线示例图

2.2 烧录步骤

1. 打开下载工具UnisoundDownloader，端口列表中会列出所有检测到的端口号。

a. 选择待升级的usb-ttl转接器对应的端口号（如有需要，可多选）。

b. 选择下载模式：SIP-NOR-FLASH为片内flash空间，烧录固件时使用此模式；EXT-SPI-NOR-FLASH为外挂flash空间，一般用来存放额外的用户数据，如音频文件等（选择EXT-SPI-NOR-FLASH时请确认外挂flash的型号是否在支持列表中）。

c. 选择合适的串口波特率（影响烧录的稳定性和耗时，默认1500000）。

d. 点击【选择镜像】后的按钮，选择待烧录的文件路径（默认为当前路径bin目录下uni_app.bin）。

2. 点击【开始烧录】，状态栏会显示“等待设备上电”。

3. 此时给蜂鸟L系列开发板上电，状态栏开始更新烧录进度。

4. 烧录完成，状态栏绿色底色显示“下载成功”。


蜂鸟L系列离线方案开发指导手册: 5、搭建开发环境

5、搭建开发环境

1 环境准备

（1）下载编译工具

推荐使用Ubuntu 16.04 / centos7以上版本作为开发环境。

交叉编译工具下载地址：链接：https://pan.baidu.com/s/1yzgtd1XipZTJaC6gk6I1IA

提取码：1nyi

下载交叉编译工具并解压到开发环境“/opt”路径中，或其他路径，然后修改Makefile文件中配置选项：

（2）已下载的版本里除了可直接烧录使用的image_demo外，文件夹内包含产品方案源码，如下图所示：

（3）修改Makefile中交叉工具链的路径为实际解压到的工具路径；

（4）安装python环境：sudo apt-get install python
（5）安装lame音频处理工具：sudo apt-get install lame

（6）安装32位兼容库（如果系统未安装过）：sudo apt-get install lib32stdc++6 lib32z1 lib32ncurses5 lib32bz2-1.0（仅适用于Ubuntu 16.04版本，其他版本请根据系统说明解决兼容性问题）

2 编译

(1) 执行编译

执行./build，编译成功会看到如下信息：

(2) “output”目录下可以看到编译生成的完整固件，使用章节3中的下载工具即可进行烧录使用：


蜂鸟L系列离线方案开发指导手册: 6、软件架构

6、软件架构

1.软件架构

蜂鸟L系列芯片源码框架采用分层设计，各个层次完成特定的功能封装，基本框架结构如下图所示：

各个层次功能描述如下：

ü HAL层：提供pmu、uart、buzzer、i2c、gpio等外设驱动统一接口；

ü BASE层：提供精简libc、npu实现；

ü LVP层：提供核心功能，如：语音识别、音频播放、应用调度等；

ü APP层：语音识别基础业务功能实现，其核心由挂载于app core上的app实例根据LVP层上报的事件进行语音识别、播报业务的逻辑处理。

2.源码目录结构

源码各个文件功能如下所示：

一般情况下，开发者仅需改动app层即可实现大部分的需求。


蜂鸟L系列离线方案开发指导手册: 7、二次开发

7、二次开发

1.运行一个Demo

平台下载源码根目录执行./build即可生成可使用的demo固件，烧录入开发板后即可体验完整功能

2.串口LOG调试

由于芯片本身只有2个硬件uart，且一路uart与DAC播放复用，因此外设通讯、log打印、DAC播放这三个功能同时仅可选择两个，请在需要log调试时进行下pin脚功能的确认，以免互相影响。

Log打印默认使用uart1，连接PC后使用常见串口工具（如putty、xshell、secureCRT等），配置波特率 (115200bps)、数据位 (8)、停止位 (1)、校验 (None)即可。

TX连接串口调试器RX，RX连接串口调试器TX，GND连接GND接口，设备上电后，可在串口工具中观察到如下启动信息：

3.调整指令阈值

用户自定义离线控制指令，修改后的指令会使用默认的阈值，出现响应难或者误响应率偏高的问题。蜂鸟芯片支持方案阈值的自主计算，用户在使用某个指令时，可以根据自己项目的要求进行调整。

4.编译特殊版本

4.1 编译uart录音调试版本

源码根目录下执行：./build record

可用专门的工具通过PIN6、PIN7的UART实现录音，会带来额外的内存开销，谨慎使用。

4.2 编译烧录外置flash播放版本

1）修改源码根目录/include/autoconfig.h文件，打开CONFIG_HW_EXT_FLASH宏定义重新编译，生成支持外置flash的uni_app.bin固件。

2）用烧录工具的”SIP-NOR-FLASH“模式烧录output/uni_app.bin

3）用烧录工具的“EXT-SPI-NOR-FLASH“模式烧录tools/scripts/ext_flash_pcm.bin


蜂鸟L系列离线方案开发指导手册: 模块

模块
这里列出了所有模块:
GPIO |
I2C |
PINMUX |
TIMER |
UART |
WATCHDOG | 看门狗实际可配时间(ms): 1048 2097 4194 8388 16772，接口会自动配置为不小于入参的最近时间。


蜂鸟L系列离线方案开发指导手册: GPIO

类型定义 | 枚举 | 枚举值 | 函数
GPIO

类型定义

typedef int(* GPIO_CALLBACK) (int port, void *pdata)

枚举

enum | UNI_GPIO_DIRECTION { UNI_GPIO_DIRECTION_INPUT = 0, UNI_GPIO_DIRECTION_OUTPUT, UNI_GPIO_DIRECTION_HIZ }
gpio输入输出方向 更多...
enum | UNI_GPIO_LEVEL { UNI_GPIO_LEVEL_LOW = 0, UNI_GPIO_LEVEL_HIGH }
gpio 电平状态 更多...
enum UNI_GPIO_TRIGGER_EDGE {
UNI_GPIO_TRIGGER_EDGE_FALLING = 0x01, UNI_GPIO_TRIGGER_EDGE_RISING = 0x02, UNI_GPIO_TRIGGER_EDGE_BOTH = 0x03, UNI_GPIO_TRIGGER_LEVEL_HIGH = 0x04,
UNI_GPIO_TRIGGER_LEVEL_LOW = 0x08
}
gpio中断触发方式 更多...

函数

UNI_GPIO_DIRECTION | uni_gpio_get_direction (unsigned int port)
获取GPIO输入输出方向 更多...
int | uni_gpio_set_direction (unsigned int port, UNI_GPIO_DIRECTION direction)
设置GPIO输入输出方向 更多...
UNI_GPIO_LEVEL | uni_gpio_get_level (unsigned int port)
获取gpio输入电平状态 更多...
int | uni_gpio_set_level (unsigned int port, UNI_GPIO_LEVEL level)
设置gpio输出电平状态 更多...
int | uni_gpio_enable_trigger (unsigned int port, UNI_GPIO_TRIGGER_EDGE edge, GPIO_CALLBACK callback, void *pdata)
gpio 使能中断 更多...
int | uni_gpio_disable_trigger (unsigned int port)
关闭gpio中断使能 更多...
int | uni_gpio_enable_pwm (unsigned int port, unsigned long int period_ns, unsigned long int duty)
gpio 输出pwm 更多...
int | uni_gpio_disable_pwm (unsigned int port)
关闭pwm 更多...
int | uni_gpio_clock_test (unsigned int port, unsigned int test_clock)
时钟输出测试 更多...
int | uni_gpio_init (void)
gpio 初始化 更多...
int | uni_gpio_exit (void)
gpio 退出 更多...
int | uni_gpio_suspend (void)
gpio 暂停 更多...
int | uni_gpio_resume (void)
gpio 恢复 更多...

详细描述

枚举类型说明

◆ UNI_GPIO_DIRECTION

enum UNI_GPIO_DIRECTION
枚举值
UNI_GPIO_DIRECTION_INPUT | 输入
UNI_GPIO_DIRECTION_OUTPUT | 输出
UNI_GPIO_DIRECTION_HIZ | 高阻态

◆ UNI_GPIO_LEVEL

enum UNI_GPIO_LEVEL
枚举值
UNI_GPIO_LEVEL_LOW | 低电平
UNI_GPIO_LEVEL_HIGH | 高电平

◆ UNI_GPIO_TRIGGER_EDGE

enum UNI_GPIO_TRIGGER_EDGE
枚举值
UNI_GPIO_TRIGGER_EDGE_FALLING | 下降沿触发
UNI_GPIO_TRIGGER_EDGE_RISING | 上升沿触发
UNI_GPIO_TRIGGER_EDGE_BOTH | 降沿上升同时沿触发
UNI_GPIO_TRIGGER_LEVEL_HIGH | 高电平触发
UNI_GPIO_TRIGGER_LEVEL_LOW | 低电平触发

函数说明

◆ uni_gpio_clock_test()

int uni_gpio_clock_test | ( | unsigned int | port,
 |  | unsigned int | test_clock
 | ) |  |
参数
port | 时钟输出的gpio端口
test_clock | 需要测试的时钟
返回
int 设置是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_gpio_disable_pwm()

int uni_gpio_disable_pwm ( unsigned int port )
参数
port gpio端口
返回
int 关闭pwm使能是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_gpio_disable_trigger()

int uni_gpio_disable_trigger ( unsigned int port )
参数
port gpio端口
返回
int 关闭gpio中断使能是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_gpio_enable_pwm()

int uni_gpio_enable_pwm | ( | unsigned int | port,
 |  | unsigned long int | period_ns,
 |  | unsigned long int | duty
 | ) |  |
参数
port | gpio端口
period_ns | pwm周期(ns)
duty | pwm占空比(duty%)
返回
int pwm使能是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_gpio_enable_trigger()

int uni_gpio_enable_trigger | ( | unsigned int | port,
 |  | UNI_GPIO_TRIGGER_EDGE | edge,
 |  | GPIO_CALLBACK | callback,
 |  | void * | pdata
 | ) |  |
参数
port | gpio端口
edge | 触发方式
callback | 中断回调函数
pdata | 中断回调参数
返回
int gpio中断使能是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_gpio_exit()

int uni_gpio_exit ( void )
返回
int 退出是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_gpio_get_direction()

UNI_GPIO_DIRECTION uni_gpio_get_direction ( unsigned int port )
参数
port gpio端口
返回
gpio 输入还是输出
返回值
UNI_GPIO_DIRECTION_INPUT | 输入
UNI_GPIO_DIRECTION_OUTPUT | 输出
UNI_GPIO_DIRECTION_HIZ | 高阻态

◆ uni_gpio_get_level()

UNI_GPIO_LEVEL uni_gpio_get_level ( unsigned int port )
参数
port gpio端口
返回
UNI_GPIO_LEVEL gpio输入电平状态
返回值
UNI_GPIO_LEVEL_LOW | 低电平
UNI_GPIO_LEVEL_HIGH | 高电平

◆ uni_gpio_init()

int uni_gpio_init ( void )
返回
int 初始化是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_gpio_resume()

int uni_gpio_resume ( void )
返回
int 恢复是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_gpio_set_direction()

int uni_gpio_set_direction | ( | unsigned int | port,
 |  | UNI_GPIO_DIRECTION | direction
 | ) |  |
参数
port | gpio端口
direction | gpio输入输出方向
返回
int 设置是否成功
返回值
0 | 设置成功
-1 | 设置失败

◆ uni_gpio_set_level()

int uni_gpio_set_level | ( | unsigned int | port,
 |  | UNI_GPIO_LEVEL | level
 | ) |  |
参数
port | gpio端口
level | 输出电平状态 UNI_GPIO_LEVEL_LOW 低电平 UNI_GPIO_LEVEL_HIGH 高电平
返回
int 设置是否成功
返回值
0 | 设置成功
-1 | 设置失败

◆ uni_gpio_suspend()

int uni_gpio_suspend ( void )
返回
int 暂停是否成功
返回值
0 | 成功
-1 | 失败


蜂鸟L系列离线方案开发指导手册: I2C

结构体 | 宏定义 | 类型定义 | 枚举 | 枚举值 | 函数 | 变量
I2C

结构体

struct uni_i2c_msg
i2c消息 更多...

宏定义

#define | I2C_STATIC_MAX_COUNT (100)
#define | I2C_M_RD 0x0001
读取slave标志
#define | I2C_M_START_BYTE 0x0002
START byte标志
#define | I2C_M_GENERAL_CALL 0x0004
General call标志
#define | I2C_M_TEN 0x0010
10bit slave地址标志
#define | I2C_M_RECV_LEN 0x0400
第一byte为长度标志
#define | I2C_M_NO_RD_ACK 0x0800
读取操作不产生ACK标志
#define | I2C_M_IGNORE_NAK 0x1000
忽略NACK标志
#define | I2C_M_REV_DIR_ADDR 0x2000
读写切换标志
#define | I2C_M_NOSTART 0x4000
no start标志

类型定义

typedef enum uni_i2c_slave_event | UNI_I2C_SLAVE_EVENT
i2c slave事件
typedef struct uni_i2c_msg | UNI_I2C_MSG
i2c消息
typedef int(* | uni_i2c_slave_cb_t) (UNI_I2C_SLAVE_EVENT event, unsigned char *val, void *private)
i2c slave回调函数 更多...
typedef void(* | uni_i2c_async_done_cb_t) (void *private)
i2c 读写异步回调函数 更多...

枚举

enum uni_i2c_slave_event { I2C_SLAVE_RECEIVE_DATA, I2C_SLAVE_REQUESTED_DATA, I2C_SLAVE_STOP }
i2c slave事件 更多...

函数

int | uni_i2c_init (unsigned char bus_id)
打开i2c模块时钟 更多...
int | uni_i2c_exit (unsigned char bus_id)
关闭i2c模块时钟 更多...
int | uni_i2c_suspend (unsigned char bus_id)
i2c模块进入低功耗 更多...
int | uni_i2c_resume (unsigned char bus_id)
i2c模块退出低功耗 更多...
int | uni_gpio_i2c_init (unsigned char bus_id, unsigned int scl_port, unsigned int sda_port)
初始化gpio i2c master 更多...
void * | uni_i2c_open (unsigned char bus_id)
打开i2c master 更多...
int | uni_i2c_set_speed (unsigned char bus_id, unsigned int speed)
获取i2c master句柄 更多...
int | uni_i2c_transfer (void *dev, UNI_I2C_MSG *msgs, int num)
处理i2c消息 更多...
int | uni_i2c_write (unsigned char bus_id, unsigned char slv_addr, unsigned char *buf, unsigned short len)
i2c发送数据 更多...
int | uni_i2c_tx (unsigned char bus_id, unsigned char slv_addr, unsigned int reg_address, unsigned char address_width, unsigned char *tx_data, unsigned short len)
i2c发送数据 更多...
int | uni_i2c_async_write (unsigned char bus_id, unsigned char slv_addr, unsigned char *buf, unsigned short len, uni_i2c_async_done_cb_t callback, void *private)
i2c异步发送数据 更多...
int | uni_i2c_async_tx (unsigned char bus_id, unsigned char slv_addr, unsigned int reg_address, unsigned char address_width, unsigned char *tx_data, unsigned short len, uni_i2c_async_done_cb_t callback, void *private)
i2c异步发送数据 更多...
int | uni_i2c_read (unsigned char bus_id, unsigned char slv_addr, unsigned char *buf, unsigned short len)
i2c读取数据 更多...
int | uni_i2c_rx (unsigned char bus_id, unsigned char slv_addr, unsigned int reg_address, unsigned char address_width, unsigned char *rx_data, unsigned short len)
i2c读取数据 更多...
int | uni_i2c_async_read (unsigned char bus_id, unsigned char slv_addr, unsigned char *buf, unsigned short len, uni_i2c_async_done_cb_t callback, void *private)
i2c异步读取数据 更多...
int | uni_i2c_async_rx (unsigned char bus_id, unsigned char slv_addr, unsigned int reg_address, unsigned char address_width, unsigned char *rx_data, unsigned short len, uni_i2c_async_done_cb_t callback, void *private)
i2c异步读取数据 更多...
int | uni_i2c_close (void *dev)
关闭i2c master 更多...
void * | uni_i2c_slave_open (unsigned char bus_id, unsigned char slv_addr, uni_i2c_slave_cb_t callback, void *private)
打开i2c slave 更多...
int | uni_i2c_slave_close (void *dev)
关闭i2c slave 更多...

变量

unsigned short | uni_i2c_msg::addr
i2c slave地址
unsigned short | uni_i2c_msg::flags
消息标志
unsigned short | uni_i2c_msg::len
消息长度
unsigned char * | uni_i2c_msg::buf
消息内容

详细描述

类型定义说明

◆ uni_i2c_async_done_cb_t

typedef void(* uni_i2c_async_done_cb_t) (void *private)
参数
private 私有参数
返回值
无

◆ uni_i2c_slave_cb_t

typedef int(* uni_i2c_slave_cb_t) (UNI_I2C_SLAVE_EVENT event, unsigned char *val, void *private)
参数
event | i2c slave事件
val | 读取或传输的值
private | 私有参数
返回值
0 | 成功
-1 | 失败

枚举类型说明

◆ uni_i2c_slave_event

enum uni_i2c_slave_event
枚举值
I2C_SLAVE_RECEIVE_DATA | i2c slave接收数据
I2C_SLAVE_REQUESTED_DATA | i2c slave发送数据
I2C_SLAVE_STOP | i2c slave关闭

函数说明

◆ uni_gpio_i2c_init()

int uni_gpio_i2c_init | ( | unsigned char | bus_id,
 |  | unsigned int | scl_port,
 |  | unsigned int | sda_port
 | ) |  |
参数
bus_id | i2c总线id
scl_port | scl线对应的gpio
sda_port | sda线对应的gpio
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_async_read()

int uni_i2c_async_read | ( | unsigned char | bus_id,
 |  | unsigned char | slv_addr,
 |  | unsigned char * | buf,
 |  | unsigned short | len,
 |  | uni_i2c_async_done_cb_t | callback,
 |  | void * | private
 | ) |  |
参数
bus_id | i2c总线id
slv_addr | i2c slave地址
buf | 读取的数据
len | 读取数据长度
callback | 完成时回调函数
private | 回调函数参数
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_async_rx()

int uni_i2c_async_rx | ( | unsigned char | bus_id,
 |  | unsigned char | slv_addr,
 |  | unsigned int | reg_address,
 |  | unsigned char | address_width,
 |  | unsigned char * | rx_data,
 |  | unsigned short | len,
 |  | uni_i2c_async_done_cb_t | callback,
 |  | void * | private
 | ) |  |
参数
bus_id | i2c总线id
slv_addr | i2c slave地址
reg_address | i2c slave寄存器地址
address_width | i2c slave寄存器地址宽度
rx_data | 读取的数据
len | 读取数据长度
callback | 完成时回调函数
private | 回调函数参数
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_async_tx()

int uni_i2c_async_tx | ( | unsigned char | bus_id,
 |  | unsigned char | slv_addr,
 |  | unsigned int | reg_address,
 |  | unsigned char | address_width,
 |  | unsigned char * | tx_data,
 |  | unsigned short | len,
 |  | uni_i2c_async_done_cb_t | callback,
 |  | void * | private
 | ) |  |
参数
bus_id | i2c总线id
slv_addr | i2c slave地址
reg_address | i2c slave寄存器地址
address_width | i2c slave寄存器地址宽度
tx_data | 需要发送的数据
len | 发送数据长度
callback | 完成时回调函数
private | 回调函数参数
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_async_write()

int uni_i2c_async_write | ( | unsigned char | bus_id,
 |  | unsigned char | slv_addr,
 |  | unsigned char * | buf,
 |  | unsigned short | len,
 |  | uni_i2c_async_done_cb_t | callback,
 |  | void * | private
 | ) |  |
参数
bus_id | i2c总线id
slv_addr | i2c slave地址
buf | 需要发送的数据
len | 发送数据长度
callback | 完成时回调函数
private | 回调函数参数
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_close()

int uni_i2c_close ( void * dev )
参数
dev i2c master句柄
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_exit()

int uni_i2c_exit ( unsigned char bus_id )
参数
bus_id i2c总线id
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_init()

int uni_i2c_init ( unsigned char bus_id )
参数
bus_id i2c总线id
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_open()

void* uni_i2c_open ( unsigned char bus_id )
参数
bus_id i2c总线id
返回值
NULL | 失败
OTHER | 成功

◆ uni_i2c_read()

int uni_i2c_read | ( | unsigned char | bus_id,
 |  | unsigned char | slv_addr,
 |  | unsigned char * | buf,
 |  | unsigned short | len
 | ) |  |
参数
bus_id | i2c总线id
slv_addr | i2c slave地址
buf | 读取的数据
len | 读取数据长度
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_resume()

int uni_i2c_resume ( unsigned char bus_id )
参数
bus_id i2c总线id
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_rx()

int uni_i2c_rx | ( | unsigned char | bus_id,
 |  | unsigned char | slv_addr,
 |  | unsigned int | reg_address,
 |  | unsigned char | address_width,
 |  | unsigned char * | rx_data,
 |  | unsigned short | len
 | ) |  |
参数
bus_id | i2c总线id
slv_addr | i2c slave地址
reg_address | i2c slave寄存器地址
address_width | i2c slave寄存器地址宽度
rx_data | 读取的数据
len | 读取数据长度
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_set_speed()

int uni_i2c_set_speed | ( | unsigned char | bus_id,
 |  | unsigned int | speed
 | ) |  |
参数
bus_id | i2c总线id
speed | i2c总线速度
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_slave_close()

int uni_i2c_slave_close ( void * dev )
参数
dev i2c slave句柄
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_slave_open()

void* uni_i2c_slave_open | ( | unsigned char | bus_id,
 |  | unsigned char | slv_addr,
 |  | uni_i2c_slave_cb_t | callback,
 |  | void * | private
 | ) |  |
参数
bus_id | i2c总线id
slv_addr | i2c slave地址
callback | i2c slave回调函数
private | 回调函数私有参数
返回值
NULL | 失败
OTHER | 成功

◆ uni_i2c_suspend()

int uni_i2c_suspend ( unsigned char bus_id )
参数
bus_id i2c总线id
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_transfer()

int uni_i2c_transfer | ( | void * | dev,
 |  | UNI_I2C_MSG * | msgs,
 |  | int | num
 | ) |  |
参数
dev | i2c master句柄
msgs | 需要发送的消息
num | 消息数量
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_tx()

int uni_i2c_tx | ( | unsigned char | bus_id,
 |  | unsigned char | slv_addr,
 |  | unsigned int | reg_address,
 |  | unsigned char | address_width,
 |  | unsigned char * | tx_data,
 |  | unsigned short | len
 | ) |  |
参数
bus_id | i2c总线id
slv_addr | i2c slave地址
reg_address | i2c slave寄存器地址
address_width | i2c slave寄存器地址宽度
tx_data | 需要发送的数据
len | 发送数据长度
返回值
0 | 成功
-1 | 失败

◆ uni_i2c_write()

int uni_i2c_write | ( | unsigned char | bus_id,
 |  | unsigned char | slv_addr,
 |  | unsigned char * | buf,
 |  | unsigned short | len
 | ) |  |
参数
bus_id | i2c总线id
slv_addr | i2c slave地址
buf | 需要发送的数据
len | 发送数据长度
返回值
0 | 成功
-1 | 失败


蜂鸟L系列离线方案开发指导手册: uni_i2c_msg结构体 参考

成员变量
uni_i2c_msg结构体 参考
I2C

i2c消息

#include <uni_i2c.h>

成员变量

unsigned short | addr
i2c slave地址
unsigned short | flags
消息标志
unsigned short | len
消息长度
unsigned char * | buf
消息内容


蜂鸟L系列离线方案开发指导手册: PINMUX

结构体 | 类型定义 | 函数 | 变量
PINMUX

结构体

struct pin_config
管脚复用配置 更多...

类型定义

typedef struct pin_config UNI_PIN_CONFIG
管脚复用配置

函数

int | padmux_set (int pad_id, int function)
配置管脚复用功能 更多...
int | padmux_get (int pad_id)
获取管脚复用功能 更多...
int | padmux_check (int pad_id, int function)
管脚复用功能检查 更多...
int | padmux_init (const UNI_PIN_CONFIG *pin_table, int size)
管脚复用初始化 更多...

变量

unsigned char | pin_config::pin_id
pin 脚号
unsigned char | pin_config::function
复用功能

详细描述

函数说明

◆ padmux_check()

int padmux_check | ( | int | pad_id,
 |  | int | function
 | ) |  |
参数
pad_id | pin 脚号
function | 复用功能
返回
int 检测是否正常
返回值
0 | 正常
-1 | 异常

◆ padmux_get()

int padmux_get ( int pad_id )
参数
pad_id pin 脚号
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ padmux_init()

int padmux_init | ( | const UNI_PIN_CONFIG * | pin_table,
 |  | int | size
 | ) |  |
参数
pin_table | 管脚复用表
size | 管脚复用表大小
返回
int 是否成功
返回值
0 | 正常
-1 | 异常

◆ padmux_set()

int padmux_set | ( | int | pad_id,
 |  | int | function
 | ) |  |
参数
pad_id | pin 脚号
function | 复用功能
返回
int 是否成功
返回值
0 | 成功
-1 | 失败


蜂鸟L系列离线方案开发指导手册: pin_config结构体 参考

成员变量
pin_config结构体 参考
PINMUX

管脚复用配置

#include <uni_padmux.h>

成员变量

unsigned char | pin_id
pin 脚号
unsigned char | function
复用功能


蜂鸟L系列离线方案开发指导手册: TIMER

枚举 | 枚举值 | 函数
TIMER

枚举

enum UNI_TIMER_MODE { UNI_TIMER_MODE_SINGLE, UNI_TIMER_MODE_CONTINUE }
定时器模式 更多...

函数

unsigned long long | uni_get_time_us (void)
获取当前时间(us) 更多...
unsigned int | uni_get_time_ms (void)
获取当前时间(ms) 更多...
unsigned int | uni_get_timer (unsigned int base)
基于某一时间，获取相对时间 更多...
int | uni_timer_register (int(*fun)(void *), int timeout_ms, void *priv, UNI_TIMER_MODE mode)
注册一个软定时器 更多...
int | uni_timer_unregister (int timer_id)
注销软定时器 更多...
int | uni_timer_reset_time (int timer_id, int timeout_ms)
重置软定时器初始时间 更多...

详细描述

枚举类型说明

◆ UNI_TIMER_MODE

enum UNI_TIMER_MODE
枚举值
UNI_TIMER_MODE_SINGLE | 单次模式
UNI_TIMER_MODE_CONTINUE | 连续模式

函数说明

◆ uni_get_time_ms()

unsigned int uni_get_time_ms ( void )
返回
unsigned int 当前时间

◆ uni_get_time_us()

unsigned long long uni_get_time_us ( void )
返回
unsigned long long 当前时间

◆ uni_get_timer()

unsigned int uni_get_timer ( unsigned int base )
参数
base 时间基值
返回
unsigned int 相对时间

◆ uni_timer_register()

int uni_timer_register | ( | int(*)(void *) | fun,
 |  | int | timeout_ms,
 |  | void * | priv,
 |  | UNI_TIMER_MODE | mode
 | ) |  |
参数
fun | 定时回调
timeout_ms | 定时时间
priv | 回调参数
mode | 定时器模式
返回值
-1 | 成功
timer_id | 软定时器id

◆ uni_timer_reset_time()

int uni_timer_reset_time | ( | int | timer_id,
 |  | int | timeout_ms
 | ) |  |
参数
timer_id | 软定时器id
timeout_ms | 定时时间
返回值
重置是否成功

◆ uni_timer_unregister()

int uni_timer_unregister ( int timer_id )
参数
timer_id 软定时器id
返回值
注销是否成功


蜂鸟L系列离线方案开发指导手册: UART

宏定义 | 类型定义 | 枚举 | 枚举值 | 函数
UART

宏定义

#define | UNI_UART_PORT0 0
#define | UNI_UART_PORT1 1

类型定义

typedef int(* | UART_CAN_SEND_CALLBACK) (int port, int length, void *priv)
typedef int(* | UART_CAN_RECV_CALLBACK) (int port, int length, void *priv)
typedef int(* | UART_SEND_DONE_CALLBACK) (int port, void *priv)
typedef int(* | UART_RECV_DONE_CALLBACK) (int port, void *priv)

枚举

enum | UNI_UART_FIFO_SEND_THRESHOLD { UNI_UART_FIFO_SEND_THRESHOLD_EMPTY, UNI_UART_FIFO_SEND_THRESHOLD_2, UNI_UART_FIFO_SEND_THRESHOLD_QUARTER, UNI_UART_FIFO_SEND_THRESHOLD_HALF }
串口发送 fifo 门限值 更多...
enum | UNI_UART_FIFO_RECV_THRESHOLD { UNI_UART_FIFO_RECV_THRESHOLD_ONE_BYTE, UNI_UART_FIFO_RECV_THRESHOLD_QUARTER, UNI_UART_FIFO_RECV_THRESHOLD_HALF, UNI_UART_FIFO_RECV_THRESHOLD_FULL }
串口接收 fifo 门限值 更多...

函数

int | uni_uart_init (int port, uint32_t baudrate)
串口初始化 更多...
int | uni_uart_exit (int port)
串口退出 更多...
void | uni_uart_putc (int port, int ch)
输出一个字符 更多...
void | uni_uart_compatible_putc (int port, int ch)
输出一个字符, 如果是换行,转换成回车输出 更多...
void | uni_uart_empty_fifo (int port)
清空串口 fifo 更多...
int | uni_uart_getc (int port)
获取一个字符 更多...
int | uni_uart_try_getc (int port, char *c)
尝试获取一个字符，如果没有获取到字符，立马返回 更多...
int | uni_uart_can_read (int port)
判断 fifo 中是否有数据 更多...
int | uni_uart_read (int port, unsigned char *buf, int len)
同步读取指定长度的数据 更多...
int | uni_uart_read_non_block (int port, unsigned char *buf, int len, unsigned int timeout_ms)
非阻塞试读取指定长度的数据 更多...
int | uni_uart_write (int port, const unsigned char *buf, int len)
同步写指定长度的数据 更多...
int | uni_uart_suspend (int port)
串口暂停 更多...
int | uni_uart_resume (int port)
串口恢复 更多...
int | uni_uart_set_send_fifo_threshold (int port, UNI_UART_FIFO_SEND_THRESHOLD threshold)
设置串口发送 fifo 中断触发门限 更多...
int | uni_uart_set_recv_fifo_threshold (int port, UNI_UART_FIFO_RECV_THRESHOLD threshold)
设置接收 fio 中断触发门限 更多...
void | uni_uart_flush_send_fifo (int port)
清空发送 fifo 更多...
void | uni_uart_flush_recv_fifo (int port)
清空接收 fifo 更多...
int | uni_uart_start_async_send (int port, UART_CAN_SEND_CALLBACK callback, void *priv)
开始异步接收串口数据 更多...
int | uni_uart_stop_async_send (int port)
停止异步接收串口数据 更多...
int | uni_uart_start_async_recv (int port, UART_CAN_RECV_CALLBACK callback, void *priv)
开始异步发送串口数据 更多...
int | uni_uart_stop_async_recv (int port)
停止异步发送串口数据 更多...
int | uni_uart_send_buffer (int port, unsigned char *buffer, int length)
发送串口数据， 但是不检查 fifo 是否满， 　　　　和　uni_uart_start_async_send 配合使用 更多...
int | uni_uart_recv_buffer (int port, unsigned char *buffer, int length)
接收串口数据，　但是不检查 fifo 中是否有数据 　　　　和 uni_uart_start_async_recv 函数配合使用 更多...
int | uni_uart_async_send_buffer (int port, unsigned char *buffer, int length, UART_SEND_DONE_CALLBACK callback, void *priv)
异步发送串口数据 更多...
int | uni_uart_async_recv_buffer (int port, unsigned char *buffer, int length, UART_RECV_DONE_CALLBACK callback, void *priv)
异步接收串口数据 更多...
int | uni_uart_async_send_buffer_stop (int port)
停止串口异步发送接口 更多...
int | uni_uart_async_recv_buffer_stop (int port)
停止串口异步接收接口 更多...
int | uni_console_init (int port, uint32_t baudrate)
控制台初始化 更多...
int | uni_console_exit (void)
控制台退出 更多...
void | uni_console_putc (int ch)
从控制台输出一个字符 更多...
void | uni_console_compatible_putc (int ch)
从控制台输出一个字符, 如果是换行,转换成回车输出 更多...
void | uni_console_empty_fifo (void)
清空控制台 fifo
int | uni_console_getc (void)
从控制台获取一个字符 更多...
int | uni_console_try_getc (char *c)
从控制台尝试获取一个字符，如果没有获取到字符，立马返回 更多...
int | uni_console_can_read (void)
判断控制台 fifo 中是否有数据 更多...
int | uni_console_suspend (void)
控制台暂停 更多...
int | uni_console_resume (void)
控制台恢复 更多...

详细描述

枚举类型说明

◆ UNI_UART_FIFO_RECV_THRESHOLD

enum UNI_UART_FIFO_RECV_THRESHOLD
枚举值
UNI_UART_FIFO_RECV_THRESHOLD_ONE_BYTE | 1 byte
UNI_UART_FIFO_RECV_THRESHOLD_QUARTER | 25%
UNI_UART_FIFO_RECV_THRESHOLD_HALF | 50%
UNI_UART_FIFO_RECV_THRESHOLD_FULL | Almost Full

◆ UNI_UART_FIFO_SEND_THRESHOLD

enum UNI_UART_FIFO_SEND_THRESHOLD
枚举值
UNI_UART_FIFO_SEND_THRESHOLD_EMPTY | empty
UNI_UART_FIFO_SEND_THRESHOLD_2 | 2 byte
UNI_UART_FIFO_SEND_THRESHOLD_QUARTER | 25
UNI_UART_FIFO_SEND_THRESHOLD_HALF | 50

函数说明

◆ uni_console_can_read()

int uni_console_can_read ( void )
返回
int 结果
返回值
0 | 没有数据
1 | 有数据

◆ uni_console_compatible_putc()

void uni_console_compatible_putc ( int ch )
参数
ch 要输出的字符

◆ uni_console_exit()

int uni_console_exit ( void )
返回值
0 | 成功
-1 | 失败

◆ uni_console_getc()

int uni_console_getc ( void )
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_console_init()

int uni_console_init | ( | int | port,
 |  | uint32_t | baudrate
 | ) |  |
参数
port | 端口
baudrate | 波特率
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_console_putc()

void uni_console_putc ( int ch )
参数
ch 要输出的字符

◆ uni_console_resume()

int uni_console_resume ( void )
返回值
0 | 成功
-1 | 失败

◆ uni_console_suspend()

int uni_console_suspend ( void )
返回值
0 | 成功
-1 | 失败

◆ uni_console_try_getc()

int uni_console_try_getc ( char * c )
参数
c 获取到的字符
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_async_recv_buffer()

int uni_uart_async_recv_buffer | ( | int | port,
 |  | unsigned char * | buffer,
 |  | int | length,
 |  | UART_RECV_DONE_CALLBACK | callback,
 |  | void * | priv
 | ) |  |
参数
port | 端口
buffer | 接收数据 buffer
length | 接收数据的长度
callback | 数据接收完成回调
priv | 回调参数
返回
int 函数是否执行成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_async_recv_buffer_stop()

int uni_uart_async_recv_buffer_stop ( int port )
参数
port 端口
返回
int 函数是否执行成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_async_send_buffer()

int uni_uart_async_send_buffer | ( | int | port,
 |  | unsigned char * | buffer,
 |  | int | length,
 |  | UART_SEND_DONE_CALLBACK | callback,
 |  | void * | priv
 | ) |  |
参数
port | 端口
buffer | 需要发送的数据
length | 数据长度
callback | 数据发送完成回调
priv | 回调参数
返回
int 函数是否执行成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_async_send_buffer_stop()

int uni_uart_async_send_buffer_stop ( int port )
参数
port 端口
返回
int 函数是否执行成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_can_read()

int uni_uart_can_read ( int port )
参数
port 端口
返回
int 结果
返回值
0 | 没有数据
1 | 有数据

◆ uni_uart_compatible_putc()

void uni_uart_compatible_putc | ( | int | port,
 |  | int | ch
 | ) |  |
参数
port | 端口
ch | 要输出的字符

◆ uni_uart_empty_fifo()

void uni_uart_empty_fifo ( int port )
参数
port 端口

◆ uni_uart_exit()

int uni_uart_exit ( int port )
参数
port 端口
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_flush_recv_fifo()

void uni_uart_flush_recv_fifo ( int port )
参数
port 端口

◆ uni_uart_flush_send_fifo()

void uni_uart_flush_send_fifo ( int port )
参数
port 端口

◆ uni_uart_getc()

int uni_uart_getc ( int port )
参数
port 端口
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_init()

int uni_uart_init | ( | int | port,
 |  | uint32_t | baudrate
 | ) |  |
参数
port | 端口
baudrate | 波特率
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_putc()

void uni_uart_putc | ( | int | port,
 |  | int | ch
 | ) |  |
参数
port | 端口
ch | 要输出的字符

◆ uni_uart_read()

int uni_uart_read | ( | int | port,
 |  | unsigned char * | buf,
 |  | int | len
 | ) |  |
参数
port | 端口
buf | 读取到的数据保存buf
len | 数据长度
返回
int 实际读取到的数据长度

◆ uni_uart_read_non_block()

int uni_uart_read_non_block | ( | int | port,
 |  | unsigned char * | buf,
 |  | int | len,
 |  | unsigned int | timeout_ms
 | ) |  |
参数
port | 端口
buf | 读取到的数据保存buf
len | 数据长度
timeout_ms | 超时时间
返回
int 实际读取到的数据长度

◆ uni_uart_recv_buffer()

int uni_uart_recv_buffer | ( | int | port,
 |  | unsigned char * | buffer,
 |  | int | length
 | ) |  |
参数
port | 端口
buffer | 接收数据 buffer
length | 数据长度
返回
int 实际接收数据长度

◆ uni_uart_resume()

int uni_uart_resume ( int port )
参数
port 端口
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_send_buffer()

int uni_uart_send_buffer | ( | int | port,
 |  | unsigned char * | buffer,
 |  | int | length
 | ) |  |
参数
port | 端口
buffer | 要发送的数据
length | 数据长度
返回
int 实际发送数据长度

◆ uni_uart_set_recv_fifo_threshold()

int uni_uart_set_recv_fifo_threshold | ( | int | port,
 |  | UNI_UART_FIFO_RECV_THRESHOLD | threshold
 | ) |  |
参数
port | 端口
threshold | 门限值
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_set_send_fifo_threshold()

int uni_uart_set_send_fifo_threshold | ( | int | port,
 |  | UNI_UART_FIFO_SEND_THRESHOLD | threshold
 | ) |  |
参数
port | 端口
threshold | 门限值
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_start_async_recv()

int uni_uart_start_async_recv | ( | int | port,
 |  | UART_CAN_RECV_CALLBACK | callback,
 |  | void * | priv
 | ) |  |
参数
port | 端口
callback | 可以发送串口数据回调函数
priv | 回调函数参数
返回
int 函数是否执行成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_start_async_send()

int uni_uart_start_async_send | ( | int | port,
 |  | UART_CAN_SEND_CALLBACK | callback,
 |  | void * | priv
 | ) |  |
参数
port | 端口
callback | 串口有数据可以接收回调函数
priv | 回调函数参数
返回
int 函数是否执行成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_stop_async_recv()

int uni_uart_stop_async_recv ( int port )
参数
port 端口
返回
int 函数是否执行成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_stop_async_send()

int uni_uart_stop_async_send ( int port )
参数
port 端口
返回
int 函数是否执行成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_suspend()

int uni_uart_suspend ( int port )
参数
port 端口
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_try_getc()

int uni_uart_try_getc | ( | int | port,
 |  | char * | c
 | ) |  |
参数
port | 端口
c | 获取到的字符
返回
int 是否成功
返回值
0 | 成功
-1 | 失败

◆ uni_uart_write()

int uni_uart_write | ( | int | port,
 |  | const unsigned char * | buf,
 |  | int | len
 | ) |  |
参数
port | 端口
buf | 需要写出的数据buf
len | 数据长度
返回
int 实际写出数据长度


蜂鸟L系列离线方案开发指导手册: WATCHDOG

函数
WATCHDOG

看门狗实际可配时间(ms): 1048 2097 4194 8388 16772，接口会自动配置为不小于入参的最近时间。 更多...

函数

void | uni_watchdog_init (uint16_t reset_timeout_ms, uint16_t level_timeout_ms, irq_handler_t irq_handler)
看门狗初始化 更多...
void | uni_watchdog_ping (void)
看门狗喂狗
int | uni_reboot (void)
重启 更多...

详细描述

函数说明

◆ uni_reboot()

int uni_reboot ( void )
返回
int 复位函数，不会返回

◆ uni_watchdog_init()

void uni_watchdog_init | ( | uint16_t | reset_timeout_ms,
 |  | uint16_t | level_timeout_ms,
 |  | irq_handler_t | irq_handler
 | ) |  |
参数
reset_timeout_ms | 看门狗复位芯片超时时间（连续两次超时会复位芯片）
level_timeout_ms | 看门狗产生超时时间（小于复位超时时间且设置了回调函数，将不会复位芯片）
irq_handler | 中断服务回调函数


蜂鸟L系列离线方案开发指导手册: 结构体

结构体
这里列出了所有结构体，并附带简要说明:
C buzzer_tone_t | 音调
C osc_current_cycle | 当前参考时钟 cycle
C osc_target_cycle | 目标时钟配置
C osc_trim | TRIM 值
C osc_trim_config | Osc 配置结构体
C pin_config | 管脚复用配置
C pmu_auto_ldo | 自动电压调节
C pmu_ctrl_config | Pmu 配置
C pmu_timing | PMU 时序
C RtcDateTime_s | RTC 日期时间结构体
C UNI_AUDIO_IN_CONFIG | 初始化配置
C UNI_AUDIO_IN_EVAD | Energy vad使能参数
C UNI_AUDIO_IN_EVAD_THRESHOLD | Energy 检测门限参数
C UNI_AUDIO_IN_FFTVAD_CHIPPING | Fftvad中线削波值
C UNI_AUDIO_IN_FFTVAD_STATE | Fftvad状态参数
C UNI_AUDIO_IN_I2S_PARAM | I2S 配置参数
C UNI_AUDIO_IN_INPUT_I2S | I2S/TDM In 配置参数
C UNI_AUDIO_IN_INPUT_PDM | PDM 输入配置
C UNI_AUDIO_IN_INPUT_SADC | SAR ADC 输入配置
C UNI_AUDIO_IN_OUTPUT_I2S | I2s输出配置
C UNI_AUDIO_IN_OUTPUT_LOGFBANK | Logfbank 输出配置
C UNI_AUDIO_IN_OUTPUT_PCM | Pcm 输出配置
C UNI_AUDIO_IN_OUTPUT_SPECTRUM | Frequence spectrum 输出配置
C UNI_AUDIO_OUT_BUFFER | 左右通道的起始地址和通道大小
C UNI_AUDIO_OUT_CALLBACK | 回调函数
C UNI_AUDIO_OUT_FRAME | 播放帧配置
C UNI_AUDIO_OUT_PCM | PCM参数配置
C uni_brc_info_t | Baud rate check 模块检测结果
C UNI_CLOCK_DIV | DIV配置表
C UNI_CLOCK_DTO | DTO配置表
C UNI_CLOCK_PLL | PLL配置表
C UNI_CLOCK_SOURCE_TABLE | 时钟配置表
C UNI_DMA_AHB_CH_CONFIG | Dma 通道配置
C uni_flash_dev | Flash 设备定义
C uni_i2c_msg | I2c消息
C UNI_LED_COLOR | Led颜色
C UNI_PMU_STATE | PMU 外设状态配置位域
C UNI_PMU_TRIM_CFG | 工作时电压trim
C uni_pmu_wakeup_addr | PMU 唤醒启动地址配置
C UNIRTC_AlarmMask_s | RTC 闹钟日期 mask


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/ck20810.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
ck20810.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : ck20810.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __CK20810_H__
25 #define __CK20810_H__
26
27 enum channel_gain {
28 ADC_CHANNEL_GAIN_0DB = 1,
29 ADC_CHANNEL_FADE_6DB,
30 ADC_CHANNEL_GAIN_3DB,
31 ADC_CHANNEL_GAIN_4DB,
32 ADC_CHANNEL_GAIN_5DB,
33 ADC_CHANNEL_GAIN_6DB,
34 ADC_CHANNEL_GAIN_7DB,
35 ADC_CHANNEL_GAIN_8DB,
36 ADC_CHANNEL_GAIN_9DB,
37 ADC_CHANNEL_GAIN_10DB,
38 ADC_CHANNEL_GAIN_11DB,
39 ADC_CHANNEL_GAIN_12DB,
40 ADC_CHANNEL_GAIN_13DB,
41 ADC_CHANNEL_GAIN_14DB,
42 ADC_CHANNEL_GAIN_15DB,
43 ADC_CHANNEL_GAIN_16DB,
44 ADC_CHANNEL_GAIN_17DB,
45 ADC_CHANNEL_GAIN_18DB,
46 ADC_CHANNEL_GAIN_19DB,
47 ADC_CHANNEL_GAIN_20DB,
48 ADC_CHANNEL_GAIN_21DB,
49 ADC_CHANNEL_GAIN_22DB,
50 ADC_CHANNEL_GAIN_23DB,
51 ADC_CHANNEL_GAIN_24DB,
52 ADC_CHANNEL_GAIN_25DB,
53 ADC_CHANNEL_GAIN_26DB,
54 ADC_CHANNEL_GAIN_27DB,
55 ADC_CHANNEL_GAIN_28DB,
56 ADC_CHANNEL_GAIN_29DB,
57 ADC_CHANNEL_GAIN_30DB,
58 ADC_CHANNEL_GAIN_31DB,
59 };
60
61 typedef struct {
62 enum channel_gain channel0;
63 enum channel_gain channel1;
64 enum channel_gain channel2;
65 enum channel_gain channel3;
66 enum channel_gain channel4;
67 enum channel_gain channel5;
68 enum channel_gain channel6;
69 enum channel_gain channel7;
70 } CK20810_CONFIG;
71
72 int ck20810_init(void);
73 int ck20810_deinit(void);
74 int ck20810_config(CK20810_CONFIG *property);
75
76 #endif


蜂鸟L系列离线方案开发指导手册: 结构体索引

结构体索引
b | o | p | r | u
b
pmu_auto_ldo UNI_AUDIO_IN_EVAD_THRESHOLD UNI_AUDIO_IN_OUTPUT_SPECTRUM UNI_DMA_AHB_CH_CONFIG
pmu_ctrl_config UNI_AUDIO_IN_FFTVAD_CHIPPING UNI_AUDIO_OUT_BUFFER uni_flash_dev
buzzer_tone_t pmu_timing UNI_AUDIO_IN_FFTVAD_STATE UNI_AUDIO_OUT_CALLBACK uni_i2c_msg
o
r
UNI_AUDIO_IN_I2S_PARAM UNI_AUDIO_OUT_FRAME UNI_LED_COLOR
UNI_AUDIO_IN_INPUT_I2S UNI_AUDIO_OUT_PCM UNI_PMU_STATE
osc_current_cycle RtcDateTime_s UNI_AUDIO_IN_INPUT_PDM uni_brc_info_t UNI_PMU_TRIM_CFG
osc_target_cycle
u
UNI_AUDIO_IN_INPUT_SADC UNI_CLOCK_DIV uni_pmu_wakeup_addr
osc_trim UNI_AUDIO_IN_OUTPUT_I2S UNI_CLOCK_DTO UNIRTC_AlarmMask_s
osc_trim_config UNI_AUDIO_IN_CONFIG UNI_AUDIO_IN_OUTPUT_LOGFBANK UNI_CLOCK_PLL
p
UNI_AUDIO_IN_EVAD UNI_AUDIO_IN_OUTPUT_PCM UNI_CLOCK_SOURCE_TABLE
pin_config


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/device.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
device.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : device.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24
25 #ifndef __DEVICE_H__
26 #define __DEVICE_H__
27
28 #include <driver/spi.h>
29
30 void device_list_init(void);
31 int spi_register_master(struct spi_master *master);
32 int spi_flash_register_master(struct sflash_master *master);
33
34 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC 目录参考

  • SRC
SRC 目录参考


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/doxygen-master/src/HummingbirdL/input 目录参考

  • src
  • HummingbirdL
  • input
input 目录参考


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/doxygen-master/src/HummingbirdL 目录参考

  • src
  • HummingbirdL
HummingbirdL 目录参考


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_i2s 目录参考

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_i2s
uni_i2s 目录参考


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include 目录参考

  • SRC
  • unione_lite_app_hb_l
  • include
include 目录参考

目录


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l 目录参考

  • SRC
  • unione_lite_app_hb_l
unione_lite_app_hb_l 目录参考


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_clock 目录参考

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_clock
uni_clock 目录参考


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver 目录参考

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
driver 目录参考

目录


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_audio_out 目录参考

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_audio_out
uni_audio_out 目录参考


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_audio_in 目录参考

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_audio_in
uni_audio_in 目录参考


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/doxygen-master/src 目录参考

  • src
src 目录参考


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_analog 目录参考

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_analog
uni_analog 目录参考


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/dma.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
dma.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : dma.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24
25 #ifndef __DMA_H__
26 #define __DMA_H__
27
28 #include <types.h>
29
30 /*
31 * enum dma_direction - dma transfer direction indicator
32 * @DMA_MEM_TO_MEM: Memcpy mode
33 * @DMA_MEM_TO_DEV: From Memory to Device
34 * @DMA_DEV_TO_MEM: From Device to Memory
35 * @DMA_DEV_TO_DEV: From Device to Device
36 */
37 enum dma_direction {
38 DMA_MEM_TO_MEM,
39 DMA_MEM_TO_DEV,
40 DMA_DEV_TO_MEM,
41 DMA_DEV_TO_DEV,
42 };
43
44 #define BIT(n) (1 << n)
45
46 #define DMA_SUPPORTS_MEM_TO_MEM BIT(0)
47 #define DMA_SUPPORTS_MEM_TO_DEV BIT(1)
48 #define DMA_SUPPORTS_DEV_TO_MEM BIT(2)
49 #define DMA_SUPPORTS_DEV_TO_DEV BIT(3)
50 #define DMA_SUPPORTS_SPI BIT(8)
51
52
53 struct dma_ops {
54 int (*transfer)(void *dst, void *src, size_t len, int direction);
55 void* (*dma_addr_get)(void *addr, uint32_t flag);
56 };
57
58 extern struct dma_ops *dma_ops_get(void);
59 extern int dma_memcpy(void *dst, void *src, size_t len);
60 extern int dma_xfer(void *dest,void *src, size_t len, int direction);
61
62
63
64 #endif
65


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/dma_axi.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
dma_axi.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : dma_axi.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
28 #ifndef __DMA_AXI_H__
29 #define __DMA_AXI_H__
30
31 enum {
32 DWAXIDMAC_ARWLEN_1 = 0,
33 DWAXIDMAC_ARWLEN_2 = 1,
34 DWAXIDMAC_ARWLEN_4 = 3,
35 DWAXIDMAC_ARWLEN_8 = 7,
36 DWAXIDMAC_ARWLEN_16 = 15,
37 DWAXIDMAC_ARWLEN_32 = 31,
38 DWAXIDMAC_ARWLEN_64 = 63,
39 DWAXIDMAC_ARWLEN_128 = 127,
40 DWAXIDMAC_ARWLEN_256 = 255,
41 DWAXIDMAC_ARWLEN_MIN = DWAXIDMAC_ARWLEN_1,
42 DWAXIDMAC_ARWLEN_MAX = DWAXIDMAC_ARWLEN_256
43 };
44
45 /* CH_CTL_L */
46 #define CH_CTL_L_LAST_WRITE_EN (DMA_BIT(30))
47
48 #define CH_CTL_L_DST_MSIZE_POS 18
49 #define CH_CTL_L_SRC_MSIZE_POS 14
50 #define CH_CTL_L_DST_MSIZE_MASK (GENMASK(21,18))
51 #define CH_CTL_L_SRC_MSIZE_MASK (GENMASK(17,14))
52
53 typedef enum {
54 DWAXIDMAC_BURST_TRANS_LEN_1 = 0,
55 DWAXIDMAC_BURST_TRANS_LEN_4,
56 DWAXIDMAC_BURST_TRANS_LEN_8,
57 DWAXIDMAC_BURST_TRANS_LEN_16,
58 DWAXIDMAC_BURST_TRANS_LEN_32,
59 DWAXIDMAC_BURST_TRANS_LEN_64,
60 DWAXIDMAC_BURST_TRANS_LEN_128,
61 DWAXIDMAC_BURST_TRANS_LEN_256,
62 DWAXIDMAC_BURST_TRANS_LEN_512,
63 DWAXIDMAC_BURST_TRANS_LEN_1024
64 }BURST_SIZE;
65
66 #define CH_CTL_L_DST_WIDTH_POS 11
67 #define CH_CTL_L_SRC_WIDTH_POS 8
68 #define CH_CTL_L_DST_WIDTH_MASK (GENMASK(13,11))
69 #define CH_CTL_L_SRC_WIDTH_MASK (GENMASK(10,8))
70
71 #define CH_CTL_L_DST_INC_POS 6
72 #define CH_CTL_L_SRC_INC_POS 4
73 #define CH_CTL_L_DST_INC_POS_MASK (DMA_BIT(6))
74 #define CH_CTL_L_SRC_INC_POS_MASK (DMA_BIT(4))
75
76 typedef enum {
77 DWAXIDMAC_CH_CTL_L_INC = 0,
78 DWAXIDMAC_CH_CTL_L_NOINC
79 }ADDRESS_UPDATE;
80
81 #define CH_CTL_L_DST 2
82 #define CH_CTL_L_SRC 0
83 #define CH_CTL_L_DST_MASK (DMA_BIT(2))
84 #define CH_CTL_L_SRC_MASK (DMA_BIT(0))
85
86 /* CH_CFG_H */
87 #define CH_CFG_L_PRIORITY_POS 47
88 #define CH_CFG_L_PRIORITY_POS_MASK (DMA_BIT(47))
89 #define CH_CFG_L_HS_SEL_DST_POS 36
90 #define CH_CFG_L_HS_SEL_DST_POS_MASK (DMA_BIT(36))
91 #define CH_CFG_L_HS_SEL_SRC_POS 35
92 #define CH_CFG_L_HS_SEL_SRC_POS_MASK (DMA_BIT(35))
93
94 typedef enum {
95 DWAXIDMAC_HS_SEL_HW = 0,
96 DWAXIDMAC_HS_SEL_SW
97 }HANDSHAKE_SELECT;
98
99 #define CH_CFG_L_TT_FC_POS 32
100 #define CH_CFG_L_TT_FC_MASK (GENMASK(34,32))
101
102 #define CH_CFG_L_SRC_PER_POS 4
103 #define CH_CFG_L_DST_PER_POS 11
104 #define CH_CFG_L_SRC_PER_MASK (GENMASK(8,4))
105 #define CH_CFG_L_DST_PER_MASK (GENMASK(15,11))
106
107
108 #define DMA_BIT(n) (1ULL << n)
109
110 #define GENMASK(h, l) ((((1ULL) << ((h) - (l) + 1)) - 1) << (l))
111
112 typedef enum {
113 DWAXIDMAC_TT_FC_MEM_TO_MEM_DMAC = 0,
114 DWAXIDMAC_TT_FC_MEM_TO_PER_DMAC,
115 DWAXIDMAC_TT_FC_PER_TO_MEM_DMAC,
116 DWAXIDMAC_TT_FC_PER_TO_PER_DMAC,
117 DWAXIDMAC_TT_FC_PER_TO_MEM_SRC,
118 DWAXIDMAC_TT_FC_PER_TO_PER_SRC,
119 DWAXIDMAC_TT_FC_MEM_TO_PER_DST,
120 DWAXIDMAC_TT_FC_PER_TO_PER_DST
121 }FLOW_CONTROL;
122
123 /* CH_CFG_L */
124 #define CH_CFG_L_DST_MULTBLK_TYPE_POS 2
125 #define CH_CFG_L_SRC_MULTBLK_TYPE_POS 0
126 enum {
127 DWAXIDMAC_MBLK_TYPE_CONTIGUOUS = 0,
128 DWAXIDMAC_MBLK_TYPE_RELOAD,
129 DWAXIDMAC_MBLK_TYPE_SHADOW_REG,
130 DWAXIDMAC_MBLK_TYPE_LL
131 };
132
166 #define DWAXIDMAC_IRQ_NONE 0
167 #define DWAXIDMAC_IRQ_BLOCK_TRF DMA_BIT(0)
168 #define DWAXIDMAC_IRQ_DMA_TRF DMA_BIT(1)
169 #define DWAXIDMAC_IRQ_SRC_TRAN DMA_BIT(3)
170 #define DWAXIDMAC_IRQ_DST_TRAN DMA_BIT(4)
171 #define DWAXIDMAC_IRQ_SRC_DEC_ERR DMA_BIT(5)
172 #define DWAXIDMAC_IRQ_DST_DEC_ERR DMA_BIT(6)
173 #define DWAXIDMAC_IRQ_SRC_SLV_ERR DMA_BIT(7)
174 #define DWAXIDMAC_IRQ_DST_SLV_ERR DMA_BIT(8)
175 #define DWAXIDMAC_IRQ_LLI_RD_DEC_ERR DMA_BIT(9)
176 #define DWAXIDMAC_IRQ_LLI_WR_DEC_ERR DMA_BIT(10)
177 #define DWAXIDMAC_IRQ_LLI_RD_SLV_ERR DMA_BIT(11)
178 #define DWAXIDMAC_IRQ_LLI_WR_SLV_ERR DMA_BIT(12)
179 #define DWAXIDMAC_IRQ_INVALID_ERR DMA_BIT(13)
180 #define DWAXIDMAC_IRQ_MULTIBLKTYPE_ERR DMA_BIT(14)
181 #define DWAXIDMAC_IRQ_DEC_ERR DMA_BIT(16)
182 #define DWAXIDMAC_IRQ_WR2RO_ERR DMA_BIT(17)
183 #define DWAXIDMAC_IRQ_RD2RWO_ERR DMA_BIT(18)
184 #define DWAXIDMAC_IRQ_WRONCHEN_ERR DMA_BIT(19)
185 #define DWAXIDMAC_IRQ_SHADOWREG_ERR DMA_BIT(20)
186 #define DWAXIDMAC_IRQ_WRONHOLD_ERR DMA_BIT(21)
187 #define DWAXIDMAC_IRQ_LOCK_CLEARED DMA_BIT(27)
188 #define DWAXIDMAC_IRQ_SRC_SUSPENDED DMA_BIT(28)
189 #define DWAXIDMAC_IRQ_SUSPENDED DMA_BIT(29)
190 #define DWAXIDMAC_IRQ_DISABLED DMA_BIT(30)
191 #define DWAXIDMAC_IRQ_ABORTED DMA_BIT(31)
192 #define DWAXIDMAC_IRQ_ALL_ERR (GENMASK(21, 16) | GENMASK(14, 5))
193 #define DWAXIDMAC_IRQ_ALL GENMASK(31, 0)
194
195 typedef enum {
196 DWAXIDMAC_TRANS_WIDTH_8 = 0,
197 DWAXIDMAC_TRANS_WIDTH_16,
198 DWAXIDMAC_TRANS_WIDTH_32,
199 DWAXIDMAC_TRANS_WIDTH_64,
200 DWAXIDMAC_TRANS_WIDTH_128,
201 DWAXIDMAC_TRANS_WIDTH_256,
202 DWAXIDMAC_TRANS_WIDTH_512,
203 DWAXIDMAC_TRANS_WIDTH_MAX = DWAXIDMAC_TRANS_WIDTH_512
204 }TRANSFRE_WIDTH;
205
206 typedef enum {
207 AXI_MASTER_1,
208 AXI_MASTER_2
209 }AXI_MASTER_SELECT;
210
211 typedef enum {
212 FLASH_SPI_RX = 0,
213 FLASH_SPI_TX,
214 SPI_MASTER_RX,
215 SPI_MASTER_TX,
216 UART1_RX,
217 UART1_TX,
218 UART0_RX,
219 UART0_TX
220 }HS_PER;
221
222 typedef struct dw_dmac_ch_config {
223 TRANSFRE_WIDTH src_trans_width;
224 BURST_SIZE src_msize;
225 ADDRESS_UPDATE src_addr_update;
226 HS_PER src_per;
227 AXI_MASTER_SELECT src_master_select;
228 HANDSHAKE_SELECT src_hs_select;
229
230 TRANSFRE_WIDTH dst_trans_width;
231 BURST_SIZE dst_msize;
232 ADDRESS_UPDATE dst_addr_update;
233 HS_PER dst_per;
234 AXI_MASTER_SELECT dst_master_select;
235 HANDSHAKE_SELECT dst_hs_select;
236
237 FLOW_CONTROL flow_ctrl;
238 }DW_DMAC_CH_CONFIG;
239
245 int dw_dma_select_channel(void);
246
254 int dw_dma_channel_config(int dma_channel, DW_DMAC_CH_CONFIG config);
255
264 int dw_dma_xfer(void *dst, void *src, int len, int dma_channel);
265
271 int dw_dma_wait_complete(int dma_channel);
272
280 int dw_dma_wait_complete_timeout(int dma_channel, unsigned int timeout_ms);
281
290 int dw_dma_xfer_poll(void *dst, void *src, int len, int dma_channel);
291
300 int dw_dma_xfer_int(void *dst, void *src, int len, int dma_channel);
301
309 void dw_dma_register_complete_callback(int dma_channel, void *func, void *para);
310
316 void dw_dmac_debug(int debug);
317
322 void dw_dmac_init(void);
323
324 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/eeprom.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
eeprom.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : eeprom.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __EEPROM_H___
25 #define __EEPROM_H_
26
27 #include "types.h"
28
29 int eeprom_init(unsigned int bus_id, unsigned char chip_addr, char *eeprom_name);
30 ssize_t eeprom_write(unsigned char *buf, unsigned int off, size_t count);
31 ssize_t eeprom_read(unsigned char *buf, unsigned int off, size_t count);
32
33 #endif /* __EEPROM_H__*/


蜂鸟L系列离线方案开发指导手册: 成员变量

这里列出了所有文档化的结构体和联合体的成员变量，并附带结构或联合所属的文件:

- a -

  • addr : UNI_CLOCK_DIV , UNI_CLOCK_DTO , uni_i2c_msg
  • adjust_delay : pmu_auto_ldo
  • adjust_ldo_delay0 : pmu_timing
  • adjust_ldo_delay1 : pmu_timing
  • AlarmMaskDay : UNIRTC_AlarmMask_s
  • AlarmMaskHour : UNIRTC_AlarmMask_s
  • AlarmMaskMin : UNIRTC_AlarmMask_s
  • AlarmMaskMonth : UNIRTC_AlarmMask_s
  • AlarmMaskMs : UNIRTC_AlarmMask_s
  • AlarmMaskSec : UNIRTC_AlarmMask_s
  • AlarmMaskUs : UNIRTC_AlarmMask_s
  • AlarmMaskWeek : UNIRTC_AlarmMask_s
  • AlarmMaskYear : UNIRTC_AlarmMask_s
  • audio_in_sram_mode : UNI_PMU_STATE
  • auto_ldo : pmu_ctrl_config

- b -

  • b : UNI_LED_COLOR
  • bclk_sel : UNI_AUDIO_IN_I2S_PARAM
  • bits : UNI_AUDIO_OUT_PCM
  • buf : uni_i2c_msg
  • buffer : UNI_AUDIO_IN_OUTPUT_LOGFBANK , UNI_AUDIO_IN_OUTPUT_SPECTRUM
  • buffer0 : UNI_AUDIO_OUT_BUFFER
  • buffer1 : UNI_AUDIO_OUT_BUFFER

- c -

  • callback : osc_trim_config
  • channels : UNI_AUDIO_OUT_PCM
  • clk : UNI_AUDIO_IN_INPUT_PDM , UNI_CLOCK_SOURCE_TABLE
  • clk_mode : UNI_AUDIO_IN_I2S_PARAM
  • close_osc_delay : pmu_timing
  • config_callback : UNI_AUDIO_IN_CONFIG
  • current_adjust_gate : pmu_auto_ldo
  • current_trim_value : pmu_auto_ldo
  • cycles : osc_current_cycle

- d -

  • data_format : UNI_AUDIO_IN_I2S_PARAM
  • dst_addr_update : UNI_DMA_AHB_CH_CONFIG
  • dst_hs_per : UNI_DMA_AHB_CH_CONFIG
  • dst_hs_select : UNI_DMA_AHB_CH_CONFIG
  • dst_master_select : UNI_DMA_AHB_CH_CONFIG
  • dst_msize : UNI_DMA_AHB_CH_CONFIG

- e -

  • eaddr : UNI_AUDIO_OUT_FRAME
  • enable : pmu_auto_ldo
  • endian : UNI_AUDIO_IN_OUTPUT_LOGFBANK , UNI_AUDIO_IN_OUTPUT_PCM , UNI_AUDIO_IN_OUTPUT_SPECTRUM , UNI_AUDIO_OUT_PCM
  • engvad_callback : UNI_AUDIO_IN_CONFIG
  • evad_enable : UNI_AUDIO_IN_EVAD
  • evad_high_threshold : UNI_AUDIO_IN_EVAD_THRESHOLD
  • evad_low_threshold : UNI_AUDIO_IN_EVAD_THRESHOLD
  • evad_zcr_threshold : UNI_AUDIO_IN_EVAD_THRESHOLD

- f -

  • fftvad_callback : UNI_AUDIO_IN_CONFIG
  • flags : uni_i2c_msg
  • flash_poweroff : UNI_PMU_STATE
  • flow_ctrl : UNI_DMA_AHB_CH_CONFIG
  • frame_num : UNI_AUDIO_IN_OUTPUT_LOGFBANK , UNI_AUDIO_IN_OUTPUT_PCM , UNI_AUDIO_IN_OUTPUT_SPECTRUM
  • frame_over_callback : UNI_AUDIO_OUT_CALLBACK
  • fsm : pmu_ctrl_config
  • function : pin_config

- g -

  • g : UNI_LED_COLOR

- h -

  • high_gate : pmu_auto_ldo
  • hz : buzzer_tone_t

- i -

  • i2s : UNI_AUDIO_IN_OUTPUT_I2S
  • i2s_fs : UNI_AUDIO_IN_I2S_PARAM
  • int_status : osc_trim_config
  • interlace : UNI_AUDIO_OUT_PCM
  • isolation_enable : UNI_PMU_STATE
  • isolation_high_delay : pmu_timing
  • isolation_low_delay : pmu_timing

- l -

  • left_buffer : UNI_AUDIO_IN_OUTPUT_PCM
  • left_source : UNI_AUDIO_IN_OUTPUT_I2S
  • len : uni_i2c_msg
  • low_gate : pmu_auto_ldo

- m -

  • manual_ldo_adjust_en : UNI_PMU_STATE
  • manual_ldo_adjust_val : UNI_PMU_STATE
  • mask : UNI_CLOCK_DIV
  • mcu_clk_gate : UNI_PMU_STATE
  • mcu_idle_delay : pmu_timing
  • mcu_poweroff : UNI_PMU_STATE
  • mcu_reset : UNI_PMU_STATE
  • mcu_sram_mode : UNI_PMU_STATE
  • mode : osc_trim_config , pmu_auto_ldo

- n -

  • new_frame_callback : UNI_AUDIO_OUT_CALLBACK
  • npu_sram_mode : UNI_PMU_STATE

- o -

  • offs : UNI_CLOCK_DIV
  • osc_1m_en : UNI_PMU_STATE
  • osc_24m_en : UNI_PMU_STATE

- p -

  • pcm_length : UNI_AUDIO_IN_I2S_PARAM
  • pga_enable : UNI_AUDIO_IN_INPUT_SADC
  • pin_id : pin_config
  • port : uni_brc_info_t
  • power_on_delay : pmu_timing
  • priv : osc_trim_config

- r -

  • r : UNI_LED_COLOR
  • ram_retention_delay : pmu_timing
  • record_callback : UNI_AUDIO_IN_CONFIG
  • ref_cycles : osc_target_cycle , osc_trim_config
  • resv : UNI_PMU_STATE , UNI_PMU_TRIM_CFG
  • right_buffer : UNI_AUDIO_IN_OUTPUT_PCM
  • right_source : UNI_AUDIO_IN_OUTPUT_I2S

- s -

  • saddr : UNI_AUDIO_OUT_FRAME
  • sample_rate : UNI_AUDIO_OUT_PCM
  • size : UNI_AUDIO_IN_OUTPUT_LOGFBANK , UNI_AUDIO_IN_OUTPUT_PCM , UNI_AUDIO_IN_OUTPUT_SPECTRUM , UNI_AUDIO_OUT_BUFFER
  • sleep_state : pmu_ctrl_config
  • source : UNI_AUDIO_IN_OUTPUT_LOGFBANK , UNI_AUDIO_IN_OUTPUT_PCM , UNI_AUDIO_IN_OUTPUT_SPECTRUM , UNI_CLOCK_SOURCE_TABLE
  • src_addr_update : UNI_DMA_AHB_CH_CONFIG
  • src_hs_per : UNI_DMA_AHB_CH_CONFIG
  • src_hs_select : UNI_DMA_AHB_CH_CONFIG
  • src_master_select : UNI_DMA_AHB_CH_CONFIG
  • src_msize : UNI_DMA_AHB_CH_CONFIG
  • state_valid_enable : UNI_AUDIO_IN_EVAD

- t -

  • target_cycles : osc_target_cycle , osc_trim_config
  • timeout : uni_brc_info_t
  • timeout_ms : buzzer_tone_t
  • timing : pmu_ctrl_config
  • TmDay : RtcDateTime_s
  • TmHour : RtcDateTime_s
  • TmMin : RtcDateTime_s
  • TmMonth : RtcDateTime_s
  • TmMs : RtcDateTime_s
  • TmSec : RtcDateTime_s
  • TmUs : RtcDateTime_s
  • TmWeek : RtcDateTime_s
  • TmYear : RtcDateTime_s
  • trans_width : UNI_DMA_AHB_CH_CONFIG
  • trim_en : UNI_PMU_TRIM_CFG
  • trim_val : UNI_PMU_TRIM_CFG
  • trim_value : osc_trim
  • type : osc_current_cycle , osc_target_cycle , osc_trim , osc_trim_config

- u -

  • update_callback : UNI_AUDIO_IN_CONFIG

- v -

  • vad_state_h : UNI_AUDIO_IN_FFTVAD_STATE
  • vad_state_index : UNI_AUDIO_IN_FFTVAD_STATE
  • vad_state_l : UNI_AUDIO_IN_FFTVAD_STATE
  • vad_state_m : UNI_AUDIO_IN_FFTVAD_STATE

- w -

  • wakeup_addr : pmu_ctrl_config
  • wakeup_address : uni_pmu_wakeup_addr
  • wakeup_from : uni_pmu_wakeup_addr
  • wakeup_mode : pmu_ctrl_config
  • wakeup_status : pmu_ctrl_config
  • width : uni_brc_info_t
  • work_ldo_trim : pmu_ctrl_config
  • work_state : pmu_ctrl_config

- z -

  • zcr_enable : UNI_AUDIO_IN_EVAD


蜂鸟L系列离线方案开发指导手册: 成员变量 - 变量

- a -

  • addr : UNI_CLOCK_DIV , UNI_CLOCK_DTO , uni_i2c_msg
  • adjust_delay : pmu_auto_ldo
  • adjust_ldo_delay0 : pmu_timing
  • adjust_ldo_delay1 : pmu_timing
  • AlarmMaskDay : UNIRTC_AlarmMask_s
  • AlarmMaskHour : UNIRTC_AlarmMask_s
  • AlarmMaskMin : UNIRTC_AlarmMask_s
  • AlarmMaskMonth : UNIRTC_AlarmMask_s
  • AlarmMaskMs : UNIRTC_AlarmMask_s
  • AlarmMaskSec : UNIRTC_AlarmMask_s
  • AlarmMaskUs : UNIRTC_AlarmMask_s
  • AlarmMaskWeek : UNIRTC_AlarmMask_s
  • AlarmMaskYear : UNIRTC_AlarmMask_s
  • audio_in_sram_mode : UNI_PMU_STATE
  • auto_ldo : pmu_ctrl_config

- b -

  • b : UNI_LED_COLOR
  • bclk_sel : UNI_AUDIO_IN_I2S_PARAM
  • bits : UNI_AUDIO_OUT_PCM
  • buf : uni_i2c_msg
  • buffer : UNI_AUDIO_IN_OUTPUT_LOGFBANK , UNI_AUDIO_IN_OUTPUT_SPECTRUM
  • buffer0 : UNI_AUDIO_OUT_BUFFER
  • buffer1 : UNI_AUDIO_OUT_BUFFER

- c -

  • callback : osc_trim_config
  • channels : UNI_AUDIO_OUT_PCM
  • clk : UNI_AUDIO_IN_INPUT_PDM , UNI_CLOCK_SOURCE_TABLE
  • clk_mode : UNI_AUDIO_IN_I2S_PARAM
  • close_osc_delay : pmu_timing
  • config_callback : UNI_AUDIO_IN_CONFIG
  • current_adjust_gate : pmu_auto_ldo
  • current_trim_value : pmu_auto_ldo
  • cycles : osc_current_cycle

- d -

  • data_format : UNI_AUDIO_IN_I2S_PARAM
  • dst_addr_update : UNI_DMA_AHB_CH_CONFIG
  • dst_hs_per : UNI_DMA_AHB_CH_CONFIG
  • dst_hs_select : UNI_DMA_AHB_CH_CONFIG
  • dst_master_select : UNI_DMA_AHB_CH_CONFIG
  • dst_msize : UNI_DMA_AHB_CH_CONFIG

- e -

  • eaddr : UNI_AUDIO_OUT_FRAME
  • enable : pmu_auto_ldo
  • endian : UNI_AUDIO_IN_OUTPUT_LOGFBANK , UNI_AUDIO_IN_OUTPUT_PCM , UNI_AUDIO_IN_OUTPUT_SPECTRUM , UNI_AUDIO_OUT_PCM
  • engvad_callback : UNI_AUDIO_IN_CONFIG
  • evad_enable : UNI_AUDIO_IN_EVAD
  • evad_high_threshold : UNI_AUDIO_IN_EVAD_THRESHOLD
  • evad_low_threshold : UNI_AUDIO_IN_EVAD_THRESHOLD
  • evad_zcr_threshold : UNI_AUDIO_IN_EVAD_THRESHOLD

- f -

  • fftvad_callback : UNI_AUDIO_IN_CONFIG
  • flags : uni_i2c_msg
  • flash_poweroff : UNI_PMU_STATE
  • flow_ctrl : UNI_DMA_AHB_CH_CONFIG
  • frame_num : UNI_AUDIO_IN_OUTPUT_LOGFBANK , UNI_AUDIO_IN_OUTPUT_PCM , UNI_AUDIO_IN_OUTPUT_SPECTRUM
  • frame_over_callback : UNI_AUDIO_OUT_CALLBACK
  • fsm : pmu_ctrl_config
  • function : pin_config

- g -

  • g : UNI_LED_COLOR

- h -

  • high_gate : pmu_auto_ldo
  • hz : buzzer_tone_t

- i -

  • i2s : UNI_AUDIO_IN_OUTPUT_I2S
  • i2s_fs : UNI_AUDIO_IN_I2S_PARAM
  • int_status : osc_trim_config
  • interlace : UNI_AUDIO_OUT_PCM
  • isolation_enable : UNI_PMU_STATE
  • isolation_high_delay : pmu_timing
  • isolation_low_delay : pmu_timing

- l -

  • left_buffer : UNI_AUDIO_IN_OUTPUT_PCM
  • left_source : UNI_AUDIO_IN_OUTPUT_I2S
  • len : uni_i2c_msg
  • low_gate : pmu_auto_ldo

- m -

  • manual_ldo_adjust_en : UNI_PMU_STATE
  • manual_ldo_adjust_val : UNI_PMU_STATE
  • mask : UNI_CLOCK_DIV
  • mcu_clk_gate : UNI_PMU_STATE
  • mcu_idle_delay : pmu_timing
  • mcu_poweroff : UNI_PMU_STATE
  • mcu_reset : UNI_PMU_STATE
  • mcu_sram_mode : UNI_PMU_STATE
  • mode : osc_trim_config , pmu_auto_ldo

- n -

  • new_frame_callback : UNI_AUDIO_OUT_CALLBACK
  • npu_sram_mode : UNI_PMU_STATE

- o -

  • offs : UNI_CLOCK_DIV
  • osc_1m_en : UNI_PMU_STATE
  • osc_24m_en : UNI_PMU_STATE

- p -

  • pcm_length : UNI_AUDIO_IN_I2S_PARAM
  • pga_enable : UNI_AUDIO_IN_INPUT_SADC
  • pin_id : pin_config
  • port : uni_brc_info_t
  • power_on_delay : pmu_timing
  • priv : osc_trim_config

- r -

  • r : UNI_LED_COLOR
  • ram_retention_delay : pmu_timing
  • record_callback : UNI_AUDIO_IN_CONFIG
  • ref_cycles : osc_target_cycle , osc_trim_config
  • resv : UNI_PMU_STATE , UNI_PMU_TRIM_CFG
  • right_buffer : UNI_AUDIO_IN_OUTPUT_PCM
  • right_source : UNI_AUDIO_IN_OUTPUT_I2S

- s -

  • saddr : UNI_AUDIO_OUT_FRAME
  • sample_rate : UNI_AUDIO_OUT_PCM
  • size : UNI_AUDIO_IN_OUTPUT_LOGFBANK , UNI_AUDIO_IN_OUTPUT_PCM , UNI_AUDIO_IN_OUTPUT_SPECTRUM , UNI_AUDIO_OUT_BUFFER
  • sleep_state : pmu_ctrl_config
  • source : UNI_AUDIO_IN_OUTPUT_LOGFBANK , UNI_AUDIO_IN_OUTPUT_PCM , UNI_AUDIO_IN_OUTPUT_SPECTRUM , UNI_CLOCK_SOURCE_TABLE
  • src_addr_update : UNI_DMA_AHB_CH_CONFIG
  • src_hs_per : UNI_DMA_AHB_CH_CONFIG
  • src_hs_select : UNI_DMA_AHB_CH_CONFIG
  • src_master_select : UNI_DMA_AHB_CH_CONFIG
  • src_msize : UNI_DMA_AHB_CH_CONFIG
  • state_valid_enable : UNI_AUDIO_IN_EVAD

- t -

  • target_cycles : osc_target_cycle , osc_trim_config
  • timeout : uni_brc_info_t
  • timeout_ms : buzzer_tone_t
  • timing : pmu_ctrl_config
  • TmDay : RtcDateTime_s
  • TmHour : RtcDateTime_s
  • TmMin : RtcDateTime_s
  • TmMonth : RtcDateTime_s
  • TmMs : RtcDateTime_s
  • TmSec : RtcDateTime_s
  • TmUs : RtcDateTime_s
  • TmWeek : RtcDateTime_s
  • TmYear : RtcDateTime_s
  • trans_width : UNI_DMA_AHB_CH_CONFIG
  • trim_en : UNI_PMU_TRIM_CFG
  • trim_val : UNI_PMU_TRIM_CFG
  • trim_value : osc_trim
  • type : osc_current_cycle , osc_target_cycle , osc_trim , osc_trim_config

- u -

  • update_callback : UNI_AUDIO_IN_CONFIG

- v -

  • vad_state_h : UNI_AUDIO_IN_FFTVAD_STATE
  • vad_state_index : UNI_AUDIO_IN_FFTVAD_STATE
  • vad_state_l : UNI_AUDIO_IN_FFTVAD_STATE
  • vad_state_m : UNI_AUDIO_IN_FFTVAD_STATE

- w -

  • wakeup_addr : pmu_ctrl_config
  • wakeup_address : uni_pmu_wakeup_addr
  • wakeup_from : uni_pmu_wakeup_addr
  • wakeup_mode : pmu_ctrl_config
  • wakeup_status : pmu_ctrl_config
  • width : uni_brc_info_t
  • work_ldo_trim : pmu_ctrl_config
  • work_state : pmu_ctrl_config

- z -

  • zcr_enable : UNI_AUDIO_IN_EVAD


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/intr_transmit.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
intr_transmit.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : intr_transmit.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __INTR_TRANSMIT__
25 #define __INTR_TRANSMIT__
26
27 #define INTR_TRANSMIT_DW_UART1 (0)
28 #define INTR_TRANSMIT_DW_UART2 (1)
29 #define INTR_TRANSMIT_DW_I2C1 (2)
30 #define INTR_TRANSMIT_DW_I2C2 (3)
31 #define INTR_TRANSMIT_DW_SPI (4)
32 #define INTR_TRANSMIT_COUNT1 (5)
33 #define INTR_TRANSMIT_EPORT1 (6)
34 #define INTR_TRANSMIT_DMA (7)
35 #define INTR_TRANSMIT_SNPU (8)
36 #define INTR_TRANSMIT_AUDIO (9)
37 #define INTR_TRANSMIT_MTC (10)
38 #define INTR_TRANSMIT_DSP (11)
39 #define INTR_TRANSMIT_AUDIO_PLAY (12)
40 #define INTR_TRANSMIT_USB_SLAVE_WU (13)
41 #define INTR_TRANSMIT_USB_SLAVE (14)
42 #define INTR_TRANSMIT_USB_DMA (15)
43
44 #define REG_OFFSET_CK_A7_INT (0x0274)
45 #define REG_OFFSET_A7_CK_INT (0x0268)
46
47 #define INTR_TRANSMIT_REG_BASE (UNI_REG_BASE_RESET + REG_OFFSET_CK_A7_INT)
48 #define INTR_TRANSMIT_INT (0X00)
49 #define INTR_TRANSMIT_CLEAN (0X04)
50 #define INTR_TRANSMIT_ENABLE (0X08)
51
52 struct intr_transmit;
53 typedef void intr_transmit_user_isr_t(struct intr_transmit*);
54
55 struct intr_transmit {
56 unsigned short irq;
57 unsigned short intr_transmit_chan;
58 intr_transmit_user_isr_t *intr_transmit_user_isr;
59 };
60
61 extern int intr_transmit_request(intr_transmit_user_isr_t *intr_user_isr, int irq);
62 extern void intr_transmit_unrequest(int irq);
63
65 #define CPU_INT_BASE (UNI_REG_BASE_RESET + REG_OFFSET_A7_CK_INT)
66 #define CPU_USER_ISR_NUM (sizeof(int) * 8)
67 typedef void (*cpu_user_isr_t)(void *priv);
68
69 struct cpu_int_regs {
70 unsigned int a7_ck_int;
71 unsigned int a7_ck_clear;
72 unsigned int a7_ck_enable;
73 unsigned int ck_a7_int;
74 unsigned int ck_a7_clear;
75 unsigned int ck_a7_enable;
76 };
77
78 enum cpu_intr_chan {
79 cpu_audio = 0,
80 cpu_vsp_flag = 4,
81 cpu_halt = 30,
82 };
83
84 extern int cpu_intr_request(enum cpu_intr_chan chan, cpu_user_isr_t isr, void *priv);
85 extern void cpu_intr_unrequest(enum cpu_intr_chan chan);
86
87 #endif
88
89
90
91
92
93
94
95
96


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/irr.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
irr.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : irr.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __IRR_H__
25 #define __IRR_H__
26
27 /* Cooperation with C and C++ */
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #include "types.h"
33
34 #define IRR_READ_ROW_DATA (1)
35
36 unsigned char irr_init(void);
37 void irr_poll(void);
38 int irr_close(void);
39 int irr_read(void *buffer, uint32_t *len);
40 int irr_ioctl(uint32_t key,void *buf);
41 void uni_irr_send_init(unsigned int gpio);
42 void uni_irr_send_code(unsigned char addr, unsigned char code);
43
44 #ifdef __cplusplus
45 }
46 #endif
47
48 #endif
49


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/misc.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
misc.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : misc.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __SCPU_MISC__
25 #define __SCPU_MISC__
26
27 #include <spl/spl.h>
28
29 /*
30 * return value : 0 success, -1 failed
31 */
32 int get_dsk(unsigned char *buf, int len);
33
34 /*
35 * let cache work
36 */
37 void uni_cache_init(void);
38
39 /*
40 * load uboot stage1
41 */
42 int load_uboot_stage1(void);
43
44 /*
45 * get chipname
46 */
47 int get_chipname(void);
48
49 #define NNNA 'A'
50 #define NNNB 'B'
51 #define NNNC 'C'
52
53 /*
54 * get chipversion
55 */
56 int get_chipversion(void);
57
58 /*
59 * Simultaneous output to uart and usb
60 */
61
62 int logger(const char *fmt, ...);
63
64 /*
65 * get a char from uart or usb, auto select
66 */
67 int auto_getchar(void);
68
69 /*
70 * send a char to uart or usb, auto select
71 */
72 int auto_putchar(char value);
73
74 /*
75 * Virtual address to dma address
76 */
77 unsigned int virt_to_dma(void *addr);
78
79 /*
80 * reinit boot info
81 */
82 extern struct boot_info boot_info_s2;
83 void bootinfo_init(void);
84
85 /*
86 * Rom 从串口启动时，该接口用于获取 stage2 应该配置的波特率
87 * return value : 波特率的值，0 表示不修改串口波特率的配置(沿用之前的波特率)
88 */
89 unsigned int get_baudrate_in_boot_mode(void);
90
95 void uni_analog_config_update_enable(void);
96
97 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/mtc.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
mtc.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : mtc.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __MTC_H__
25 #define __MTC_H__
26
27 int uni_mtc_open(void);
28 int uni_mtc_close(void);
29 int uni_mtc_ioctl(uint32_t key, void *buf);
30
31 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/multicore_lock.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
multicore_lock.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : multicore_lock.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __MULTICORE_LOCK_H__
25 #define __MULTICORE_LOCK_H__
26
27 #include <autoconf.h>
28
29 typedef enum {
30 MULTICORE_LOCK_OTP = (1 << 0),
31 } MULTICORE_LOCK;
32
33 #ifdef CONFIG_MULTICORE_LOCK
34
35 int multicore_trylock(MULTICORE_LOCK lock);
36 int multicore_lock(MULTICORE_LOCK lock);
37 int multicore_unlock(MULTICORE_LOCK lock);
38
39 #else
40
41 inline int multicore_trylock(MULTICORE_LOCK lock)
42 {
43 return 0;
44 }
45
46 inline int multicore_lock(MULTICORE_LOCK lock)
47 {
48 return 0;
49 }
50
51 inline int multicore_unlock(MULTICORE_LOCK lock)
52 {
53 return 0;
54 }
55 #endif
56
57 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/oem.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
oem.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : oem.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __OEM_H__
25 #define __OEM_H__
26
27 #include <common.h>
28
29 #define OEM_SIZE (64*1024)
30
31 int oem_get_hardware_version(uint32_t *version);
32 int oem_get_software_version(uint32_t *version);
33 int oem_get_software_crc32(uint32_t *crc32);
34 int oem_get_vender_id(uint16_t *vender_id);
35 int oem_get_product_id(uint16_t *product_id);
36 int oem_get_sn(uint8_t *sn);
37 int oem_init(uint32_t start);
38
39 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/otp.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
otp.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : otp.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __OTP_H__
25 #define __OTP_H__
26
27 #define OTP_USER_DATA_LENGTH (64)
28 int uni_otp_read(unsigned int start_addr, char *data, int rd_num);
29 int uni_otp_write(unsigned int start_addr, char *data, int wr_num);
30 int otp_get_chipname(char *chip_name, unsigned int buf_len);
31 int otp_get_publicid(unsigned long long *public_id);
32 int otp_set_userdata(unsigned int index, char *data, int length);
33 int otp_get_userdata(unsigned int index, char *data, int length);
34 int otp_lock(void);
35 int otp_get_lock(unsigned int *lock);
36
37 #endif


蜂鸟L系列离线方案开发指导手册: 相关页面

相关页面
这里列出了所有相关页面:
1、简介
2、产品说明
3、获取源码
4、烧录固件
5、搭建开发环境
6、软件架构
7、二次开发


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/pm.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
pm.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : pm.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __PM_H__
25 #define __PM_H__
26
27 #define CPU_HALT_RESET (0xa030a260)
28 #define CPU_HALT_PM (0xa030a150)
29 #define CPU_HALT_ISOLATE (0xa030a264)
30
31 enum reset_mode {
32 RESET_REBOOT,
33 RESET_POWEROFF,
34 RESET_SUSPEND,
35 RESET_RESUME,
36 };
37
38 void ddr_reset(void);
39 void cpu_reset(void);
40 void cpu_suspend(void);
41 void cpu_resume(void);
42 void cpu_reboot(void);
43
44 struct bq25890_config {
45 u32 ichg; /* charge current */
46 u32 vreg; /* regulation voltage */
47 u32 iterm; /* termination current */
48 u32 iprechg; /* precharge current */
49 u32 sysvmin; /* minimum system voltage limit */
50 u32 boostv; /* boost regulation voltage */
51 u32 boosti; /* boost current limit */
52 u32 boostf; /* boost frequency */
53 u32 ilim_en; /* enable ILIM pin */
54 u32 treg; /* thermal regulation threshold */
55 u32 enable;
56 };
57
58 struct bq25890_info{
59 unsigned int chrg_status;
60 unsigned int online;
61 unsigned int enable;
62 unsigned int bat_fault;
63 unsigned int temp;
64 unsigned int Vbus;
65 unsigned int chrg_I;
66 unsigned int chrg_Imax;
67 unsigned int chrg_V;
68 unsigned int chrg_Vmax;
69 unsigned int chrg_Iterm;
70 };
71
72 struct cw2015_info{
73 unsigned int voltage;
74 unsigned int capacity;
75 unsigned int time;
76 };
77
78 extern void uni_pm_init(void);
79
80 int bq25890_init(int i2c_bus, struct bq25890_config *config);
81 int bq25890_get_property(struct bq25890_info *info);
82
83 int cw2015_init(int bus_id);
84 int cw2015_get_property(struct cw2015_info *info);
85
86 int rt5037_buck_set(unsigned char buck_num, unsigned int voltage);
87 int rt5037_ldo_set(unsigned char ldo_num, unsigned int voltage);
88 int rt5037_init(int bus_id);
89
90 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/pwm_buzzer.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
pwm_buzzer.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : pwm_buzzer.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef _PWM_BUZZER_H
25 #define _PWM_BUZZER_H
26
30 typedef enum {
31 EVENT_BUZZER_FINISH,
32 EVENT_BUZZER_ERR,
33 } BUZZER_EVENT;
34
43 typedef void (*UserBuzzerEventCallback)(int buzzer_event_id, void *data);
44
48 typedef struct {
49 unsigned int hz;
50 unsigned int timeout_ms;
51 }buzzer_tone_t;
52
62 int user_buzzer_init(unsigned int pin, UserBuzzerEventCallback cb);
63
70 int user_buzzer_final(void);
71
81 int user_buzzer_play(buzzer_tone_t *tone_list, int len);
82
89 int user_buzzer_stop(void);
90 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/spi.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
spi.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : spi.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __SPI_H__
25 #define __SPI_H__
26
27 #include <list.h>
28 #include <string.h>
29
30
31 struct spi_transfer {
32 const void *tx_buf;
33 void *rx_buf;
34 unsigned len;
35
36 unsigned cs_change:1;
37 unsigned tx_nbits:3;
38 unsigned rx_nbits:3;
39 #define SPI_NBITS_SINGLE 0x01 /* 1bit transfer */
40 #define SPI_NBITS_DUAL 0x02 /* 2bits transfer */
41 #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */
42 unsigned char bits_per_word;
43 unsigned int delay_usecs;
44 unsigned int speed_hz;
45
46 struct list_head transfer_list;
47 };
48
49 struct spi_device ;
50 struct spi_message {
51 struct list_head transfers;
52 struct spi_device *spi;
53 unsigned is_dma_mapped:1;
54 void (*complete)(void *context);
55 void *context;
56 unsigned actual_length;
57 int status;
58 struct list_head queue;
59 void *state;
60 };
61
62 struct spi_master {
63 int bus_num;
64 unsigned int num_chipselect;
65 int (*setup)(struct spi_device *spi);
66 int (*transfer)(struct spi_device *spi,struct spi_message *mesg);
67 void (*cleanup)(struct spi_device *spi);
68 void *data;
69 void *driver_data;
70 struct list_head list;
71 };
72
73 struct spi_device {
74 struct spi_master *master;
75 unsigned int max_speed_hz;
76 unsigned char chip_select;
77 unsigned char bits_per_word;
78 unsigned short mode;
79 #define SPI_TX_DUAL 0x100 /* transmit with 2 wires */
80 #define SPI_TX_QUAD 0x200 /* transmit with 4 wires */
81 #define SPI_RX_DUAL 0x400 /* receive with 2 wires */
82 #define SPI_RX_QUAD 0x800 /* receive with 4 wires */
83 void *controller_state;
84 };
85
86 struct sflash_master {
87 int bus_num;
88 struct spi_device spi;
89 struct list_head list;
90 };
91
92 static inline void spi_message_init(struct spi_message *m)
93 {
94 memset(m, 0, sizeof *m);
95 INIT_LIST_HEAD(&m->transfers);
96 }
97
98 static inline void
99 spi_message_add_tail(struct spi_transfer *t, struct spi_message *m)
100 {
101 list_add_tail(&t->transfer_list, &m->transfers);
102 }
103
104 static inline void
105 spi_transfer_del(struct spi_transfer *t)
106 {
107 list_del(&t->transfer_list);
108 }
109
128 static inline int
129 spi_setup(struct spi_device *spi)
130 {
131 return spi->master->setup(spi);
132 }
133
134
164 static inline int
165 spi_sync(struct spi_device *spi, struct spi_message *message)
166 {
167 message->spi = spi;
168 return spi->master->transfer(spi, message);
169 }
170
171 /*---------------------------------------------------------------------------*/
172
183 static inline int
184 spi_write(struct spi_device *spi, const unsigned char *buf, size_t len)
185 {
186 struct spi_transfer t = {
187 .tx_buf = buf,
188 .len = len,
189 };
190 struct spi_message m;
191
192 spi_message_init(&m);
193 spi_message_add_tail(&t, &m);
194 return spi_sync(spi, &m);
195 }
196
207 static inline int
208 spi_read(struct spi_device *spi, unsigned char *buf, size_t len)
209 {
210 struct spi_transfer t = {
211 .rx_buf = buf,
212 .len = len,
213 };
214 struct spi_message m;
215
216 spi_message_init(&m);
217 spi_message_add_tail(&t, &m);
218 return spi_sync(spi, &m);
219 }
220
221 int spi_write_then_read(struct spi_device *spi,
222 const unsigned char *txbuf, unsigned n_tx,
223 unsigned char *rxbuf, unsigned n_rx);
224
225 void uni_spi_probe(void);
226
227 void spi_master_v3_probe(void);
228
229 #endif


蜂鸟L系列离线方案开发指导手册: buzzer_tone_t结构体 参考

成员变量
buzzer_tone_t结构体 参考

音调

#include <pwm_buzzer.h>

成员变量

unsigned int | hz
频率
unsigned int | timeout_ms
播放时长


蜂鸟L系列离线方案开发指导手册: osc_current_cycle结构体 参考

成员变量
osc_current_cycle结构体 参考

当前参考时钟 cycle

#include <uni_pmu_osc.h>

成员变量

UNI_OSC_CLK_TYPE | type
时钟类型
uint32_t | cycles
参考时钟 cycle 数


蜂鸟L系列离线方案开发指导手册: osc_target_cycle结构体 参考

成员变量
osc_target_cycle结构体 参考

目标时钟配置

#include <uni_pmu_osc.h>

成员变量

UNI_OSC_CLK_TYPE | type
时钟类型
uint16_t | target_cycles
目标时钟 cycle 数
uint16_t | ref_cycles
参考时钟 cycle 数


蜂鸟L系列离线方案开发指导手册: osc_trim结构体 参考

成员变量
osc_trim结构体 参考

TRIM 值

#include <uni_pmu_osc.h>

成员变量

UNI_OSC_CLK_TYPE | type
时钟类型
uint32_t | trim_value
trim 值


蜂鸟L系列离线方案开发指导手册: osc_trim_config结构体 参考

成员变量
osc_trim_config结构体 参考

osc 配置结构体

#include <uni_pmu_osc.h>

成员变量

UNI_OSC_CLK_TYPE | type
TRIM 时钟类型
UNI_OSC_TRIM_MODE | mode
TRIM 模式
uint16_t | target_cycles
目标时钟 cycle 数
uint16_t | ref_cycles
参考时钟 cycle 数
irq_handler_t | callback
TRIM 中断回调函数
void * | priv
TRIM 回调参数
uint32_t | int_status
中断状态


蜂鸟L系列离线方案开发指导手册: pmu_auto_ldo结构体 参考

成员变量
pmu_auto_ldo结构体 参考

自动电压调节

#include <uni_pmu_ctrl.h>

成员变量

uint8_t | enable
自动调整使能
uint8_t | mode
自动电压调整模式
uint8_t | low_gate
自动调整电压最低门限
uint8_t | high_gate
自动调整电压最高门限
uint16_t | adjust_delay
两次电压调整时间间隔，时钟数
uint8_t | current_trim_value
当前电压调整过的trim值(只读)
uint8_t | current_adjust_gate
当前电压值所处档位(只读)


蜂鸟L系列离线方案开发指导手册: pmu_ctrl_config结构体 参考

成员变量
pmu_ctrl_config结构体 参考

pmu 配置

#include <uni_pmu_ctrl.h>

成员变量

UNI_PMU_TIMING timing
时序配置
UNI_PMU_STATE sleep_state
进入低功耗时外设状态配置
UNI_PMU_STATE work_state
退出低功耗时外设状态配置
uint32_t | wakeup_mode
唤醒模式配置
uint32_t | fsm
pmu 状态
uint32_t | wakeup_status
唤醒状态
UNI_PMU_WAKEUP_ADDR wakeup_addr
唤醒地址配置
UNI_PMU_AUTO_LDO auto_ldo
自动ldo配置
UNI_PMU_TRIM_CFG work_ldo_trim
工作时ldo配置


蜂鸟L系列离线方案开发指导手册: pmu_timing结构体 参考

成员变量
pmu_timing结构体 参考

PMU 时序

#include <uni_pmu_ctrl.h>

成员变量

uint16_t | mcu_idle_delay
delay after mcu idle
uint16_t | ram_retention_delay
ram retention delay
uint16_t | isolation_high_delay
delay after isolation high
uint16_t | close_osc_delay
delay after close osc
uint16_t | adjust_ldo_delay0
delay after adjust ldo
uint16_t | adjust_ldo_delay1
delay after adjust ldo
uint16_t | power_on_delay
delay after power on
uint16_t | isolation_low_delay
delay after isolation low


蜂鸟L系列离线方案开发指导手册: RtcDateTime_s结构体 参考

成员变量
RtcDateTime_s结构体 参考

RTC 日期时间结构体

#include <uni_rtc.h>

成员变量

int | TmYear
年,BCD码
int | TmMonth
月,BCD码
int | TmDay
日,BCD码
int | TmWeek
周,BCD码
int | TmHour
时,BCD码
int | TmMin
分,BCD码
int | TmSec
秒,BCD码
int | TmMs
毫秒,DEC值
int | TmUs
微秒,DEC值


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_CONFIG结构体 参考

成员变量
UNI_AUDIO_IN_CONFIG结构体 参考

初始化配置

#include <uni_audio_in_v2.h>

成员变量

UNI_AUDIO_IN_RECORD_CB | record_callback
录制中断回调
UNI_AUDIO_IN_CONFIG_CB | config_callback
初始化配置回调
UNI_AUDIO_IN_UPDATE_CB | update_callback
buffer切换中断回调
UNI_AUDIO_IN_ENGVAD_CB | engvad_callback
engvad中断回调
UNI_AUDIO_IN_FFTVAD_CB | fftvad_callback
fftvad中断回调


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_EVAD结构体 参考

成员变量
UNI_AUDIO_IN_EVAD结构体 参考

energy vad使能参数

#include <uni_audio_in_v2.h>

成员变量

unsigned int | evad_enable
evad使能开关
unsigned int | zcr_enable
过零率使能开关
unsigned int | state_valid_enable
该输入evad检测是否对录制生效


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_EVAD_THRESHOLD结构体 参考

成员变量
UNI_AUDIO_IN_EVAD_THRESHOLD结构体 参考

energy 检测门限参数

#include <uni_audio_in_v2.h>

成员变量

unsigned int | evad_low_threshold
evad检测低门限
unsigned int | evad_high_threshold
evad检测高门限
unsigned int | evad_zcr_threshold
过零率检测门限


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_FFTVAD_CHIPPING结构体 参考

成员变量
UNI_AUDIO_IN_FFTVAD_CHIPPING结构体 参考

fftvad中线削波值

#include <uni_audio_in_v2.h>

成员变量

unsigned short | chipping_1
unsigned short | chipping_2
unsigned short | chipping_3
unsigned short | chipping_4


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_FFTVAD_STATE结构体 参考

成员变量
UNI_AUDIO_IN_FFTVAD_STATE结构体 参考

fftvad状态参数

#include <uni_audio_in_v2.h>

成员变量

unsigned int | vad_state_l
0~31帧状态
unsigned int | vad_state_m
32~63帧状态
unsigned int | vad_state_h
64~95帧状态
unsigned short | vad_state_index
当前更新到的帧状态索引


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_I2S_PARAM结构体 参考

成员变量
UNI_AUDIO_IN_I2S_PARAM结构体 参考

I2S 配置参数

#include <uni_audio_in_v2.h>

成员变量

UNI_AUDIO_IN_I2S_PCM_LENGTH | pcm_length
数据位宽
UNI_AUDIO_IN_I2S_DATA_FORMAT | data_format
数据格式
UNI_AUDIO_IN_I2S_CLOCK_MODE | clk_mode
主从格式
UNI_AUDIO_IN_I2S_BCLK_MODE | bclk_sel
bclk模式
UNI_AUDIO_IN_SAMPLE_RATE | i2s_fs
采样率


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_INPUT_I2S结构体 参考

成员变量
UNI_AUDIO_IN_INPUT_I2S结构体 参考

I2S/TDM In 配置参数

#include <uni_audio_in_v2.h>

成员变量

UNI_AUDIO_IN_I2S_PARAM | i2s
UNI_AUDIO_IN_FSYNC_MODE | fsync_mode


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_INPUT_PDM结构体 参考

成员变量
UNI_AUDIO_IN_INPUT_PDM结构体 参考

PDM 输入配置

#include <uni_audio_in_v2.h>

成员变量

UNI_AUDIO_IN_PDM_CLK clk
pdm时钟配置


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_INPUT_SADC结构体 参考

成员变量
UNI_AUDIO_IN_INPUT_SADC结构体 参考

SAR ADC 输入配置

#include <uni_audio_in_v2.h>

成员变量

unsigned int pga_enable
pga使能开关


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_OUTPUT_I2S结构体 参考

成员变量
UNI_AUDIO_IN_OUTPUT_I2S结构体 参考

i2s输出配置

#include <uni_audio_in_v2.h>

成员变量

UNI_AUDIO_IN_I2S_PARAM i2s
i2s参数
UNI_AUDIO_IN_I2S_SOURCE | left_source
左声道数据来源
UNI_AUDIO_IN_I2S_SOURCE | right_source
右声道数据来源


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_OUTPUT_LOGFBANK结构体 参考

成员变量
UNI_AUDIO_IN_OUTPUT_LOGFBANK结构体 参考

logfbank 输出配置

#include <uni_audio_in_v2.h>

成员变量

unsigned int | buffer
buffer起始地址
unsigned int | size
buffer大小
unsigned int | frame_num
帧数
UNI_AUDIO_IN_ENDIAN | endian
大小端
UNI_AUDIO_IN_LOGFBANK_SOURCE | source
数据源


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_OUTPUT_PCM结构体 参考

成员变量
UNI_AUDIO_IN_OUTPUT_PCM结构体 参考

pcm 输出配置

#include <uni_audio_in_v2.h>

成员变量

unsigned int | left_buffer
左声道buffer起始地址
unsigned int | right_buffer
右声道buffer起始地址
unsigned int | size
buffer大小
unsigned int | frame_num
帧数
UNI_AUDIO_IN_ENDIAN | endian
大小端
UNI_AUDIO_IN_PCM_SOURCE | source
数据源


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_IN_OUTPUT_SPECTRUM结构体 参考

成员变量
UNI_AUDIO_IN_OUTPUT_SPECTRUM结构体 参考

frequence spectrum 输出配置

#include <uni_audio_in_v2.h>

成员变量

unsigned int | buffer
buffer起始地址
unsigned int | size
buffer大小
unsigned int | frame_num
帧数
UNI_AUDIO_IN_ENDIAN | endian
大小端
UNI_AUDIO_IN_LOGFBANK_SOURCE | source
数据源


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_OUT_BUFFER结构体 参考

成员变量
UNI_AUDIO_OUT_BUFFER结构体 参考

左右通道的起始地址和通道大小

#include <uni_audio_out_v2.h>

成员变量

unsigned char * | buffer0
左声道起始地址 8字节对齐
unsigned char * | buffer1
右声道起始地址 8字节对齐
unsigned int | size
通路buffer大小,同时对左右声道buffer起作用 128字节对齐


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_OUT_CALLBACK结构体 参考

成员变量
UNI_AUDIO_OUT_CALLBACK结构体 参考

回调函数

#include <uni_audio_out_v2.h>

成员变量

UNI_AUDIO_OUT_FRAME_CB | new_frame_callback
回调,该函数实现不能阻塞
UNI_AUDIO_OUT_FRAME_OVER_CB | frame_over_callback
帧数据全部消耗完回调,该函数实现不能阻塞


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_OUT_FRAME结构体 参考

成员变量
UNI_AUDIO_OUT_FRAME结构体 参考

播放帧配置

#include <uni_audio_out_v2.h>

成员变量

unsigned int | saddr
帧起始地址
unsigned int | eaddr
帧结束地址


蜂鸟L系列离线方案开发指导手册: UNI_AUDIO_OUT_PCM结构体 参考

成员变量
UNI_AUDIO_OUT_PCM结构体 参考

PCM参数配置

#include <uni_audio_out_v2.h>

成员变量

unsigned int | sample_rate
PCM采样率
unsigned char | channels
PCM通道数
unsigned char | bits
PCM位深16/32bit
unsigned char | interlace
PCM交织:1 非交织:0
unsigned char | endian
PCM大小端0:小端,1:大端


蜂鸟L系列离线方案开发指导手册: uni_brc_info_t结构体 参考

成员变量
uni_brc_info_t结构体 参考

baud rate check 模块检测结果

#include <uni_baud_rate_check.h>

成员变量

int | port
哪路串口的测量结果
int | width
接收 5 个 bit 串口数据经历的 cycle 数
int | timeout
0 : 未超时 1: 超时


蜂鸟L系列离线方案开发指导手册: UNI_CLOCK_DIV结构体 参考

成员变量
UNI_CLOCK_DIV结构体 参考

DIV配置表

#include <uni_clock_v2.h>

成员变量

uint8_t | addr
div 地址
uint8_t | offs
偏移
uint16_t | mask
掩码


蜂鸟L系列离线方案开发指导手册: UNI_CLOCK_DTO结构体 参考

成员变量
UNI_CLOCK_DTO结构体 参考

DTO配置表

#include <uni_clock_v2.h>

成员变量

uint8_t addr
dto 地址


蜂鸟L系列离线方案开发指导手册: UNI_CLOCK_PLL结构体 参考

成员变量
UNI_CLOCK_PLL结构体 参考

PLL配置表

#include <uni_clock_v2.h>

成员变量

unsigned int | pll_enable
unsigned int | pll_in
unsigned int | pll_fvco
unsigned int | pll_out
unsigned int | pll_div_in
unsigned int | pll_div_fb
unsigned int | pll_icpsel
unsigned int | pll_bwsel_lpf
unsigned int | pll_vco_subband
unsigned int | pll_div_out
unsigned int | pll_itrim
unsigned int | pll_vco_trim
unsigned int | pll_2nd3nd_lpf
unsigned int | pll_lock_tiehi


蜂鸟L系列离线方案开发指导手册: UNI_CLOCK_SOURCE_TABLE结构体 参考

成员变量
UNI_CLOCK_SOURCE_TABLE结构体 参考

时钟配置表

#include <uni_clock_v2.h>

成员变量

UNI_CLOCK_SOURCE | source
时钟源类型
uint8_t | clk
目标时钟


蜂鸟L系列离线方案开发指导手册: UNI_DMA_AHB_CH_CONFIG结构体 参考

成员变量
UNI_DMA_AHB_CH_CONFIG结构体 参考

dma 通道配置

#include <uni_dma_ahb.h>

成员变量

UNI_DMA_AHB_TRANSFRE_WIDTH | trans_width
dma操作位宽
UNI_DMA_AHB_BURST_SIZE | src_msize
dma 源通道burst
UNI_DMA_AHB_ADDRESS_UPDATE | src_addr_update
dma 源通道地址更新方式
unsigned int | src_hs_per
dma 源通道握手信号值
UNI_DMA_AHB_MASTER_SELECT | src_master_select
dma 源通道master选择
UNI_AHB_DMA_HANDSHAKE_SELECT | src_hs_select
dma 源通道握手信号选择
UNI_DMA_AHB_BURST_SIZE | dst_msize
dma 目的通道burst
UNI_DMA_AHB_ADDRESS_UPDATE | dst_addr_update
dma 目的通道地址更新方式
unsigned int | dst_hs_per
dma 目的通道握手信号值
UNI_DMA_AHB_MASTER_SELECT | dst_master_select
dma 目的通道master选择
UNI_AHB_DMA_HANDSHAKE_SELECT | dst_hs_select
dma 目的通道握手信号选择
UNI_DMA_AHB_FLOW_CONTROL | flow_ctrl
dma 流控方式


蜂鸟L系列离线方案开发指导手册: uni_flash_dev结构体 参考

成员变量
uni_flash_dev结构体 参考

flash 设备定义

#include <uni_flash.h>

成员变量

UNI_FLASH_DEV *(* | init )(int bus, int cs, int speed, int mode)
int(* | readdata )(unsigned int addr, unsigned char *data, unsigned int len)
int(* | chiperase )(void)
int(* | erasedata )(unsigned int addr, unsigned int len)
int(* | pageprogram )(unsigned int addr, unsigned char *data, unsigned int len)
void(* | sync )(void)
void(* | test )(int argc, char *argv[])
void(* | calcblockrange )(unsigned int addr, unsigned int len, unsigned int *pstart, unsigned int *pend)
int(* | badinfo )(void)
int(* | pageprogram_yaffs2 )(unsigned int addr, unsigned char *data, unsigned int len)
int(* | readoob )(unsigned int addr, unsigned char *data, unsigned int len)
int(* | writeoob )(unsigned int addr, unsigned char *data, unsigned int len)
char *(* | gettype )(void)
int(* | getinfo )(enum uni_flash_info flash_info)
int(* | write_protect_mode )(void)
int(* | write_protect_status )(void)
int(* | write_protect_lock )(unsigned int addr)
int(* | write_protect_unlock )(void)
int(* | otp_lock )(void)
int(* | otp_status )(unsigned char *data)
int(* | otp_erase )(void)
int(* | otp_write )(unsigned int addr, unsigned char *data, unsigned int len)
int(* | otp_read )(unsigned int addr, unsigned char *data, unsigned int len)
int(* | otp_get_region )(unsigned int *region)
int(* | otp_set_region )(unsigned int region)
int(* | block_isbad )(unsigned int addr)
int(* | block_markbad )(unsigned int addr)
int(* | calc_phy_offset )(unsigned int start, unsigned int logic_offset, unsigned int *phy_offset)


蜂鸟L系列离线方案开发指导手册: UNI_LED_COLOR结构体 参考

成员变量
UNI_LED_COLOR结构体 参考

led颜色

#include <uni_led.h>

成员变量

unsigned char | r
led绿色分量
unsigned char | b
led蓝色分量
unsigned char | g
led绿色分量


蜂鸟L系列离线方案开发指导手册: uni_pmu_wakeup_addr结构体 参考

成员变量
uni_pmu_wakeup_addr结构体 参考

PMU 唤醒启动地址配置

#include <uni_pmu_ctrl.h>

成员变量

uint8_t | wakeup_from
唤醒后从哪里启动
uint32_t | wakeup_address
启动地址


蜂鸟L系列离线方案开发指导手册: UNIRTC_AlarmMask_s结构体 参考

成员变量
UNIRTC_AlarmMask_s结构体 参考

RTC 闹钟日期 mask

#include <uni_rtc.h>

成员变量

unsigned char | AlarmMaskYear
年
unsigned char | AlarmMaskMonth
月
unsigned char | AlarmMaskDay
日
unsigned char | AlarmMaskWeek
周
unsigned char | AlarmMaskHour
时
unsigned char | AlarmMaskMin
分
unsigned char | AlarmMaskSec
秒
unsigned char | AlarmMaskMs
毫秒
unsigned char | AlarmMaskUs
微秒


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_analog/uni_adc.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_analog
uni_adc.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_adc.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_ADC_H__
25 #define __UNI_ADC_H__
26
36 int uni_analog_set_pga_itrim(unsigned int itrim);
37
47 int uni_analog_set_pga_bypass(unsigned int bypass);
48
58 int uni_analog_set_pga_enable(unsigned int enbale);
59
69 int uni_analog_set_pga_cmr_sel(unsigned int sel);
70
80 int uni_analog_set_pga_dcc(unsigned char pga_dcc);
81
93 int uni_analog_set_pga_gain(unsigned char gain);
94
104 int uni_analog_set_pga_tstbuf(unsigned int enable);
105
116 int uni_analog_set_adc_sample_clk_sel(unsigned int clk_sel);
117
128 int uni_analog_set_adc_out_at_clk(unsigned int out_clk);
129
140 int uni_analog_set_adc_in_sel(unsigned int sel);
141
151 int uni_analog_set_adc_rstn(unsigned int rstn);
152
153 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_audio_in.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_audio_in.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_audio_in.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_AUDIO_IN_H__
25 #define __UNI_AUDIO_IN_H__
26
27 #include "autoconf.h"
28 #include "uni_audio_in/uni_audio_in_v2.h"
29
30 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_audio_in/uni_audio_in_v2.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_audio_in
uni_audio_in_v2.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_audio_in_v2.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_AUDIO_IN_V1_H__
25 #define __UNI_AUDIO_IN_V1_H__
26
29 typedef enum {
30 AUDIO_IN_SADC = (1 << 0),
31 AUDIO_IN_PDM = (1 << 1),
32 AUDIO_IN_I2S = (1 << 2),
33 AUDIO_IN_FSPEC = (1 << 3),
34 } UNI_AUDIO_IN_SOURCE;
35
39 typedef enum {
40 SAMPLE_RATE_16K,
41 SAMPLE_RATE_8K, //only for i2s in
42 SAMPLE_RATE_48K //only for i2s in
43 } UNI_AUDIO_IN_SAMPLE_RATE;
44
48 typedef enum {
49 ENDIAN_LITTLE_16BIT,
50 ENDIAN_BIG_16BIT,
51 ENDIAN_LITTLE_32BIT,
52 ENDIAN_BIG_32BIT,
53 } UNI_AUDIO_IN_ENDIAN;
54
58 typedef enum {
59 PCM_LENGTH_24BIT,
60 PCM_LENGTH_20BIT,
61 PCM_LENGTH_16BIT,
62 PCM_LENGTH_32BIT = 8,
63 } UNI_AUDIO_IN_I2S_PCM_LENGTH;
64
68 typedef enum {
69 DATA_FORMAT_I2S,
70 DATA_FORMAT_LEFT_JUSTIFIED,
71 DATA_FORMAT_RIGHT_JUSTIFIED,
72 DATA_FORMAT_TDM64,
73 DATA_FORMAT_TDM128,
74 DATA_FORMAT_TDM256,
75 } UNI_AUDIO_IN_I2S_DATA_FORMAT;
76
80 typedef enum {
81 CLK_MODE_MASTER,
82 CLK_MODE_SLAVE
83 } UNI_AUDIO_IN_I2S_CLOCK_MODE;
84
88 typedef enum {
89 BCLK_MODE_32FS,
90 BCLK_MODE_64FS,
91 BCLK_MODE_128FS, // only for tdm
92 BCLK_MODE_256FS, // only for tdm
93 } UNI_AUDIO_IN_I2S_BCLK_MODE;
94
98 typedef struct {
99 UNI_AUDIO_IN_I2S_PCM_LENGTH pcm_length;
100 UNI_AUDIO_IN_I2S_DATA_FORMAT data_format;
101 UNI_AUDIO_IN_I2S_CLOCK_MODE clk_mode;
102 UNI_AUDIO_IN_I2S_BCLK_MODE bclk_sel;
103 UNI_AUDIO_IN_SAMPLE_RATE i2s_fs;
104 } UNI_AUDIO_IN_I2S_PARAM;
105
109 typedef enum {
110 FSYNC_MODE_LONG,
111 FSYNC_MODE_SHORT,
112 } UNI_AUDIO_IN_FSYNC_MODE;
113
117 typedef struct {
118 UNI_AUDIO_IN_I2S_PARAM i2s;
119 UNI_AUDIO_IN_FSYNC_MODE fsync_mode;
120 } UNI_AUDIO_IN_INPUT_I2S;
121
125 typedef enum {
126 AUDIO_IN_PDM_1M,
127 AUDIO_IN_PDM_2M
128 } UNI_AUDIO_IN_PDM_CLK;
129
133 typedef struct {
134 UNI_AUDIO_IN_PDM_CLK clk;
135 } UNI_AUDIO_IN_INPUT_PDM;
136
140 typedef struct {
141 unsigned int pga_enable;
142 } UNI_AUDIO_IN_INPUT_SADC;
143
153 int uni_audio_in_set_input_sadc(UNI_AUDIO_IN_INPUT_SADC sadc);
154
164 int uni_audio_in_set_input_pdm(UNI_AUDIO_IN_INPUT_PDM pdm);
165
175 int uni_audio_in_set_input_i2s(UNI_AUDIO_IN_INPUT_I2S i2s);
176
188 int uni_audio_in_set_input_channel(UNI_AUDIO_IN_SOURCE source, unsigned int left_channel, unsigned int right_channel);
189
199 int uni_audio_in_set_i2sin_mode(UNI_AUDIO_IN_I2S_CLOCK_MODE mode);
200
201 /******************************************************/
205 typedef enum {
206 AUDIO_IN_CHANNEL_PCM0 = (1 << 0),
207 AUDIO_IN_CHANNEL_PCM1 = (1 << 1),
208 AUDIO_IN_CHANNEL_LOGFBANK = (1 << 2),
209 AUDIO_IN_CHANNEL_I2SOUT = (1 << 3),
210 } UNI_AUDIO_IN_CHANNEL;
211
212
216 typedef enum {
217 I2S_SOURCE_SADC = 0,
218 I2S_SOURCE_PDM_LEFT,
219 I2S_SOURCE_PDM_RIGHT,
220 I2S_SOURCE_I2SIN_LEFT,
221 I2S_SOURCE_I2SIN_RIGHT
222 } UNI_AUDIO_IN_I2S_SOURCE;
223
227 typedef struct {
228 UNI_AUDIO_IN_I2S_PARAM i2s;
229
230 UNI_AUDIO_IN_I2S_SOURCE left_source;
231 UNI_AUDIO_IN_I2S_SOURCE right_source;
232 } UNI_AUDIO_IN_OUTPUT_I2S;
233
237 typedef enum {
238 PCM_SOURCE_SADC = 0,
239 PCM_SOURCE_PDM,
240 PCM_SOURCE_I2SIN,
241 PCM_SOURCE_FSPEC,
242 } UNI_AUDIO_IN_PCM_SOURCE;
243
247 typedef struct {
248 unsigned int left_buffer;
249 unsigned int right_buffer;
250 unsigned int size;
251
252 unsigned int frame_num;
253 UNI_AUDIO_IN_ENDIAN endian;
254 UNI_AUDIO_IN_PCM_SOURCE source;
255 } UNI_AUDIO_IN_OUTPUT_PCM;
256
260 typedef enum {
261 LOGFBANK_SOURCE_SADC = 0,
262 LOGFBANK_SOURCE_PDM_LEFT,
263 LOGFBANK_SOURCE_PDM_RIGHT,
264 LOGFBANK_SOURCE_I2SIN_LEFT,
265 LOGFBANK_SOURCE_I2SIN_RIGHT
266 } UNI_AUDIO_IN_LOGFBANK_SOURCE;
267
271 typedef struct {
272 unsigned int buffer;
273 unsigned int size;
274
275 unsigned int frame_num;
276 UNI_AUDIO_IN_ENDIAN endian;
277 UNI_AUDIO_IN_LOGFBANK_SOURCE source;
278 } UNI_AUDIO_IN_OUTPUT_LOGFBANK;
279
283 typedef struct {
284 unsigned int buffer;
285 unsigned int size;
286
287 unsigned int frame_num;
288 UNI_AUDIO_IN_ENDIAN endian;
289 UNI_AUDIO_IN_LOGFBANK_SOURCE source;
290 } UNI_AUDIO_IN_OUTPUT_SPECTRUM;
301 int uni_audio_in_set_output_pcm(UNI_AUDIO_IN_CHANNEL channel, UNI_AUDIO_IN_OUTPUT_PCM pcm);
302
312 int uni_audio_in_set_output_i2s(UNI_AUDIO_IN_OUTPUT_I2S i2s);
313
323 int uni_audio_in_set_output_logfbank(UNI_AUDIO_IN_OUTPUT_LOGFBANK logfbank);
324
335 int uni_audio_in_set_output_spectrum(UNI_AUDIO_IN_CHANNEL channel, UNI_AUDIO_IN_OUTPUT_SPECTRUM spectrum);
336
347 int uni_audio_in_set_update_addr(UNI_AUDIO_IN_CHANNEL channel, void *value);
348
358 int uni_audio_in_set_i2sout_mode(UNI_AUDIO_IN_I2S_CLOCK_MODE mode);
359
360 /******************************************************/
364 typedef enum {
365 AUDIO_IN_GAIN_0dB,
366 AUDIO_IN_GAIN_6dB,
367 AUDIO_IN_GAIN_12dB,
368 AUDIO_IN_GAIN_18dB,
369 AUDIO_IN_GAIN_24dB,
370 AUDIO_IN_GAIN_30dB,
371 AUDIO_IN_GAIN_36dB,
372 AUDIO_IN_GAIN_42dB,
373 AUDIO_IN_GAIN_48dB,
374 AUDIO_IN_GAIN_54dB,
375 } UNI_AUDIO_IN_GAIN;
376
387 int uni_audio_in_set_rough_gain(UNI_AUDIO_IN_SOURCE source, UNI_AUDIO_IN_GAIN gain);
388
399 int uni_audio_in_set_refined_gain(UNI_AUDIO_IN_SOURCE source, int gain);
400
410 int uni_audio_in_get_rough_gain(UNI_AUDIO_IN_SOURCE source);
411
421 int uni_audio_in_get_frame_rough_gain(UNI_AUDIO_IN_CHANNEL channel);
422
423 /******************************************************/
427 typedef struct {
428 unsigned short chipping_1;
429 unsigned short chipping_2;
430 unsigned short chipping_3;
431 unsigned short chipping_4;
432 } UNI_AUDIO_IN_FFTVAD_CHIPPING;
433
434 typedef struct {
435 unsigned char w1;
436 unsigned char w2;
437 unsigned char w3;
438 } UNI_AUDIO_IN_FFTVAD_W;
439
443 typedef struct {
444 unsigned int vad_state_l;
445 unsigned int vad_state_m;
446 unsigned int vad_state_h;
447 unsigned short vad_state_index;
448 } UNI_AUDIO_IN_FFTVAD_STATE;
449
460 int uni_audio_in_set_fftvad_curve_1(unsigned short curve_a, unsigned short curve_b);
461
472 int uni_audio_in_set_fftvad_curve_2(unsigned short curve_a, unsigned short curve_b);
483 int uni_audio_in_set_fftvad_curve_3(short curve_a, short curve_b);
494 int uni_audio_in_set_fftvad_curve_4(unsigned short curve_a, unsigned short curve_b);
495
505 int uni_audio_in_set_fftvad_curve_5(unsigned short curve);
506
516 int uni_audio_in_set_fftvad_silence_num(unsigned char silence_num);
517
527 int uni_audio_in_set_fftvad_count_num(unsigned char count_num);
528
538 int uni_audio_in_set_fftvad_chipping(UNI_AUDIO_IN_FFTVAD_CHIPPING chipping);
539
549 int uni_audio_in_set_fftvad_w(UNI_AUDIO_IN_FFTVAD_W fftvad_w);
550
560 int uni_audio_in_set_fftvad_startnum(unsigned short start_num);
561
573 int uni_audio_in_set_fftvad_enable(unsigned int vad_enable, unsigned int zcr_enable, unsigned int frame_num);
574
583 int uni_audio_in_get_fftvad_state(UNI_AUDIO_IN_FFTVAD_STATE *state);
584
591 unsigned int uni_audio_in_get_distance_city(void);
592
599 unsigned int uni_audio_in_get_distance_noise_smooth(void);
600
607 unsigned int uni_audio_in_get_fftvad_zcr_reg(void);
608
609 /******************************************************/
610
614 typedef enum {
615 AUDIO_IN_IRQ_PCM0_DONE = (1 << 0),
616 AUDIO_IN_IRQ_PCM1_DONE = (1 << 1),
617 AUDIO_IN_IRQ_LOGFBANK_DONE = (1 << 2),
618 AUDIO_IN_IRQ_FFTVAD_START = (1 << 16),
619 AUDIO_IN_IRQ_FFTVAD_FINISH = (1 << 17),
620 AUDIO_IN_IRQ_SADC_EVAD_DONE = (1 << 18),
621 AUDIO_IN_IRQ_PDM_EVAD_DONE = (1 << 19),
622 AUDIO_IN_IRQ_I2S_EVAD_DONE = (1 << 20),
623 AUDIO_IN_IRQ_WRITE_START = (1 << 21),
624 } UNI_AUDIO_IN_IRQ_TYPE;
625
636 int uni_audio_in_set_interrupt_enable(UNI_AUDIO_IN_IRQ_TYPE type, unsigned int enable);
637 UNI_AUDIO_IN_IRQ_TYPE uni_audio_in_get_interrupt_enable_state(void);
638
649 int uni_audio_in_get_sdc_addr(UNI_AUDIO_IN_CHANNEL channel, unsigned int *sdc_addr);
650
651 /******************************************************/
655 typedef struct {
656 unsigned int evad_enable;
657 unsigned int zcr_enable;
658
659 unsigned int state_valid_enable;
660 } UNI_AUDIO_IN_EVAD;
661
665 typedef struct {
666 unsigned int evad_low_threshold;
667 unsigned int evad_high_threshold;
668 unsigned int evad_zcr_threshold;
669 } UNI_AUDIO_IN_EVAD_THRESHOLD;
670
681 int uni_audio_in_set_evad_enable(UNI_AUDIO_IN_SOURCE source, UNI_AUDIO_IN_EVAD evad);
682
693 int uni_audio_in_set_evad_threshold(UNI_AUDIO_IN_SOURCE source, UNI_AUDIO_IN_EVAD_THRESHOLD threshold);
694
695 /******************************************************/
699 typedef enum {
700 AUDIO_IN_ADCIN_PGA_REAR = 0,
701 AUDIO_IN_ADCIN_PGA_FRONT = 1,
702 } UNI_AUDIO_IN_ADC_IN;
703
713 int uni_audio_in_set_pga_gain(unsigned int gain);
714
724 int uni_audio_in_set_pga_enable(unsigned int enable);
725
735 int uni_audio_in_set_adc_in(UNI_AUDIO_IN_ADC_IN adc_in);
736
737 /******************************************************/
741 typedef enum {
742 AUDIO_IN_FFTVAD_START = (1 << 0),
743 AUDIO_IN_FFTVAD_FINISH = (1 << 1),
744 } UNI_AUDIO_IN_FFTVAD_STATUS;
745
746 typedef int (*UNI_AUDIO_IN_CONFIG_CB)(void);
747 typedef int (*UNI_AUDIO_IN_RECORD_CB)(UNI_AUDIO_IN_CHANNEL channel, unsigned int *sdc_addr);
748 typedef int (*UNI_AUDIO_IN_UPDATE_CB)(UNI_AUDIO_IN_CHANNEL channel, unsigned int *saved_addr);
749 typedef int (*UNI_AUDIO_IN_ENGVAD_CB)(UNI_AUDIO_IN_SOURCE source);
750 typedef int (*UNI_AUDIO_IN_FFTVAD_CB)(UNI_AUDIO_IN_FFTVAD_STATUS status);
751
755 typedef enum {
756 AUDIO_IN_I2SCLK_1M = 1,
757 AUDIO_IN_I2SCLK_2M = 2,
758 AUDIO_IN_I2SCLK_12M = 3,
759 AUDIO_IN_I2SCLK_4M = 4,
760 } UNI_AUDIO_IN_I2S_CLOCK;
761
765 typedef struct {
766 UNI_AUDIO_IN_RECORD_CB record_callback;
767 UNI_AUDIO_IN_CONFIG_CB config_callback;
768 UNI_AUDIO_IN_UPDATE_CB update_callback;
769 UNI_AUDIO_IN_ENGVAD_CB engvad_callback;
770 UNI_AUDIO_IN_FFTVAD_CB fftvad_callback;
771 } UNI_AUDIO_IN_CONFIG;
772
779 int uni_audio_in_init(UNI_AUDIO_IN_CONFIG config);
780
784 int uni_audio_in_exit(void);
785
795 int uni_audio_in_set_i2s_clock(UNI_AUDIO_IN_I2S_CLOCK clock);
796
807 int uni_audio_in_set_dc_enable(UNI_AUDIO_IN_SOURCE source, unsigned int enable);
808
819 int uni_audio_in_set_logfbank_enable(unsigned int module_enable, unsigned int hmt_enable);
820
830 int uni_audio_in_set_data_auto_produce_enable(int enable);
831 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_audio_out.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_audio_out.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_audio_out.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_AUDIO_OUT_H__
25 #define __UNI_AUDIO_OUT_H__
26
27 #include "autoconf.h"
28 #include "uni_audio_out/uni_audio_out_v2.h"
29
30 #endif /* __UNI_AUDIO_OUT_H__ */
31


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_audio_out/uni_audio_out_v2.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_audio_out
uni_audio_out_v2.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_audio_out_v2.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef _UNI_AUDIO_OUT_V2_H__
25 #define _UNI_AUDIO_OUT_V2_H__
26
27 typedef void (*UNI_AUDIO_OUT_FRAME_CB)(unsigned int saddr, unsigned int eaddr);
28 typedef void (*UNI_AUDIO_OUT_FRAME_OVER_CB)(void);
29
33 typedef struct {
34 unsigned char *buffer0;
35 unsigned char *buffer1;
36 unsigned int size;
37 } UNI_AUDIO_OUT_BUFFER;
38
42 typedef struct {
43 unsigned int sample_rate;
44 unsigned char channels;
45 unsigned char bits;
46 unsigned char interlace;
47 unsigned char endian;
48 } UNI_AUDIO_OUT_PCM;
49
53 typedef struct {
54 UNI_AUDIO_OUT_FRAME_CB new_frame_callback;
55 UNI_AUDIO_OUT_FRAME_OVER_CB frame_over_callback;
56 } UNI_AUDIO_OUT_CALLBACK;
57
61 typedef struct {
62 unsigned int saddr;
63 unsigned int eaddr;
64 } UNI_AUDIO_OUT_FRAME;
65
69 typedef enum {
70 UNI_AUDIO_OUT_STEREO_C = 0,
71 UNI_AUDIO_OUT_LEFT_C,
72 UNI_AUDIO_OUT_RIGHT_C,
73 UNI_AUDIO_OUT_MONO_C,
74 } UNI_AUDIO_OUT_CHANNEL;
75
84 int uni_audio_out_alloc_playback(unsigned char route);
85
94 int uni_audio_out_free(int handle);
95
105 int uni_audio_out_config_buffer(int handle, UNI_AUDIO_OUT_BUFFER *conf);
106
116 int uni_audio_out_config_pcm(int handle, UNI_AUDIO_OUT_PCM *conf);
117
127 int uni_audio_out_config_cb(int handle, UNI_AUDIO_OUT_CALLBACK *cb);
128
138 int uni_audio_out_push_frame(int handle, UNI_AUDIO_OUT_FRAME *frame);
139
148 int uni_audio_out_drain_frame(int handle);
149
159 int uni_audio_out_set_db(int handle, short db);
160
170 int uni_audio_out_get_db(int handle, short *db);
171
181 int uni_audio_out_set_mute(int handle, int mute);
182
192 int uni_audio_out_get_mute(int handle);
193
203 int uni_audio_out_set_channel(int handle, UNI_AUDIO_OUT_CHANNEL channel);
204
213 int uni_audio_out_init(int aout_mode);
214
222 int uni_audio_out_exit(void);
223
232 int uni_audio_out_suspend(int handle);
233
241 int uni_audio_out_resume(int handle);
242 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_baud_rate_check.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_baud_rate_check.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_baud_rate_check.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_BAUD_RATE_CHECK_H__
25 #define __UNI_BAUD_RATE_CHECK_H__
26
30 typedef struct {
31 int port;
32 int width;
33 int timeout;
34 } uni_brc_info_t;
35
47 int uni_brc_start(int timeout_ms, uni_brc_info_t *brc_info);
48
57 int uni_brc_calculate_uart_freq(int width, int baud);
58
70 int uni_brc_calculate_uart_div_dlf(int width, int *div, int *dlf);
71
72 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_cache.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_cache.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_cache.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_CACHE_H__
25 #define __UNI_CACHE_H__
26
27 #include <driver/uni_icache.h>
28 #include <driver/uni_dcache.h>
29
30 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_clock.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_clock.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_clock.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_CLOCK_H__
25 #define __UNI_CLOCK_H__
26
27 #include "autoconf.h"
28 #include "uni_clock/uni_clock_v2.h"
29
30 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_clock/uni_clock_v2.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_clock
uni_clock_v2.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_clock_v2.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_CLOCK_V2_H__
25 #define __UNI_CLOCK_V2_H__
26
27 #include <stdint.h>
28
29 #define UNI_CLOCK_PMU_INHIBIT_NORM (0x18)
30 #define UNI_CLOCK_PMU_INHIBIT_SET (0x1c)
31 #define UNI_CLOCK_PMU_INHIBIT_CLR (0x20)
32 #define UNI_CLOCK_PMU_DTO_CONFIG0 (0x24)
33 #define UNI_CLOCK_PMU_DIV_CONFIG0 (0x80)
34 #define UNI_CLOCK_PMU_DIV_CONFIG1 (0x84)
35 #define UNI_CLOCK_PMU_DIV_CONFIG2 (0x88)
36 #define UNI_CLOCK_PMU_SOURCE_SEL (0x8c)
37 #define UNI_CLOCK_PMU_TCI_ONFIG0 (0x104)
38 #define UNI_CLOCK_PMU_SOURCE_SEL1 (0x108)
39
40 #define UNI_CLOCK_MCU_INHIBIT_NORM (0x18)
41 #define UNI_CLOCK_MCU_INHIBIT_SET (0x1c)
42 #define UNI_CLOCK_MCU_INHIBIT_CLR (0x20)
43 #define UNI_CLOCK_MCU_DTO_CONFIG0 (0x24)
44 #define UNI_CLOCK_MCU_DTO_CONFIG1 (0x28)
45 #define UNI_CLOCK_MCU_DIV_CONFIG0 (0x80)
46 #define UNI_CLOCK_MCU_DIV_CONFIG1 (0x84)
47 #define UNI_CLOCK_MCU_SOURCE_SEL (0x88)
48 #define UNI_CLOCK_DTO_BASE (0x24)
49
53 typedef enum {
54 CLOCK_MODULE_RTC = 0,
55 CLOCK_MODULE_PMU = 1,
56 CLOCK_MODULE_AUDIO_IN_SYS = 2,
57 CLOCK_MODULE_FFT = 3,
58 CLOCK_MODULE_GPIO = 4,
59 CLOCK_MODULE_HW_I2C = 5,
60 CLOCK_MODULE_SRAM = 6,
61 CLOCK_MODULE_AUDIO_IN_ADC = 7,
62 CLOCK_MODULE_AUDIO_IN_PDM = 8,
63 CLOCK_MODULE_OSC_REF = 9,
64
65 CLOCK_MODULE_SCPU = 10,
66 CLOCK_MODULE_AUDIO_PLAY = 11,
67 CLOCK_MODULE_NPU = 12,
68 CLOCK_MODULE_FLASH_SPI = 13,
69 CLOCK_MODULE_GENERAL_SPI = 14,
70 CLOCK_MODULE_AUDIO_LODAC = 15,
71 CLOCK_MODULE_UART0_UART1 = 16,
72 CLOCK_MODULE_UART0 = 17,
73 CLOCK_MODULE_UART1 = 18,
74 CLOCK_MODULE_I2C0_I2C1 = 19,
75 CLOCK_MODULE_I2C0 = 20,
76 CLOCK_MODULE_I2C1 = 21,
77 CLOCK_MODULE_TIMER_WDT = 22,
78 CLOCK_MODULE_TIMER = 23,
79 CLOCK_MODULE_WDT = 24,
80 CLOCK_MODULE_DMA = 25,
81
82 CLOCK_MODULE_MAX = 26,
83 } UNI_CLOCK_MODULE;
84
88 typedef enum {
89 CLOCK_SOURCE_24M_PLL = 0,
90 CLOCK_SOURCE_32K = 14,
91 CLOCK_SOURCE_32K_PLL = 15,
92 CLOCK_SOURCE_24M = 16,
93 CLOCK_SOURCE_PLL_DTO = 17,
94 CLOCK_SOURCE_1M_12M = 18,
95 CLOCK_SOURCE_PIN_IN = 26,
96 CLOCK_SOURCE_1M_INPUT= 27,
97 CLOCK_SOURCE_1M = 28,
98 CLOCK_SOURCE_OSC_PLL = 29,
99 } UNI_CLOCK_SOURCE;
100
104 typedef struct {
105 UNI_CLOCK_SOURCE source;
106 uint8_t clk;
107 } UNI_CLOCK_SOURCE_TABLE;
108
112 typedef enum {
113 MODULE_SOURCE_1M_12M = 0,
114 MODULE_SOURCE_24M_PLL = 1,
115 MODULE_SOURCE_32K = 2,
116
117 MODULE_SOURCE_ADC_SYS = 3,
118 MODULE_SOURCE_ADC_32K = 4,
119
120 MODULE_SOURCE_PDM_SYS = 5,
121 MODULE_SOURCE_PDM_OSC_1M = 6,
122
123 MODULE_SOURCE_ERROR = -1,
124 } UNI_CLOCK_MODULE_SOURCE;
125
129 typedef struct {
130 unsigned int pll_enable;
131 unsigned int pll_in;
132 unsigned int pll_fvco;
133 unsigned int pll_out;
134 unsigned int pll_div_in;
135 unsigned int pll_div_fb;
136 unsigned int pll_icpsel;
137 unsigned int pll_bwsel_lpf;
138 unsigned int pll_vco_subband;
139 unsigned int pll_div_out;
140
141 unsigned int pll_itrim;
142 unsigned int pll_vco_trim;
143 unsigned int pll_2nd3nd_lpf;
144 unsigned int pll_lock_tiehi;
145 } UNI_CLOCK_PLL;
146
150 typedef struct {
151 uint8_t addr;
152 } UNI_CLOCK_DTO;
153
157 typedef struct {
158 uint8_t addr;
159 uint8_t offs;
160 uint16_t mask;
161 } UNI_CLOCK_DIV;
162
171 void uni_clock_set_module_enable(UNI_CLOCK_MODULE module, unsigned int enable);
172
173 /*****************************************************/
181 int uni_clock_set_module_source(UNI_CLOCK_MODULE module, UNI_CLOCK_MODULE_SOURCE source);
182
190 void uni_clock_set_source(UNI_CLOCK_SOURCE_TABLE *source_table);
191
199 UNI_CLOCK_MODULE_SOURCE uni_clock_get_module_source(UNI_CLOCK_MODULE module);
200
208 unsigned int uni_clock_get_source(UNI_CLOCK_SOURCE source);
209
218 void uni_clock_set_div(UNI_CLOCK_MODULE module, int div);
219
227 int uni_clock_get_div(UNI_CLOCK_MODULE module);
228
238 void uni_clock_set_dto(UNI_CLOCK_MODULE module, unsigned int dto, int enable);
239
247 unsigned int uni_clock_get_dto(UNI_CLOCK_MODULE module);
248
256 void uni_clock_set_pll(UNI_CLOCK_PLL *pll);
257
265 void uni_clock_set_module_snpu_enable(int enable);
266
274 int uni_clock_get_module_enable(UNI_CLOCK_MODULE module);
275
283 unsigned int uni_clock_get_module_frequence(UNI_CLOCK_MODULE module);
284 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_dcache.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_dcache.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_dcache.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_DCACHE_H__
25 #define __UNI_DCACHE_H__
26
27 #include <soc.h>
28 #include <common.h>
29
33 void uni_dcache_enable(void);
34
38 void uni_dcache_disable (void);
39
43 void uni_dcache_clean(void);
44
48 void uni_dcache_invalid(void);
49
53 void uni_dcache_clean_invalid(void);
54
61 void uni_dcache_invalid_range (uint32_t *addr, int32_t dsize);
62
69 void uni_dcache_clean_range (uint32_t *addr, int32_t dsize);
70
77 void uni_dcache_clean_invalid_range(uint32_t *addr, int32_t dsize);
78
82 void uni_dcache_enable_profile(void);
83
87 void uni_dcache_disable_profile(void);
88
92 void uni_dcache_reset_profile(void);
93
99 uint32_t uni_dcache_get_access_time(void);
100
106 uint32_t uni_dcache_get_miss_time(void);
107
108 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_delay.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_delay.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_delay.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_DELAY_H__
25 #define __UNI_DELAY_H__
26
30 void uni_delay_init(void);
31
37 void uni_udelay(unsigned int us);
38
44 void uni_mdelay(unsigned int ms);
45
49 void uni_timer_init(void);
50
51 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_dma_ahb.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_dma_ahb.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_dma_ahb.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_DMA_AHB_H__
25 #define __UNI_DMA_AHB_H__
26
30 typedef enum {
31 UNI_DMA_AHB_BURST_TRANS_LEN_1 = 0,
32 UNI_DMA_AHB_BURST_TRANS_LEN_4,
33 UNI_DMA_AHB_BURST_TRANS_LEN_8,
34 UNI_DMA_AHB_BURST_TRANS_LEN_16,
35 UNI_DMA_AHB_BURST_TRANS_LEN_32,
36 UNI_DMA_AHB_BURST_TRANS_LEN_64,
37 UNI_DMA_AHB_BURST_TRANS_LEN_128,
38 UNI_DMA_AHB_BURST_TRANS_LEN_256,
39 UNI_DMA_AHB_BURST_TRANS_LEN_512,
40 UNI_DMA_AHB_BURST_TRANS_LEN_1024
41 }UNI_DMA_AHB_BURST_SIZE;
42
46 typedef enum {
47 UNI_DMA_AHB_CH_CTL_L_INC = 0,
48 UNI_DMA_AHB_CH_CTL_L_NOINC
49 }UNI_DMA_AHB_ADDRESS_UPDATE;
50
54 typedef enum {
55 UNI_DMA_AHB_HS_SEL_HW = 0,
56 UNI_DMA_AHB_HS_SEL_SW
57 }UNI_AHB_DMA_HANDSHAKE_SELECT;
58
62 typedef enum {
63 UNI_DMA_AHB_TT_FC_MEM_TO_MEM_DMAC = 0,
64 UNI_DMA_AHB_TT_FC_MEM_TO_PER_DMAC,
65 UNI_DMA_AHB_TT_FC_PER_TO_MEM_DMAC,
66 UNI_DMA_AHB_TT_FC_PER_TO_PER_DMAC,
67 UNI_DMA_AHB_TT_FC_PER_TO_MEM_SRC,
68 UNI_DMA_AHB_TT_FC_PER_TO_PER_SRC,
69 UNI_DMA_AHB_TT_FC_MEM_TO_PER_DST,
70 UNI_DMA_AHB_TT_FC_PER_TO_PER_DST
71 }UNI_DMA_AHB_FLOW_CONTROL;
72
76 typedef enum {
77 UNI_DMA_AHB_TRANS_WIDTH_8 = 0,
78 UNI_DMA_AHB_TRANS_WIDTH_16,
79 UNI_DMA_AHB_TRANS_WIDTH_32,
80 UNI_DMA_AHB_TRANS_WIDTH_64,
81 UNI_DMA_AHB_TRANS_WIDTH_128,
82 UNI_DMA_AHB_TRANS_WIDTH_256,
83 UNI_DMA_AHB_TRANS_WIDTH_512,
84 UNI_DMA_AHB_TRANS_WIDTH_MAX = UNI_DMA_AHB_TRANS_WIDTH_512
85 }UNI_DMA_AHB_TRANSFRE_WIDTH;
86
90 typedef enum {
91 UNI_DMA_AHB_MASTER_1,
92 UNI_DMA_AHB_MASTER_2
93 }UNI_DMA_AHB_MASTER_SELECT;
94
98 typedef struct {
99 UNI_DMA_AHB_TRANSFRE_WIDTH trans_width;
100
101 UNI_DMA_AHB_BURST_SIZE src_msize;
102 UNI_DMA_AHB_ADDRESS_UPDATE src_addr_update;
103 unsigned int src_hs_per;
104 UNI_DMA_AHB_MASTER_SELECT src_master_select;
105 UNI_AHB_DMA_HANDSHAKE_SELECT src_hs_select;
106
107 UNI_DMA_AHB_BURST_SIZE dst_msize;
108 UNI_DMA_AHB_ADDRESS_UPDATE dst_addr_update;
109 unsigned int dst_hs_per;
110 UNI_DMA_AHB_MASTER_SELECT dst_master_select;
111 UNI_AHB_DMA_HANDSHAKE_SELECT dst_hs_select;
112
113 UNI_DMA_AHB_FLOW_CONTROL flow_ctrl;
114 }UNI_DMA_AHB_CH_CONFIG;
115
119 void uni_dma_init(void);
120
128 int uni_dma_select_channel(void);
129
142 int uni_dma_xfer(void *dst, void *src, int len, int channel, UNI_DMA_AHB_CH_CONFIG *config);
143
153 int uni_dma_wait_complete(int channel);
154
164 int uni_dma_channel_abort(int channel);
165
176 int uni_dma_wait_complete_timeout(int channel, unsigned int timeout_ms);
177
191 int uni_dma_xfer_poll(void *dst, void *src, int len, int channel, UNI_DMA_AHB_CH_CONFIG *config);
192
200 void uni_dma_register_complete_callback(int channel, void *func, void *param);
201
215 int uni_dma_xfer_int(void *dst, void *src, int len, int channel, UNI_DMA_AHB_CH_CONFIG *config);
216
217
218 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_flash.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_flash.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_flash.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_FLASH_H__
25 #define __UNI_FLASH_H__
26
27 #include "autoconf.h"
28 #include "uni_flash_common.h"
29
30 typedef struct uni_flash_dev UNI_FLASH_DEV;
31
35 typedef struct uni_flash_dev {
36 UNI_FLASH_DEV *(*init) (int bus, int cs, int speed, int mode);
37 int (*readdata)(unsigned int addr, unsigned char *data, unsigned int len);
38 int (*chiperase) (void);
39 int (*erasedata)(unsigned int addr, unsigned int len);
40 int (*pageprogram)(unsigned int addr, unsigned char *data, unsigned int len);
41 void (*sync)(void);
42 void (*test)(int argc, char *argv[]);
43 void (*calcblockrange)(unsigned int addr, unsigned int len, unsigned int *pstart, unsigned int *pend);
44 int (*badinfo)(void);
45 int (*pageprogram_yaffs2)(unsigned int addr, unsigned char *data, unsigned int len);
46 int (*readoob)(unsigned int addr, unsigned char *data, unsigned int len);
47 int (*writeoob)(unsigned int addr, unsigned char *data, unsigned int len);
48 char *(*gettype)(void);
49 int (*getinfo)(enum uni_flash_info flash_info);
50 int (*write_protect_mode)(void);
51 int (*write_protect_status)(void);
52 int (*write_protect_lock)(unsigned int addr);
53 int (*write_protect_unlock)(void);
54 #ifdef CONFIG_MTD_TESTS
55 int (*readdata_noskip)(unsigned int addr, unsigned char *data, unsigned int len);
56 void (*erasedata_noskip)(unsigned int addr, unsigned int len);
57 int (*pageprogram_noskip)(unsigned int addr, unsigned char *data, unsigned int len);
58 #endif
59 int (*otp_lock)(void);
60 int (*otp_status)(unsigned char *data);
61 int (*otp_erase)(void);
62 int (*otp_write)(unsigned int addr, unsigned char *data, unsigned int len);
63 int (*otp_read)(unsigned int addr, unsigned char* data, unsigned int len);
64 int (*otp_get_region)(unsigned int *region);
65 int (*otp_set_region)(unsigned int region);
66 int (*block_isbad)(unsigned int addr);
67 int (*block_markbad)(unsigned int addr);
68 int (*calc_phy_offset)(unsigned int start, unsigned int logic_offset, unsigned int *phy_offset);
69 } UNI_FLASH_DEV;
70
83 UNI_FLASH_DEV *uni_ext_spi_flash_probe(unsigned int busnum, unsigned int cs,
84 unsigned int max_hz, unsigned int spi_mode);
85
98 UNI_FLASH_DEV *uni_spi_flash_probe(unsigned int busnum, unsigned int cs,
99 unsigned int max_hz, unsigned int spi_mode);
100
113 int uni_spi_flash_readdata(UNI_FLASH_DEV *devp, unsigned int addr, unsigned char *data, unsigned int len);
114
124 int uni_spi_flash_chiperase (UNI_FLASH_DEV *devp);
125
137 int uni_spi_flash_erasedata(UNI_FLASH_DEV *devp, unsigned int addr, unsigned int len);
138
151 int uni_spi_flash_pageprogram(UNI_FLASH_DEV *devp, unsigned int addr, unsigned char *data, unsigned int len);
152
158 void uni_spi_flash_sync(UNI_FLASH_DEV *devp);
159 #ifdef CONFIG_MTD_TESTS
160
172 int uni_spi_flash_readdata_noskip(UNI_FLASH_DEV *devp, unsigned int addr, unsigned char *data, unsigned int len);
173
185 void uni_spi_flash_erasedata_noskip(UNI_FLASH_DEV *devp, unsigned int addr, unsigned int len);
186
199 int uni_spi_flash_pageprogram_noskip(UNI_FLASH_DEV *devp, unsigned int addr, unsigned char *data, unsigned int len);
200 #endif
201
209 void uni_spi_flash_test(UNI_FLASH_DEV *devp, int argc, char *argv[]);
210
220 void uni_spi_flash_calcblockrange(UNI_FLASH_DEV *devp, unsigned int addr, unsigned int len, unsigned int *pstart, unsigned int *pend);
221
231 int uni_spi_flash_badinfo(UNI_FLASH_DEV *devp);
232
245 int uni_spi_flash_pageprogram_yaffs2(UNI_FLASH_DEV *devp, unsigned int addr, unsigned char *data, unsigned int len);
246
259 int uni_spi_flash_readoob(UNI_FLASH_DEV *devp, unsigned int addr, unsigned char *data, unsigned int len);
260
273 int uni_spi_flash_writeoob(UNI_FLASH_DEV *devp, unsigned int addr, unsigned char *data, unsigned int len);
274
283 char * uni_spi_flash_gettype(UNI_FLASH_DEV *devp);
284
295 int uni_spi_flash_getinfo(UNI_FLASH_DEV *devp, enum uni_flash_info flash_info);
296
306 int uni_spi_flash_write_protect_mode(UNI_FLASH_DEV *devp);
307
317 int uni_spi_flash_write_protect_status(UNI_FLASH_DEV *devp);
318
329 int uni_spi_flash_write_protect_lock(UNI_FLASH_DEV *devp, unsigned long addr);
330
340 int uni_spi_flash_write_protect_unlock(UNI_FLASH_DEV *devp);
341
353 int uni_spi_flash_block_isbad(UNI_FLASH_DEV *devp, unsigned int addr);
354
365 int uni_spi_flash_block_markbad(UNI_FLASH_DEV *devp, unsigned int addr);
366
376 int uni_spi_flash_otp_lock(UNI_FLASH_DEV *devp);
377
388 int uni_spi_flash_otp_status(UNI_FLASH_DEV *devp, unsigned char *data);
389
399 int uni_spi_flash_otp_erase(UNI_FLASH_DEV *devp);
400
413 int uni_spi_flash_otp_write(UNI_FLASH_DEV *devp, unsigned int addr, unsigned char *data, unsigned int len);
414
427 int uni_spi_flash_otp_read(UNI_FLASH_DEV *devp, unsigned int addr, unsigned char *data, unsigned int len);
428
439 int uni_spi_flash_otp_get_region(UNI_FLASH_DEV *devp, unsigned int *region);
440
451 int uni_spi_flash_otp_set_region(UNI_FLASH_DEV *devp, unsigned int region);
452
465 int uni_spi_flash_calc_phy_offset(UNI_FLASH_DEV *devp, unsigned int phy_start, unsigned int logic_offset, unsigned int *phy_offset);
466
480 int uni_spi_flash_logic_read(UNI_FLASH_DEV *devp, unsigned int phy_start, unsigned int logic_offs, void *buf, unsigned int len);
481
495 int uni_spi_flash_logic_program(UNI_FLASH_DEV *devp, unsigned int phy_start, unsigned int logic_offs, void *buf, unsigned int len);
496
508 int uni_spi_flash_area_erase(UNI_FLASH_DEV *devp, unsigned int phy_start, unsigned int phy_end);
509
527 int uni_xip_init(unsigned int cmd, unsigned int cmd_len, unsigned int cmd_mode,
528 unsigned int addr_len, unsigned int addr_mode,
529 unsigned int mode_code, unsigned int mode_code_enable,
530 unsigned int wait_cycles, unsigned int spi_mode);
531
539 int uni_spinor_flash_init(void);
540
552 int uni_spinor_flash_readdata(unsigned int addr, unsigned char *data, unsigned int len);
553
562 char *uni_spinor_flash_gettype(void);
563
573 int uni_spinor_flash_getinfo(enum uni_flash_info flash_info);
574
582 int uni_spinor_flash_chiperase(void);
583
595 int uni_spinor_flash_erasedata(unsigned int addr, unsigned int len);
596
608 int uni_spinor_flash_pageprogram(unsigned int addr, unsigned char *data, unsigned int len);
616 int uni_spinor_flash_deep_powerdown(void);
617
625 int uni_spinor_flash_release_powerdown(void);
626
634 int uni_spinor_flash_exit(void);
635
643 int uni_spinor_flash_suspend(void);
644
652 int uni_spinor_flash_resume(void);
653
661 int uni_generic_spi_norflash_init(void);
662
674 int uni_generic_spi_norflash_readdata(unsigned int addr, unsigned char *data, unsigned int len);
675
686 int uni_generic_spi_norflash_erasedata(unsigned int addr, unsigned int len);
687
699 int uni_gereric_spi_norflash_pageprogram(unsigned int addr, unsigned char *data, unsigned int len);
700 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_flash_common.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_flash_common.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_flash_common.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_FLASH_COMMON_H__
25 #define __UNI_FLASH_COMMON_H__
26
30 enum {
31 UNI_FLASH_CHIP_TYPE_NOR = 0,
32 UNI_FLASH_CHIP_TYPE_SPINAND,
33 UNI_FLASH_CHIP_TYPE_NAND,
34 UNI_FLASH_CHIP_TYPE_UNKNOWN
35 };
36
40 enum {
41 UNI_FLASH_PROTECT_MODE_NONSUPPORT = 0,
42 UNI_FLASH_PROTECT_MODE_BOTTOM,
43 UNI_FLASH_PROTECT_MODE_TOP
44 };
45
49 enum {
50 UNI_FLASH_MATCH_MODE_NONSUPPORT = 0,
51 UNI_FLASH_MATCH_MODE_ID,
52 UNI_FLASH_MATCH_MODE_BLUR
53 };
54
58 enum uni_flash_info {
59 UNI_FLASH_CHIP_TYPE,
60 UNI_FLASH_CHIP_NAME,
61 UNI_FLASH_CHIP_ID,
62 UNI_FLASH_CHIP_SIZE,
63 UNI_FLASH_BLOCK_SIZE,
64 UNI_FLASH_BLOCK_NUM,
65 UNI_FLASH_SECTOR_SIZE,
66 UNI_FLASH_SECTOR_NUM,
67 UNI_FLASH_PAGE_SIZE,
68 UNI_FLASH_PAGE_NUM,
69 UNI_FLASH_ERASE_SIZE,
70 UNI_FLASH_ERASE_NUM,
71 UNI_FLASH_PROTECT_MODE,
72 UNI_FLASH_MATCH_MODE,
73 };
74
75 #endif /* __UNI_FLASH_COMMON_H__ */
76


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_gpio.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_gpio.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_gpio.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_GPIO_H__
25 #define __UNI_GPIO_H__
26
32 typedef enum {
33 UNI_GPIO_DIRECTION_INPUT = 0,
34 UNI_GPIO_DIRECTION_OUTPUT,
35 UNI_GPIO_DIRECTION_HIZ
36 } UNI_GPIO_DIRECTION;
37
41 typedef enum {
42 UNI_GPIO_LEVEL_LOW = 0,
43 UNI_GPIO_LEVEL_HIGH
44 } UNI_GPIO_LEVEL;
45
49 typedef enum {
50 UNI_GPIO_TRIGGER_EDGE_FALLING = 0x01,
51 UNI_GPIO_TRIGGER_EDGE_RISING = 0x02,
52 UNI_GPIO_TRIGGER_EDGE_BOTH = 0x03,
53 UNI_GPIO_TRIGGER_LEVEL_HIGH = 0x04,
54 UNI_GPIO_TRIGGER_LEVEL_LOW = 0x08,
55 } UNI_GPIO_TRIGGER_EDGE;
56
57 typedef int (*GPIO_CALLBACK)(int port, void *pdata);
58
69 UNI_GPIO_DIRECTION uni_gpio_get_direction(unsigned int port);
70
81 int uni_gpio_set_direction(unsigned int port, UNI_GPIO_DIRECTION direction);
82
91 UNI_GPIO_LEVEL uni_gpio_get_level(unsigned int port);
92
103 int uni_gpio_set_level(unsigned int port, UNI_GPIO_LEVEL level);
104
117 int uni_gpio_enable_trigger(unsigned int port, UNI_GPIO_TRIGGER_EDGE edge, GPIO_CALLBACK callback, void *pdata);
118
128 int uni_gpio_disable_trigger(unsigned int port);
129
141 int uni_gpio_enable_pwm(unsigned int port, unsigned long int period_ns, unsigned long int duty);
142
151 int uni_gpio_disable_pwm(unsigned int port);
152
162 int uni_gpio_clock_test(unsigned int port, unsigned int test_clock);
163
171 int uni_gpio_init(void);
172
180 int uni_gpio_exit(void);
181
189 int uni_gpio_suspend(void);
190
198 int uni_gpio_resume(void);
199
200 #endif /* __UNI_GPIO_H__ */


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_hw_i2c.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_hw_i2c.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_hw_i2c.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_HW_I2C_H__
25 #define __UNI_HW_I2C_H__
26
27 #define HW_I2C_COMMON_REG0 (0xa0)
28 #define HW_I2C_COMMON_REG1 (0xa4)
29 #define HW_I2C_COMMON_REG2 (0xa8)
30 #define HW_I2C_COMMON_REG3 (0xac)
31
35 typedef enum {
36 HW_I2C_RESET_GLOBAL = 0,
37 HW_I2C_RESET_MCU = 1,
38 HW_I2C_RESET_PMU = 2,
39 } UNI_HW_I2C_RESET_TARGET;
40
44 typedef enum {
45 HW_I2C_AUTO_RESET_MODE = 0,
46 HW_I2C_MANUAL_RESET_MODE = 1,
47 } UNI_HW_I2C_RESET_MODE;
48
58 typedef int (*uni_hw_i2c_cb)(void *private, unsigned char status);
59
66 void uni_hw_i2c_request_irq(uni_hw_i2c_cb callback, void *private);
67
72 void uni_hw_i2c_free_irq(void);
73
79 void uni_hw_i2c_set_irq_enable(unsigned char mask);
80
89 int uni_hw_i2c_auto_reset(UNI_HW_I2C_RESET_TARGET target);
90
100 int uni_hw_i2c_set_reset_mode(UNI_HW_I2C_RESET_TARGET target, UNI_HW_I2C_RESET_MODE mode);
101
108 int uni_hw_i2c_enter_config_mode(void);
109
115 void uni_hw_i2c_write_all(unsigned char val);
116
120 void uni_hw_i2c_read_all(void);
121
127 unsigned char uni_hw_i2c_read_reg(unsigned char reg);
128
135 void uni_hw_i2c_write_reg(unsigned char reg, unsigned char val);
136
137 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_i2c.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_i2c.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_i2c.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_I2C_H__
25 #define __UNI_I2C_H__
26
28 #define I2C_STATIC_MAX_COUNT (100)
29
33 typedef enum uni_i2c_slave_event {
34 I2C_SLAVE_RECEIVE_DATA,
35 I2C_SLAVE_REQUESTED_DATA,
36 I2C_SLAVE_STOP
37 } UNI_I2C_SLAVE_EVENT;
38
42 typedef struct uni_i2c_msg {
43 unsigned short addr;
44 unsigned short flags;
45
46 #define I2C_M_RD 0x0001
47 #define I2C_M_START_BYTE 0x0002
48 #define I2C_M_GENERAL_CALL 0x0004
49 #define I2C_M_TEN 0x0010
50 #define I2C_M_RECV_LEN 0x0400
51 #define I2C_M_NO_RD_ACK 0x0800
52 #define I2C_M_IGNORE_NAK 0x1000
53 #define I2C_M_REV_DIR_ADDR 0x2000
54 #define I2C_M_NOSTART 0x4000
55
56 unsigned short len;
57 unsigned char *buf;
58 } UNI_I2C_MSG;
59
70 typedef int (*uni_i2c_slave_cb_t)(UNI_I2C_SLAVE_EVENT event, unsigned char *val, void *private);
71
79 typedef void (*uni_i2c_async_done_cb_t)(void *private);
80
89 int uni_i2c_init(unsigned char bus_id);
90
99 int uni_i2c_exit(unsigned char bus_id);
100
109 int uni_i2c_suspend(unsigned char bus_id);
110
119 int uni_i2c_resume(unsigned char bus_id);
120
131 int uni_gpio_i2c_init(unsigned char bus_id, unsigned int scl_port, unsigned int sda_port);
132
141 void *uni_i2c_open(unsigned char bus_id);
142
152 int uni_i2c_set_speed(unsigned char bus_id, unsigned int speed);
153
164 int uni_i2c_transfer(void *dev, UNI_I2C_MSG *msgs, int num);
165
177 int uni_i2c_write(unsigned char bus_id, unsigned char slv_addr, unsigned char *buf, unsigned short len);
178
192 int uni_i2c_tx(unsigned char bus_id, unsigned char slv_addr, unsigned int reg_address, unsigned char address_width, unsigned char *tx_data, unsigned short len);
193
207 int uni_i2c_async_write(unsigned char bus_id, unsigned char slv_addr, unsigned char *buf,
208 unsigned short len, uni_i2c_async_done_cb_t callback, void *private);
209
225 int uni_i2c_async_tx(unsigned char bus_id, unsigned char slv_addr, unsigned int reg_address, unsigned char address_width,
226 unsigned char *tx_data, unsigned short len, uni_i2c_async_done_cb_t callback, void *private);
227
239 int uni_i2c_read(unsigned char bus_id, unsigned char slv_addr, unsigned char *buf, unsigned short len);
240
254 int uni_i2c_rx(unsigned char bus_id, unsigned char slv_addr, unsigned int reg_address, unsigned char address_width, unsigned char *rx_data, unsigned short len);
255
269 int uni_i2c_async_read(unsigned char bus_id, unsigned char slv_addr, unsigned char *buf,
270 unsigned short len, uni_i2c_async_done_cb_t callback, void *private);
271
287 int uni_i2c_async_rx(unsigned char bus_id, unsigned char slv_addr, unsigned int reg_address, unsigned char address_width,
288 unsigned char *rx_data, unsigned short len, uni_i2c_async_done_cb_t callback, void *private);
289
298 int uni_i2c_close(void *dev);
299
311 void *uni_i2c_slave_open(unsigned char bus_id, unsigned char slv_addr, uni_i2c_slave_cb_t callback, void *private);
312
321 int uni_i2c_slave_close(void *dev);
322
323 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_i2s/uni_i2s_v1.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_i2s
uni_i2s_v1.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_i2s_v1.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_I2S_V1_H__
25 #define __UNI_I2S_V1_H__
26
30 typedef enum {
31 MODULE_I2S_IN,
32 MODULE_REC_OUT,
33 MODULE_I2S_OUT
34 } UNI_I2S_MODULE;
35
39 typedef enum {
40 I2S_MODE_SLAVE,
41 I2S_MODE_MASTER,
42 } UNI_I2S_SINGLE_MODE;
43
47 typedef enum {
48 I2S_MODE_I2S_IN_M_REC_OUT_S,
49 I2S_MODE_I2S_IN_S_REC_OUT_M,
50 I2S_MODE_I2S_IN_S_REC_OUT_S_FROM_I2S_IN,
51 I2S_MODE_I2S_IN_S_REC_OUT_S_FROM_REC_OUT,
52
53 I2S_MODE_I2S_IN_M_I2S_OUT_S,
54 I2S_MODE_I2S_IN_S_I2S_OUT_M,
55 I2S_MODE_I2S_IN_S_I2S_OUT_S_FROM_I2S_IN,
56 I2S_MODE_I2S_IN_S_I2S_OUT_S_FROM_I2S_OUT,
57
58 I2S_MODE_REC_OUT_M_I2S_OUT_S,
59 I2S_MODE_REC_OUT_S_I2S_OUT_M,
60 I2S_MODE_REC_OUT_S_I2S_OUT_S_FROM_REC_OUT,
61 I2S_MODE_REC_OUT_S_I2S_OUT_S_FROM_I2S_OUT,
62 } UNI_I2S_FIVE_WIRE_MODE;
63
67 typedef enum {
68 I2S_IN_MCLK_IN,
69 I2S_IN_MCLK_OUT,
70 REC_OUT_MCLK_IN,
71 REC_OUT_MCLK_OUT,
72 I2S_OUT_MCLK_IN,
73 } UNI_I2S_MCLK_TYPE;
74
78 typedef enum {
79 I2S_IN_BCLK_IN,
80 I2S_IN_BCLK_OUT,
81 REC_OUT_BCLK_IN,
82 REC_OUT_BCLK_OUT,
83 I2S_OUT_BCLK_IN,
84 I2S_OUT_BCLK_OUT
85 } UNI_I2S_BCLK_TYPE;
86
90 typedef enum {
91 I2S_IN_LRCLK_IN,
92 I2S_IN_LRCLK_OUT,
93 REC_OUT_LRCLK_IN,
94 REC_OUT_LRCLK_OUT,
95 I2S_OUT_LRCLK_IN,
96 I2S_OUT_LRCLK_OUT
97 } UNI_I2S_LRCLK_TYPE;
98
109 int uni_i2s_set_single_mode(UNI_I2S_MODULE module, UNI_I2S_SINGLE_MODE mode);
110
120 int uni_i2s_set_five_wire_mode(UNI_I2S_FIVE_WIRE_MODE mode);
121 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_icache.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_icache.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_icache.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_ICACHE_H__
25 #define __UNI_ICACHE_H__
26
27 #include <common.h>
28 #include <soc.h>
29
33 void uni_icache_enable(void);
34
38 void uni_icache_disable(void);
39
43 void uni_icache_enable_profile(void);
44
48 void uni_icache_disable_profile(void);
49
53 void uni_icache_reset_profile(void);
54
60 uint32_t uni_icache_get_access_time(void);
61
67 uint32_t uni_icache_get_miss_time(void);
68
72 void uni_icache_init(void);
73
74 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_irq.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_irq.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_irq.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_IRQ_H__
25 #define __UNI_IRQ_H__
26
27 #include <types.h>
28 #include <soc.h>
29
30 typedef int (*irq_handler_t) (int irq, void *pdata);
31
35 void uni_disable_all_interrupt(void);
36
40 void uni_irq_init(void);
41
47 void uni_mask_irq(unsigned int irq);
48
54 void uni_unmask_irq(unsigned int irq);
55
59 void uni_enable_irq(void);
60
64 void uni_disable_irq(void);
65
73 void uni_request_irq(int irq, irq_handler_t handler, void *pdata);
74
80 void uni_free_irq(int irq);
81
87 uint32_t uni_lock_irq_save(void);
88
94 void uni_unlock_irq_restore(uint32_t irq_state);
95
96
104 void uni_fiq_init(void);
105
111 void uni_mask_fiq(unsigned int fiq);
112
118 void uni_unmask_fiq(unsigned int fiq);
119
120 // Fast Interrupt handler
121 typedef void (*fiq_handler_t) (int fiq, void *pdata);
122
126 void uni_enable_fiq(void);
127
135 void uni_request_fiq(int fiq, fiq_handler_t handler, void *pdata);
136
142 void uni_free_fiq(int fiq);
143
147 typedef enum {
148 AUDIO_SOURCE = 0x01,
149 RTC_SOURCE = 0x02,
150 GPIO_SOURCE = 0x04,
151 } WAKE_SOURCE;
152
153 typedef int (*wake_handler_t) (int status, void *pdata);
154
162 void uni_request_wake(WAKE_SOURCE wake_source, wake_handler_t handler, void *pdata);
163
164 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_analog/uni_ldo.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
  • uni_analog
uni_ldo.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_ldo.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_LDO_H__
25 #define __UNI_LDO_H__
26
36 int uni_analog_set_ldo_fla_enbale(unsigned int enable);
37
62 int uni_analog_set_ldo_fla_trim(unsigned int trim);
63
73 int uni_analog_set_ldo_ana_exbypass(unsigned int bypass);
74
84 int uni_analog_set_ldo_ana_bypass(unsigned int bypass);
85
106 int uni_analog_set_ldo_ana_trim(unsigned int trim);
107
117 int uni_analog_set_ldo_dig_exbypass(unsigned int bypass);
118
128 int uni_analog_set_ldo_dig_bypass(unsigned int bypass);
129
139 int uni_analog_set_ldo_dig_dummyload(unsigned int enable);
140
161 int uni_analog_set_ldo_dig_trim(unsigned int trim);
162
170 int uni_analog_get_ldo_fla_bypass(void);
171
179 int uni_analog_get_ldo_core_bypass(void);
180
188 int uni_analog_get_ldo_vdd12_ov10(void);
189 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_led.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_led.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_led.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_LED_H__
25 #define __UNI_LED_H__
26
30 typedef enum {
31 UNI_LED_SWITCH_OFF = 0,
32 UNI_LED_SWITCH_ON,
33 } UNI_LED_SWITCH;
34
38 typedef enum {
39 UNI_LED_LIGHT_0 = 0x06,
40 UNI_LED_LIGHT_1 = 0x04,
41 UNI_LED_LIGHT_2 = 0x02,
42 UNI_LED_LIGHT_3 = 0x00,
43 } UNI_LED_LIGHT;
44
48 typedef enum {
49 UNI_LED_FRE_3K = 0,
50 UNI_LED_FRE_22K,
51 } UNI_LED_FRE_SET;
52
56 typedef struct {
57 unsigned char r;
58 unsigned char b;
59 unsigned char g;
60 } UNI_LED_COLOR;
61
71 int uni_led_set_color(int index_v, UNI_LED_COLOR rbg);
72
82 int uni_led_set_light(int index_v, UNI_LED_LIGHT light);
83
93 int uni_led_switch(int index_v, UNI_LED_SWITCH val);
94
103 int uni_led_enable(void);
104
113 int uni_led_disable(void);
114
123 int uni_led_reset(void);
124
133 int uni_led_set_frequency(UNI_LED_FRE_SET val);
134
143 int uni_led_init(int i2c_bus);
144
145 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_mmu.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_mmu.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_mmu.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_MMU_H__
25 #define __UNI_MMU_H__
26
27 #include <stdint.h>
28
40 int uni_mmu_map(uint32_t virt_addr, uint32_t phy_addr, size_t size);
41
51 int uni_mmu_unmap(uint32_t virt_addr);
52
53 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_npu.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_npu.h
1 #ifndef __UNI_NPU_H__
2 #define __UNI_NPU_H__
3
4 #include "autoconf.h"
5
14 int uni_npu_init(void);
15
24 int uni_npu_exit(void);
25
26 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_padmux.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_padmux.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_padmux.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_PADMUX_H__
25 #define __UNI_PADMUX_H__
26
31 typedef struct pin_config {
32 unsigned char pin_id;
33 unsigned char function;
34 } UNI_PIN_CONFIG;
35
45 int padmux_set(int pad_id, int function);
46
55 int padmux_get(int pad_id);
56
66 int padmux_check(int pad_id, int function);
67
77 int padmux_init(const UNI_PIN_CONFIG *pin_table, int size);
78
79 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_pmu_ctrl.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_pmu_ctrl.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_pmu_ctrl.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_PMU_CTRL_H__
25 #define __UNI_PMU_CTRL_H__
26
27 #include <common.h>
28
32 #define UNI_PMU_WAKEUP_GPIO 0x01
33 #define UNI_PMU_WAKEUP_RTC 0x02
34 #define UNI_PMU_WAKEUP_AUDIO_IN 0x04
35 #define UNI_PMU_WAKEUP_I2C 0x08
36
37
40 #define UNI_PMU_WAKEUP_FROM_ROM 0
41 #define UNI_PMU_WAKEUP_FROM_SRAM 1
42
43
46 #define UNI_SRAM_MODE_NORMAL 0
47 #define UNI_SRAM_MODE_RETENTION 1
48 #define UNI_SRAM_MODE_SHUTDOWN 2
49
50
53 typedef union {
54 uint32_t value;
55 struct {
56 unsigned npu_sram_mode:2;
57 unsigned mcu_sram_mode:2;
58 unsigned audio_in_sram_mode:2;
59 unsigned isolation_enable:1;
60 unsigned mcu_reset:1;
61 unsigned mcu_poweroff:1;
62 unsigned mcu_clk_gate:1;
63 unsigned osc_24m_en:1;
64 unsigned osc_1m_en:1;
65 unsigned flash_poweroff:1;
66 unsigned manual_ldo_adjust_en:1;
67 unsigned manual_ldo_adjust_val:4;
68 unsigned resv:4;
69 } bits;
70 } UNI_PMU_STATE;
71
75 typedef union {
76 uint32_t value;
77 struct {
78 unsigned trim_val:4;
79 unsigned trim_en:1;
80 unsigned resv:27;
81 } bits;
82 } UNI_PMU_TRIM_CFG;
83
87 typedef enum pmu_cmd {
88 UNI_PMU_CMD_TIMING,
89 UNI_PMU_CMD_SLEEP_STATE,
90 UNI_PMU_CMD_WORK_STATE,
91 UNI_PMU_CMD_WAKEUP_MODE,
92 UNI_PMU_CMD_WAKEUP_STATUS,
93 UNI_PMU_CMD_WAKEUP_ADDR,
94 UNI_PMU_CMD_FSM,
95 UNI_PMU_CMD_SLEEP_AUTO_LDO,
96 UNI_PMU_CMD_WORK_LDO_TRIM,
97 UNI_PMU_CMD_FLASH_PD,
98 UNI_PMU_CMD_MAX
99 } UNI_PMU_CMD;
100
104 enum {
105 UNI_PMU_FSM_IDLE,
106 UNI_PMU_FSM_MCU_IDLE,
107 UNI_PMU_FSM_MCU_DELAY,
108 UNI_PMU_FSM_RAM_LOWPOWER_OPEN,
109 UNI_PMU_FSM_ISO_OPEN,
110 UNI_PMU_FSM_MCU_RST_LOW,
111 UNI_PMU_FSM_OSC_CLOSES,
112 UNI_PMU_FSM_MCU_POWERDOWN,
113 UNI_PMU_FSM_LDO_ADD_POWER,
114 UNI_PMU_FSM_WAIT_INT,
115 UNI_PMU_FSM_LDO_SUB_POWER,
116 UNI_PMU_FSM_MCU_POWERON,
117 UNI_PMU_FSM_OSC_OPEN,
118 UNI_PMU_FSM_ISO_CLOSE,
119 UNI_PMU_FSM_RAM_LOWPOWER_CLOSE,
120 UNI_PMU_FSM_MCU_RST_HIGH,
121 UNI_PMU_FSM_MAX
122 };
123
127 typedef enum {
128 UNI_WAKEUP_SOURCE_COLD,
129 UNI_WAKEUP_SOURCE_WDT,
130 UNI_WAKEUP_SOURCE_GPIO,
131 UNI_WAKEUP_SOURCE_AUDIO_IN,
132 UNI_WAKEUP_SOURCE_RTC,
133 UNI_WAKEUP_SOURCE_I2C,
134 } UNI_WAKEUP_SOURCE;
135
136 typedef enum {
137 UNI_START_MODE_ROM,
138 UNI_START_MODE_SRAM,
139 } UNI_START_MODE;
143 typedef struct pmu_timing {
144 uint16_t mcu_idle_delay;
145 uint16_t ram_retention_delay;
146 uint16_t isolation_high_delay;
147 uint16_t close_osc_delay;
148 uint16_t adjust_ldo_delay0;
149 uint16_t adjust_ldo_delay1;
150 uint16_t power_on_delay;
151 uint16_t isolation_low_delay;
152 } UNI_PMU_TIMING;
153
157 typedef struct uni_pmu_wakeup_addr {
158 uint8_t wakeup_from;
159 uint32_t wakeup_address;
160 } UNI_PMU_WAKEUP_ADDR;
161
162 #define UNI_PMU_AUTO_LDO_MODE_SINGLE 0
163 #define UNI_PMU_AUTO_LDO_MODE_CONTINUE 1
164
165
168 typedef struct pmu_auto_ldo {
169 uint8_t enable;
170 uint8_t mode;
171 uint8_t low_gate;
172 uint8_t high_gate;
173 uint16_t adjust_delay;
174 uint8_t current_trim_value;
175 uint8_t current_adjust_gate;
176 } UNI_PMU_AUTO_LDO;
177
181 typedef struct pmu_ctrl_config {
182 UNI_PMU_TIMING timing;
183 UNI_PMU_STATE sleep_state;
184 UNI_PMU_STATE work_state;
185 uint32_t wakeup_mode;
186 uint32_t fsm;
187 uint32_t wakeup_status;
188 UNI_PMU_WAKEUP_ADDR wakeup_addr;
189 UNI_PMU_AUTO_LDO auto_ldo;
190 UNI_PMU_TRIM_CFG work_ldo_trim;
191 } UNI_PMU_CTRL_CONFIG;
192
203 int uni_pmu_ctrl_set(int cmd, void *data);
204
215 int uni_pmu_ctrl_get(int cmd, void *data);
216
220 void uni_pmu_ctrl_enable(void);
221
227 UNI_WAKEUP_SOURCE uni_pmu_get_wakeup_source(void);
228
234 UNI_START_MODE uni_pmu_get_start_mode(void);
235
236 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_pmu_osc.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_pmu_osc.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_pmu_osc.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_PMU_OSC_H__
25 #define __UNI_PMU_OSC_H__
26
27 #include <driver/uni_irq.h>
28
29 #define UNI_OSC_32K_VALUE_MAX 0x1FF
30 #define UNI_OSC_1M_VALUE_MAX 0x1FF
31 #define UNI_OSC_24M_VALUE_MAX 0x7F
32
33 #define UNI_OSC_CLOCK_32K 32000
34 #define UNI_OSC_CLOCK_1M 1024000
35 #define UNI_OSC_CLOCK_24M 24576000
36
37 // trim值下溢测试
38 // #define UNI_OSC_CLOCK_32K 1280000
39 // #define UNI_OSC_CLOCK_1M 50000000
40 // #define UNI_OSC_CLOCK_24M 100000000
41
42 // trim值上溢测试
43 // #define UNI_OSC_CLOCK_32K 3200
44 // #define UNI_OSC_CLOCK_1M 100000
45 // #define UNI_OSC_CLOCK_24M 1000000
46
47 // 中断MASK
48 #define UNI_OSC_INT_32K_DONE_MASK 0x01
49 #define UNI_OSC_INT_1M_DONE_MASK 0x02
50 #define UNI_OSC_INT_24M_DONE_MASK 0x04
51 #define UNI_OSC_INT_32K_ERROR_MASK 0x08
52 #define UNI_OSC_INT_1M_ERROR_MASK 0x10
53 #define UNI_OSC_INT_24M_ERROR_MASK 0x20
54
55 #define UNI_OSC_INT_32K_MASK ((UNI_OSC_INT_32K_DONE_MASK) | (UNI_OSC_INT_32K_ERROR_MASK))
56 #define UNI_OSC_INT_1M_MASK ((UNI_OSC_INT_1M_DONE_MASK) | (UNI_OSC_INT_1M_ERROR_MASK))
57 #define UNI_OSC_INT_24M_MASK ((UNI_OSC_INT_24M_DONE_MASK) | (UNI_OSC_INT_24M_ERROR_MASK))
58
60 #define UNI_OSC_REF_CYCLE(ref_freq, target_freq, target_cycles) \
61 (((unsigned long long)(ref_freq) * (target_cycles)) / (target_freq))
62
66 typedef enum {
67 UNI_OSC_CMD_TRIM_CONFIG,
68 UNI_OSC_CMD_CURRENT_CYCLE,
69 UNI_OSC_CMD_TRIM_VALUE,
70 UNI_OSC_CMD_TRIM_DELAY,
71 UNI_OSC_CMD_MAX
72 } UNI_OSC_CMD;
73
77 typedef enum {
78 UNI_OSC_CLK_TYPE_32K,
79 UNI_OSC_CLK_TYPE_1M,
80 UNI_OSC_CLK_TYPE_24M,
81 UNI_OSC_CLK_TYPE_MAX
82 } UNI_OSC_CLK_TYPE;
83
87 typedef enum {
88 UNI_OSC_TRIM_MODE_AUTO = 0x01,
89 UNI_OSC_TRIM_MODE_MANUAL = 0x02,
90 } UNI_OSC_TRIM_MODE;
91
95 typedef struct osc_target_cycle {
96 UNI_OSC_CLK_TYPE type;
97 uint16_t target_cycles;
98 uint16_t ref_cycles;
99 } UNI_OSC_TARGET_CYCLE;
100
104 typedef struct osc_current_cycle {
105 UNI_OSC_CLK_TYPE type;
106 uint32_t cycles;
107 } UNI_OSC_CURRENT_CYCLE;
108
112 typedef struct osc_trim {
113 UNI_OSC_CLK_TYPE type;
114 uint32_t trim_value;
115 } UNI_OSC_TRIM;
116
120 typedef struct osc_trim_config {
121 UNI_OSC_CLK_TYPE type;
122 UNI_OSC_TRIM_MODE mode;
123 uint16_t target_cycles;
124 uint16_t ref_cycles;
125
126 irq_handler_t callback;
127 void *priv;
128 uint32_t int_status;
129 } UNI_OSC_TRIM_CONFIG;
130
141 int uni_pmu_osc_set(UNI_OSC_CMD cmd, void *data);
142
153 int uni_pmu_osc_get(UNI_OSC_CMD cmd, void *data);
154
167 int uni_osc_cycles_compare(uint16_t expected_cycles, uint16_t current_cycles, uint16_t tolerance);
168
178 int uni_pmu_osc_enable(UNI_OSC_CLK_TYPE type);
179
189 int uni_pmu_osc_disable(UNI_OSC_CLK_TYPE type);
190
198 int uni_pmu_osc_init(void);
199
209 int uni_pmu_osc_trim_enable(UNI_OSC_CLK_TYPE type);
210
218 int uni_pmu_osc_trim_init(void);
219
220 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_rtc.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_rtc.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_rtc.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24
25 /* Define to prevent recursive inclusion */
26 #ifndef __UNI_RTC_H__
27 #define __UNI_RTC_H__
28 /* Cooperation with C and C++ */
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #include <driver/uni_irq.h>
34
38 typedef struct RtcDateTime_s {
39 int TmYear;
40 int TmMonth;
41 int TmDay;
42 int TmWeek;
43 int TmHour;
44 int TmMin;
45 int TmSec;
46 int TmMs;
47 int TmUs;
48 } UNI_RTC_DATETIME;
49
53 typedef struct UNIRTC_AlarmMask_s {
54 unsigned char AlarmMaskYear;
55 unsigned char AlarmMaskMonth;
56 unsigned char AlarmMaskDay;
57 unsigned char AlarmMaskWeek;
58 unsigned char AlarmMaskHour;
59 unsigned char AlarmMaskMin;
60 unsigned char AlarmMaskSec;
61 unsigned char AlarmMaskMs;
62 unsigned char AlarmMaskUs;
63 } UNI_RTC_ALARM_MASK;
64
68 void uni_rtc_init(void);
69
73 void uni_rtc_start_tick(void);
74
78 void uni_rtc_stop_tick(void);
79
85 void uni_rtc_set_tick(unsigned long time_duration); // us级
86
92 void uni_rtc_get_tick(unsigned long *time_duration); // us级
93
97 void uni_rtc_start_time(void);
98
102 void uni_rtc_stop_time(void);
103
112 int uni_rtc_get_time(UNI_RTC_DATETIME *DateTime);
113
122 int uni_rtc_set_time(UNI_RTC_DATETIME *DateTime);
123
127 void uni_rtc_start_alarm(void);
128
132 void uni_rtc_stop_alarm(void);
133
142 int uni_rtc_get_alarm(UNI_RTC_DATETIME *DateTime);
143
152 int uni_rtc_set_alarm(UNI_RTC_DATETIME *DateTime);
153
159 void uni_rtc_mask_alarm(UNI_RTC_ALARM_MASK *Mask);
160
166 void uni_rtc_print_time(UNI_RTC_DATETIME DateTime);
167
177 int uni_rtc_set_interrupt( irq_handler_t callback, void *priv);
178
187 int uni_rtc_set_alarm_time_s(int alarm_after_s);
188
196 int uni_rtc_exit(void);
197
205 int uni_rtc_suspend(void);
206
214 int uni_rtc_resume(void);
215
216 #ifdef __cplusplus
217 }
218 #endif
219
220 #endif
221


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_spi_slave.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_spi_slave.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_spi_slave.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_SPI_SLAVE_H__
25 #define __UNI_SPI_SLAVE_H__
26
27 #include <common.h>
28
29 #define START_STATE (0)
30 #define RUNNING_STATE (1)
31 #define DONE_STATE (2)
32 #define ERROR_STATE (-1)
33
34 typedef void (*completion_cb)(struct spi_device *spi);
35
46 int spi_slave_init(struct spi_device* spi);
47
63 int spi_slave_rx(struct spi_device *spi, void* buffer, int len, completion_cb slave_completetion_cb);
64
80 int spi_slave_tx(struct spi_device *spi, const void* buffer, int len, completion_cb slave_completetion_cb);
81
82 #endif /* __UNI_SPI_SLAVE_H__ */


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_spinor.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_spinor.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_spinor.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_SPINOR_H__
25 #define __UNI_SPINOR_H__
26
27 int uni_spi_nor_init(int bus_num,int cs, int speed, int mode);
28 void uni_spi_nor_protect_init(void);
29 int uni_spi_nor_fast_readdata(unsigned int from, unsigned char *buf,unsigned int len);
30 int uni_spi_nor_dual_readdata(unsigned int from, unsigned char *buf,unsigned int len);
31 int uni_spi_nor_readdata(unsigned int from, unsigned char *buf, unsigned int len);
32 int uni_spi_nor_pageprogram(unsigned int to,unsigned char *buf,unsigned int len);
33 int uni_spi_nor_chiperase(void);
34 int uni_spi_nor_erasedata(unsigned int addr, unsigned int len);
35 void uni_spi_nor_sync(void);
36
37 void uni_spi_nor_exit_4byte(void);
38 char *uni_spi_nor_gettype(void);
39 unsigned int uni_spi_nor_get_info(enum uni_flash_info flash_info);
40
41 int uni_spi_nor_write_protect_mode(void);
42 int uni_spi_nor_write_protect_status(unsigned int *len);
43 int uni_spi_nor_write_protect_lock(unsigned int protect_addr);
44 int uni_spi_nor_write_protect_unlock(void);
45 int uni_spi_nor_set_lock_reg(void);
46 int uni_spi_nor_get_lock_reg(int *lock);
47 void uni_spi_nor_calcblockrange(unsigned int addr, unsigned int len, unsigned int *pstart, unsigned int *pend);
48
49 int uni_spi_nor_otp_status(unsigned char *buf);
50 int uni_spi_nor_otp_lock(void);
51 int uni_spi_nor_otp_read(unsigned int addr, unsigned char *buf, unsigned int len);
52 int uni_spi_nor_otp_write(unsigned int addr, unsigned char *buf, unsigned int len);
53 int uni_spi_nor_otp_erase(void);
54 int uni_spi_nor_otp_get_region(unsigned int *region);
55 int uni_spi_nor_otp_set_region(unsigned int region);
56
57 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_timer.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_timer.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_timer.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_TIMER_H__
25 #define __UNI_TIMER_H__
26
31 typedef enum {
32 UNI_TIMER_MODE_SINGLE,
33 UNI_TIMER_MODE_CONTINUE,
34 } UNI_TIMER_MODE;
35
41 unsigned long long uni_get_time_us(void);
42
48 unsigned int uni_get_time_ms(void);
49
56 unsigned int uni_get_timer(unsigned int base);
57
68 int uni_timer_register(int (*fun)(void*), int timeout_ms, void *priv, UNI_TIMER_MODE mode);
69
76 int uni_timer_unregister(int timer_id);
77
85 int uni_timer_reset_time(int timer_id, int timeout_ms);
86
87 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_uart.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_uart.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_uart.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24 #ifndef __UNI_UART_H__
25 #define __UNI_UART_H__
26
29 #include <common.h>
30
31 #define UNI_UART_PORT0 0
32 #define UNI_UART_PORT1 1
33
34 /* Generic uart API */
44 int uni_uart_init(int port, uint32_t baudrate);
45
54 int uni_uart_exit(int port);
55
62 void uni_uart_putc(int port, int ch);
63
70 void uni_uart_compatible_putc(int port, int ch);
71
77 void uni_uart_empty_fifo(int port);
78
87 int uni_uart_getc(int port);
88
98 int uni_uart_try_getc(int port, char *c);
99
108 int uni_uart_can_read(int port);
109
118 int uni_uart_read(int port, unsigned char *buf, int len);
119
129 int uni_uart_read_non_block(int port, unsigned char *buf, int len, unsigned int timeout_ms);
130
131
140 int uni_uart_write(int port, const unsigned char *buf, int len);
141
150 int uni_uart_suspend(int port);
151
160 int uni_uart_resume(int port);
161
162 //-------------------------------------------------------------------------------------------------
163 // FIFO Related
164
168 typedef enum {
169 UNI_UART_FIFO_SEND_THRESHOLD_EMPTY,
170 UNI_UART_FIFO_SEND_THRESHOLD_2,
171 UNI_UART_FIFO_SEND_THRESHOLD_QUARTER,
172 UNI_UART_FIFO_SEND_THRESHOLD_HALF,
173 } UNI_UART_FIFO_SEND_THRESHOLD;
174
178 typedef enum {
179 UNI_UART_FIFO_RECV_THRESHOLD_ONE_BYTE,
180 UNI_UART_FIFO_RECV_THRESHOLD_QUARTER,
181 UNI_UART_FIFO_RECV_THRESHOLD_HALF,
182 UNI_UART_FIFO_RECV_THRESHOLD_FULL,
183 } UNI_UART_FIFO_RECV_THRESHOLD;
184
194 int uni_uart_set_send_fifo_threshold(int port, UNI_UART_FIFO_SEND_THRESHOLD threshold);
195
205 int uni_uart_set_recv_fifo_threshold(int port, UNI_UART_FIFO_RECV_THRESHOLD threshold);
206
212 void uni_uart_flush_send_fifo(int port);
213
219 void uni_uart_flush_recv_fifo(int port);
220
221
222 //-------------------------------------------------------------------------------------------------
223 // Async API Mode 1 (Interrupt Mode)
224
225 typedef int (*UART_CAN_SEND_CALLBACK)(int port, int length, void *priv);
226 typedef int (*UART_CAN_RECV_CALLBACK)(int port, int length, void *priv);
227
238 int uni_uart_start_async_send(int port, UART_CAN_SEND_CALLBACK callback, void *priv);
239
248 int uni_uart_stop_async_send(int port);
249
260 int uni_uart_start_async_recv(int port, UART_CAN_RECV_CALLBACK callback, void *priv);
261
270 int uni_uart_stop_async_recv(int port);
271
272 // No check FIFO status in these function
282 int uni_uart_send_buffer(int port, unsigned char *buffer, int length);
283
293 int uni_uart_recv_buffer(int port, unsigned char *buffer, int length);
294
295 //-------------------------------------------------------------------------------------------------
296 // Async API Mode 2 (DMA Mode)
297 // In Leo, it is implemented by interrupt mode
298
299 typedef int (*UART_SEND_DONE_CALLBACK)(int port, void *priv);
300 typedef int (*UART_RECV_DONE_CALLBACK)(int port, void *priv);
301
314 int uni_uart_async_send_buffer(int port, unsigned char *buffer, int length, UART_SEND_DONE_CALLBACK callback, void *priv);
315
328 int uni_uart_async_recv_buffer(int port, unsigned char *buffer, int length, UART_RECV_DONE_CALLBACK callback, void *priv);
329
338 int uni_uart_async_send_buffer_stop(int port);
339
348 int uni_uart_async_recv_buffer_stop(int port);
349
350 /* Console API */
351
361 int uni_console_init(int port, uint32_t baudrate);
362
369 int uni_console_exit(void);
370
376 void uni_console_putc(int ch);
377
383 void uni_console_compatible_putc(int ch);
384
388 void uni_console_empty_fifo(void);
389
397 int uni_console_getc(void);
398
407 int uni_console_try_getc(char *c);
408
416 int uni_console_can_read(void);
417
424 int uni_console_suspend(void);
425
432 int uni_console_resume(void);
433
434 #endif


蜂鸟L系列离线方案开发指导手册: D:/Project/IoT/L/SRC/unione_lite_app_hb_l/include/driver/uni_watchdog.h 源文件

  • SRC
  • unione_lite_app_hb_l
  • include
  • driver
uni_watchdog.h
1 /**************************************************************************
2 * Copyright (C) 2012-2021 Unisound
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 **************************************************************************
18 *
19 * Description : uni_watchdog.h
20 * Author : yzs.unisound.com
21 * Date : 2021.03.01
22 *
23 **************************************************************************/
24
25 #ifndef __UNI_WATCHDOG_H__
26 #define __UNI_WATCHDOG_H__
27
31 #include <common.h>
32 #include <driver/uni_irq.h>
33
41 void uni_watchdog_init(uint16_t reset_timeout_ms,
42 uint16_t level_timeout_ms, irq_handler_t irq_handler);
43
47 void uni_watchdog_ping(void);
48
54 int uni_reboot(void);
55
56 #endif


蜂鸟L系列离线方案开发指导手册: UNI_PMU_STATE联合体 参考

成员变量
UNI_PMU_STATE联合体 参考

PMU 外设状态配置位域

#include <uni_pmu_ctrl.h>

成员变量

uint32_t value
struct {
unsigned npu_sram_mode:2
NPU SRAM 工作模式
unsigned mcu_sram_mode:2
MCU SRAM 工作模式
unsigned audio_in_sram_mode:2
AUDIO_IN SRAM 工作模式
unsigned isolation_enable:1
是否隔离
unsigned mcu_reset:1
MCU 是是否复位
unsigned mcu_poweroff:1
MCU 是否断电
unsigned mcu_clk_gate:1
MCU 时钟是否gate
unsigned osc_24m_en:1
OSC 24M时钟是否开启
unsigned osc_1m_en:1
OSC 1M时钟是否开启
unsigned flash_poweroff:1
FLASH 是否断电
unsigned manual_ldo_adjust_en:1
手动电压调整使能(模式切换时)
unsigned manual_ldo_adjust_val:4
手动电压调整值(模式切换时)
unsigned resv:4
保留
} bits


蜂鸟L系列离线方案开发指导手册: UNI_PMU_TRIM_CFG联合体 参考

成员变量
UNI_PMU_TRIM_CFG联合体 参考

工作时电压trim

#include <uni_pmu_ctrl.h>

成员变量

uint32_t value
struct {
unsigned trim_val:4
trim 值
unsigned trim_en:1
trim值使能
unsigned resv:27
保留
} bits