Skip to content

Commit a936baf

Browse files
committed
add support for renesas ra family of mcus
Signed-off-by: Rafael Silva <[email protected]>
1 parent 2a17a7e commit a936baf

File tree

5 files changed

+75
-3
lines changed

5 files changed

+75
-3
lines changed

src/common/tusb_mcu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
#define TUP_DCD_ENDPOINT_MAX 7
237237

238238
//------------- Renesas -------------//
239-
#elif TU_CHECK_MCU(OPT_MCU_RX63X, OPT_MCU_RX65X, OPT_MCU_RX72N)
239+
#elif TU_CHECK_MCU(OPT_MCU_RX63X, OPT_MCU_RX65X, OPT_MCU_RX72N, OPT_MCU_RAXXX)
240240
#define TUP_DCD_ENDPOINT_MAX 10
241241

242242
//------------- GigaDevice -------------//

src/portable/renesas/link/dcd_link.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@
3131
// We disable SOF for now until needed later on
3232
#define USE_SOF 0
3333

34-
#if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_RX63X || CFG_TUSB_MCU == OPT_MCU_RX65X || CFG_TUSB_MCU == OPT_MCU_RX72N)
34+
#if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_RX63X || CFG_TUSB_MCU == OPT_MCU_RX65X || CFG_TUSB_MCU == OPT_MCU_RX72N || \
35+
CFG_TUSB_MCU == OPT_MCU_RAXXX)
3536

3637
#include "device/dcd.h"
3738
#include "link_type.h"
3839

3940
#if TU_CHECK_MCU(OPT_MCU_RX63X, OPT_MCU_RX65X, OPT_MCU_RX72N)
4041
#include "link_rx.h"
42+
#elif TU_CHECK_MCU(OPT_MCU_RAXXX)
43+
#include "link_ra.h"
4144
#else
4245
#error "Unsupported MCU"
4346
#endif

src/portable/renesas/link/hcd_link.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@
2727

2828
#include "tusb_option.h"
2929

30-
#if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_RX63X || CFG_TUSB_MCU == OPT_MCU_RX65X || CFG_TUSB_MCU == OPT_MCU_RX72N)
30+
#if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_RX63X || CFG_TUSB_MCU == OPT_MCU_RX65X || CFG_TUSB_MCU == OPT_MCU_RX72N || \
31+
CFG_TUSB_MCU == OPT_MCU_RAXXX)
3132

3233
#include "host/hcd.h"
3334
#include "link_type.h"
3435

3536
#if TU_CHECK_MCU(OPT_MCU_RX63X, OPT_MCU_RX65X, OPT_MCU_RX72N)
3637
#include "link_rx.h"
38+
#elif TU_CHECK_MCU(OPT_MCU_RAXXX)
39+
#include "link_ra.h"
3740
#else
3841
#error "Unsupported MCU"
3942
#endif

src/portable/renesas/link/link_ra.h

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2022 Rafael Silva (@perigoso)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*
24+
* This file is part of the TinyUSB stack.
25+
*/
26+
27+
#ifndef _LINK_RA_H_
28+
#define _LINK_RA_H_
29+
30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
34+
#include "link_type.h"
35+
36+
/* renesas fsp api */
37+
#include "bsp_api.h"
38+
39+
#define LINK_REG_BASE (0x40090000)
40+
41+
TU_ATTR_ALWAYS_INLINE
42+
static inline void link_int_enable(uint8_t rhport)
43+
{
44+
(void) rhport;
45+
NVIC_EnableIRQ(TU_IRQn);
46+
}
47+
48+
TU_ATTR_ALWAYS_INLINE
49+
static inline void link_int_disable(uint8_t rhport)
50+
{
51+
(void) rhport;
52+
NVIC_DisableIRQ(TU_IRQn);
53+
}
54+
55+
// MCU specific PHY init
56+
static inline void link_phy_init(void)
57+
{
58+
}
59+
60+
#ifdef __cplusplus
61+
}
62+
#endif
63+
64+
#endif /* _LINK_RA_H_ */

src/tusb_option.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ typedef int make_iso_compilers_happy ;
127127
#define OPT_MCU_RX63X 1400 ///< Renesas RX63N/631
128128
#define OPT_MCU_RX65X 1401 ///< Renesas RX65N/RX651
129129
#define OPT_MCU_RX72N 1402 ///< Renesas RX72N
130+
#define OPT_MCU_RAXXX 1403 ///< Renesas RAxxx families
131+
130132

131133
// Mind Motion
132134
#define OPT_MCU_MM32F327X 1500 ///< Mind Motion MM32F327

0 commit comments

Comments
 (0)