[doc] update comments, remove doxygen file

This commit is contained in:
jzlv 2023-07-04 11:24:29 +08:00
parent 9cba4a5383
commit 088c4a3099
175 changed files with 369 additions and 4955 deletions

View File

@ -5,7 +5,7 @@
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
SOURCEDIR = zh
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".

View File

@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
PROJECT_NAME = "LHAL Driver"
PROJECT_NAME = "Bouffalo SDK"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
@ -54,21 +54,21 @@ PROJECT_NUMBER = 1.0
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF = "LHAL Drivers for bouffalolab Series MicroController"
PROJECT_BRIEF = "Bouffalolab Software Development Kit"
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
PROJECT_LOGO =
PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
OUTPUT_DIRECTORY = doc
OUTPUT_DIRECTORY = $(DOXYGEN_OUTPUT_DIR)
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
# sub-directories (in 2 levels) under the output directory of each output format
@ -113,7 +113,7 @@ ALLOW_UNICODE_NAMES = NO
# Swedish, Turkish, Ukrainian and Vietnamese.
# The default value is: English.
OUTPUT_LANGUAGE = Chinese
OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
# descriptions after the members that are listed in the file and class
@ -184,7 +184,7 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
STRIP_FROM_PATH =
STRIP_FROM_PATH = $(BL_SDK_BASE)
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
@ -908,7 +908,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = include
INPUT = $(BL_SDK_BASE)/drivers/lhal/include
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

View File

@ -7,7 +7,7 @@ REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set SOURCEDIR=zh
set BUILDDIR=build
if "%1" == "" goto help

View File

@ -1,2 +0,0 @@
TODO
====================

View File

@ -1,10 +0,0 @@
=======================
Components
=======================
.. toctree::
:maxdepth: 1
BFLOG <bflog>
BLE <ble>
WIFI <wifi>

View File

@ -1,520 +0,0 @@
ADC
=============
Macros
------------
adc channel
^^^^^^^^^^^^^^^^^^^^
参考 `bflb_adc.h` 文件,不详细列出。
adc clock div
^^^^^^^^^^^^^^^^^^^^
对 adc 时钟再一次进行分频。分频后的时钟必须小于等于 500K。ADC CLK = CLK_SOURCE/CLK_DIV/adc_clk_div。
.. code-block:: c
:linenos:
#define ADC_CLK_DIV_4 1
#define ADC_CLK_DIV_8 2
#define ADC_CLK_DIV_12 3
#define ADC_CLK_DIV_16 4
#define ADC_CLK_DIV_20 5
#define ADC_CLK_DIV_24 6
#define ADC_CLK_DIV_32 7
adc resolution
^^^^^^^^^^^^^^^^^^^^
adc 位数,可以选择 12B、14B、16B。其中 14B 和 16B 自带过采样处理。
.. code-block:: c
:linenos:
#define ADC_RESOLUTION_12B 0
#define ADC_RESOLUTION_14B 2
#define ADC_RESOLUTION_16B 4
adc vref
^^^^^^^^^^^^^^^^^^^^
adc 内置参考电压选择,可以选择 2.0 V 或者 3.2V。
.. code-block:: c
:linenos:
#define ADC_VREF_3P2V 0
#define ADC_VREF_2P0V 1
Structs
------------
struct bflb_adc_config_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
adc 初始化配置结构体。
.. code-block:: c
:linenos:
struct bflb_adc_config_s {
uint8_t clk_div;
uint8_t scan_conv_mode;
uint8_t continuous_conv_mode;
uint8_t differential_mode;
uint8_t resolution;
uint8_t vref;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - clk_div
- 分频值
* - scan_conv_mode
- 是否开启扫描模式
* - continuous_conv_mode
- 是否开启连续转换模式
* - differential_mode
- 是否开启差分模式
* - resolution
- 采样位数
* - vref
- 参考电压选择
struct bflb_adc_channel_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
配置 adc 通道时使用。
.. code-block:: c
:linenos:
struct bflb_adc_channel_s {
uint8_t pos_chan;
uint8_t neg_chan;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - pos_chan
- 正向通道
* - neg_chan
- 反向通道(单端模式下无用)
struct bflb_adc_result_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
adc 标准转换结果
.. code-block:: c
:linenos:
struct bflb_adc_result_s {
int8_t pos_chan;
int8_t neg_chan;
int32_t value;
int32_t millivolt;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - pos_chan
- 正向通道
* - neg_chan
- 反向通道(单端模式下无用)
* - value
- adc 转换结果
* - millivolt
- 转换结果转 mv
Functions
------------
bflb_adc_init
^^^^^^^^^^^^^^^^^^^^
说明: 初始化 adc。adc 使用之前需要开启 adc ip 时钟、设置 adc 时钟源和分频值、选择使用的 gpio 为 analog 模式。
.. code-block:: c
:linenos:
void bflb_adc_init(struct bflb_device_s *dev, const struct bflb_adc_config_s *config);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - config
- 配置项
bflb_adc_deinit
^^^^^^^^^^^^^^^^^^^^
说明: 反初始化 adc。
.. code-block:: c
:linenos:
void bflb_adc_deinit(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_adc_link_rxdma
^^^^^^^^^^^^^^^^^^^^
说明: adc dma 功能开关。
.. code-block:: c
:linenos:
void bflb_adc_link_rxdma(struct bflb_device_s *dev, bool enable);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - enable
- 是否开启 dma 功能
bflb_adc_channel_config
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 配置 adc 通道。
.. code-block:: c
:linenos:
int bflb_adc_channel_config(struct bflb_device_s *dev, struct bflb_adc_channel_s *chan, uint8_t channels);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - chan
- 通道(一对)
* - channels
- 通道对数(单次扫描模式下只能为 1
bflb_adc_start_conversion
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 启动 adc 转换。连续转换模式下只需要调用一次。
.. code-block:: c
:linenos:
void bflb_adc_start_conversion(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_adc_stop_conversion
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 停止 adc 转换。
.. code-block:: c
:linenos:
void bflb_adc_stop_conversion(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_adc_get_count
^^^^^^^^^^^^^^^^^^^^
说明: 获取 adc 转换个数。
.. code-block:: c
:linenos:
uint8_t bflb_adc_get_count(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 转换个数最大为32
bflb_adc_read_raw
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 读取一次 adc 转换值。
.. code-block:: c
:linenos:
uint32_t bflb_adc_read_raw(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 转换值(注意不是最终采样值)
bflb_adc_rxint_mask
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: adc 转换完成中断开关。
.. code-block:: c
:linenos:
void bflb_adc_rxint_mask(struct bflb_device_s *dev, bool mask);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - mask
- 是否屏蔽中断
bflb_adc_errint_mask
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: adc 错误中断开关。
.. code-block:: c
:linenos:
void bflb_adc_errint_mask(struct bflb_device_s *dev, bool mask);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - mask
- 是否屏蔽中断
bflb_adc_get_intstatus
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: adc 中断标志。
.. code-block:: c
:linenos:
uint32_t bflb_adc_get_intstatus(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 中断标志
返回值如下:
.. code-block:: c
:linenos:
ADC_INTSTS_NEG_SATURATION
ADC_INTSTS_NEG_SATURATION
ADC_INTSTS_FIFO_UNDERRUN
ADC_INTSTS_FIFO_OVERRUN
ADC_INTSTS_ADC_READY
bflb_adc_int_clear
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 清除 adc 中断标志。
.. code-block:: c
:linenos:
void bflb_adc_int_clear(struct bflb_device_s *dev, uint32_t int_clear);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - int_clear
- 清除值
`int_clear` 可以填入以下参数:
.. code-block:: c
:linenos:
ADC_INTCLR_NEG_SATURATION
ADC_INTCLR_POS_SATURATION
ADC_INTCLR_FIFO_UNDERRUN
ADC_INTCLR_FIFO_OVERRUN
ADC_INTCLR_ADC_READY
bflb_adc_parse_result
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 对 adc 转换结果进行解析。
.. code-block:: c
:linenos:
void bflb_adc_parse_result(struct bflb_device_s *dev, uint32_t *buffer, struct bflb_adc_result_s *result, uint16_t count);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - buffer
- 转换值
* - result
- 输出结果
* - count
- 转换个数
bflb_adc_tsen_init
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 初始化 adc tsen 模块。
.. code-block:: c
:linenos:
void bflb_adc_tsen_init(struct bflb_device_s *dev, uint8_t tsen_mod);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - tsen_mod
- 模式选择
bflb_adc_tsen_get_temp
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 初始化 adc tsen 模块。
.. code-block:: c
:linenos:
float bflb_adc_tsen_get_temp(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 温度
bflb_adc_vbat_enable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 开启 vbat 。
.. code-block:: c
:linenos:
void bflb_adc_vbat_enable(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_adc_vbat_disable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭 vbat。
.. code-block:: c
:linenos:
void bflb_adc_vbat_disable(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄

View File

@ -1,15 +0,0 @@
CKS
=============
Macros
------------
Structs
------------
Functions
------------

View File

@ -1,111 +0,0 @@
CLOCK
=============
Macros
------------
Structs
------------
Functions
------------
bflb_clk_get_system_clock
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取系统时钟频率。
.. code-block:: c
:linenos:
uint32_t bflb_clk_get_system_clock(uint8_t type);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - type
- 外设类型
**type** 可以填入以下参数:
.. code-block:: c
:linenos:
#define BFLB_SYSTEM_ROOT_CLOCK 0
#define BFLB_SYSTEM_CPU_CLK 1
#define BFLB_SYSTEM_PBCLK 2
#define BFLB_SYSTEM_XCLK 3
#define BFLB_SYSTEM_32K_CLK 4
bflb_clk_get_peripheral_clock
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取外设时钟频率。
.. code-block:: c
:linenos:
uint32_t bflb_clk_get_peripheral_clock(uint8_t type, uint8_t idx);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - type
- 外设类型
* - idx
- 外设 id
**type** 可以填入以下参数:
.. code-block:: c
:linenos:
#define BFLB_DEVICE_TYPE_ADC 0
#define BFLB_DEVICE_TYPE_DAC 1
#define BFLB_DEVICE_TYPE_AUDIOADC 2
#define BFLB_DEVICE_TYPE_AUDIODAC 3
#define BFLB_DEVICE_TYPE_GPIO 4
#define BFLB_DEVICE_TYPE_UART 5
#define BFLB_DEVICE_TYPE_SPI 6
#define BFLB_DEVICE_TYPE_I2C 7
#define BFLB_DEVICE_TYPE_DMA 8
#define BFLB_DEVICE_TYPE_I2S 9
#define BFLB_DEVICE_TYPE_IR 10
#define BFLB_DEVICE_TYPE_TIMER 11
#define BFLB_DEVICE_TYPE_PWM 12
#define BFLB_DEVICE_TYPE_CAMERA 14
#define BFLB_DEVICE_TYPE_FLASH 15
#define BFLB_DEVICE_TYPE_QSPI 16
#define BFLB_DEVICE_TYPE_SDH 17
#define BFLB_DEVICE_TYPE_SDU 18
#define BFLB_DEVICE_TYPE_ETH 19
#define BFLB_DEVICE_TYPE_RTC 20
#define BFLB_DEVICE_TYPE_CRC 21
#define BFLB_DEVICE_TYPE_RNG 22
#define BFLB_DEVICE_TYPE_MIPI 23
#define BFLB_DEVICE_TYPE_DPI 24
#define BFLB_DEVICE_TYPE_DSI 25
#define BFLB_DEVICE_TYPE_CSI 26
#define BFLB_DEVICE_TYPE_USB 27
#define BFLB_DEVICE_TYPE_AES 28
#define BFLB_DEVICE_TYPE_SHA 29
#define BFLB_DEVICE_TYPE_MD5 30
#define BFLB_DEVICE_TYPE_TRNG 31
#define BFLB_DEVICE_TYPE_PKA 32
#define BFLB_DEVICE_TYPE_CKS 33
#define BFLB_DEVICE_TYPE_MJPEG 34

View File

@ -1,163 +0,0 @@
DAC
=============
Macros
------------
dac clock div
^^^^^^^^^^^^^^^^^^^^^^^^^
dac 分频,只有 DMA 模式下可以使用 1 分频。
.. code-block:: c
:linenos:
#define DAC_CLK_DIV_16 0
#define DAC_CLK_DIV_32 1
#define DAC_CLK_DIV_64 3
#define DAC_CLK_DIV_1 4
dac channel
^^^^^^^^^^^^^^^^^^^^^^^^^
博流系列芯片 dac 通道共两组A 通道和 B 通道。
.. code-block:: c
:linenos:
#define DAC_CHANNEL_A (1 << 0)
#define DAC_CHANNEL_B (1 << 1)
Structs
------------
Functions
------------
bflb_dac_init
^^^^^^^^^^^^^^^^^^^^
说明: 初始化 dac。dac 使用之前需要开启 dac ip 时钟、设置 dac 时钟源和分频值、选择使用的 gpio 为 analog 模式。
.. code-block:: c
:linenos:
void bflb_dac_init(struct bflb_device_s *dev, uint8_t clk_div);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - clk_div
- 分频值
bflb_dac_deinit
^^^^^^^^^^^^^^^^^^^^
说明: 反初始化 dac。
.. code-block:: c
:linenos:
void bflb_dac_deinit(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_dac_link_txdma
^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: dac dma 开关使能。
.. code-block:: c
:linenos:
void bflb_dac_link_txdma(struct bflb_device_s *dev, bool enable);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - enable
- 是否使能 dma
bflb_dac_channel_enable
^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: dac 通道使能。
.. code-block:: c
:linenos:
void bflb_dac_channel_enable(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道,多个通道之间使用 | 连接
bflb_dac_channel_disable
^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: dac 通道关闭。
.. code-block:: c
:linenos:
void bflb_dac_channel_disable(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道,多个通道之间使用 | 连接
bflb_dac_set_value
^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 更改 dac 通道值。
.. code-block:: c
:linenos:
void bflb_dac_set_value(struct bflb_device_s *dev, uint8_t ch, uint16_t value);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道,多个通道之间使用 | 连接
* - value
- 通道值

View File

@ -1,375 +0,0 @@
DMA
=============
Macros
------------
dma direction
^^^^^^^^^^^^^^^
dma 传输方向支持 4 种。
.. code-block:: c
:linenos:
#define DMA_MEMORY_TO_MEMORY 0
#define DMA_MEMORY_TO_PERIPH 1
#define DMA_PERIPH_TO_MEMORY 2
#define DMA_PERIPH_TO_PERIPH 3
dma addr increment
^^^^^^^^^^^^^^^^^^^^^
dma 地址自增使能。
.. code-block:: c
:linenos:
#define DMA_ADDR_INCREMENT_DISABLE 0
#define DMA_ADDR_INCREMENT_ENABLE 1
dma data width
^^^^^^^^^^^^^^^^^^^^^
dma 传输位宽支持 8BIT 、16BIT、32BIT。
.. code-block:: c
:linenos:
#define DMA_TRANSFER_WIDTH_8BIT 0
#define DMA_TRANSFER_WIDTH_16BIT 1
#define DMA_TRANSFER_WIDTH_32BIT 2
dma burst size
^^^^^^^^^^^^^^^^^^^^^
dma 突发传输个数,最多 16 字节突发。
.. code-block:: c
:linenos:
#define DMA_BURST_INCR1 0
#define DMA_BURST_INCR4 1
#define DMA_BURST_INCR8 2
#define DMA_BURST_INCR16 3
.. warning:: 位宽 * 突发个数 需要小于等于 16 字节
dma addr
^^^^^^^^^^^^^^^^^^^^^
参考 `bflb_dma.h` 文件,不详细列出。
dma request
^^^^^^^^^^^^^^^^^^^^^
参考 `bflb_dma.h` 文件,不详细列出。
Structs
------------
struct bflb_dma_channel_lli_pool_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
由于 dma 支持 lli 模式,所以需要在传输之前分配一块内存池给 lli 使用, 调用 `bflb_dma_lli_reload` 后会自动消耗内存池和配置相关 lli 信息,无需用户手动配置。
.. code-block:: c
:linenos:
struct bflb_dma_channel_lli_pool_s {
uint32_t src_addr;
uint32_t dst_addr;
uint32_t nextlli;
union bflb_dma_lli_control_s lli_control;
};
struct bflb_dma_channel_lli_transfer_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
用户使用 lli 传输时,需要填充的传输内容:源地址、目标地址和长度,并且如果地址不连续,可以增加多个 transfer。
.. code-block:: c
:linenos:
struct bflb_dma_channel_lli_transfer_s {
uint32_t src_addr;
uint32_t dst_addr;
uint32_t nbytes;
};
struct bflb_dma_channel_config_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
初始化 dma 通道时需要填充的信息。
.. code-block:: c
:linenos:
struct bflb_dma_channel_config_s {
uint8_t direction;
uint32_t src_req;
uint32_t dst_req;
uint8_t src_addr_inc;
uint8_t dst_addr_inc;
uint8_t src_burst_count;
uint8_t dst_burst_count;
uint8_t src_width;
uint8_t dst_width;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - direction
- 传输方向
* - src_req
- 源 dma 请求
* - dst_req
- 目标 dma 请求
* - src_addr_inc
- 源地址是否自增
* - dst_addr_inc
- 目标地址是否自增
* - src_burst_count
- 源地址突发个数
* - dst_burst_count
- 目标地址突发个数
* - src_width
- 源地址位宽
* - dst_width
- 目标地址位宽
Functions
------------
bflb_dma_channel_init
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 初始化 dma 通道。
.. code-block:: c
:linenos:
void bflb_dma_channel_init(struct bflb_device_s *dev, const struct bflb_dma_channel_config_s *config);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - config
- 配置参数
bflb_dma_channel_deinit
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 反初始化 dma 通道。
.. code-block:: c
:linenos:
void bflb_dma_channel_deinit(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_dma_channel_start
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 启动 dma 通道传输。
.. code-block:: c
:linenos:
void bflb_dma_channel_start(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_dma_channel_stop
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭 dma 通道传输。
.. code-block:: c
:linenos:
void bflb_dma_channel_stop(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_dma_channel_isbusy
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 检查 dma 通道是否处于 busy 状态。
.. code-block:: c
:linenos:
bool bflb_dma_channel_isbusy(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 是否 busy
bflb_dma_channel_irq_attach
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 注册 dma 通道中断完成回调函数并开启通道完成中断。
.. code-block:: c
:linenos:
void bflb_dma_channel_irq_attach(struct bflb_device_s *dev, void (*callback)(void *arg), void *arg);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - callback
- 回调函数
* - arg
- 用户参数
bflb_dma_channel_irq_detach
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭 dma 通道完成中断。
.. code-block:: c
:linenos:
void bflb_dma_channel_irq_detach(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_dma_channel_lli_reload
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 配置 dma 通道的 lli 信息。
.. code-block:: c
:linenos:
int bflb_dma_channel_lli_reload(struct bflb_device_s *dev,
struct bflb_dma_channel_lli_pool_s *lli_pool, uint32_t max_lli_count,
struct bflb_dma_channel_lli_transfer_s *transfer, uint32_t count);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - lli_pool
- lli 内存池
* - max_lli_count
- lli 内存池大小
* - transfer
- 传输句柄
* - count
- 传输次数
* - return
- 返回使用的 lli count个数小于0表示错误
bflb_dma_channel_lli_link_head
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 将 lli 最后一个链表与头部连接,表示开启循环模式。
.. code-block:: c
:linenos:
void bflb_dma_channel_lli_link_head(struct bflb_device_s *dev,
struct bflb_dma_channel_lli_pool_s *lli_pool, uint32_t used_lli_count);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - lli_pool
- lli 内存池
* - used_lli_count
- 已经使用的 lli 个数
bflb_dma_feature_control
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: dma 其他特性相关控制,一般不常用。
.. code-block:: c
:linenos:
void bflb_dma_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - cmd
- 控制字
* - arg
- 控制参数
`cmd` 可以填入以下参数:
.. code-block:: c
:linenos:
#define DMA_CMD_SET_SRCADDR_INCREMENT (0x01)
#define DMA_CMD_SET_DSTADDR_INCREMENT (0x02)
#define DMA_CMD_SET_ADD_MODE (0x03)
#define DMA_CMD_SET_REDUCE_MODE (0x04)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,235 +0,0 @@
FLASH
=============
Macros
------------
flash iomode
^^^^^^^^^^^^^^^^^^^^
.. code-block:: c
:linenos:
#define FLASH_IOMODE_NIO 0
#define FLASH_IOMODE_DO 1
#define FLASH_IOMODE_QO 2
#define FLASH_IOMODE_DIO 3
#define FLASH_IOMODE_QIO 4
Structs
------------
Functions
------------
bflb_flash_init
^^^^^^^^^^^^^^^^^^^^
说明: flash 初始化,自动识别支持的 flash 并重新配置 flash 的参数。如果返回错误,必须停止运行代码。
.. code-block:: c
:linenos:
int bflb_flash_init(void);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - return
- 返回 0 表示成功,其他表示错误,必须停止运行代码
bflb_flash_get_jedec_id
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 flash jedec id。
.. code-block:: c
:linenos:
uint32_t bflb_flash_get_jedec_id(void);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - return
- 返回 flash jedec id
bflb_flash_get_cfg
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 flash 配置。
.. code-block:: c
:linenos:
void bflb_flash_get_cfg(uint8_t **cfg_addr, uint32_t *len);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - cfg_addr
- 保存 flash 配置的地址
* - len
- flash 配置的长度
bflb_flash_set_iomode
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 设置 flash IO 工作模式。
.. code-block:: c
:linenos:
void bflb_flash_set_iomode(uint8_t iomode);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - iomode
- flash IO 工作模式
bflb_flash_get_image_offset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取代码 xip 虚拟地址实际所在的 flash 物理地址。
.. code-block:: c
:linenos:
uint32_t bflb_flash_get_image_offset(void);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - return
- 返回 flash xip 物理地址
bflb_flash_erase
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: flash 扇区擦除。 **len** 为擦除的长度,需要为 4096 倍数,假设 **addr** 为0 **len** 为 4096则擦除范围为 0 ~ 4095。
.. code-block:: c
:linenos:
int bflb_flash_erase(uint32_t addr, uint32_t len);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - addr
- 擦除的物理地址
* - len
- 擦除长度,需要是 4096 的倍数
* - return
- 返回 0 表示成功,其他表示错误
bflb_flash_write
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取代码 xip 虚拟地址实际所在的 flash 物理地址。
.. code-block:: c
:linenos:
int bflb_flash_write(uint32_t addr, uint8_t *data, uint32_t len);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - addr
- 写入的物理地址
* - data
- 写入的数据缓冲区
* - len
- 写入长度
* - return
- 返回 0 表示成功,其他表示错误
bflb_flash_read
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取代码 xip 虚拟地址实际所在的 flash 物理地址。
.. code-block:: c
:linenos:
int bflb_flash_read(uint32_t addr, uint8_t *data, uint32_t len);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - addr
- 读取的物理地址
* - data
- 读取的数据缓冲区
* - len
- 读取长度
* - return
- 返回 0 表示成功,其他表示错误
bflb_flash_aes_init
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 配置某一段 flash 区域进行硬件 aes 解密,能够通过 xip 直接读取解密后的内容。
.. code-block:: c
:linenos:
void bflb_flash_aes_init(struct bflb_flash_aes_config_s *config);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - config
- flash aes 配置
bflb_flash_aes_enable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 使能 flash aes 解密。
.. code-block:: c
:linenos:
void bflb_flash_aes_enable(void);
bflb_flash_aes_disable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭 flash aes 解密。
.. code-block:: c
:linenos:
void bflb_flash_aes_disable(void);

View File

@ -1,346 +0,0 @@
GPIO
=============
Macros
------------
gpio pin
^^^^^^^^^^
参考 `bflb_gpio.h` 文件,不详细列出。
.. warning:: 相同系列芯片引脚数会有区别,注意区分
gpio mode
^^^^^^^^^^
gpio 模式可以配置成输入、输出、模拟、复用。
.. code-block:: c
:linenos:
#define GPIO_INPUT (0 << GPIO_MODE_SHIFT) /* Input Enable */
#define GPIO_OUTPUT (1 << GPIO_MODE_SHIFT) /* Output Enable */
#define GPIO_ANALOG (2 << GPIO_MODE_SHIFT) /* Analog Enable */
#define GPIO_ALTERNATE (3 << GPIO_MODE_SHIFT) /* Alternate Enable */
gpio function
^^^^^^^^^^^^^^^
参考 `bflb_gpio.h` 文件,不详细列出。
gpio pupd
^^^^^^^^^^^^^^^
gpio 上下拉可以选择上拉、下拉、浮空。
.. code-block:: c
:linenos:
#define GPIO_FLOAT (0 << GPIO_PUPD_SHIFT) /* No pull-up, pull-down */
#define GPIO_PULLUP (1 << GPIO_PUPD_SHIFT) /* Pull-up */
#define GPIO_PULLDOWN (2 << GPIO_PUPD_SHIFT) /* Pull-down */
gpio smt
^^^^^^^^^^^^^^^
gpio 滤波开关。
.. code-block:: c
:linenos:
#define GPIO_SMT_DIS (0 << GPIO_SMT_SHIFT)
#define GPIO_SMT_EN (1 << GPIO_SMT_SHIFT)
gpio drive
^^^^^^^^^^^^^^^
gpio 输出能力选择。
.. code-block:: c
:linenos:
#define GPIO_DRV_0 (0 << GPIO_DRV_SHIFT)
#define GPIO_DRV_1 (1 << GPIO_DRV_SHIFT)
#define GPIO_DRV_2 (2 << GPIO_DRV_SHIFT)
#define GPIO_DRV_3 (3 << GPIO_DRV_SHIFT)
gpio int trig mode
^^^^^^^^^^^^^^^^^^^^^
gpio 外部中断触发模式。
.. code-block:: c
:linenos:
#define GPIO_INT_TRIG_MODE_SYNC_FALLING_EDGE 0
#define GPIO_INT_TRIG_MODE_SYNC_RISING_EDGE 1
#define GPIO_INT_TRIG_MODE_SYNC_LOW_LEVEL 2
#define GPIO_INT_TRIG_MODE_SYNC_HIGH_LEVEL 3
#if defined(BL702)
#define GPIO_INT_TRIG_MODE_ASYNC_FALLING_EDGE 4
#define GPIO_INT_TRIG_MODE_ASYNC_RISING_EDGE 5
#define GPIO_INT_TRIG_MODE_ASYNC_LOW_LEVEL 6
#define GPIO_INT_TRIG_MODE_ASYNC_HIGH_LEVEL 7
#else
#define GPIO_INT_TRIG_MODE_SYNC_FALLING_RISING_EDGE 4
#define GPIO_INT_TRIG_MODE_ASYNC_FALLING_EDGE 8
#define GPIO_INT_TRIG_MODE_ASYNC_RISING_EDGE 9
#define GPIO_INT_TRIG_MODE_ASYNC_LOW_LEVEL 10
#define GPIO_INT_TRIG_MODE_ASYNC_HIGH_LEVEL 11
#endif
.. warning:: 602、702 不支持双边沿
gpio uart function
^^^^^^^^^^^^^^^^^^^^^
博流系列芯片,每个 gpio 可以选择到 UART 的任意一个功能。
.. code-block:: c
:linenos:
#define GPIO_UART_FUNC_UART0_RTS 0
#define GPIO_UART_FUNC_UART0_CTS 1
#define GPIO_UART_FUNC_UART0_TX 2
#define GPIO_UART_FUNC_UART0_RX 3
#define GPIO_UART_FUNC_UART1_RTS 4
#define GPIO_UART_FUNC_UART1_CTS 5
#define GPIO_UART_FUNC_UART1_TX 6
#define GPIO_UART_FUNC_UART1_RX 7
#if defined(BL808) || defined(BL606P)
#define GPIO_UART_FUNC_UART2_RTS 8
#define GPIO_UART_FUNC_UART2_CTS 9
#define GPIO_UART_FUNC_UART2_TX 10
#define GPIO_UART_FUNC_UART2_RX 11
#endif
Structs
------------
Functions
------------
bflb_gpio_init
^^^^^^^^^^^^^^^^^^^^
说明: 初始化 gpio。如果配置为 UART 功能,请使用 `bflb_gpio_uart_init`
.. code-block:: c
:linenos:
void bflb_gpio_init(struct bflb_device_s *dev, uint8_t pin, uint32_t cfgset);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - pin
- gpio pin
* - cfgset
- gpio 配置项gpio mode、gpio function、gpio pupd、gpio smt、gpio drive多个配置需要使用 | 连接
bflb_gpio_deinit
^^^^^^^^^^^^^^^^^^^^
说明: 反初始化 gpio默认为输入浮空状态
.. code-block:: c
:linenos:
void bflb_gpio_deinit(struct bflb_device_s *dev, uint8_t pin);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - pin
- gpio pin
bflb_gpio_set
^^^^^^^^^^^^^^^^^^^^
说明: gpio 输出高电平
.. code-block:: c
:linenos:
void bflb_gpio_set(struct bflb_device_s *dev, uint8_t pin);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - pin
- gpio pin
bflb_gpio_reset
^^^^^^^^^^^^^^^^^^^^
说明: gpio 输出低电平
.. code-block:: c
:linenos:
void bflb_gpio_reset(struct bflb_device_s *dev, uint8_t pin);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - pin
- gpio pin
bflb_gpio_read
^^^^^^^^^^^^^^^^^^^^
说明: 读取 gpio 电平
.. code-block:: c
:linenos:
bool bflb_gpio_read(struct bflb_device_s *dev, uint8_t pin);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - pin
- gpio pin
* - return
- true 为 高电平false 为低电平
bflb_gpio_int_init
^^^^^^^^^^^^^^^^^^^^
说明: gpio 外部中断初始化
.. code-block:: c
:linenos:
void bflb_gpio_int_init(struct bflb_device_s *dev, uint8_t pin, uint8_t trig_mode);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - pin
- gpio pin
* - trig_mode
- 中断触发模式
bflb_gpio_int_mask
^^^^^^^^^^^^^^^^^^^^
说明: gpio 外部中断屏蔽开关
.. code-block:: c
:linenos:
void bflb_gpio_int_mask(struct bflb_device_s *dev, uint8_t pin, bool mask);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - pin
- gpio pin
* - mask
- 是否屏蔽中断
bflb_gpio_get_intstatus
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 gpio 外部中断是否触发的标志
.. code-block:: c
:linenos:
bool bflb_gpio_get_intstatus(struct bflb_device_s *dev, uint8_t pin);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - pin
- gpio pin
* - return
- 为 true 表示触发
bflb_gpio_int_clear
^^^^^^^^^^^^^^^^^^^^^^^^
说明: 清除 gpio 中断标志
.. code-block:: c
:linenos:
void bflb_gpio_int_clear(struct bflb_device_s *dev, uint8_t pin);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - pin
- gpio pin
bflb_gpio_uart_init
^^^^^^^^^^^^^^^^^^^^^^^
说明: gpio 配置成 uart 的某一个功能。
.. code-block:: c
:linenos:
void bflb_gpio_uart_init(struct bflb_device_s *dev, uint8_t pin, uint8_t uart_func);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - pin
- gpio pin
* - uart_func
- uart 具体某一个功能

View File

@ -1,161 +0,0 @@
I2C
=============
Macros
------------
Structs
------------
struct bflb_i2c_msg_s
^^^^^^^^^^^^^^^^^^^^^^^^^^
i2c 传输时需要填充的消息。
.. code-block:: c
:linenos:
struct bflb_i2c_msg_s {
uint16_t addr;
uint16_t flags;
uint8_t *buffer;
uint16_t length;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - addr
- 设备地址7 位或者 10 位)
* - flags
- 传输时附带标志
* - buffer
- 数据区
* - length
- 数据长度
`flag` 可以为以下参数:
.. code-block:: c
:linenos:
#define I2C_M_READ 0x0001
#define I2C_M_TEN 0x0002
#define I2C_M_DMA 0x0004
#define I2C_M_NOSTOP 0x0040
#define I2C_M_NOSTART 0x0080
.. note:: I2C_M_NOSTOP 表示 i2c 设备需要操作寄存器地址
Functions
------------
bflb_i2c_init
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 初始化 i2c 并配置频率。
.. code-block:: c
:linenos:
void bflb_i2c_init(struct bflb_device_s *dev, uint32_t frequency);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - frequency
- 配置频率(范围 305 HZ ~ 400KHZ
bflb_i2c_deinit
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 反初始化 i2c。
.. code-block:: c
:linenos:
void bflb_i2c_deinit(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_i2c_link_txdma
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: i2c 发送 dma 使能开关。
.. code-block:: c
:linenos:
void bflb_i2c_link_txdma(struct bflb_device_s *dev, bool enable);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - enable
- 是否使能 dma
bflb_i2c_link_rxdma
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: i2c 接收 dma 使能开关。
.. code-block:: c
:linenos:
void bflb_i2c_link_rxdma(struct bflb_device_s *dev, bool enable);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - enable
- 是否使能 dma
bflb_i2c_transfer
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: i2c 消息传输。
.. code-block:: c
:linenos:
int bflb_i2c_transfer(struct bflb_device_s *dev, struct bflb_i2c_msg_s *msgs, int count);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - msgs
- 消息指针
* - count
- 消息个数

View File

@ -1,234 +0,0 @@
=======================
Peripherals
=======================
简介
---------
BouffaloSDK 中外设驱动分为两类: **LHAL****SOC** ,前者对通用外设进行了统一的封装,不同芯片使用同一套接口,方便用户使用和移植到其他平台。后者则是每个芯片独有且特殊的部分,比如 GLB、HBN、PDS、AON 等等。
下面主要列出 **LHAL** 相关 API 的使用。
**LHAL** 中各个外设 API 声明均在 `drivers/include` 目录下可以查看。在学习 API 使用之前,我们需要了解 `struct bflb_device_s` 结构体的含义和作用。
.. code-block:: C
:linenos:
struct bflb_device_s {
const char *name;
uint32_t reg_base;
uint8_t irq_num;
uint8_t idx;
uint8_t sub_idx;
uint8_t dev_type;
void *user_data;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - name
- 外设名称
* - reg_base
- 外设寄存器基地址
* - irq_num
- 外设中断号
* - idx
- 外设 id
* - idx
- 外设 id,例如 UART0、UART1
* - sub_idx
- 外设子 id,例如 DMA0_CH0、DMA0_CH1
* - dev_type
- 外设类型
* - user_data
- 用户变量
从上我们可以知道 `struct bflb_device_s` 结构体成员的具体信息,其中比较重要的就是 **reg_base****irq_num** ,有了这两个,我们才能操作外设寄存器和外设中断。那么当我们进行外设配置之前,就需要先获取该结构体句柄,从中获取我们需要的信息,否则不能对外设进行操作。获取结构体句柄有以下两种方式:
- `bflb_device_get_by_name` 通过 **name** 获取
- `bflb_device_get_by_id` 通过 **dev_type****idx** 获取
**那么还有一个问题,结构体句柄保存在哪?**
对于每个系列芯片支持的外设,我们将结构体句柄保存在一个 table 表中。详见 **lhal/config/xxx/device_table.c** 文件。
API 支持情况
---------------
了解了上面的基本概念以后,接下来就可以查阅相关 **LHAL** API 并使用了。当前已经支持的 **LHAL** API 列表如下:
.. note:: **✔️** 表示已支持; **❌** 表示未支持; **❓** 表示已支持但未测试; **** 表示没有该外设。
.. list-table::
:widths: 10 10 10 10 10
:header-rows: 1
* - peripheral
- BL602/BL604
- BL702/BL704/BL706
- BL616/BL618
- BL808
* - ADC
- ❓
- ✔️
- ✔️
- ❓
* - CAM
-
- ❌
- ❌
- ❌
* - CKS
- ❓
- ✔️
- ✔️
- ❓
* - DAC
- ❓
- ✔️
- ✔️
- ❓
* - DMA
- ❓
- ✔️
- ✔️
- ✔️
* - EFUSE
- ❓
- ✔️
- ✔️
- ✔️
* - EMAC
-
- ✔️
- ✔️
- ✔️
* - FLASH
- ✔️
- ✔️
- ✔️
- ✔️
* - GPIO
- ❓
- ✔️
- ✔️
- ✔️
* - I2C
- ❓
- ✔️
- ✔️
- ❓
* - IR
- ❓
- ✔️
- ✔️
- ✔️
* - MJPEG
- ❌
- ✔️
- ✔️
- ❌
* - PWM_v1
- ❓
- ✔️
-
-
* - PWM_v2
-
-
- ✔️
- ✔️
* - RTC
- ❓
- ✔️
- ✔️
- ✔️
* - SEC_AES
- ❓
- ✔️
- ✔️
- ✔️
* - SEC_SHA
- ❓
- ✔️
- ✔️
- ✔️
* - SEC_TRNG
- ❓
- ✔️
- ✔️
- ✔️
* - SEC_PKA
- ❓
- ✔️
- ✔️
- ✔️
* - SPI
- ❓
- ✔️
- ✔️
- ❓
* - TIMER
- ❓
- ✔️
- ✔️
- ✔️
* - UART
- ❓
- ✔️
- ✔️
- ✔️
* - USB_v1
-
- ✔️
-
-
* - USB_v2
-
-
- ✔️
- ✔️
* - WDG
- ❓
- ✔️
- ✔️
- ✔️
API 列表
---------------
除了使用网页版查看 API 以外, 还提供了 **LHAL Doxygen** 版本,离线生成文档。 Doxyfile 文件在 ``drivers/lhal`` 目录下。
使用 Doxywizard 导入并运行即可。
.. figure:: doxygen.png
:alt:
.. toctree::
:maxdepth: 1
ADC <adc>
CKS <cks>
CLOCK <clock>
DAC <dac>
DMA <dma>
FLASH <flash>
GPIO <gpio>
I2C <i2c>
IRQ <irq>
L1C <l1c>
MTIMER <mtimer>
PWM_v1 <pwm_v1>
PWM_v2 <pwm_v2>
RTC <rtc>
SEC_AES <sec_aes>
SEC_SHA <sec_sha>
SEC_PKA <sec_pka>
SPI <spi>
TIMER <timer>
UART <uart>
WDG <wdg>

View File

@ -1,219 +0,0 @@
IRQ
=============
Macros
------------
Structs
------------
Functions
------------
bflb_irq_initialize
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 中断控制器初始化,清除所有中断和中断 pending。
.. code-block:: c
:linenos:
void bflb_irq_initialize(void);
bflb_irq_save
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭全局中断并保存之前的状态。
.. code-block:: c
:linenos:
uintptr_t bflb_irq_save(void);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - return
- 返回关闭之前的状态
bflb_irq_restore
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 恢复关闭全局中断之前的状态。
.. code-block:: c
:linenos:
void bflb_irq_restore(uintptr_t flags);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - flags
- 关闭之前的状态
bflb_irq_attach
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 注册中断入口函数。
.. code-block:: c
:linenos:
int bflb_irq_attach(int irq, irq_callback isr, void *arg);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - flags
- 关闭之前的状态
bflb_irq_detach
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 取消中断函数注册。
.. code-block:: c
:linenos:
int bflb_irq_detach(int irq);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - flags
- 关闭之前的状态
bflb_irq_enable
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 开启中断。
.. code-block:: c
:linenos:
void bflb_irq_enable(int irq);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - irq
- 中断号
bflb_irq_disable
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭中断。
.. code-block:: c
:linenos:
void bflb_irq_disable(int irq);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - irq
- 中断号
bflb_irq_set_pending
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 设置中断 pending 位。
.. code-block:: c
:linenos:
void bflb_irq_set_pending(int irq);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - irq
- 中断号
bflb_irq_clear_pending
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 清除中断 pending 位。
.. code-block:: c
:linenos:
void bflb_irq_clear_pending(int irq);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - irq
- 中断号
bflb_irq_set_nlbits
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 设置中断分组。
.. code-block:: c
:linenos:
void bflb_irq_set_nlbits(uint8_t nlbits);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - irq
- 中断号
bflb_irq_set_priority
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 设置中断优先级。
.. code-block:: c
:linenos:
void bflb_irq_set_priority(int irq, uint8_t preemptprio, uint8_t subprio);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - irq
- 中断号
* - preemptprio
- 抢占优先级
* - subprio
- 子优先级

View File

@ -1,118 +0,0 @@
L1C
=============
Macros
------------
Structs
------------
Functions
------------
bflb_l1c_icache_enable
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 开启 icache。
.. code-block:: c
:linenos:
void bflb_l1c_icache_enable(void);
bflb_l1c_icache_disable
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭 icache。
.. code-block:: c
:linenos:
void bflb_l1c_icache_disable(void);
bflb_l1c_dcache_enable
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 开启 dcache。
.. code-block:: c
:linenos:
void bflb_l1c_dcache_enable(void);
bflb_l1c_dcache_disable
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭 dcache。
.. code-block:: c
:linenos:
void bflb_l1c_dcache_disable(void);
bflb_l1c_dcache_clean_range
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: clean 一段数据到内存中。
.. code-block:: c
:linenos:
void bflb_l1c_dcache_clean_range(unsigned long addr, uint32_t len);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - addr
- 首地址(必须 32 字节对齐)
* - len
- 长度
bflb_l1c_dcache_invalidate_range
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 将 cache 中的数据置为 dity。
.. code-block:: c
:linenos:
void bflb_l1c_dcache_invalidate_range(unsigned long addr, uint32_t len);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - addr
- 首地址(必须 32 字节对齐)
* - len
- 长度
bflb_l1c_dcache_clean_invalidate_range
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: clean 一段数据到内存中,并使 cache 中的数据失效。
.. code-block:: c
:linenos:
void bflb_l1c_dcache_clean_invalidate_range(unsigned long addr, uint32_t len);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - addr
- 首地址(必须 32 字节对齐)
* - len
- 长度

View File

@ -1,131 +0,0 @@
MTIMER
=============
Macros
------------
Structs
------------
Functions
------------
bflb_mtimer_config
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: mtimer 定时配置。
.. code-block:: c
:linenos:
void bflb_mtimer_config(uint64_t ticks, void (*interruptfun)(void));
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - ticks
- 定时 tick 数
* - interruptfun
- 中断回调
bflb_mtimer_get_freq
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 mtimer 频率。默认 mtimer 经过分频后设置成了 1M所以频率就是 1M。
.. code-block:: c
:linenos:
uint32_t bflb_mtimer_get_freq(void);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - return
- 频率
bflb_mtimer_delay_ms
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: mtimer 毫秒延时。
.. code-block:: c
:linenos:
void bflb_mtimer_delay_ms(uint32_t time);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - time
- 延时时间
bflb_mtimer_delay_us
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: mtimer 微妙延时。
.. code-block:: c
:linenos:
void bflb_mtimer_delay_us(uint32_t time);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - time
- 延时时间
bflb_mtimer_get_time_us
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 mtimer 当前时间us 为单位。
.. code-block:: c
:linenos:
uint64_t bflb_mtimer_get_time_us();
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - return
- 当前时间
bflb_mtimer_get_time_ms
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 mtimer 当前时间ms 为单位。
.. code-block:: c
:linenos:
uint64_t bflb_mtimer_get_time_ms();
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - return
- 当前时间

View File

@ -1,183 +0,0 @@
PWM_v1
=============
.. note:: PWM V1 版本每个 PWM 的所有通道频率可以单独设置。
Macros
------------
pwm channel
^^^^^^^^^^^^^^
PWM V1 版本共 5 个 pwm 通道。BL702L 只有通道 0
Structs
------------
struct bflb_pwm_v1_channel_config_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pwm v1 初始化配置结构体。
.. code-block:: c
:linenos:
struct bflb_pwm_v1_channel_config_s {
uint8_t clk_source;
uint16_t clk_div;
uint16_t period;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - clk_source
- 时钟源选择PBCLK or XCLK or 32K_CLK
* - clk_div
- 分频值
* - period
- 周期值
.. note:: PWM 最终产生的频率 = clk_source/clk_div/period
Functions
------------
bflb_pwm_v1_channel_init
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 初始化 pwm 通道。使用之前需要选择 gpio 为 pwm 功能。
.. code-block:: c
:linenos:
void bflb_pwm_v1_channel_init(struct bflb_device_s *dev, uint8_t ch, const struct bflb_pwm_v1_channel_config_s *config);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
* - config
- 配置项
bflb_pwm_v1_channel_deinit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 复位 pwm 通道。
.. code-block:: c
:linenos:
void bflb_pwm_v1_channel_deinit(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
bflb_pwm_v1_start
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 启动 pwm 通道输出。
.. code-block:: c
:linenos:
void bflb_pwm_v1_start(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
bflb_pwm_v1_stop
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭 pwm 通道输出。
.. code-block:: c
:linenos:
void bflb_pwm_v1_stop(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
bflb_pwm_v1_set_period
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 修改 pwm 通道周期值,从而更改 pwm 通道输出的频率。
.. code-block:: c
:linenos:
void bflb_pwm_v1_set_period(struct bflb_device_s *dev, uint8_t ch, uint16_t period);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
* - period
- 周期值
bflb_pwm_v1_channel_set_threshold
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 设置 pwm 占空比。
.. code-block:: c
:linenos:
void bflb_pwm_v1_channel_set_threshold(struct bflb_device_s *dev, uint8_t ch, uint16_t low_threhold, uint16_t high_threhold);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
* - low_threhold
- 低阈值
* - high_threhold
- 高阈值,需要大于 low_threhold并且小于等于 period
.. note:: PWM 占空比 = (high_threhold - low_threhold)/period

View File

@ -1,483 +0,0 @@
PWM_v2
=============
.. note:: PWM V2 版本每个 PWM 的所有通道共用一个频率。
Macros
------------
pwm channel
^^^^^^^^^^^^^^
PWM V2 版本每个 PWM 共 4 个 pwm 通道。
pwm polarity
^^^^^^^^^^^^^^
PWM V2 版本输出有效极性。当正向通道阈值位于设置的低阈值和高阈值之间,为有效极性,如果设置有效极性为高,则输出高电平,反之输出低电平。反向通道相反,阈值位于设置的低阈值和高阈值之外,为有效极性,如果设置有效极性为高,则输出高电平,反之输出低电平。
.. code-block:: c
:linenos:
#define PWM_POLARITY_ACTIVE_LOW 0
#define PWM_POLARITY_ACTIVE_HIGH 1
Structs
------------
struct bflb_pwm_v2_config_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pwm v2 初始化配置结构体。
.. code-block:: c
:linenos:
struct bflb_pwm_v2_config_s {
uint8_t clk_source;
uint16_t clk_div;
uint16_t period;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - clk_source
- 时钟源选择PBCLK or XCLK or 32K_CLK
* - clk_div
- 分频值
* - period
- 周期值
.. note:: PWM 最终产生的频率 = clk_source/clk_div/period
struct bflb_pwm_v2_channel_config_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pwm v2 初始化配置结构体。
.. code-block:: c
:linenos:
struct bflb_pwm_v2_channel_config_s {
uint8_t positive_polarity;
uint8_t negative_polarity;
uint8_t positive_stop_state;
uint8_t negative_stop_state;
uint8_t positive_brake_state;
uint8_t negative_brake_state;
uint8_t dead_time;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - positive_polarity
- 正向输出极性
* - negative_polarity
- 反向输出极性
* - positive_stop_state
- 正向输出空闲状态
* - negative_stop_state
- 反向输出空闲状态
* - positive_brake_state
- 正向输出刹车状态
* - negative_brake_state
- 反向输出刹车状态
* - dead_time
- 死区时间
Functions
------------
bflb_pwm_v2_init
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 初始化 pwm 。使用之前需要选择 gpio 为 pwm 功能。
.. code-block:: c
:linenos:
void bflb_pwm_v2_init(struct bflb_device_s *dev, const struct bflb_pwm_v2_config_s *config);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - config
- 配置项
bflb_pwm_v2_deinit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 复位 pwm 。
.. code-block:: c
:linenos:
void bflb_pwm_v2_deinit(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_pwm_v2_start
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 启动 pwm 输出。
.. code-block:: c
:linenos:
void bflb_pwm_v2_start(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_pwm_v2_stop
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 关闭 pwm 输出。
.. code-block:: c
:linenos:
void bflb_pwm_v2_stop(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_pwm_v2_set_period
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 修改 pwm 周期值,从而更改 pwm 输出的频率。
.. code-block:: c
:linenos:
void bflb_pwm_v2_set_period(struct bflb_device_s *dev, uint16_t period);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - period
- 周期值
bflb_pwm_v2_channel_init
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: PWM 通道初始化。
.. code-block:: c
:linenos:
void bflb_pwm_v2_channel_init(struct bflb_device_s *dev, uint8_t ch, struct bflb_pwm_v2_channel_config_s *config);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
* - config
- 通道配置
bflb_pwm_v2_channel_set_threshold
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 设置 PWM 占空比。
.. code-block:: c
:linenos:
void bflb_pwm_v2_channel_set_threshold(struct bflb_device_s *dev, uint8_t ch, uint16_t low_threhold, uint16_t high_threhold);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
* - low_threhold
- 低阈值
* - high_threhold
- 高阈值,需要大于 low_threhold并且小于等于 period
.. note:: PWM 占空比 = (high_threhold - low_threhold)/period
bflb_pwm_v2_channel_positive_start
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: PWM 正向通道使能输出。
.. code-block:: c
:linenos:
void bflb_pwm_v2_channel_positive_start(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
bflb_pwm_v2_channel_negative_start
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: PWM 反向通道使能输出。
.. code-block:: c
:linenos:
void bflb_pwm_v2_channel_negative_start(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
bflb_pwm_v2_channel_positive_stop
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: PWM 正向通道停止输出。
.. code-block:: c
:linenos:
void bflb_pwm_v2_channel_positive_stop(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
bflb_pwm_v2_channel_negative_stop
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: PWM 反向通道停止输出。
.. code-block:: c
:linenos:
void bflb_pwm_v2_channel_negative_stop(struct bflb_device_s *dev, uint8_t ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 通道号
bflb_pwm_v2_int_enable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: PWM 中断使能和关闭。
.. code-block:: c
:linenos:
void bflb_pwm_v2_int_enable(struct bflb_device_s *dev, uint32_t int_en, bool enable);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - int_en
- 中断使能位
* - enable
- 是否开启中断
`int_en` 可以填入以下值,多个中断可以使用 `|` 连接:
.. code-block:: c
:linenos:
#define PWM_INTEN_CH0_L (1 << 0)
#define PWM_INTEN_CH0_H (1 << 1)
#define PWM_INTEN_CH1_L (1 << 2)
#define PWM_INTEN_CH1_H (1 << 3)
#define PWM_INTEN_CH2_L (1 << 4)
#define PWM_INTEN_CH2_H (1 << 5)
#define PWM_INTEN_CH3_L (1 << 6)
#define PWM_INTEN_CH3_H (1 << 7)
#define PWM_INTEN_PERIOD (1 << 8)
#define PWM_INTEN_BRAKE (1 << 9)
#define PWM_INTEN_REPT (1 << 10)
bflb_pwm_v2_get_intstatus
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 PWM 中断标志。
.. code-block:: c
:linenos:
uint32_t bflb_pwm_v2_get_intstatus(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 返回中断标志
返回值如下:
.. code-block:: c
:linenos:
#define PWM_INTSTS_CH0_L (1 << 0)
#define PWM_INTSTS_CH0_H (1 << 1)
#define PWM_INTSTS_CH1_L (1 << 2)
#define PWM_INTSTS_CH1_H (1 << 3)
#define PWM_INTSTS_CH2_L (1 << 4)
#define PWM_INTSTS_CH2_H (1 << 5)
#define PWM_INTSTS_CH3_L (1 << 6)
#define PWM_INTSTS_CH3_H (1 << 7)
#define PWM_INTSTS_PERIOD (1 << 8)
#define PWM_INTSTS_BRAKE (1 << 9)
#define PWM_INTSTS_REPT (1 << 10)
bflb_pwm_v2_int_clear
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 清除 PWM 中断标志。
.. code-block:: c
:linenos:
void bflb_pwm_v2_int_clear(struct bflb_device_s *dev, uint32_t int_clear);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - int_clear
- 清除值
`int_clear` 可以填入以下参数:
.. code-block:: c
:linenos:
#define PWM_INTCLR_CH0_L (1 << 0)
#define PWM_INTCLR_CH0_H (1 << 1)
#define PWM_INTCLR_CH1_L (1 << 2)
#define PWM_INTCLR_CH1_H (1 << 3)
#define PWM_INTCLR_CH2_L (1 << 4)
#define PWM_INTCLR_CH2_H (1 << 5)
#define PWM_INTCLR_CH3_L (1 << 6)
#define PWM_INTCLR_CH3_H (1 << 7)
#define PWM_INTCLR_PERIOD (1 << 8)
#define PWM_INTCLR_BRAKE (1 << 9)
#define PWM_INTCLR_REPT (1 << 10)
bflb_pwm_v2_feature_control
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: PWM 其他特性相关控制,一般不常用。
.. code-block:: c
:linenos:
int bflb_pwm_v2_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - cmd
- 控制字
* - arg
- 控制参数
* - return
- 负值表示不支持此命令
`cmd` 可以填入以下参数:
.. code-block:: c
:linenos:
#define PWM_CMD_SET_TRIG_ADC_SRC (0x01)
#define PWM_CMD_SET_EXT_BRAKE_POLARITY (0x02)
#define PWM_CMD_SET_EXT_BRAKE_ENABLE (0x03)
#define PWM_CMD_SET_SW_BRAKE_ENABLE (0x04)
#define PWM_CMD_SET_STOP_ON_REPT (0x05)
#define PWM_CMD_SET_REPT_COUNT (0x06)

View File

@ -1,66 +0,0 @@
RTC
=============
Macros
------------
BFLB_RTC_SEC2TIME
^^^^^^^^^^^^^^^^^^^^^^^
将秒转换成 RTC 时间
BFLB_RTC_TIME2SEC
^^^^^^^^^^^^^^^^^^^^^^^
将 RTC 时间转换成秒
Structs
------------
Functions
------------
bflb_rtc_set_time
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 设置 RTC 时间。
.. code-block:: c
:linenos:
void bflb_rtc_set_time(struct bflb_device_s *dev, uint64_t time);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - time
- RTC 时间(单位: 1/32768 s)
bflb_rtc_get_time
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 RTC 时间。
.. code-block:: c
:linenos:
uint64_t bflb_rtc_get_time(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- RTC 时间(单位: 1/32768 s)

View File

@ -1,15 +0,0 @@
SEC_AES
=============
Macros
------------
Structs
------------
Functions
------------

View File

@ -1,15 +0,0 @@
SEC_PKA
=============
Macros
------------
Structs
------------
Functions
------------

View File

@ -1,15 +0,0 @@
SEC_SHA
=============
Macros
------------
Structs
------------
Functions
------------

View File

@ -1,406 +0,0 @@
SPI
=============
Macros
------------
spi role
^^^^^^^^^^^^
spi 支持主从角色。
.. code-block:: c
:linenos:
#define SPI_ROLE_MASTER 0
#define SPI_ROLE_SLAVE 1
spi mode
^^^^^^^^^^^^
spi 支持 4 种工作模式。
.. code-block:: c
:linenos:
#define SPI_DEV_MODE0 0 /* CPOL=0 CHPHA=0 */
#define SPI_DEV_MODE1 1 /* CPOL=0 CHPHA=1 */
#define SPI_DEV_MODE2 2 /* CPOL=1 CHPHA=0 */
#define SPI_DEV_MODE3 3 /* CPOL=1 CHPHA=1 */
spi data_width
^^^^^^^^^^^^^^^
spi 支持 4 种位宽。
.. code-block:: c
:linenos:
#define SPI_DATA_WIDTH_8BIT 0
#define SPI_DATA_WIDTH_16BIT 1
#define SPI_DATA_WIDTH_24BIT 2
#define SPI_DATA_WIDTH_32BIT 3
spi bit_order
^^^^^^^^^^^^^^^
spi bit 先行方式。
.. code-block:: c
:linenos:
#define SPI_BIT_LSB 1
#define SPI_BIT_MSB 0
spi byte_order
^^^^^^^^^^^^^^^
spi 字节先行方式。
.. code-block:: c
:linenos:
#define SPI_BYTE_LSB 0
#define SPI_BYTE_MSB 1
Structs
------------
struct bflb_spi_config_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spi 初始化配置结构体。
.. code-block:: c
:linenos:
struct bflb_spi_config_s {
uint32_t freq;
uint8_t role;
uint8_t mode;
uint8_t data_width;
uint8_t bit_order;
uint8_t byte_order;
uint8_t tx_fifo_threshold;
uint8_t rx_fifo_threshold;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - freq
- 频率(BL702 不得超过32M,其他芯片不得超过 40M)
* - role
- 主从选择
* - mode
- 工作模式
* - data_width
- 数据宽度
* - bit_order
- bit 先行方式
* - byte_order
- 字节先行方式
* - tx_fifo_threshold
- 发送 fifo 中断触发阈值(大于阈值触发中断)
* - rx_fifo_threshold
- 接收 fifo 中断触发阈值(大于阈值触发中断)
.. note:: SPI 阈值最大为 16
Functions
------------
bflb_spi_init
^^^^^^^^^^^^^^^^^^^^
说明: 初始化 spi。使用之前需要开启 spi ip 时钟、设置 spi 时钟源和分频值、选择 gpio 为 spi 功能。
.. code-block:: c
:linenos:
void bflb_spi_init(struct bflb_device_s *dev, const struct bflb_spi_config_s *config);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - config
- 配置项
bflb_spi_deinit
^^^^^^^^^^^^^^^^^^^^
说明: 反初始化 spi。
.. code-block:: c
:linenos:
void bflb_spi_deinit(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_spi_link_txdma
^^^^^^^^^^^^^^^^^^^^^^^
说明: spi tx dma 使能开关。
.. code-block:: c
:linenos:
void bflb_spi_link_txdma(struct bflb_device_s *dev, bool enable);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - enable
- 是否使能 dma
bflb_spi_link_rxdma
^^^^^^^^^^^^^^^^^^^^^^^
说明: spi rx dma 使能开关。
.. code-block:: c
:linenos:
void bflb_spi_link_rxdma(struct bflb_device_s *dev, bool enable);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - enable
- 是否使能 dma
bflb_spi_poll_send
^^^^^^^^^^^^^^^^^^^^
说明: 通过 spi 阻塞式发送一个数据并接收一个数据。
.. code-block:: c
:linenos:
uint32_t bflb_spi_poll_send(struct bflb_device_s *dev, uint32_t data);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - data
- 发送的数据(可以为字节、字、双字)
* - return
- 接收的数据(可以为字节、字、双字)
bflb_spi_poll_exchange
^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 通过 spi 阻塞式发送一段数据并接收一段数据。
.. code-block:: c
:linenos:
int bflb_spi_poll_exchange(struct bflb_device_s *dev, const void *txbuffer, void *rxbuffer, size_t nbyte);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - txbuffer
- 发送缓冲区
* - rxbuffer
- 接收缓冲区
* - nbyte
- 数据长度
bflb_spi_txint_mask
^^^^^^^^^^^^^^^^^^^^^^^
说明: spi tx fifo 阈值中断屏蔽开关,开启后超过设定阈值则触发中断。
.. code-block:: c
:linenos:
void bflb_spi_txint_mask(struct bflb_device_s *dev, bool mask);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - mask
- 是否屏蔽中断
bflb_spi_rxint_mask
^^^^^^^^^^^^^^^^^^^^^^^
说明: spi rx fifo 阈值中断和超时屏蔽开关,开启后超过设定阈值则或者超时则触发中断。
.. code-block:: c
:linenos:
void bflb_spi_rxint_mask(struct bflb_device_s *dev, bool mask);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - mask
- 是否屏蔽中断
bflb_spi_errint_mask
^^^^^^^^^^^^^^^^^^^^^^^
说明: spi 错误中断屏蔽开关。
.. code-block:: c
:linenos:
void bflb_spi_errint_mask(struct bflb_device_s *dev, bool mask);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - mask
- 是否屏蔽中断
bflb_spi_get_intstatus
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 spi 中断标志。
.. code-block:: c
:linenos:
uint32_t bflb_spi_get_intstatus(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 中断标志
中断标志有以下选项:
.. code-block:: c
:linenos:
#define SPI_INTSTS_TC (1 << 0)
#define SPI_INTSTS_TX_FIFO (1 << 1)
#define SPI_INTSTS_RX_FIFO (1 << 2)
#define SPI_INTSTS_SLAVE_TIMEOUT (1 << 3)
#define SPI_INTSTS_SLAVE_TX_UNDERRUN (1 << 4)
#define SPI_INTSTS_FIFO_ERR (1 << 5)
bflb_spi_int_clear
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 清除 spi 中断标志。
.. code-block:: c
:linenos:
void bflb_spi_int_clear(struct bflb_device_s *dev, uint32_t int_clear);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - int_clear
- 清除值
`int_clear` 可以填入以下参数:
.. code-block:: c
:linenos:
#define SPI_INTCLR_TC (1 << 16)
#define SPI_INTCLR_SLAVE_TIMEOUT (1 << 19)
#define SPI_INTCLR_SLAVE_TX_UNDERRUN (1 << 20)
bflb_spi_feature_control
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: spi 其他特性相关控制,一般不常用。
.. code-block:: c
:linenos:
int bflb_spi_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - cmd
- 控制字
* - arg
- 控制参数
* - return
- 负值表示不支持此命令
`cmd` 可以填入以下参数:
.. code-block:: c
:linenos:
#define SPI_CMD_SET_DATA_WIDTH (0x01)
#define SPI_CMD_GET_DATA_WIDTH (0x02)
#define SPI_CMD_CLEAR_TX_FIFO (0x03)
#define SPI_CMD_CLEAR_RX_FIFO (0x04)
#define SPI_CMD_SET_CS_INTERVAL (0x05)

View File

@ -1,305 +0,0 @@
TIMER
=============
Macros
------------
timer clock source
^^^^^^^^^^^^^^^^^^^^^^
定时器输入时钟源可以选择以下类型,注意: `TIMER_CLKSRC_GPIO` BL602/BL702 系列没有此功能。
.. code-block:: c
:linenos:
#define TIMER_CLKSRC_BCLK 0
#define TIMER_CLKSRC_32K 1
#define TIMER_CLKSRC_1K 2
#define TIMER_CLKSRC_XTAL 3
#define TIMER_CLKSRC_GPIO 4
#define TIMER_CLKSRC_NO 5
timer counter mode
^^^^^^^^^^^^^^^^^^^^^^
定时器计数模式分为两种: freerun(向上计数模式)、preload(重装载模式)。
.. code-block:: c
:linenos:
#define TIMER_COUNTER_MODE_PROLOAD 0
#define TIMER_COUNTER_MODE_UP 1
timer compare id
^^^^^^^^^^^^^^^^^^^^^^
定时器一共三个 compare id, 用于设置不同的定时时间,可以当三个定时器使用。
.. code-block:: c
:linenos:
#define TIMER_COMP_ID_0 0
#define TIMER_COMP_ID_1 1
#define TIMER_COMP_ID_2 2
Structs
------------
struct bflb_timer_config_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
timer 初始化配置结构体。
.. code-block:: c
:linenos:
struct bflb_timer_config_s {
uint8_t counter_mode;
uint8_t clock_source;
uint8_t clock_div;
uint8_t trigger_comp_id;
uint32_t comp0_val;
uint32_t comp1_val;
uint32_t comp2_val;
uint32_t preload_val;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - counter_mode
- 计数模式
* - clock_source
- 时钟源选择
* - clock_div
- 分频值
* - trigger_comp_id
- 选择触发的最高 comp id(选择越高,则能够定时的个数越多)
* - comp0_val
- comp0 比较值
* - comp1_val
- comp1 比较值(需要大于 comp0_val)
* - comp2_val
- comp2 比较值(需要大于 comp1_val)
* - preload_val
- 重装载值
Functions
------------
bflb_timer_init
^^^^^^^^^^^^^^^^^^^^
说明: 初始化 timer。使用之前需要开启 timer ip 时钟。
.. code-block:: c
:linenos:
void bflb_timer_init(struct bflb_device_s *dev, const struct bflb_timer_config_s *config);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - config
- 配置项
bflb_timer_deinit
^^^^^^^^^^^^^^^^^^^^
说明: 反初始化 timer。
.. code-block:: c
:linenos:
void bflb_timer_deinit(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_timer_start
^^^^^^^^^^^^^^^^^^^^
说明: 启动 timer 。
.. code-block:: c
:linenos:
void bflb_timer_start(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_timer_stop
^^^^^^^^^^^^^^^^^^^^
说明: 停止 timer。
.. code-block:: c
:linenos:
void bflb_timer_stop(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_timer_set_compvalue
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 设置 timer comp id 比较值。
.. code-block:: c
:linenos:
void bflb_timer_set_compvalue(struct bflb_device_s *dev, uint8_t cmp_no, uint32_t val);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - cmp_no
- comp id
* - val
- 比较值
bflb_timer_get_compvalue
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 comp id 比较值。
.. code-block:: c
:linenos:
uint32_t bflb_timer_get_compvalue(struct bflb_device_s *dev, uint8_t cmp_no);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - cmp_no
- comp id
* - return
- 比较值
bflb_timer_get_countervalue
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 timer 计数值。
.. code-block:: c
:linenos:
uint32_t bflb_timer_get_countervalue(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 计数值
bflb_timer_compint_mask
^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: timer comp 中断屏蔽开关。
.. code-block:: c
:linenos:
void bflb_timer_compint_mask(struct bflb_device_s *dev, uint8_t cmp_no, bool mask);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - cmp_no
- comp id
* - mask
- 是否屏蔽中断
bflb_timer_get_compint_status
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 timer comp id 中断匹配标志。
.. code-block:: c
:linenos:
bool bflb_timer_get_compint_status(struct bflb_device_s *dev, uint8_t cmp_no);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - cmp_no
- comp id
* - return
- 为 true 表示匹配
bflb_timer_compint_clear
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 清除 timer comp id 中断标志。
.. code-block:: c
:linenos:
void bflb_timer_compint_clear(struct bflb_device_s *dev, uint8_t cmp_no);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - cmp_no
- comp id

View File

@ -1,499 +0,0 @@
UART
=============
Macros
------------
uart direction
^^^^^^^^^^^^^^^^^^
UART 方向可以设置为 TX、RX、TXRX
uart databits
^^^^^^^^^^^^^^^^^^
.. code-block:: c
:linenos:
#define UART_DATA_BITS_5 0
#define UART_DATA_BITS_6 1
#define UART_DATA_BITS_7 2
#define UART_DATA_BITS_8 3
#define UART_DATA_BITS_9 4
uart stopbits
^^^^^^^^^^^^^^^^^^
.. code-block:: c
:linenos:
#define UART_STOP_BITS_0_5 0
#define UART_STOP_BITS_1 1
#define UART_STOP_BITS_1_5 2
#define UART_STOP_BITS_2 3
uart parity
^^^^^^^^^^^^^^^^^^
.. code-block:: c
:linenos:
#define UART_PARITY_NONE 0
#define UART_PARITY_ODD 1
#define UART_PARITY_EVEN 2
#define UART_PARITY_MARK 3
#define UART_PARITY_SPACE 4
uart bit order
^^^^^^^^^^^^^^^^^^
.. code-block:: c
:linenos:
#define UART_LSB_FIRST 0
#define UART_MSB_FIRST 1
Structs
------------
struct bflb_uart_config_s
^^^^^^^^^^^^^^^^^^^^^^^^^^
uart 初始化配置结构体。
.. code-block:: c
:linenos:
struct bflb_uart_config_s {
uint32_t baudrate;
uint8_t direction;
uint8_t data_bits;
uint8_t stop_bits;
uint8_t parity;
uint8_t bit_order;
uint8_t flow_ctrl;
uint8_t tx_fifo_threshold;
uint8_t rx_fifo_threshold;
};
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - baudrate
- 波特率
* - direction
- 方向
* - data_bits
- 数据位
* - stop_bits
- 停止位
* - parity
- 校验位
* - bit_order
- bit 先行方式
* - flow_ctrl
- 流控
* - tx_fifo_threshold
- 发送 fifo 中断触发阈值(大于阈值触发中断)
* - rx_fifo_threshold
- 接收 fifo 中断触发阈值(大于阈值触发中断)
.. note:: BL702 阈值为 128, 其他芯片为 32
Functions
------------
bflb_uart_init
^^^^^^^^^^^^^^^^^^^^
说明: 初始化 uart。使用之前需要开启 uart ip 时钟、设置 uart 时钟源和分频值、选择 gpio 为 uart 中的一个功能。
.. code-block:: c
:linenos:
void bflb_uart_init(struct bflb_device_s *dev, const struct bflb_uart_config_s *config);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - config
- 配置项
bflb_uart_deinit
^^^^^^^^^^^^^^^^^^^^
说明: 反初始化 uart。
.. code-block:: c
:linenos:
void bflb_uart_deinit(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
bflb_uart_link_txdma
^^^^^^^^^^^^^^^^^^^^^^^
说明: uart tx dma 使能开关。
.. code-block:: c
:linenos:
void bflb_uart_link_txdma(struct bflb_device_s *dev, bool enable);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - enable
- 是否使能 dma
bflb_uart_link_rxdma
^^^^^^^^^^^^^^^^^^^^^^^
说明: uart rx dma 使能开关。
.. code-block:: c
:linenos:
void bflb_uart_link_rxdma(struct bflb_device_s *dev, bool enable);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - enable
- 是否使能 dma
bflb_uart_putchar
^^^^^^^^^^^^^^^^^^^^
说明: 通过 uart 阻塞式发送一个字符。
.. code-block:: c
:linenos:
void bflb_uart_putchar(struct bflb_device_s *dev, int ch);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - ch
- 字符
bflb_uart_getchar
^^^^^^^^^^^^^^^^^^^^
说明: 通过 uart 异步接收一个字符。
.. code-block:: c
:linenos:
int bflb_uart_getchar(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 返回 -1 表示没有数据,返回其他表示接收的字符
bflb_uart_txready
^^^^^^^^^^^^^^^^^^^^
说明: 查询 uart tx fifo 是否准备就绪,准备好才可以填充字符。
.. code-block:: c
:linenos:
bool bflb_uart_txready(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 为 true 表示就绪
bflb_uart_txempty
^^^^^^^^^^^^^^^^^^^^
说明: 查询 uart tx fifo 是否为空。
.. code-block:: c
:linenos:
bool bflb_uart_txempty(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 为 true 表示 fifo 已空,无法填充数据
bflb_uart_rxavailable
^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 查询 uart rx 是否有数据。
.. code-block:: c
:linenos:
bool bflb_uart_rxavailable(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 为 true 表示有数据,可以进行读取
bflb_uart_txint_mask
^^^^^^^^^^^^^^^^^^^^^^^
说明: uart tx fifo 阈值中断屏蔽开关,开启后超过设定阈值则触发中断。
.. code-block:: c
:linenos:
void bflb_uart_txint_mask(struct bflb_device_s *dev, bool mask);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - mask
- 是否屏蔽中断
bflb_uart_rxint_mask
^^^^^^^^^^^^^^^^^^^^^^^
说明: uart rx fifo 阈值中断和超时屏蔽开关,开启后超过设定阈值则或者超时则触发中断。
.. code-block:: c
:linenos:
void bflb_uart_rxint_mask(struct bflb_device_s *dev, bool mask);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - mask
- 是否屏蔽中断
bflb_uart_errint_mask
^^^^^^^^^^^^^^^^^^^^^^^
说明: uart 错误中断屏蔽开关。
.. code-block:: c
:linenos:
void bflb_uart_errint_mask(struct bflb_device_s *dev, bool mask);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - mask
- 是否屏蔽中断
bflb_uart_get_intstatus
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 获取 uart 中断标志。
.. code-block:: c
:linenos:
uint32_t bflb_uart_get_intstatus(struct bflb_device_s *dev);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - return
- 中断标志
中断标志有以下选项:
.. code-block:: c
:linenos:
#define UART_INTSTS_TX_END (1 << 0)
#define UART_INTSTS_RX_END (1 << 1)
#define UART_INTSTS_TX_FIFO (1 << 2)
#define UART_INTSTS_RX_FIFO (1 << 3)
#define UART_INTSTS_RTO (1 << 4)
#define UART_INTSTS_PCE (1 << 5)
#define UART_INTSTS_TX_FER (1 << 6)
#define UART_INTSTS_RX_FER (1 << 7)
#if !defined(BL602)
#define UART_INTSTS_RX_LSE (1 << 8)
#endif
#if !defined(BL602) && !defined(BL702)
#define UART_INTSTS_RX_BCR (1 << 9)
#define UART_INTSTS_RX_ADS (1 << 10)
#define UART_INTSTS_RX_AD5 (1 << 11)
#endif
bflb_uart_int_clear
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: 清除 uart 中断标志。
.. code-block:: c
:linenos:
void bflb_uart_int_clear(struct bflb_device_s *dev, uint32_t int_clear);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - int_clear
- 清除值
`int_clear` 可以填入以下参数:
.. code-block:: c
:linenos:
#define UART_INTCLR_TX_END (1 << 0)
#define UART_INTCLR_RX_END (1 << 1)
#define UART_INTCLR_RTO (1 << 4)
#define UART_INTCLR_PCE (1 << 5)
#if !defined(BL602)
#define UART_INTCLR_RX_LSE (1 << 8)
#endif
#if !defined(BL602) && !defined(BL702)
#define UART_INTCLR_RX_BCR (1 << 9)
#define UART_INTCLR_RX_ADS (1 << 10)
#define UART_INTCLR_RX_AD5 (1 << 11)
#endif
bflb_uart_feature_control
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
说明: uart 其他特性相关控制,一般不常用。
.. code-block:: c
:linenos:
int bflb_uart_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
.. list-table::
:widths: 10 10
:header-rows: 1
* - parameter
- description
* - dev
- 设备句柄
* - cmd
- 控制字
* - arg
- 控制参数
* - return
- 负值表示不支持此命令
`cmd` 可以填入以下参数:
.. code-block:: c
:linenos:
#define UART_CMD_SET_BAUD_RATE (0x01)
#define UART_CMD_SET_DATA_BITS (0x02)
#define UART_CMD_SET_STOP_BITS (0x03)
#define UART_CMD_SET_PARITY_BITS (0x04)
#define UART_CMD_CLR_TX_FIFO (0x05)
#define UART_CMD_CLR_RX_FIFO (0x06)
#define UART_CMD_SET_RTO_VALUE (0x07)
#define UART_CMD_SET_RTS_VALUE (0x08)
#define UART_CMD_GET_TX_FIFO_CNT (0x09)
#define UART_CMD_GET_RX_FIFO_CNT (0x0a)
#define UART_CMD_SET_AUTO_BAUD (0x0b)
#define UART_CMD_GET_AUTO_BAUD (0x0c)
#define UART_CMD_SET_BREAK_VALUE (0x0d)
#define UART_CMD_SET_TX_LIN_VALUE (0x0e)
#define UART_CMD_SET_RX_LIN_VALUE (0x0f)
#define UART_CMD_SET_TX_RX_EN (0x10)
#define UART_CMD_SET_TX_RS485_EN (0x11)
#define UART_CMD_SET_TX_RS485_POLARITY (0x12)
#define UART_CMD_SET_ABR_ALLOWABLE_ERROR (0x13)
#define UART_CMD_SET_SW_RTS_CONTROL (0x14)
#define UART_CMD_IR_CONFIG (0x15)
#define UART_CMD_SET_TX_FREERUN (0x16)
#define UART_CMD_SET_TX_END_INTERRUPT (0x17)
#define UART_CMD_SET_RX_END_INTERRUPT (0x18)
#define UART_CMD_SET_TX_TRANSFER_LEN (0x19)
#define UART_CMD_SET_RX_TRANSFER_LEN (0x20)
#define UART_CMD_SET_TX_EN (0x21)
#define UART_CMD_SET_BCR_END_INTERRUPT (0x22)
#define UART_CMD_GET_BCR_COUNT (0x23)

View File

@ -1,15 +0,0 @@
WDG
=============
Macros
------------
Structs
------------
Functions
------------

0
docs/zh/_static/.gitkeep Normal file
View File

View File

@ -430,3 +430,5 @@ ble_set_tx_pwr
Functions
----------------
ble stack 采用 zephyr ble stack因此 API 请参考 `zephyr bluetooth api <https://docs.zephyrproject.org/apidoc/latest/group__bluetooth.html>`_

View File

@ -0,0 +1,30 @@
.. _blemesh-index:
BLE_MESH
==================
CLI 命令
-------------
blemesh_init
^^^^^^^^^^^^^^^^^^^^
- 命令功能blemesh通用初始化在所有blemesh cli操作前需要先输入该命令
- 参数:无
- 示例:输入命令 ``blemesh_init``
blemesh_pb
^^^^^^^^^^^^^^^^^^^^
- 命令功能:设置 Provisioning 承载
- 第一个参数表示 Provisioning 承载方式
- 1承载方式 PB-ADV
- 2承载方式 PB-GATT
- 第二个参数表示使能
- 示例:输入命令 ``blemesh_pb 2 1``
Functions
----------------
ble stack 采用 zephyr ble mesh因此 API 请参考 `zephyr bluetooth mesh api <https://docs.zephyrproject.org/apidoc/latest/group__bt__mesh.html>`_

View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,7 @@
=======================
LHAL
=======================
**LHAL** 是 BouffaloSDK 为统一通用外设而实现的驱动库,不同芯片使用同一套接口,方便用户使用和移植到其他平台。
**LHAL** API 文档请参考 `doxygen for lhal <../_static/html/index.html>`_

View File

@ -1,5 +1,28 @@
# Configuration file for the Sphinx documentation builder.
import os
import os.path
import subprocess
import shutil
os.environ[r'BL_SDK_BASE'] = os.path.abspath(r'../..')
os.environ[r'DOXYGEN_OUTPUT_DIR'] = os.path.abspath(r'_static')
def doxygen_run(bl_sdk_path):
shutil.rmtree(os.environ[r'DOXYGEN_OUTPUT_DIR'], ignore_errors=True)
doxygen_conf = os.path.join(bl_sdk_path, r'docs/doxygen/Doxyfile')
doxygen_cmd = r'doxygen ' + doxygen_conf
print(os.path.abspath(doxygen_conf))
return_code, out = subprocess.getstatusoutput(doxygen_cmd)
#print(out)
if 0 != return_code:
print("Doxygen failed!!!")
print(out)
doxygen_run(os.environ[r'BL_SDK_BASE'])
# -- Project information
project = 'BouffaloSDK'
@ -32,6 +55,3 @@ templates_path = ['_templates']
# -- Options for HTML output
html_theme = 'sphinx_rtd_theme'
# -- Options for EPUB output
epub_show_urls = 'footnote'

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Some files were not shown because too many files have changed in this diff Show More