mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-03-04 01:35:26 +08:00
Merge branch 'master' into comp
This commit is contained in:
commit
247df39bfe
@ -68,6 +68,8 @@ ab32vg1-prougen 是 中科蓝讯(Bluetrum) 推出的一款基于 RISC-V 内核
|
||||
|
||||
本 BSP 为开发者提供 GCC 开发环境。下面介绍如何将系统运行起来。
|
||||
|
||||
教学视频:https://www.bilibili.com/video/BV1RV411v75P/
|
||||
|
||||
#### 硬件连接
|
||||
|
||||
使用数据线连接开发板到 PC,打开电源开关。
|
||||
@ -94,13 +96,12 @@ msh >
|
||||
此 BSP 默认只开启了 GPIO 和 串口0 的功能,如果需使用 SD 卡、Flash 等更多高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下:
|
||||
|
||||
1. 在 bsp 下打开 env 工具。
|
||||
|
||||
2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
|
||||
|
||||
3. 输入`pkgs --update`命令更新软件包。
|
||||
|
||||
4. 输入`scons` 命令重新编译工程。
|
||||
|
||||
更多细节请参见使用指南:https://ab32vg1-example.readthedocs.io/zh/latest/introduction.html
|
||||
|
||||
## 注意事项
|
||||
|
||||
波特率默认为 1.5M,需要使用 [Downloader](https://github.com/BLUETRUM/Downloader) 下载 `.dcf` 到芯片,需要编译后自动下载,需要在 `Downloader` 中的下载的下拉窗中选择 `自动`;目前暂时屏蔽 uart1 打印
|
||||
|
@ -12,7 +12,13 @@
|
||||
#define BOARD_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "ab32vgx.h"
|
||||
#include "drv_gpio.h"
|
||||
#include <ab32vgx.h>
|
||||
#ifdef RT_USING_PIN
|
||||
#include <drv_gpio.h>
|
||||
#endif
|
||||
#ifdef RT_USING_WDT
|
||||
#include <drv_wdt.h>
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -15,4 +15,6 @@
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#define GET_PIN(PORTx,PIN) (uint8_t)__AB32_GET_PIN_##PORTx(PIN)
|
||||
|
||||
#endif // DRV_COMMON_H__
|
||||
|
@ -15,6 +15,10 @@
|
||||
#include "board.h"
|
||||
|
||||
#define __AB32_PORT(port) GPIO##port
|
||||
#define __AB32_GET_PIN_A(PIN) PIN
|
||||
#define __AB32_GET_PIN_B(PIN) 8 + PIN
|
||||
#define __AB32_GET_PIN_E(PIN) 13 + PIN
|
||||
#define __AB32_GET_PIN_F(PIN) 21 + PIN
|
||||
|
||||
int rt_hw_pin_init(void);
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
#ifdef RT_USING_WDT
|
||||
|
||||
#include <drv_wdt.h>
|
||||
|
||||
// #define DRV_DEBUG
|
||||
#define LOG_TAG "drv.wdt"
|
||||
#include <drv_log.h>
|
||||
@ -49,35 +51,35 @@ static rt_err_t wdt_control(rt_watchdog_t *wdt, int cmd, void *arg)
|
||||
|
||||
switch (*((rt_uint32_t *)arg))
|
||||
{
|
||||
case 0:
|
||||
case AB32_WDT_TIMEOUT_1MS:
|
||||
LOG_I("The watchdog timeout is set to 1ms");
|
||||
tmp |= (0xa << 24) | (0x00 << 20);
|
||||
break;
|
||||
case 1:
|
||||
case AB32_WDT_TIMEOUT_256MS:
|
||||
LOG_I("The watchdog timeout is set to 256ms");
|
||||
tmp |= (0xa << 24) | (0x01 << 20);
|
||||
break;
|
||||
case 2:
|
||||
case AB32_WDT_TIMEOUT_512MS:
|
||||
LOG_I("The watchdog timeout is set to 512ms");
|
||||
tmp |= (0xa << 24) | (0x02 << 20);
|
||||
break;
|
||||
case 3:
|
||||
case AB32_WDT_TIMEOUT_1024MS:
|
||||
LOG_I("The watchdog timeout is set to 1024ms");
|
||||
tmp |= (0xa << 24) | (0x03 << 20);
|
||||
break;
|
||||
case 4:
|
||||
case AB32_WDT_TIMEOUT_2048MS:
|
||||
LOG_I("The watchdog timeout is set to 2048ms");
|
||||
tmp |= (0xa << 24) | (0x04 << 20);
|
||||
break;
|
||||
case 5:
|
||||
case AB32_WDT_TIMEOUT_4096MS:
|
||||
LOG_I("The watchdog timeout is set to 4096ms");
|
||||
tmp |= (0xa << 24) | (0x05 << 20);
|
||||
break;
|
||||
case 6:
|
||||
case AB32_WDT_TIMEOUT_8192MS:
|
||||
LOG_I("The watchdog timeout is set to 8192ms");
|
||||
tmp |= (0xa << 24) | (0x06 << 20);
|
||||
break;
|
||||
case 7:
|
||||
case AB32_WDT_TIMEOUT_16384MS:
|
||||
LOG_I("The watchdog timeout is set to 16384ms");
|
||||
tmp |= (0xa << 24) | (0x07 << 20);
|
||||
break;
|
||||
@ -92,28 +94,28 @@ static rt_err_t wdt_control(rt_watchdog_t *wdt, int cmd, void *arg)
|
||||
case RT_DEVICE_CTRL_WDT_GET_TIMEOUT:
|
||||
switch ((WDTCON >> 20) & 0x7)
|
||||
{
|
||||
case 0:
|
||||
case AB32_WDT_TIMEOUT_1MS:
|
||||
LOG_D("The watchdog timeout is set to 1ms");
|
||||
break;
|
||||
case 1:
|
||||
case AB32_WDT_TIMEOUT_256MS:
|
||||
LOG_D("The watchdog timeout is set to 256ms");
|
||||
break;
|
||||
case 2:
|
||||
case AB32_WDT_TIMEOUT_512MS:
|
||||
LOG_D("The watchdog timeout is set to 512ms");
|
||||
break;
|
||||
case 3:
|
||||
case AB32_WDT_TIMEOUT_1024MS:
|
||||
LOG_D("The watchdog timeout is set to 1024ms");
|
||||
break;
|
||||
case 4:
|
||||
case AB32_WDT_TIMEOUT_2048MS:
|
||||
LOG_D("The watchdog timeout is set to 2048ms");
|
||||
break;
|
||||
case 5:
|
||||
case AB32_WDT_TIMEOUT_4096MS:
|
||||
LOG_D("The watchdog timeout is set to 4096ms");
|
||||
break;
|
||||
case 6:
|
||||
case AB32_WDT_TIMEOUT_8192MS:
|
||||
LOG_D("The watchdog timeout is set to 8192ms");
|
||||
break;
|
||||
case 7:
|
||||
case AB32_WDT_TIMEOUT_16384MS:
|
||||
LOG_D("The watchdog timeout is set to 16384ms");
|
||||
break;
|
||||
default:
|
||||
|
23
bsp/bluetrum/libraries/hal_drivers/drv_wdt.h
Normal file
23
bsp/bluetrum/libraries/hal_drivers/drv_wdt.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021, Bluetrum Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-03-11 Meco Man first version
|
||||
*/
|
||||
|
||||
#ifndef DRV_WDT_H__
|
||||
#define DRV_WDT_H__
|
||||
|
||||
#define AB32_WDT_TIMEOUT_1MS 0
|
||||
#define AB32_WDT_TIMEOUT_256MS 1
|
||||
#define AB32_WDT_TIMEOUT_512MS 2
|
||||
#define AB32_WDT_TIMEOUT_1024MS 3
|
||||
#define AB32_WDT_TIMEOUT_2048MS 4
|
||||
#define AB32_WDT_TIMEOUT_4096MS 5
|
||||
#define AB32_WDT_TIMEOUT_8192MS 6
|
||||
#define AB32_WDT_TIMEOUT_16384MS 7
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2019, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@ -15,7 +15,7 @@
|
||||
#if !defined(BSP_USING_UART0) && !defined(BSP_USING_UART1) && !defined(BSP_USING_UART2) \
|
||||
&& !defined(BSP_USING_UART3) && !defined(BSP_USING_UART4) && !defined(BSP_USING_UART5)
|
||||
#error "Please define at least one BSP_USING_UARTx"
|
||||
/* this driver can be disabled at menuconfig ¡ú RT-Thread Components ¡ú Device Drivers */
|
||||
/* this driver can be disabled at menuconfig → RT-Thread Components → Device Drivers */
|
||||
#endif
|
||||
|
||||
struct gd32_usart {
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Nuvoton BSP descriptions
|
||||
ï»? Nuvoton BSP descriptions
|
||||
Current supported BSP shown in below table:
|
||||
|
||||
| **BSP folder** | **Board name** |
|
||||
@ -7,3 +7,4 @@ Current supported BSP shown in below table:
|
||||
| [numaker-pfm-m487](numaker-pfm-m487) | Nuvoton NuMaker-PFM-M487 |
|
||||
| [nk-980iot](nk-980iot) | Nuvoton NK-980IOT |
|
||||
| [numaker-m2354](numaker-m2354) | Nuvoton NuMaker-M2354 |
|
||||
| [nk-rtu980](nk-rtu980) | Nuvoton NK-RTU980 |
|
@ -9,6 +9,7 @@
|
||||
#ifndef __NUMICRO_H__
|
||||
#define __NUMICRO_H__
|
||||
|
||||
#include "nutool_clkcfg.h"
|
||||
#include "M2354.h"
|
||||
|
||||
#endif /* __NUMICRO_H__ */
|
||||
|
@ -49,11 +49,21 @@ extern "C" {
|
||||
/*----------------------------------------------------------------------------
|
||||
Define SYSCLK
|
||||
*----------------------------------------------------------------------------*/
|
||||
#ifndef __HXT
|
||||
#define __HXT (12000000UL) /*!< External Crystal Clock Frequency */
|
||||
#endif
|
||||
|
||||
#define __LIRC (32000UL) /*!< Internal 32K RC Oscillator Frequency */
|
||||
#define __HIRC (12000000UL) /*!< Internal 12M RC Oscillator Frequency */
|
||||
|
||||
#ifndef __LXT
|
||||
#define __LXT (32768UL) /*!< External Crystal Clock Frequency 32.768KHz */
|
||||
#endif
|
||||
|
||||
#ifndef __HSI
|
||||
#define __HSI (48000000UL) /*!< PLL Output Clock Frequency */
|
||||
#endif
|
||||
|
||||
#define __HIRC48 (48000000UL) /*!< Internal 48M RC Oscillator Frequency */
|
||||
#define __LIRC32 (32000UL) /*!< Internal 32K RC Oscillator Frequency */
|
||||
#define __MIRC (4000000UL) /*!< Internal 4M RC Oscillator Frequency */
|
||||
@ -93,7 +103,7 @@ extern uint32_t __PC(void); /*!< Return the current program counter valu
|
||||
*/
|
||||
#define ASSERT_PARAM(expr) { if (!(expr)) { AssertError((uint8_t*)__FILE__, __LINE__); } }
|
||||
|
||||
void AssertError(uint8_t* file, uint32_t line);
|
||||
void AssertError(uint8_t *file, uint32_t line);
|
||||
#else
|
||||
#define ASSERT_PARAM(expr)
|
||||
#endif
|
||||
|
@ -348,6 +348,7 @@
|
||||
<state>$PROJ_DIR$\..\..\Device\Nuvoton\M2354\Include</state>
|
||||
<state>$PROJ_DIR$\..\..\CMSIS\Include</state>
|
||||
<state>$PROJ_DIR$\..\inc</state>
|
||||
<state>$PROJ_DIR$</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CCStdIncCheck</name>
|
||||
@ -1385,6 +1386,7 @@
|
||||
<state>$PROJ_DIR$\..\..\Device\Nuvoton\M2354\Include</state>
|
||||
<state>$PROJ_DIR$\..\..\CMSIS\Include</state>
|
||||
<state>$PROJ_DIR$\..\inc</state>
|
||||
<state>$PROJ_DIR$</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CCStdIncCheck</name>
|
||||
|
@ -338,7 +338,7 @@
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\inc;..\..\CMSIS\Include;..\..\Device\Nuvoton\M2354\Include</IncludePath>
|
||||
<IncludePath>..\inc;..\..\CMSIS\Include;..\..\Device\Nuvoton\M2354\Include;.</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
|
@ -14,7 +14,7 @@
|
||||
#if defined(BSP_USING_BPWM_CAPTURE)
|
||||
#if ((BSP_USING_BPWM0_CAPTURE_CHMSK+BSP_USING_BPWM1_CAPTURE_CHMSK)!=0)
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private typedef --------------------------------------------------------------*/
|
||||
typedef struct _bpwm_dev
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private Define ---------------------------------------------------------------*/
|
||||
#define RX_MSG_ID_INDEX 16
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <rtdbg.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <rtthread.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <nu_bitutil.h>
|
||||
#include "drv_uart.h"
|
||||
#include "board.h"
|
||||
@ -24,7 +24,7 @@
|
||||
/**
|
||||
* This function will initial M487 board.
|
||||
*/
|
||||
void rt_hw_board_init(void)
|
||||
RT_WEAK void rt_hw_board_init(void)
|
||||
{
|
||||
/* Init System/modules clock */
|
||||
nutool_modclkcfg_init();
|
||||
@ -67,6 +67,41 @@ void rt_hw_board_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* The time delay function.
|
||||
*
|
||||
* @param microseconds.
|
||||
*/
|
||||
void rt_hw_us_delay(rt_uint32_t us)
|
||||
{
|
||||
rt_uint32_t ticks;
|
||||
rt_uint32_t told, tnow, tcnt = 0;
|
||||
rt_uint32_t reload = SysTick->LOAD;
|
||||
|
||||
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
|
||||
told = SysTick->VAL;
|
||||
while (1)
|
||||
{
|
||||
tnow = SysTick->VAL;
|
||||
if (tnow != told)
|
||||
{
|
||||
if (tnow < told)
|
||||
{
|
||||
tcnt += told - tnow;
|
||||
}
|
||||
else
|
||||
{
|
||||
tcnt += reload - tnow + told;
|
||||
}
|
||||
told = tnow;
|
||||
if (tcnt >= ticks)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the timer interrupt service routine.
|
||||
*
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#ifdef BSP_USING_EADC
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define __DRV_EBI_H___
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize EBI for specify Bank
|
||||
|
@ -14,7 +14,7 @@
|
||||
#if defined(BSP_USING_ECAP)
|
||||
#if ((BSP_USING_ECAP0_CHMSK+BSP_USING_ECAP1_CHMSK)!=0)
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#define ECAP_CH0_POS (0)
|
||||
#define ECAP_CH1_POS (1)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#if defined(BSP_USING_EPWM_CAPTURE)
|
||||
#if ((BSP_USING_EPWM0_CAPTURE_CHMSK+BSP_USING_EPWM1_CAPTURE_CHMSK)!=0)
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#define EPWM_CH0CH1_POS (0)
|
||||
#define EPWM_CH2CH3_POS (2)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define __DRV_FMC_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
int nu_fmc_read(long offset, uint8_t *buf, size_t size);
|
||||
int nu_fmc_write(long offset, const uint8_t *buf, size_t size);
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <nu_bitutil.h>
|
||||
#include <drv_gpio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#ifdef BSP_USING_I2C
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
#define LOG_TAG "drv.i2c"
|
||||
|
@ -220,7 +220,8 @@ static rt_err_t nu_i2s_dai_setup(nu_i2s_t psNuI2s, struct rt_audio_configure *pc
|
||||
}
|
||||
|
||||
/* Set MCLK and enable MCLK */
|
||||
I2S_EnableMCLK(psNuI2s->i2s_base, __HXT);
|
||||
/* The target MCLK is related to audio codec setting. */
|
||||
I2S_EnableMCLK(psNuI2s->i2s_base, 12000000);
|
||||
|
||||
/* Set unmute */
|
||||
if (pNuACodecOps->nu_acodec_mixer_control)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define __DRV_I2S_H__
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_pdma.h>
|
||||
|
||||
#if !defined(NU_I2S_DMA_FIFO_SIZE)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#if defined(BSP_USING_OTG)
|
||||
#include <rtdevice.h>
|
||||
#include <rtdbg.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* This delay must be at least 10 us */
|
||||
static void _usb_init_delay(void)
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <rtthread.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#ifndef NU_PDMA_SGTBL_POOL_SIZE
|
||||
#define NU_PDMA_SGTBL_POOL_SIZE (16)
|
||||
|
@ -14,7 +14,8 @@
|
||||
#if defined (BSP_USING_RTC)
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include <sys/time.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
|
||||
@ -184,8 +185,8 @@ static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
|
||||
|
||||
if (!initialised)
|
||||
{
|
||||
t_upper = mktime((struct tm *)&tm_upper);
|
||||
t_lower = mktime((struct tm *)&tm_lower);
|
||||
t_upper = timegm((struct tm *)&tm_upper);
|
||||
t_lower = timegm((struct tm *)&tm_lower);
|
||||
initialised = RT_TRUE;
|
||||
}
|
||||
|
||||
@ -226,13 +227,13 @@ static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args)
|
||||
tm_out.tm_hour = hw_time.u32Hour;
|
||||
tm_out.tm_min = hw_time.u32Minute;
|
||||
tm_out.tm_sec = hw_time.u32Second;
|
||||
*time = mktime(&tm_out);
|
||||
*time = timegm(&tm_out);
|
||||
break;
|
||||
|
||||
case RT_DEVICE_CTRL_RTC_SET_TIME:
|
||||
|
||||
time = (time_t *) args;
|
||||
tm_in = localtime(time);
|
||||
tm_in = gmtime(time);
|
||||
|
||||
if (nu_rtc_is_date_valid(time) != RT_EOK)
|
||||
return RT_ERROR;
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#if defined(BSP_USING_SCUART)
|
||||
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#if defined(BSP_USING_SDH)
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_pdma.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_slcd.h>
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define __DRV_SLCD_H__
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
struct nu_slcd_pixel
|
||||
{
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
#define LOG_TAG "drv.softi2c"
|
||||
@ -65,7 +65,6 @@ struct nu_soft_i2c
|
||||
};
|
||||
|
||||
/* Private functions ------------------------------------------------------------*/
|
||||
static void nu_soft_i2c_udelay(rt_uint32_t us);
|
||||
static void nu_soft_i2c_set_sda(void *data, rt_int32_t state);
|
||||
static void nu_soft_i2c_set_scl(void *data, rt_int32_t state);
|
||||
static rt_int32_t nu_soft_i2c_get_sda(void *data);
|
||||
@ -91,48 +90,13 @@ static const struct rt_i2c_bit_ops nu_soft_i2c_bit_ops =
|
||||
.set_scl = nu_soft_i2c_set_scl,
|
||||
.get_sda = nu_soft_i2c_get_sda,
|
||||
.get_scl = nu_soft_i2c_get_scl,
|
||||
.udelay = nu_soft_i2c_udelay,
|
||||
.udelay = rt_hw_us_delay,
|
||||
.delay_us = 1,
|
||||
.timeout = 100
|
||||
};
|
||||
|
||||
/* Functions define ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The time delay function.
|
||||
*
|
||||
* @param microseconds.
|
||||
*/
|
||||
static void nu_soft_i2c_udelay(rt_uint32_t us)
|
||||
{
|
||||
rt_uint32_t ticks;
|
||||
rt_uint32_t told, tnow, tcnt = 0;
|
||||
rt_uint32_t reload = SysTick->LOAD;
|
||||
|
||||
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
|
||||
told = SysTick->VAL;
|
||||
while (1)
|
||||
{
|
||||
tnow = SysTick->VAL;
|
||||
if (tnow != told)
|
||||
{
|
||||
if (tnow < told)
|
||||
{
|
||||
tcnt += told - tnow;
|
||||
}
|
||||
else
|
||||
{
|
||||
tcnt += reload - tnow + told;
|
||||
}
|
||||
told = tnow;
|
||||
if (tcnt >= ticks)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function initializes the soft i2c pin.
|
||||
*
|
||||
@ -163,9 +127,9 @@ static rt_err_t nu_soft_i2c_bus_unlock(const struct nu_soft_i2c_config *cfg)
|
||||
while (i++ < 9)
|
||||
{
|
||||
rt_pin_write(cfg->scl, PIN_HIGH);
|
||||
nu_soft_i2c_udelay(100);
|
||||
rt_hw_us_delay(100);
|
||||
rt_pin_write(cfg->scl, PIN_LOW);
|
||||
nu_soft_i2c_udelay(100);
|
||||
rt_hw_us_delay(100);
|
||||
}
|
||||
}
|
||||
if (PIN_LOW == rt_pin_read(cfg->sda))
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <rtconfig.h>
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <nu_bitutil.h>
|
||||
|
||||
#if defined(BSP_USING_SPI_PDMA)
|
||||
|
@ -282,7 +282,8 @@ static rt_err_t nu_spii2s_dai_setup(nu_i2s_t psNuSPII2s, struct rt_audio_configu
|
||||
LOG_I("Open SPII2S.");
|
||||
|
||||
/* Set MCLK and enable MCLK */
|
||||
SPII2S_EnableMCLK(spii2s_base, __HXT);
|
||||
/* The target MCLK is related to audio codec setting. */
|
||||
SPII2S_EnableMCLK(spii2s_base, 12000000);
|
||||
|
||||
/* Set un-mute */
|
||||
if (pNuACodecOps->nu_acodec_mixer_control)
|
||||
|
@ -15,7 +15,7 @@
|
||||
#if (defined(BSP_USING_TIMER) && defined(RT_USING_HWTIMER))
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
#define NU_TIMER_DEVICE(timer) (nu_timer_t *)(timer)
|
||||
|
@ -21,7 +21,7 @@
|
||||
defined(BSP_USING_TIMER5_CAPTURE)
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private typedef --------------------------------------------------------------*/
|
||||
typedef struct _timer
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_uart.h>
|
||||
|
||||
#if defined(RT_SERIAL_USING_DMA)
|
||||
|
@ -15,7 +15,7 @@
|
||||
#if (defined(BSP_USING_UI2C) && defined(RT_USING_I2C))
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
#define LOG_TAG "drv.ui2c"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#include "usb.h"
|
||||
#include "usbh_lib.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <rtdevice.h>
|
||||
#include <rtdef.h>
|
||||
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <nu_bitutil.h>
|
||||
|
||||
#if defined(BSP_USING_USPI_PDMA)
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#if defined(RT_SERIAL_USING_DMA)
|
||||
#include <drv_pdma.h>
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
#include <rtdbg.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/*-------------------------------------------------------------------------------*/
|
||||
/* watchdog timer timeout look up table */
|
||||
|
@ -14,7 +14,7 @@
|
||||
#if defined(BSP_USING_BPWM_CAPTURE)
|
||||
#if ((BSP_USING_BPWM0_CAPTURE_CHMSK+BSP_USING_BPWM1_CAPTURE_CHMSK)!=0)
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private typedef --------------------------------------------------------------*/
|
||||
typedef struct _bpwm_dev
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private Define ---------------------------------------------------------------*/
|
||||
#define RX_MSG_ID_INDEX 16
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <rtdbg.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <rtthread.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include "drv_uart.h"
|
||||
#include "board.h"
|
||||
#include "nutool_pincfg.h"
|
||||
@ -20,9 +20,9 @@
|
||||
|
||||
|
||||
/**
|
||||
* This function will initial M487 board.
|
||||
* This function will initial.
|
||||
*/
|
||||
void rt_hw_board_init(void)
|
||||
RT_WEAK void rt_hw_board_init(void)
|
||||
{
|
||||
/* Init System/modules clock */
|
||||
nutool_modclkcfg_init();
|
||||
@ -67,6 +67,41 @@ void rt_hw_board_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* The time delay function.
|
||||
*
|
||||
* @param microseconds.
|
||||
*/
|
||||
void rt_hw_us_delay(rt_uint32_t us)
|
||||
{
|
||||
rt_uint32_t ticks;
|
||||
rt_uint32_t told, tnow, tcnt = 0;
|
||||
rt_uint32_t reload = SysTick->LOAD;
|
||||
|
||||
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
|
||||
told = SysTick->VAL;
|
||||
while (1)
|
||||
{
|
||||
tnow = SysTick->VAL;
|
||||
if (tnow != told)
|
||||
{
|
||||
if (tnow < told)
|
||||
{
|
||||
tcnt += told - tnow;
|
||||
}
|
||||
else
|
||||
{
|
||||
tcnt += reload - tnow + told;
|
||||
}
|
||||
told = tnow;
|
||||
if (tcnt >= ticks)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the timer interrupt service routine.
|
||||
*
|
||||
@ -89,7 +124,7 @@ void rt_hw_cpu_reset(void)
|
||||
SYS->IPRST0 |= SYS_IPRST0_CHIPRST_Msk;
|
||||
}
|
||||
|
||||
int reboot(int argc, char** argv)
|
||||
int reboot(int argc, char **argv)
|
||||
{
|
||||
rt_hw_cpu_reset();
|
||||
return 0;
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#ifdef BSP_USING_EADC
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define __DRV_EBI_H___
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize EBI for specify Bank
|
||||
|
@ -14,7 +14,7 @@
|
||||
#if defined(BSP_USING_ECAP)
|
||||
#if ((BSP_USING_ECAP0_CHMSK+BSP_USING_ECAP1_CHMSK)!=0)
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#define ECAP_CH0_POS (0)
|
||||
#define ECAP_CH1_POS (1)
|
||||
|
@ -17,7 +17,7 @@
|
||||
#if defined(RT_USING_LWIP)
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <netif/ethernetif.h>
|
||||
#include <netif/etharp.h>
|
||||
#include <lwip/icmp.h>
|
||||
|
@ -14,7 +14,7 @@
|
||||
#if defined(BSP_USING_EPWM_CAPTURE)
|
||||
#if ((BSP_USING_EPWM0_CAPTURE_CHMSK+BSP_USING_EPWM1_CAPTURE_CHMSK)!=0)
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#define EPWM_CH0CH1_POS (0)
|
||||
#define EPWM_CH2CH3_POS (2)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define __DRV_FMC_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
int nu_fmc_read(long offset, uint8_t *buf, size_t size);
|
||||
int nu_fmc_write(long offset, const uint8_t *buf, size_t size);
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <nu_bitutil.h>
|
||||
#include <drv_gpio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -14,7 +14,7 @@
|
||||
#if defined(BSP_USING_HSOTG)
|
||||
#include <rtdevice.h>
|
||||
#include <rtdbg.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
|
||||
/* This delay must be at least 10 us */
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#ifdef BSP_USING_I2C
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
#define LOG_TAG "drv.i2c"
|
||||
|
@ -220,7 +220,8 @@ static rt_err_t nu_i2s_dai_setup(nu_i2s_t psNuI2s, struct rt_audio_configure *pc
|
||||
}
|
||||
|
||||
/* Set MCLK and enable MCLK */
|
||||
I2S_EnableMCLK(psNuI2s->i2s_base, __HXT);
|
||||
/* The target MCLK is related to audio codec setting. */
|
||||
I2S_EnableMCLK(psNuI2s->i2s_base, 12000000);
|
||||
|
||||
/* Set unmute */
|
||||
if (pNuACodecOps->nu_acodec_mixer_control)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define __DRV_I2S_H__
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_pdma.h>
|
||||
|
||||
#if !defined(NU_I2S_DMA_FIFO_SIZE)
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <rtthread.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#ifndef NU_PDMA_SGTBL_POOL_SIZE
|
||||
#define NU_PDMA_SGTBL_POOL_SIZE (16)
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <sys/time.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#if defined(BSP_USING_SCUART)
|
||||
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#if defined(BSP_USING_SDH)
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_pdma.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
#define LOG_TAG "drv.softi2c"
|
||||
@ -65,7 +65,6 @@ struct nu_soft_i2c
|
||||
};
|
||||
|
||||
/* Private functions ------------------------------------------------------------*/
|
||||
static void nu_soft_i2c_udelay(rt_uint32_t us);
|
||||
static void nu_soft_i2c_set_sda(void *data, rt_int32_t state);
|
||||
static void nu_soft_i2c_set_scl(void *data, rt_int32_t state);
|
||||
static rt_int32_t nu_soft_i2c_get_sda(void *data);
|
||||
@ -91,48 +90,13 @@ static const struct rt_i2c_bit_ops nu_soft_i2c_bit_ops =
|
||||
.set_scl = nu_soft_i2c_set_scl,
|
||||
.get_sda = nu_soft_i2c_get_sda,
|
||||
.get_scl = nu_soft_i2c_get_scl,
|
||||
.udelay = nu_soft_i2c_udelay,
|
||||
.udelay = rt_hw_us_delay,
|
||||
.delay_us = 1,
|
||||
.timeout = 100
|
||||
};
|
||||
|
||||
/* Functions define ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The time delay function.
|
||||
*
|
||||
* @param microseconds.
|
||||
*/
|
||||
static void nu_soft_i2c_udelay(rt_uint32_t us)
|
||||
{
|
||||
rt_uint32_t ticks;
|
||||
rt_uint32_t told, tnow, tcnt = 0;
|
||||
rt_uint32_t reload = SysTick->LOAD;
|
||||
|
||||
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
|
||||
told = SysTick->VAL;
|
||||
while (1)
|
||||
{
|
||||
tnow = SysTick->VAL;
|
||||
if (tnow != told)
|
||||
{
|
||||
if (tnow < told)
|
||||
{
|
||||
tcnt += told - tnow;
|
||||
}
|
||||
else
|
||||
{
|
||||
tcnt += reload - tnow + told;
|
||||
}
|
||||
told = tnow;
|
||||
if (tcnt >= ticks)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function initializes the soft i2c pin.
|
||||
*
|
||||
@ -163,9 +127,9 @@ static rt_err_t nu_soft_i2c_bus_unlock(const struct nu_soft_i2c_config *cfg)
|
||||
while (i++ < 9)
|
||||
{
|
||||
rt_pin_write(cfg->scl, PIN_HIGH);
|
||||
nu_soft_i2c_udelay(100);
|
||||
rt_hw_us_delay(100);
|
||||
rt_pin_write(cfg->scl, PIN_LOW);
|
||||
nu_soft_i2c_udelay(100);
|
||||
rt_hw_us_delay(100);
|
||||
}
|
||||
}
|
||||
if (PIN_LOW == rt_pin_read(cfg->sda))
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <rtconfig.h>
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <nu_bitutil.h>
|
||||
|
||||
#if defined(BSP_USING_SPI_PDMA)
|
||||
|
@ -282,7 +282,8 @@ static rt_err_t nu_spii2s_dai_setup(nu_i2s_t psNuSPII2s, struct rt_audio_configu
|
||||
LOG_I("Open SPII2S.");
|
||||
|
||||
/* Set MCLK and enable MCLK */
|
||||
SPII2S_EnableMCLK(spii2s_base, __HXT);
|
||||
/* The target MCLK is related to audio codec setting. */
|
||||
SPII2S_EnableMCLK(spii2s_base, 12000000);
|
||||
|
||||
/* Set un-mute */
|
||||
if (pNuACodecOps->nu_acodec_mixer_control)
|
||||
|
@ -15,7 +15,7 @@
|
||||
#if (defined(BSP_USING_TIMER) && defined(RT_USING_HWTIMER))
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
#define NU_TIMER_DEVICE(timer) (nu_timer_t *)(timer)
|
||||
|
@ -19,7 +19,7 @@
|
||||
defined(BSP_USING_TIMER3_CAPTURE)
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private typedef --------------------------------------------------------------*/
|
||||
typedef struct _timer
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_uart.h>
|
||||
|
||||
#if defined(RT_SERIAL_USING_DMA)
|
||||
|
@ -15,7 +15,7 @@
|
||||
#if (defined(BSP_USING_UI2C) && defined(RT_USING_I2C))
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
#define LOG_TAG "drv.ui2c"
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#include "usb.h"
|
||||
#include "usbh_lib.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <rtdevice.h>
|
||||
#include <rtdef.h>
|
||||
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <nu_bitutil.h>
|
||||
|
||||
#if defined(BSP_USING_USPI_PDMA)
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#if defined(RT_SERIAL_USING_DMA)
|
||||
#include <drv_pdma.h>
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
#include <rtdbg.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
/*-------------------------------------------------------------------------------*/
|
||||
/* watchdog timer timeout look up table */
|
||||
|
@ -88,10 +88,10 @@ static int I2C_WriteNAU88L25(uint16_t u16addr, uint16_t u16data)
|
||||
static int I2C_ReadNAU88L25(uint16_t u16addr, uint16_t *pu16data)
|
||||
{
|
||||
struct rt_i2c_msg msgs[2];
|
||||
uint16_t u16data = 0;
|
||||
char au8TxData[2];
|
||||
|
||||
RT_ASSERT(g_I2cBusDev != NULL);
|
||||
RT_ASSERT(pu16data != NULL);
|
||||
|
||||
au8TxData[0] = (uint8_t)((u16addr >> 8) & 0x00FF); //addr [15:8]
|
||||
au8TxData[1] = (uint8_t)(u16addr & 0x00FF); //addr [ 7:0]
|
||||
@ -103,8 +103,8 @@ static int I2C_ReadNAU88L25(uint16_t u16addr, uint16_t *pu16data)
|
||||
|
||||
msgs[1].addr = DEF_NAU88L25_ADDR; /* Slave address */
|
||||
msgs[1].flags = RT_I2C_RD; /* Read flag */
|
||||
msgs[1].buf = (rt_uint8_t *)&u16data; /* Read data pointer */
|
||||
msgs[1].len = sizeof(u16data); /* Number of bytes read */
|
||||
msgs[1].buf = (rt_uint8_t *)pu16data; /* Read data pointer */
|
||||
msgs[1].len = sizeof(uint16_t); /* Number of bytes read */
|
||||
|
||||
if (rt_i2c_transfer(g_I2cBusDev, &msgs[0], 2) != 2)
|
||||
{
|
||||
|
@ -26,6 +26,8 @@
|
||||
static int audio_test(int argc, char **argv)
|
||||
{
|
||||
#define DEF_MAX_ARGV_NUM 8
|
||||
#define DEF_MAX_TEST_SECOND 5
|
||||
|
||||
int smplrate[] = {8000, 16000, 44100, 48000};
|
||||
int smplbit[] = {16};
|
||||
int chnum[] = {1, 2};
|
||||
@ -54,9 +56,9 @@ static int audio_test(int argc, char **argv)
|
||||
info.samplebits = smplbit[j];
|
||||
info.channels = chnum[k];
|
||||
wavrecorder_start(&info);
|
||||
rt_thread_mdelay(10000);
|
||||
rt_thread_mdelay(DEF_MAX_TEST_SECOND * 1000);
|
||||
wavrecorder_stop();
|
||||
rt_thread_mdelay(1000);
|
||||
rt_thread_mdelay(DEF_MAX_TEST_SECOND * 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -68,7 +70,7 @@ static int audio_test(int argc, char **argv)
|
||||
|
||||
rt_kprintf("Replay file at %s\n", strbuf);
|
||||
wavplayer_play(strbuf);
|
||||
rt_thread_mdelay(10000);
|
||||
rt_thread_mdelay(DEF_MAX_TEST_SECOND * 1000);
|
||||
wavplayer_stop();
|
||||
}
|
||||
} // k
|
||||
|
@ -30,21 +30,6 @@ config SOC_SERIES_NUC980
|
||||
select RT_USING_PIN
|
||||
default y
|
||||
|
||||
menuconfig BSP_USING_CLK
|
||||
bool "Enable Clock Controller(CLK)"
|
||||
select RT_USING_PM
|
||||
select BSP_USING_TMR
|
||||
default y
|
||||
help
|
||||
Choose this option if you need CLK/PM function.
|
||||
Notice: Enable the option will hold timer3 resource
|
||||
|
||||
if BSP_USING_CLK
|
||||
config NU_CLK_INVOKE_WKTMR
|
||||
bool "Enable SPD1 and DPD mode wakeup timer. (About 6.6 Secs)"
|
||||
default y
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_EMAC
|
||||
bool "Enable Ethernet MAC Controller(EMAC)"
|
||||
select RT_USING_LWIP
|
||||
|
@ -14,7 +14,7 @@
|
||||
#if defined(BSP_USING_ADC)
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_sys.h>
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_sys.h>
|
||||
|
||||
/* Private Define ---------------------------------------------------------------*/
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define __DRV_EBI_H___
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
|
||||
#define MAX_BANK EBI_BANK2
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#if defined(RT_USING_LWIP)
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <netif/ethernetif.h>
|
||||
#include <netif/etharp.h>
|
||||
#include <lwip/icmp.h>
|
||||
@ -117,7 +117,7 @@ static struct nu_emac nu_emac_arr[] =
|
||||
.name = "e1",
|
||||
.memmgr.psEmac = (EMAC_T *)EMC1_BA,
|
||||
.irqn_tx = IRQ_EMC1_TX,
|
||||
.irqn_rx = IRQ_EMC1_RX
|
||||
.irqn_rx = IRQ_EMC1_RX,
|
||||
.rstidx = EMAC1RST,
|
||||
.clkidx = EMAC1CKEN,
|
||||
},
|
||||
|
@ -15,7 +15,7 @@
|
||||
#if defined(BSP_USING_TIMER) && defined(RT_USING_HWTIMER)
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_sys.h>
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
|
@ -15,7 +15,7 @@
|
||||
#if defined(BSP_USING_TIMER_CAPTURE)
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <drv_sys.h>
|
||||
|
||||
/* Private define ---------------------------------------------------------------*/
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <NuMicro.h>
|
||||
#include "NuMicro.h"
|
||||
#include <nu_bitutil.h>
|
||||
#include <drv_gpio.h>
|
||||
#include <stdlib.h>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user