mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
add:air105 bsp (#5607)
* add:air105 bsp * add:去掉注释代码 * add:注释修改 * fix:格式化一遍代码格式 * add:main函数添加闪灯 * add:完善bsp * add:添加一些信息 * add:使用工作队列喂狗 * add:整理目录 * add:去掉乱码部分 * add:修改readme * add:更新readme说明 * add:去掉bootloader.bin和soc_download.exe,README.md中添加标注 * fix:去除多余文件 * add:补充license * add:支持scons --dist * add:更新soc_download.exe连接地址
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
### 本文档为 合宙 开发团队为 airm2m bsp 提供的资料、介绍说明。
|
||||
|
||||
**合宙官网:https://openluat.com**
|
||||
|
||||
**wiki教程文档:https://wiki.luatos.com/**
|
||||
|
||||
**luatos仓库:https://gitee.com/openLuat/LuatOS**
|
||||
|
||||
**Luatos RTthread 软件包仓库:https://github.com/openLuat/luatos-soc-rtt**
|
||||
|
||||
**API手册:https://wiki.luatos.com/api/index.html**
|
||||
|
||||
**社区:https://doc.openluat.com/**
|
||||
|
||||
**air105仓库:https://gitee.com/openLuat/luatos-soc-air105**
|
||||
|
||||
**购买地址:https://luat.taobao.com/index.htm?spm=a1z10.5-c-s.w5002-24045920810.2.457f5bcdtkiPyX**
|
||||
|
||||
**如有问题提问请详细说明现象,提供日志以及最新复现工程,在https://gitee.com/openLuat/LuatOS/issues报问题**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
mainmenu "RT-Thread Configuration"
|
||||
|
||||
config BSP_DIR
|
||||
string
|
||||
option env="BSP_ROOT"
|
||||
default "."
|
||||
|
||||
config RTT_DIR
|
||||
string
|
||||
option env="RTT_ROOT"
|
||||
default "../../.."
|
||||
|
||||
config PKGS_DIR
|
||||
string
|
||||
option env="PKGS_ROOT"
|
||||
default "packages"
|
||||
|
||||
source "$RTT_DIR/Kconfig"
|
||||
source "$PKGS_DIR/Kconfig"
|
||||
source "board/Kconfig"
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
# AIR105开发板 BSP 说明
|
||||
|
||||
## 简介
|
||||
|
||||
本文档为 合宙 开发团队为 AIR105开发板提供的 BSP (板级支持包) 说明。
|
||||
|
||||
主要内容如下:
|
||||
|
||||
- 开发板资源介绍
|
||||
- BSP 快速上手
|
||||
- 进阶使用方法
|
||||
|
||||
通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。
|
||||
|
||||
## 开发板介绍
|
||||
|
||||
AIR105 是合宙推出的一款基于 ARM Cortex-M4 内核的10mm x 10mm 大小的MCU,最高主频为 204Mhz,不仅提供UART/GPIO/I2C/ADC/SPI等基础外设,更提供DAC/USB/DCMI/HSPI等高级外设接口,内置充电功能,支持5V/3.3V供电,同时自带5v转3.3V的LDO,4M字节Flash,640K字节RAM。
|
||||
|
||||
开发板外观如下图所示:
|
||||
|
||||

|
||||
|
||||
该开发板常用 **板载资源** 如下:
|
||||
|
||||
- MCU:Air105,主频 204MHz,4M FLASH ,640KB RAM
|
||||
- 调试下载接口,UART0 To Type-c USB 接口
|
||||
|
||||
开发板更多详细信息请参考合宙Air105 [合宙Air105开发板介绍](https://wiki.luatos.com/chips/air105/board.html)。
|
||||
|
||||
## 外设支持
|
||||
|
||||
本 BSP 目前对外设的支持情况如下:
|
||||
|
||||
| 片上外设 | **支持情况** |
|
||||
| -------- | ------------ |
|
||||
| GPIO | 支持 |
|
||||
| UART | 支持 |
|
||||
| SPI | 支持 |
|
||||
| I2C | 支持 |
|
||||
| RTC | 支持 |
|
||||
| WDT | 支持 |
|
||||
|
||||
|
||||
## 使用说明
|
||||
|
||||
使用说明分为如下两个章节:
|
||||
|
||||
- 快速上手
|
||||
|
||||
本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
|
||||
|
||||
- 进阶使用
|
||||
|
||||
本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
|
||||
|
||||
|
||||
### 快速上手
|
||||
|
||||
本 BSP 为开发者提供 GCC 工程,支持 GCC 开发环境。下面介绍如何将系统运行起来。
|
||||
|
||||
#### 硬件连接
|
||||
|
||||
使用数据线连接开发板到 PC。
|
||||
|
||||
#### 编译下载
|
||||
|
||||
1. 在 bsp 下打开 env 工具。
|
||||
2. 输入`menuconfig`。
|
||||
3. 输入`scons`进行编译。
|
||||
|
||||
编译完成会自动打包bl : bootloader.bin和下载工具:soc_download.exe在bsp目录下生成rtthread_air105.soc,使用[Luatools](http://cdndownload.openluat.com/Luat_tool_src/last_release/Luatools_v2.exe)下载进开发板即可。
|
||||
|
||||
#### 运行结果
|
||||
|
||||
下载程序成功之后,系统会自动运行。
|
||||
|
||||
连接开发板对应串口到 PC , 在终端工具里打开相应的串口(1500000-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:
|
||||
|
||||
|
||||
```bash
|
||||
\ | /
|
||||
- RT - Thread Operating System
|
||||
/ | \ 4.1.0 build Feb 22 2022 09:53:22
|
||||
2006 - 2022 Copyright by RT-Thread team
|
||||
msh >
|
||||
```
|
||||
### 进阶使用
|
||||
|
||||
此 BSP 默认只开启了 GPIO 和 串口0 的功能,如果需使用更多高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下:
|
||||
|
||||
1. 在 bsp 下打开 env 工具。
|
||||
|
||||
2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
|
||||
|
||||
3. 输入`pkgs --update`命令更新软件包。
|
||||
|
||||
4. 输入`scons`进行编译。
|
||||
|
||||
|
||||
|
||||
**Luatos同样也上线了RTthread 软件包,仓库:https://github.com/openLuat/luatos-soc-rtt**
|
||||
|
||||
## 注意事项
|
||||
|
||||
**bootloader.bin和soc_download.exe如不存在会自动下载,请保持网络通畅**
|
||||
|
||||
**烧录前请设置波特率为1500000**
|
||||
|
||||
**air105必须启用看门狗,默认启用**
|
||||
|
||||
**更多资料参考[WIKI](https://wiki.luatos.com/)**
|
||||
|
||||
## 联系人信息
|
||||
|
||||
维护人:
|
||||
|
||||
- [**合宙Luat**](https://gitee.com/openLuat)
|
||||
- [**淘宝地址**](https://item.taobao.com/item.htm?spm=a1z10.5-c-s.w4002-24045920841.15.29395bcdUExSHR&id=666216389131)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# for module compiling
|
||||
import os
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
import sys
|
||||
import rtconfig
|
||||
|
||||
if os.getenv('RTT_ROOT'):
|
||||
RTT_ROOT = os.getenv('RTT_ROOT')
|
||||
else:
|
||||
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
|
||||
|
||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||
try:
|
||||
from building import *
|
||||
except:
|
||||
print('Cannot found RT-Thread root directory, please check RTT_ROOT')
|
||||
print(RTT_ROOT)
|
||||
exit(-1)
|
||||
|
||||
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
|
||||
|
||||
DefaultEnvironment(tools=[])
|
||||
env = Environment(tools = ['mingw'],
|
||||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
||||
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
|
||||
AR = rtconfig.AR, ARFLAGS = '-rc',
|
||||
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
|
||||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
||||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
||||
|
||||
if rtconfig.PLATFORM == 'iar':
|
||||
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
|
||||
env.Replace(ARFLAGS = [''])
|
||||
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rtthread.map')
|
||||
|
||||
Export('RTT_ROOT')
|
||||
Export('rtconfig')
|
||||
|
||||
SDK_ROOT = os.path.abspath('./')
|
||||
|
||||
if os.path.exists(SDK_ROOT + '/libraries'):
|
||||
libraries_path_prefix = SDK_ROOT + '/libraries'
|
||||
else:
|
||||
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
|
||||
|
||||
SDK_LIB = libraries_path_prefix
|
||||
Export('SDK_LIB')
|
||||
|
||||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
@@ -0,0 +1,12 @@
|
||||
import rtconfig
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
CPPPATH = [cwd, str(Dir('#'))]
|
||||
src = Split("""
|
||||
main.c
|
||||
""")
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-02-22 airm2m first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <board.h>
|
||||
#include "drv_gpio.h"
|
||||
|
||||
/* defined the LED2 pin: PD14 */
|
||||
#define LED0_PIN GPIOD_14
|
||||
/* defined the LED3 pin: PD15 */
|
||||
#define LED1_PIN GPIOD_15
|
||||
/* defined the LED4 pin: PC3 */
|
||||
#define LED2_PIN GPIOC_03
|
||||
|
||||
int main(void)
|
||||
{
|
||||
uint32_t Speed = 200;
|
||||
/* set LED2 pin mode to output */
|
||||
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
|
||||
/* set LED3 pin mode to output */
|
||||
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
|
||||
/* set LED4 pin mode to output */
|
||||
rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
|
||||
|
||||
while (1)
|
||||
{
|
||||
rt_pin_write(LED0_PIN, PIN_LOW);
|
||||
rt_thread_mdelay(Speed);
|
||||
rt_pin_write(LED1_PIN, PIN_LOW);
|
||||
rt_thread_mdelay(Speed);
|
||||
rt_pin_write(LED2_PIN, PIN_LOW);
|
||||
rt_thread_mdelay(Speed);
|
||||
rt_pin_write(LED0_PIN, PIN_HIGH);
|
||||
rt_thread_mdelay(Speed);
|
||||
rt_pin_write(LED1_PIN, PIN_HIGH);
|
||||
rt_thread_mdelay(Speed);
|
||||
rt_pin_write(LED2_PIN, PIN_HIGH);
|
||||
rt_thread_mdelay(Speed);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
menu "Hardware Drivers Config"
|
||||
|
||||
config SOC_AIR105
|
||||
bool
|
||||
select ARCH_ARM_CORTEX_M4
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
select BSP_USING_WDT
|
||||
default y
|
||||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
|
||||
config BSP_USING_SHELL_TO_USART
|
||||
bool "Enable SHELL TO USART (uart0)"
|
||||
select BSP_USING_UART
|
||||
select BSP_USING_UART0
|
||||
default y
|
||||
|
||||
config BSP_USING_SPI_FLASH
|
||||
bool "Enable SPI FLASH (W25Q64 spi1)"
|
||||
select BSP_USING_SPI
|
||||
select RT_USING_SFUD
|
||||
select RT_SFUD_USING_SFDP
|
||||
default n
|
||||
|
||||
config BSP_USING_ETH
|
||||
bool "Enable Ethernet Driver"
|
||||
select PKG_USING_WIZNET
|
||||
select BSP_USING_SPI
|
||||
default n
|
||||
if BSP_USING_ETH
|
||||
config EXTERNAL_PHY_ADDRESS
|
||||
hex
|
||||
default 0x00
|
||||
config WIZ_SPI_BUS
|
||||
string "WIZ SPI bus name"
|
||||
default "spi2"
|
||||
config WIZ_SPI_CS
|
||||
int "WIZ SPI bus cs pin"
|
||||
default 19
|
||||
endif
|
||||
|
||||
endmenu
|
||||
|
||||
menu "On-chip Peripheral Drivers"
|
||||
config BSP_USING_GPIO
|
||||
bool "Enable GPIO"
|
||||
select RT_USING_PIN
|
||||
default y
|
||||
|
||||
menuconfig BSP_USING_UART
|
||||
bool "Enable UART"
|
||||
default y
|
||||
select RT_USING_SERIAL
|
||||
if BSP_USING_UART
|
||||
menuconfig BSP_USING_UART0
|
||||
bool "Enable UART0 (Debugger)"
|
||||
default n
|
||||
if BSP_USING_UART0
|
||||
config BSP_UART0_RX_BUFSIZE
|
||||
int "Set UART0 RX buffer size"
|
||||
range 64 65535
|
||||
depends on RT_USING_SERIAL_V2
|
||||
default 256
|
||||
|
||||
config BSP_UART0_TX_BUFSIZE
|
||||
int "Set UART0 TX buffer size"
|
||||
range 0 65535
|
||||
depends on RT_USING_SERIAL_V2
|
||||
default 0
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_UART1
|
||||
bool "Enable UART1"
|
||||
default n
|
||||
if BSP_USING_UART1
|
||||
config BSP_UART1_RX_BUFSIZE
|
||||
int "Set UART1 RX buffer size"
|
||||
range 64 65535
|
||||
depends on RT_USING_SERIAL_V2
|
||||
default 256
|
||||
|
||||
config BSP_UART1_TX_BUFSIZE
|
||||
int "Set UART1 TX buffer size"
|
||||
range 0 65535
|
||||
depends on RT_USING_SERIAL_V2
|
||||
default 0
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_UART2
|
||||
bool "Enable UART2"
|
||||
default n
|
||||
if BSP_USING_UART2
|
||||
config BSP_UART2_RX_BUFSIZE
|
||||
int "Set UART2 RX buffer size"
|
||||
range 64 65535
|
||||
depends on RT_USING_SERIAL_V2
|
||||
default 256
|
||||
|
||||
config BSP_UART2_TX_BUFSIZE
|
||||
int "Set UART2 TX buffer size"
|
||||
range 0 65535
|
||||
depends on RT_USING_SERIAL_V2
|
||||
default 256
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_UART3
|
||||
bool "Enable UART3"
|
||||
default n
|
||||
if BSP_USING_UART3
|
||||
config BSP_UART3_RX_BUFSIZE
|
||||
int "Set UART3 RX buffer size"
|
||||
range 64 65535
|
||||
depends on RT_USING_SERIAL_V2
|
||||
default 256
|
||||
|
||||
config BSP_UART3_TX_BUFSIZE
|
||||
int "Set UART3 TX buffer size"
|
||||
range 0 65535
|
||||
depends on RT_USING_SERIAL_V2
|
||||
default 256
|
||||
endif
|
||||
endif
|
||||
|
||||
config BSP_USING_I2C
|
||||
bool "Enable HW I2C"
|
||||
select RT_USING_I2C
|
||||
default n
|
||||
if BSP_USING_I2C
|
||||
config I2C_BUS_NAME
|
||||
string "HW I2C bus name"
|
||||
default "i2c"
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI BUS"
|
||||
default n
|
||||
select RT_USING_SPI
|
||||
if BSP_USING_SPI
|
||||
config BSP_USING_HSPI0
|
||||
bool "Enable HSPI0 BUS"
|
||||
default n
|
||||
|
||||
config BSP_USING_SPI0
|
||||
bool "Enable SPI0 BUS"
|
||||
default n
|
||||
|
||||
config BSP_USING_SPI1
|
||||
bool "Enable SPI1 BUS"
|
||||
default n
|
||||
|
||||
config BSP_USING_SPI2
|
||||
bool "Enable SPI2 BUS"
|
||||
default n
|
||||
|
||||
config BSP_USING_SPI0S
|
||||
bool "Enable SPI0S BUS"
|
||||
default n
|
||||
endif
|
||||
|
||||
config BSP_USING_ONCHIP_RTC
|
||||
bool "Enable HW onchip rtc"
|
||||
select RT_USING_ONCHIP_RTC
|
||||
default n
|
||||
|
||||
config BSP_USING_WDT
|
||||
bool "Enable Watchdog Timer"
|
||||
select RT_USING_WDT
|
||||
select RT_USING_DEVICE_IPC
|
||||
select RT_USING_SYSTEM_WORKQUEUE
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
@@ -0,0 +1,35 @@
|
||||
import os
|
||||
import rtconfig
|
||||
from building import *
|
||||
|
||||
Import('SDK_LIB')
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
CPPDEFINES = ['__USE_XTL__']
|
||||
# add general drivers
|
||||
src = Split('''
|
||||
board.c
|
||||
''')
|
||||
|
||||
if GetDepend(['BSP_USING_ETH']):
|
||||
src += Glob('ports/w5500_device.c')
|
||||
|
||||
if GetDepend(['BSP_USING_SPI_FLASH']):
|
||||
src += Glob('ports/spi_flash_init.c')
|
||||
|
||||
if GetDepend(['BSP_USING_WDT']):
|
||||
src += Glob('wdt_feed.c')
|
||||
|
||||
path = [cwd]
|
||||
|
||||
startup_path_prefix = SDK_LIB
|
||||
|
||||
if rtconfig.CROSS_TOOL == 'gcc':
|
||||
src += [startup_path_prefix + '/HAL_Driver/Startup/gcc/startup_gcc.s']
|
||||
elif rtconfig.CROSS_TOOL == 'keil':
|
||||
src += [startup_path_prefix + '/HAL_Driver/Startup/arm/startup_gcc.s']
|
||||
elif rtconfig.CROSS_TOOL == 'iar':
|
||||
src += [startup_path_prefix + '/HAL_Driver/Startup/iar/startup_gcc.s']
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
|
||||
Return('group')
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-02-22 airm2m first version
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
uint32_t SystemCoreClock;
|
||||
extern const uint32_t __isr_start_address;
|
||||
|
||||
|
||||
const uint32_t __attribute__((section (".app_info")))
|
||||
g_CAppInfo[256] =
|
||||
{
|
||||
__APP_START_MAGIC__,
|
||||
sizeof(g_CAppInfo),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
void SystemInit(void)
|
||||
{
|
||||
#ifdef __USE_XTL__
|
||||
SYSCTRL->FREQ_SEL = 0x20000000 | SYSCTRL_FREQ_SEL_HCLK_DIV_1_2 | (1 << 13) | SYSCTRL_FREQ_SEL_CLOCK_SOURCE_EXT | SYSCTRL_FREQ_SEL_XTAL_192Mhz;
|
||||
#else
|
||||
SYSCTRL->FREQ_SEL = 0x20000000 | SYSCTRL_FREQ_SEL_HCLK_DIV_1_2 | (1 << 13) | SYSCTRL_FREQ_SEL_CLOCK_SOURCE_INC | SYSCTRL_FREQ_SEL_XTAL_192Mhz;
|
||||
#endif
|
||||
SCB->VTOR = (uint32_t)(&__isr_start_address);
|
||||
SYSCTRL->CG_CTRL1 = SYSCTRL_APBPeriph_ALL;
|
||||
SYSCTRL->SOFT_RST1 = SYSCTRL_APBPeriph_ALL;
|
||||
SYSCTRL->PHER_CTRL &= ~(1 << 20);
|
||||
SYSCTRL->SOFT_RST2 &= ~SYSCTRL_USB_RESET;
|
||||
SYSCTRL->LOCK_R |= SYSCTRL_USB_RESET;
|
||||
__enable_irq();
|
||||
}
|
||||
|
||||
void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
|
||||
{
|
||||
SystemCoreClock = HSE_VALUE * (((SYSCTRL->FREQ_SEL & SYSCTRL_FREQ_SEL_XTAL_Mask) >> SYSCTRL_FREQ_SEL_XTAL_Pos) + 1);
|
||||
}
|
||||
|
||||
void rt_hw_board_init(void)
|
||||
{
|
||||
GPIO_Config(GPIOC_03, 0, 0);
|
||||
GPIO_Config(GPIOD_14, 0, 0);
|
||||
GPIO_Config(GPIOD_15, 0, 0);
|
||||
__NVIC_SetPriorityGrouping(7 - __NVIC_PRIO_BITS);
|
||||
SystemCoreClockUpdate();
|
||||
#ifdef RT_USING_HEAP
|
||||
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
|
||||
#endif
|
||||
rt_hw_systick_init();
|
||||
DMA_GlobalInit();
|
||||
Uart_GlobalInit();
|
||||
DMA_TakeStream(DMA1_STREAM_1);//for qspi
|
||||
CoreTick_Init();
|
||||
#ifdef RT_USING_PIN
|
||||
rt_hw_pin_init();
|
||||
#endif
|
||||
|
||||
/* USART driver initialization is open by default */
|
||||
#ifdef RT_USING_SERIAL
|
||||
rt_hw_usart_init();
|
||||
#endif
|
||||
|
||||
/* Set the shell console output device */
|
||||
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
|
||||
/* Board underlying hardware initialization */
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
rt_components_board_init();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-02-22 airm2m first version
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
#include "app_inc.h"
|
||||
#include <rtthread.h>
|
||||
#include "rtconfig.h"
|
||||
|
||||
#ifdef __CC_ARM
|
||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||
#define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
|
||||
#elif __ICCARM__
|
||||
#pragma section="HEAP"
|
||||
#define HEAP_BEGIN (__segment_end("HEAP"))
|
||||
#else
|
||||
extern int __bss_end;
|
||||
#define HEAP_BEGIN ((void *)&__bss_end)
|
||||
#endif
|
||||
#define HEAP_END (void*)(0x20000000 + 0xA0000)
|
||||
|
||||
void rt_hw_board_init(void);
|
||||
int rt_vbus_do_init(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x01000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0102FFFF;
|
||||
define symbol __ICFEDIT_region_RAM1_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM1_end__ = 0x2009FFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x0400;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x000;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region RAM1_region = mem:[from __ICFEDIT_region_RAM1_start__ to __ICFEDIT_region_RAM1_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM1_region { readwrite, last block CSTACK };
|
||||
@@ -0,0 +1,156 @@
|
||||
/* Program Entry, set to mark it as "used" and avoid gc */
|
||||
MEMORY
|
||||
{
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K
|
||||
FLASH (rx) : ORIGIN = 0x1010000, LENGTH = 3008K
|
||||
}
|
||||
ENTRY(Reset_Handler)
|
||||
_system_stack_size = 0x4000;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.app_info :
|
||||
{
|
||||
. = ALIGN(512);
|
||||
KEEP(*(.app_info))
|
||||
. = ALIGN(512);
|
||||
} >FLASH
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__isr_start_address = .;
|
||||
_stext = .;
|
||||
KEEP(*(.isr_vector)) /* Startup code */
|
||||
|
||||
. = ALIGN(4);
|
||||
*startup_gcc.o(.text .text.*)
|
||||
*(.text) /* remaining code */
|
||||
*(.text.*) /* remaining code */
|
||||
*(.rodata) /* read-only data (constants) */
|
||||
*(.rodata*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.gnu.linkonce.t*)
|
||||
|
||||
/* section information for finsh shell */
|
||||
. = ALIGN(4);
|
||||
__fsymtab_start = .;
|
||||
KEEP(*(FSymTab))
|
||||
__fsymtab_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__vsymtab_start = .;
|
||||
KEEP(*(VSymTab))
|
||||
__vsymtab_end = .;
|
||||
|
||||
/* section information for initial. */
|
||||
. = ALIGN(4);
|
||||
__rt_init_start = .;
|
||||
KEEP(*(SORT(.rti_fn*)))
|
||||
__rt_init_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
PROVIDE(__ctors_start__ = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
PROVIDE(__ctors_end__ = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
_etext = .;
|
||||
} > FLASH
|
||||
|
||||
/* .ARM.exidx is sorted, so has to go in its own output section. */
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
|
||||
/* This is used by the startup in order to initialize the .data secion */
|
||||
_sidata = .;
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
/* .data section which is used for initialized data */
|
||||
|
||||
.data : AT (_sidata)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
/* This is used by the startup in order to initialize the .data secion */
|
||||
_sdata = . ;
|
||||
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d*)
|
||||
*(.RamFunc) /* .RamFunc sections */
|
||||
*(.RamFunc*) /* .RamFunc* sections */
|
||||
. = ALIGN(4);
|
||||
/* This is used by the startup in order to initialize the .data secion */
|
||||
_edata = . ;
|
||||
} >RAM
|
||||
|
||||
.stack :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sstack = .;
|
||||
. = . + _system_stack_size;
|
||||
. = ALIGN(4);
|
||||
_estack = .;
|
||||
} >RAM
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
/* This is used by the startup in order to initialize the .bss secion */
|
||||
_sbss = .;
|
||||
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* This is used by the startup in order to initialize the .bss secion */
|
||||
_ebss = . ;
|
||||
|
||||
*(.bss.init)
|
||||
} > RAM
|
||||
__bss_end = .;
|
||||
|
||||
_end = .;
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
* Symbols in the DWARF debugging sections are relative to the beginning
|
||||
* of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
; *************************************************************
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LR_IROM1 0x01010000 0x002F0000 { ; load region size_region
|
||||
ER_IROM1 0x01010000 0x002F0000 { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
RW_IRAM1 0x20000000 0x000A0000 { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-02-22 airm2m first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "spi_flash.h"
|
||||
#include "spi_flash_sfud.h"
|
||||
#include "drv_spi.h"
|
||||
|
||||
#if defined(BSP_USING_SPI_FLASH)
|
||||
static int rt_hw_spi_flash_init(void)
|
||||
{
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
rt_hw_spi_device_attach("spi1", "spi10", GPIOA, GPIO_PIN_4);
|
||||
|
||||
if (RT_NULL == rt_sfud_flash_probe("W25Q64", "spi10"))
|
||||
{
|
||||
return -RT_ERROR;
|
||||
};
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init);
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-02-22 airm2m first version
|
||||
*/
|
||||
|
||||
#include "drv_spi.h"
|
||||
#include "board.h"
|
||||
int w5500_spi_device_init(void)
|
||||
{
|
||||
return rt_hw_spi_device_attach(WIZ_SPI_BUS,WIZ_SPI_DEVICE, WIZ_SPI_CS);
|
||||
}
|
||||
INIT_DEVICE_EXPORT(w5500_spi_device_init);
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-02-22 airm2m first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
static char device_name[] = "wdt";
|
||||
static rt_device_t wdg_dev;
|
||||
|
||||
static struct rt_work wdt_feed;
|
||||
static void wdt_feed_func(struct rt_work *work, void *work_data)
|
||||
{
|
||||
rt_device_control(wdg_dev, RT_DEVICE_CTRL_WDT_KEEPALIVE, RT_NULL);
|
||||
rt_work_submit(&wdt_feed, 1200);
|
||||
}
|
||||
|
||||
static int wdt_feed_init(void)
|
||||
{
|
||||
rt_err_t ret = RT_EOK;
|
||||
rt_uint32_t timeout = 2;
|
||||
|
||||
wdg_dev = rt_device_find(device_name);
|
||||
if (!wdg_dev)
|
||||
{
|
||||
rt_kprintf("find %s failed!\n", device_name);
|
||||
return RT_ERROR;
|
||||
}
|
||||
|
||||
ret = rt_device_control(wdg_dev, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout);
|
||||
if (ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("set %s timeout failed!\n", device_name);
|
||||
return RT_ERROR;
|
||||
}
|
||||
ret = rt_device_control(wdg_dev, RT_DEVICE_CTRL_WDT_START, RT_NULL);
|
||||
if (ret != RT_EOK)
|
||||
{
|
||||
rt_kprintf("start %s failed!\n", device_name);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
rt_work_init(&wdt_feed, wdt_feed_func, RT_NULL);
|
||||
rt_work_submit(&wdt_feed, 1200);
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_COMPONENT_EXPORT(wdt_feed_init);
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 808 KiB |
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __AIR105_ADC_H__
|
||||
#define __AIR105_ADC_H__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Include ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
#define IS_ADC_PERIPH(PERIPH) ((PERIPH) == ADC0)
|
||||
|
||||
#define ADC_CR1_CHANNEL_MASK ((uint32_t)0x07)
|
||||
#define ADC_CR1_SAMPLE_RATE_Pos 3
|
||||
#define ADC_CR1_SAMPLE_RATE_MASK (0x3 << ADC_CR1_SAMPLE_RATE_Pos)
|
||||
#define ADC_CR1_SAMP_ENABLE BIT(6)
|
||||
#define ADC_CR1_POWER_DOWN BIT(8)
|
||||
#define ADC_CR1_IRQ_ENABLE BIT(5)
|
||||
|
||||
#define ADC_SR_DONE_FLAG BIT(0)
|
||||
#define ADC_SR_FIFO_OV_FLAG BIT(1)
|
||||
|
||||
#define ADC_FIFO_OV_INT_ENABLE BIT(2)
|
||||
#define ADC_FIFO_RESET BIT(1)
|
||||
|
||||
#define ADC_FIFO_ENABLE BIT(0)
|
||||
|
||||
#define ADC_CR2_BUFF_ENABLE BIT(14)
|
||||
#define ADC_DIV_RESISTOR_EN_BIT BIT(13)
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ADC_Overflow = 0,
|
||||
ADC_NoOverflow = 1,
|
||||
}ADC_OverflowTypeDef;
|
||||
|
||||
/* ADC Channel select */
|
||||
typedef enum
|
||||
{
|
||||
ADC_CHANNEL_CHARGE_VBAT =0,
|
||||
ADC_CHANNEL_1,
|
||||
ADC_CHANNEL_2,
|
||||
ADC_CHANNEL_3,
|
||||
ADC_CHANNEL_4,
|
||||
ADC_CHANNEL_5,
|
||||
ADC_CHANNEL_6,
|
||||
}ADC_ChxTypeDef;
|
||||
#define IS_ADC_CHANNEL(CHANNEL_NUM) (((CHANNEL_NUM) == ADC_CHANNEL_CHARGE_VBAT) || \
|
||||
((CHANNEL_NUM) == ADC_CHANNEL_1) || \
|
||||
((CHANNEL_NUM) == ADC_CHANNEL_2) || \
|
||||
((CHANNEL_NUM) == ADC_CHANNEL_3) || \
|
||||
((CHANNEL_NUM) == ADC_CHANNEL_4) || \
|
||||
((CHANNEL_NUM) == ADC_CHANNEL_5) || \
|
||||
((CHANNEL_NUM) == ADC_CHANNEL_6))
|
||||
|
||||
/* ADC Samp Select */
|
||||
typedef enum
|
||||
{
|
||||
ADC_SpeedPrescaler_None = 0,
|
||||
ADC_SpeedPrescaler_2,
|
||||
ADC_SpeedPrescaler_4,
|
||||
ADC_SpeedPrescaler_8,
|
||||
}ADC_SampTypeDef;
|
||||
|
||||
#define IS_ADC_SAMP(SAMP) (((SAMP) == ADC_SpeedPrescaler_None) || \
|
||||
((SAMP) == ADC_SpeedPrescaler_2) || \
|
||||
((SAMP) == ADC_SpeedPrescaler_4) || \
|
||||
((SAMP) == ADC_SpeedPrescaler_8))
|
||||
|
||||
|
||||
typedef struct _ADC_InitTypeDef
|
||||
{
|
||||
ADC_ChxTypeDef ADC_Channel; /* ADC Channel select */
|
||||
ADC_SampTypeDef ADC_SampSpeed; /* ADC sampspeed select */
|
||||
FunctionalState ADC_IRQ_EN; /* ADC IRQ/Polling Select */
|
||||
FunctionalState ADC_FIFO_EN; /* ADC FIFO Enable Select */
|
||||
} ADC_InitTypeDef;
|
||||
|
||||
/* Exported constants -------------------------------------------------------*/
|
||||
/* Exported macro -----------------------------------------------------------*/
|
||||
/* Exported functions -------------------------------------------------------*/
|
||||
void ADC_Init(ADC_InitTypeDef *ADC_InitStruct);
|
||||
|
||||
void ADC_StartCmd(FunctionalState NewState);
|
||||
|
||||
void ADC_FIFODeepth(uint32_t FIFO_Deepth);
|
||||
|
||||
void ADC_FIFOReset(void);
|
||||
|
||||
void ADC_ITCmd(FunctionalState NewState);
|
||||
|
||||
void ADC_FIFOOverflowITcmd(FunctionalState NewState);
|
||||
|
||||
void ADC_BuffCmd(FunctionalState NewState);
|
||||
|
||||
void ADC_DivResistorCmd(FunctionalState NewState);
|
||||
|
||||
int32_t ADC_GetFIFOCount(void);
|
||||
|
||||
int32_t ADC_GetResult(void);
|
||||
|
||||
int32_t ADC_GetFIFOResult(uint16_t *ADCdata, uint32_t len);
|
||||
|
||||
uint32_t ADC_CalVoltage(uint32_t u32ADC_Value, uint32_t u32ADC_Ref_Value);
|
||||
|
||||
ADC_ChxTypeDef ADC_GetChannel(void);
|
||||
|
||||
FunctionalState ADC_IsDivResistorEnable(void);
|
||||
|
||||
ADC_OverflowTypeDef ADC_IsFIFOOverflow(void);
|
||||
|
||||
void ADC_ChannelSwitch(ADC_ChxTypeDef Channelx);
|
||||
|
||||
/* Exported variables -------------------------------------------------------*/
|
||||
|
||||
/* Exported types -----------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __AIR105_ADC_H__ */
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __AIR105_BPK_H
|
||||
#define __AIR105_BPK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
|
||||
/** @defgroup BPK_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define BPK_KEY_REGION_0 ((uint32_t)0x0001)
|
||||
#define BPK_KEY_REGION_1 ((uint32_t)0x0002)
|
||||
#define BPK_KEY_REGION_ALL ((uint32_t)0x0003)
|
||||
#define IS_BPK_KEY_REGION(REGION) ((((REGION) & ~BPK_KEY_REGION_ALL) == 0x00) && ((REGION) != 0x00))
|
||||
|
||||
|
||||
#define IS_BPK_LOCK(LOCK) ((((LOCK) & ~BPK_LR_LOCK_ALL) == 0x00) && ((LOCK) != (uint32_t)0x00))
|
||||
|
||||
|
||||
FlagStatus BPK_IsReady(void);
|
||||
ErrorStatus BPK_WriteKey(uint32_t *Key,uint32_t Key_Len, uint32_t Key_Offset);
|
||||
ErrorStatus BPK_ReadKey(uint32_t *Key,uint32_t Key_Len, uint32_t Key_Offset);
|
||||
void BPK_KeyWriteLock(uint16_t BPK_KEY_Region, FunctionalState NewState);
|
||||
void BPK_KeyReadLock(uint16_t BPK_KEY_Region, FunctionalState NewState);
|
||||
void BPK_KeyClear(uint16_t BPK_KEY_Region);
|
||||
|
||||
void BPK_SetScramber(uint32_t Scram);
|
||||
void BPK_Lock(uint32_t BPK_LOCK, FunctionalState NewState);
|
||||
void BPK_LockSelf(void);
|
||||
FlagStatus BPK_GetLockStatus(uint32_t BPK_LOCK);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __AIR105_CACHE_H
|
||||
#define __AIR105_CACHE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
|
||||
#define CACHE_REFRESH ((uint32_t)0x80000000)
|
||||
#define CACHE_REFRESH_ALLTAG ((uint32_t)0x40000000)
|
||||
|
||||
#define CACHE_KEY_GEN_START ((uint32_t)0x80000000)
|
||||
|
||||
#define CACHE_IS_BUSY ((uint32_t)0x20000000)
|
||||
|
||||
#define CACHE_SIZE ((uint32_t)0x8000)
|
||||
#define CACHE_PARTICLE_SIZE (0x20)
|
||||
#define CACHE_ADDRESS_START ((uint32_t)0x01000000)
|
||||
#define CACHE_ADDRESS_MAX ((uint32_t)0x00FFFFFF)
|
||||
#define IS_CACHE_ADDR_VALID(addr) (((addr) & CACHE_ADDRESS_START) == CACHE_ADDRESS_START)
|
||||
|
||||
#define CACHE_AES_BYPASS (0xA5)
|
||||
#define CACHE_KEY_GEN (0xA5)
|
||||
#define CACHE_WRAP_ENABLE (0xA5)
|
||||
|
||||
#define CACHE_ZONE_ENCRYPT ((uint32_t)0xA5000000)
|
||||
|
||||
#define CACHE_CODE_BUS_OFFSET_POS (0)
|
||||
#define CACHE_CODE_BUS_OFFSET_WIDTH (5)
|
||||
#define CACHE_CODE_BUS_OFFSET_MASK ((uint32_t)0x001F)
|
||||
|
||||
#define CACHE_CODE_BUS_SET_POS (5)
|
||||
#define CACHE_CODE_BUS_SET_WIDTH (8)
|
||||
#define CACHE_CODE_BUS_SET_MASK ((uint32_t)0x00FF)
|
||||
|
||||
#define CACHE_CODE_BUS_TAG_POS (13)
|
||||
#define CACHE_CODE_BUS_TAG_WIDTH (11)
|
||||
#define CACHE_CODE_BUS_TAG_MASK ((uint32_t)0x07FF)
|
||||
|
||||
#define CHCHE_ALGORITHM_SET_POS (28)
|
||||
|
||||
#define CACHE_BUILD_INDEX_OFFSET(x) (((x) & CACHE_CODE_BUS_OFFSET_MASK) << CACHE_CODE_BUS_OFFSET_POS)
|
||||
#define CACHE_BUILD_INDEX_SET(x) (((x) & CACHE_CODE_BUS_SET_MASK) << CACHE_CODE_BUS_SET_POS)
|
||||
#define CACHE_BUILD_INDEX_TAG(x) (((x) & CACHE_CODE_BUS_TAG_MASK) << CACHE_CODE_BUS_TAG_POS)
|
||||
#define CACHE_ADDRESS_BUILD(base,index_set,tag_way,offset) ((base) | CACHE_BUILD_INDEX_SET(index_set) | CACHE_BUILD_INDEX_TAG(tag_way) | CACHE_BUILD_INDEX_OFFSET(offset))
|
||||
|
||||
#define CACHE_TAG_NUM(x) ((x >> CACHE_CODE_BUS_TAG_POS) & CACHE_CODE_BUS_TAG_MASK)
|
||||
#define CACHE_SET_NUM(x) ((x >> CACHE_CODE_BUS_SET_POS) & CACHE_CODE_BUS_SET_MASK)
|
||||
#define CACHE_OFF_NUM(x) ((x >> CACHE_CODE_BUS_OFFSET_POS) & CACHE_CODE_BUS_OFFSET_MASK)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CACHE_Encrypt_Mode_All = 0x0,
|
||||
CACHE_Encrypt_Mode_Zone,
|
||||
}CACHE_EncryptModeTypeDef;
|
||||
#define IS_CACHE_ENCRYPT_MODE(MODE) (((MODE) == CACHE_Encrypt_Mode_All) || \
|
||||
((MODE) == CACHE_Encrypt_Mode_Zone))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t I[4];
|
||||
uint32_t K[4];
|
||||
uint32_t AES_CS;
|
||||
uint32_t CONFIG;
|
||||
|
||||
uint32_t aes_enable;
|
||||
uint32_t Address;
|
||||
uint32_t size;
|
||||
uint32_t algorithm;
|
||||
|
||||
uint32_t encrypt_mode;
|
||||
uint32_t encrypt_saddr;
|
||||
uint32_t encrypt_eaddr;
|
||||
}CACHE_InitTypeDef;
|
||||
|
||||
void CACHE_Init(CACHE_TypeDef *Cache, CACHE_InitTypeDef *CACHE_InitStruct);
|
||||
void CACHE_Clean(CACHE_TypeDef *Cache, CACHE_InitTypeDef *CACHE_InitStruct);
|
||||
void CACHE_CleanAll(CACHE_TypeDef *Cache);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __AIR105_CONF_H
|
||||
#define __AIR105_CONF_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Uncomment the line below to enable peripheral header file inclusion */
|
||||
#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
|
||||
|
||||
#include "string.h"
|
||||
|
||||
#include "air105_cache.h"
|
||||
#include "air105_dcmi.h"
|
||||
#include "air105_dma.h"
|
||||
#include "air105_gpio.h"
|
||||
#include "air105_i2c.h"
|
||||
#include "air105_qspi.h"
|
||||
#include "air105_sysctrl.h"
|
||||
#include "air105_timer.h"
|
||||
#include "air105_uart.h"
|
||||
#include "air105_wdt.h"
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Uncomment the line below to expanse the "assert_param" macro in the
|
||||
Standard Peripheral Library drivers code */
|
||||
/* #define USE_FULL_ASSERT 1 */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __AIR105_CRC_H
|
||||
#define __AIR105_CRC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
CRC_16 = 0x01,
|
||||
CRC_16_Modbus = 0x02,
|
||||
CRC_CCITT_0xffff = 0x03,
|
||||
CRC_CCITT_XModem = 0x04,
|
||||
CRC_32 = 0x05
|
||||
}CRC_Param_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CRC_Poly_16_1021 = 0x01,
|
||||
CRC_Poly_16_8005 = 0x02,
|
||||
CRC_Poly_32_04C11DB7 = 0x03
|
||||
}CRC_Poly_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CRC_PolyMode_Normal = 0x01,
|
||||
CRC_PolyMode_Reversed = 0x02,
|
||||
}CRC_PolyMode_TypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CRC_Poly_TypeDef CRC_Poly;
|
||||
CRC_PolyMode_TypeDef CRC_PolyMode;
|
||||
uint32_t CRC_Init_Value;
|
||||
uint32_t CRC_Xor_Value;
|
||||
}CRC_ConfigTypeDef;
|
||||
|
||||
|
||||
uint32_t CRC_CalcBlockCRC(uint32_t CRC_type, uint8_t *pData, uint32_t len);
|
||||
uint32_t CRC_Calc(CRC_ConfigTypeDef *CRC_Config, uint8_t *pData, uint32_t len);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __AIR105_DAC_H__
|
||||
#define __AIR105_DAC_H__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Include ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
|
||||
#define DAC_CR1_IS_RUNNING ((uint32_t)0x20000000)
|
||||
#define DAC_CR1_POWER_DOWN ((uint32_t)0x00000010)
|
||||
#define DAC_CR1_FIFO_RESET ((uint32_t)0x00000008)
|
||||
#define DAC_CR1_DMA_ENABLE ((uint32_t)0x00000004)
|
||||
|
||||
|
||||
#define IS_DAC_DATA(DATA) ((DATA) <= 0x3FF)
|
||||
|
||||
|
||||
#define DAC_CURR_SEL_MASK ((uint32_t)0x00000020)
|
||||
#define DAC_CURR_SEL_20K ((uint32_t)0x00000000)
|
||||
#define DAC_CURR_SEL_2K ((uint32_t)0x00000020)
|
||||
#define IS_DAC_CURR_SEL(CURR) (((CURR) == DAC_CURR_SEL_20K) || \
|
||||
((CURR) == DAC_CURR_SEL_2K))
|
||||
|
||||
#define IS_DAC_FIFO_THR(THR) ((THR) <= 0xF)
|
||||
|
||||
|
||||
typedef struct _DAC_InitTypeDef
|
||||
{
|
||||
uint32_t DAC_CurrSel; /* DAC mode select */
|
||||
uint32_t DAC_TimerExp; /* DAC timer expectation */
|
||||
uint32_t DAC_FIFOThr; /* DAC FIFO Threshold */
|
||||
} DAC_InitTypeDef;
|
||||
|
||||
|
||||
#define DAC_FIFO_DEPTH (16)
|
||||
#define DAC_IT_STATUS_SHIFT (30)
|
||||
|
||||
#define DAC_IT_FIFO_THR ((uint32_t)0x0002)
|
||||
#define DAC_IT_FIFO_OVERFLOW ((uint32_t)0x0001)
|
||||
#define IS_DAC_IT(IT) (((IT) == DAC_IT_FIFO_THR) || \
|
||||
((IT) == DAC_IT_FIFO_OVERFLOW))
|
||||
|
||||
#define DAC_FLAG_RUNNING (DAC_CR1_IS_RUNNING)
|
||||
#define DAC_FLAG_OVERFLOW ((uint32_t)0x40000000)
|
||||
#define IS_DAC_FLAG(FLAG) (((FLAG) == DAC_FLAG_RUNNING) || \
|
||||
((FLAG) == DAC_FLAG_OVERFLOW))
|
||||
|
||||
|
||||
/* Exported functions -------------------------------------------------------*/
|
||||
void DAC_Init(DAC_InitTypeDef *DAC_InitStruct);
|
||||
void DAC_StructInit(DAC_InitTypeDef *DAC_InitStruct);
|
||||
void DAC_FIFOReset(void);
|
||||
|
||||
void DAC_Cmd(FunctionalState NewState);
|
||||
void DAC_DMACmd(FunctionalState NewState);
|
||||
|
||||
void DAC_SetData(uint16_t Data);
|
||||
|
||||
FlagStatus DAC_GetFlagStatus(uint32_t DAC_Flag);
|
||||
void DAC_ClearFlag(uint32_t DAC_Flag);
|
||||
|
||||
void DAC_ITConfig(uint32_t DAC_IT, FunctionalState NewState);
|
||||
ITStatus DAC_GetITStatus(uint32_t DAC_IT);
|
||||
void DAC_ClearITPendingBit(uint32_t DAC_IT);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __AIR105_DAC_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __AIR105_EXTI_H
|
||||
#define __AIR105_EXTI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes -----------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief EXTI Trigger enumeration
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
EXTI_Trigger_Off = (uint32_t)0x00,
|
||||
EXTI_Trigger_Rising = (uint32_t)0x01,
|
||||
EXTI_Trigger_Falling = (uint32_t)0x02,
|
||||
EXTI_Trigger_Rising_Falling = (uint32_t)0x03
|
||||
}EXTI_TriggerTypeDef;
|
||||
|
||||
#define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Off) || \
|
||||
((TRIGGER) == EXTI_Trigger_Rising) || \
|
||||
((TRIGGER) == EXTI_Trigger_Falling) || \
|
||||
((TRIGGER) == EXTI_Trigger_Rising_Falling))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup EXTI_Lines
|
||||
* @{
|
||||
*/
|
||||
#define EXTI_Line0 ((uint32_t)0x0000) /*!< External interrupt line 0 */
|
||||
#define EXTI_Line1 ((uint32_t)0x0001) /*!< External interrupt line 1 */
|
||||
#define EXTI_Line2 ((uint32_t)0x0002) /*!< External interrupt line 2 */
|
||||
#define EXTI_Line3 ((uint32_t)0x0003) /*!< External interrupt line 3 */
|
||||
#define EXTI_Line4 ((uint32_t)0x0004) /*!< External interrupt line 4 */
|
||||
#define EXTI_Line5 ((uint32_t)0x0005) /*!< External interrupt line 5 */
|
||||
|
||||
#define IS_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
|
||||
((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
|
||||
((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup EXTI_PinSource
|
||||
* @{
|
||||
*/
|
||||
#define EXTI_PinSource0 ((uint32_t)0x0001) /*!< Pin 0 selected */
|
||||
#define EXTI_PinSource1 ((uint32_t)0x0002) /*!< Pin 1 selected */
|
||||
#define EXTI_PinSource2 ((uint32_t)0x0004) /*!< Pin 2 selected */
|
||||
#define EXTI_PinSource3 ((uint32_t)0x0008) /*!< Pin 3 selected */
|
||||
#define EXTI_PinSource4 ((uint32_t)0x0010) /*!< Pin 4 selected */
|
||||
#define EXTI_PinSource5 ((uint32_t)0x0020) /*!< Pin 5 selected */
|
||||
#define EXTI_PinSource6 ((uint32_t)0x0040) /*!< Pin 6 selected */
|
||||
#define EXTI_PinSource7 ((uint32_t)0x0080) /*!< Pin 7 selected */
|
||||
#define EXTI_PinSource8 ((uint32_t)0x0100) /*!< Pin 8 selected */
|
||||
#define EXTI_PinSource9 ((uint32_t)0x0200) /*!< Pin 9 selected */
|
||||
#define EXTI_PinSource10 ((uint32_t)0x0400) /*!< Pin 10 selected */
|
||||
#define EXTI_PinSource11 ((uint32_t)0x0800) /*!< Pin 11 selected */
|
||||
#define EXTI_PinSource12 ((uint32_t)0x1000) /*!< Pin 12 selected */
|
||||
#define EXTI_PinSource13 ((uint32_t)0x2000) /*!< Pin 13 selected */
|
||||
#define EXTI_PinSource14 ((uint32_t)0x4000) /*!< Pin 14 selected */
|
||||
#define EXTI_PinSource15 ((uint32_t)0x8000) /*!< Pin 15 selected */
|
||||
#define EXTI_PinSourceAll ((uint32_t)0xffff) /*!< Pin All selected */
|
||||
|
||||
#define IS_EXTI_PIN_SOURCE(PIN) (((((PIN) & ~(uint32_t)0xFFFF)) == 0x00) && ((PIN) != (uint32_t)0x00))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup EXTI_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
void EXTI_DeInit(void);
|
||||
void EXTI_LineConfig(uint32_t EXTI_Line, uint32_t EXTI_PinSource, EXTI_TriggerTypeDef EXTI_Trigger);
|
||||
uint32_t EXTI_GetITStatus(void);
|
||||
uint32_t EXTI_GetITLineStatus(uint32_t EXTI_Line);
|
||||
void EXTI_ClearITPendingBit(uint32_t EXTI_Line);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __AIR105_EXTI_H
|
||||
|
||||
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __AIR105_IT_H
|
||||
#define __AIR105_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void MemManage_Handler(void);
|
||||
void BusFault_Handler(void);
|
||||
void UsageFault_Handler(void);
|
||||
void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __AIR105_KCU_H
|
||||
#define __AIR105_KCU_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
/**
|
||||
* @brief KCU Init structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t KCU_DebounceTimeLevel;
|
||||
uint32_t KCU_PortInput;
|
||||
uint32_t KCU_PortOutput;
|
||||
uint32_t KCU_Rand;
|
||||
}KCU_InitTypeDef;
|
||||
|
||||
|
||||
#define KCU_IT_PUSH (KCU_CTRL1_PUSH_IT)
|
||||
#define KCU_IT_RELEASE (KCU_CTRL1_RELEASE_IT)
|
||||
#define KCU_IT_OVERRUN (KCU_CTRL1_OVERRUN_IT)
|
||||
|
||||
void KCU_DeInit(void);
|
||||
|
||||
void KCU_Init(KCU_InitTypeDef *KCU_InitStruct);
|
||||
void KCU_StructInit(KCU_InitTypeDef *KCU_InitStruct);
|
||||
|
||||
void KCU_Cmd(FunctionalState NewState);
|
||||
|
||||
uint32_t KCU_SetRand(uint32_t rand);
|
||||
|
||||
void KCU_ITConfig(uint32_t KCU_IT, FunctionalState NewState);
|
||||
FlagStatus KCU_GetITStatus(uint32_t KCU_IT);
|
||||
void KCU_ClearITPending(void);
|
||||
|
||||
uint32_t KCU_GetEvenReg(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __AIR105_LCDI_H
|
||||
#define __AIR105_LCDI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
#include "air105.h"
|
||||
|
||||
|
||||
#define LCDI_CMD (0)
|
||||
#define LCDI_DAT (1)
|
||||
|
||||
#define LCDI_MODE_6800 (0)
|
||||
#define LCDI_MODE_8080 (1)
|
||||
|
||||
#define LCD_CMD_BUFF_SIZE (64)
|
||||
#define LCD_READ_BUFF_SIZE (512)
|
||||
#define LCD_WRITE_BUFF_SIZE (512)
|
||||
|
||||
//LCD module
|
||||
#define LCDI_FIFO_OV_IE (1 << 12)
|
||||
#define LCDI_FIFO_RST (1 << 11)
|
||||
#define LCDI_WR_DMA_EN (1 << 10)
|
||||
#define LCDI_WR_FIFO_EN (1 << 9)
|
||||
|
||||
#define LCDI_CTRL_AUTO_READ (1 << 8)
|
||||
#define LCDI_CTRL_TYPE_8080 (1 << 7)
|
||||
#define LCDI_CTRL_EN_RD (1 << 6)
|
||||
#define LCDI_CTRL_RW_WR (1 << 5)
|
||||
#define LCDI_CTRL_CD (1 << 4)
|
||||
#define LCDI_CTRL_WIDTH_4BIT (1 << 3)
|
||||
#define LCDI_CTRL_AUTO (1 << 2)
|
||||
#define LCDI_CTRL_RD_IE (1 << 1)
|
||||
#define LCDI_CTRL_WR_IE (1 << 0)
|
||||
|
||||
#define LCDI_STATUS_READY (1 << 2)
|
||||
#define LCDI_STATUS_RD_IS (1 << 1)
|
||||
#define LCDI_STATUS_WR_IS (1 << 0)
|
||||
|
||||
#define RNG_BUF_IS_FULL(pBuf) ((pBuf)->u32Tail == (pBuf)->u32Head)
|
||||
#define RNG_BUF_NEXT_HEAD(pBuf) (((pBuf)->u32Head + 1) % ((pBuf)->u32BuffSize))
|
||||
#define RNG_BUF_NEXT_TAIL(pBuf) (((pBuf)->u32Tail + 1) % ((pBuf)->u32BuffSize))
|
||||
#define RNG_BUF_LEN(pBuf) (((pBuf)->u32Tail + (pBuf)->u32BuffSize - 1 - (pBuf)->u32Head) % (pBuf)->u32BuffSize)
|
||||
#define RNG_BUF_PERI_TAIL(pBuf) (((pBuf)->u32Tail + (pBuf)->u32BuffSize - 1) % ((pBuf)->u32BuffSize))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t volatile u32Head;
|
||||
uint32_t volatile u32Tail;
|
||||
uint32_t volatile u32BuffSize;
|
||||
uint32_t volatile u32Stat;
|
||||
uint8_t volatile *pu8Buff;
|
||||
} RNG_BUF8, *RNG_BUF8_ID;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t volatile u32Head;
|
||||
uint32_t volatile u32Tail;
|
||||
uint32_t volatile u32BuffSize;
|
||||
uint32_t volatile u32Stat;
|
||||
uint32_t volatile *pu32Buff;
|
||||
} RNG_BUF32, *RNG_BUF32_ID;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t lcd_ReadBuff[LCD_READ_BUFF_SIZE];
|
||||
uint8_t lcd_WriteBuff[LCD_WRITE_BUFF_SIZE];
|
||||
uint32_t lcd_CmdBuff[LCD_CMD_BUFF_SIZE];
|
||||
RNG_BUF8 rbRead;
|
||||
RNG_BUF8 rbWrite;
|
||||
RNG_BUF32 rbCmd;
|
||||
RNG_BUF32_ID prbCmd;
|
||||
RNG_BUF8_ID prbRead;
|
||||
RNG_BUF8_ID prbWrite;
|
||||
volatile uint32_t u32OpCount;
|
||||
} RING_BUF;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t LCD_BusMode; //Bus mode(8080/6800)
|
||||
uint8_t LCD_IntRead; //Read interrupt Enable
|
||||
uint8_t LCD_IntWrite; //Read interrupt Enable
|
||||
uint8_t fifo_level;
|
||||
uint32_t LCD_MaxQTR; //Max qaurter cylce of read/write.
|
||||
uint32_t fifo_ov_ie_enable;
|
||||
uint32_t fifo_rst_enable;
|
||||
uint32_t wr_dma_enable;
|
||||
uint32_t wr_fifo_enable;
|
||||
uint32_t opt;
|
||||
RING_BUF ring_buf;
|
||||
} LCD_InitTypeDef;
|
||||
|
||||
//Operate the bus signal
|
||||
void LCD_BusRead(LCD_TypeDef *LCDx,uint8_t u8CD);
|
||||
void LCD_BusWrite(LCD_TypeDef *LCDx,uint8_t u8CD, uint8_t value);
|
||||
|
||||
void LCD_Read(LCD_TypeDef *LCDx,uint8_t u8CD, uint8_t *dat);
|
||||
void LCD_Write(LCD_TypeDef *LCDx,uint8_t u8CD, uint8_t u8Value);
|
||||
|
||||
//Buffer mode only can used in interrupt mode.
|
||||
int32_t LCD_ReadBuff(LCD_TypeDef *LCDx, LCD_InitTypeDef *pLcdInit, uint8_t *pu8Buff, uint32_t u32BuffLen);
|
||||
int32_t LCD_WriteBuff(LCD_TypeDef *LCDx, LCD_InitTypeDef *pLcdInit, uint8_t *pu8Buff, uint32_t u32BuffLen);
|
||||
|
||||
void LCD_Init(LCD_TypeDef *LCDx, LCD_InitTypeDef *pLcdInit);
|
||||
void LCD_FIFODMAconfig(LCD_TypeDef *LCDx, LCD_InitTypeDef *LCD_InitType);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __AIR105_OTP_H
|
||||
#define __AIR105_OTP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
OTP_Complete = 0,
|
||||
OTP_ReadOnProgramOrSleep, //�ڱ�̡�����״̬�¶�OTP���ж�����
|
||||
OTP_ProgramIn_HiddenOrRO_Block, //��ֻ�������б��
|
||||
OTP_ProgramOutOfAddr, //��̷�Χ����OTP��Χ
|
||||
OTP_ProgramOnSleep, //������״̬���б�̲���
|
||||
OTP_WakeUpOnNoSleep, //�ڷ�����״̬�½��л��Ѳ���
|
||||
OTP_TimeOut, //OTP��ɱ�־λ��ʱû����λ
|
||||
OTP_DataWrong,
|
||||
}OTP_StatusTypeDef;
|
||||
|
||||
#define IS_OTP_ADDRESS(ADDRESS) (((ADDRESS) > AIR105_OTP_SIZE - 1) && ((ADDRESS) < AIR105_OTP_BASE + AIR105_OTP_SIZE))
|
||||
|
||||
|
||||
void OTP_WakeUp(void);
|
||||
void OTP_Unlock(void);
|
||||
void OTP_Lock(void);
|
||||
void OTP_ClearStatus(void);
|
||||
void OTP_SetLatency(uint8_t u8_1UsClk, uint8_t u8_10NsCLK);
|
||||
void OTP_TimCmd(FunctionalState NewState);
|
||||
|
||||
void OTP_SetProtect(uint32_t u32Addr);
|
||||
void OTP_SetProtectLock(uint32_t u32Addr);
|
||||
void OTP_UnProtect(uint32_t u32Addr);
|
||||
uint32_t OTP_GetProtect(void);
|
||||
uint32_t OTP_GetProtectLock(void);
|
||||
|
||||
void OTP_PowerOn(void);
|
||||
|
||||
Boolean OTP_IsReadReady(void);
|
||||
Boolean OTP_IsWriteDone(void);
|
||||
|
||||
OTP_StatusTypeDef OTP_GetFlag(void);
|
||||
|
||||
Boolean OTP_IsProtect(uint32_t u32Addr);
|
||||
Boolean OTP_IsProtectLock(uint32_t u32Addr);
|
||||
|
||||
OTP_StatusTypeDef OTP_WriteWord(uint32_t addr, uint32_t w);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef AIRMCU_FLASH
|
||||
#define AIRMCU_FLASH
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "air105.h"
|
||||
|
||||
|
||||
/* Size of the flash */
|
||||
#define X25Q_PAGE_SIZE 0x100
|
||||
|
||||
// Identification Operations
|
||||
/***Command Definitions***/
|
||||
|
||||
// Program Operations
|
||||
#define PAGE_PROG_CMD 0x02
|
||||
#define QUAD_INPUT_PAGE_PROG_CMD 0x32
|
||||
|
||||
|
||||
// Erase Operations
|
||||
#define SECTOR_ERASE_CMD 0x20
|
||||
#define CHIP_ERASE_CMD 0xC7
|
||||
|
||||
#define PROG_ERASE_RESUME_CMD 0x7A
|
||||
#define PROG_ERASE_SUSPEND_CMD 0x75
|
||||
|
||||
#define SET_BURST_WITH_WRAP 0x77
|
||||
#define RELEASE_FROM_DEEP_POWER_DOWN 0xAB
|
||||
#define DEEP_POWER_DOWN 0xB9
|
||||
|
||||
/***End Cmd***/
|
||||
|
||||
|
||||
#define QSPI_DEVICE_PARA_SAMPLE_DLY_Pos 15
|
||||
#define QSPI_DEVICE_PARA_SAMPLE_PHA_Pos 14
|
||||
#define QSPI_DEVICE_PARA_PROTOCOL_Pos 8
|
||||
#define QSPI_DEVICE_PARA_DUMMY_CYCLE_Pos 4
|
||||
|
||||
|
||||
#define ROM_QSPI_Init (*((void (*)(QSPI_InitTypeDef *))(*(uint32_t *)0x8010)))
|
||||
#define ROM_QSPI_ReadID (*((uint32_t (*)(QSPI_CommandTypeDef *))(*(uint32_t *)0x8014)))
|
||||
#define ROM_QSPI_WriteParam (*((uint8_t (*)(QSPI_CommandTypeDef *, uint16_t))(*(uint32_t *)0x8018)))
|
||||
#define ROM_QSPI_EraseSector (*((uint8_t (*)(QSPI_CommandTypeDef *, uint32_t))(*(uint32_t *)0x801C)))
|
||||
#define ROM_QSPI_ProgramPage (*((uint8_t (*)(QSPI_CommandTypeDef *, DMA_TypeDef *, uint32_t, uint32_t, uint8_t *))(*(uint32_t *)0x8024)))
|
||||
#define ROM_QSPI_ReleaseDeepPowerDown (*((uint8_t (*)(QSPI_CommandTypeDef *))(*(uint32_t *)0x802C)))
|
||||
#define ROM_QSPI_StatusReg (*((uint16_t (*)(QSPI_CommandTypeDef *))(*(uint32_t *)0x8034)))
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
QSPI_BUSMODE_111 = 0x00, //CMD-ADDR-DATA = 1-1-1
|
||||
QSPI_BUSMODE_114 = 0x01, //CMD-ADDR-DATA = 1-1-4
|
||||
QSPI_BUSMODE_144 = 0x02, //CMD-ADDR-DATA = 1-4-4
|
||||
QSPI_BUSMODE_444 = 0x03, //CMD-ADDR-DATA = 4-4-4
|
||||
}QSPI_BusModeTypeDef;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
QSPI_CMDFORMAT_CMD8 = 0x00,
|
||||
QSPI_CMDFORMAT_CMD8_RREG8 = 0x01,
|
||||
QSPI_CMDFORMAT_CMD8_RREG16 = 0x02,
|
||||
QSPI_CMDFORMAT_CMD8_RREG24 = 0x03,
|
||||
QSPI_CMDFORMAT_CMD8_DMY24_WREG8 = 0x04,
|
||||
QSPI_CMDFORMAT_CMD8_ADDR24_RREG8 = 0x05,
|
||||
QSPI_CMDFORMAT_CMD8_ADDR24_RREG16 = 0x06,
|
||||
QSPI_CMDFORMAT_CMD8_WREG8 = 0x07,
|
||||
QSPI_CMDFORMAT_CMD8_WREG16 = 0x08,
|
||||
QSPI_CMDFORMAT_CMD8_ADDR24 = 0x09,
|
||||
QSPI_CMDFORMAT_CMD8_ADDR24_RDAT = 0x0A,
|
||||
QSPI_CMDFORMAT_CMD8_ADDR24_DMY_RDAT = 0x0B,
|
||||
QSPI_CMDFORMAT_CMD8_ADDR24_M8_DMY_RDAT = 0x0C,
|
||||
QSPI_CMDFORMAT_CMD8_ADDR24_PDAT = 0x0D
|
||||
}QSPI_CmdFormatTypeDef;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
QSPI_PROTOCOL_CLPL = 0x00,
|
||||
QSPI_PROTOCOL_CHPH = 0x03
|
||||
}QSPI_ProtocolTypedef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
QSPI_FREQSEL_HCLK_DIV2 = 0x01,
|
||||
QSPI_FREQSEL_HCLK_DIV3 = 0x02,
|
||||
QSPI_FREQSEL_HCLK_DIV4 = 0x03
|
||||
}QSPI_FreqSelTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//Device Para
|
||||
uint8_t SampleDly; //Default:0
|
||||
uint8_t SamplePha; //Default:0
|
||||
uint8_t ProToCol; //Defualt: QSPI_PROTOCOL_CLPL
|
||||
uint8_t DummyCycles; //Include M7:0 Defualt: 6
|
||||
uint8_t FreqSel; //Defualt: QSPI_FREQSEL_HCLK_DIV4
|
||||
|
||||
//Setting Cache
|
||||
uint8_t Cache_Cmd_ReleaseDeepInstruction; //Defualt: 0xAB
|
||||
uint8_t Cache_Cmd_DeepInstruction; //Defualt: 0xB9
|
||||
uint8_t Cache_Cmd_ReadBusMode; //Defualt: QSPI_BUSMODE_144
|
||||
uint8_t Cache_Cmd_ReadFormat; //Defualt: QSPI_CMDFORMAT_CMD8_ADDR24_DMY_RDAT
|
||||
uint8_t Cache_Cmd_ReadInstruction; //Defualt: 0xEB
|
||||
|
||||
}QSPI_InitTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Instruction;
|
||||
uint32_t BusMode;
|
||||
uint32_t CmdFormat;
|
||||
|
||||
}QSPI_CommandTypeDef;
|
||||
|
||||
|
||||
void QSPI_Init(QSPI_InitTypeDef *mhqspi);
|
||||
void QSPI_SetLatency(uint32_t u32UsClk);
|
||||
|
||||
uint8_t FLASH_EraseSector(uint32_t sectorAddress);
|
||||
uint8_t FLASH_ProgramPage(uint32_t addr, uint32_t size, uint8_t *buffer);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __AIR105_RTC_H
|
||||
#define __AIR105_RTC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
#define RTC_32K_EXT_INC_SELECT (0x00000400U)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SELECT_EXT32K,
|
||||
SELECT_INC32K
|
||||
} RTCCLK_SOURCE_TypeDef;
|
||||
#define IS_RTCCLK_SOURCE(FREQ) (((FREQ) == SELECT_EXT32K) || \
|
||||
((FREQ) == SELECT_INC32K))
|
||||
|
||||
FlagStatus RTC_IsReady(void);
|
||||
|
||||
void RTC_ResetCounter(void);
|
||||
uint32_t RTC_GetCounter(void);
|
||||
|
||||
void RTC_SetRefRegister(uint32_t RefValue);
|
||||
uint32_t RTC_GetRefRegister(void);
|
||||
|
||||
void RTC_SetAlarm(uint32_t AlarmValue);
|
||||
|
||||
uint32_t RTC_GetAttrackTime(void);
|
||||
|
||||
void RTC_ITConfig(FunctionalState NewState);
|
||||
void RTC_ClearITPendingBit(void);
|
||||
ITStatus RTC_GetITStatus(void);
|
||||
void RTC_CLKSourceSelect(RTCCLK_SOURCE_TypeDef source);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __AIR105_SCI_H
|
||||
#define __AIR105_SCI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "air105.h"
|
||||
#include <arm_math.h>
|
||||
|
||||
|
||||
#define SCI_UNCONFIG (-1)
|
||||
#define SCI_ICC_CLOCK_ERR (-2)
|
||||
#define SCI_REF_CLOCK_ERR (-3)
|
||||
#define SCI_IMPRECISION_CLK (-4)
|
||||
#define SCI_EMV_F_D_ERR (-5)
|
||||
#define SCI_EMV_TS_ERR (-6)
|
||||
#define SCI_EMV_ATR_ERR (-7)
|
||||
#define SCI_CARD_OUT_ERR (-8)
|
||||
|
||||
|
||||
int32_t SCI_ConfigEMV(uint8_t SCI_Bitmap, uint32_t SCIx_Clk);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif ///< __AIR105_SCI_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __AIR105_SSC_H
|
||||
#define __AIR105_SSC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
|
||||
#define SSC_ITSysXTAL12M BIT(18) //ϵͳ��12Mʱ�ӱ�־
|
||||
#define SSC_ITSysGlitch BIT(17) //����Դë�̱�־
|
||||
#define SSC_ITSysVolHigh BIT(16) //����Դ��ѹ��־
|
||||
#define SSC_ITSysVolLow BIT(15) //����ԴǷѹ��־
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FunctionalState ParityCheck; //��żУ��ʹ��
|
||||
}SSC_InitTypeDef;
|
||||
|
||||
|
||||
/*
|
||||
* ��BPK��Ϊ4��ÿ��256����Ϊ��λ���ö�дȨ��
|
||||
* SSC_BPKAccessCtrBlock_0Ϊ��ʼ0��ַ��
|
||||
*/
|
||||
#define SSC_BPKAccessCtrBlock_0 (0x01)
|
||||
#define SSC_BPKAccessCtrBlock_1 (0x02)
|
||||
#define SSC_BPKAccessCtrBlock_All (0x03)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SSC_BPKReadOnly = 0x01, //BPK��ֻ��
|
||||
SSC_BPKWriteOnly = 0x02, //BPK��ֻд
|
||||
SSC_BPKReadWrite = 0x03 //BPK���д
|
||||
}SSC_BPKAccessCtrlTypeDef;
|
||||
#define IS_BPK_ACCESS_CTRL(CTRL) (((CTRL) == SSC_BPKReadOnly) || ((CTRL) == SSC_BPKWriteOnly) || \
|
||||
((CTRL) == SSC_BPKReadWrite))
|
||||
|
||||
#define SSC_SENSOR_XTAL12M ((uint32_t)0x00000001)
|
||||
#define SSC_SENSOR_VOL_LOW ((uint32_t)0x00000002)
|
||||
#define SSC_SENSOR_VOL_HIGH ((uint32_t)0x00000004)
|
||||
#define SSC_SENSOR_VOLGLITCH ((uint32_t)0x00000008)
|
||||
#define IS_SSC_SENSOR(SENSOR) ((((SENSOR) & (uint32_t)0xFFFFFFF0) == 0x00) && ((SENSOR) != (uint32_t)0x00))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SSC_SENSOR_CPUReset = 0,
|
||||
SSC_SENSOR_Interrupt = 1
|
||||
}SSC_SENSOR_RespModeTypeDef;
|
||||
#define IS_SSC_SENSOR_RESP_MODE(Mode) ((Mode) == SSC_SENSOR_CPUReset ||\
|
||||
(Mode) == SSC_SENSOR_Interrupt)
|
||||
|
||||
/**
|
||||
* @method SSC_Init
|
||||
* @brief SSC��ȫ���Գ�ʼ��
|
||||
* @param SSC_InitTypeDef SSC_InitStruct
|
||||
* @retval void
|
||||
*/
|
||||
void SSC_Init(SSC_InitTypeDef *SSC_InitStruct);
|
||||
|
||||
|
||||
/**
|
||||
* @method SSC_GetITStatus
|
||||
* @brief SSC��ȫ�ж�״̬
|
||||
* @param uint32_t SSC_IT
|
||||
* @retval ITStatus
|
||||
*/
|
||||
ITStatus SSC_GetITStatus(uint32_t SSC_IT);
|
||||
|
||||
|
||||
/**
|
||||
* @method SSC_ClearITPendingBit
|
||||
* @brief SSC��ȫ�ж����
|
||||
* @param uint32_t SSC_IT
|
||||
* @retval void
|
||||
*/
|
||||
void SSC_ClearITPendingBit( uint32_t SSC_IT);
|
||||
|
||||
|
||||
/**
|
||||
* @method SSC_SetDataRAMScrambler
|
||||
* @brief ��������RAM����
|
||||
* @param uint32_t Scrambler
|
||||
* @retval void
|
||||
*/
|
||||
void SSC_SetDataRAMScrambler(uint32_t Scrambler);
|
||||
|
||||
|
||||
/**
|
||||
* @method SSC_BPKAccessCtrConfig
|
||||
* @brief ����BPK����Ȩ��
|
||||
* @param uint32_t SSC_BPKAccessCtrBlock
|
||||
* @param SSC_BPKAccessCtrlTypeDef SSC_BPKAccessCtr
|
||||
* @retval void
|
||||
*/
|
||||
void SSC_BPKAccessCtrlConfig(uint32_t SSC_BPKAccessCtrBlock, SSC_BPKAccessCtrlTypeDef SSC_BPKAccessCtr);
|
||||
|
||||
|
||||
/**
|
||||
* @method SSC_SENSOR_Enable
|
||||
* @brief ����ϵͳSensor
|
||||
* @param SSC_SENSOR
|
||||
* @retval
|
||||
*/
|
||||
uint32_t SSC_SENSORCmd(uint32_t SSC_SENSOR, FunctionalState NewState);
|
||||
|
||||
|
||||
/**
|
||||
* @method SSC_SENSORLock
|
||||
* @brief ����ϵͳSensor����״̬
|
||||
* @param SSC_SENSOR
|
||||
* @retval
|
||||
*/
|
||||
void SSC_SENSORLock(uint32_t SSC_SENSOR);
|
||||
|
||||
|
||||
/**
|
||||
* @method SSC_SENSOR_AttackRespMode
|
||||
* @brief ϵͳSensor��Ӧ��ʽ
|
||||
* @param SSC_SENSOR_RespMode
|
||||
* @retval
|
||||
*/
|
||||
void SSC_SENSORAttackRespMode(SSC_SENSOR_RespModeTypeDef SSC_SENSOR_RespMode);
|
||||
|
||||
|
||||
void SSC_SENSORKeyClearCmd(uint32_t SSC_SENSOR, FunctionalState KeyClearEn);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __AIR105_SYSCTRL_H
|
||||
#define __AIR105_SYSCTRL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
#define SYSCTRL_FREQ_SEL_POWERMODE_Pos (24)
|
||||
#define SYSCTRL_FREQ_SEL_POWERMODE_Mask (0x07 << SYSCTRL_FREQ_SEL_POWERMODE_Pos)
|
||||
#define SYSCTRL_FREQ_SEL_POWERMODE_CLOSE_CPU (0x00 << SYSCTRL_FREQ_SEL_POWERMODE_Pos)
|
||||
#define SYSCTRL_FREQ_SEL_POWERMODE_CLOSE_CPU_MEM (0x01 << SYSCTRL_FREQ_SEL_POWERMODE_Pos)
|
||||
|
||||
|
||||
/** @defgroup SYSCTRL_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t PLL_Frequency; /*!< returns PLL frequency expressed in Hz */
|
||||
uint32_t CPU_Frequency; /*!< returns CPU frequency expressed in Hz */
|
||||
uint32_t HCLK_Frequency; /*!< returns HCLK frequency expressed in Hz */
|
||||
uint32_t PCLK_Frequency; /*!< returns PCLK frequency expressed in Hz */
|
||||
}SYSCTRL_ClocksTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SleepMode_CpuOff = 0, /*!< CPU Sleep */
|
||||
SleepMode_DeepSleep, /*!< Deep Sleep */
|
||||
SleepMode_Invalid
|
||||
}SleepMode_TypeDef;
|
||||
#define IS_ALL_SLEEP_MODE(MODE) ((MODE) < SleepMode_Invalid)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SELECT_EXT12M,
|
||||
SELECT_INC12M
|
||||
} SYSCLK_SOURCE_TypeDef;
|
||||
#define IS_SYSCLK_SOURCE(FREQ) (((FREQ) == SELECT_EXT12M) || \
|
||||
((FREQ) == SELECT_INC12M))
|
||||
typedef enum
|
||||
{
|
||||
SYSCTRL_PLL_108MHz = (uint32_t)0x01,
|
||||
SYSCTRL_PLL_120MHz = (uint32_t)0x02,
|
||||
SYSCTRL_PLL_132MHz = (uint32_t)0x03,
|
||||
SYSCTRL_PLL_144MHz = (uint32_t)0x04,
|
||||
SYSCTRL_PLL_156MHz = (uint32_t)0x05,
|
||||
SYSCTRL_PLL_168MHz = (uint32_t)0x06,
|
||||
SYSCTRL_PLL_180MHz = (uint32_t)0x07,
|
||||
SYSCTRL_PLL_192MHz = (uint32_t)0x08,
|
||||
SYSCTRL_PLL_204MHz = (uint32_t)0x09
|
||||
}SYSCTRL_PLL_TypeDef;
|
||||
#define IS_PLL_FREQ(FREQ) (((FREQ) == SYSCTRL_PLL_108MHz) || \
|
||||
((FREQ) == SYSCTRL_PLL_120MHz) || \
|
||||
((FREQ) == SYSCTRL_PLL_132MHz) || \
|
||||
((FREQ) == SYSCTRL_PLL_144MHz) || \
|
||||
((FREQ) == SYSCTRL_PLL_156MHz) || \
|
||||
((FREQ) == SYSCTRL_PLL_168MHz) || \
|
||||
((FREQ) == SYSCTRL_PLL_180MHz) || \
|
||||
((FREQ) == SYSCTRL_PLL_192MHz) || \
|
||||
((FREQ) == SYSCTRL_PLL_204MHz))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#define SYSCTRL_PLL_Div_None ((uint32_t)0x00)
|
||||
#define SYSCTRL_PLL_Div2 ((uint32_t)0x01)
|
||||
#define SYSCTRL_PLL_Div4 ((uint32_t)0x10)
|
||||
#define IS_GET_SYSCTRL_PLL_DIV(DIV) (((DIV) == SYSCTRL_PLL_Div_None) || \
|
||||
((DIV) == SYSCTRL_PLL_Div2) || \
|
||||
((DIV) == SYSCTRL_PLL_Div4))
|
||||
|
||||
#define SYSCTRL_HCLK_Div_None ((uint32_t)0x00)
|
||||
#define SYSCTRL_HCLK_Div2 ((uint32_t)0x01)
|
||||
#define IS_GET_SYSCTRL_HCLK_DIV(DIV) (((DIV) == SYSCTRL_HCLK_Div_None) || \
|
||||
((DIV) == SYSCTRL_HCLK_Div2))
|
||||
|
||||
#define SYSCTRL_PCLK_Div2 ((uint32_t)0x01)
|
||||
#define SYSCTRL_PCLK_Div4 ((uint32_t)0x02)
|
||||
#define IS_GET_SYSCTRL_PCLK_DIV(DIV) (((DIV) == SYSCTRL_PCLK_Div2) || \
|
||||
((DIV) == SYSCTRL_PCLK_Div4))
|
||||
|
||||
#define SYSCTRL_CHIP_SN_ADDR ((uint32_t)0x40008804)
|
||||
#define SYSCTRL_CHIP_SN_LEN ((uint32_t)0x10)
|
||||
|
||||
#define SYSCTRL_USB_DOWNLOAD_FLAG ((uint32_t)0X55)
|
||||
|
||||
void SYSCTRL_AHBPeriphClockCmd(uint32_t SYSCTRL_AHBPeriph, FunctionalState NewState);
|
||||
void SYSCTRL_AHBPeriphResetCmd(uint32_t SYSCTRL_AHBPeriph, FunctionalState NewState);
|
||||
void SYSCTRL_APBPeriphClockCmd(uint32_t SYSCTRL_APBPeriph, FunctionalState NewState);
|
||||
void SYSCTRL_APBPeriphResetCmd(uint32_t SYSCTRL_APBPeriph, FunctionalState NewState);
|
||||
|
||||
void SYSCTRL_EnterSleep(SleepMode_TypeDef SleepMode);
|
||||
|
||||
void SYSCTRL_SYSCLKSourceSelect(SYSCLK_SOURCE_TypeDef source_select);
|
||||
void SYSCTRL_PLLConfig(SYSCTRL_PLL_TypeDef PLL_Freq);
|
||||
void SYSCTRL_PLLDivConfig(uint32_t PLL_Div);
|
||||
void SYSCTRL_HCLKConfig(uint32_t HCLK_Div);
|
||||
void SYSCTRL_PCLKConfig(uint32_t PCLK_Div);
|
||||
|
||||
void SYSCTRL_GetClocksFreq(SYSCTRL_ClocksTypeDef* SYSCTRL_Clocks);
|
||||
void SYSCTRL_GetChipSN(unsigned char *ChipSN);
|
||||
|
||||
void SYSCTRL_SoftReset(void);
|
||||
void SYSCTRL_EnterUSBDownload(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __AIR105_TIMER_H
|
||||
#define __AIR105_TIMER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
TIM_0 = 0,
|
||||
TIM_1,
|
||||
TIM_2,
|
||||
TIM_3,
|
||||
TIM_4,
|
||||
TIM_5,
|
||||
TIM_6,
|
||||
TIM_7,
|
||||
}TIM_NumTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TIM_NumTypeDef TIMx;
|
||||
uint32_t TIM_Period; /*!< Specifies the period value to be loaded into the active
|
||||
Auto-Reload Register at the next update event.
|
||||
This parameter must be a number between 0x0000 and 0xFFFFFFFF. */
|
||||
}TIM_InitTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TIM_NumTypeDef TIMx;
|
||||
uint32_t TIM_LowLevelPeriod;
|
||||
uint32_t TIM_HighLevelPeriod;
|
||||
}TIM_PWMInitTypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TIM_Mode_General = 0,
|
||||
TIM_Mode_PWM = 1
|
||||
}TIM_ModeTypeDef;
|
||||
#define IS_TIM_MODE(MODE) (MODE == TIM_Mode_General || MODE == TIM_Mode_PWM)
|
||||
|
||||
|
||||
void TIM_DeInit(TIM_Module_TypeDef *TIMMx);
|
||||
void TIM_Init(TIM_Module_TypeDef* TIMMx, TIM_InitTypeDef* TIM_InitStruct);
|
||||
|
||||
void TIM_PWMInit(TIM_Module_TypeDef* TIMMx, TIM_PWMInitTypeDef* TIM_PWMInitStruct);
|
||||
void TIM_Cmd(TIM_Module_TypeDef* TIMMx, TIM_NumTypeDef TIMx, FunctionalState NewState);
|
||||
void TIM_ModeConfig(TIM_Module_TypeDef* TIMMx, TIM_NumTypeDef TIMx, TIM_ModeTypeDef TIM_Mode);
|
||||
void TIM_SetPeriod(TIM_Module_TypeDef* TIMMx, TIM_NumTypeDef TIMx, uint32_t Period);
|
||||
void TIM_SetPWMPeriod(TIM_Module_TypeDef* TIMMx, TIM_NumTypeDef TIMx, uint32_t PWM_LowLevelPeriod, uint32_t PWM_HighLevelPeriod);
|
||||
void TIM_ITConfig(TIM_Module_TypeDef* TIMMx, TIM_NumTypeDef TIMx, FunctionalState NewState);
|
||||
void TIM_ClearITPendingBit(TIM_Module_TypeDef* TIMMx, TIM_NumTypeDef TIMx);
|
||||
void TIM_PWMSinglePulseConfig(TIM_Module_TypeDef* TIMMx, TIM_NumTypeDef TIMx, FunctionalState NewState);
|
||||
void TIM_PWMReloadSinglePulse(TIM_Module_TypeDef *TIMMx, TIM_NumTypeDef TIMx);
|
||||
|
||||
ITStatus TIM_GetITStatus(TIM_Module_TypeDef* TIMMx, TIM_NumTypeDef TIMx);
|
||||
uint32_t TIM_GetAllITStatus(TIM_Module_TypeDef* TIMMx);
|
||||
ITStatus TIM_GetRawITStatus(TIM_Module_TypeDef* TIMMx, TIM_NumTypeDef TIMx);
|
||||
uint32_t TIM_GetAllRawITStatus(TIM_Module_TypeDef* TIMMx);
|
||||
|
||||
uint32_t TIM_GetCounter(TIM_Module_TypeDef *TIMMx, TIM_NumTypeDef TIMx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __AIR105_TRNG_H
|
||||
#define __AIR105_TRNG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
/** @defgroup RNG_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum{
|
||||
TRNG0
|
||||
} TRNG_ChannelTypeDef;
|
||||
#define IS_TRNG_CHANNEL(CHANNEL) (((CHANNEL) == TRNG0))
|
||||
|
||||
|
||||
#define TRNG_IT_RNG0_S128 ((uint32_t)0x00000001)
|
||||
#define TRNG_IT_RNG0_ATTACK ((uint32_t)0x00000004)
|
||||
#define IS_TRNG_GET_IT(IT) (((IT) == TRNG_IT_RNG0_S128) || \
|
||||
((IT) == TRNG_IT_RNG0_ATTACK))
|
||||
|
||||
/** @defgroup RNG_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
void TRNG_Start(TRNG_ChannelTypeDef TRNGx);
|
||||
void TRNG_Stop(TRNG_ChannelTypeDef TRNGx);
|
||||
uint32_t TRNG_Get(uint32_t rand[4], TRNG_ChannelTypeDef TRNGx);
|
||||
void TRNG_SetPseudoRandom(uint32_t PseudoRandom);
|
||||
void TRNG_DirectOutANA(TRNG_ChannelTypeDef TRNGx, FunctionalState NewState);
|
||||
|
||||
void TRNG_ITConfig(FunctionalState NewState);
|
||||
ITStatus TRNG_GetITStatus(uint32_t TRNG_IT);
|
||||
void TRNG_ClearITPendingBit(uint32_t TRNG_IT);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/************************** (C) COPYRIGHT Megahunt *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __AIR105_WDT_H
|
||||
#define __AIR105_WDT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WDT_Mode_CPUReset = 0,
|
||||
WDT_Mode_Interrupt = 1
|
||||
}WDT_ModeTypeDef;
|
||||
|
||||
void WDT_SetReload(uint32_t Reload);
|
||||
void WDT_ReloadCounter(void);
|
||||
void WDT_Enable(void);
|
||||
void WDT_ModeConfig(WDT_ModeTypeDef WDT_Mode);
|
||||
|
||||
ITStatus WDT_GetITStatus(void);
|
||||
void WDT_ClearITPendingBit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __APP_INC_H__
|
||||
#define __APP_INC_H__
|
||||
#include "bl_inc.h"
|
||||
|
||||
#include "core_hwtimer.h"
|
||||
#include "core_spi.h"
|
||||
#include "core_adc.h"
|
||||
#include "core_dac.h"
|
||||
#include "core_wdt.h"
|
||||
#include "core_usb_ll_driver.h"
|
||||
#include "core_keyboard.h"
|
||||
#include "core_dcmi.h"
|
||||
#include "core_rng.h"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,136 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 19. October 2015
|
||||
* $Revision: V.1.4.5 a
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_common_tables.h
|
||||
*
|
||||
* Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* - Neither the name of ARM LIMITED nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef _ARM_COMMON_TABLES_H
|
||||
#define _ARM_COMMON_TABLES_H
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
extern const uint16_t armBitRevTable[1024];
|
||||
extern const q15_t armRecipTableQ15[64];
|
||||
extern const q31_t armRecipTableQ31[64];
|
||||
/* extern const q31_t realCoefAQ31[1024]; */
|
||||
/* extern const q31_t realCoefBQ31[1024]; */
|
||||
extern const float32_t twiddleCoef_16[32];
|
||||
extern const float32_t twiddleCoef_32[64];
|
||||
extern const float32_t twiddleCoef_64[128];
|
||||
extern const float32_t twiddleCoef_128[256];
|
||||
extern const float32_t twiddleCoef_256[512];
|
||||
extern const float32_t twiddleCoef_512[1024];
|
||||
extern const float32_t twiddleCoef_1024[2048];
|
||||
extern const float32_t twiddleCoef_2048[4096];
|
||||
extern const float32_t twiddleCoef_4096[8192];
|
||||
#define twiddleCoef twiddleCoef_4096
|
||||
extern const q31_t twiddleCoef_16_q31[24];
|
||||
extern const q31_t twiddleCoef_32_q31[48];
|
||||
extern const q31_t twiddleCoef_64_q31[96];
|
||||
extern const q31_t twiddleCoef_128_q31[192];
|
||||
extern const q31_t twiddleCoef_256_q31[384];
|
||||
extern const q31_t twiddleCoef_512_q31[768];
|
||||
extern const q31_t twiddleCoef_1024_q31[1536];
|
||||
extern const q31_t twiddleCoef_2048_q31[3072];
|
||||
extern const q31_t twiddleCoef_4096_q31[6144];
|
||||
extern const q15_t twiddleCoef_16_q15[24];
|
||||
extern const q15_t twiddleCoef_32_q15[48];
|
||||
extern const q15_t twiddleCoef_64_q15[96];
|
||||
extern const q15_t twiddleCoef_128_q15[192];
|
||||
extern const q15_t twiddleCoef_256_q15[384];
|
||||
extern const q15_t twiddleCoef_512_q15[768];
|
||||
extern const q15_t twiddleCoef_1024_q15[1536];
|
||||
extern const q15_t twiddleCoef_2048_q15[3072];
|
||||
extern const q15_t twiddleCoef_4096_q15[6144];
|
||||
extern const float32_t twiddleCoef_rfft_32[32];
|
||||
extern const float32_t twiddleCoef_rfft_64[64];
|
||||
extern const float32_t twiddleCoef_rfft_128[128];
|
||||
extern const float32_t twiddleCoef_rfft_256[256];
|
||||
extern const float32_t twiddleCoef_rfft_512[512];
|
||||
extern const float32_t twiddleCoef_rfft_1024[1024];
|
||||
extern const float32_t twiddleCoef_rfft_2048[2048];
|
||||
extern const float32_t twiddleCoef_rfft_4096[4096];
|
||||
|
||||
|
||||
/* floating-point bit reversal tables */
|
||||
#define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 )
|
||||
#define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 )
|
||||
#define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 )
|
||||
#define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 )
|
||||
#define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 )
|
||||
#define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 )
|
||||
#define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800)
|
||||
#define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808)
|
||||
#define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032)
|
||||
|
||||
extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH];
|
||||
|
||||
/* fixed-point bit reversal tables */
|
||||
#define ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH ((uint16_t)12 )
|
||||
#define ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH ((uint16_t)24 )
|
||||
#define ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH ((uint16_t)56 )
|
||||
#define ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH ((uint16_t)112 )
|
||||
#define ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH ((uint16_t)240 )
|
||||
#define ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH ((uint16_t)480 )
|
||||
#define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992 )
|
||||
#define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984)
|
||||
#define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032)
|
||||
|
||||
extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH];
|
||||
|
||||
/* Tables for Fast Math Sine and Cosine */
|
||||
extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1];
|
||||
extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1];
|
||||
extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1];
|
||||
|
||||
#endif /* ARM_COMMON_TABLES_H */
|
||||
@@ -0,0 +1,79 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 19. March 2015
|
||||
* $Revision: V.1.4.5
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_const_structs.h
|
||||
*
|
||||
* Description: This file has constant structs that are initialized for
|
||||
* user convenience. For example, some can be given as
|
||||
* arguments to the arm_cfft_f32() function.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* - Neither the name of ARM LIMITED nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef _ARM_CONST_STRUCTS_H
|
||||
#define _ARM_CONST_STRUCTS_H
|
||||
|
||||
#include "arm_math.h"
|
||||
#include "arm_common_tables.h"
|
||||
|
||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16;
|
||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32;
|
||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64;
|
||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128;
|
||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256;
|
||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512;
|
||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024;
|
||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048;
|
||||
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096;
|
||||
|
||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16;
|
||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32;
|
||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64;
|
||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128;
|
||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256;
|
||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512;
|
||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024;
|
||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048;
|
||||
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096;
|
||||
|
||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16;
|
||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32;
|
||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64;
|
||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128;
|
||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256;
|
||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512;
|
||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024;
|
||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048;
|
||||
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __BL_INC_H__
|
||||
#define __BL_INC_H__
|
||||
#include "global_config.h"
|
||||
|
||||
#include "air105.h"
|
||||
#include "air105_conf.h"
|
||||
|
||||
#include "bsp_common.h"
|
||||
#include "platform_define.h"
|
||||
|
||||
#include "resource_map.h"
|
||||
#include "core_dma.h"
|
||||
#include "core_tick.h"
|
||||
#include "core_debug.h"
|
||||
#include "core_flash.h"
|
||||
#include "core_gpio.h"
|
||||
#include "core_timer.h"
|
||||
#include "core_otp.h"
|
||||
#include "core_uart.h"
|
||||
#include "core_rtc.h"
|
||||
#include "core_i2c.h"
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
/**************************************************************************//**
|
||||
* @file cmsis_version.h
|
||||
* @brief CMSIS Core(M) Version definitions
|
||||
* @version V5.0.2
|
||||
* @date 19. April 2017
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2017 ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if defined ( __ICCARM__ )
|
||||
#pragma system_include /* treat file as system include file for MISRA check */
|
||||
#elif defined (__clang__)
|
||||
#pragma clang system_header /* treat file as system include file */
|
||||
#endif
|
||||
|
||||
#ifndef __CMSIS_VERSION_H
|
||||
#define __CMSIS_VERSION_H
|
||||
|
||||
/* CMSIS Version definitions */
|
||||
#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
|
||||
#define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */
|
||||
#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
|
||||
__CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_ADC_H__
|
||||
#define __CORE_ADC_H__
|
||||
#define ADC_VALUE_ERROR (0xffffffff)
|
||||
void ADC_GlobalInit(void);
|
||||
/**
|
||||
* @brief 通道开关,在globalinit时只打开了0,0也无法被关闭,目前已经废弃,ADC_GetChannelValue的时候临时打开
|
||||
*
|
||||
* @param Channel 通道号
|
||||
* @param OnOff 开关
|
||||
*/
|
||||
void ADC_ChannelOnOff(uint8_t Channel, uint8_t OnOff);
|
||||
/**
|
||||
* @brief 获取通道的原始ADC值,12bit,1.8V参考电压,通道0内部9:5分压,其他关闭
|
||||
*
|
||||
* @param Channel 通道号
|
||||
* @return != ADC_VALUE_ERROR 为有效值
|
||||
*/
|
||||
uint32_t ADC_GetChannelValue(uint8_t Channel);
|
||||
/**
|
||||
* @brief 开关内部分压,1~5都是1:1 6就不确定了,手册和demo不一致
|
||||
*
|
||||
* @param OnOff 开关
|
||||
*/
|
||||
void ADC_IntelResistance(uint8_t OnOff);
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,87 @@
|
||||
/**************************************************************************//**
|
||||
* @file core_cmFunc.h
|
||||
* @brief CMSIS Cortex-M Core Function Access Header File
|
||||
* @version V4.30
|
||||
* @date 20. October 2015
|
||||
******************************************************************************/
|
||||
/* Copyright (c) 2009 - 2015 ARM LIMITED
|
||||
|
||||
All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of ARM nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
*
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#if defined ( __ICCARM__ )
|
||||
#pragma system_include /* treat file as system include file for MISRA check */
|
||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
#pragma clang system_header /* treat file as system include file */
|
||||
#endif
|
||||
|
||||
#ifndef __CORE_CMFUNC_H
|
||||
#define __CORE_CMFUNC_H
|
||||
|
||||
|
||||
/* ########################### Core Function Access ########################### */
|
||||
/** \ingroup CMSIS_Core_FunctionInterface
|
||||
\defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
|
||||
@{
|
||||
*/
|
||||
|
||||
/*------------------ RealView Compiler -----------------*/
|
||||
#if defined ( __CC_ARM )
|
||||
#include "cmsis_armcc.h"
|
||||
|
||||
/*------------------ ARM Compiler V6 -------------------*/
|
||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
#include "cmsis_armcc_V6.h"
|
||||
|
||||
/*------------------ GNU Compiler ----------------------*/
|
||||
#elif defined ( __GNUC__ )
|
||||
#include "cmsis_gcc.h"
|
||||
|
||||
/*------------------ ICC Compiler ----------------------*/
|
||||
#elif defined ( __ICCARM__ )
|
||||
#include <cmsis_iar.h>
|
||||
|
||||
/*------------------ TI CCS Compiler -------------------*/
|
||||
#elif defined ( __TMS470__ )
|
||||
#include <cmsis_ccs.h>
|
||||
|
||||
/*------------------ TASKING Compiler ------------------*/
|
||||
#elif defined ( __TASKING__ )
|
||||
/*
|
||||
* The CMSIS functions have been implemented as intrinsics in the compiler.
|
||||
* Please use "carm -?i" to get an up to date list of all intrinsics,
|
||||
* Including the CMSIS ones.
|
||||
*/
|
||||
|
||||
/*------------------ COSMIC Compiler -------------------*/
|
||||
#elif defined ( __CSMC__ )
|
||||
#include <cmsis_csm.h>
|
||||
|
||||
#endif
|
||||
|
||||
/*@} end of CMSIS_Core_RegAccFunctions */
|
||||
|
||||
#endif /* __CORE_CMFUNC_H */
|
||||
@@ -0,0 +1,87 @@
|
||||
/**************************************************************************//**
|
||||
* @file core_cmInstr.h
|
||||
* @brief CMSIS Cortex-M Core Instruction Access Header File
|
||||
* @version V4.30
|
||||
* @date 20. October 2015
|
||||
******************************************************************************/
|
||||
/* Copyright (c) 2009 - 2015 ARM LIMITED
|
||||
|
||||
All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of ARM nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
*
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#if defined ( __ICCARM__ )
|
||||
#pragma system_include /* treat file as system include file for MISRA check */
|
||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
#pragma clang system_header /* treat file as system include file */
|
||||
#endif
|
||||
|
||||
#ifndef __CORE_CMINSTR_H
|
||||
#define __CORE_CMINSTR_H
|
||||
|
||||
|
||||
/* ########################## Core Instruction Access ######################### */
|
||||
/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
|
||||
Access to dedicated instructions
|
||||
@{
|
||||
*/
|
||||
|
||||
/*------------------ RealView Compiler -----------------*/
|
||||
#if defined ( __CC_ARM )
|
||||
#include "cmsis_armcc.h"
|
||||
|
||||
/*------------------ ARM Compiler V6 -------------------*/
|
||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
#include "cmsis_armcc_V6.h"
|
||||
|
||||
/*------------------ GNU Compiler ----------------------*/
|
||||
#elif defined ( __GNUC__ )
|
||||
#include "cmsis_gcc.h"
|
||||
|
||||
/*------------------ ICC Compiler ----------------------*/
|
||||
#elif defined ( __ICCARM__ )
|
||||
#include <cmsis_iar.h>
|
||||
|
||||
/*------------------ TI CCS Compiler -------------------*/
|
||||
#elif defined ( __TMS470__ )
|
||||
#include <cmsis_ccs.h>
|
||||
|
||||
/*------------------ TASKING Compiler ------------------*/
|
||||
#elif defined ( __TASKING__ )
|
||||
/*
|
||||
* The CMSIS functions have been implemented as intrinsics in the compiler.
|
||||
* Please use "carm -?i" to get an up to date list of all intrinsics,
|
||||
* Including the CMSIS ones.
|
||||
*/
|
||||
|
||||
/*------------------ COSMIC Compiler -------------------*/
|
||||
#elif defined ( __CSMC__ )
|
||||
#include <cmsis_csm.h>
|
||||
|
||||
#endif
|
||||
|
||||
/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
|
||||
|
||||
#endif /* __CORE_CMINSTR_H */
|
||||
@@ -0,0 +1,96 @@
|
||||
/**************************************************************************//**
|
||||
* @file core_cmSimd.h
|
||||
* @brief CMSIS Cortex-M SIMD Header File
|
||||
* @version V4.30
|
||||
* @date 20. October 2015
|
||||
******************************************************************************/
|
||||
/* Copyright (c) 2009 - 2015 ARM LIMITED
|
||||
|
||||
All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of ARM nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
*
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#if defined ( __ICCARM__ )
|
||||
#pragma system_include /* treat file as system include file for MISRA check */
|
||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
#pragma clang system_header /* treat file as system include file */
|
||||
#endif
|
||||
|
||||
#ifndef __CORE_CMSIMD_H
|
||||
#define __CORE_CMSIMD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* ################### Compiler specific Intrinsics ########################### */
|
||||
/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
|
||||
Access to dedicated SIMD instructions
|
||||
@{
|
||||
*/
|
||||
|
||||
/*------------------ RealView Compiler -----------------*/
|
||||
#if defined ( __CC_ARM )
|
||||
#include "cmsis_armcc.h"
|
||||
|
||||
/*------------------ ARM Compiler V6 -------------------*/
|
||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
#include "cmsis_armcc_V6.h"
|
||||
|
||||
/*------------------ GNU Compiler ----------------------*/
|
||||
#elif defined ( __GNUC__ )
|
||||
#include "cmsis_gcc.h"
|
||||
|
||||
/*------------------ ICC Compiler ----------------------*/
|
||||
#elif defined ( __ICCARM__ )
|
||||
#include <cmsis_iar.h>
|
||||
|
||||
/*------------------ TI CCS Compiler -------------------*/
|
||||
#elif defined ( __TMS470__ )
|
||||
#include <cmsis_ccs.h>
|
||||
|
||||
/*------------------ TASKING Compiler ------------------*/
|
||||
#elif defined ( __TASKING__ )
|
||||
/*
|
||||
* The CMSIS functions have been implemented as intrinsics in the compiler.
|
||||
* Please use "carm -?i" to get an up to date list of all intrinsics,
|
||||
* Including the CMSIS ones.
|
||||
*/
|
||||
|
||||
/*------------------ COSMIC Compiler -------------------*/
|
||||
#elif defined ( __CSMC__ )
|
||||
#include <cmsis_csm.h>
|
||||
|
||||
#endif
|
||||
|
||||
/*@} end of group CMSIS_SIMD_intrinsics */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CORE_CMSIMD_H */
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_DAC_H__
|
||||
#define __CORE_DAC_H__
|
||||
void DAC_Init(uint8_t Stream);
|
||||
void DAC_Setup(uint32_t Freq, uint32_t OutRMode);
|
||||
void DAC_Send(const uint16_t *Data, uint32_t Len, CBFuncEx_t Callback, void *pParam);
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_DCMI_H__
|
||||
#define __CORE_DCMI_H__
|
||||
|
||||
/**
|
||||
* @brief 对摄像头做基本的初始化工作
|
||||
*
|
||||
* @param VsyncLevel 垂直同步极性 0: VSYNC 低电平有效 1: VSYNC 高电平有效
|
||||
* @param HsyncLevel 水平同步极性 0: HSYNC 低电平有效 1: HSYNC 高电平有效
|
||||
* @param PclkPOL Pixel时钟极性 0:下降沿有效 1:上升沿有效
|
||||
* @param DataBits 数据位8~14
|
||||
* @param FrameRate 帧率控制,0不控制,1减少为50%,2减少为25%
|
||||
*/
|
||||
void DCMI_Setup(uint8_t VsyncLevel, uint8_t HsyncLevel, uint8_t PclkPOL, uint8_t DataBit, uint32_t FrameRate);
|
||||
|
||||
/**
|
||||
* @brief 摄像头捕获开关
|
||||
*
|
||||
* @param OnOff 0: 关 1: 开
|
||||
* @param BufLen 缓存大小,注意单位是4byte,如果为0,看下面的参数自动生成,如果不为0,必须是行数据量的倍数,且能被总行数整除,比如320*240,16bit数据,那么就是320*2/4的N倍,比如8倍的1280
|
||||
* @param ImageW 输出图像一行的像素点数
|
||||
* @param ImageW 输出图像行数
|
||||
* @param DataByte 1个像素点的数据量byte
|
||||
* @param OutH 自动计算出的单次回调行数
|
||||
*/
|
||||
void DCMI_CaptureSwitch(uint8_t OnOff, uint32_t BufLen, uint32_t ImageW, uint32_t ImageH, uint8_t DataByte, uint32_t *OutH);
|
||||
void DCMI_SetCallback(CBFuncEx_t CB, void *pData);
|
||||
/**
|
||||
* @brief 摄像头裁剪功能
|
||||
*
|
||||
* @param OnOff 0: 关 1: 开
|
||||
* @param VStart 裁剪从第几行开始
|
||||
* @param HStart 裁剪每行从第几个像素数据开始,如果是16bit数据,则要*2,依次类推
|
||||
* @param VLen 裁剪保留的行数,最小1
|
||||
* @param HLen 裁剪每行保留的像素数据,如果是16bit数据,则要*2,依次类推
|
||||
*/
|
||||
void DCMI_SetCROPConfig(uint8_t OnOff, uint32_t VStart, uint32_t HStart, uint32_t VLen, uint32_t HLen);
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_DEBUG_H__
|
||||
#define __CORE_DEBUG_H__
|
||||
#include "stdint.h"
|
||||
#include "bsp_common.h"
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_DMA_H__
|
||||
#define __CORE_DMA_H__
|
||||
|
||||
enum
|
||||
{
|
||||
DMA1_STREAM_0,
|
||||
DMA1_STREAM_1,
|
||||
DMA1_STREAM_2,
|
||||
DMA1_STREAM_3,
|
||||
DMA1_STREAM_4,
|
||||
DMA1_STREAM_5,
|
||||
DMA1_STREAM_6,
|
||||
DMA1_STREAM_7,
|
||||
// DMA1_STREAM_QTY,
|
||||
// DMA2_STREAM_0 = DMA1_STREAM_QTY,
|
||||
// DMA2_STREAM_1,
|
||||
// DMA2_STREAM_2,
|
||||
// DMA2_STREAM_3,
|
||||
// DMA2_STREAM_4,
|
||||
// DMA2_STREAM_5,
|
||||
// DMA2_STREAM_6,
|
||||
// DMA2_STREAM_7,
|
||||
DMA2_STREAM_QTY,
|
||||
DMA_STREAM_QTY = DMA2_STREAM_QTY,
|
||||
};
|
||||
void DMA_GlobalInit(void);
|
||||
void *DMA_TakeStream(uint8_t Stream);
|
||||
int DMA_CheckStreamLock(uint8_t Stream);
|
||||
void DMA_ReleaseStream(uint8_t Stream);
|
||||
uint8_t DMA_CheckStreamBusy(uint8_t Stream);
|
||||
int DMA_ConfigStream(uint8_t Stream, void *Config);
|
||||
int DMA_StartStream(uint8_t Stream, const void *Data, uint32_t Len, CBFuncEx_t CB, void *pUserData, uint8_t NeedIrq);
|
||||
/**
|
||||
* @brief 强制启动DMA传输
|
||||
* @param Stream DMA流序号
|
||||
* @param Data DMA缓存
|
||||
* @param Len DMA缓存长度
|
||||
* @param CB 完成或者出错回调。完成时,回调函数参数pParam为0,出错为0xffffffff
|
||||
* @param NeedIrq 是否需要中断
|
||||
* @return 无
|
||||
*/
|
||||
void DMA_ForceStartStream(uint8_t Stream, const void *Data, uint32_t Len, CBFuncEx_t CB, void *pUserData, uint8_t NeedIrq);
|
||||
void DMA_ClearStreamFlag(uint8_t Stream);
|
||||
void DMA_StopStream(uint8_t Stream);
|
||||
uint32_t DMA_GetRemainingDataLength(uint8_t Stream);
|
||||
uint32_t DMA_GetDataLength(uint8_t Stream, uint32_t FirstAddress);
|
||||
void DMA_BaseConfig(void *Config);
|
||||
void DMA_PrintGlobalReg(void);
|
||||
void DMA_PrintReg(uint8_t Stream);
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_FLASH_H__
|
||||
#define __CORE_FLASH_H__
|
||||
int Flash_EraseSector(uint32_t address, uint8_t NeedCheck);
|
||||
int Flash_ProgramData(uint32_t address, uint32_t *Data, uint32_t Len, uint8_t NeedCheck);
|
||||
#endif
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_GPIO_H__
|
||||
#define __CORE_GPIO_H__
|
||||
#include "bsp_common.h"
|
||||
/**
|
||||
* @brief GPIO全局初始化
|
||||
*
|
||||
* @param Fun 中断回调函数,回调时,PIN序号是pData,void *->uint32_t
|
||||
|
||||
*/
|
||||
void GPIO_GlobalInit(CBFuncEx_t Fun);
|
||||
|
||||
/**
|
||||
* @brief GPIO初始化
|
||||
*
|
||||
* @param Pin Pin序号
|
||||
* @param IsInput 是否为输入功能,1是,0否
|
||||
* @param InitValue 初始电平,1高,0低,只对输出有效
|
||||
|
||||
*/
|
||||
void GPIO_Config(uint32_t Pin, uint8_t IsInput, uint8_t InitValue);
|
||||
/**
|
||||
* @brief GPIO上下拉控制
|
||||
*
|
||||
* @param Pin Pin序号
|
||||
* @param IsPull 是否需要上下拉
|
||||
* @param IsUp 是否上拉
|
||||
|
||||
*/
|
||||
void GPIO_PullConfig(uint32_t Pin, uint8_t IsPull, uint8_t IsUp);
|
||||
|
||||
/**
|
||||
* @brief GPIO外部中断初始化
|
||||
*
|
||||
* @param Pin Pin序号
|
||||
* @param IsLevel 是否是电平中断,0边沿型,1电平型
|
||||
* @param IsRiseHigh 上升沿或者高电平
|
||||
* @param IsFallLow 下降沿或者低电平
|
||||
*/
|
||||
void GPIO_ExtiConfig(uint32_t Pin, uint8_t IsLevel, uint8_t IsRiseHigh, uint8_t IsFallLow);
|
||||
|
||||
/**
|
||||
* @brief GPIO复用功能
|
||||
*
|
||||
* @param Pin Pin序号
|
||||
* @param Function 复用功能,这个需要根据芯片实际情况决定,当前是0~3,注意GPIO功能是1
|
||||
*/
|
||||
void GPIO_Iomux(uint32_t Pin, uint32_t Function);
|
||||
|
||||
/**
|
||||
* @brief GPIO输出电平
|
||||
*
|
||||
* @param Pin Pin序号
|
||||
* @param Level 1高电平,0低电平
|
||||
*/
|
||||
void GPIO_Output(uint32_t Pin, uint8_t Level);
|
||||
|
||||
/**
|
||||
* @brief 读取GPIO输入电平
|
||||
*
|
||||
* @param Pin Pin序号
|
||||
* @return 1高电平, 0低电平,其他无效
|
||||
*/
|
||||
uint8_t GPIO_Input(uint32_t Pin);
|
||||
|
||||
/**
|
||||
* @brief GPIO同一端口多个pin输出电平,针对类似STM32GPIO分布有效
|
||||
*
|
||||
* @param Port 端口号
|
||||
* @param Pins Pin序号组合
|
||||
* @param Level 1高电平,0低电平
|
||||
*/
|
||||
void GPIO_OutputMulti(uint32_t Port, uint32_t Pins, uint32_t Level);
|
||||
|
||||
/**
|
||||
* @brief 读取GPIO同一端口多个pin输入电平
|
||||
*
|
||||
* @param Port 端口号
|
||||
* @return
|
||||
*/
|
||||
uint32_t GPIO_InputMulti(uint32_t Port);
|
||||
|
||||
void GPIO_ExtiSetHWTimerCB(CBFuncEx_t CB, void *pParam);
|
||||
void GPIO_ODConfig(uint32_t Pin, uint8_t InitValue);
|
||||
#endif
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_HWTIMER_H__
|
||||
#define __CORE_HWTIMER_H__
|
||||
|
||||
|
||||
/**
|
||||
* @brief 硬件定时器按照周期和占空比设置成PWM并启动
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
* @param Period 周期,最大24M,
|
||||
* @param Duty 占空比,0.1%,只有50KHz以下才能达到这个精度,500KHz到1%
|
||||
* @param IsOnePulse 只触发一次脉冲
|
||||
*/
|
||||
void HWTimer_SetPWM(uint8_t HWTimerID, uint32_t Period, uint16_t Duty, uint8_t IsOnePulse);
|
||||
|
||||
/**
|
||||
* @brief 硬件定时器按照高低电平分辨率设置成PWM并启动,时钟48M
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
* @param HighCnt 高电平时钟周期数
|
||||
* @param LowCnt 低电平时钟周期数
|
||||
* @param IsOnePulse 只触发一次脉冲
|
||||
*/
|
||||
void HWTimer_StartPWM(uint8_t HWTimerID, uint32_t HighCnt, uint32_t LowCnt, uint8_t IsOnePulse);
|
||||
|
||||
/**
|
||||
* @brief 硬件定时器关闭
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
*/
|
||||
void HWTimer_Stop(uint8_t HWTimerID);
|
||||
/**
|
||||
* @brief 初始化IO操作序列,会完全清除之前保留的操作序列
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
* @param nCount 操作步骤总数
|
||||
* @param Repeat 重复次数
|
||||
* @param InputByte IO读取的次数,注意每8次1个byte,不足8个也算1个byte
|
||||
* @param CmdDoneCB 全部完成后回调函数
|
||||
* @param pCmdDoneParam 回调函数的用户参数
|
||||
*
|
||||
*/
|
||||
void HWTimer_InitOperationQueue(uint8_t HWTimerID, uint32_t nCount, uint32_t Repeat, uint32_t InputByte, CBFuncEx_t CmdDoneCB, void *pCmdDoneParam);
|
||||
/**
|
||||
* @brief 加入IO操作序列
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
* @param pCmd IO操作
|
||||
*/
|
||||
void HWTimer_AddOperation(uint8_t HWTimerID, OPQueue_CmdStruct *pCmd);
|
||||
/**
|
||||
* @brief 启动IO操作序列
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
*/
|
||||
void HWTimer_StartOperationQueue(uint8_t HWTimerID);
|
||||
/**
|
||||
* @brief 清空IO操作序列,需要重新AddOperation,但是不需要init
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
*/
|
||||
void HWTimer_ClearOperationQueue(uint8_t HWTimerID);
|
||||
/**
|
||||
* @brief 完全释放IO操作序列,下次使用需要重新init,必须在HWTimer_CheckOperationQueueDone确认完成的情况下调用
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
*/
|
||||
void HWTimer_FreeOperationQueue(uint8_t HWTimerID);
|
||||
/**
|
||||
* @brief 在OP_QUEUE_CMD_CB时,需要在CB里调用本函数来安全的结束序列操作,只能在OP_QUEUE_CMD_CB时调用
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
*/
|
||||
void HWTimer_AddEndCmdInOperationQueue(uint8_t HWTimerID);
|
||||
/**
|
||||
* @brief 检查IO操作序列是否完成
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
* @return =0未完成,其他已完成
|
||||
*/
|
||||
uint8_t HWTimer_CheckOperationQueueDone(uint8_t HWTimerID);
|
||||
/**
|
||||
* @brief 获取IO操作序列中IO读取的值
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
* @param Value copy的空间
|
||||
* @return 获取的byte数,和init时InputByte一致
|
||||
*/
|
||||
int HWTimer_GetOperationQueueInputResult(uint8_t HWTimerID, uint8_t *Value);
|
||||
|
||||
/**
|
||||
* @brief 获取IO操作序列中捕获状态
|
||||
*
|
||||
* @param HWTimerID 硬件定时器ID
|
||||
* @param CB 捕获回调函数
|
||||
* @param CB 捕获回调函数的用户参数
|
||||
* @return 捕获次数
|
||||
*/
|
||||
uint32_t HWTimer_GetOperationQueueCaptureResult(uint8_t HWTimerID, CBFuncEx_t CB, void *pParam);
|
||||
#endif
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_I2C_H__
|
||||
#define __CORE_I2C_H__
|
||||
#include "bsp_common.h"
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Data[2];
|
||||
}I2C_CommonRegDataStruct;
|
||||
|
||||
void I2C_GlobalInit(void);
|
||||
/**
|
||||
* @brief i2c主机配置
|
||||
*
|
||||
* @param I2CID I2C通道号
|
||||
* @param Speed 速度,只有100000和400000
|
||||
*/
|
||||
void I2C_MasterSetup(uint8_t I2CID, uint32_t Speed);
|
||||
/*
|
||||
* @brief i2c传输前配置,如果配置和上次一致,则不用设置
|
||||
*
|
||||
* @param I2CID I2C通道号
|
||||
* @param ChipAddress I2C设备地址
|
||||
* @param ChipAddressLen I2C设备地址长度 ,1或者2
|
||||
* @param CB 完成后回调函数
|
||||
* @param pParam 完成后回调函数中的pParam
|
||||
*/
|
||||
void I2C_Prepare(uint8_t I2CID, uint16_t ChipAddress, uint8_t ChipAddressLen, CBFuncEx_t CB, void *pParam);
|
||||
/**
|
||||
* @brief i2c主机传输,兼容直接读写和先写寄存器地址后读数据
|
||||
*
|
||||
* @param I2CID I2C通道号
|
||||
* @param Operate 操作类型
|
||||
* I2C_OP_READ_REG = 0, //i2c通用读寄存器,一写一读,自动带start信号
|
||||
I2C_OP_READ, //i2c通用读,只读
|
||||
I2C_OP_WRITE, //i2c通用写,只写
|
||||
* @param RegAddress 寄存器地址,在通用读写时忽略
|
||||
* @param Data 读写数据缓存,直接使用用户的空间,在完成前不可以释放空间
|
||||
* @param Len 读写数据长度
|
||||
* @param Toms 传输单个字节超时时间,单位ms
|
||||
*/
|
||||
void I2C_MasterXfer(uint8_t I2CID, uint8_t Operate, uint8_t RegAddress, uint8_t *Data, uint32_t Len, uint16_t Toms);
|
||||
|
||||
/**
|
||||
* @brief i2c主机传输,多个单一寄存器写入
|
||||
*
|
||||
* @param I2CID I2C通道号
|
||||
* @param RegQueue 寄存器序列
|
||||
* @param TotalNum 序列长度
|
||||
* @param Toms 传输单个字节超时时间,单位ms
|
||||
* @param IsBlock 是否要阻塞
|
||||
* @return =0 传输成功,其他失败 IsBlock=1才有效,IsBlock=0直接返回0
|
||||
*/
|
||||
int32_t I2C_MasterWriteRegQueue(uint8_t I2CID, I2C_CommonRegDataStruct *RegQueue, uint32_t TotalNum, uint16_t Toms, uint8_t IsBlock);
|
||||
|
||||
/**
|
||||
* @brief i2c主机传输结果查询
|
||||
*
|
||||
* @param I2CID I2C通道号
|
||||
* @param Result 传输结果 =0成功,其他失败,只有return != 0才有效
|
||||
* @return =0 传输还未完成 其他已完成
|
||||
*/
|
||||
int I2C_WaitResult(uint8_t I2CID, int32_t *Result);
|
||||
|
||||
int32_t I2C_BlockWrite(uint8_t I2CID, uint8_t ChipAddress, const uint8_t *Data, uint32_t Len, uint16_t Toms, CBFuncEx_t CB, void *pParam);
|
||||
|
||||
int32_t I2C_BlockRead(uint8_t I2CID, uint8_t ChipAddress, uint8_t *Reg, uint8_t *Data, uint32_t Len, uint16_t Toms, CBFuncEx_t CB, void *pParam);
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_IRQ_H__
|
||||
#define __CORE_IRQ_H__
|
||||
|
||||
/**
|
||||
* @brief 设置中断回调函数
|
||||
*
|
||||
* @param Irq 中断号 0~IRQ_LINE_MAX
|
||||
* @param Handler 中断回调函数,如 void Irq_Handler(uint32_t IrqLine, void *pData); 可以多个中断号对应1个中断函数,回调时传入中断号和用户数据
|
||||
*/
|
||||
void ISR_SetHandler(int32_t Irq, void *Handler);
|
||||
/**
|
||||
* @brief 设置中断优先级
|
||||
*
|
||||
* @param Irq 中断号 0~IRQ_LINE_MAX
|
||||
* @param PriorityLevel 优先级范围根据芯片实际情况决定
|
||||
*/
|
||||
void ISR_SetPriority(int32_t Irq, uint32_t PriorityLevel);
|
||||
|
||||
void ISR_OnOff(int32_t Irq, uint32_t OnOff);
|
||||
void ISR_Clear(int32_t Irq);
|
||||
void ISR_PrintCallback(int32_t Irq);
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_KEYBOARD_H__
|
||||
#define __CORE_KEYBOARD_H__
|
||||
/**
|
||||
* @brief 键盘扫描配置
|
||||
*
|
||||
* @param PinConfigMap 硬盘扫描通道配置,bit0~bit8对应通道0到8,0为输入,1为输出,开发板配置为0x0f0
|
||||
* @param Debounce 按键滤波,目前强制为7
|
||||
0: 5ms~75ms;
|
||||
1: 17.5ms~75ms;
|
||||
2: 27.5ms~75ms;
|
||||
3: 37.5 ms~75ms;
|
||||
4: 45ms~75ms;
|
||||
5: 50ms~75ms;
|
||||
6: 60ms~75ms;
|
||||
7: 70ms~75ms。
|
||||
* @param CB 按键中断回调,pData为按键参数32bit,pParam为用户数据,按键参数中bit16=1按下0释放,bit0~3,输入通道值,bit4~bit7,输出通道值
|
||||
* @param pParam 按键中断回调用户数据
|
||||
*/
|
||||
void KB_Setup(uint16_t PinConfigMap, uint16_t Debounce, CBFuncEx_t CB, void *pParam);
|
||||
void KB_Stop(void);
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_OTP_H__
|
||||
#define __CORE_OTP_H__
|
||||
/**
|
||||
* @brief 写OTP区
|
||||
*
|
||||
* @param Address 写入首地址,注意从0开始,一共3KB,必须4字节对齐
|
||||
* @param Data 写入数据,必须4字节对齐
|
||||
* @param Len 写入数据长度,单位4字节,比如写入128字节,这里填32
|
||||
*/
|
||||
void OTP_Write(uint32_t Address, const uint32_t *Data, uint32_t Len);
|
||||
/**
|
||||
* @brief 读OTP区
|
||||
*
|
||||
* @param Address 首地址,注意从0开始,一共3KB
|
||||
* @param Data 缓存数据
|
||||
* @param Len 读出长度
|
||||
*/
|
||||
void OTP_Read(uint32_t Address, uint8_t *Data, uint32_t Len);
|
||||
/**
|
||||
* @brief 锁定全部OTP区,变成只读,只能重启恢复
|
||||
*
|
||||
*/
|
||||
void OTP_Lock(void);
|
||||
|
||||
void OTP_GetSn(uint8_t *ChipSN);
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_RNG_H__
|
||||
#define __CORE_RNG_H__
|
||||
void RNG_Init(void);
|
||||
/**
|
||||
* @brief 获取随机数
|
||||
*
|
||||
* @param Buf,一次获取4个32bit数据
|
||||
*/
|
||||
void RNG_GetData(uint32_t Buf[4]);
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_RTC_H__
|
||||
#define __CORE_RTC_H__
|
||||
#include "bsp_common.h"
|
||||
void RTC_GlobalInit(void);
|
||||
|
||||
void RTC_SetDateTime(Date_UserDataStruct *pDate, Time_UserDataStruct *pTime, uint8_t isForce);
|
||||
|
||||
void RTC_GetDateTime(Date_UserDataStruct *pDate, Time_UserDataStruct *pTime);
|
||||
|
||||
uint64_t RTC_GetUTC(void);
|
||||
|
||||
|
||||
void RTC_SetStamp(uint32_t Stamp);
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_SERVICE_H__
|
||||
#define __CORE_SERVICE_H__
|
||||
#include "bsp_common.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Speed;
|
||||
uint32_t x1;
|
||||
uint32_t y1;
|
||||
uint32_t x2;
|
||||
uint32_t y2;
|
||||
uint32_t xoffset;
|
||||
uint32_t yoffset;
|
||||
uint32_t Size;
|
||||
uint32_t DCDelay;
|
||||
uint8_t *Data;
|
||||
uint8_t SpiID;
|
||||
uint8_t Mode;
|
||||
uint8_t CSPin;
|
||||
uint8_t DCPin;
|
||||
uint8_t ColorMode;
|
||||
}LCD_DrawStruct;
|
||||
|
||||
void Core_ServiceInit(void);
|
||||
void Core_LCDDraw(LCD_DrawStruct *Draw);
|
||||
void Core_CameraDraw(LCD_DrawStruct *Draw);
|
||||
void Core_DecodeQR(uint8_t *ImageData, uint16_t ImageW, uint16_t ImageH, CBDataFun_t CB);
|
||||
uint32_t Core_LCDDrawCacheLen(void);
|
||||
void Core_USBDefaultDeviceStart(uint8_t USB_ID);
|
||||
void Core_USBAction(uint8_t USB_ID, uint8_t Action, void *pParam);
|
||||
void Core_PrintMemInfo(void);
|
||||
void Core_PrintServiceStack(void);
|
||||
void Core_DebugMem(uint8_t HeapID, const char *FuncName, uint32_t Line);
|
||||
|
||||
uint8_t Core_GetSleepFlag(void);
|
||||
void Core_SetSleepEnable(uint8_t OnOff);
|
||||
|
||||
void Core_VUartInit(uint8_t UartID, uint32_t BaudRate, uint8_t IsRxCacheEnable, uint8_t DataBits, uint8_t Parity, uint8_t StopBits, CBFuncEx_t CB);
|
||||
void Core_VUartDeInit(uint8_t UartID);
|
||||
void Core_VUartSetRxTimeout(uint8_t UartID, uint32_t TimeoutUS);
|
||||
void Core_VUartSetCb(uint8_t UartID, CBFuncEx_t CB);
|
||||
uint32_t Core_VUartRxBufferRead(uint8_t UartID, uint8_t *Data, uint32_t Len);
|
||||
int32_t Core_VUartBufferTx(uint8_t UartID, const uint8_t *Data, uint32_t Len);
|
||||
void Core_VUartBufferTxStop(uint8_t UartID);
|
||||
|
||||
void Core_VHIDInit(uint8_t USB_ID, CBFuncEx_t CB);
|
||||
void Core_VHIDUploadData(uint8_t USB_ID, uint8_t *Data, uint16_t Len);
|
||||
void Core_VHIDUploadStop(uint8_t USB_ID);
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_SPI_H__
|
||||
#define __CORE_SPI_H__
|
||||
#include "bsp_common.h"
|
||||
void SPI_MasterInit(uint8_t SpiID, uint8_t DataBit, uint8_t Mode, uint32_t Speed, CBFuncEx_t CB, void *pUserData);
|
||||
int32_t SPI_Transfer(uint8_t SpiID, const uint8_t *TxData, uint8_t *RxData, uint32_t Len, uint8_t UseDMA);
|
||||
/*
|
||||
* polling传输,不发生线程调度
|
||||
*/
|
||||
int32_t SPI_BlockTransfer(uint8_t SpiID, const uint8_t *TxData, uint8_t *RxData, uint32_t Len);
|
||||
/*
|
||||
* 类似spiflash的cmd+data型传输用,先发WLen数据,忽略Rx数据,再接收RLen数据
|
||||
*/
|
||||
int32_t SPI_FlashBlockTransfer(uint8_t SpiID, const uint8_t *TxData, uint32_t WLen, uint8_t *RxData, uint32_t RLen);
|
||||
void SPI_DMATxInit(uint8_t SpiID, uint8_t Stream, uint32_t Channel);
|
||||
void SPI_DMARxInit(uint8_t SpiID, uint8_t Stream, uint32_t Channel);
|
||||
void SPI_TransferStop(uint8_t UartID);
|
||||
uint8_t SPI_IsTransferBusy(uint8_t UartID);
|
||||
void SPI_SetNewConfig(uint8_t SpiID, uint32_t Speed, uint8_t NewMode);
|
||||
void SPI_SetCallbackFun(uint8_t SpiID, CBFuncEx_t CB, void *pUserData);
|
||||
void SPI_SetTxOnlyFlag(uint8_t SpiID, uint8_t OnOff);
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_TASK_H__
|
||||
#define __CORE_TASK_H__
|
||||
typedef struct
|
||||
{
|
||||
uint32_t ID;
|
||||
uint32_t Param1;
|
||||
uint32_t Param2;
|
||||
uint32_t Param3;
|
||||
}Task_EventStruct;
|
||||
#define OS_EVENT Task_EventStruct
|
||||
HANDLE Task_Create(TaskFun_t EntryFunction, void *Param, uint32_t StackSize, uint32_t Priority, const char *Name);
|
||||
void Task_SendEvent(HANDLE TaskHandle, uint32_t ID, uint32_t P1, uint32_t P2, uint32_t P3);
|
||||
int32_t Task_GetEvent(HANDLE TaskHandle, uint32_t TargetEventID, Task_EventStruct *OutEvent, CBFuncEx_t Callback, uint64_t Tick);
|
||||
int32_t Task_GetEventByMS(HANDLE TaskHandle, uint32_t TargetEventID, Task_EventStruct *OutEvent, CBFuncEx_t Callback, uint32_t ms);
|
||||
HANDLE Task_GetCurrent(void);
|
||||
void Task_DelayTick(uint64_t Tick);
|
||||
void Task_DelayUS(uint32_t US);
|
||||
void Task_DelayMS(uint32_t MS);
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_TICK_H__
|
||||
#define __CORE_TICK_H__
|
||||
uint64_t GetSysTick(void);
|
||||
void SysTickDelay(uint32_t Tick);
|
||||
void SysTickDelayUntil(uint64_t StartTick, uint32_t Tick);
|
||||
void CoreTick_Init(void);
|
||||
uint64_t GetSysTickMS(void);
|
||||
uint64_t GetSysTickUS(void);
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_TIMER_H__
|
||||
#define __CORE_TIMER_H__
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TIMER_SN_START = 0,
|
||||
TIMER_SN_MAX,
|
||||
}STATIC_TIMER_ENUM;
|
||||
|
||||
typedef struct Timer_InfoStruct Timer_t;
|
||||
|
||||
/*********************************TimerList*****************************************/
|
||||
|
||||
void Timer_Init(void);
|
||||
//void Timer_Task(void *Param);
|
||||
//void Timer_Run(void);
|
||||
Timer_t * Timer_Create(CBFuncEx_t CB, void *Param, void *NotifyTask);
|
||||
Timer_t * Timer_GetStatic(uint32_t Sn, CBFuncEx_t CB, void *Param, void *NotifyTask);
|
||||
int Timer_Start(Timer_t *Timer, uint64_t Tick, uint8_t IsRepeat);
|
||||
int Timer_StartMS(Timer_t *Timer, uint32_t MS, uint8_t IsRepeat);
|
||||
int Timer_StartUS(Timer_t *Timer, uint32_t US, uint8_t IsRepeat);
|
||||
void Timer_Stop(Timer_t *Timer);
|
||||
void Timer_Release(Timer_t *Timer);
|
||||
uint32_t Timer_NextToRest(void);
|
||||
uint8_t Timer_IsRunning(Timer_t *Timer);
|
||||
void Timer_PrintAll(void);
|
||||
#endif
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_UART_H__
|
||||
#define __CORE_UART_H__
|
||||
#include "bsp_common.h"
|
||||
/**
|
||||
* @brief 对串口做基本的初始化工作,不开启任何中断和DMA
|
||||
*
|
||||
* @param UartID 串口号 0~MAX,对应USART1~UARTX,0默认用于log输出
|
||||
* @param BaudRate 波特率
|
||||
* @param IsRxCacheEnable 是否打开RX缓存功能,打开后,只有接收超时中断才会返回,否则每次数据到来都会返回
|
||||
* @param DataBits 数据位5~8
|
||||
* @param Parity 奇偶校验,可选下列
|
||||
* UART_PARITY_NONE,
|
||||
UART_PARITY_ODD,
|
||||
UART_PARITY_EVEN,
|
||||
* @param StopBits 停止位
|
||||
* UART_STOP_BIT1,
|
||||
UART_STOP_BIT1_5,
|
||||
UART_STOP_BIT2,
|
||||
* @param CB 回调函数,用于通知是否有新数据达到,DMA TX或者RX完成,是否有错误
|
||||
*/
|
||||
void Uart_BaseInit(uint8_t UartID, uint32_t BaudRate, uint8_t IsRxCacheEnable, uint8_t DataBits, uint8_t Parity, uint8_t StopBits, CBFuncEx_t CB);
|
||||
|
||||
|
||||
void Uart_SetCb(uint8_t UartID, CBFuncEx_t CB);
|
||||
|
||||
void Uart_DeInit(uint8_t UartID);
|
||||
/**
|
||||
* @brief 串口做阻塞输出,一般用于bootloader或者紧急场合
|
||||
*
|
||||
* @param UartID 串口号 0~MAX,对应USART1~UARTX,0默认用于log输出
|
||||
* @param Data
|
||||
* @param Len
|
||||
*/
|
||||
void Uart_BlockTx(uint8_t UartID, uint8_t *Data, uint32_t Len);
|
||||
|
||||
void Uart_NoBlockTx(uint8_t UartID, uint8_t Data);
|
||||
|
||||
void Uart_EnableRxIrq(uint8_t UartID);
|
||||
|
||||
void Uart_EnableTxDoneIrq(uint8_t UartID);
|
||||
/**
|
||||
* @brief 串口的DMA配置
|
||||
*
|
||||
* @param UartID 串口号 0~5
|
||||
* @param Stream DMA流序号
|
||||
* @param Channel DMA通道
|
||||
* @return >0 成功返回中断号,其他失败
|
||||
*/
|
||||
int Uart_DMATxInit(uint8_t UartID, uint8_t Stream, uint32_t Channel);
|
||||
|
||||
int Uart_DMARxInit(uint8_t UartID, uint8_t Stream, uint32_t Channel);
|
||||
|
||||
/**
|
||||
* @brief 串口做DMA非阻塞输出,只能用于APP
|
||||
*
|
||||
* @param UartID 串口号 0~5
|
||||
* @param Stream DMA流序号
|
||||
* @param Data
|
||||
* @param Len
|
||||
*/
|
||||
void Uart_DMATx(uint8_t UartID, uint8_t Stream, const uint8_t *Data, uint32_t Len);
|
||||
|
||||
void Uart_DMARx(uint8_t UartID, uint8_t Stream, uint8_t *Data, uint32_t Len);
|
||||
|
||||
uint32_t Uart_RxBufferRead(uint8_t UartID, uint8_t *Data, uint32_t Len);
|
||||
|
||||
void Uart_RxBufferCB(uint8_t UartID, CBFuncEx_t CB);
|
||||
|
||||
uint32_t Uart_FifoRead(uint8_t UartID, uint8_t *Data);
|
||||
/**
|
||||
* @brief 串口做FIFO非阻塞输出
|
||||
*
|
||||
* @param UartID 串口号 0~5
|
||||
* @param Data
|
||||
* @param Len
|
||||
* @return <0 失败 =0 所有数据传入fifo,不再回调buffer_done,直接回调all_done >0 还有数据没有传入fifo
|
||||
*/
|
||||
int32_t Uart_BufferTx(uint8_t UartID, const uint8_t *Data, uint32_t Len);
|
||||
void Uart_BufferTxStop(uint8_t UartID);
|
||||
void Uart_PrintReg(uint8_t UartID);
|
||||
void Uart_ChangeBR(uint8_t UartID, uint32_t BaudRate);
|
||||
uint32_t Uart_GetLastError(uint8_t UartID);
|
||||
void Uart_GlobalInit(void);
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_USB_LL_DRIVER_H__
|
||||
#define __CORE_USB_LL_DRIVER_H__
|
||||
|
||||
void USB_GlobalInit(void);
|
||||
void USB_PowerOnOff(HANDLE hUSB, uint8_t OnOff);
|
||||
void USB_Stop(HANDLE hUSB);
|
||||
void USB_ResetStart(HANDLE hUSB);
|
||||
void USB_ResetEnd(HANDLE hUSB);
|
||||
void USB_SetWorkMode(HANDLE hUSB, uint8_t Mode);
|
||||
void USB_SetDeviceAddress(HANDLE hUSB, uint8_t Address);
|
||||
int USB_InitEpCfg(HANDLE hUSB);
|
||||
int USB_ReInitEpCfg(HANDLE hUSB);
|
||||
void USB_Start(HANDLE hUSB);
|
||||
void USB_TxPacket(HANDLE hUSB, uint8_t EpIndex, const uint8_t *Data, uint16_t Len);
|
||||
void USB_DeviceXfer(HANDLE hUSB, uint8_t EpIndex);
|
||||
void USB_DeviceXferStop(HANDLE hUSB, uint8_t EpIndex);
|
||||
void USB_EpIntOnOff(HANDLE hUSB, uint8_t EpIndex, uint8_t IsToDevice, uint8_t OnOff);
|
||||
void USB_SetDeviceNoDataSetup(HANDLE hUSB);
|
||||
void USB_FlushFifo(HANDLE hUSB, uint8_t EpIndex, uint8_t IsRxFifo);
|
||||
|
||||
void USB_SetDeviceEPStatus (HANDLE hUSB, uint8_t Index, uint8_t IsToDevice, uint8_t Status);
|
||||
uint8_t USB_GetDeviceEPStatus (HANDLE hUSB, uint8_t Index, uint8_t IsToDevice);
|
||||
|
||||
int32_t USB_SetISOCHDelay(HANDLE hUSB, uint16_t DelayNS);
|
||||
int32_t USB_ExitLatency(HANDLE hUSB, uint8_t Config[6]);
|
||||
|
||||
void USB_ResumeStart(HANDLE hUSB);
|
||||
void USB_ResumeEnd(HANDLE hUSB);
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_WDT_H__
|
||||
#define __CORE_WDT_H__
|
||||
|
||||
void WDT_SetTimeout(uint32_t ms);
|
||||
void WDT_Feed(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "bsp_common.h"
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __GLOBAL_CONFIG_H__
|
||||
#define __GLOBAL_CONFIG_H__
|
||||
#ifndef HSE_VALUE
|
||||
#define HSE_VALUE ((uint32_t)12000000) /*!< Value of the HSE oscillator in Hz */
|
||||
#endif
|
||||
//#define __DEBUG__
|
||||
#define IRQ_LINE_OFFSET (16) //如果想要用sys_tick,改成15
|
||||
#define IRQ_LINE_MAX (52)
|
||||
#define CORE_TICK_BASE (1000)
|
||||
#define HW_TICK_BASE (48000000)
|
||||
#define __WDT_TO_MS__ (15000)
|
||||
#define __FLASH_SECTOR_SIZE__ (0x00001000)
|
||||
#define __FLASH_PAGE_SIZE__ (0x00000100)
|
||||
#define __CORE_FLASH_SECTOR_NUM__ (768) //__FLASH_BASE_ADDR__ + __CORE_FLASH_SECTOR_NUM__ * __FLASH_SECTOR_SIZE__,是脚本区, 3M开始
|
||||
#define __SCRIPT_FLASH_SECTOR_NUM__ (128) //__SCRIPT_FLASH_SECTOR_NUM__ * __FLASH_SECTOR_SIZE__,是脚本区长度,512K,剩余512K是文件区
|
||||
#define __FLASH_BASE_ADDR__ (0x01000000)
|
||||
#define __RAMRUN_ISR_ADDR__ (0x20004000)
|
||||
#define __SRAM_BASE_ADDR__ (0x20000000)
|
||||
#define __APP_START_MAGIC__ (0x5ae1f0b5)
|
||||
#ifndef __BUILD_OS__
|
||||
#define __FUNC_IN_RAM__
|
||||
#else
|
||||
#define __FUNC_IN_RAM__ __attribute__((section (".RamFunc")))
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __IO_MAP_H__
|
||||
#define __IO_MAP_H__
|
||||
#define DBG_UART_TX_PIN HAL_GPIO_1
|
||||
#define DBG_UART_TX_AF 0
|
||||
|
||||
#define DBG_UART_RX_PIN HAL_GPIO_0
|
||||
#define DBG_UART_RX_AF 0
|
||||
|
||||
//#define FLASH_SPI_TX_PORT GPIOB
|
||||
//#define FLASH_SPI_TX_PIN LL_GPIO_PIN_5
|
||||
//#define FLASH_SPI_TX_AF LL_GPIO_AF_5
|
||||
//#define FLASH_SPI_RX_PORT GPIOB
|
||||
//#define FLASH_SPI_RX_PIN LL_GPIO_PIN_4
|
||||
//#define FLASH_SPI_RX_AF LL_GPIO_AF_5
|
||||
//#define FLASH_SPI_CLK_PORT GPIOB
|
||||
//#define FLASH_SPI_CLK_PIN LL_GPIO_PIN_3
|
||||
//#define FLASH_SPI_CLK_AF LL_GPIO_AF_5
|
||||
//#define FLASH_SPI_CS_PORT GPIOE
|
||||
//#define FLASH_SPI_CS_PIN LL_GPIO_PIN_2
|
||||
//#define FLASH_SPI_CS_AF LL_GPIO_AF_0
|
||||
//
|
||||
//
|
||||
//#define UART2_TX_PORT GPIOA
|
||||
//#define UART2_TX_PIN LL_GPIO_PIN_9
|
||||
//#define UART2_TX_AF LL_GPIO_AF_7
|
||||
//#define UART2_RX_PORT GPIOA
|
||||
//#define UART2_RX_PIN LL_GPIO_PIN_9
|
||||
//#define UART2_RX_AF LL_GPIO_AF_7
|
||||
//
|
||||
//#define UART3_TX_PORT GPIOA
|
||||
//#define UART3_TX_PIN LL_GPIO_PIN_9
|
||||
//#define UART3_TX_AF LL_GPIO_AF_7
|
||||
//#define UART3_RX_PORT GPIOA
|
||||
//#define UART3_RX_PIN LL_GPIO_PIN_9
|
||||
//#define UART3_RX_AF LL_GPIO_AF_7
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __MISC_H
|
||||
#define __MISC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "air105.h"
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled.
|
||||
This parameter can be a value of @ref IRQn_Type
|
||||
(For the complete SCPU Devices IRQ Channels list, please
|
||||
refer to cpu.h file) */
|
||||
|
||||
uint32_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel
|
||||
specified in NVIC_IRQChannel. This parameter can be a value
|
||||
between 0 and 15 as described in the table @ref NVIC_Priority_Table */
|
||||
|
||||
uint32_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified
|
||||
in NVIC_IRQChannel. This parameter can be a value
|
||||
between 0 and 15 as described in the table @ref NVIC_Priority_Table */
|
||||
|
||||
FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
|
||||
will be enabled or disabled.
|
||||
This parameter can be set either to ENABLE or DISABLE */
|
||||
} NVIC_InitTypeDef;
|
||||
|
||||
|
||||
|
||||
#define NVIC_VectTab_RAM ((uint32_t)0x20000000)
|
||||
#define NVIC_VectTab_FLASH ((uint32_t)0x01000000)
|
||||
#define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
|
||||
((VECTTAB) == NVIC_VectTab_FLASH))
|
||||
|
||||
|
||||
#define NVIC_PriorityGroup_0 ((uint32_t)0x07) /*!< 0 bits for pre-emption priority
|
||||
3 bits for subpriority */
|
||||
#define NVIC_PriorityGroup_1 ((uint32_t)0x06) /*!< 1 bits for pre-emption priority
|
||||
2 bits for subpriority */
|
||||
#define NVIC_PriorityGroup_2 ((uint32_t)0x05) /*!< 2 bits for pre-emption priority
|
||||
1 bits for subpriority */
|
||||
#define NVIC_PriorityGroup_3 ((uint32_t)0x04) /*!< 3 bits for pre-emption priority
|
||||
0 bits for subpriority */
|
||||
|
||||
#define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
|
||||
((GROUP) == NVIC_PriorityGroup_1) || \
|
||||
((GROUP) == NVIC_PriorityGroup_2) || \
|
||||
((GROUP) == NVIC_PriorityGroup_3))
|
||||
|
||||
#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
|
||||
|
||||
#define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
|
||||
|
||||
#define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
|
||||
|
||||
|
||||
/** @defgroup MISC_SysTick_clock_source
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
|
||||
#define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
|
||||
#define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
|
||||
((SOURCE) == SysTick_CLKSource_HCLK_Div8))
|
||||
|
||||
|
||||
//void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
|
||||
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
|
||||
void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
|
||||
void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MISC_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/******************* (C) COPYRIGHT MEGAHUNT *****END OF FILE****/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2019-08-23 balanceTWK first version
|
||||
*/
|
||||
|
||||
#ifndef __PULSE_ENCODER_CONFIG_H__
|
||||
#define __PULSE_ENCODER_CONFIG_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_PULSE_ENCODER1
|
||||
#ifndef PULSE_ENCODER1_CONFIG
|
||||
#define PULSE_ENCODER1_CONFIG \
|
||||
{ \
|
||||
.tim_handler.Instance = TIM1, \
|
||||
.encoder_irqn = TIM1_UP_TIM10_IRQn, \
|
||||
.name = "pulse1" \
|
||||
}
|
||||
#endif /* PULSE_ENCODER1_CONFIG */
|
||||
#endif /* BSP_USING_PULSE_ENCODER1 */
|
||||
|
||||
#ifdef BSP_USING_PULSE_ENCODER2
|
||||
#ifndef PULSE_ENCODER2_CONFIG
|
||||
#define PULSE_ENCODER2_CONFIG \
|
||||
{ \
|
||||
.tim_handler.Instance = TIM2, \
|
||||
.encoder_irqn = TIM2_IRQn, \
|
||||
.name = "pulse2" \
|
||||
}
|
||||
#endif /* PULSE_ENCODER2_CONFIG */
|
||||
#endif /* BSP_USING_PULSE_ENCODER2 */
|
||||
|
||||
#ifdef BSP_USING_PULSE_ENCODER3
|
||||
#ifndef PULSE_ENCODER3_CONFIG
|
||||
#define PULSE_ENCODER3_CONFIG \
|
||||
{ \
|
||||
.tim_handler.Instance = TIM3, \
|
||||
.encoder_irqn = TIM3_IRQn, \
|
||||
.name = "pulse3" \
|
||||
}
|
||||
#endif /* PULSE_ENCODER3_CONFIG */
|
||||
#endif /* BSP_USING_PULSE_ENCODER3 */
|
||||
|
||||
#ifdef BSP_USING_PULSE_ENCODER4
|
||||
#ifndef PULSE_ENCODER4_CONFIG
|
||||
#define PULSE_ENCODER4_CONFIG \
|
||||
{ \
|
||||
.tim_handler.Instance = TIM4, \
|
||||
.encoder_irqn = TIM4_IRQn, \
|
||||
.name = "pulse4" \
|
||||
}
|
||||
#endif /* PULSE_ENCODER4_CONFIG */
|
||||
#endif /* BSP_USING_PULSE_ENCODER4 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PULSE_ENCODER_CONFIG_H__ */
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __RESOURCE_MAP_H__
|
||||
#define __RESOURCE_MAP_H__
|
||||
#include "io_map.h"
|
||||
#define CORE_TICK_TIM 7
|
||||
#define CORE_TICK_IRQ TIM0_7_IRQn
|
||||
#define CORE_TICK_1US (48)
|
||||
#define CORE_TICK_1MS (48000)
|
||||
#define CORE_TICK_1S (48000000)
|
||||
#define CORE_TICK_IRQ_LEVEL 1
|
||||
#define HWTIMER_IRQ_LEVEL 0
|
||||
|
||||
#define SYS_TIMER_TIM 6
|
||||
#define SYS_TIMER_IRQ TIM0_6_IRQn
|
||||
#define SYS_TIMER_1US (48)
|
||||
#define SYS_TIMER_1MS (48000)
|
||||
#define SYS_TIMER_1S (48000000)
|
||||
#define SYS_TIMER_IRQ_LEVEL 6
|
||||
|
||||
#define DBG_UART_ID UART_ID0
|
||||
#define DBG_UART_BR 1500000
|
||||
#define BL_UART_BR 3000000
|
||||
#define DBG_UART_IRQ_LEVEL 6
|
||||
#define DBG_UART_TX_DMA_STREAM DMA1_STREAM_2
|
||||
#define DBG_UART_RX_DMA_STREAM DMA1_STREAM_2
|
||||
#define DBG_UART_TX_DMA_CHANNEL SYSCTRL_PHER_CTRL_DMA_CHx_IF_UART0_TX
|
||||
#define DBG_UART_RX_DMA_CHANNEL SYSCTRL_PHER_CTRL_DMA_CHx_IF_UART0_RX
|
||||
|
||||
#define EFLASH_QSPI_TX_DMA_STREAM DMA1_STREAM_1
|
||||
#define DAC_TX_DMA_STREAM DMA1_STREAM_0
|
||||
#define DCMI_RX_DMA_STREAM DMA1_STREAM_3
|
||||
#define FLASH_SPI_TX_DMA_STREAM DMA1_STREAM_4
|
||||
#define FLASH_SPI_RX_DMA_STREAM DMA1_STREAM_5
|
||||
#define LCD_SPI_TX_DMA_STREAM DMA1_STREAM_6
|
||||
#define LCD_SPI_RX_DMA_STREAM DMA1_STREAM_7
|
||||
|
||||
#define LUATOS_TASK_PRO (configMAX_PRIORITIES - 2)
|
||||
#define HW_TASK_PRO (configMAX_PRIORITIES - 1)
|
||||
#define SERVICE_TASK_PRO (configMAX_PRIORITIES - 4)
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2022 OpenLuat & AirM2M
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __SYSTEM_AIR105_H_ /* ToDo: replace '<Device>' with your device name */
|
||||
#define __SYSTEM_AIR105_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "air105.h"
|
||||
#define assert_param(x)
|
||||
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the system
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Setup the microcontroller system.
|
||||
* Initialize the System and update the SystemCoreClock variable.
|
||||
*/
|
||||
extern void SystemInit (void);
|
||||
|
||||
/**
|
||||
* Update SystemCoreClock variable
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Updates the SystemCoreClock with current core Clock
|
||||
* retrieved from cpu registers.
|
||||
*/
|
||||
extern void SystemCoreClockUpdate (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSTEM_<Device>_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user