Skip to content

Commit 700dced

Browse files
quytranpzzKhiemNguyenT
authored andcommitted
hal: renesas: rx: Add LVD HAL support for RX130
Add LVD HAL support for RX130 with r_lvd_rx RDP Signed-off-by: Quy Tran <[email protected]>
1 parent 26bcf66 commit 700dced

File tree

8 files changed

+3000
-0
lines changed

8 files changed

+3000
-0
lines changed

drivers/rx/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,14 @@ if(CONFIG_USE_RX_RDP_IWDT)
125125
rdp/src/r_iwdt_rx/src/r_iwdt_rx.c
126126
)
127127
endif()
128+
129+
if(CONFIG_USE_RX_RDP_LVD)
130+
zephyr_library_sources(
131+
rdp/src/r_lvd_rx/src/r_lvd_rx_hw.c
132+
rdp/src/r_lvd_rx/src/r_lvd_rx.c
133+
)
134+
zephyr_include_directories(
135+
rdp/src/r_lvd_rx
136+
rdp/src/r_lvd_rx/src
137+
rdp/src/r_lvd_rx/src/targets/${CONFIG_SOC_SERIES})
138+
endif()
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/***********************************************************************************************************************
2+
* Copyright (c) 2016 - 2025 Renesas Electronics Corporation and/or its affiliates
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
***********************************************************************************************************************/
6+
/***********************************************************************************************************************
7+
* File Name : r_lvd_rx_if.h
8+
* Description : Functions for using LVD on RX devices.
9+
***********************************************************************************************************************/
10+
/***********************************************************************************************************************
11+
* History : DD.MM.YYYY Version Description
12+
* : 15.06.2016 2.00 First Release
13+
* : 01.10.2016 2.10 Deleted Tool-Chain version.
14+
* : 19.12.2016 2.20 Added support for RX24U, RX24T(512KB).
15+
* : Deleted unnecessary header information.
16+
* : 09.06.2017 2.30 Added support for RX130-512K, RX65N-2M.
17+
* : 28.09.2018 2.40 Added support for RX66T.
18+
* : 01.02.2019 2.50 Added support for RX72T, RX65N-64pin.
19+
* : 20.05.2019 3.00 Added support for GNUC and ICCRX.
20+
* : 31.03.2023 4.40 Fixed to comply with GSCE Coding Standards Rev.6.5.0.
21+
* : 28.06.2024 4.80 Fixed to comply with GSCE Coding Standards Rev.6.5.0.
22+
* : 15.03.2025 4.81 Updated disclaimer.
23+
***********************************************************************************************************************/
24+
#ifndef LVD_INTERFACE_HEADER_FILE
25+
#define LVD_INTERFACE_HEADER_FILE
26+
27+
/***********************************************************************************************************************
28+
Includes <System Includes> , "Project Includes"
29+
***********************************************************************************************************************/
30+
/* Includes board and MCU related header files. */
31+
#include "platform.h"
32+
33+
/***********************************************************************************************************************
34+
Macro definitions
35+
***********************************************************************************************************************/
36+
37+
#if R_BSP_VERSION_MAJOR < 5
38+
#error "This module must use BSP module of Rev.5.00 or higher. Please use the BSP module of Rev.5.00 or higher."
39+
#endif
40+
41+
/***********************************************************************************************************************
42+
Typedef definitions
43+
***********************************************************************************************************************/
44+
45+
/* This section describes return values which can be used with the LVD FIT module. */
46+
typedef enum
47+
{
48+
LVD_SUCCESS = 0,
49+
LVD_ERR_INVALID_PTR,
50+
LVD_ERR_INVALID_FUNC,
51+
LVD_ERR_INVALID_DATA,
52+
LVD_ERR_INVALID_CHAN,
53+
LVD_ERR_INVALID_ARG,
54+
LVD_ERR_UNSUPPORTED,
55+
LVD_ERR_ALREADY_OPEN,
56+
LVD_ERR_NOT_OPENED,
57+
LVD_ERR_LOCO_STOPPED
58+
} lvd_err_t;
59+
60+
/* This enum defines channels that can be used with the MCU. */
61+
typedef enum
62+
{
63+
LVD_CHANNEL_1 = 0,
64+
LVD_CHANNEL_2,
65+
LVD_CHANNEL_INVALID
66+
} lvd_channel_t;
67+
68+
/* This enum defines voltage detection conditions and influences interrupt conditions and the LVD status. A reset */
69+
/* occurs when the monitored voltage is below the voltage detection level, thus it is not influenced by this enum. */
70+
typedef enum
71+
{
72+
LVD_TRIGGER_RISE = 0,
73+
LVD_TRIGGER_FALL,
74+
LVD_TRIGGER_BOTH,
75+
LVD_TRIGGER_INVALID
76+
}lvd_trigger_t;
77+
78+
/* This enum defines the status whether the monitored voltage is above or below the voltage detection level. */
79+
typedef enum
80+
{
81+
LVD_STATUS_POSITION_ABOVE = 0,
82+
LVD_STATUS_POSITION_BELOW,
83+
LVD_STATUS_POSITION_INVALID
84+
}lvd_status_position_t;
85+
86+
/* This enum defines whether the voltage crossed the voltage detection level. */
87+
typedef enum
88+
{
89+
LVD_STATUS_CROSS_NONE = 0,
90+
LVD_STATUS_CROSS_OVER,
91+
LVD_STATUS_CROSS_INVALID
92+
}lvd_status_cross_t;
93+
94+
/* This data structure defines the structure which is sent to the R_LVD_Open() function. */
95+
typedef struct
96+
{
97+
lvd_trigger_t trigger;
98+
}lvd_config_t;
99+
100+
/* This data structure defines the structure which is sent to the callback function. */
101+
typedef struct
102+
{
103+
bsp_int_src_t vector;
104+
} lvd_int_cb_args_t;
105+
106+
/***********************************************************************************************************************
107+
Imported global variables and functions (from other files)
108+
***********************************************************************************************************************/
109+
extern lvd_err_t R_LVD_Open (lvd_channel_t channel, lvd_config_t const *p_cfg, void (*p_callback)(void *));
110+
extern lvd_err_t R_LVD_Close (lvd_channel_t channel);
111+
extern lvd_err_t R_LVD_GetStatus (lvd_channel_t channel,
112+
lvd_status_position_t * p_status_position,
113+
lvd_status_cross_t * p_status_cross);
114+
extern lvd_err_t R_LVD_ClearStatus (lvd_channel_t channel);
115+
extern uint32_t R_LVD_GetVersion (void);
116+
117+
/***********************************************************************************************************************
118+
Exported global variables and functions (to be accessed by other files)
119+
***********************************************************************************************************************/
120+
121+
#endif /* LVD_INTERFACE_HEADER_FILE */
122+
123+
/* End of File */
124+

0 commit comments

Comments
 (0)