| 1 |
/* |
| 2 |
* The MIT License (MIT) |
| 3 |
* |
| 4 |
* Copyright (c) 2021 Renesas Electronics Corporation |
| 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 |
|
| 25 |
#ifndef PORTS_RA_RA_RA_SCI_H_ |
| 26 |
#define PORTS_RA_RA_RA_SCI_H_ |
| 27 |
|
| 28 |
#include <stdint.h> |
| 29 |
|
| 30 |
#define RA_SCI_FLOW_START_NUM (16) |
| 31 |
|
| 32 |
typedef int (*SCI_CB)(uint32_t ch, uint32_t d); |
| 33 |
|
| 34 |
// static bool find_irq_to_ch(IRQn_Type *irq_tbl, IRQn_Type irq, uint32_t *ch); |
| 35 |
// static void delay_us(volatile unsigned int us); |
| 36 |
bool ra_af_find_ch_af(ra_af_pin_t *af_pin, uint32_t size, uint32_t pin, uint32_t *ch, uint32_t *af); |
| 37 |
// static void ra_sci_tx_set_pin(uint32_t pin); |
| 38 |
// static void ra_sci_rx_set_pin(uint32_t pin); |
| 39 |
// static void ra_sci_cts_set_pin(uint32_t pin); |
| 40 |
// static void ra_sci_module_start(uint32_t ch); |
| 41 |
// static void ra_sci_module_stop(uint32_t ch); |
| 42 |
void ra_sci_rx_set_callback(int ch, SCI_CB cb); |
| 43 |
// static void ra_sci_irq_disable(uint32_t ch); |
| 44 |
// static void ra_sci_irq_enable(uint32_t ch); |
| 45 |
void ra_sci_rxirq_disable(uint32_t ch); |
| 46 |
void ra_sci_rxirq_enable(uint32_t ch); |
| 47 |
bool ra_sci_is_rxirq_enable(uint32_t ch); |
| 48 |
// static void ra_sci_irq_priority(uint32_t ch, uint32_t ipl); |
| 49 |
// static void ra_sci_isr_rx(uint32_t ch); |
| 50 |
// static void ra_sci_isr_er(uint32_t ch); |
| 51 |
// static void ra_sci_isr_tx(uint32_t ch); |
| 52 |
void ra_sci_isr_te(uint32_t ch); |
| 53 |
int ra_sci_rx_ch(uint32_t ch); |
| 54 |
int ra_sci_rx_any(uint32_t ch); |
| 55 |
int ra_sci_tx_busy(uint32_t ch); |
| 56 |
int ra_sci_tx_bufsize(uint32_t ch); |
| 57 |
void ra_sci_tx_ch(uint32_t ch, int c); |
| 58 |
int ra_sci_tx_wait(uint32_t ch); |
| 59 |
void ra_sci_tx_break(uint32_t ch); |
| 60 |
void ra_sci_tx_str(uint32_t ch, uint8_t *p); |
| 61 |
// static void ra_sci_fifo_set(sci_fifo *fifo, uint8_t *bufp, uint32_t size); |
| 62 |
void ra_sci_txfifo_set(uint32_t ch, uint8_t *bufp, uint32_t size); |
| 63 |
void ra_sci_rxfifo_set(uint32_t ch, uint8_t *bufp, uint32_t size); |
| 64 |
// static void sci_fifo_init(uint32_t ch); |
| 65 |
void ra_sci_set_baud(uint32_t ch, uint32_t baud); |
| 66 |
void ra_sci_init_with_flow(uint32_t ch, uint32_t tx_pin, uint32_t rx_pin, uint32_t baud, uint32_t bits, uint32_t parity, uint32_t stop, uint32_t flow, uint32_t cts_pin, uint32_t rts_pin); |
| 67 |
void ra_sci_init(uint32_t ch, uint32_t tx_pin, uint32_t rx_pin, uint32_t baud, uint32_t bits, uint32_t parity, uint32_t stop, uint32_t flow); |
| 68 |
void ra_sci_deinit(uint32_t ch); |
| 69 |
void sci_uart_rxi_isr(void); |
| 70 |
void sci_uart_txi_isr(void); |
| 71 |
void sci_uart_eri_isr(void); |
| 72 |
void sci_uart_tei_isr(void); |
| 73 |
|
| 74 |
#endif /* PORTS_RA_RA_RA_SCI_H_ */ |