Skip to content

Commit 077a0c0

Browse files
Phi Tranquytranpzz
authored andcommitted
drivers: uart: Update sci uart for support RX261
This commit to update sci uart for support RX261 Signed-off-by: Phi Tran <phi.tran.jg@bp.renesas.com>
1 parent 1864c4c commit 077a0c0

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

drivers/serial/uart_renesas_rx_sci.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
#include <zephyr/spinlock.h>
1515

1616
#include "r_sci_rx_if.h"
17+
#include "iodefine_sci.h"
1718

1819
#if CONFIG_SOC_SERIES_RX130
1920
#include "r_sci_rx130_private.h"
21+
#elif CONFIG_SOC_SERIES_RX261
22+
#include "r_sci_rx261_private.h"
2023
#else
2124
#error Unknown SOC, not (yet) supported.
2225
#endif
@@ -68,7 +71,7 @@ struct uart_rx_sci_data {
6871

6972
static int uart_rx_sci_poll_in(const struct device *dev, unsigned char *c)
7073
{
71-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
74+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
7275

7376
if (IS_ENABLED(CONFIG_UART_ASYNC_API) && sci->SCR.BIT.RIE) {
7477
return -EBUSY;
@@ -86,7 +89,7 @@ static int uart_rx_sci_poll_in(const struct device *dev, unsigned char *c)
8689

8790
static void uart_rx_sci_poll_out(const struct device *dev, unsigned char c)
8891
{
89-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
92+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
9093

9194
while (sci->SSR.BIT.TEND == 0U) {
9295
}
@@ -96,7 +99,7 @@ static void uart_rx_sci_poll_out(const struct device *dev, unsigned char c)
9699

97100
static int uart_rx_err_check(const struct device *dev)
98101
{
99-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
102+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
100103

101104
const uint32_t status = sci->SSR.BYTE;
102105
int errors = 0;
@@ -227,7 +230,7 @@ static int uart_rx_config_get(const struct device *dev, struct uart_config *cfg)
227230

228231
static int uart_rx_fifo_fill(const struct device *dev, const uint8_t *tx_data, int size)
229232
{
230-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
233+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
231234
uint8_t num_tx = 0U;
232235

233236
if (size > 0 && sci->SSR.BIT.TDRE) {
@@ -240,7 +243,7 @@ static int uart_rx_fifo_fill(const struct device *dev, const uint8_t *tx_data, i
240243

241244
static int uart_rx_fifo_read(const struct device *dev, uint8_t *rx_data, const int size)
242245
{
243-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
246+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
244247
uint8_t num_rx = 0U;
245248

246249
if (size > 0 && sci->SSR.BIT.RDRF) {
@@ -254,7 +257,7 @@ static int uart_rx_fifo_read(const struct device *dev, uint8_t *rx_data, const i
254257
static void uart_rx_irq_tx_enable(const struct device *dev)
255258
{
256259
struct uart_rx_sci_data *data = dev->data;
257-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
260+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
258261

259262
sci->SCR.BYTE |= (BIT(R_SCI_SCR_TIE_Pos) | BIT(R_SCI_SCR_TEIE_Pos));
260263
irq_enable(data->tei_irq);
@@ -274,44 +277,44 @@ static void uart_rx_irq_tx_enable(const struct device *dev)
274277
static void uart_rx_irq_tx_disable(const struct device *dev)
275278
{
276279
struct uart_rx_sci_data *data = dev->data;
277-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
280+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
278281

279282
sci->SCR.BYTE &= ~(BIT(R_SCI_SCR_TIE_Pos) | BIT(R_SCI_SCR_TEIE_Pos));
280283
irq_disable(data->tei_irq);
281284
}
282285

283286
static int uart_rx_irq_tx_ready(const struct device *dev)
284287
{
285-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
288+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
286289

287290
return (sci->SCR.BIT.TIE == 1U) &&
288291
(sci->SSR.BYTE & (BIT(R_SCI_SSR_TDRE_Pos) | BIT(R_SCI_SSR_TEND_Pos)));
289292
}
290293

291294
static int uart_rx_irq_tx_complete(const struct device *dev)
292295
{
293-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
296+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
294297

295298
return (sci->SCR.BIT.TEIE == 1U) && (sci->SSR.BYTE & BIT(R_SCI_SSR_TEND_Pos));
296299
}
297300

298301
static void uart_rx_irq_rx_enable(const struct device *dev)
299302
{
300-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
303+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
301304

302305
sci->SCR.BIT.RIE = 1U;
303306
}
304307

305308
static void uart_rx_irq_rx_disable(const struct device *dev)
306309
{
307-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
310+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
308311

309312
sci->SCR.BIT.RIE = 0U;
310313
}
311314

312315
static int uart_rx_irq_rx_ready(const struct device *dev)
313316
{
314-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
317+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
315318

316319
return (sci->SCR.BIT.RIE == 1U) && ((sci->SSR.BYTE & BIT(R_SCI_SSR_RDRF_Pos)));
317320
}
@@ -332,7 +335,7 @@ static void uart_rx_irq_err_disable(const struct device *dev)
332335

333336
static int uart_rx_irq_is_pending(const struct device *dev)
334337
{
335-
volatile struct st_sci0 *sci = (struct st_sci0 *)DEV_BASE(dev);
338+
volatile struct st_sci *sci = (struct st_sci *)DEV_BASE(dev);
336339
bool tx_pending = false;
337340
bool rx_pending = false;
338341

@@ -483,7 +486,6 @@ static void uart_rx_sci_eri_isr(const struct device *dev)
483486
#define UART_RX_SCI_IRQ_INIT(index)
484487
#endif
485488

486-
487489
#define UART_RX_INIT(index) \
488490
PINCTRL_DT_DEFINE(DT_INST_PARENT(index)); \
489491
\

0 commit comments

Comments
 (0)