Skip to content

Commit

Permalink
Merge pull request #1 from Guozhanxin/master
Browse files Browse the repository at this point in the history
first version
  • Loading branch information
eclipsesw authored Oct 31, 2022
2 parents 9c74618 + fe95ae3 commit fcffebb
Show file tree
Hide file tree
Showing 2,041 changed files with 769,629 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
*.pyc
*.map
*.dblite
*.elf
*.bin
*.hex
*.axf
*.exe
*.pdb
*.idb
*.ilk
*.old
*.crf
build
Debug
documentation/html
*~
*.o
*.obj
*.bak
*.dep
*.lib
*.a
*.i
*.d
tools/kconfig-frontends/kconfig-mconf
dist
dist_ide_project
cconfig.h
GPUCache

#cscope files
cscope.*
ncscope.*

#ctag files
tags

.idea
.vscode
.history
CMakeLists.txt
cmake-build-debug
Binary file not shown.
Binary file added documents/RA2L1_datasheet.pdf
Binary file not shown.
Binary file added documents/images/ra2l1-cpk - 副本.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/images/ra2l1-cpk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions libraries/HAL_Drivers/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
config BSP_USING_GPIO
bool "Enable GPIO"
select RT_USING_PIN
default y

config BSP_USING_ONCHIP_FLASH
bool "Enable Onchip FLASH"
default n

config BSP_USING_WDT
bool "Enable Watchdog Timer"
select RT_USING_WDT
default n

menuconfig BSP_USING_ONCHIP_RTC
bool "Enable RTC"
select RT_USING_RTC
default n
if BSP_USING_ONCHIP_RTC
endif
61 changes: 61 additions & 0 deletions libraries/HAL_Drivers/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Import('RTT_ROOT')
Import('rtconfig')
from building import *

cwd = GetCurrentDir()

# add the general drivers.
src = Split("""
drv_common.c
""")

if GetDepend(['BSP_USING_UART']):
if GetDepend(['RT_USING_SERIAL_V2']):
src += ['drv_usart_v2.c']
else:
print("\nThe current project does not support serial-v1\n")
Return('group')

if GetDepend(['BSP_USING_GPIO']):
src += ['drv_gpio.c']

if GetDepend(['BSP_USING_WDT']):
src += ['drv_wdt.c']

if GetDepend(['BSP_USING_ONCHIP_RTC']):
src += ['drv_rtc.c']

if GetDepend(['BSP_USING_I2C', 'RT_USING_I2C_BITOPS']):
if GetDepend('BSP_USING_I2C0') or GetDepend('BSP_USING_I2C1'):
src += ['drv_soft_i2c.c']

if GetDepend(['BSP_USING_I2C', 'BSP_USING_HW_I2C']):
src += ['drv_i2c.c']

if GetDepend(['BSP_USING_SPI']):
src += ['drv_spi.c']

if GetDepend(['BSP_USING_ADC']):
src += ['drv_adc.c']

if GetDepend(['BSP_USING_DAC']):
src += ['drv_dac.c']

if GetDepend(['BSP_USING_ONCHIP_FLASH']):
src += ['drv_flash.c']

if GetDepend(['BSP_USING_PWM']):
src += ['drv_pwm.c']

if GetDepend(['BSP_USING_CAN']):
src += ['drv_can.c']

if GetDepend(['BSP_USING_SDHI']):
src += ['drv_sdhi.c']

path = [cwd]
path += [cwd + '/config']

group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)

Return('group')
68 changes: 68 additions & 0 deletions libraries/HAL_Drivers/config/drv_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-07-29 KyleChan first version
*/

#ifndef __DRV_CONFIG_H__
#define __DRV_CONFIG_H__

#include "board.h"
#include <rtthread.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifdef SOC_SERIES_R7FA6M4
#include "ra6m4/uart_config.h"

#ifdef BSP_USING_ADC
#include "ra6m4/adc_config.h"
#endif

#ifdef BSP_USING_DAC
#include "ra6m4/dac_config.h"
#endif

#ifdef BSP_USING_PWM
#include "ra6m4/pwm_config.h"
#endif

#ifdef BSP_USING_CAN
#include "ra6m4/can_config.h"
#endif
#endif/* SOC_SERIES_R7FA6M4 */

#ifdef SOC_SERIES_R7FA2L1
#include "ra2l1/uart_config.h"

#ifdef BSP_USING_ADC
#include "ra2l1/adc_config.h"
#endif

#ifdef BSP_USING_DAC
#include "ra2l1/dac_config.h"
#endif

#ifdef BSP_USING_PWM
#include "ra2l1/pwm_config.h"
#endif

#ifdef BSP_USING_CAN
#include "ra2l1/can_config.h"
#endif
#endif/* SOC_SERIES_R7FA2L1 */




#ifdef __cplusplus
}
#endif

#endif/* __DRV_CONFIG_H__ */
41 changes: 41 additions & 0 deletions libraries/HAL_Drivers/config/ra2l1/adc_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-19 Mr.Tiger first version
*/

#ifndef __ADC_CONFIG_H__
#define __ADC_CONFIG_H__

#include <rtthread.h>
#include <rtdevice.h>
#include "hal_data.h"
#ifdef __cplusplus
extern "C" {
#endif

#if defined(BSP_USING_ADC0) || defined(BSP_USING_ADC1)
struct ra_adc_map
{
char name;
const adc_cfg_t *g_cfg;
const adc_instance_ctrl_t *g_ctrl;
const adc_channel_cfg_t *g_channel_cfg;
};

struct ra_dev
{
rt_adc_device_t ra_adc_device_t;
struct ra_adc_map *ra_adc_dev;
};
#endif
#endif

#ifdef __cplusplus
}
#endif

48 changes: 48 additions & 0 deletions libraries/HAL_Drivers/config/ra2l1/can_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-29 mazhiyuan first version
*/

#ifndef __CAN_CONFIG_H__
#define __CAN_CONFIG_H__

#include <rtthread.h>
#include "hal_data.h"

#ifdef __cplusplus
extern "C" {
#endif

#if defined(BSP_USING_CAN0)
#ifndef CAN0_CONFIG
#define CAN0_CONFIG \
{ \
.name = "can0", \
.num_of_mailboxs = CAN_NO_OF_MAILBOXES_g_can0, \
.p_api_ctrl = &g_can0_ctrl, \
.p_cfg = &g_can0_cfg, \
}
#endif /* CAN0_CONFIG */
#endif /* BSP_USING_CAN0 */

#if defined(BSP_USING_CAN1)
#ifndef CAN1_CONFIG
#define CAN1_CONFIG \
{ \
.name = "can1", \
.num_of_mailboxs = CAN_NO_OF_MAILBOXES_g_can1, \
.p_api_ctrl = &g_can1_ctrl, \
.p_cfg = &g_can1_cfg, \
}
#endif /* CAN1_CONFIG */
#endif /* BSP_USING_CAN1 */

#ifdef __cplusplus
}
#endif
#endif
41 changes: 41 additions & 0 deletions libraries/HAL_Drivers/config/ra2l1/dac_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-19 Mr.Tiger first version
*/

#ifndef __DAC_CONFIG_H__
#define __DAC_CONFIG_H__

#include <rtthread.h>
#include <rtdevice.h>
#include "hal_data.h"
#ifdef __cplusplus
extern "C" {
#endif

#ifdef BSP_USING_DAC
struct ra_dac_map
{
char name;
const struct st_dac_cfg *g_cfg;
const struct st_dac_instance_ctrl *g_ctrl;
};

struct ra_dac_dev
{
rt_dac_device_t ra_dac_device_t;
struct ra_dac_map *ra_dac_map_dev;
};
#endif

#endif

#ifdef __cplusplus
}
#endif

68 changes: 68 additions & 0 deletions libraries/HAL_Drivers/config/ra2l1/pwm_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-26 KevinXu first version
*/
#ifndef __PWM_CONFIG_H__
#define __PWM_CONFIG_H__

#include <rtthread.h>
#include <drv_config.h>
#include "hal_data.h"

#ifdef __cplusplus
extern "C" {
#endif

enum
{
#ifdef BSP_USING_PWM0
BSP_PWM0_INDEX,
#endif
#ifdef BSP_USING_PWM1
BSP_PWM1_INDEX,
#endif
#ifdef BSP_USING_PWM2
BSP_PWM2_INDEX,
#endif
#ifdef BSP_USING_PWM3
BSP_PWM3_INDEX,
#endif
#ifdef BSP_USING_PWM4
BSP_PWM4_INDEX,
#endif
#ifdef BSP_USING_PWM5
BSP_PWM5_INDEX,
#endif
#ifdef BSP_USING_PWM6
BSP_PWM6_INDEX,
#endif
#ifdef BSP_USING_PWM7
BSP_PWM7_INDEX,
#endif
#ifdef BSP_USING_PWM8
BSP_PWM8_INDEX,
#endif
#ifdef BSP_USING_PWM9
BSP_PWM9_INDEX,
#endif
BSP_PWMS_NUM
};

#define PWM_DRV_INITIALIZER(num) \
{ \
.name = "pwm"#num , \
.g_cfg = &g_timer##num##_cfg, \
.g_ctrl = &g_timer##num##_ctrl, \
.g_timer = &g_timer##num, \
}

#ifdef __cplusplus
}
#endif

#endif /* __PWM_CONFIG_H__ */
Loading

0 comments on commit fcffebb

Please sign in to comment.