[doc] update readme and rst

This commit is contained in:
jzlv 2022-10-29 16:13:16 +08:00
parent 5ce60f5c3a
commit b1fafb81f3
11 changed files with 295 additions and 138 deletions

View File

@ -30,6 +30,7 @@ Note**√** means supported **×** means not supported**○** means sup
|:------------:|:--------------:|:--------------------:|:-----------:|:--------:|
| ADC | ○ | √ | √ | ○ |
| CAM | - | × | × | × |
| CKS | ○ | √ | √ | ○ |
| DAC | ○ | √ | √ | ○ |
| DMA | ○ | √ | √ | √ |
| EFUSE | × | × | × | × |
@ -45,11 +46,13 @@ Note**√** means supported **×** means not supported**○** means sup
| SEC_AES | ○ | √ | √ | √ |
| SEC_SHA | ○ | √ | √ | √ |
| SEC_TRNG | ○ | √ | √ | √ |
| SEC_PKA | ○ | √ | √ | √ |
| SPI | ○ | √ | √ | ○ |
| TIMER | ○ | √ | √ | √ |
| UART | √ | √ | √ | √ |
| USB_v1 | - | √ | - | - |
| USB_v2 | - | - | √ | √ |
| WDG | ○ | ○ | √ | ○ |
## Code Framework
@ -170,7 +173,7 @@ Bouffalolab Developer Forum: [https://bbs.bouffalolab.com/](https://bbs.bouffalo
```
/*
* Copyright (c) 2021 Bouffalolab team
* Copyright (c) 2022 Bouffalolab team
*
* SPDX-License-Identifier: Apache-2.0
*/

View File

@ -30,6 +30,7 @@
|:------------:|:--------------:|:--------------------:|:-----------:|:--------:|
| ADC | ○ | √ | √ | ○ |
| CAM | - | × | × | × |
| CKS | ○ | √ | √ | ○ |
| DAC | ○ | √ | √ | ○ |
| DMA | ○ | √ | √ | √ |
| EFUSE | × | × | × | × |
@ -45,11 +46,13 @@
| SEC_AES | ○ | √ | √ | √ |
| SEC_SHA | ○ | √ | √ | √ |
| SEC_TRNG | ○ | √ | √ | √ |
| SEC_PKA | ○ | √ | √ | √ |
| SPI | ○ | √ | √ | ○ |
| TIMER | ○ | √ | √ | √ |
| UART | √ | √ | √ | √ |
| USB_v1 | - | √ | - | - |
| USB_v2 | - | - | √ | √ |
| WDG | ○ | ○ | √ | ○ |
# 代码框架
@ -161,7 +164,7 @@ TODO
```
/*
* Copyright (c) 2021 Bouffalolab team
* Copyright (c) 2022 Bouffalolab team
*
* SPDX-License-Identifier: Apache-2.0
*/

View File

@ -120,10 +120,10 @@ adc 标准转换结果
:linenos:
struct bflb_adc_result_s {
int8_t pos_chan;
int8_t neg_chan;
uint16_t value;
int32_t millivolt;
int8_t pos_chan;
int8_t neg_chan;
int32_t value;
int32_t millivolt;
};
.. list-table::

View File

@ -44,10 +44,11 @@ i2c 传输时需要填充的消息。
.. code-block:: c
:linenos:
#define I2C_M_READ 0x0001
#define I2C_M_TEN 0x0002
#define I2C_M_NOSTOP 0x0040
#define I2C_M_NOSTART 0x0080
#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 设备需要操作寄存器地址

View File

@ -62,7 +62,7 @@ API 支持情况
了解了上面的基本概念以后,接下来就可以查阅相关 **LHAL** API 并使用了。当前已经支持的 **LHAL** API 列表如下:
.. note:: **√** 表示已支持; **×** 表示未支持; **○** 表示已支持但未测试; **-** 表示没有该外设。
.. note:: **✔️** 表示已支持; **❌** 表示未支持; **❓** 表示已支持但未测试; **** 表示没有该外设。
.. list-table::
:widths: 10 10 10 10 10
@ -74,115 +74,115 @@ API 支持情况
- BL616
- BL808
* - ADC
-
-
-
-
-
- ✔️
- ✔️
-
* - CAM
- **-**
- ×
- ×
- ×
-
-
-
-
* - DAC
-
-
-
-
-
- ✔️
- ✔️
-
* - DMA
-
-
-
-
-
- ✔️
- ✔️
- ✔️
* - EFUSE
- ×
- ×
- ×
- ×
-
-
-
-
* - EMAC
- **-**
-
-
-
-
- ✔️
- ✔️
- ✔️
* - FLASH
- ×
- ×
- ×
- ×
-
-
-
-
* - GPIO
-
-
-
-
-
- ✔️
- ✔️
- ✔️
* - I2C
-
-
-
-
-
- ✔️
- ✔️
-
* - IR
-
-
-
-
-
- ✔️
- ✔️
- ✔️
* - MJPEG
- ×
- ×
- ×
- ×
-
-
-
-
* - PWM_v1
-
-
- **-**
- **-**
-
- ✔️
-
-
* - PWM_v2
- **-**
- **-**
-
-
-
-
- ✔️
- ✔️
* - RTC
-
-
-
-
-
- ✔️
- ✔️
- ✔️
* - SEC_AES
-
-
-
-
-
- ✔️
- ✔️
- ✔️
* - SEC_SHA
-
-
-
-
-
- ✔️
- ✔️
- ✔️
* - SEC_TRNG
-
-
-
-
-
- ✔️
- ✔️
- ✔️
* - SPI
-
-
-
-
-
- ✔️
- ✔️
-
* - TIMER
-
-
-
-
-
- ✔️
- ✔️
- ✔️
* - UART
-
-
-
-
-
- ✔️
- ✔️
- ✔️
* - USB_v1
- **-**
-
- **-**
- **-**
-
- ✔️
-
-
* - USB_v2
- **-**
- **-**
-
-
-
-
- ✔️
- ✔️
API 列表
---------------

View File

@ -375,7 +375,7 @@ bflb_spi_feature_control
.. code-block:: c
:linenos:
void bflb_spi_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
int bflb_spi_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
.. list-table::
:widths: 10 10
@ -389,6 +389,8 @@ bflb_spi_feature_control
- 控制字
* - arg
- 控制参数
* - return
- 负值表示不支持此命令
`cmd` 可以填入以下参数:

View File

@ -4,6 +4,21 @@ 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
^^^^^^^^^^^^^^^^^^^^^^

View File

@ -382,16 +382,22 @@ bflb_uart_get_intstatus
.. code-block:: c
:linenos:
UART_UTX_FIFO_INT
UART_URX_FIFO_INT
UART_URX_RTO_INT
UART_URX_PCE_INT
UART_UTX_FER_INT
UART_URX_FER_INT
UART_URX_LSE_INT
UART_URX_BCR_INT
UART_URX_ADS_INT
UART_URX_AD5_INT
#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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -419,12 +425,18 @@ bflb_uart_int_clear
.. code-block:: c
:linenos:
UART_CR_URX_RTO_CLR
UART_CR_URX_PCE_CLR
UART_CR_URX_LSE_CLR
UART_CR_URX_BCR_CLR
UART_CR_URX_ADS_CLR
UART_CR_URX_AD5_CLR
#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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -434,7 +446,7 @@ bflb_uart_feature_control
.. code-block:: c
:linenos:
void bflb_uart_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
int bflb_uart_feature_control(struct bflb_device_s *dev, int cmd, size_t arg);
.. list-table::
:widths: 10 10
@ -448,30 +460,31 @@ bflb_uart_feature_control
- 控制字
* - 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)
#if !defined(BL602) && !defined(BL702)
#define UART_CMD_SET_TX_RS485_EN (0x11)
#define UART_CMD_SET_TX_RS485_POL (0x12)
#endif
#define UART_CMD_SET_ABR_PW_VALUE (0x13)
#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)

View File

@ -5,4 +5,5 @@ Utils
.. toctree::
:maxdepth: 1
LIBC <libc>
VLIBC <vlibc>

View File

@ -0,0 +1,118 @@
LIBC
============
简介
------------
- LIBC 中实现了一个vsnprintf用以避开使用完整的c库减少代码体积。
.. note:: LIBC 中浮点打印只能最大支持到11位小数精度
配置LIBC相关功能
------------
如果需要配置LIBC的相关功能需要在对应的工程目录下 `proj.conf` 文件中添加对应的代码,举例如下:
.. code-block:: cmake
:linenos:
# 使能浮点打印
set(CONFIG_VSNPRINTF_FLOAT 1)
格式化控制字符
------------
.. list-table::
:header-rows: 1
* - proj.conf 配置项
- 功能描述
* - CONFIG_VLIBC
- 使能 **VLIBC** 库,默认使用 **LIBC** ,不配置 **CONFIG_VLIBC** 或配置为 **0** 使能 **LIBC**
* - CONFIG_VSNPRINTF_FLOAT
- 使能格式化输出 (%f, %F) 浮点数格式化支持
* - CONFIG_VSNPRINTF_FLOAT_EX
- 使能格式化输出 (%e, %g, %E, %G) 浮点数扩展格式化支持
* - CONFIG_VSNPRINTF_LONG_LONG
- 使能格式化输出 (%lld,%lli,%llo,%llx,%llX,%llu) 长整型格式化支持
.. list-table::
:header-rows: 1
* - 格式化控制字符 (specifier)
- 支持情况
* - %s
- ✔️
* - %c
- ✔️
* - %d
- ✔️
* - %i
- ✔️
* - %u
- ✔️
* - %x (%X)
- ✔️
* - %o
- ✔️
* - %b
- ✔️
* - %f (%F)
- ✔️
* - %e (%E)
- ✔️
* - %g (%G)
- ✔️
* - %a (%A)
- ❌
* - %p
- ✔️
* - %n
- ❌
.. list-table::
:header-rows: 1
* - 格式化控制变量长度字符 (length)
- 支持情况
* - l
- ✔️
* - ll
- ✔️
* - h
- ✔️
* - hh
- ✔️
* - t
- ✔️
* - j
- ✔️
* - z
- ✔️
.. list-table::
:header-rows: 1
* - 格式化控制标志字符 (flags)
- 支持情况
* - 0
- ✔️
* - \-
- ✔️
* - \+
- ✔️
* - ' ' (空格)
- ✔️
* - #
- ✔️
格式化输出格式
------------
.. code-block:: c
:linenos:
/* 格式化输出控制字符格式 */
/* %[flags][width][.precision][length][specifier] */
printf("%+12.9f\r\n", var)
printf("%-12lld\r\n", var)
printf("%#x\r\n", var)
printf("%08x\r\n", var)
printf("% 8x\r\n", var)

View File

@ -8,6 +8,7 @@ VLIBC
- VLIBC 同时支持对外设进行操作例如将UART当做文件进行处理使用fprintf进行输出。
- VLIBC 体积小、移植极简、同时可以裁剪掉对Fatfs的依赖仅仅当做一个体积小的printf库使用。
.. note:: VLIBC 中浮点打印只能最大支持到11位小数精度
配置VLIBC相关功能
------------